General ODE solver

*INTERFACE:*

subroutine ode_solver(solver,numc,nlev,dt,cc,right_hand_side_rhs,right_hand_side_ppdd)

Here, 10 different numerical solvers for the right hand sides of the biogeochemical models are implemented for computing the ordinary differential equations (ODEs) which are calculated as the second step of the operational split method for the complete biogeochemical models. The remaining ODE is

with denoting the concentrations of state variables. The right hand side denotes the reaction terms, which are composed of contributions , which represent reactive fluxes from to , and in turn, are reactive fluxes from received by , see equation (267).

These methods are:

- First-order explicit (not unconditionally positive)
- Second order explicit Runge-Kutta (not unconditionally positive)
- Fourth-order explicit Runge-Kutta (not unconditionally positive)
- First-order Patankar (not conservative)
- Second-order Patankar-Runge-Kutta (not conservative)
- Fourth-order Patankar-Runge-Kutta (does not work, not conservative)
- First-order Modified Patankar (conservative and positive)
- Second-order Modified Patankar-Runge-Kutta (conservative and positive)
- Fourth-order Modified Patankar-Runge-Kutta (does not work, conservative and positive)
- First-order Extended Modified Patankar (stoichiometrically conservative and positive)
- Second-order Extended Modified Patankar-Runge-Kutta (stoichiometrically conservative and positive)

The schemes 1 - 5 and 7 - 8 have been described in detail by Burchard et al. (2003). Later, Bruggeman et al. (2006) could show that the Modified Patankar schemes 7 - 8 are only conservative for one limiting nutrient and therefore they developed the Extended Modified Patankar (EMP) schemes 10 and 11 which are also stoichiometrically conservative. Patankar and Modified Patankar schemes of fourth order have not yet been developed, such that choices 6 and 9 do not work yet.

The call to `ode_solver()` requires a little explanation. The
first argument `solver` is an integer and specifies which solver
to use. The arguments `numc` and `nlev` gives the dimensions
of the data structure `cc` i.e. `cc(1:numc,0:nlev)`.
`dt` is simply the time step. The last argument is the most
complicated. `right_hand_side` is a subroutine with a fixed
argument list. The subroutine evaluates the right hand side of the ODE
and may be called more than once during one time-step - for higher order
schemes. For an example of a correct `right_hand_side` have a look
at e.g. `do_bio_npzd()`

*USES:*

IMPLICIT NONE

integer, intent(in) :: solver,nlev,numc REALTYPE, intent(in) :: dt !INPUT/OUTPUT PARAMETER: REALTYPE, intent(inout) :: cc(1:numc,0:nlev) interface subroutine right_hand_side_ppdd(first,numc,nlev,cc,pp,dd) logical, intent(in) :: first integer, intent(in) :: numc,nlev REALTYPE, intent(in) :: cc(1:numc,0:nlev) REALTYPE, intent(out) :: pp(1:numc,1:numc,0:nlev) REALTYPE, intent(out) :: dd(1:numc,1:numc,0:nlev) end end interface interface subroutine right_hand_side_rhs(first,numc,nlev,cc,rhs) logical, intent(in) :: first integer, intent(in) :: numc,nlev REALTYPE, intent(in) :: cc(1:numc,0:nlev) REALTYPE, intent(out) :: rhs(1:numc,0:nlev) end end interface

Original author(s): Hans Burchard, Karsten Bolding

- First-order Euler-forward scheme
- Second-order Runge-Kutta scheme
- Fourth-order Runge-Kutta scheme
- First-order Patankar scheme
- Second-order Patankar-Runge-Kutta scheme
- Fourth-order Patankar-Runge-Kutta scheme
- First-order Modified Patankar scheme
- Second-order Modified Patankar-Runge-Kutta scheme
- Fourth-order Modified Patankar-Runge-Kutta scheme
- First-order Extended Modified Patankar scheme
- Second-order Extended Modified Patankar scheme
- Calculation of the EMP product term 'p'
- Matrix solver