You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
For some models, like the shallow water equations or the compressible navier stokes, we want to have a suite of choices for the integrators, riemann solvers, or source terms.
Describe the solution you'd like
To allow for dynamic selection of these methods within main programs, we can use procedure pointers as attributes in the SELF_Model* classes for these methods. The SELF_Model module can define all of the time integrators and default riemann solver methods that do nothing. The individual models (shallow water, compressible ideal gas, etc.) can define the suite of Riemann solvers that can be selected in main programs doing something like
! Set the time integrator
this % TimeIntegrator => SELF_RK3()
! Set the Riemann Solver
this % RiemannSolver => SELF_LocalLaxFriedrichs_CompressibleIdealGas()
Describe alternatives you've considered
In the code we currently use an integer flag for the time integrator and a SELECT CASE block for running with the correct time integrator. As we add more integrators, we'll need to continue writing this boiler-plate code. With procedure pointers, we can write the subroutines, and simply allow for the user to assign the procedure pointer in their program.
* This reduces duplicate boiler-plate code in the ForwardStep_Model
routine, where we previously had a SELECT CASE construct for working
with different time integrators. Here, we simply can assign the
`model % timeStepper` attribute to a provided time integrator that has
a consistent interface with SELF_timeIntegrator.
So far, this feature is working well for time integrators in the SELF_Model class. Users can assign the time integrator using the model % timeIntegrator procedure pointer attribute. I've added explicit integrators that are being verified ( AB2, AB3, AB4, RK2, RK4)
Is your feature request related to a problem? Please describe.
For some models, like the shallow water equations or the compressible navier stokes, we want to have a suite of choices for the integrators, riemann solvers, or source terms.
Describe the solution you'd like
To allow for dynamic selection of these methods within main programs, we can use procedure pointers as attributes in the
SELF_Model*
classes for these methods. TheSELF_Model
module can define all of the time integrators and default riemann solver methods that do nothing. The individual models (shallow water, compressible ideal gas, etc.) can define the suite of Riemann solvers that can be selected in main programs doing something likehttps://riptutorial.com/fortran/example/11869/referencing-a-procedure
Describe alternatives you've considered
In the code we currently use an integer flag for the time integrator and a
SELECT CASE
block for running with the correct time integrator. As we add more integrators, we'll need to continue writing this boiler-plate code. With procedure pointers, we can write the subroutines, and simply allow for the user to assign the procedure pointer in their program.Additional context
Procedure Pointers example
The text was updated successfully, but these errors were encountered: