inciter::FluxCorrector class

FluxCorrector is used to perform flux-corrected transport

Constructors, destructors, conversion operators

FluxCorrector(std::size_t is = 0) explicit

Public functions

template<class... Eq>
auto findsys() -> std::vector<std::vector<ncomp_t>>
template<class... Eq>
auto findvel() -> std::vector<std::array<ncomp_t, 3>>
void resize(std::size_t is)
Resize state (e.g., after mesh refinement)
void aec(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<tk::real>& vol, const std::unordered_map<std::size_t, std::vector<std::pair<bool, tk::real>>>& bcdir, const std::unordered_map<int, std::unordered_set<std::size_t>>& symbcnodemap, const std::unordered_map<int, std::unordered_map<std::size_t, std::array<tk::real, 4>>>& bnorm, const tk::Fields& Un, tk::Fields& P)
Compute antidiffusive element contributions (AEC)
auto verify(std::size_t nchare, const std::vector<std::size_t>& inpoel, const tk::Fields& dUh, const tk::Fields& dUl) const -> bool
Verify the assembled antidiffusive element contributions.
auto diff(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const tk::Fields& Un) const -> tk::Fields
Compute mass diffusion contribution to the rhs of the low order system.
void alw(const std::vector<std::size_t>& inpoel, const tk::Fields& Un, const tk::Fields& Ul, tk::Fields& Q) const
Compute the maximum and minimum unknowns of all elements surrounding nodes.
void lim(const std::vector<std::size_t>& inpoel, const std::unordered_map<std::size_t, std::vector<std::pair<bool, tk::real>>>& bcdir, const tk::Fields& P, const tk::Fields& Ul, tk::Fields& Q, tk::Fields& A) const
Compute limited antiffusive element contributions and apply to mesh nodes.
auto fields(const std::vector<std::size_t>& inpoel) const -> std::tuple<std::vector<std::string>, std::vector<std::vector<tk::real>>>

Charm++ pack/unpack serializer member functions

tk::Fields m_aec
Antidiffusive element contributions for all scalar components.
std::vector<std::vector<ncomp_t>> m_sys
Component indices to treat as a system for multiple systems.
std::vector<std::array<ncomp_t, 3>> m_vel
Component indices to treat as a velocity vector for multiple systems.
void pup(PUP::er& p)
Pack/Unpack serialize member function.
void operator|(PUP::er& p, FluxCorrector& i)
Pack/Unpack serialize operator|.

Function documentation

inciter::FluxCorrector::FluxCorrector(std::size_t is = 0) explicit

Parameters
is in Size of the mesh element connectivity vector (inpoel size)

Constructor

template<class... Eq>
std::vector<std::vector<ncomp_t>> inciter::FluxCorrector::findsys()

Template parameters
Eq Equation types to consider as equation systems
Returns List of component indices to treat as a system

Collect scalar comonent indices for equation systems

template<class... Eq>
std::vector<std::array<ncomp_t, 3>> inciter::FluxCorrector::findvel()

Template parameters
Eq Equation types to consider as equation systems
Returns List of 3 component indices to treat as a velocity

Find components of a velocity for equation systems

void inciter::FluxCorrector::aec(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<tk::real>& vol, const std::unordered_map<std::size_t, std::vector<std::pair<bool, tk::real>>>& bcdir, const std::unordered_map<int, std::unordered_set<std::size_t>>& symbcnodemap, const std::unordered_map<int, std::unordered_map<std::size_t, std::array<tk::real, 4>>>& bnorm, const tk::Fields& Un, tk::Fields& P)

Compute antidiffusive element contributions (AEC)

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
vol in Volume associated to mesh nodes
bcdir in Vector of pairs of bool and boundary condition value associated to local mesh node IDs at which to set Dirichlet boundary conditions.
symbcnodemap in Unique set of node ids at which to set symmetry BCs associated to side set ids
bnorm in Face normals in boundary points: key global node id, value: unit normal, outer key: side set id
Un in Solution at the previous time step
in/out The sums of positive (negative) AECs to nodes

