35#include <boost/core/ignore_unused.hpp>
47 "Riemann invariant boundary condition.");
53 const int pSpaceDim,
const int bcRegion,
const int cnt)
54 :
CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
57 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
73 boost::ignore_unused(physarray, time);
76 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
83 NekDouble gammaMinusOneInv = 1.0 / gammaMinusOne;
89 for (i = 0; i < nDimensions; ++i)
91 Vmath::Vdiv(nTracePts, Fwd[i + 1], 1, Fwd[0], 1, Vel, 1);
98 m_varConv->GetAbsoluteVelocity(Fwd, absVel);
105 m_varConv->GetSoundSpeed(Fwd, soundSpeed);
109 Vmath::Vdiv(nTracePts, Vn, 1, soundSpeed, 1, Mach, 1);
114 int e, id1, id2, nBCEdgePts, pnt;
115 NekDouble cPlus, rPlus, cMinus, rMinus, VDBC, VNBC;
123 for (e = 0; e < eMax; ++e)
136 for (i = 0; i < nBCEdgePts; i++)
144 if (Mach[pnt] < 1.00)
148 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
152 rMinus =
m_VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv;
158 rPlus =
m_VnInf[pnt] + 2.0 * cPlus * gammaMinusOneInv;
162 rMinus =
m_VnInf[pnt] - 2.0 * cPlus * gammaMinusOneInv;
166 VNBC = 0.5 * (rPlus + rMinus);
167 cBC = 0.25 * gammaMinusOne * (rPlus - rMinus);
172 rhoBC = pow((cBC * cBC) / (
m_gamma * sBC), gammaMinusOneInv);
173 pBC = rhoBC * cBC * cBC * gammaInv;
179 for (j = 0; j < nDimensions; ++j)
182 rhoVelBC[j] = rhoBC * velBC[j];
183 EkBC += 0.5 * rhoBC * velBC[j] * velBC[j];
187 EBC = pBC * gammaMinusOneInv + EkBC;
192 ->UpdatePhys())[id1 + i] = rhoBC;
193 for (j = 0; j < nDimensions; ++j)
197 ->UpdatePhys())[id1 + i] = rhoVelBC[j];
201 ->UpdatePhys())[id1 + i] = EBC;
206 if (Mach[pnt] < 1.00)
210 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
214 rMinus =
m_VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv;
220 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
224 rMinus = Vn[pnt] - 2.0 * cPlus * gammaMinusOneInv;
228 VNBC = 0.5 * (rPlus + rMinus);
229 cBC = 0.25 * gammaMinusOne * (rPlus - rMinus);
230 VDBC = VNBC - Vn[pnt];
234 rhoBC = pow((cBC * cBC) / (
m_gamma * sBC), gammaMinusOneInv);
235 pBC = rhoBC * cBC * cBC * gammaInv;
241 for (j = 0; j < nDimensions; ++j)
243 velBC[j] = Fwd[j + 1][pnt] / Fwd[0][pnt] +
245 rhoVelBC[j] = rhoBC * velBC[j];
246 EkBC += 0.5 * rhoBC * velBC[j] * velBC[j];
250 EBC = pBC * gammaMinusOneInv + EkBC;
255 ->UpdatePhys())[id1 + i] = rhoBC;
256 for (j = 0; j < nDimensions; ++j)
260 ->UpdatePhys())[id1 + i] = rhoVelBC[j];
264 ->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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
virtual void v_Apply(Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray, const NekDouble &time) override
static CFSBndCondSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const int pSpaceDim, const int bcRegion, const int cnt)
Creates an instance of this class.
static std::string className
Name of the class.
RiemannInvariantBC(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const int pSpaceDim, const int bcRegion, const int cnt)
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)