SpECTRE
v2025.03.17
|
Computes the time derivative for a DG time step. More...
#include <ComputeTimeDerivative.hpp>
Public Types | |
using | inbox_tags = tmpl::list< evolution::dg::Tags::BoundaryCorrectionAndGhostCellsInbox< Dim, UseNodegroupDgElements > > |
using | const_global_cache_tags = tmpl::append< tmpl::list<::dg::Tags::Formulation, evolution::Tags::BoundaryCorrection< EvolutionSystem >, domain::Tags::ExternalBoundaryConditions< Dim > >, tmpl::conditional_t< LocalTimeStepping, tmpl::list<::Tags::MinimumTimeStep >, tmpl::list<> > > |
Public Member Functions | |
template<typename ParallelComponent , typename DbTagsList , typename Metavariables > | |
void | send_data_for_fluxes (const gsl::not_null< Parallel::GlobalCache< Metavariables > * > cache, const gsl::not_null< db::DataBox< DbTagsList > * > box, const Variables< db::wrap_tags_in< ::Tags::Flux, typename EvolutionSystem::flux_variables, tmpl::size_t< Dim >, Frame::Inertial > > &volume_fluxes) |
Static Public Member Functions | |
template<typename DbTagsList , typename... InboxTags, typename ArrayIndex , typename ActionList , typename ParallelComponent , typename Metavariables > | |
static Parallel::iterable_action_return_t | apply (db::DataBox< DbTagsList > &box, tuples::TaggedTuple< InboxTags... > &, Parallel::GlobalCache< Metavariables > &cache, const ArrayIndex &, ActionList, const ParallelComponent *) |
Computes the time derivative for a DG time step.
Computes the volume fluxes, the divergence of the fluxes and all additional interior contributions to the time derivatives (both nonconservative products and source terms). The internal mortar data is also computed.
The general first-order hyperbolic evolution equation solved for conservative systems is:
\begin{align*} \frac{\partial u_\alpha}{\partial \hat{t}} + \partial_{i} \left(F^i_\alpha - v^i_g u_\alpha\right) = S_\alpha-u_\alpha\partial_i v^i_g, \end{align*}
where \(F^i_{\alpha}\) are the fluxes when the mesh isn't moving, \(v^i_g\) is the velocity of the mesh, \(u_{\alpha}\) are the evolved variables, \(S_{\alpha}\) are the source terms, \(\hat{t}\) is the time in the logical frame, \(t\) is the time in the inertial frame, hatted indices correspond to logical frame quantites, and unhatted indices to inertial frame quantities (e.g. \(\partial_i\) is the derivative with respect to the inertial coordinates). For evolution equations that do not have any fluxes and only nonconservative products we evolve:
\begin{align*} \frac{\partial u_\alpha}{\partial \hat{t}} +\left(B^i_{\alpha\beta}-v^i_g \delta_{\alpha\beta} \right)\partial_{i}u_\beta = S_\alpha. \end{align*}
Finally, for equations with both conservative terms and nonconservative products we use:
\begin{align*} \frac{\partial u_\alpha}{\partial \hat{t}} + \partial_{i} \left(F^i_\alpha - v^i_g u_\alpha\right) +B^i_{\alpha\beta}\partial_{i}u_\beta = S_\alpha-u_\alpha\partial_i v^i_g, \end{align*}
where \(B^i_{\alpha\beta}\) is the matrix for the nonconservative products.
The mesh velocity is added to the flux automatically if the mesh is moving. That is,
\begin{align*} F^i_{\alpha}\to F^i_{\alpha}-v^i_{g} u_{\alpha} \end{align*}
The source terms are also altered automatically by adding:
\begin{align*} -u_\alpha \partial_i v^i_g, \end{align*}
For systems with equations that only contain nonconservative products, the following mesh velocity is automatically added to the time derivative:
\begin{align*} v^i_g \partial_i u_\alpha, \end{align*}
Frame::Inertial
frame, and the plus sign arises because we add it to the time derivative.Here are examples of the TimeDerivative
struct used to compute the volume time derivative. This struct is what the type alias System::compute_volume_time_derivative
points to. The time derivatives are as gsl::not_null
first, then the temporary tags as gsl::not_null
, followed by the argument_tags
. These type aliases are given by
for the examples. For a conservative system without primitives the apply
function would look like
For a nonconservative system it would be
And finally, for a mixed conservative-nonconservative system with primitive variables
In addition to each variable being passed individually, if the time derivative struct inherits from evolution::PassVariables
, then the time derivatives, fluxes, and temporaries are passed as gsl::not_null<Variables<...>>
. This is useful for systems where additional quantities are sometimes evolved, and just generally nice for keeping the number of arguments reasonable. Below are the above examples but with Variables
being passed.
Uses:
variables_tag
flux_variables
gradient_variables
compute_volume_time_derivative_terms
system::compute_volume_time_derivative_terms::argument_tags
domain::Tags::MeshVelocity<Metavariables::volume_dim>
Metavariables::system::variables_tag
Metavariables::system::flux_variables
Metavariables::system::gradient_variables
domain::Tags::DivMeshVelocity
DirectionsTag
,Metavariables::system::normal_dot_fluxes
DataBox changes:
Tags::dt<system::variable_tags>
Tags::Mortars<typename BoundaryScheme::mortar_data_tag, VolumeDim>
Internal boundary terms are computed from the System::boundary_correction_base
type alias. This type alias must point to a base class with creatable_classes
. Each concrete boundary correction must specify:
dg_package_field_tags
. These are what will be returned by gsl::not_null
from the dg_package_data
member function.dg_package_temporary_tags
. These are temporary tags that are projected to the face and then passed to the dg_package_data
function.dg_package_primitive_tags
. These are the primitive variables (if any) that are projected to the face and then passed to dg_package_data
.dg_package_volume_tags
. These are tags that are not projected to the interface and are retrieved directly from the DataBox
. The equation of state for hydrodynamics systems is an example of what would be a "volume tag".A static constexpr bool need_normal_vector
must be specified. If true
then the normal vector is computed from the normal covector. This is currently not implemented.
The dg_package_data
function takes as arguments gsl::not_null
of the dg_package_data_field_tags
, then the projected evolved variables, the projected fluxes, the projected temporaries, the projected primitives, the unit normal covector, mesh velocity, normal dotted into the mesh velocity, the volume_tags
, and finally the dg::Formulation
. The dg_package_data
function must compute all ingredients for the boundary correction, including mesh-velocity-corrected characteristic speeds. However, the projected fluxes passed in are \(F^i - u v^i_g\) (the mesh velocity term is already included). The dg_package_data
function must also return a double
that is the maximum absolute characteristic speed over the entire face. This will be used for checking that the time step doesn't violate the CFL condition.
Here is an example of the type aliases and bool
:
The normal vector requirement is:
For a conservative system with primitive variables and using the TimeStepId
as a volume tag the dg_package_data
function looks like:
For a mixed conservative-nonconservative system with primitive variables and using the TimeStepId
as a volume tag the dg_package_data
function looks like:
Uses:
boundary_correction
variables_tag
flux_variables
gradients_tags
compute_volume_time_derivative
has_primitive_and_conservative_vars
primitive_variables_tag
if system has primitive variablesdomain::Tags::Element<Dim>
domain::Tags::Mesh<Dim>
evolution::dg::Tags::MortarMesh<Dim>
evolution::dg::Tags::MortarSize<Dim>
evolution::dg::Tags::MortarData<Dim>
Tags::TimeStepId
Metavariables::system::variables_tag
Metavariables::system::flux_variables
Metavariables::system::primitive_tags
if existssystem::boundary_correction_base::dg_package_data_volume_tags
DataBox changes: