44 RegisterCreatorFunction(
"RinglebFlow",
45 RinglebFlowBC::create,
46 "Ringleb flow boundary condition.");
54 :
CFSBndCond(pSession, pFields, pTraceNormals, pSpaceDim, bcRegion, cnt)
56 m_expdim = pFields[0]->GetGraph()->GetMeshDimension();
59 if (
m_session->DefinesSolverInfo(
"HOMOGENEOUS"))
61 std::string HomoStr =
m_session->GetSolverInfo(
"HOMOGENEOUS");
62 if ((HomoStr ==
"HOMOGENEOUS1D") || (HomoStr ==
"Homogeneous1D")
63 || (HomoStr ==
"1D") || (HomoStr ==
"Homo1D"))
75 int nvariables = physarray.size();
81 int nPointsTot =
m_fields[0]->GetTotPoints();
82 int nPointsTot_plane =
m_fields[0]->GetPlane(0)->GetTotPoints();
83 n_planes = nPointsTot/nPointsTot_plane;
86 int id2, id2_plane, e_max;
90 for(
int e = 0; e < e_max; ++e)
93 GetBndCondExpansions()[
m_bcRegion]->GetExp(e)->GetTotPoints();
95 GetBndCondExpansions()[
m_bcRegion]->GetPhys_Offset(e);
100 int m_offset_plane =
m_offset/n_planes;
102 int e_max_plane = e_max/n_planes;
103 int nTracePts_plane =
m_fields[0]->GetTrace()->GetNpoints();
105 int planeID = floor((e + 0.5 )/ e_max_plane );
106 e_plane = e - e_max_plane*planeID;
108 id2_plane =
m_fields[0]->GetTrace()->GetPhys_Offset(
110 GetBndCondIDToGlobalTraceID(m_offset_plane + e_plane));
111 id2 = id2_plane + planeID*nTracePts_plane;
116 GetTrace()->GetPhys_Offset(
m_fields[0]->GetTraceMap()->
117 GetBndCondIDToGlobalTraceID(
m_offset+e));
125 GetExp(e)->GetCoords(x0, x1, x2);
128 NekDouble c, k, phi, r, J, VV, pp, sint,
P, ss;
142 NekDouble gamma_1_2 = (gamma - 1.0) / 2.0;
145 for (
int j = 0; j < npoints; j++)
148 while ((
abs(errV) > toll) || (
abs(errTheta) > toll))
152 c =
sqrt(1.0 - gamma_1_2 * VV);
156 J = 1.0 / c + 1.0 / (3.0 * c * c * c) +
157 1.0 / (5.0 * c * c * c * c * c) -
158 0.5 *
log((1.0 + c) / (1.0 - c));
160 r = pow(c, 1.0 / gamma_1_2);
161 xi = 1.0 / (2.0 * r) * (1.0 / VV - 2.0 * pp) + J / 2.0;
162 yi = phi / (r * V) *
sqrt(1.0 - VV * pp);
163 par1 = 25.0 - 5.0 * VV;
169 J11 = 39062.5 / pow(par1, 3.5) *
170 (1.0 / VV - 2.0 / VV * ss) * V + 1562.5 /
171 pow(par1, 2.5) * (-2.0 / (VV * V) + 4.0 /
172 (VV * V) * ss) + 12.5 / pow(par1, 1.5) * V +
173 312.5 / pow(par1, 2.5) * V + 7812.5 /
174 pow(par1, 3.5) * V - 0.25 *
175 (-1.0 / pow(par1, 0.5) * V / (1.0 - 0.2 *
176 pow(par1, 0.5)) - (1.0 + 0.2 * pow(par1, 0.5)) /
177 pow((1.0 - 0.2 * pow(par1, 0.5)), 2.0) /
178 pow(par1, 0.5) * V) / (1.0 + 0.2 * pow(par1, 0.5)) *
179 (1.0 - 0.2 * pow(par1, 0.5));
181 J12 = -6250.0 / pow(par1, 2.5) / VV * sint * cos(theta);
182 J21 = -6250.0 / (VV * V) * sint / pow(par1, 2.5) *
183 pow((1.0 - ss), 0.5) + 78125.0 / V * sint /
184 pow(par1, 3.5) * pow((1.0 - ss), 0.5);
187 if (
abs(x1[j]) < toll &&
abs(cos(theta)) < toll)
189 J22 = -39062.5 / pow(par1, 3.5) / V + 3125 /
190 pow(par1, 2.5) / (VV * V) + 12.5 /
191 pow(par1, 1.5) * V + 312.5 / pow(par1, 2.5) *
192 V + 7812.5 / pow(par1, 3.5) * V - 0.25 *
193 (-1.0 / pow(par1, 0.5) * V / (1.0 - 0.2 *
194 pow(par1, 0.5)) - (1.0 + 0.2 * pow(par1, 0.5)) /
195 pow((1.0 - 0.2 * pow(par1, 0.5)), 2.0) /
196 pow(par1, 0.5) * V) / (1.0 + 0.2 *
197 pow(par1, 0.5)) * (1.0 - 0.2 * pow(par1, 0.5));
200 dV = -1.0 / J22 * Fx;
206 J22 = 3125.0 / VV * cos(theta) / pow(par1, 2.5) *
207 pow((1.0 - ss), 0.5) - 3125.0 / VV * ss /
208 pow(par1, 2.5) / pow((1.0 - ss), 0.5) *
211 det = -1.0 / (J11 * J22 - J12 * J21);
214 dV = det * ( J22 * Fx - J12 * Fy);
215 dtheta = det * (-J21 * Fx + J11 * Fy);
219 theta = theta + dtheta;
222 errTheta =
abs(dtheta);
225 c =
sqrt(1.0 - gamma_1_2 * VV);
229 !(
m_session->DefinesFunction(
"InitialConditions") &&
230 m_session->GetFunctionType(
"InitialConditions", 0) ==
233 Fwd[0][kk] = pow(c, 1.0 / gamma_1_2) *
234 exp(-1.0 + time /timeramp);
236 Fwd[1][kk] = Fwd[0][kk] * V * cos(theta) *
237 exp(-1 + time / timeramp);
239 Fwd[2][kk] = Fwd[0][kk] * V * sin(theta) *
240 exp(-1 + time / timeramp);
244 Fwd[0][kk] = pow(c, 1.0 / gamma_1_2);
245 Fwd[1][kk] = Fwd[0][kk] * V * cos(theta);
246 Fwd[2][kk] = Fwd[0][kk] * V * sin(theta);
249 P = (c * c) * Fwd[0][kk] / gamma;
250 Fwd[3][kk] =
P / (gamma - 1.0) + 0.5 *
251 (Fwd[1][kk] * Fwd[1][kk] / Fwd[0][kk] +
252 Fwd[2][kk] * Fwd[2][kk] / Fwd[0][kk]);
257 V = kExt * sin(theta);
260 for (
int i = 0; i < nvariables; ++i)
264 UpdatePhys())[id1],1);
Encapsulates the user-defined boundary conditions for compressible flow solver.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
NekDouble m_gamma
Parameters of the flow.
int m_bcRegion
Id of the boundary region.
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)
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 Vcopy(int n, const T *x, const int incx, T *y, const int incy)
scalarT< T > log(scalarT< T > in)
scalarT< T > abs(scalarT< T > in)
scalarT< T > sqrt(scalarT< T > in)