gusto.spatial_methods package
Submodules
gusto.spatial_methods.diffusion_methods module
Provides discretisations for diffusion terms.
- class gusto.spatial_methods.diffusion_methods.CGDiffusion(equation, variable, diffusion_parameters)[source]
Bases:
DiffusionMethod
- Parameters:
equation (
PrognosticEquation
) – the equation, which includes a diffusion term.variable (str) – name of the variable to set the diffusion scheme for
- class gusto.spatial_methods.diffusion_methods.InteriorPenaltyDiffusion(equation, variable, diffusion_parameters)[source]
Bases:
DiffusionMethod
The interior penalty method for discretising the diffusion term.
- Parameters:
equation (
PrognosticEquation
) – the equation, which includes a transport term.variable (str) – name of the variable to set the diffusion method for
diffusion_parameters (
DiffusionParameters
) – object containing metadata describing the diffusion term. Includes the kappa and mu constants.
gusto.spatial_methods.limiters module
This module contains slope limiters.
Slope limiters are used in transport schemes to enforce monotonicity. They are
generally passed as an argument to time discretisations, and should be selected
to be compatible with with FunctionSpace
of the transported field.
- class gusto.spatial_methods.limiters.DG1Limiter(space, subspace=None)[source]
Bases:
object
A vertex-based limiter for the degree 1 discontinuous Galerkin space.
A vertex based limiter for fields in the DG1 space. This wraps around the vertex-based limiter implemented in Firedrake, but ensures that this is done in the space using the appropriate “equispaced” elements.
- Parameters:
space (
FunctionSpace
) –- the space in which the transported
variables lies. It should be the DG1 space, or a mixed function space containing the DG1 space.
- subspace (int, optional): specifies that the limiter works on this
component of a
MixedFunctionSpace
.
- Raises:
ValueError – If the space is not appropriate for the limiter.
- apply(field)[source]
The application of the limiter to the field.
- Parameters:
field (
Function
) – the field to apply the limiter to.- Raises:
AssertionError – If the field is not in the correct space.
- class gusto.spatial_methods.limiters.MixedFSLimiter(equation, sublimiters)[source]
Bases:
object
An object to hold a dictionary that defines limiters for transported prognostic variables. Different limiters may be applied to different fields and not every transported variable needs a defined limiter.
- Parameters:
( (equation) – class: PrognosticEquationSet): the prognostic equation(s)
sublimiters (dict) – A dictionary holding limiters defined for individual prognostic variables
- Raises:
ValueError – If a limiter is defined for a field that is not in the prognostic variable set
- class gusto.spatial_methods.limiters.NoLimiter[source]
Bases:
object
A blank limiter that does nothing.
- class gusto.spatial_methods.limiters.ThetaLimiter(space)[source]
Bases:
object
A vertex-based limiter for the degree 1 temperature space. A vertex based limiter for fields in the DG1xCG2 space, i.e. temperature variables in the next-to-lowest order set of spaces. This acts like the vertex-based limiter implemented in Firedrake, but in addition corrects the central nodes to prevent new maxima or minima forming.
- Parameters:
space (
FunctionSpace
) – the space in which the transported variables lies. It should be a form of the DG1xCG2 space.- Raises:
ValueError – If the mesh is not extruded.
ValueError – If the space is not appropriate for the limiter.
- apply(field)[source]
The application of the limiter to the field. :param field: the field to apply the limiter to. :type field:
Function
- Raises:
AssertionError – If the field is not in the broken form of the
FunctionSpace
that theThetaLimiter
was initialised with.
- class gusto.spatial_methods.limiters.ZeroLimiter(space, clipping_space=None)[source]
Bases:
object
A simple limiter to enforce non-negativity of a field pointwise.
Negative values are simply clipped to be zero. There is also the option to project the field to another function space to enforce non-negativity there.
- Parameters:
space (
FunctionSpace
) – the space of the incoming field to clip.clipping_space (
FunctionSpace
, optional) – the space in which to clip the field. If not specified, the space of the input field is used.
gusto.spatial_methods.spatial_methods module
This module defines the SpatialMethod base object, which is used to define a spatial discretisation of some term.
- class gusto.spatial_methods.spatial_methods.SpatialMethod(equation, variable, term_label)[source]
Bases:
object
The base object for describing a spatial discretisation of some term.
- Parameters:
equation (
PrognosticEquation
) – the equation, which includes the original type of this term.variable (str) – name of the variable to set the method for
term_label (
Label
) – the label specifying which type of term to be discretised.
gusto.spatial_methods.transport_methods module
Defines TransportMethod objects, which are used to solve a transport problem.
- class gusto.spatial_methods.transport_methods.DGUpwind(equation, variable, ibp=IntegrateByParts.ONCE, vector_manifold_correction=False, outflow=False)[source]
Bases:
TransportMethod
The Discontinuous Galerkin Upwind transport scheme.
Discretises the gradient of a field weakly, taking the upwind value of the transported variable at facets.
- Parameters:
equation (
PrognosticEquation
) – the equation, which includes a transport term.variable (str) – name of the variable to set the transport scheme for
ibp (
IntegrateByParts
, optional) – an enumerator for how many times to integrate by parts. Defaults to ONCE.vector_manifold_correction (bool, optional) – whether to include a vector manifold correction term. Defaults to False.
outflow (bool, optional) – whether to include outflow at the domain boundaries, through exterior facet terms. Defaults to False.
- class gusto.spatial_methods.transport_methods.DefaultTransport(equation, variable)[source]
Bases:
TransportMethod
Performs no manipulation of the transport form, so the scheme is simply based on the transport terms that are declared when the equation is set up.
- Parameters:
equation (
PrognosticEquation
) – the equation, which includes a transport term.variable (str) – name of the variable to set the transport scheme for