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 background info for ODE solvers #164

Merged
merged 1 commit into from
Jan 27, 2023
Merged

Add background info for ODE solvers #164

merged 1 commit into from
Jan 27, 2023

Conversation

dennisYatunin
Copy link
Member

Purpose

This PR adds a new page to the docs, background/ode_solvers.md.

Content

The new documentation is a detailed LaTeX writeup of how our IMEX ARK and IMEX SSPRK methods are formulated and why they are formulated that way. It also provides a brief description of standard IMEX ARK methods, assuming minimal background knowledge from users.

Aside from the writeup, this PR also removes stage_callback! from the ClimaODEFunction. This function was originally introduced to allow filtering, but filtering of the explicit tendencies can already be achieved through dss!, and filtering of the implicit tendencies is a bad idea (see current EDMF filtering revamp). Without stage_callback!, the current implementation of IMEX ARK and IMEX SSPRK methods exactly matches what is in the writeup.


  • I have read and checked the items on the review checklist.

@dennisYatunin dennisYatunin linked an issue Jan 27, 2023 that may be closed by this pull request
@dennisYatunin dennisYatunin added the documentation Improvements or additions to documentation label Jan 27, 2023
Copy link

@tapios tapios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine (however, I did not check every detail).

Please add the relevant references for the methods, especially the SSP IMEX. And mention that the SSP property relies on being able to write the method as a sequence of Euler steps.

For next time, though, please keep the documentation succinct (no need to introduce textbook concepts about timesteppers), and please focus implementation and documentation on what we directly need, i.e., SSPRK(3,3) for SSP IMEX. As it is, this is overly general, making it harder to understand the simple case we need and use.


Note that ``T_{\text{exp}}`` is evaluated explicitly at the known state ``u_0``, while ``T_{\text{imp}}`` is evaluated implicitly at the unknown state ``\hat{u}``.

Both the forward and backward Euler methods (and, by extension, the IMEX Euler method) are *first-order* methods, which means that the errors of their approximations are proportional to ``\Delta t`` when ``\Delta t`` is sufficiently close to 0.[^1] In order to achieve a reasonable accuracy with fewer timesteps, it is common to use *higher-order* methods, where a method of order ``p`` will have an error that is proportional to ``\Delta t^p`` for small values of ``\Delta t``. The simplest higher-order generalization of the forward and backward Euler methods is a *Runge-Kutta* method, in which there are ``s`` *stages* ``U_1, U_2, \ldots, U_s`` that satisfy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Both the forward and backward Euler methods (and, by extension, the IMEX Euler method) are *first-order* methods, which means that the errors of their approximations are proportional to ``\Delta t`` when ``\Delta t`` is sufficiently close to 0.[^1] In order to achieve a reasonable accuracy with fewer timesteps, it is common to use *higher-order* methods, where a method of order ``p`` will have an error that is proportional to ``\Delta t^p`` for small values of ``\Delta t``. The simplest higher-order generalization of the forward and backward Euler methods is a *Runge-Kutta* method, in which there are ``s`` *stages* ``U_1, U_2, \ldots, U_s`` that satisfy
Both the forward and backward Euler methods (and, by extension, the IMEX Euler method) are *first-order* methods, which means that the errors of their approximations are proportional to ``\Delta t`` when ``\Delta t`` is sufficiently close to 0.[^1] In order to achieve a reasonable accuracy with fewer timesteps, it is common to use *higher-order* methods, where a method of order ``p`` will have an error that is proportional to ``(\Delta t)^p`` for small values of ``\Delta t``. The simplest higher-order generalization of the forward and backward Euler methods is a *Runge-Kutta* method, in which there are ``s`` *stages* ``U_1, U_2, \ldots, U_s`` that satisfy


## Adding DSS

It is often necessary to filter the state so that it satisfies some particular constraint before it is used to evaluate a tendency. In our case, the state is a collection of values defined across a spatially discretized domain. When we use a discontinuous Galerkin spectral element discretization, we must ensure that the state is continuous across element boundaries before we use it to compute any tendency. We can turn any discontinuous state into a continuous one by applying a *direct stiffness summation* (DSS) to it. Applying DSS to ``\hat{u}`` in the IMEX ARK method is straightforward:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It is often necessary to filter the state so that it satisfies some particular constraint before it is used to evaluate a tendency. In our case, the state is a collection of values defined across a spatially discretized domain. When we use a discontinuous Galerkin spectral element discretization, we must ensure that the state is continuous across element boundaries before we use it to compute any tendency. We can turn any discontinuous state into a continuous one by applying a *direct stiffness summation* (DSS) to it. Applying DSS to ``\hat{u}`` in the IMEX ARK method is straightforward:
It is often necessary to filter the state so that it satisfies some particular constraint before it is used to evaluate a tendency. In our case, the state is a collection of values defined across a spatially discretized domain. When we use a continuous Galerkin (CG) spectral element discretization, we must ensure that the state is continuous across element boundaries before we use it to compute any tendency. We can turn any state that is discontinuous across element boundaries into a continuous one by applying a *direct stiffness summation* (DSS) to it. Applying DSS to ``\hat{u}`` in the IMEX ARK method is straightforward:

@dennisYatunin
Copy link
Member Author

I've addressed all of Tapio's comments. I'll go ahead and r+ this.

@dennisYatunin
Copy link
Member Author

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 27, 2023

@bors bors bot merged commit 873d81a into main Jan 27, 2023
@bors bors bot deleted the dy/docs branch January 27, 2023 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve documentation for SSP
2 participants