Commit b0398c63 authored by Jannis Teunissen's avatar Jannis Teunissen

Add documentation on time integration

parent 3213f2f4
......@@ -422,7 +422,7 @@ EXTRACT_ALL = YES
# be included in the documentation.
# The default value is: NO.
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
......@@ -17,6 +17,7 @@
* [Setting boundary conditions](documentation/
* [Performing grid refinement](documentation/
* [Running in parallel](documentation/
* [Time integration](documentation/
* [Multigrid overview](documentation/
* [Writing and viewing output](documentation/
* [Profiling an application](documentation/
# Time integration
The `m_af_advance` module can be used to perform time integration.
## Methods
Currently, the following explicit methods are included:
* [Forward Euler]( (`af_forward_euler`)
* [Midpoint method]( (`af_midpoint_method`)
* [Heun's method]( (`af_heuns_method`)
New integrators can be added relatively easily by modifying the `af_advance` routine.
## How to use
To use the built-in time integration, a `forward_euler` routine has to be
provided, see `m_af_advance::subr_feuler` for details. This routine will then
be used to construct the various time integration schemes.
For higher-order schemes, the idea is that multiple copies will be stored for variables that will be integrated, which correspond to different temporal states. The number of copies can be specified in `m_af_core::af_add_cc_variable`.
The user-provided forward Euler method then takes three extra arguments that
indicate which temporal states to operate on. For a simple equation of the form
y' = f(y)
the method should provide a solution
y_out = y_prev + dt * f(y_deriv)
More details can be found at `m_af_advance::subr_feuler`, and an example from @ref euler_gas_dynamics.f90 is shown below
\snippet euler_gas_dynamics.f90 forward_euler_gasd
......@@ -162,6 +162,7 @@ program KT_euler
!> [forward_euler_gasd]
subroutine forward_euler(tree, dt, dt_lim, time, s_deriv, s_prev, s_out, &
i_step, n_steps)
type(af_t), intent(inout) :: tree
......@@ -182,6 +183,7 @@ contains
! Compute new time step
dt_lim = 1.0_dp / sum(wmax/af_lvl_dr(tree, tree%highest_lvl))
end subroutine forward_euler
!> [forward_euler_gasd]
subroutine set_init_conds(box)
type(box_t), intent(inout) :: box
......@@ -19,6 +19,19 @@ module m_af_advance
integer, parameter :: req_copies(n_integrators) = af_advance_num_steps
!> Interface for a generic forward Euler scheme for time integration
!> This method should advance the solution over a time dt. The method
!> assumes that several copies are stored for the variables to be
!> integrated. It should then operate on these different copies, which
!> correspond to temporal states. In this way, higher-order time
!> integration schemes can be constructed.
!> The meaning of the temporal states is as follows. For an equation y' =
!> f(y), the method should perform: y_out = y_prev + dt * f(y_deriv).
!> If the index of the variable `y` is `i`, then the index of `y_out` is
!> `i+s_out`, the index of `y_prev` is `i+s_prev` etc.
subroutine subr_feuler(tree, dt, dt_lim, time, s_deriv, s_prev, s_out, &
i_step, n_steps)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment