52 "Computes CFL number for the entire domain for Incompressible flow.");
66 int expdim =
m_f->m_graph->GetMeshDimension();
67 int nelmt =
m_f->m_exp[0]->GetExpSize();
68 int nfields =
m_f->m_variables.size();
71 NekDouble timeStep =
m_f->m_session->GetParameter(
"TimeStep");
74 if (
m_f->m_numHomogeneousDir == 1)
79 "CFL for 3DH2D simulations is not supported");
83 m_f->m_variables.push_back(
"CFL");
86 if (
m_f->m_exp[0]->GetNumElmts() == 0)
90 int npoints =
m_f->m_exp[0]->GetNpoints();
94 m_f->m_session->LoadParameter(
"Strip_Z", nstrips, 1);
98 for (
int s = 0; s < nstrips; ++s)
100 Exp =
m_f->AppendExpList(
m_f->m_numHomogeneousDir);
101 m_f->m_exp.insert(
m_f->m_exp.begin() + s * (nfields + 1) + nfields,
105 for (
int s = 0; s < nstrips; ++s)
117 m_f->m_exp[s * nfields + 0]->EvalBasisNumModesMaxPerExp();
121 for (
int el = 0; el < nelmt; ++el)
123 int order = std::max(expOrder[el] - 1, 1);
124 cfl[el] = timeStep * stdVel[el] * cLambda * order * order;
128 for (
int el = 0; el < nelmt; ++el)
131 int nquad =
m_f->m_exp[s * nfields + 0]->GetExp(el)->GetTotPoints();
138 m_f->m_exp[s * (nfields + 1) + nfields]->UpdatePhys(), 1);
139 m_f->m_exp[0]->FwdTransLocalElmt(
140 outfield,
m_f->m_exp[s * (nfields + 1) + nfields]->UpdateCoeffs());
147 int expdim =
m_f->m_graph->GetMeshDimension();
148 int nfields =
m_f->m_variables.size();
149 int npoints =
m_f->m_exp[0]->GetNpoints();
150 if (boost::iequals(
m_f->m_variables[0],
"u"))
155 for (
int i = 0; i < expdim; ++i)
162 else if (boost::iequals(
m_f->m_variables[0],
"rho") &&
163 boost::iequals(
m_f->m_variables[1],
"rhou"))
166 ASSERTL0(
false,
"CFL calculation is not supported for the compressible "
167 "flow simulations at the moment");
172 ASSERTL0(
false,
"Could not identify velocity for ProcessCFL");
182 int nfields =
m_f->m_variables.size();
183 int n_points_0 =
m_f->m_exp[0]->GetExp(0)->GetTotPoints();
184 int n_element =
m_f->m_exp[0]->GetExpSize();
185 int nvel = vel.size();
196 for (
int i = 0; i < nvel; ++i)
202 for (
int el = 0; el < n_element; ++el)
204 int n_points =
m_f->m_exp[0]->GetExp(el)->GetTotPoints();
205 ptsKeys =
m_f->m_exp[0]->GetExp(el)->GetPointsKeys();
208 if (n_points != n_points_0)
210 for (
int j = 0; j < nvel; ++j)
214 n_points_0 = n_points;
218 for (
int j = 0; j < nvel; ++j)
228 ->GetDerivFactors(ptsKeys);
230 if (
m_f->m_exp[strip * nfields + 0]
236 for (
int j = 0; j < nvel; ++j)
238 for (
int k = 0; k < nvel; ++k)
241 tmp = vel[k] + cnt, 1, stdVelocity[j], 1,
248 for (
int j = 0; j < nvel; ++j)
250 for (
int k = 0; k < nvel; ++k)
253 tmp = vel[k] + cnt, 1, stdVelocity[j], 1,
261 Vmath::Vmul(n_points, stdVelocity[0], 1, stdVelocity[0], 1,
263 for (
int k = 1; k < nvel; ++k)
265 Vmath::Vvtvp(n_points, stdVelocity[k], 1, stdVelocity[k], 1,
266 stdVelocity[0], 1, stdVelocity[0], 1);
268 pntVelocity =
Vmath::Vmax(n_points, stdVelocity[0], 1);
269 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
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.
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)