Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for dynamic time integrators and riemann solvers #38

Open
fluidnumerics-joe opened this issue Jul 27, 2022 · 1 comment
Open

Comments

@fluidnumerics-joe
Copy link
Member

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()

https://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

fluidnumerics-joe added a commit that referenced this issue Aug 15, 2022
* 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.
fluidnumerics-joe added a commit that referenced this issue Aug 15, 2022
* Matches description in issue #38.
@fluidnumerics-joe
Copy link
Member Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant