41 namespace GlobalMapping
47 "X = X(x,y,z), Y = Y(x,y,z), Z=Z(x,y,z)");
71 const TiXmlElement *pMapping)
78 "General Mapping needs at least 2 velocity components.");
85 int physTot =
m_fields[0]->GetTotPoints();
88 for (
int i = 0; i < nvel; i++)
91 for (
int j = 0; j < nvel; j++)
94 outarray[i], 1, outarray[i], 1);
103 int physTot =
m_fields[0]->GetTotPoints();
106 for (
int i = 0; i < nvel; i++)
109 for (
int j = 0; j < nvel; j++)
112 outarray[i], 1, outarray[i], 1);
121 int physTot =
m_fields[0]->GetTotPoints();
124 for (
int i = 0; i < nvel; i++)
127 for (
int j = 0; j < nvel; j++)
130 outarray[i], 1, outarray[i], 1);
139 int physTot =
m_fields[0]->GetTotPoints();
142 for (
int i = 0; i < nvel; i++)
145 for (
int j = 0; j < nvel; j++)
148 outarray[i], 1, outarray[i], 1);
155 int physTot =
m_fields[0]->GetTotPoints();
162 int physTot =
m_fields[0]->GetTotPoints();
165 for (
int i = 0; i < nvel; i++)
167 for (
int j = 0; j < nvel; j++)
171 outarray[i * nvel + j], 1);
179 int physTot =
m_fields[0]->GetTotPoints();
182 for (
int i = 0; i < nvel; i++)
184 for (
int j = 0; j < nvel; j++)
188 outarray[i * nvel + j], 1);
197 int physTot =
m_fields[0]->GetTotPoints();
201 for (
int i = 0; i < nvel; i++)
203 for (
int k = 0; k < nvel; k++)
206 for (
int j = 0; j < nvel; j++)
210 outarray[i * nvel + k], 1, outarray[i * nvel + k],
221 int physTot =
m_fields[0]->GetTotPoints();
225 for (
int j = 0; j < nvel; j++)
227 for (
int k = 0; k < nvel; k++)
230 for (
int i = 0; i < nvel; i++)
234 outarray[j * nvel + k], 1, outarray[j * nvel + k],
249 int physTot =
m_fields[0]->GetTotPoints();
253 bool wavespace =
m_fields[0]->GetWaveSpace();
271 for (
int i = 0; i < nvel; i++)
273 for (
int j = 0; j < nvel; j++)
287 for (
int i = 0; i < nvel; i++)
289 for (
int j = 0; j < nvel; j++)
291 for (
int k = 0; k < nvel; k++)
319 int a, b, c, d, e, i, j;
322 for (i = 0; i < nvel; ++i)
324 for (j = 0; j < nvel; ++j)
326 a = ((i + 1) % nvel) * nvel + ((j + 1) % nvel);
327 b = ((i + 1) % nvel) * nvel + ((j + 2) % nvel);
328 c = ((i + 2) % nvel) * nvel + ((j + 1) % nvel);
329 d = ((i + 2) % nvel) * nvel + ((j + 2) % nvel);
345 for (
int i = 0; i < nvel; ++i)
352 for (
int i = 0; i < nvel * nvel; ++i)
363 for (
int i = 0; i < nvel; ++i)
365 for (
int j = 0; j < nvel; ++j)
367 for (
int k = 0; k < nvel; ++k)
378 m_fields[0]->SetWaveSpace(wavespace);
383 int physTot =
m_fields[0]->GetTotPoints();
390 for (
int i = 0; i < gradG.size(); i++)
398 bool waveSpace =
m_fields[0]->GetWaveSpace();
402 for (
int i = 0; i < nvel; i++)
404 for (
int j = 0; j < nvel; j++)
406 for (
int k = 0; k < nvel; k++)
410 gradG[i * nvel * nvel + j * nvel + k]);
416 for (
int p = 0;
p < nvel;
p++)
418 for (
int j = 0; j < nvel; j++)
420 for (
int k = 0; k < nvel; k++)
422 Vmath::Vadd(physTot, gradG[
p * nvel * nvel + j * nvel + k], 1,
423 gradG[
p * nvel * nvel + k * nvel + j], 1,
424 tmp[
p * nvel * nvel + j * nvel + k], 1);
425 Vmath::Vsub(physTot, tmp[
p * nvel * nvel + j * nvel + k], 1,
426 gradG[j * nvel * nvel + k * nvel +
p], 1,
427 tmp[
p * nvel * nvel + j * nvel + k], 1);
428 Vmath::Smul(physTot, 0.5, tmp[
p * nvel * nvel + j * nvel + k],
429 1, tmp[
p * nvel * nvel + j * nvel + k], 1);
435 for (
int i = 0; i < nvel; i++)
437 for (
int j = 0; j < nvel; j++)
439 for (
int k = 0; k < nvel; k++)
441 for (
int p = 0;
p < nvel;
p++)
445 tmp[
p * nvel * nvel + j * nvel + k], 1,
453 m_fields[0]->SetWaveSpace(waveSpace);
#define ASSERTL0(condition, msg)
static std::string className
Name of the class.
virtual GLOBAL_MAPPING_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const TiXmlElement *pMapping) override
Array< OneD, Array< OneD, NekDouble > > m_invDeriv
Array< OneD, Array< OneD, NekDouble > > m_metricTensor
virtual GLOBAL_MAPPING_EXPORT void v_GetJacobian(Array< OneD, NekDouble > &outarray) override
virtual GLOBAL_MAPPING_EXPORT void v_ApplyChristoffelContravar(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray) override
virtual GLOBAL_MAPPING_EXPORT void v_CovarFromCartesian(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray) override
virtual GLOBAL_MAPPING_EXPORT void v_ContravarToCartesian(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray) override
Array< OneD, Array< OneD, NekDouble > > m_deriv
virtual GLOBAL_MAPPING_EXPORT void v_ApplyChristoffelCovar(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
virtual GLOBAL_MAPPING_EXPORT void v_GetMetricTensor(Array< OneD, Array< OneD, NekDouble >> &outarray) override
void CalculateChristoffel()
void CalculateMetricTerms()
Array< OneD, Array< OneD, NekDouble > > m_Christoffel
virtual GLOBAL_MAPPING_EXPORT void v_ContravarFromCartesian(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray) override
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.
virtual GLOBAL_MAPPING_EXPORT void v_UpdateGeomInfo() override
virtual GLOBAL_MAPPING_EXPORT void v_CovarToCartesian(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray) override
virtual GLOBAL_MAPPING_EXPORT void v_GetInvMetricTensor(Array< OneD, Array< OneD, NekDouble >> &outarray) 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[]
The above copyright notice and this permission notice shall be included.
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.