PrincetonUniversity / SPEC

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

Matlab update #169

Closed abaillod closed 11 months ago

abaillod commented 2 years ago

I updated the matlab tools with my own subroutines. I did some cleanup, and added the routine "SPEC_Namelist" which allows you to read, edit, and write SPEC input files, as well as plot the initial guess.

I think it is safe to merge, since I didn't touch SPEC source, only the matlab tools. Let me know if you find a bug or if a feature is missing!

jloizu commented 2 years ago

I started testing these updated tools.

abaillod commented 2 years ago

Thanks for testing!

I don't see the problematic line you are talking about in get_spec_jacobian.m. In the latest version of the matlab_update branch, line 26 is https://github.com/PrincetonUniversity/SPEC/blob/1e6331f0de3539ab46ad73c3e824f0a31447ce3d/Utilities/matlabtools/get_spec_jacobian.m#L25-L32

Regarding the SPEC_Namelist; you can just do

nm = SPEC_Namelist('input.sp')

Then you can do nm. and double tabs to see all methods associated to SPEC_Namelist. Use the help to print some information about each element of the class:

>> nm = SPEC_Namelist('final.sp');
>> nm.
change_boundary_representation  lists                           plot_initial_guess              truncate_fourier_series         
diagnosticslist                 locallist                       plot_plasma_boundary            write_input_file                
get_fourier_harmonics           numericlist                     read_initial_guess              
globallist                      physicslist                     screenlist                      
initial_guess                   plot_computational_boundary     set_fourier_harmonics           
>> help nm.truncate_fourier_series
--- help for SPEC_Namelist/truncate_fourier_series ---

  TRUNCATE_FOURIER_SERIES( MPOL, NTOR )
  =====================================

  Truncates all spectral quantities to the requested poloidal
  and toroidal resolution

  INPUTS
  ------
    -Mpol: Poloidal resolution
    -Ntor: Toroidal resolution

  OUTPUT
  ------
    -OBJ: Truncated instance of SPEC_Namelist

I should probably write a tutorial for this class; I will write one down this week.

jloizu commented 2 years ago

OK the problem with the jacobian was related to internal file conflicts I had not resolved myself.

One small issue: the routine plot_spec_poincare.m is not consistent between arguments and help – please explain in the help what is varargin.

jloizu commented 2 years ago

Another issue: when running plot_spec_modB_boundary.m, I get an error message "Error using get_spec_R_derivatives, Too many output arguments".

abaillod commented 2 years ago

I pushed a new commit.

Regarding your error in plot_spec_modB_boundary, I don't have it. Is it possible that you have another internal file conflict?

jloizu commented 2 years ago

OK so my internal conflicts were finally solved (thanks!).

I found some bugs in a number of routines, and fixed them, and pushed changes – please check.

Doxygen automatic testing seems to fail  – please have a look.

After that, we'll be almost ready to merge!

jonathanschilling commented 2 years ago

@jloizu I fixed the doxygen version in the master branch, but currently it fails due to some "$" in the comments which confuse LaTeX when generating the PDF version of the documentation.

abaillod commented 1 year ago

Sorry this thing completely got out of my mind.

I tested most of the plotting routines and everything seems to be fine on my side. I vote for a merge!

zhisong commented 1 year ago

Does anyone know what happens to the cmake tests? They seem to fail since 4 months ago.

jonathanschilling commented 1 year ago

Does anyone know what happens to the cmake tests? They seem to fail since 4 months ago.

Seems due to pip being to old on the provided docker image (see https://stackoverflow.com/a/63457606). Fixed now.

jonathanschilling commented 1 year ago

I vote for a merge!

Me too :-)

smiet commented 1 year ago

There seemed widespread agreement on merging this with master, but this was never completed. I am re-triggering the checks and waiting for 24 hours, if nobody objects, I will merge this into master.