TrixiAtmo
Documentation for TrixiAtmo.
TrixiAtmo.TrixiAtmo
TrixiAtmo.AbstractCovariantEquations
TrixiAtmo.CovariantLinearAdvectionEquation2D
TrixiAtmo.GlobalCartesianCoordinates
TrixiAtmo.GlobalSphericalCoordinates
TrixiAtmo.MetricTermsCrossProduct
TrixiAtmo.MetricTermsInvariantCurl
TrixiAtmo.ShallowWaterEquations3D
Trixi.flux_fjordholm_etal
Trixi.flux_wintermeyer_etal
TrixiAtmo.P4estMeshCubedSphere2D
TrixiAtmo.P4estMeshQuadIcosahedron2D
TrixiAtmo.clean_solution_lagrange_multiplier!
TrixiAtmo.contravariant2global
TrixiAtmo.examples_dir
TrixiAtmo.global2contravariant
TrixiAtmo.have_aux_node_vars
TrixiAtmo.initial_condition_gaussian
TrixiAtmo.source_terms_lagrange_multiplier
TrixiAtmo.transform_initial_condition
TrixiAtmo.TrixiAtmo
— Module🌍 TrixiAtmo 🌍
TrixiAtmo.jl is a simulation package for atmospheric models based on Trixi.jl
See also: trixi-framework/TrixiAtmo.jl
TrixiAtmo.AbstractCovariantEquations
— TypeAbstractCovariantEquations{NDIMS,
+Home · TrixiAtmo.jl TrixiAtmo
Documentation for TrixiAtmo.
TrixiAtmo.TrixiAtmo
TrixiAtmo.AbstractCovariantEquations
TrixiAtmo.CovariantLinearAdvectionEquation2D
TrixiAtmo.GlobalCartesianCoordinates
TrixiAtmo.GlobalSphericalCoordinates
TrixiAtmo.MetricTermsCrossProduct
TrixiAtmo.MetricTermsInvariantCurl
TrixiAtmo.ShallowWaterEquations3D
Trixi.flux_fjordholm_etal
Trixi.flux_wintermeyer_etal
TrixiAtmo.P4estMeshCubedSphere2D
TrixiAtmo.P4estMeshQuadIcosahedron2D
TrixiAtmo.clean_solution_lagrange_multiplier!
TrixiAtmo.contravariant2global
TrixiAtmo.examples_dir
TrixiAtmo.global2contravariant
TrixiAtmo.have_aux_node_vars
TrixiAtmo.initial_condition_gaussian
TrixiAtmo.source_terms_lagrange_multiplier
TrixiAtmo.transform_initial_condition
TrixiAtmo.TrixiAtmo
— Module🌍 TrixiAtmo 🌍
TrixiAtmo.jl is a simulation package for atmospheric models based on Trixi.jl
See also: trixi-framework/TrixiAtmo.jl
sourceTrixiAtmo.AbstractCovariantEquations
— TypeAbstractCovariantEquations{NDIMS,
NDIMS_AMBIENT,
GlobalCoordinateSystem,
- NVARS} <: AbstractEquations{NDIMS, NVARS}
Abstract type used to dispatch on systems of equations in covariant form, in which fluxes and prognostic variables are stored and computed in terms of their contravariant components defining their expansions in terms of the local covariant tangent basis. The type parameter NDIMS
denotes the dimension of the manifold on which the equations are solved, while NDIMS_AMBIENT
is the dimension of the ambient space in which such a manifold is embedded. Some references on discontinuous Galerkin methods in covariant flux form are listed below:
- M. Baldauf (2020). Discontinuous Galerkin solver for the shallow-water equations in covariant form on the sphere and the ellipsoid. Journal of Computational Physics 410:109384. DOI: 10.1016/j.jcp.2020.109384
- M. Baldauf (2021). A horizontally explicit, vertically implicit (HEVI) discontinuous Galerkin scheme for the 2-dimensional Euler and Navier-Stokes equations using terrain-following coordinates. Journal of Computational Physics 446:110635. DOI: 10.1016/ j.jcp.2021.110635
- L. Bao, R. D. Nair, and H. M. Tufo (2014). A mass and momentum flux-form high-order discontinuous Galerkin shallow water model on the cubed-sphere. A mass and momentum flux-form high-order discontinuous Galerkin shallow water model on the cubed-sphere. Journal of Computational Physics 271:224-243. DOI: 10.1016/j.jcp.2013.11.033
When using this equation type, functions which are evaluated pointwise, such as fluxes, source terms, and initial conditions take in the extra argument aux_vars
, which contains the geometric information needed for the covariant form. The type parameter GlobalCoordinateSystem
specifies the global coordinate system used to define the covariant tangent basis, and may be either GlobalCartesianCoordinates
or GlobalSphericalCoordinates
. The GlobalCoordinateSystem
type parameter also specifies the coordinate system with respect to which the initial condition should be prescribed.
sourceTrixiAtmo.CovariantLinearAdvectionEquation2D
— TypeCovariantLinearAdvectionEquation2D{GlobalCoordinateSystem} <:
+ NVARS} <: AbstractEquations{NDIMS, NVARS}
Abstract type used to dispatch on systems of equations in covariant form, in which fluxes and prognostic variables are stored and computed in terms of their contravariant components defining their expansions in terms of the local covariant tangent basis. The type parameter NDIMS
denotes the dimension of the manifold on which the equations are solved, while NDIMS_AMBIENT
is the dimension of the ambient space in which such a manifold is embedded. Some references on discontinuous Galerkin methods in covariant flux form are listed below:
- M. Baldauf (2020). Discontinuous Galerkin solver for the shallow-water equations in covariant form on the sphere and the ellipsoid. Journal of Computational Physics 410:109384. DOI: 10.1016/j.jcp.2020.109384
- M. Baldauf (2021). A horizontally explicit, vertically implicit (HEVI) discontinuous Galerkin scheme for the 2-dimensional Euler and Navier-Stokes equations using terrain-following coordinates. Journal of Computational Physics 446:110635. DOI: 10.1016/ j.jcp.2021.110635
- L. Bao, R. D. Nair, and H. M. Tufo (2014). A mass and momentum flux-form high-order discontinuous Galerkin shallow water model on the cubed-sphere. A mass and momentum flux-form high-order discontinuous Galerkin shallow water model on the cubed-sphere. Journal of Computational Physics 271:224-243. DOI: 10.1016/j.jcp.2013.11.033
When using this equation type, functions which are evaluated pointwise, such as fluxes, source terms, and initial conditions take in the extra argument aux_vars
, which contains the geometric information needed for the covariant form. The type parameter GlobalCoordinateSystem
specifies the global coordinate system used to define the covariant tangent basis, and may be either GlobalCartesianCoordinates
or GlobalSphericalCoordinates
. The GlobalCoordinateSystem
type parameter also specifies the coordinate system with respect to which the initial condition should be prescribed.
sourceTrixiAtmo.CovariantLinearAdvectionEquation2D
— TypeCovariantLinearAdvectionEquation2D{GlobalCoordinateSystem} <:
AbstractCovariantEquations{2, 3, GlobalCoordinateSystem, 3}
A variable-coefficient linear advection equation can be defined on a two-dimensional manifold $S \subset \mathbb{R}^3$ as
\[\partial_t h + \nabla_S \cdot (h \vec{v}) = 0,\]
where $\nabla_S \cdot$ is the horizontal divergence operator on $S$. We treat this problem as a system of equations in which the first variable is the scalar conserved quantity $h$, and the second two are the contravariant components $v^1$ and $v^2$ used in the expansion with respect to the covariant basis vectors $\vec{a}_1$ and $\vec{a}_2$ as
\[\vec{v} = v^1 \vec{a}_1 + v^2 \vec{a}_2,\]
where $\vec{a}_1 = \partial \vec{x} / \partial \xi^1$ and $\vec{a}_2 = \partial \vec{x} / \partial \xi^2$ are the so-called covariant basis vectors, and $\xi^1$ and $\xi^2$ are the local reference space coordinates. The velocity components are spatially varying but assumed to be constant in time, so we do not apply any flux or dissipation to such variables. The resulting system is then given on the reference element as
\[\sqrt{G} \frac{\partial}{\partial t}
\left[\begin{array}{c} h \\ v^1 \\ v^2 \end{array}\right]
+
@@ -12,7 +12,7 @@
\frac{\partial}{\partial \xi^2}
\left[\begin{array}{c} \sqrt{G} h v^2 \\ 0 \\ 0 \end{array}\right]
=
-\left[\begin{array}{c} 0 \\ 0 \\ 0 \end{array}\right],\]
where $G$ is the determinant of the covariant metric tensor expressed as a 2 by 2 matrix with entries $G_{ij} = \vec{a}_i \cdot \vec{a}_j$. Note that the variable advection velocity components could alternatively be stored as auxiliary variables, similarly to the geometric information.
sourceTrixiAtmo.GlobalCartesianCoordinates
— TypeGlobalCartesianCoordinates()
Struct used for dispatch, specifying that the covariant tangent basis vectors should be defined with respect to a global Cartesian coordinate system.
sourceTrixiAtmo.GlobalSphericalCoordinates
— TypeGlobalSphericalCoordinates()
Struct used for dispatch, specifying that the covariant tangent basis vectors should be defined with respect to a global spherical coordinate system.
sourceTrixiAtmo.MetricTermsCrossProduct
— TypeMetricTermsCrossProduct()
Struct used for multiple dispatch on functions that compute the metric terms. When the argument metric_terms
is of type MetricTermsCrossProduct
, the contravariant vectors are computed using the cross-product form.
sourceTrixiAtmo.MetricTermsInvariantCurl
— TypeMetricTermsInvariantCurl()
Struct used for multiple dispatch on functions that compute the metric terms. When the argument metric_terms
is of type MetricTermsInvariantCurl
, the contravariant vectors are computed using the invariant curl form.
References
- Kopriva, D. A. (2006). Metric identities and the discontinuous spectral element method on curvilinear meshes. Journal of Scientific Computing 26, 301-327. DOI: 10.1007/s10915-005-9070-8
- Vinokur, M. and Yee, H. C. (2001). Extension of efficient low dissipation high order schemes for 3-D curvilinear moving grids. In Caughey, D. A., and Hafez, M. M. (eds.), Frontiers of Computational Fluid Dynamics 2002, World Scientific, Singapore, pp. 129–164. DOI: 10.1142/9789812810793_0008
sourceTrixiAtmo.ShallowWaterEquations3D
— TypeShallowWaterEquations3D(; gravity, H0 = 0)
Shallow water equations (SWE) in three space dimensions in conservation form (with constant bottom topography). The equations are given by
\[\begin{aligned}
+\left[\begin{array}{c} 0 \\ 0 \\ 0 \end{array}\right],\]
where $G$ is the determinant of the covariant metric tensor expressed as a 2 by 2 matrix with entries $G_{ij} = \vec{a}_i \cdot \vec{a}_j$. Note that the variable advection velocity components could alternatively be stored as auxiliary variables, similarly to the geometric information.
sourceTrixiAtmo.GlobalCartesianCoordinates
— TypeGlobalCartesianCoordinates()
Struct used for dispatch, specifying that the covariant tangent basis vectors should be defined with respect to a global Cartesian coordinate system.
sourceTrixiAtmo.GlobalSphericalCoordinates
— TypeGlobalSphericalCoordinates()
Struct used for dispatch, specifying that the covariant tangent basis vectors should be defined with respect to a global spherical coordinate system.
sourceTrixiAtmo.MetricTermsCrossProduct
— TypeMetricTermsCrossProduct()
Struct used for multiple dispatch on functions that compute the metric terms. When the argument metric_terms
is of type MetricTermsCrossProduct
, the contravariant vectors are computed using the cross-product form.
sourceTrixiAtmo.MetricTermsInvariantCurl
— TypeMetricTermsInvariantCurl()
Struct used for multiple dispatch on functions that compute the metric terms. When the argument metric_terms
is of type MetricTermsInvariantCurl
, the contravariant vectors are computed using the invariant curl form.
References
- Kopriva, D. A. (2006). Metric identities and the discontinuous spectral element method on curvilinear meshes. Journal of Scientific Computing 26, 301-327. DOI: 10.1007/s10915-005-9070-8
- Vinokur, M. and Yee, H. C. (2001). Extension of efficient low dissipation high order schemes for 3-D curvilinear moving grids. In Caughey, D. A., and Hafez, M. M. (eds.), Frontiers of Computational Fluid Dynamics 2002, World Scientific, Singapore, pp. 129–164. DOI: 10.1142/9789812810793_0008
sourceTrixiAtmo.ShallowWaterEquations3D
— TypeShallowWaterEquations3D(; gravity, H0 = 0)
Shallow water equations (SWE) in three space dimensions in conservation form (with constant bottom topography). The equations are given by
\[\begin{aligned}
\frac{\partial h}{\partial t} + \frac{\partial}{\partial x}(h v_1)
+ \frac{\partial}{\partial y}(h v_2) + \frac{\partial}{\partial z}(h v_3) &= 0 \\
\frac{\partial}{\partial t}(h v_1) + \frac{\partial}{\partial x}\left(h v_1^2 + \frac{g}{2}h^2\right)
@@ -21,16 +21,16 @@
+ \frac{\partial}{\partial y}\left(h v_2^2 + \frac{g}{2}h^2\right) + \frac{\partial}{\partial z}(h v_2 v_3) &= 0 \\
\frac{\partial}{\partial t}(h v_3) + \frac{\partial}{\partial x}(h v_1 v_3)
+ \frac{\partial}{\partial y}(h v_2 v_3) + \frac{\partial}{\partial z}\left(h v_3^2 + \frac{g}{2}h^2\right) &= 0.
-\end{aligned}\]
The unknown quantities of the SWE are the water height $h$ and the velocities $\mathbf{v} = (v_1, v_2, v_3)^T$. The gravitational constant is denoted by g
.
The 3D Shallow Water Equations (SWE) extend the 2D SWE to model shallow water flows on 2D manifolds embedded within 3D space. To confine the flow to the 2D manifold, a source term incorporating a Lagrange multiplier is applied. This term effectively removes momentum components that are normal to the manifold, ensuring the flow remains constrained within the 2D surface.
The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.
In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the bottom topography must be zero.
- The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes this variable.- Trixi.jl's visualization tools will visualize the bottom topography by default.
References:
- J. Coté (1988). "A Lagrange multiplier approach for the metric terms of semi-Lagrangian models on the sphere". Quarterly Journal of the Royal Meteorological Society 114, 1347-1352. DOI: 10.1002/qj.49711448310
- F. X. Giraldo (2001). "A spectral element shallow water model on spherical geodesic grids". DOI: 10.1002/1097-0363(20010430)35:8<869::AID-FLD116>3.0.CO;2-S
sourceTrixi.flux_fjordholm_etal
— Methodflux_fjordholm_etal(u_ll, u_rr, orientation,
- equations::ShallowWaterEquations1D)
Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal
.
Details are available in Eq. (4.1) in the paper:
- Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
sourceTrixi.flux_wintermeyer_etal
— Methodflux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,
- equations::ShallowWaterEquations2D)
Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux
. For the surface_flux
either flux_wintermeyer_etal
or flux_fjordholm_etal
can be used to ensure well-balancedness and entropy conservation.
Further details are available in Theorem 1 of the paper:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
sourceTrixiAtmo.P4estMeshCubedSphere2D
— MethodP4estMeshCubedSphere2D(trees_per_face_dimension, radius;
+\end{aligned}\]The unknown quantities of the SWE are the water height $h$ and the velocities $\mathbf{v} = (v_1, v_2, v_3)^T$. The gravitational constant is denoted by g
.
The 3D Shallow Water Equations (SWE) extend the 2D SWE to model shallow water flows on 2D manifolds embedded within 3D space. To confine the flow to the 2D manifold, a source term incorporating a Lagrange multiplier is applied. This term effectively removes momentum components that are normal to the manifold, ensuring the flow remains constrained within the 2D surface.
The additional quantity $H_0$ is also available to store a reference value for the total water height that is useful to set initial conditions or test the "lake-at-rest" well-balancedness.
In addition to the unknowns, Trixi.jl currently stores the bottom topography values at the approximation points despite being fixed in time. This is done for convenience of computing the bottom topography gradients on the fly during the approximation as well as computing auxiliary quantities like the total water height $H$ or the entropy variables. This affects the implementation and use of these equations in various ways:
- The flux values corresponding to the bottom topography must be zero.
- The bottom topography values must be included when defining initial conditions, boundary conditions or source terms.
AnalysisCallback
analyzes this variable.- Trixi.jl's visualization tools will visualize the bottom topography by default.
References:
- J. Coté (1988). "A Lagrange multiplier approach for the metric terms of semi-Lagrangian models on the sphere". Quarterly Journal of the Royal Meteorological Society 114, 1347-1352. DOI: 10.1002/qj.49711448310
- F. X. Giraldo (2001). "A spectral element shallow water model on spherical geodesic grids". DOI: 10.1002/1097-0363(20010430)35:8<869::AID-FLD116>3.0.CO;2-S
sourceTrixi.flux_fjordholm_etal
— Methodflux_fjordholm_etal(u_ll, u_rr, orientation,
+ equations::ShallowWaterEquations1D)
Total energy conservative (mathematical entropy for shallow water equations). When the bottom topography is nonzero this should only be used as a surface flux otherwise the scheme will not be well-balanced. For well-balancedness in the volume flux use flux_wintermeyer_etal
.
Details are available in Eq. (4.1) in the paper:
- Ulrik S. Fjordholm, Siddhartha Mishr and Eitan Tadmor (2011) Well-balanced and energy stable schemes for the shallow water equations with discontinuous topography DOI: 10.1016/j.jcp.2011.03.042
sourceTrixi.flux_wintermeyer_etal
— Methodflux_wintermeyer_etal(u_ll, u_rr, orientation_or_normal_direction,
+ equations::ShallowWaterEquations2D)
Total energy conservative (mathematical entropy for shallow water equations) split form. When the bottom topography is nonzero this scheme will be well-balanced when used as a volume_flux
. For the surface_flux
either flux_wintermeyer_etal
or flux_fjordholm_etal
can be used to ensure well-balancedness and entropy conservation.
Further details are available in Theorem 1 of the paper:
- Niklas Wintermeyer, Andrew R. Winters, Gregor J. Gassner and David A. Kopriva (2017) An entropy stable nodal discontinuous Galerkin method for the two dimensional shallow water equations on unstructured curvilinear meshes with discontinuous bathymetry DOI: 10.1016/j.jcp.2017.03.036
sourceTrixiAtmo.P4estMeshCubedSphere2D
— MethodP4estMeshCubedSphere2D(trees_per_face_dimension, radius;
polydeg, RealT=Float64,
initial_refinement_level=0, unsaved_changes=true,
p4est_partition_allow_for_coarsening=true,
- element_local_mapping=false)
Build a "Cubed Sphere" mesh as a 2D P4estMesh
with 6 * trees_per_face_dimension^2
trees.
The mesh will have no boundaries.
Arguments
trees_per_face_dimension::Integer
: the number of trees in the two local dimensions of each face.radius::Integer
: the radius of the sphere.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.unsaved_changes::Bool
: if set to true
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must be true
when using AMR to make mesh adaptivity independent of domain partitioning. Should be false
for static meshes to permit more fine-grained partitioning.element_local_mapping::Bool
: option to use the alternative element-local mapping from Appendix A of Guba et al. (2014). If set to true
, the four corner vertex positions for each element will be obtained through an equiangular gnomonic projection (Ronchi et al. 1996), and the tree node coordinates within the element (i.e. the field tree_node_coordinates
) will be obtained by first using a bilinear mapping based on the four corner vertices, and then projecting the bilinearly mapped nodes onto the spherical surface by normalizing the resulting Cartesian coordinates and scaling by radius
. If set to false
, the equiangular gnomonic projection will be used for all tree node coordinates.
Warning Adaptivity and MPI parallelization are not yet supported for equations in covariant form, and we require initial_refinement_level = 0
for such cases. Furthermore, the calculation of the metric terms for the covariant form currently requires polydeg
to be equal to the polynomial degree of the solver, and element_local_mapping = true
.
sourceTrixiAtmo.P4estMeshQuadIcosahedron2D
— MethodP4estMeshQuadIcosahedron2D(trees_per_face_dimension, radius;
+ element_local_mapping=false)
Build a "Cubed Sphere" mesh as a 2D P4estMesh
with 6 * trees_per_face_dimension^2
trees.
The mesh will have no boundaries.
Arguments
trees_per_face_dimension::Integer
: the number of trees in the two local dimensions of each face.radius::Integer
: the radius of the sphere.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.unsaved_changes::Bool
: if set to true
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must be true
when using AMR to make mesh adaptivity independent of domain partitioning. Should be false
for static meshes to permit more fine-grained partitioning.element_local_mapping::Bool
: option to use the alternative element-local mapping from Appendix A of Guba et al. (2014). If set to true
, the four corner vertex positions for each element will be obtained through an equiangular gnomonic projection (Ronchi et al. 1996), and the tree node coordinates within the element (i.e. the field tree_node_coordinates
) will be obtained by first using a bilinear mapping based on the four corner vertices, and then projecting the bilinearly mapped nodes onto the spherical surface by normalizing the resulting Cartesian coordinates and scaling by radius
. If set to false
, the equiangular gnomonic projection will be used for all tree node coordinates.
Warning Adaptivity and MPI parallelization are not yet supported for equations in covariant form, and we require initial_refinement_level = 0
for such cases. Furthermore, the calculation of the metric terms for the covariant form currently requires polydeg
to be equal to the polynomial degree of the solver, and element_local_mapping = true
.
sourceTrixiAtmo.P4estMeshQuadIcosahedron2D
— MethodP4estMeshQuadIcosahedron2D(trees_per_face_dimension, radius;
polydeg, RealT=Float64,
initial_refinement_level=0, unsaved_changes=true,
- p4est_partition_allow_for_coarsening=true)
Build a quad-based icosahedral mesh as a 2D P4estMesh
with 60 * trees_per_face_dimension^2
trees (20 triangular faces of the icosahedron, each subdivided into 3 parent quads, each of which subdivided into trees_per_face_dimension^2
trees).
The node coordinates of the trees will be obtained using the element-local mapping from Appendix A of Guba et al. (2014). See P4estMeshCubedSphere2D
for more information about the element-local mapping.
The mesh will have no boundaries.
Arguments
trees_per_face_dimension::Integer
: the number of trees in the two local dimensions of each parent quad.radius::Integer
: the radius of the sphere.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.unsaved_changes::Bool
: if set to true
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must be true
when using AMR to make mesh adaptivity independent of domain partitioning. Should be false
for static meshes to permit more fine-grained partitioning.
Warning Adaptivity and MPI parallelization are not yet supported for equations in covariant form, and we require initial_refinement_level = 0
for such cases. Furthermore, the calculation of the metric terms for the covariant form currently requires polydeg
to be equal to the polynomial degree of the solver.
sourceTrixiAtmo.clean_solution_lagrange_multiplier!
— Method clean_solution_lagrange_multiplier!(u, equations::ShallowWaterEquations3D, normal_direction)
Function to apply Lagrange multiplier discretely to the solution in order to constrain the momentum to a 2D manifold.
The vector normal_direction is perpendicular to the 2D manifold. By default, this is the normal contravariant basis vector.
sourceTrixiAtmo.contravariant2global
— Functioncontravariant2global(u, aux_vars, equations)
Transform the vector u
of solution variables with the momentum or velocity given in terms of local contravariant components into the global coordinate system specified by the GlobalCoordinateSystem
type parameter in AbstractCovariantEquations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by global2contravariant
.
sourceTrixiAtmo.examples_dir
— Methodexamples_dir()
Return the directory where the example files provided with TrixiAtmo.jl are located. If TrixiAtmo.jl is installed as a regular package (with ]add Trixi
), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir
:
Examples
readdir(examples_dir())
sourceTrixiAtmo.global2contravariant
— Functionglobal2contravariant(u, aux_vars, equations)
Transform the vector u
of solution variables with momentum or velocity components given with respect to the global coordinate system into local contravariant components. The global coordinate system is specified by the GlobalCoordinateSystem
type parameter in AbstractCovariantEquations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by contravariant2global
.
sourceTrixiAtmo.have_aux_node_vars
— Methodhave_aux_node_vars(equations)
Trait function determining whether equations
requires the use of auxiliary variables. Classical conservation laws such as the CompressibleEulerEquations2D
do not require auxiliary variables. The return value will be True()
or False()
to allow dispatching on the return type.
sourceTrixiAtmo.initial_condition_gaussian
— Methodinitial_condition_gaussian(x, t, equations)
This Gaussian bell case is a smooth initial condition suitable for testing the convergence of discretizations of the linear advection equation on a spherical domain of radius $6. 37122 \times 10^3\ \mathrm{m}$, representing the surface of the Earth. Denoting the Euclidean norm as $\lVert \cdot \rVert$, the initial height field is given by
\[h(\vec{x}) = h_0 \exp
-\Big(-b_0 \big(\lVert \vec{x} - \vec{x}_0 \rVert / \lVert \vec{x} \rVert\big)^2 \Big),\]
where $h_0 = 1 \times 10^3\ \mathrm{m}$ is the height of the bell, $b_0 = 5$ is the width parameter, and $\vec{x}_0$ is the position of the centre of the bell, which is initialized at a longitude of $3\pi/2$ and a latitude of zero. The velocity field corresponds to a solid body rotation with a period of 12 days at an angle of $\alpha = \pi/4$ from the polar axis. Denoting $\vec{\omega}$ as the corresponding angular velocity vector, the velocity is therefore initialized as
\[\vec{v}(\vec{x}) = \vec{\omega} \times \vec{x}.\]
This problem is adapted from Case 1 of the test suite described in the following paper:
- D. L. Williamson, J. B. Drake, J. J. Hack, R. Jakob, and P. N. Swarztrauber (1992). A standard test set for numerical approximations to the shallow water equations in spherical geometry. Journal of Computational Physics, 102(1):211-224. DOI: 10.1016/S0021-9991(05)80016-6
sourceTrixiAtmo.source_terms_lagrange_multiplier
— Methodsource_terms_lagrange_multiplier(u, du, x, t,
+ p4est_partition_allow_for_coarsening=true)
Build a quad-based icosahedral mesh as a 2D P4estMesh
with 60 * trees_per_face_dimension^2
trees (20 triangular faces of the icosahedron, each subdivided into 3 parent quads, each of which subdivided into trees_per_face_dimension^2
trees).
The node coordinates of the trees will be obtained using the element-local mapping from Appendix A of Guba et al. (2014). See P4estMeshCubedSphere2D
for more information about the element-local mapping.
The mesh will have no boundaries.
Arguments
trees_per_face_dimension::Integer
: the number of trees in the two local dimensions of each parent quad.radius::Integer
: the radius of the sphere.polydeg::Integer
: polynomial degree used to store the geometry of the mesh. The mapping will be approximated by an interpolation polynomial of the specified degree for each tree.RealT::Type
: the type that should be used for coordinates.initial_refinement_level::Integer
: refine the mesh uniformly to this level before the simulation starts.unsaved_changes::Bool
: if set to true
, the mesh will be saved to a mesh file.p4est_partition_allow_for_coarsening::Bool
: Must be true
when using AMR to make mesh adaptivity independent of domain partitioning. Should be false
for static meshes to permit more fine-grained partitioning.
Warning Adaptivity and MPI parallelization are not yet supported for equations in covariant form, and we require initial_refinement_level = 0
for such cases. Furthermore, the calculation of the metric terms for the covariant form currently requires polydeg
to be equal to the polynomial degree of the solver.
sourceTrixiAtmo.clean_solution_lagrange_multiplier!
— Method clean_solution_lagrange_multiplier!(u, equations::ShallowWaterEquations3D, normal_direction)
Function to apply Lagrange multiplier discretely to the solution in order to constrain the momentum to a 2D manifold.
The vector normal_direction is perpendicular to the 2D manifold. By default, this is the normal contravariant basis vector.
sourceTrixiAtmo.contravariant2global
— Functioncontravariant2global(u, aux_vars, equations)
Transform the vector u
of solution variables with the momentum or velocity given in terms of local contravariant components into the global coordinate system specified by the GlobalCoordinateSystem
type parameter in AbstractCovariantEquations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by global2contravariant
.
sourceTrixiAtmo.examples_dir
— Methodexamples_dir()
Return the directory where the example files provided with TrixiAtmo.jl are located. If TrixiAtmo.jl is installed as a regular package (with ]add Trixi
), these files are read-only and should not be modified. To find out which files are available, use, e.g., readdir
:
Examples
readdir(examples_dir())
sourceTrixiAtmo.global2contravariant
— Functionglobal2contravariant(u, aux_vars, equations)
Transform the vector u
of solution variables with momentum or velocity components given with respect to the global coordinate system into local contravariant components. The global coordinate system is specified by the GlobalCoordinateSystem
type parameter in AbstractCovariantEquations
. u
is a vector type of the correct length nvariables(equations)
. Notice the function doesn't include any error checks for the purpose of efficiency, so please make sure your input is correct. The inverse conversion is performed by contravariant2global
.
sourceTrixiAtmo.have_aux_node_vars
— Methodhave_aux_node_vars(equations)
Trait function determining whether equations
requires the use of auxiliary variables. Classical conservation laws such as the CompressibleEulerEquations2D
do not require auxiliary variables. The return value will be True()
or False()
to allow dispatching on the return type.
sourceTrixiAtmo.initial_condition_gaussian
— Methodinitial_condition_gaussian(x, t, equations)
This Gaussian bell case is a smooth initial condition suitable for testing the convergence of discretizations of the linear advection equation on a spherical domain of radius $6. 37122 \times 10^3\ \mathrm{m}$, representing the surface of the Earth. Denoting the Euclidean norm as $\lVert \cdot \rVert$, the initial height field is given by
\[h(\vec{x}) = h_0 \exp
+\Big(-b_0 \big(\lVert \vec{x} - \vec{x}_0 \rVert / \lVert \vec{x} \rVert\big)^2 \Big),\]
where $h_0 = 1 \times 10^3\ \mathrm{m}$ is the height of the bell, $b_0 = 5$ is the width parameter, and $\vec{x}_0$ is the position of the centre of the bell, which is initialized at a longitude of $3\pi/2$ and a latitude of zero. The velocity field corresponds to a solid body rotation with a period of 12 days at an angle of $\alpha = \pi/4$ from the polar axis. Denoting $\vec{\omega}$ as the corresponding angular velocity vector, the velocity is therefore initialized as
\[\vec{v}(\vec{x}) = \vec{\omega} \times \vec{x}.\]
This problem is adapted from Case 1 of the test suite described in the following paper:
- D. L. Williamson, J. B. Drake, J. J. Hack, R. Jakob, and P. N. Swarztrauber (1992). A standard test set for numerical approximations to the shallow water equations in spherical geometry. Journal of Computational Physics, 102(1):211-224. DOI: 10.1016/S0021-9991(05)80016-6
sourceTrixiAtmo.source_terms_lagrange_multiplier
— Methodsource_terms_lagrange_multiplier(u, du, x, t,
equations::ShallowWaterEquations3D,
- normal_direction)
Source term function to apply a Lagrange multiplier to the semi-discretization in order to constrain the momentum to a 2D manifold.
The vector normal_direction is perpendicular to the 2D manifold. By default, this is the normal contravariant basis vector.
sourceTrixiAtmo.transform_initial_condition
— Methodtransform_initial_condition(initial_condition, equations)
Takes in a function with the signature initial_condition(x, t, equations)
which returns an initial condition given in terms of global Cartesian or zonal/meridional velocity components, and returns another function initial_condition_transformed(x, t, equations)
or initial_condition_transformed(x, t, aux_vars, equations)
which returns the same initial data, but transformed to the appropriate prognostic variables used internally by the solver. For the covariant form, this involves a transformation of the global velocity components to contravariant components using global2contravariant
as well as a conversion from primitive to conservative variables. For standard Cartesian formulations, this simply involves a conversion from primitive to conservative variables. The intention here is to have a set of test cases (for example, initial_condition_gaussian
) for which the initial condition is prescribed using a standardized set of primitive variables in a global Cartesian coordinates, and transformed to the specific prognostic variables required for a given model.
Note When using the covariant formulation, the initial velocity components should be defined in the coordinate system specified by the GlobalCoordinateSystem
type parameter in AbstractCovariantEquations
.
sourceSettings
This document was generated with Documenter.jl version 1.8.0 on Friday 6 December 2024. Using Julia version 1.11.2.
+ normal_direction)
Source term function to apply a Lagrange multiplier to the semi-discretization in order to constrain the momentum to a 2D manifold.
The vector normal_direction is perpendicular to the 2D manifold. By default, this is the normal contravariant basis vector.
TrixiAtmo.transform_initial_condition
— Methodtransform_initial_condition(initial_condition, equations)
Takes in a function with the signature initial_condition(x, t, equations)
which returns an initial condition given in terms of global Cartesian or zonal/meridional velocity components, and returns another function initial_condition_transformed(x, t, equations)
or initial_condition_transformed(x, t, aux_vars, equations)
which returns the same initial data, but transformed to the appropriate prognostic variables used internally by the solver. For the covariant form, this involves a transformation of the global velocity components to contravariant components using global2contravariant
as well as a conversion from primitive to conservative variables. For standard Cartesian formulations, this simply involves a conversion from primitive to conservative variables. The intention here is to have a set of test cases (for example, initial_condition_gaussian
) for which the initial condition is prescribed using a standardized set of primitive variables in a global Cartesian coordinates, and transformed to the specific prognostic variables required for a given model.
When using the covariant formulation, the initial velocity components should be defined in the coordinate system specified by the GlobalCoordinateSystem
type parameter in AbstractCovariantEquations
.