PrincetonUniversity / SPEC

The Stepped-Pressure Equilibrium Code, an advanced MRxMHD equilibrium solver.
https://princetonuniversity.github.io/SPEC/
GNU General Public License v3.0
25 stars 6 forks source link

Straight field line #168

Closed abaillod closed 2 years ago

abaillod commented 2 years ago

Hi!

This is a quick change to add the straight field line transformation to the output of SPEC. The straight field line angle will be evaluated and outputted if the new input flag Ltransform is set to true in the diagnosticslist namelist. The flag is set to false by default.

It seems that all the ci tests went through successfully. If you want to test it, just take any input file and add the line

Ltransform = T

to the diagnosticslist.

jloizu commented 2 years ago

I tested the branch, and compilation/execution works fine, but if I compare the m=n=0 mode of lambda to iota from field line tracing (or to the iota constraint on the surface), it does not match at all surfaces.

Running the testcase G3V02L1Fi.001.sp gives for the lowest mode (0,0) on the two interfaces

lambda = 0.28... lambda = 0.24...

while iota is, on these surfaces

iota = 0.28... iota = 0.30...

so there is a mismatch on the outer (?) interface, I think.

abaillod commented 2 years ago

Thank you for testing!

I think this is related to the Poincare resolution you are using. What did you use for nPpts? On my machine, if I use nPpts=200 I get a similar mismatch, but for nPpts=1000 I get the same result.

I also noticed a bug when running on multiple CPUs - I don't get the same result than if I run with a single CPU... I will debug this tomorrow.

jloizu commented 2 years ago

Actually the Poincaré resolution does not change anything, since what I am really comparing is lambda to the constraint in iota. Namely, we run SPEC with Lconstraint=1, and the iota constraint on the interfaces is iota = 0.28... iota = 0.30... which also matches the values obtained from Poincaré, but that is not important. However, the values of lambda are lambda = 0.28... lambda = 0.24... But I was running with 2 cpus, so that might be the reason, since you reported an mpi-related bug. OK I just checked and running with 1 cpu also gives a discrepancy (the same).

abaillod commented 2 years ago

I think I fixed it - at least it works on my machine. Could you try again, once you have the time? Thanks!

jloizu commented 2 years ago

It works now, well done!