45 "Riemann invariant boundary condition.");
52 const int pSpaceDim,
const int bcRegion,
const int cnt)
53 :
CFSBndCond(pSession, pFields, pTraceNormals, pGridVelocity, pSpaceDim,
57 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
75 int nTracePts =
m_fields[0]->GetTrace()->GetNpoints();
82 NekDouble gammaMinusOneInv = 1.0 / gammaMinusOne;
88 for (i = 0; i < nDimensions; ++i)
90 Vmath::Vdiv(nTracePts, Fwd[i + 1], 1, Fwd[0], 1, Vel, 1);
97 m_varConv->GetAbsoluteVelocity(Fwd, absVel);
104 m_varConv->GetSoundSpeed(Fwd, soundSpeed);
108 Vmath::Vdiv(nTracePts, Vn, 1, soundSpeed, 1, Mach, 1);
113 int e, id1, id2, nBCEdgePts, pnt;
114 NekDouble cPlus, rPlus, cMinus, rMinus, VDBC, VNBC;
122 for (e = 0; e < eMax; ++e)
135 for (i = 0; i < nBCEdgePts; i++)
143 if (Mach[pnt] < 1.00)
147 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
151 rMinus =
m_VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv;
157 rPlus =
m_VnInf[pnt] + 2.0 * cPlus * gammaMinusOneInv;
161 rMinus =
m_VnInf[pnt] - 2.0 * cPlus * gammaMinusOneInv;
165 VNBC = 0.5 * (rPlus + rMinus);
166 cBC = 0.25 * gammaMinusOne * (rPlus - rMinus);
171 rhoBC = pow((cBC * cBC) / (
m_gamma * sBC), gammaMinusOneInv);
172 pBC = rhoBC * cBC * cBC * gammaInv;
178 for (j = 0; j < nDimensions; ++j)
181 rhoVelBC[j] = rhoBC * velBC[j];
182 EkBC += 0.5 * rhoBC * velBC[j] * velBC[j];
186 EBC = pBC * gammaMinusOneInv + EkBC;
191 ->UpdatePhys())[id1 + i] = rhoBC;
192 for (j = 0; j < nDimensions; ++j)
196 ->UpdatePhys())[id1 + i] = rhoVelBC[j];
200 ->UpdatePhys())[id1 + i] = EBC;
205 if (Mach[pnt] < 1.00)
209 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
213 rMinus =
m_VnInf[pnt] - 2.0 * cMinus * gammaMinusOneInv;
219 rPlus = Vn[pnt] + 2.0 * cPlus * gammaMinusOneInv;
223 rMinus = Vn[pnt] - 2.0 * cPlus * gammaMinusOneInv;
227 VNBC = 0.5 * (rPlus + rMinus);
228 cBC = 0.25 * gammaMinusOne * (rPlus - rMinus);
229 VDBC = VNBC - Vn[pnt];
233 rhoBC = pow((cBC * cBC) / (
m_gamma * sBC), gammaMinusOneInv);
234 pBC = rhoBC * cBC * cBC * gammaInv;
240 for (j = 0; j < nDimensions; ++j)
242 velBC[j] = Fwd[j + 1][pnt] / Fwd[0][pnt] +
244 rhoVelBC[j] = rhoBC * velBC[j];
245 EkBC += 0.5 * rhoBC * velBC[j] * velBC[j];
249 EBC = pBC * gammaMinusOneInv + EkBC;
254 ->UpdatePhys())[id1 + i] = rhoBC;
255 for (j = 0; j < nDimensions; ++j)
259 ->UpdatePhys())[id1 + i] = rhoVelBC[j];
263 ->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.
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 Array< OneD, Array< OneD, NekDouble > > &pGridVelocity, const int pSpaceDim, const int bcRegion, const int cnt)
Creates an instance of this class.
RiemannInvariantBC(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const Array< OneD, Array< OneD, NekDouble > > &pTraceNormals, const Array< OneD, Array< OneD, NekDouble > > &pGridVelocity, const int pSpaceDim, const int bcRegion, const int cnt)
static std::string className
Name of the class.
Array< OneD, NekDouble > m_VnInf
Reference normal velocity.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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)