inciter::Discretization class

Discretization Charm++ chare array holding common functinoality to all discretization schemes.

Public types

template<typename... tags>
struct SidesetNodes
Function object for querying the node ids that belong to side sets of the same type, called for each PDE type.

Public static functions

static void registerReducers()
Configure Charm++ reduction types.

Constructors, destructors, conversion operators

Discretization(CkMigrateMessage*) explicit
Migrate constructor.

Public functions

auto Discretization(std::size_t meshid, const std::vector<CProxy_Discretization>& disc, const CProxy_DistFCT& fctproxy, const tk::CProxy_ConjugateGradients& conjugategradientsproxy, const CProxy_Transporter& transporter, const tk::CProxy_MeshWriter& meshwriter, const tk::UnsMesh::CoordMap& coordmap, const tk::UnsMesh::Chunk& el, const tk::CommMaps& msum, int nc) -> Discretization_SDAG_CODE explicit
Constructor.
void meshvelInit(const std::vector<tk::real>& x, const std::vector<tk::real>& div, const std::unordered_map<std::size_t, std::vector<std::pair<bool, tk::real>>>& bc, CkCallback c)
Initialize mesh velocity linear solve: set initial guess and BCs.
void meshvelSolve(CkCallback c)
Solve using Conjugrate Gradients linear solver.
auto meshvelSolution() const -> std::vector<tk::real>
Query the solution of the Conjugrate Gradients linear solver.
void meshvelConv()
Assess and record mesh velocity linear solver convergence.
void transferInit()
Our mesh has been registered with the mesh-to-mesh transfer library (if coupled to other solver)
void transferCallback(std::vector<CkCallback>& cb)
Receive a list of callbacks from our own child solver.
void comcb(std::size_t srcmeshid, CkCallback c)
Receive mesh transfer callbacks from source mesh/solver.
void transfer(const tk::Fields& u)
Start solution transfer (if coupled)
void resizePostAMR(const tk::UnsMesh::Chunk& chunk, const tk::UnsMesh::Coords& coord, const tk::NodeCommMap& nodeCommMap)
Resize mesh data structures after mesh refinement.
void startvol()
Get ready for (re-)computing/communicating nodal volumes.
void vol()
Sum mesh volumes to nodes, start communicating them on chare-boundaries.
void setRefiner(const CProxy_Refiner& ref)
Set Refiner Charm++ proxy.
void comvol(const std::vector<std::size_t>& gid, const std::vector<tk::real>& nodevol)
Collect nodal volumes across chare boundaries.
void totalvol()
Sum mesh volumes and contribute own mesh volume to total volume.
void stat(tk::real mesh_volume)
Compute mesh cell statistics.
void boxvol(const std::vector<std::unordered_set<std::size_t>>& nodes)
Compute total box IC volume.

Charm++ pack/unpack serializer member functions

