44 "X = X(x,y,z), Y = Y(x,y,z), Z=Z(x,y,z)");
65 const TiXmlElement *pMapping)
72 "General Mapping needs at least 2 velocity components.");
79 int physTot =
m_fields[0]->GetTotPoints();
82 for (
int i = 0; i < nvel; i++)
85 for (
int j = 0; j < nvel; j++)
88 outarray[i], 1, outarray[i], 1);
97 int physTot =
m_fields[0]->GetTotPoints();
100 for (
int i = 0; i < nvel; i++)
103 for (
int j = 0; j < nvel; j++)
106 outarray[i], 1, outarray[i], 1);
115 int physTot =
m_fields[0]->GetTotPoints();
118 for (
int i = 0; i < nvel; i++)
121 for (
int j = 0; j < nvel; j++)
124 outarray[i], 1, outarray[i], 1);
133 int physTot =
m_fields[0]->GetTotPoints();
136 for (
int i = 0; i < nvel; i++)
139 for (
int j = 0; j < nvel; j++)
142 outarray[i], 1, outarray[i], 1);
149 int physTot =
m_fields[0]->GetTotPoints();
156 int physTot =
m_fields[0]->GetTotPoints();
159 for (
int i = 0; i < nvel; i++)
161 for (
int j = 0; j < nvel; j++)
165 outarray[i * nvel + j], 1);
173 int physTot =
m_fields[0]->GetTotPoints();
176 for (
int i = 0; i < nvel; i++)
178 for (
int j = 0; j < nvel; j++)
182 outarray[i * nvel + j], 1);
191 int physTot =
m_fields[0]->GetTotPoints();
195 for (
int i = 0; i < nvel; i++)
197 for (
int k = 0; k < nvel; k++)
200 for (
int j = 0; j < nvel; j++)
204 outarray[i * nvel + k], 1, outarray[i * nvel + k],
215 int physTot =
m_fields[0]->GetTotPoints();
219 for (
int j = 0; j < nvel; j++)
221 for (
int k = 0; k < nvel; k++)
224 for (
int i = 0; i < nvel; i++)
228 outarray[j * nvel + k], 1, outarray[j * nvel + k],
243 int physTot =
m_fields[0]->GetTotPoints();
247 bool wavespace =
m_fields[0]->GetWaveSpace();
265 for (
int i = 0; i < nvel; i++)
267 for (
int j = 0; j < nvel; j++)
281 for (
int i = 0; i < nvel; i++)
283 for (
int j = 0; j < nvel; j++)
285 for (
int k = 0; k < nvel; k++)
313 int a, b, c,
d, e, i, j;
316 for (i = 0; i < nvel; ++i)
318 for (j = 0; j < nvel; ++j)
320 a = ((i + 1) % nvel) * nvel + ((j + 1) % nvel);
321 b = ((i + 1) % nvel) * nvel + ((j + 2) % nvel);
322 c = ((i + 2) % nvel) * nvel + ((j + 1) % nvel);
323 d = ((i + 2) % nvel) * nvel + ((j + 2) % nvel);
339 for (
int i = 0; i < nvel; ++i)
346 for (
int i = 0; i < nvel * nvel; ++i)
357 for (
int i = 0; i < nvel; ++i)
359 for (
int j = 0; j < nvel; ++j)
361 for (
int k = 0; k < nvel; ++k)
372 m_fields[0]->SetWaveSpace(wavespace);
377 int physTot =
m_fields[0]->GetTotPoints();
384 for (
int i = 0; i < gradG.size(); i++)
392 bool waveSpace =
m_fields[0]->GetWaveSpace();
396 for (
int i = 0; i < nvel; i++)
398 for (
int j = 0; j < nvel; j++)
400 for (
int k = 0; k < nvel; k++)
404 gradG[i * nvel * nvel + j * nvel + k]);
410 for (
int p = 0;
p < nvel;
p++)
412 for (
int j = 0; j < nvel; j++)
414 for (
int k = 0; k < nvel; k++)
416 Vmath::Vadd(physTot, gradG[
p * nvel * nvel + j * nvel + k], 1,
417 gradG[
p * nvel * nvel + k * nvel + j], 1,
418 tmp[
p * nvel * nvel + j * nvel + k], 1);
419 Vmath::Vsub(physTot, tmp[
p * nvel * nvel + j * nvel + k], 1,
420 gradG[j * nvel * nvel + k * nvel +
p], 1,
421 tmp[
p * nvel * nvel + j * nvel + k], 1);
422 Vmath::Smul(physTot, 0.5, tmp[
p * nvel * nvel + j * nvel + k],
423 1, tmp[
p * nvel * nvel + j * nvel + k], 1);
429 for (
int i = 0; i < nvel; i++)
431 for (
int j = 0; j < nvel; j++)
433 for (
int k = 0; k < nvel; k++)
435 for (
int p = 0;
p < nvel;
p++)
439 tmp[
p * nvel * nvel + j * nvel + k], 1,
447 m_fields[0]->SetWaveSpace(waveSpace);
#define ASSERTL0(condition, msg)
static std::string className
Name of the class.
GLOBAL_MAPPING_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const TiXmlElement *pMapping) override
GLOBAL_MAPPING_EXPORT void v_ApplyChristoffelCovar(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
GLOBAL_MAPPING_EXPORT void v_CovarToCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
Array< OneD, Array< OneD, NekDouble > > m_invDeriv
Array< OneD, Array< OneD, NekDouble > > m_metricTensor
GLOBAL_MAPPING_EXPORT void v_GetJacobian(Array< OneD, NekDouble > &outarray) override
Array< OneD, Array< OneD, NekDouble > > m_deriv
GLOBAL_MAPPING_EXPORT void v_GetMetricTensor(Array< OneD, Array< OneD, NekDouble > > &outarray) override
GLOBAL_MAPPING_EXPORT void v_ApplyChristoffelContravar(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
GLOBAL_MAPPING_EXPORT void v_ContravarFromCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
Array< OneD, NekDouble > m_jac
Array< OneD, Array< OneD, NekDouble > > m_invMetricTensor
GLOBAL_MAPPING_EXPORT void v_ContravarToCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
GLOBAL_MAPPING_EXPORT void v_CovarFromCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
GLOBAL_MAPPING_EXPORT void v_GetInvMetricTensor(Array< OneD, Array< OneD, NekDouble > > &outarray) override
void CalculateChristoffel()
void CalculateMetricTerms()
Array< OneD, Array< OneD, NekDouble > > m_Christoffel
MappingGeneral(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
static GLOBAL_MAPPING_EXPORT MappingSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const TiXmlElement *pMapping)
Creates an instance of this class.
GLOBAL_MAPPING_EXPORT void v_UpdateGeomInfo() override
Base class for mapping to be applied to the coordinate system.
int m_nConvectiveFields
Number of velocity components.
Array< OneD, Array< OneD, NekDouble > > m_coords
Array with the Cartesian coordinates.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
virtual GLOBAL_MAPPING_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const TiXmlElement *pMapping)
bool m_constantJacobian
Flag defining if the Jacobian is constant.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
MappingFactory & GetMappingFactory()
Declaration of the mapping factory singleton.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
MultiRegions::Direction const DirCartesianMap[]
std::vector< double > d(NPUPPER *NPUPPER)
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
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 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 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 Vvtvm(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)
vvtvm (vector times vector minus vector): z = w*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 Vdiv(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 Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.