35 #include <boost/core/ignore_unused.hpp>
45 RegisterCreatorFunction(
"RiemannInvariant",
46 RiemannInvariantBC::create,
47 "Riemann invariant boundary condition.");
49 RiemannInvariantBC::RiemannInvariantBC(
56 :
CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
59 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
78 boost::ignore_unused(physarray, time);
81 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
89 NekDouble gammaMinusOneInv = 1.0 / gammaMinusOne;
95 for (i = 0; i < nDimensions; ++i)
97 Vmath::Vdiv(nTracePts, Fwd[i+1], 1, Fwd[0], 1, Vel, 1);
104 m_varConv->GetAbsoluteVelocity(Fwd, absVel);
111 m_varConv->GetSoundSpeed(Fwd, soundSpeed);
115 Vmath::Vdiv(nTracePts, Vn, 1, soundSpeed, 1, Mach, 1);
120 int e, id1, id2, nBCEdgePts, pnt;
121 NekDouble cPlus, rPlus, cMinus, rMinus, VDBC, VNBC;
129 for (e = 0; e < eMax; ++e)
132 GetExp(e)->GetTotPoints();
139 for (i = 0; i < nBCEdgePts; i++)
147 if (Mach[pnt] < 1.00)
151 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
155 rMinus =
m_VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv;
161 rPlus =
m_VnInf[pnt] + 2.0 * cPlus * gammaMinusOneInv;
165 rMinus =
m_VnInf[pnt] - 2.0 * cPlus * gammaMinusOneInv;
169 VNBC = 0.5 * (rPlus + rMinus);
170 cBC = 0.25 * gammaMinusOne * (rPlus - rMinus);
175 rhoBC = pow((cBC * cBC) / (
m_gamma * sBC), gammaMinusOneInv);
176 pBC = rhoBC * cBC * cBC * gammaInv;
182 for ( j = 0; j < nDimensions; ++j)
185 rhoVelBC[j] = rhoBC * velBC[j];
186 EkBC += 0.5 * rhoBC * velBC[j]*velBC[j];
190 EBC = pBC * gammaMinusOneInv + EkBC;
194 UpdatePhys())[id1+i] = rhoBC;
195 for (j = 0; j < nDimensions; ++j)
198 UpdatePhys())[id1+i] = rhoVelBC[j];
201 UpdatePhys())[id1+i] = EBC;
207 if (Mach[pnt] < 1.00)
211 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
215 rMinus =
m_VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv;
221 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
225 rMinus = Vn[pnt] - 2.0 * cPlus * gammaMinusOneInv;
229 VNBC = 0.5 * (rPlus + rMinus);
230 cBC = 0.25 * gammaMinusOne * (rPlus - rMinus);
231 VDBC = VNBC - Vn[pnt];
235 rhoBC = pow((cBC * cBC) / (
m_gamma * sBC), gammaMinusOneInv);
236 pBC = rhoBC * cBC * cBC * gammaInv;
242 for ( j = 0; j < nDimensions; ++j)
244 velBC[j] = Fwd[j+1][pnt] / Fwd[0][pnt] +
246 rhoVelBC[j] = rhoBC * velBC[j];
247 EkBC += 0.5 * rhoBC * velBC[j]*velBC[j];
251 EBC = pBC * gammaMinusOneInv + EkBC;
255 UpdatePhys())[id1+i] = rhoBC;
256 for (j = 0; j < nDimensions; ++j)
259 UpdatePhys())[id1+i] = rhoVelBC[j];
262 UpdatePhys())[id1+i] = EBC;
Encapsulates the user-defined boundary conditions for compressible flow solver.
int m_spacedim
Space dimension.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Trace normals.
Array< OneD, NekDouble > m_velInf
NekDouble m_gamma
Parameters of the flow.
int m_bcRegion
Id of the boundary region.
VariableConverterSharedPtr m_varConv
Auxiliary object to convert variables.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array of fields.
virtual void v_Apply(Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray, const NekDouble &time)
Array< OneD, NekDouble > m_VnInf
Reference normal velocity.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
The above copyright notice and this permission notice shall be included.
CFSBndCondFactory & GetCFSBndCondFactory()
Declaration of the boundary condition factory singleton.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
void Vabs(int n, const T *x, const int incx, T *y, const int incy)
vabs: y = |x|
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
scalarT< T > sqrt(scalarT< T > in)