Repository navigation
Conversation
…zphifun grad(zeta) update For fast-ion calculations a divergence-free perturbed field can matter. With reg_flag=t the psi,theta grid output field is not divergence-free, so a new output option reg_div_flag (default f) damps only the (n,m) projection of (bwt,bwz) in gpout_xbrzphifun, which keeps div b = 0; bwp, xi and all other outputs are unchanged. gpout_arzphifun now takes the grad(zeta) components w(3,1:2) from the chain rule through grad(psi) and grad(theta), as in gpeq.f, so that curl A is consistent with the xbrzphifun field. input/gpec.in template updated.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GPEC - ENHANCEMENT - div-free option for psi,theta grid fields and arzphifun grad(zeta) update
For fast-ion calculations a divergence-free perturbed field can matter, so this adds an output option for that and makes the flux-grid vector potential consistent with it. Both changes are output-only (
gpout_xbrzphifun,gpout_arzphifun);reg_div_flagdefaults tof, with it off the outputs are identical todevelop.1.
gpout_arzphifun: grad(zeta) componentsw(3,1:2)gpeq.f(l.757-761) computes the poloidal components of grad(zeta) asgpout_arzphifunusedw(3,1)=2*rfac*dphi_psi,w(3,2)=dphi_theta/(2*pi*rfac)instead. This PR implements the same quantity there through thew(1,:),w(2,:)already in the routine (sign opposite togpeq.fbecausearzphifunapplies it with a minus):Check (KSTAR n=1, psi_N < 0.4): curl(a) vs
xbrzphifunb_R / b_z = 168 % / 46 % before, 0.25 % / 0.14 % after; a_phi unchanged.2.
reg_div_flag: the regularized field is not divergence-freeIssue: with
reg_flag=tthe output field (b_R, b_z, b_phi) does not satisfy div b = 0. The regularization damps bmt and bmz but not bwp, and div b = 0 tiesm*bwt - n*bwztod(bwp)/dpsi. On thepsi,thetagrid the b_phi implied by div b = 0 from (b_R, b_z) differs from the output b_phi by ~15 % pointwise near the rational surfaces (4 % numerical floor withreg_flag=f).reg_div_flag=t(defaultf) lets the user choose, at output time ingpout_xbrzphifunonly, a regularization that keeps div b = 0: only the (n,m) projection of (bwt, bwz) is damped,so
m*bmt - n*bmzis unchanged. bwp, xi and all other outputs are untouched. Check: pointwise mismatch 0.147 -> 0.044 (= reg-off floor), xi identical, fields finite in the bands.Files
gpec/gpout.f(fix + flag block),gpec/gpglobal.F,gpec/gpec.f(flag),input/gpec.in. Built frominstall/with ifort; added fixed-format lines <= 72 columns. The same approximation also appears ingpdiag_singcurs(gpdiag.f l.476, 502) — not touched here.