41 #include <boost/core/ignore_unused.hpp>
56 "Computes CFL number for the entire domain for Incompressible flow.");
70 int expdim =
m_f->m_graph->GetMeshDimension();
71 int nelmt =
m_f->m_exp[0]->GetExpSize();
72 int nfields =
m_f->m_variables.size();
76 NekDouble timeStep =
m_f->m_session->GetParameter(
"TimeStep");
79 if (
m_f->m_numHomogeneousDir == 1)
84 "CFL for 3DH2D simulations is not supported");
88 m_f->m_variables.push_back(
"CFL");
91 if (
m_f->m_exp[0]->GetNumElmts() == 0)
95 int npoints =
m_f->m_exp[0]->GetNpoints();
99 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
101 vector<MultiRegions::ExpListSharedPtr> Exp(nstrips * addfields);
103 for (
int s = 0; s < nstrips; ++s)
115 m_f->m_exp[s * nfields + 0]->EvalBasisNumModesMaxPerExp();
119 for (
int el = 0; el < nelmt; ++el)
121 int order = std::max(expOrder[el] - 1, 1);
122 cfl[el] = timeStep * stdVel[el] * cLambda * order * order;
126 for (
int el = 0; el < nelmt; ++el)
129 int nquad =
m_f->m_exp[s * nfields + 0]->GetExp(el)->GetTotPoints();
135 int n = s * addfields;
136 Exp[n] =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
137 Vmath::Vcopy(npoints, outfield, 1, Exp[n]->UpdatePhys(), 1);
138 Exp[n]->FwdTransLocalElmt(outfield, Exp[n]->UpdateCoeffs());
142 for (
int s = 0; s < nstrips; ++s)
144 for (
int i = 0; i < addfields; ++i)
146 m_f->m_exp.insert(
m_f->m_exp.begin() + s * (nfields + addfields) +
148 Exp[s * addfields + i]);
156 int expdim =
m_f->m_graph->GetMeshDimension();
157 int nfields =
m_f->m_variables.size();
158 int npoints =
m_f->m_exp[0]->GetNpoints();
159 if (boost::iequals(
m_f->m_variables[0],
"u"))
164 for (
int i = 0; i < expdim; ++i)
171 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
172 boost::iequals(
m_f->m_variables[1],
"rhou"))
175 ASSERTL0(
false,
"CFL calculation is not supported for the compressible "
176 "flow simulations at the moment");
181 ASSERTL0(
false,
"Could not identify velocity for ProcessCFL");
191 int nfields =
m_f->m_variables.size();
192 int n_points_0 =
m_f->m_exp[0]->GetExp(0)->GetTotPoints();
193 int n_element =
m_f->m_exp[0]->GetExpSize();
194 int nvel = vel.size();
205 for (
int i = 0; i < nvel; ++i)
211 for (
int el = 0; el < n_element; ++el)
213 int n_points =
m_f->m_exp[0]->GetExp(el)->GetTotPoints();
214 ptsKeys =
m_f->m_exp[0]->GetExp(el)->GetPointsKeys();
217 if (n_points != n_points_0)
219 for (
int j = 0; j < nvel; ++j)
223 n_points_0 = n_points;
227 for (
int j = 0; j < nvel; ++j)
237 ->GetDerivFactors(ptsKeys);
239 if (
m_f->m_exp[strip * nfields + 0]
245 for (
int j = 0; j < nvel; ++j)
247 for (
int k = 0; k < nvel; ++k)
250 tmp = vel[k] + cnt, 1, stdVelocity[j], 1,
257 for (
int j = 0; j < nvel; ++j)
259 for (
int k = 0; k < nvel; ++k)
262 tmp = vel[k] + cnt, 1, stdVelocity[j], 1,
270 Vmath::Vmul(n_points, stdVelocity[0], 1, stdVelocity[0], 1,
272 for (
int k = 1; k < nvel; ++k)
274 Vmath::Vvtvp(n_points, stdVelocity[k], 1, stdVelocity[k], 1,
275 stdVelocity[0], 1, stdVelocity[0], 1);
277 pntVelocity =
Vmath::Vmax(n_points, stdVelocity[0], 1);
278 maxV[el] =
sqrt(pntVelocity);
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble >> &vel, int strip=0)
virtual void Process(po::variables_map &vm)
Write mesh to output file.
void GetVelocity(Array< OneD, Array< OneD, NekDouble >> &vel, int strip=0)
Abstract base class for processing modules.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()
std::vector< PointsKey > PointsKeyVector
@ eDeformed
Geometry is curved or has non-constant factors.
The above copyright notice and this permission notice shall be included.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
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 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 Zero(int n, T *x, const int incx)
Zero vector.
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
scalarT< T > sqrt(scalarT< T > in)