The antidiffusive element contributions (AEC) are defined as the difference between the high and low order solution, where the high order solution is obtained from consistent mass Taylor-Galerkin discretization and the low order solution is lumped mass Taylor-Galerkin + diffusion. Note that AEC is not directly computed as dUh - dUl (although that could also be done), but as AEC = M_L^{-1} (M_Le - M_ce) (ctau * Un + dUh), where

  • M_ce is the element's consistent mass matrix,
  • M_Le is the element's lumped mass matrix,
  • ctau is the mass diffusion coefficient on the rhs of the low order solution, see also FluxCorrector::diff(),
  • Un is the solution at the previous time step
  • dUh is the increment of the high order solution, and
  • M_L^{-1} is the inverse of the assembled lumped mass matrix, i.e., the volume associated to a mesh node by summing the quarter of the element volumes surrounding the node. Note that this is the correct node volume taking into account that some nodes are on chare boundaries.

bool inciter::FluxCorrector::verify(std::size_t nchare, const std::vector<std::size_t>& inpoel, const tk::Fields& dUh, const tk::Fields& dUl) const

Verify the assembled antidiffusive element contributions.

Parameters
nchare in Total number of host chares
inpoel in Mesh element connectivity
dUh in Increment of the high order solution
dUl in Increment of the low order solution
Returns True if verification has been done

This verification only makes sense if no communication is to be done, i.e., if there is a single host chare, because the AEC assembled to mesh nodes only contains partial contributions on chare boundaries at this point. Verification in parallel would incure communication of the unlimited AEC, which in general is not necessary, so we will not do that for the sake of verification.

tk::Fields inciter::FluxCorrector::diff(const std::array<std::vector<tk::real>, 3>& coord, const std::vector<std::size_t>& inpoel, const tk::Fields& Un) const

Compute mass diffusion contribution to the rhs of the low order system.

Parameters
coord in Mesh node coordinates
inpoel in Mesh element connectivity
Un in Solution at the previous time step
Returns Mass diffusion contribution to the RHS of the low order system

void inciter::FluxCorrector::alw(const std::vector<std::size_t>& inpoel, const tk::Fields& Un, const tk::Fields& Ul, tk::Fields& Q) const

Compute the maximum and minimum unknowns of all elements surrounding nodes.

Parameters
inpoel in Mesh element connectivity
Un in Solution at the previous time step
Ul in Low order solution
in/out Maximum and mimimum unknowns of elements surrounding nodes

void inciter::FluxCorrector::lim(const std::vector<std::size_t>& inpoel, const std::unordered_map<std::size_t, std::vector<std::pair<bool, tk::real>>>& bcdir, const tk::Fields& P, const tk::Fields& Ul, tk::Fields& Q, tk::Fields& A) const

Compute limited antiffusive element contributions and apply to mesh nodes.

Parameters
inpoel in Mesh element connectivity
bcdir in Vector of pairs of bool and boundary condition value associated to mesh node IDs at which to set Dirichlet boundary conditions.
in The sums of all positive (negative) AECs to nodes
Ul in Low order solution
in/out The maximum and mimimum unknowns of elements surrounding each node
in/out Limited antidiffusive element contributions scatter-added to nodes

std::tuple<std::vector<std::string>, std::vector<std::vector<tk::real>>> inciter::FluxCorrector::fields(const std::vector<std::size_t>& inpoel) const

Returns Names and fields in mesh cells

void inciter::FluxCorrector::pup(PUP::er& p)

Pack/Unpack serialize member function.

Parameters
in/out Charm++'s PUP::er serializer object reference

void inciter::FluxCorrector::operator|(PUP::er& p, FluxCorrector& i)

Pack/Unpack serialize operator|.

Parameters
in/out Charm++'s PUP::er serializer object reference
in/out FluxCorrector object reference