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();
75 NekDouble timeStep =
m_f->m_session->GetParameter(
"TimeStep");
78 if (
m_f->m_numHomogeneousDir == 1)
83 "CFL for 3DH2D simulations is not supported");
87 m_f->m_variables.push_back(
"CFL");
90 if (
m_f->m_exp[0]->GetNumElmts() == 0)
94 int npoints =
m_f->m_exp[0]->GetNpoints();
98 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
102 for (
int s = 0; s < nstrips; ++s)
104 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
105 m_f->m_exp.insert(
m_f->m_exp.begin() + s * (nfields + 1) + nfields,
109 for (
int s = 0; s < nstrips; ++s)
121 m_f->m_exp[s * nfields + 0]->EvalBasisNumModesMaxPerExp();
125 for (
int el = 0; el < nelmt; ++el)
127 int order = std::max(expOrder[el] - 1, 1);
128 cfl[el] = timeStep * stdVel[el] * cLambda * order * order;
132 for (
int el = 0; el < nelmt; ++el)
135 int nquad =
m_f->m_exp[s * nfields + 0]->GetExp(el)->GetTotPoints();
142 m_f->m_exp[s * (nfields + 1) + nfields]->UpdatePhys(), 1);
143 m_f->m_exp[0]->FwdTransLocalElmt(
144 outfield,
m_f->m_exp[s * (nfields + 1) + nfields]->UpdateCoeffs());
151 int expdim =
m_f->m_graph->GetMeshDimension();
152 int nfields =
m_f->m_variables.size();
153 int npoints =
m_f->m_exp[0]->GetNpoints();
154 if (boost::iequals(
m_f->m_variables[0],
"u"))
159 for (
int i = 0; i < expdim; ++i)
166 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
167 boost::iequals(
m_f->m_variables[1],
"rhou"))
170 ASSERTL0(
false,
"CFL calculation is not supported for the compressible "
171 "flow simulations at the moment");
176 ASSERTL0(
false,
"Could not identify velocity for ProcessCFL");
186 int nfields =
m_f->m_variables.size();
187 int n_points_0 =
m_f->m_exp[0]->GetExp(0)->GetTotPoints();
188 int n_element =
m_f->m_exp[0]->GetExpSize();
189 int nvel = vel.size();
200 for (
int i = 0; i < nvel; ++i)
206 for (
int el = 0; el < n_element; ++el)
208 int n_points =
m_f->m_exp[0]->GetExp(el)->GetTotPoints();
209 ptsKeys =
m_f->m_exp[0]->GetExp(el)->GetPointsKeys();
212 if (n_points != n_points_0)
214 for (
int j = 0; j < nvel; ++j)
218 n_points_0 = n_points;
222 for (
int j = 0; j < nvel; ++j)
232 ->GetDerivFactors(ptsKeys);
234 if (
m_f->m_exp[strip * nfields + 0]
240 for (
int j = 0; j < nvel; ++j)
242 for (
int k = 0; k < nvel; ++k)
245 tmp = vel[k] + cnt, 1, stdVelocity[j], 1,
252 for (
int j = 0; j < nvel; ++j)
254 for (
int k = 0; k < nvel; ++k)
257 tmp = vel[k] + cnt, 1, stdVelocity[j], 1,
265 Vmath::Vmul(n_points, stdVelocity[0], 1, stdVelocity[0], 1,
267 for (
int k = 1; k < nvel; ++k)
269 Vmath::Vvtvp(n_points, stdVelocity[k], 1, stdVelocity[k], 1,
270 stdVelocity[0], 1, stdVelocity[0], 1);
272 pntVelocity =
Vmath::Vmax(n_points, stdVelocity[0], 1);
273 maxV[el] =
sqrt(pntVelocity);
#define ASSERTL0(condition, msg)
FieldSharedPtr m_f
Field object.
void GetVelocity(Array< OneD, Array< OneD, NekDouble > > &vel, int strip=0)
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > &vel, int strip=0)
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
static ModuleKey className
virtual void v_Process(po::variables_map &vm) override
Write mesh to output file.
ProcessCFL(FieldSharedPtr f)
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
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
@ 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)