template<class Physics, class Problem>
CompFlow class
CompFlow used polymorphically with tk::CGPDE.
Contents
The template arguments specify policies and are used to configure the behavior of the class. The policies are:
- Physics - physics configuration, see PDE/CompFlow/Physics.h
Problem - problem configuration, see PDE/CompFlow/Problems.h
Constructors, destructors, conversion operators
- CompFlow() explicit
- Constructor.
Public functions
-
void IcBoxNodes(const tk::
UnsMesh:: Coords& coord, const std::vector<std::size_t>& inpoel, const std::unordered_map<std::size_t, std::set<std::size_t>>& elemblkid, std::vector<std::unordered_set<std::size_t>>& inbox, std::unordered_map<std::size_t, std::set<std::size_t>>& nodeblkid, std::size_t& nuserblk) const -
void initialize(const std::array<std::vector<real>, 3>& coord,
tk::Fields& unk,
real t,
real V,
const std::vector<std::unordered_set<std::size_t>>& inbox,
const std::vector<tk::
real>& blkvols, const std::unordered_map<std::size_t, std::set<std::size_t>>& nodeblkid) const -
void velocity(const tk::Fields& u,
tk::
UnsMesh:: Coords& v) const -
void soundspeed(const tk::Fields& U,
std::vector<tk::
real>& s) const - auto analyticSolution(real xi, real yi, real zi, real t) const -> std::vector<real>
-
auto solution(tk::
real xi, tk:: real yi, tk:: real zi, tk:: real t) const -> std::vector<tk:: real> - void chBndGrad(const std::array<std::vector<real>, 3>& coord, const std::vector<std::size_t>& inpoel, const std::vector<std::size_t>& bndel, const std::vector<std::size_t>& gid, const std::unordered_map<std::size_t, std::size_t>& bid, const tk::Fields& U, tk::Fields& G) const
- Compute nodal gradients of primitive variables for ALECG along chare-boundary.
-
void rhs(real t,
const std::array<std::vector<real>, 3>& coord,
const std::vector<std::size_t>& inpoel,
const std::vector<std::size_t>& triinpoel,
const std::vector<std::size_t>& gid,
const std::unordered_map<std::size_t, std::size_t>& bid,
const std::unordered_map<std::size_t, std::size_t>& lid,
const std::vector<real>& dfn,
const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& psup,
const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup,
const std::vector<int>& symbctri,
const std::vector<real>& vol,
const std::vector<std::size_t>& edgenode,
const std::vector<std::size_t>& edgeid,
const std::vector<std::unordered_set<std::size_t>>& boxnodes,
const tk::Fields& G,
const tk::Fields& U,
const tk::Fields& W,
const std::vector<tk::
real>& tp, real V, tk::Fields& R) const -
void getMeshVel(real,
const std::array<std::vector<real>, 3>&,
const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& psup,
const std::unordered_set<std::size_t>& symbcnodes,
const std::array<tk::
real, 3>& uservel, const tk::Fields& U, tk::Fields&, int& movedmesh) const - Compute overset mesh motion for OversetFE.
-
auto dt(const std::array<std::vector<real>, 3>& coord,
const std::vector<std::size_t>& inpoel,
tk::
real t, tk:: real dtn, const tk::Fields& U, const std::vector<tk:: real>& vol, const std::vector<tk:: real>& voln) const -> real -
void dt(uint64_t,
const std::vector<tk::
real>& vol, const tk::Fields& U, std::vector<tk:: real>& dtp) const -
auto dirbc(real t,
real deltat,
const std::vector<tk::
real>& tp, const std::vector<tk:: real>& dtp, const std::pair<const int, std::vector<std::size_t>>& ss, const std::array<std::vector<real>, 3>& coord, bool increment) const -> std::map<std::size_t, std::vector<std::pair<bool, real>>> - Query Dirichlet boundary condition value on a given side set for all components in this PDE system.
- void symbc(tk::Fields& U, const std::array<std::vector<real>, 3>&, const std::unordered_map<int, std::unordered_map<std::size_t, std::array<real, 4>>>& bnorm, const std::unordered_set<std::size_t>& nodes) const
- void farfieldbc(tk::Fields& U, const std::array<std::vector<real>, 3>&, const std::unordered_map<int, std::unordered_map<std::size_t, std::array<real, 4>>>& bnorm, const std::unordered_set<std::size_t>& nodes) const
-
void timedepbc(tk::
real t, tk::Fields& U, const std::vector<std::unordered_set<std::size_t>>& nodes, const std::vector<tk:: Table<5>>& timedepfn) const -
auto OutVarFn() const -> std::map<std::string, tk::
GetVarFn> - auto analyticFieldNames() const -> std::vector<std::string>
- auto surfNames() const -> std::vector<std::string>
- auto histNames() const -> std::vector<std::string>
- auto surfOutput(const std::map<int, std::vector<std::size_t>>& bnd, const tk::Fields& U) const -> std::vector<std::vector<real>>
- Return nodal surface field output going to file.
- auto elemSurfOutput(const std::map<int, std::vector<std::size_t>>& bface, const std::vector<std::size_t>& triinpoel, const tk::Fields& U) const -> std::vector<std::vector<real>>
- Return elemental surface field output (on triangle faces) going to file.
- auto histOutput(const std::vector<HistData>& h, const std::vector<std::size_t>& inpoel, const tk::Fields& U) const -> std::vector<std::vector<real>>
- Return time history field output evaluated at time history points.
- auto names() const -> std::vector<std::string>
Function documentation
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: IcBoxNodes(const tk:: UnsMesh:: Coords& coord,
const std::vector<std::size_t>& inpoel,
const std::unordered_map<std::size_t, std::set<std::size_t>>& elemblkid,
std::vector<std::unordered_set<std::size_t>>& inbox,
std::unordered_map<std::size_t, std::set<std::size_t>>& nodeblkid,
std::size_t& nuserblk) const
Parameters | |
---|---|
coord in | Mesh node coordinates |
inpoel in | Element node connectivity |
elemblkid in | Element ids associated with mesh block ids where user ICs are set |
inbox in/out | List of nodes at which box user ICs are set for each IC box |
nodeblkid in/out | Node ids associated to mesh block ids, where user ICs are set |
nuserblk in/out | number of mesh blocks where user ICs are set |
Determine nodes that lie inside the user-defined IC box and mesh blocks
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: initialize(const std::array<std::vector<real>, 3>& coord,
tk::Fields& unk,
real t,
real V,
const std::vector<std::unordered_set<std::size_t>>& inbox,
const std::vector<tk:: real>& blkvols,
const std::unordered_map<std::size_t, std::set<std::size_t>>& nodeblkid) const
Parameters | |
---|---|
coord in | Mesh node coordinates |
unk in/out | Array of unknowns |
t in | Physical time |
V in | Discrete volume of user-defined IC box |
inbox in | List of nodes at which box user ICs are set (for each box IC) |
blkvols in | Vector of discrete volumes of each block where user ICs are set |
nodeblkid in | Node ids associated to mesh block ids, where user ICs are set |
Initalize the compressible flow equations, prepare for time integration
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: velocity(const tk::Fields& u,
tk:: UnsMesh:: Coords& v) const
Parameters | |
---|---|
u in | Solution vector of conserved variables |
v in/out | Velocity components |
Query the fluid velocity
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: soundspeed(const tk::Fields& U,
std::vector<tk:: real>& s) const
Parameters | |
---|---|
U in | Solution vector of conserved variables |
s in/out | Speed of sound in mesh nodes |
Query the sound speed
template<class Physics, class Problem>
std::vector<real> inciter:: cg:: CompFlow<Physics, Problem>:: analyticSolution(real xi,
real yi,
real zi,
real t) const
Parameters | |
---|---|
xi in | X-coordinate |
yi in | Y-coordinate |
zi in | Z-coordinate |
t in | Physical time |
Returns | Vector of analytic solution at given location and time |
Return analytic solution (if defined by Problem) at xi, yi, zi, t
template<class Physics, class Problem>
std::vector<tk:: real> inciter:: cg:: CompFlow<Physics, Problem>:: solution(tk:: real xi,
tk:: real yi,
tk:: real zi,
tk:: real t) const
Parameters | |
---|---|
xi in | X-coordinate at which to evaluate the analytic solution |
yi in | Y-coordinate at which to evaluate the analytic solution |
zi in | Z-coordinate at which to evaluate the analytic solution |
t in | Physical time at which to evaluate the analytic solution |
Returns | Vector of analytic solution at given location and time |
Return analytic solution for conserved variables
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: chBndGrad(const std::array<std::vector<real>, 3>& coord,
const std::vector<std::size_t>& inpoel,
const std::vector<std::size_t>& bndel,
const std::vector<std::size_t>& gid,
const std::unordered_map<std::size_t, std::size_t>& bid,
const tk::Fields& U,
tk::Fields& G) const
Compute nodal gradients of primitive variables for ALECG along chare-boundary.
Parameters | |
---|---|
coord in | Mesh node coordinates |
inpoel in | Mesh element connectivity |
bndel in | List of elements contributing to chare-boundary nodes |
gid in | Local->global node id map |
bid in | Local chare-boundary node ids (value) associated to global node ids (key) |
U in | Solution vector at recent time step |
G in/out | Nodal gradients of primitive variables |
This function only computes local contributions to gradients at chare-boundary nodes. Internal node gradients are calculated as required, and do not need to be stored.
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: rhs(real t,
const std::array<std::vector<real>, 3>& coord,
const std::vector<std::size_t>& inpoel,
const std::vector<std::size_t>& triinpoel,
const std::vector<std::size_t>& gid,
const std::unordered_map<std::size_t, std::size_t>& bid,
const std::unordered_map<std::size_t, std::size_t>& lid,
const std::vector<real>& dfn,
const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& psup,
const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& esup,
const std::vector<int>& symbctri,
const std::vector<real>& vol,
const std::vector<std::size_t>& edgenode,
const std::vector<std::size_t>& edgeid,
const std::vector<std::unordered_set<std::size_t>>& boxnodes,
const tk::Fields& G,
const tk::Fields& U,
const tk::Fields& W,
const std::vector<tk:: real>& tp,
real V,
tk::Fields& R) const
Parameters | |
---|---|
t in | Physical time |
coord in | Mesh node coordinates |
inpoel in | Mesh element connectivity |
triinpoel in | Boundary triangle face connecitivity with local ids |
gid in | Local->glocal node ids |
bid in | Local chare-boundary node ids (value) associated to global node ids (key) |
lid in | Global->local node ids |
dfn in | Dual-face normals |
psup in | Points surrounding points |
esup in | Elements surrounding points |
symbctri in | Vector with 1 at symmetry BC boundary triangles |
vol in | Nodal volumes |
edgenode in | Local node IDs of edges |
edgeid in | Edge ids in the order of access |
boxnodes in | Mesh node ids within user-defined IC boxes |
G in | Nodal gradients for chare-boundary nodes |
U in | Solution vector at recent time step |
W in | Mesh velocity |
tp in | Physical time for each mesh node |
V in | Total box volume |
R in/out | Right-hand side vector computed |
Compute right hand side for ALECG
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: getMeshVel(real,
const std::array<std::vector<real>, 3>&,
const std::pair<std::vector<std::size_t>, std::vector<std::size_t>>& psup,
const std::unordered_set<std::size_t>& symbcnodes,
const std::array<tk:: real, 3>& uservel,
const tk::Fields& U,
tk::Fields&,
int& movedmesh) const
Compute overset mesh motion for OversetFE.
Parameters | |
---|---|
psup in | Points surrounding points |
symbcnodes in | Symmetry BC node list |
uservel in | User specified constant mesh velocity |
U in | Solution vector at recent time step |
movedmesh in/out | True/false if mesh moved |
template<class Physics, class Problem>
real inciter:: cg:: CompFlow<Physics, Problem>:: dt(const std::array<std::vector<real>, 3>& coord,
const std::vector<std::size_t>& inpoel,
tk:: real t,
tk:: real dtn,
const tk::Fields& U,
const std::vector<tk:: real>& vol,
const std::vector<tk:: real>& voln) const
Parameters | |
---|---|
coord in | Mesh node coordinates |
inpoel in | Mesh element connectivity |
t in | Physical time |
dtn in | Time step size at the previous time step |
U in | Solution vector at recent time step |
vol in | Nodal volume (with contributions from other chares) |
voln in | Nodal volume (with contributions from other chares) at the previous time step |
Returns | Minimum time step size |
Compute the minimum time step size (for unsteady time stepping)
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: dt(uint64_t,
const std::vector<tk:: real>& vol,
const tk::Fields& U,
std::vector<tk:: real>& dtp) const
Parameters | |
---|---|
vol in | Nodal volume (with contributions from other chares) |
U in | Solution vector at recent time step |
dtp in/out | Time step size for each mesh node |
Compute a time step size for each mesh node (for steady time stepping)
template<class Physics, class Problem>
std::map<std::size_t, std::vector<std::pair<bool, real>>> inciter:: cg:: CompFlow<Physics, Problem>:: dirbc(real t,
real deltat,
const std::vector<tk:: real>& tp,
const std::vector<tk:: real>& dtp,
const std::pair<const int, std::vector<std::size_t>>& ss,
const std::array<std::vector<real>, 3>& coord,
bool increment) const
Query Dirichlet boundary condition value on a given side set for all components in this PDE system.
Parameters | |
---|---|
t in | Physical time |
deltat in | Time step size |
tp in | Physical time for each mesh node |
dtp in | Time step size for each mesh node |
ss in | Pair of side set ID and (local) node IDs on the side set |
coord in | Mesh node coordinates |
increment in | If true, evaluate the solution increment between t and t+dt for Dirichlet BCs. If false, evlauate the solution instead. |
Returns | Vector of pairs of bool and boundary condition value associated to mesh node IDs at which Dirichlet boundary conditions are set. Note that if increment is true, instead of the actual boundary condition value, we return the increment between t+deltat and t, since, depending on client code and solver, that may be what the solution requires. |
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: symbc(tk::Fields& U,
const std::array<std::vector<real>, 3>&,
const std::unordered_map<int, std::unordered_map<std::size_t, std::array<real, 4>>>& bnorm,
const std::unordered_set<std::size_t>& nodes) const
Parameters | |
---|---|
U in | Solution vector at recent time step |
bnorm in | Face normals in boundary points, key local node id, first 3 reals of value: unit normal, outer key: side set id |
nodes in | Unique set of node ids at which to set symmetry BCs |
Set symmetry boundary conditions at nodes
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: farfieldbc(tk::Fields& U,
const std::array<std::vector<real>, 3>&,
const std::unordered_map<int, std::unordered_map<std::size_t, std::array<real, 4>>>& bnorm,
const std::unordered_set<std::size_t>& nodes) const
Parameters | |
---|---|
U in | Solution vector at recent time step |
bnorm in | Face normals in boundary points, key local node id, first 3 reals of value: unit normal, outer key: side set id |
nodes in | Unique set of node ids at which to set farfield BCs |
Set farfield boundary conditions at nodes
template<class Physics, class Problem>
void inciter:: cg:: CompFlow<Physics, Problem>:: timedepbc(tk:: real t,
tk::Fields& U,
const std::vector<std::unordered_set<std::size_t>>& nodes,
const std::vector<tk:: Table<5>>& timedepfn) const
Parameters | |
---|---|
t in | Physical time |
U in/out | Solution vector at recent time step |
nodes in | Vector of unique sets of node ids at which to apply BCs |
timedepfn |
Apply user defined time dependent BCs This function applies user defined time dependent boundary conditions on groups of side sets specified in the input file. The user specifies pressure, density, and velocity as discrete functions of time, in the control file, associated with a group of side sets. Several such groups can be specified, each with their own discrete function: p(t), rho(t), vx(t), vy(t), vz(t).
template<class Physics, class Problem>
std::map<std::string, tk:: GetVarFn> inciter:: cg:: CompFlow<Physics, Problem>:: OutVarFn() const
Returns | Map that associates user-specified strings to functions that compute relevant quantities to be output to file |
---|
Return a map that associates user-specified strings to functions
template<class Physics, class Problem>
std::vector<std::string> inciter:: cg:: CompFlow<Physics, Problem>:: analyticFieldNames() const
Returns | Vector of strings labelling analytic fields output in file |
---|
Return analytic field names to be output to file
template<class Physics, class Problem>
std::vector<std::string> inciter:: cg:: CompFlow<Physics, Problem>:: surfNames() const
Returns | Vector of strings labelling surface fields output in file |
---|
Return surface field names to be output to file
template<class Physics, class Problem>
std::vector<std::string> inciter:: cg:: CompFlow<Physics, Problem>:: histNames() const
Returns | Vector of strings labelling time history fields output in file |
---|
Return time history field names to be output to file
template<class Physics, class Problem>
std::vector<std::string> inciter:: cg:: CompFlow<Physics, Problem>:: names() const
Returns | Vector of strings labelling integral variables output |
---|
Return names of integral variables to be output to diagnostics file