7#ifndef DGBOUNDARYCONDITIONEXACT_H_
8#define DGBOUNDARYCONDITIONEXACT_H_
25template <MInt nDim,
class SysEqn>
48template <MInt nDim,
class SysEqn>
50 MFloat* nodeVarsL = &surfaces().nodeVars(surfaceId, 0);
51 MFloat* nodeVarsR = &surfaces().nodeVars(surfaceId, 1);
52 MFloat* stateL = &surfaces().variables(surfaceId, 0);
53 MFloat* stateR = &surfaces().variables(surfaceId, 1);
57 MFloat* boundaryState = (surfaces().internalSideId(surfaceId) == 1) ? stateL : stateR;
58 MFloat* boundaryNodeVars = (surfaces().internalSideId(surfaceId) == 1) ? nodeVarsL : nodeVarsR;
59 MFloat* innerNodeVars = (surfaces().internalSideId(surfaceId) == 1) ? nodeVarsR : nodeVarsL;
62 const MInt noNodes1D = surfaces().noNodes1D(surfaceId);
63 const MInt noNodes1D3 = (nDim == 3) ? noNodes1D : 1;
64 const MInt dirId = surfaces().orientation(surfaceId);
65 MFloatTensor u(boundaryState, noNodes1D, noNodes1D3, SysEqn::noVars());
68 MFloatTensor nodeVars(boundaryNodeVars, noNodes1D, noNodes1D3, std::max(SysEqn::noNodeVars(), 1));
69 MFloatTensor x(&surfaces().nodeCoords(surfaceId), noNodes1D, noNodes1D3, nDim);
71 for(
MInt i = 0; i < noNodes1D; i++) {
72 for(
MInt j = 0; j < noNodes1D3; j++) {
73 sysEqn().calcInitialCondition(time, &x(i, j, 0), &nodeVars(i, j, 0), &u(i, j, 0));
80 MFloat* f = flux(surfaceId);
81 sysEqn().calcRiemann(innerNodeVars, innerNodeVars, stateL, stateR, noNodes1D, dirId, f);
Boundary condition which imposes initial condition ("exact" boundary conditions) at the domain bounda...
DgBcExact(SolverType &solver_, MInt bcId)
void apply(const MFloat time) override
Apply method to apply boundary condition.
MString name() const override
Returns name of boundary condition.
void applyAtSurface(const MInt surfaceId, const MFloat NotUsed(time))
SurfaceCollector & surfaces()
Return reference to surfaces.
DgCartesianSolver< nDim, SysEqn > SolverType
SysEqn & sysEqn()
Return reference to SysEqn object.
MInt begin() const
Return index of first surface.
MInt end() const
Return index of one-past-last surface.
MFloat * flux(const MInt i)
Return pointer to surface flux.
std::basic_string< char > MString
void loop(Functor &&fun, Class *object, const IdType begin, const IdType end, Args... args)