std::size_t m_meshid
Mesh ID.
CkCallback m_transfer_complete
Function to continue with if not coupled to any other solver.
std::vector<Transfer> m_transfer
std::vector<Transfer> m_mytransfer
std::vector<CProxy_Discretization> m_disc
Discretization proxies (one per mesh)
int m_nchare
Total number of Discretization chares.
uint64_t m_it
Iteration count.
uint64_t m_itr
uint64_t m_itf
tk::real m_initial
Flag that is nonzero during setup and zero during time stepping.
tk::real m_t
Physical time.
tk::real m_lastDumpTime
Physics time at last field output.
tk::real m_physFieldFloor
Recent floor of physics time divided by field output interval time.
tk::real m_physHistFloor
Recent floor of physics time divided by history output interval time.
tk::real m_dt
Physical time step size.
tk::real m_dtn
Physical time step size at the previous time step.
std::size_t m_nvol
Number of chares from which we received nodal volume contributions on chare boundaries.
CProxy_DistFCT m_fct
Distributed FCT proxy.
tk::CProxy_ConjugateGradients m_conjugategradients
Distributed conjugrate gradients solver proxy.
CProxy_Transporter m_transporter
Transporter proxy.
tk::CProxy_MeshWriter m_meshwriter
Mesh writer proxy.
CProxy_Refiner m_refiner
Mesh refiner proxy.
tk::UnsMesh::Chunk m_el
Elements of the mesh chunk we operate on.
std::vector<std::size_t>& m_inpoel
Alias to element connectivity.
std::vector<std::size_t>& m_gid
Alias to global node IDs of owned elements.
std::unordered_map<std::size_t, std::size_t>& m_lid
Alias to local node ids associated to the global ones of owned elements.
tk::UnsMesh::Coords m_coord
Mesh point coordinates.
tk::NodeCommMap m_nodeCommMap
Global mesh node IDs bordering the mesh chunk held by fellow Discretization chares associated to their chare IDs.
tk::EdgeCommMap m_edgeCommMap
Edges with global node IDs bordering the mesh chunk held by fellow Discretization chares associated to their chare IDs.
tk::real m_meshvol
Total mesh volume.
std::vector<tk::real> m_v
std::vector<tk::real> m_vol
std::unordered_map<std::size_t, tk::real> m_volc
std::vector<tk::real> m_voln
std::vector<tk::real> m_vol0
Mesh element volumes at t=t0.
tk::real m_boxvol
Volume of user-defined box IC.
std::unordered_map<std::size_t, std::size_t> m_bid
Local chare-boundary mesh node IDs at which we receive contributions associated to global mesh node IDs of elements we contribute to.
tk::Timer m_timer
Timer measuring a time step.
int m_refined
1 if mesh was refined in a time step, 0 if it was not
Clock::time_point m_prevstatus
Time point storing clock state at status()
int m_nrestart
Number of times restarted.
std::vector<HistData> m_histdata
Data at history point locations.
std::size_t m_nsrc
Number of transfers requested as a source.
std::size_t m_ndst
Number of transfers requested as a destination.
bool m_meshvel_converged
True if all stages of the time step converged the mesh velocity linear solve in ALE.
void pup(PUP::er& p) override
Pack/Unpack serialize member function.
void operator|(PUP::er& p, Discretization& i)
Pack/Unpack serialize operator|.

Accessors

auto Coord() const -> const tk::UnsMesh::Coords&
auto Coord() -> tk::UnsMesh::Coords&
Coordinates accessor as reference.
auto Gid() const -> const std::vector<std::size_t>&
Global ids accessors as const-ref.
auto Lid() const -> const std::unordered_map<std::size_t, std::size_t>&
Local ids accessors as const-ref.
auto Inpoel() const -> const std::vector<std::size_t>&
Tetrahedron element connectivity (with local ids) accessors as const-ref.
auto Chunk() const -> const tk::UnsMesh::Chunk&
Mesh chunk accessor as const-ref.
auto meshvol() const -> tk::real
Total mesh volume accessor.
auto V() const -> const std::vector<tk::real>&
Nodal mesh volume accessors const-ref.
auto Vol() const -> const std::vector<tk::real>&
Nodal mesh volumes at current time step accessors as const-ref.
auto Voln() const -> const std::vector<tk::real>&
Nodal mesh volumes at previous time step accessors as const-ref.
auto Voln() -> std::vector<tk::real>&
Nodal mesh volumes at previous time step accessors as ref.
auto Vol0() const -> const std::vector<tk::real>&
Element mesh volumes at t=t0 accessors as const-ref.
void Initial(tk::real i)
auto Initial() const -> bool
auto Hist() const -> const std::vector<HistData>&
History points data accessor as const-ref.
auto Boxvol() -> tk::real&
Box volume accessor.
auto MeshId() const -> std::size_t
Mesh ID accessor.
auto Dt() const -> tk::real
Time step size accessor.
auto Dtn() const -> tk::real
Time step size at previous time step accessor.
auto T() const -> tk::real
Physical time accessor.
auto It() const -> uint64_t
Iteration count accessor.
auto Itr() -> uint64_t&
Non-const-ref refinement iteration count accessor.
auto Itf() -> uint64_t&
Non-const-ref field-output iteration count accessor.
auto Nrestart() -> int&
Non-const-ref number of restarts accessor.
auto Timer() const -> const tk::Timer&
Timer accessor as const-ref.
auto Timer() -> tk::Timer&
Timer accessor as non-const-ref.
auto refined() const -> int
Accessor to flag indicating if the mesh was refined as a value.
auto refined() -> int&
Accessor to flag indicating if the mesh was refined as non-const-ref.
auto Tr() const -> const CProxy_Transporter&
Transporter proxy accessor as const-ref.
auto Tr() -> CProxy_Transporter&
Transporter proxy accessor as non-const-ref.
auto Ref() const -> Refiner*
Access bound Refiner class pointer.
auto FCT() const -> DistFCT*
Access bound DistFCT class pointer.
auto ConjugateGradients() const -> tk::ConjugateGradients*
Access bound ConjugateGradients class pointer.
auto coupled(std::size_t meshid) const -> CProxy_Discretization
Access Discretization proxy for a mesh.
auto Transfers() const -> const std::vector<Transfer>&
Const-ref accessor to solver/mesh transfer configuration.
auto Bid() const -> const std::unordered_map<std::size_t, std::size_t>&
Boundary node ids accessor as const-ref.
auto NodeCommMap() const -> const tk::NodeCommMap&
Node communication map accessor as const-ref.
auto EdgeCommMap() const -> const tk::EdgeCommMap&
Edge communication map accessor as const-ref.
void setdt(tk::real newdt)
Set time step size.
void next()
Prepare for next step.
void status()
Otput one-liner status report.
auto histfilename(const std::string& id, kw::precision::info::expect::type precision) -> std::string
Construct history output filename.
void histheader(std::vector<std::string>&& names)
Output headers for time history files (one for each point)
void history(std::vector<std::vector<tk::real>>&& data)
Output time history for a time step.
void write(const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& coord, const std::map<int, std::vector<std::size_t>>& bface, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& triinpoel, const std::vector<std::string>& elemfieldnames, const std::vector<std::string>& nodefieldnames, const std::vector<std::string>& nodesurfnames, const std::vector<std::vector<tk::real>>& elemfields, const std::vector<std::vector<tk::real>>& nodefields, const std::vector<std::vector<tk::real>>& nodesurfs, CkCallback c)
Output mesh and fields data (solution dump) to file(s)
void grindZero()
Zero grind-timer.
auto restarted(int nrestart) -> bool
Detect if just returned from a checkpoint and if so, zero timers.
void remap(const std::unordered_map<std::size_t, std::size_t>& map)
Remap mesh data due to new local ids.
template<typename... tags>
auto bcnodes(const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel) const -> std::unordered_map<int, std::unordered_set<std::size_t>>
Query nodes that belong to side sets of the same type for all PDE types.
auto bndel() const -> std::vector<std::size_t>
Find elements along our mesh chunk boundary.
auto ALE() const -> bool
Query if ALE mesh motion is enabled by the user.
auto fielditer() const -> bool
Decide if field output iteration count interval is hit.
auto fieldtime() const -> bool
Decide if field output physics time interval is hit.
auto histiter() const -> bool
Decide if history output iteration count interval is hit.
auto histtime() const -> bool
Decide if history output physics time interval is hit.
auto finished() const -> bool
Decide if this is the last time step.

