7#ifndef DGBOUNDARYCONDITIONSTRAIGHTDUCTEXIT_H_
8#define DGBOUNDARYCONDITIONSTRAIGHTDUCTEXIT_H_
19template <MInt nDim,
class SysEqn>
57template <MInt nDim,
class SysEqn>
60 IF_CONSTEXPR(nDim != 2) { TERMM(1,
"This boundary condition is only usable for 2D simulations"); }
74 for(
MInt i = 0; i < 2; i++) {
75 m_ductPosition[i] = Context::getSolverProperty<MFloat>(
"ductPosition", solver().solverId(), AT_, i);
80template <MInt nDim,
class SysEqn>
82 const MFloat*
const coordinates = &surfaces().coords(surfaceId, 0);
83 const MInt sOrientation = surfaces().orientation(surfaceId);
85 const MFloat pos = coordinates[(sOrientation + 1) % 2];
86 const MFloat lb = m_ductPosition[0];
87 const MFloat ub = m_ductPosition[1];
90 if(lb > pos || pos > ub) {
92 m_wallBc.applyAtSurface(surfaceId, time);
95 const MInt noNodes1D = surfaces().noNodes1D(surfaceId);
97 const MFloat* surfaceStateL = &surfaces().variables(surfaceId, 0);
98 const MFloat* surfaceStateR = &surfaces().variables(surfaceId, 1);
99 const MFloat* outerState = (surfaces().nghbrElementIds(surfaceId, 0) == -1) ? surfaceStateL : surfaceStateR;
103 if(sOrientation == 1) {
104 for(
MInt n = 0; n < noNodes1D; n++) {
107 oS(n, 1) = sin(2 * PI * time);
108 oS(n, 2) = sin(2 * PI * time);
111 for(
MInt n = 0.0; n < noNodes1D; n++) {
113 oS(n, 0) = sin(2 * PI * time);
115 oS(n, 2) = sin(2 * PI * time);
120 const MFloat* nodeVarsL = &surfaces().nodeVars(surfaceId, 0);
121 const MFloat* nodeVarsR = &surfaces().nodeVars(surfaceId, 1);
122 const MFloat* innerNodeVars = (surfaces().nghbrElementIds(surfaceId, 0) == -1) ? nodeVarsR : nodeVarsL;
123 sysEqn().calcRiemann(innerNodeVars, innerNodeVars, surfaceStateL, surfaceStateR, noNodes1D, sOrientation,
Solid (slip) wall boundary condition.
DgBcAcousticPerturbStraightDuctExit(SolverType &solver_, MInt bcId)
void applyAtSurface(const MInt surfaceId, const MFloat time)
void apply(const MFloat time) override
Apply method to apply boundary condition.
MString name() const override
Returns name of boundary condition.
DgBcAcousticPerturbSolidWall< nDim, SysEqn > m_wallBc
SurfaceCollector & surfaces()
Return reference to surfaces.
DgCartesianSolver< nDim, SysEqn > SolverType
SysEqn & sysEqn()
Return reference to SysEqn object.
SolverType & solver()
Return reference to solver.
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)