53 return m_f->m_session->GetParameter(
"Kinvis");
60 int method =
m_config[
"Q"].as<
int>();
75 int npoints =
m_f->m_exp[0]->GetNpoints();
77 if (Q.size() < npoints)
86 auto index = find(
m_f->m_variables.begin(),
m_f->m_variables.end(), var);
87 if (index ==
m_f->m_variables.end())
91 return index -
m_f->m_variables.begin();
98 int npoints = exp[0]->GetNpoints();
100 if (Q.size() < npoints)
116 exp[ip]->PhysDeriv(i,
m_f->m_exp[ip]->GetPhys(), grad[i]);
117 exp[ip]->PhysDeriv(i, grad[i], tmp);
128 int npoints = exp[0]->GetNpoints();
129 for (
size_t i = 0; i <
m_f->m_variables.size(); ++i)
131 if (std::string::npos !=
m_f->m_variables[i].find(
"phi"))
133 Iphi[i] =
m_f->m_variables[i];
136 if (phi.size() != Iphi.size())
141 for (
const auto &p : Iphi)
143 if (phi[i].size() < npoints)
147 Vmath::Vcopy(npoints, exp[p.first]->GetPhys(), 1, phi[i], 1);
155 for (
size_t i = 0; i <
m_f->m_variables.size(); ++i)
157 if (std::string::npos !=
m_f->m_variables[i].find(
"phi"))
159 Iphi[i] =
m_f->m_variables[i];
168 int npoints = exp[0]->GetNpoints();
173 for (
size_t i = 0; i < gradp.size(); ++i)
175 if (gradp[i].size() < npoints)
190 Vmath::Vcopy(npoints, exp[iv]->GetPhys(), 1, pressure, 1);
193 exp[0]->PhysDeriv(i, pressure, gradp[i]);
201 int npoints = exp[0]->GetNpoints();
206 std::vector<std::string> vars = {
"u",
"v",
"w"};
210 if (vel[i].size() < npoints)
214 Vmath::Vcopy(npoints, exp[iv]->GetPhys(), 1, vel[i], 1);
222 int npoints = exp[0]->GetNpoints();
227 for (
size_t i = 0; i < grad.size(); ++i)
237 for (
size_t i = 0; i < stress.size(); ++i)
239 if (stress[i].size() < npoints)
249 exp[i]->PhysDeriv(j, vel[i], grad[i *
m_spacedim + j]);
269 for (
int j = 0; j < i; ++j)
281 int npoints = exp[0]->GetNpoints();
284 if (lapvel.size() != vel.size())
288 for (
size_t i = 0; i < lapvel.size(); ++i)
290 if (lapvel[i].size() < npoints)
301 for (
size_t i = 0; i < lapvel.size(); ++i)
306 exp[i]->PhysDeriv(j, vel[i], grad[j]);
307 exp[i]->PhysDeriv(j, grad[j], tmp);
308 Vmath::Vadd(npoints, tmp, 1, lapvel[i], 1, lapvel[i], 1);
317 for (
int i = 0; i < exp->GetExpSize(); ++i)
319 sum += exp->GetExp(i)->Integral(value + exp->GetPhys_Offset(i));
331 int ndata = data.size();
332 NekDouble dh = (BoundBox[dir * 2 + 1] - BoundBox[dir * 2]) / Nslots;
334 for (
int i = 0; i < ndata; ++i)
339 for (
size_t e = 0; e < field->GetExpSize(); ++e)
347 for (
size_t j = 0; j < nv; ++j)
350 vertex->
GetCoords(gct[0], gct[1], gct[2]);
354 if (BoundBox[0] <= gct[0] && gct[0] <= BoundBox[1] &&
355 BoundBox[2] <= gct[1] && gct[1] <= BoundBox[3] &&
356 BoundBox[4] <= gct[2] && gct[2] <= BoundBox[5])
363 int index = floor((gc[dir] - BoundBox[2 * dir]) / dh);
364 index = std::max(std::min(index, Nslots - 1), 0);
365 for (
int j = 0; j < ndata; ++j)
368 exp->Integral(data[j] + field->GetPhys_Offset(e));
372 for (
int j = 0; j < ndata; ++j)
376 if (comm->TreatAsRankZero())
379 cout <<
"variables = x";
380 for (
const auto &phi : Iphi)
382 cout <<
", f" + phi.second;
385 for (
int i = 0; i < Nslots; ++i)
387 cout << (BoundBox[2 * dir] + (i + 0.5) * dh) <<
" ";
388 for (
int j = 0; j < ndata; ++j)
390 sum[j] += slots[j][i];
391 cout << sum[j] <<
" ";
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
FieldSharedPtr m_f
Field object.
std::map< std::string, ConfigOption > m_config
List of configuration values.
void QFromField(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, NekDouble > &Q)
void GetGradPressure(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, Array< OneD, NekDouble > > &gradp)
void GetLaplaceVelocity(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, Array< OneD, NekDouble > > &lapvel)
void GetQ(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, NekDouble > &Q)
void VolumeIntegrateForce(const MultiRegions::ExpListSharedPtr &field, const Array< OneD, Array< OneD, NekDouble > > &data, const LibUtilities::CommSharedPtr &comm, std::map< int, std::string > &Iphi, Array< OneD, NekDouble > &BoundBox, int dir)
NekDouble PhysIntegral(MultiRegions::ExpListSharedPtr exp, Array< OneD, NekDouble > value)
void GetInfoPhi(std::map< int, std::string > &Iphi)
void GetStressTensor(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, Array< OneD, NekDouble > > &shear)
void GetVelocity(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, Array< OneD, NekDouble > > &vel)
void QFromPressure(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, NekDouble > &Q)
void GetPhi(const Array< OneD, MultiRegions::ExpListSharedPtr > exp, Array< OneD, Array< OneD, NekDouble > > &phi, std::map< int, std::string > &Iphi)
int FindVariable(const std::string &var)
Abstract base class for processing modules.
Base class for shape geometry information.
PointGeom * GetVertex(int i) const
Returns vertex i of this object.
int GetNumVerts() const
Get the number of vertices of this object.
void GetCoords(NekDouble &x, NekDouble &y, NekDouble &z)
std::shared_ptr< Field > FieldSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)