Function documentation

static void inciter::Discretization::registerReducers()

Configure Charm++ reduction types.

Since this is a [initnode] routine, see the .ci file, the Charm++ runtime system executes the routine exactly once on every logical node early on in the Charm++ init sequence. Must be static as it is called without an object. See also: Section "Initializations at Program Startup" at in the Charm++ manual http://charm.cs.illinois.edu/manuals/html/charm++/manual.html.

Discretization_SDAG_CODE inciter::Discretization::Discretization(std::size_t meshid, const std::vector<CProxy_Discretization>& disc, const CProxy_DistFCT& fctproxy, const tk::CProxy_ConjugateGradients& conjugategradientsproxy, const CProxy_Transporter& transporter, const tk::CProxy_MeshWriter& meshwriter, const tk::UnsMesh::CoordMap& coordmap, const tk::UnsMesh::Chunk& el, const tk::CommMaps& msum, int nc) explicit

Constructor.

Parameters
meshid in Mesh ID
disc in All Discretization proxies (one per mesh)
fctproxy in Distributed FCT proxy
conjugategradientsproxy in Distributed Conjugrate Gradients linear solver proxy
transporter in Host (Transporter) proxy
meshwriter in Mesh writer proxy
coordmap in Coordinates of mesh nodes and their global IDs
el
msum in Communication maps associated to chare IDs bordering the mesh chunk we operate on
nc in Total number of Discretization chares

void inciter::Discretization::meshvelInit(const std::vector<tk::real>& x, const std::vector<tk::real>& div, const std::unordered_map<std::size_t, std::vector<std::pair<bool, tk::real>>>& bc, CkCallback c)

Initialize mesh velocity linear solve: set initial guess and BCs.

Parameters
in Initial guess for mesh velocity linear solve
div in Velocity divergence for Helmholtz rhs
bc in Local node ids associated to linear solver Dirichlet BCs
c

std::vector<tk::real> inciter::Discretization::meshvelSolution() const

Query the solution of the Conjugrate Gradients linear solver.

