Commit Graph

8 Commits

Author SHA1 Message Date
Michele Guerini Rocco
72eb224568
remove unnecessary deallocations
1. Local variables are automatically deallocated when they go out of
   scope.

2. When calling exit() during CLI processing some stuff wasn't being
   deallocated, but it doesnt matter because the OS does it anyway.
   So, get rid of it entirely.
2024-11-04 12:05:50 +01:00
Michele Guerini Rocco
e9e3a4d697
src/gray_equil.f90: fix compilation on intel compilers 2024-11-04 12:05:45 +01:00
Michele Guerini Rocco
7477fffb43
move flux averages inside gray_equil 2024-11-04 12:00:20 +01:00
Michele Guerini Rocco
8c144c3892
make the sign of q consistent with cocos=3 2024-11-04 12:00:20 +01:00
Michele Guerini Rocco
fdf5ef72fe
src/magsurf_data.f90: cleanup 2024-11-04 12:00:20 +01:00
Michele Guerini Rocco
d5c81268de
src/utils.f90: clean up
- Replace the `get_free_unit` subroutine with the built-in
  `newutin` option of the `open` statement.

- Replace `locatex` with just `locate` + an index offset.

- Replace `inside` with `contour%contains`.

- Merge `vmaxmin` and `vmaxmini` into a single subroutine
  with optional arguments.

- Remove unused `range2rect`, `bubble`.
2024-11-03 09:19:21 +01:00
Michele Guerini Rocco
751cca3bfc
mark some procedures as pure 2024-11-03 09:19:18 +01:00
Michele Guerini Rocco
166086d369
replace equilibrium module with an object
Similarly to eb648039 this change replaces the `equilibrium` module with
a new `gray_equil` module providing the same functionality without using
global variables.

  - `read_eqdsk`, `read_equil_an` are replaced by a single `load_equil`
    routine that handles all equilibrium kind (analytical, numerical,
    and vacuum).

  - `scale_equil` is merged into `load_equil`, which besides reading
    the equilibrium from file peforms the rescaling and interpolation based
    on the `gray_parameters` settings and the equilibrium kind.

    To operate on G-EQDSK data specifically, the `change_cocors` and
    `scale_eqdsk` are still available. The numeric equilibrium must then
    be initialised manually by calling equil%init().

  - `set_equil_spline`, `set_equil_an`, `unset_equil_spline`
     are completely removed as the module no longer has any internal state.

  - `fq` is replaced by `equil%safety`; `bfield` by `equil%b_field`;
    `frhotor`, `frhopol` by `equil%pol2tor` and `equil%pol2tor`;
    and the remaining subroutines by other methods of `abstract_equil`
    retaining the old name.

  - the `contours_psi` subroutine is replaced by `equil%flux_contour`,
    with a slightly changed invocation but same functionality.

  - the `gray_data` type is no longer required ans has been removed: all
    the core subroutines now access the input data only though either
    `abstract_equil`, `abstract_plasma` or the `limiter` contour.
2024-11-03 09:18:33 +01:00