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

Additional python tools #183

Closed abaillod closed 1 year ago

abaillod commented 2 years ago

Hi!

This branch started as a fix to an issue in the python tools (how Nvol was managed in spec_namelist), and then I started adding some useful routines to SPECout.

I also made a small fix in SPEC final diagnostics. I thought it could be useful to have the Btemn, Btomn, ... harmonics on the computational boundary, so I changed the logic in line 879 or src/xspech.f90.

I think we can safely merge this, I did not touch the core of SPEC.

abaillod commented 1 year ago

Hi,

Could we merge these small changes? These are mainly new routines for the python tools.

The automatic tests seem to be failing because the docker container did not install scipy. I don't know how to fix this...

zhucaoxiang commented 1 year ago

I think I fixed the scipy error. But now we got CI errors like

ERROR: Btemn , element average difference =  9.07119E-02
ERROR: Btomn , element average difference =  2.14677E-02
ERROR: Bzemn , element average difference =  1.10917E+01
ERROR: Bzomn , element average difference =  1.06942E+00
abaillod commented 1 year ago

Thank you!

I will look into the Btemn error.

abaillod commented 1 year ago

I solved the Btemn bug; I think it is ready to be merged.

zhisong commented 1 year ago

This is OK but your RK4 will fail. The right-hand side will be e.g. Bt/Bz -> infinity. Maybe there is a way to quit the integration but not throw an error. Anyway, unless you are dealing with RFP, if the problem is triggered it means the calculation is really fishy.

zhisong commented 1 year ago

You should also change the version of py_spec or it will not get updated on PYPI. You should find the version number in __init__.py.

abaillod commented 1 year ago

This is OK but your RK4 will fail. The right-hand side will be e.g. Bt/Bz -> infinity. Maybe there is a way to quit the integration but not throw an error. Anyway, unless you are dealing with RFP, if the problem is triggered it means the calculation is really fishy.

I agree. Maybe the best is to keep the FATALstatement, and change in a later commit the behavior of the integrator when this test is triggered. I will revert it.

abaillod commented 1 year ago

If there are no more comments, I will merge this branch by the end of the day. Thank you for your reviews!