Returns Solution to the Conjugate Gradients linear solve

Query the solution of the Conjugrate Gradients linear solver

void inciter::Discretization::transferCallback(std::vector<CkCallback>& cb)

Receive a list of callbacks from our own child solver.

Parameters
cb in List of callbacks

This is called by our child solver, either when it is coupled to another solver or not.

void inciter::Discretization::comcb(std::size_t srcmeshid, CkCallback c)

Receive mesh transfer callbacks from source mesh/solver.

Parameters
srcmeshid in Source mesh (solver) id
in Callback received

void inciter::Discretization::transfer(const tk::Fields& u)

Start solution transfer (if coupled)

Parameters
in Solution to transfer from/to

void inciter::Discretization::resizePostAMR(const tk::UnsMesh::Chunk& chunk, const tk::UnsMesh::Coords& coord, const tk::NodeCommMap& nodeCommMap)

Resize mesh data structures after mesh refinement.

Parameters
chunk in New mesh chunk (connectivity and global<->local id maps)
coord in New mesh node coordinates
nodeCommMap in New node communication map

void inciter::Discretization::setRefiner(const CProxy_Refiner& ref)

Set Refiner Charm++ proxy.

Parameters
ref in Incoming refiner proxy to store

void inciter::Discretization::comvol(const std::vector<std::size_t>& gid, const std::vector<tk::real>& nodevol)

Collect nodal volumes across chare boundaries.

Parameters
gid in Global mesh node IDs at which we receive volume contributions
nodevol in Partial sums of nodal volume contributions to chare-boundary nodes

This function receives contributions to m_vol, which stores the nodal volumes. While m_vol stores own contributions, m_volc collects the neighbor chare contributions during communication. This way work on m_vol and m_volc is overlapped. The contributions are applied in totalvol().

void inciter::Discretization::stat(tk::real mesh_volume)

Compute mesh cell statistics.

Parameters
mesh_volume in Total mesh volume

void inciter::Discretization::boxvol(const std::vector<std::unordered_set<std::size_t>>& nodes)

Compute total box IC volume.

Parameters
nodes in Node list contributing to box IC volume (for each IC box)

void inciter::Discretization::pup(PUP::er& p) override

Pack/Unpack serialize member function.

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

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

Pack/Unpack serialize operator|.

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

const tk::UnsMesh::Coords& inciter::Discretization::Coord() const

Coordinates accessor as const-ref

void inciter::Discretization::Initial(tk::real i)

Parameters
in Value to put in 'initial'

Set 'initial' flag

bool inciter::Discretization::Initial() const

Returns True during setup, false durign time stepping

Query 'initial' flag

void inciter::Discretization::setdt(tk::real newdt)

Set time step size.

Parameters
newdt in Size of the new time step

std::string inciter::Discretization::histfilename(const std::string& id, kw::precision::info::expect::type precision)

Construct history output filename.

Parameters
id in History point id
precision in Floating point precision to use for output
Returns History file name

void inciter::Discretization::histheader(std::vector<std::string>&& names)

Output headers for time history files (one for each point)

Parameters
names in History output variable names

void inciter::Discretization::history(std::vector<std::vector<tk::real>>&& data)

Output time history for a time step.

Parameters
data in Time history data for all variables and equations integrated

void inciter::Discretization::write(const std::vector<std::size_t>& inpoel, const tk::UnsMesh::Coords& coord, const std::map<int, std::vector<std::size_t>>& bface, const std::map<int, std::vector<std::size_t>>& bnode, const std::vector<std::size_t>& triinpoel, const std::vector<std::string>& elemfieldnames, const std::vector<std::string>& nodefieldnames, const std::vector<std::string>& nodesurfnames, const std::vector<std::vector<tk::real>>& elemfields, const std::vector<std::vector<tk::real>>& nodefields, const std::vector<std::vector<tk::real>>& nodesurfs, CkCallback c)

Output mesh and fields data (solution dump) to file(s)

Parameters
inpoel in Mesh connectivity for the mesh chunk to be written
coord in Node coordinates of the mesh chunk to be written
bface in Map of boundary-face lists mapped to corresponding side set ids for this mesh chunk
bnode in Map of boundary-node lists mapped to corresponding side set ids for this mesh chunk
triinpoel in Interconnectivity of points and boundary-face in this mesh chunk
elemfieldnames in Names of element fields to be output to file
nodefieldnames in Names of node fields to be output to file
nodesurfnames in Names of node surface fields to be output to file
elemfields in Field data in mesh elements to output to file
nodefields in Field data in mesh nodes to output to file
nodesurfs in Surface field data in mesh nodes to output to file
in Function to continue with after the write

