7#ifndef DGBOUNDARYCONDITIONACOUSTICPERTURBCBC_H_
8#define DGBOUNDARYCONDITIONACOUSTICPERTURBCBC_H_
41 MFloat* nodeVarsL = &surfaces().nodeVars(surfaceId, 0);
42 MFloat* nodeVarsR = &surfaces().nodeVars(surfaceId, 1);
43 MFloat* stateL = &surfaces().variables(surfaceId, 0);
44 MFloat* stateR = &surfaces().variables(surfaceId, 1);
46 MFloat* innerNodeVars = (surfaces().internalSideId(surfaceId) != 1) ? nodeVarsL : nodeVarsR;
47 MFloat* boundaryNodeVars = (surfaces().internalSideId(surfaceId) != 1) ? nodeVarsR : nodeVarsL;
48 MFloat* innerState = (surfaces().nghbrElementIds(surfaceId, 0) == -1) ? stateR : stateL;
49 MFloat* boundaryState = (surfaces().nghbrElementIds(surfaceId, 0) == -1) ? stateL : stateR;
52 const MInt dirId = surfaces().orientation(surfaceId);
53 const MInt noNodes1D = surfaces().noNodes1D(surfaceId);
54 const MInt noNodesXD = surfaces().noNodesXD(surfaceId);
55 MFloat* f = flux(surfaceId);
60 std::fill_n(&boundaryState[0], noNodesXD * Base::SysEqn::noVars(), 0.0);
61 std::fill_n(&boundaryNodeVars[0], noNodesXD * Base::SysEqn::noNodeVars(), 0.0);
63 for(
MInt i = 0; i < noNodesXD; i++) {
64 MFloat*
const nodeVars = &boundaryNodeVars[i * Base::SysEqn::noNodeVars()];
66 nodeVars[Base::SysEqn::CV::RHO0] = 1.0;
68 nodeVars[Base::SysEqn::CV::C0] = 1.0;
70 sysEqn().calcRiemannRoe(nodeVarsL, nodeVarsR, stateL, stateR, noNodes1D, dirId, f);
76 sysEqn().calcRiemannRoe(innerNodeVars, innerNodeVars, innerState, innerState, noNodes1D, dirId, f);
81 TERMM(1,
"Bad boundary condition id for CBC boundary conditions");
DgBcAcousticPerturbCBC(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))
MInt id() const
Return boundary condition if of this boundary condition.
SurfaceCollector & surfaces()
Return reference to surfaces.
DgCartesianSolver< nDim, SysEqn > SolverType
SysEqn & sysEqn()
Return reference to SysEqn object.
DgSysEqnAcousticPerturb< nDim > SysEqn
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)