-
Notifications
You must be signed in to change notification settings - Fork 5
Description
The variable isgn in the Vacuum code is currently very esoteric and needs a rework, specifically:
- Renaming the variable entirely, something like
outward_normal_sign - Add documentation for what it does and why it is there
- I think its use can also be simplified. Right now, it multiplies all entries into the gradient Green's function except for two occasions, when the wall x point < 0 and when adding the residue term. I think this could just be turned into an element-wise multiplication of the entire grad green block at the end of the function, taking special care for the sign of these cases. Note @logan-nc's comment here, where the case of the wall x points < 0 doesn't make sense. Perhaps that will get deprecated in a future PR anyway.
@jhalpern30's explanation of isgn (more or less correct, may not be 100%)
"the surface integrals from Green's identity (eq. 20) pop out a unit normal, which we interpret as the outward unit normal defined relative to the integration volume, which is the plasma -> wall region, and needs to be consistent over S = union of the plasma and wall surfaces. This unit normal is J * grad Psi, which always points outward in the direction of decreasing Psi. So on the plasma surface, you need a minus sign such that it points inward (which is the outward normal relative to the integration region). And for an outward unit normal on the wall, you use the plus such that it points outward (again, the outward normal of the integration region). This appears for only the grad green matrix in kernel since its dotted with the normal (eq. 21), but not in the regular green matrix because the normal gets dotted with grad chi instead (this might get handled implicitly or elsewhere in the code)"