The dist_fn module is too large and contains too many different things
The dist_fn module is rather large and contains a wide range of different things including:
- Key calculations of the basic physics properties, velocities etc.
- The main time advance calculation
- Flow shear advection
- Parallel boundary conditions
- The source terms and related arrays
- The field equations calculation
- Moments and related diagnostics.
To make the code more accessible and flexible I propose we split some of this code into other modules.
In particular here I would like to move the moments and related diagnostics and the field equation calculations into their own module. This might have some impact on the planned merging of diagnostics (just in terms of structure).
I propose creating a dist_fn_moments
module and a field_equations
module.
We might also want to consider splitting things further.
Comments (5)
-
reporter -
reporter Some issues with moving the field equations code is that it depends on things like the adiabatic option and parallel boundary condition options in places. These currently belong to dist_fn_knobs namelist. Some of these could be relocated (e.g. adiabatic_option and gridfac only used in the field routines in dist_fn), but others, such as the boundary option may be harder to move.
-
reporter The wdrift_func, wcurv_func and wcoriolis_func routines in dist_fn mostly just depend on the geometry and the grids so would perhaps be more suited to
theta_grid
However this isn’t possible currently askt_grids
depends ontheta_grid
and these drift routines depend onkt_grids
. Perhaps we could introduce aphysics_terms
module or similar for gathering things like the drifts, vpar, vperp etc. (i.e. the physics terms built up from our grid choices [theta, kt, species, le]) or break it down further with a module for drifts, one for velocities etc.
-
reporter - changed milestone to 8.2
-
reporter It might be worth creating the following small modules:
- drifts – init_wdrift and related arrays
- field_equations – gamtot’s, getfieldeq and related
- time_advance – timeadv (single routine but rather important so worth it?)
- dist_fn_diagnostics (the moments and checks routines above).
- invert_rhs – invert_rhs and related routines. This one is perhaps less clear.
- Log in to comment
There are 111 subroutines in dist_fn in current next. I think the following 32 could be moved into a dist_fn_moments_and_checks module
The following could be moved into a field_equations module