Since m_meshwriter is a Charm++ chare group, it never migrates and an instance is guaranteed on every PE. We index the first PE on every logical compute node. In Charm++'s non-SMP mode, a node is the same as a PE, so the index is the same as CkMyPe(). In SMP mode the index is the first PE on every logical node. In non-SMP mode this yields one or more output files per PE with zero or non-zero virtualization, respectively. If there are multiple chares on a PE, the writes are serialized per PE, since only a single entry method call can be executed at any given time. In SMP mode, still the same number of files are output (one per chare), but the output is serialized through the first PE of each compute node. In SMP mode, channeling multiple files via a single PE on each node is required by NetCDF and HDF5, as well as ExodusII, since none of these libraries are thread-safe.

bool inciter::Discretization::restarted(int nrestart)

Detect if just returned from a checkpoint and if so, zero timers.

Parameters
nrestart in Number of times restarted
Returns True if restart detected

void inciter::Discretization::remap(const std::unordered_map<std::size_t, std::size_t>& map)

Remap mesh data due to new local ids.

Parameters
map in Mapping of old->new local ids

template<typename... tags>
std::unordered_map<int, std::unordered_set<std::size_t>> inciter::Discretization::bcnodes(const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel) const

Query nodes that belong to side sets of the same type for all PDE types.

Template parameters
tags Tags addressing the location of a vector of vectors of side set ids in the input deck
Parameters
bface in Boundary-faces mapped to side set ids
triinpoel in Boundary-face connectivity
Returns Node ids that belong side sets of the same type (value), associated to sides set id (key)

std::vector<std::size_t> inciter::Discretization::bndel() const

Find elements along our mesh chunk boundary.

Returns List of local element ids that have at least a single node contributing to a chare boundary

bool inciter::Discretization::fielditer() const

Decide if field output iteration count interval is hit.

Returns True if field output iteration count interval is hit

bool inciter::Discretization::fieldtime() const

Decide if field output physics time interval is hit.

Returns True if field output physics time interval is hit

bool inciter::Discretization::histiter() const

Decide if history output iteration count interval is hit.

Returns True if history output iteration count interval is hit

bool inciter::Discretization::histtime() const

Decide if history output physics time interval is hit.

Returns True if history output physics time interval is hit

bool inciter::Discretization::finished() const

Decide if this is the last time step.

Returns True if this is the last time step

Variable documentation

std::vector<Transfer> inciter::Discretization::m_transfer

Solution/mesh transfer (coupling) information

This has the same size with the same src/dst information on all solvers.

std::vector<Transfer> inciter::Discretization::m_mytransfer

My solution transfer/mesh (coupling) information

This is a subset of m_transfer, holding only those entries that this solver is involved in (either a source or a destination).

uint64_t inciter::Discretization::m_itr

Iteration count with mesh refinement

Used as the restart sequence number {RS} in saving output in an ExodusII sequence

uint64_t inciter::Discretization::m_itf

Field output iteration count without mesh refinement

Counts the number of field outputs to file during two time steps with mesh efinement

tk::UnsMesh::Chunk inciter::Discretization::m_el

Elements of the mesh chunk we operate on.

Initialized by the constructor. The first vector is the element connectivity (local IDs), the second vector is the global node IDs of owned elements, while the third one is a map of global->local node IDs.

std::vector<tk::real> inciter::Discretization::m_v

Nodal mesh volumes

This is the volume of the mesh associated to nodes of owned elements (sum of surrounding cell volumes / 4) without contributions from other chares on chare-boundaries

std::vector<tk::real> inciter::Discretization::m_vol

Volume of nodes

This is the volume of the mesh associated to nodes of owned elements (sum of surrounding cell volumes / 4) with contributions from other chares on chare-boundaries

std::unordered_map<std::size_t, tk::real> inciter::Discretization::m_volc

Receive buffer for volume of nodes (with global node id as key)

This is a communication buffer used to compute the volume of the mesh associated to nodes of owned elements (sum of surrounding cell volumes / 4) with contributions from other chares on chare-boundaries.

std::vector<tk::real> inciter::Discretization::m_voln

Volume of nodes at previous time step

This is the volume of the mesh associated to nodes of owned elements (sum of surrounding cell volumes / 4) with contributions from other chares on chare-boundaries at the previous time step stage