Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable XMH geometry for TGLF in TGYRO runs #434

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Conversation

halpernf
Copy link
Contributor

@halpernf halpernf commented Jan 9, 2025

The following changes have been made

  • Add an input parameter tgyro_tglf_geometry_flag in tgyro inputs
  • Transfer the existing XMH coefficients from tgyro to tglf in tgyro_tglf_map if new input flag is set to 4

tgyro_tglf_geometry_flag has default 1 to preserve backwards compatibility.

…m TGYRO into TGLF, using a new integer input tgyro_tglf_geometry_flag ( == 1 for Miller geometry (default), == 4 for XMH geometry )
@halpernf halpernf requested a review from jmcclena January 9, 2025 20:31
@jcandy
Copy link
Member

jcandy commented Jan 10, 2025

Thanks Federico!

Would it be better to call this TGYRO_TGLF_MXH_FLAG?

@halpernf
Copy link
Contributor Author

Would it be better to call this TGYRO_TGLF_MXH_FLAG?

My original idea was to subsequently add a geometry_flag=4 option in tglf for XMH vs the current approach. Right now, XMH is on by default on standalone TGLF with geometry_flag=1, not backwards compatible.

Hence the name tgyro_tglf_geometry_flag

Maybe an even better idea is to match what neo and cgyro are doing at the moment. I'm happy to make modifications as people prefer.

@gmstaebler
Copy link
Member

I am not sure a new flag is needed unless you want to have TGYRO reduce the XHM shape functions to the standard Miller (i.e. zero the extra ones) before calling tglf. I guess if the default is for all of the shape coefficients to be computed then it would be necessary to use this flag to recover the original Miller. Note that standard Miller has zmaj_loc=0, dzmajdx_loc=0 , zeta_loc=0 and zeta_s_loc=0. These were added by Jeff before XHM so there are really three version of Miller.

@jcandy
Copy link
Member

jcandy commented Jan 13, 2025

@halpernf @gmstaebler

I would like to have you both agree about these changes, at least so you both know exactly what the new behaviour will be. I am happy with whatever is agreed upon.

@halpernf
Copy link
Contributor Author

I am not sure a new flag is needed unless you want to have TGYRO reduce the XHM shape functions to the standard Miller (i.e. zero the extra ones) before calling tglf.

@gmstaebler that was my original idea -- the TGYRO regression tests are converging more slowly with the XHM shape functions. My concern is whether existing TGYRO+TGLF workflows would be disrupted by this upgrade. I'm inclined to at least have a parameter to preserve the existing behavior. Let me know what you prefer, also a shoutout @tomneiser who is another TGYRO/TGLF user. I'm happy to go with the flow

jmcclena
jmcclena previously approved these changes Jan 14, 2025
Copy link
Contributor

@jmcclena jmcclena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, other than the discussion of tglf geometry variable flag names which I have no strong feeling one way or the other.

@gmstaebler
Copy link
Member

It is good to be able to recover the previous default. The way I had miller_geo set up in TGLF before the XHM was added set zmaj_loc and dzmaj_dx_loc to zero. This should be done to the inputs from TGYRO as well as zeroing the shape and shape_s functions if the flag is set.

@gmstaebler
Copy link
Member

to be clear the TGYRO flag TGYRO_TGLF_MXH_FLAG would be 1 if you want to use XHM and 0 if you want the previous Miller model. The coding in tgyro_tglf_map.f90 would need to be added to cover these options.

@halpernf
Copy link
Contributor Author

halpernf commented Jan 17, 2025

to be clear the TGYRO flag TGYRO_TGLF_MXH_FLAG would be 1 if you want to use XHM and 0 if you want the previous Miller model. The coding in tgyro_tglf_map.f90 would need to be added to cover these options.

Changed the TGYRO inputs so that it follows the behavior preferred by Gary

  • Use previous Miller model with TGYRO_TGLF_MXH_FLAG=0 (default)
  • Use MXH model with TGYRO_TGLF_MXH_FLAG=1

Last comment: only harmonics up to sin3/cos3 are included in TGYRO, but can be added easily

@jcandy jcandy merged commit 29268b4 into master Jan 17, 2025
0 of 3 checks passed
@jcandy
Copy link
Member

jcandy commented Jan 17, 2025

It would make the formulation more elegant if someday we could replace triangularity and squareness with s1 and s2 (now, delta = sin(s1) and zeta = -s2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants