42 namespace GlobalMapping
72 const TiXmlElement *pMapping)
79 "General Mapping needs at least 2 velocity components.");
86 int physTot =
m_fields[0]->GetTotPoints();
89 for (
int i=0; i<nvel; i++)
92 for (
int j=0; j<nvel; j++)
107 int physTot =
m_fields[0]->GetTotPoints();
110 for (
int i=0; i<nvel; i++)
113 for (
int j=0; j<nvel; j++)
128 int physTot =
m_fields[0]->GetTotPoints();
131 for (
int i=0; i<nvel; i++)
134 for (
int j=0; j<nvel; j++)
149 int physTot =
m_fields[0]->GetTotPoints();
152 for (
int i=0; i<nvel; i++)
155 for (
int j=0; j<nvel; j++)
169 int physTot =
m_fields[0]->GetTotPoints();
176 int physTot =
m_fields[0]->GetTotPoints();
179 for (
int i=0; i<nvel; i++)
181 for (
int j=0; j<nvel; j++)
185 outarray[i*nvel+j], 1);
194 int physTot =
m_fields[0]->GetTotPoints();
197 for (
int i=0; i<nvel; i++)
199 for (
int j=0; j<nvel; j++)
203 outarray[i*nvel+j], 1);
213 int physTot =
m_fields[0]->GetTotPoints();
217 for (
int i = 0; i <nvel; i++)
219 for (
int k = 0; k < nvel; k++)
222 for (
int j = 0; j < nvel; j++)
226 outarray[i*nvel+k], 1,
227 outarray[i*nvel+k], 1);
238 int physTot =
m_fields[0]->GetTotPoints();
242 for (
int j = 0; j < nvel; j++)
244 for (
int k = 0; k < nvel; k++)
247 for (
int i = 0; i <nvel; i++)
251 outarray[j*nvel+k], 1,
252 outarray[j*nvel+k], 1);
266 int physTot =
m_fields[0]->GetTotPoints();
270 bool wavespace =
m_fields[0]->GetWaveSpace();
288 for(
int i = 0; i<nvel; i++)
290 for(
int j = 0; j<nvel; j++)
305 for(
int i = 0; i<nvel; i++)
307 for(
int j = 0; j<nvel; j++)
309 for(
int k = 0; k<nvel; k++)
312 m_deriv[k*nvel+j], 1,
323 Vmath::Fill (physTot, 1.0, m_invMetricTensor[0], 1);
327 m_invMetricTensor[0*nvel+0], 1);
329 m_invMetricTensor[1*nvel+0], 1);
331 m_invMetricTensor[0*nvel+1], 1);
333 m_invMetricTensor[1*nvel+1], 1);
337 int a, b, c, d, e, i, j;
340 for (i = 0; i < nvel; ++i)
342 for (j = 0; j < nvel; ++j)
344 a = ((i+1)%nvel) * nvel + ((j+1)%nvel);
345 b = ((i+1)%nvel) * nvel + ((j+2)%nvel);
346 c = ((i+2)%nvel) * nvel + ((j+1)%nvel);
347 d = ((i+2)%nvel) * nvel + ((j+2)%nvel);
352 m_invMetricTensor[e], 1);
355 m_invMetricTensor[e], 1,
356 m_invMetricTensor[e], 1);
365 for (
int i = 0; i < nvel; ++i)
368 m_invMetricTensor[i*nvel], 1,
373 for (
int i = 0; i < nvel*nvel; ++i)
376 m_invMetricTensor[i], 1);
384 for (
int i = 0; i < nvel; ++i)
386 for (
int j = 0; j < nvel; ++j)
388 for (
int k = 0; k < nvel; ++k)
391 m_invMetricTensor[j*nvel+k], 1,
392 m_invDeriv[i*nvel+j], 1,
393 m_invDeriv[i*nvel+j], 1);
399 m_fields[0]->SetWaveSpace(wavespace);
404 int physTot =
m_fields[0]->GetTotPoints();
411 for (
int i = 0; i < gradG.num_elements(); i++)
419 bool waveSpace =
m_fields[0]->GetWaveSpace();
423 for (
int i = 0; i <nvel; i++)
425 for(
int j=0; j<nvel; j++)
427 for(
int k=0; k<nvel; k++)
431 gradG[i*nvel*nvel + j*nvel + k]);
437 for (
int p = 0;
p <nvel;
p++)
439 for (
int j = 0; j < nvel; j++)
441 for (
int k = 0; k < nvel; k++)
443 Vmath::Vadd(physTot, gradG[
p*nvel*nvel + j*nvel + k], 1,
444 gradG[
p*nvel*nvel + k*nvel + j], 1,
445 tmp[
p*nvel*nvel + j*nvel + k], 1);
447 gradG[j*nvel*nvel + k*nvel +
p], 1,
448 tmp[
p*nvel*nvel + j*nvel + k], 1);
449 Vmath::Smul(physTot, 0.5, tmp[
p*nvel*nvel + j*nvel + k], 1,
450 tmp[
p*nvel*nvel + j*nvel + k], 1);
456 for (
int i = 0; i <nvel; i++)
458 for (
int j = 0; j < nvel; j++)
460 for (
int k = 0; k < nvel; k++)
462 for (
int p = 0;
p < nvel;
p++)
465 tmp[
p*nvel*nvel + j*nvel + k], 1,
473 m_fields[0]->SetWaveSpace(waveSpace);
Array< OneD, Array< OneD, NekDouble > > m_invMetricTensor
Array< OneD, Array< OneD, NekDouble > > m_coords
Array with the Cartesian coordinates.
#define ASSERTL0(condition, msg)
virtual GLOBAL_MAPPING_EXPORT void v_CovarFromCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
MappingFactory & GetMappingFactory()
Declaration of the mapping factory singleton.
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
virtual GLOBAL_MAPPING_EXPORT void v_ContravarFromCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Array< OneD, Array< OneD, NekDouble > > m_invDeriv
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
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 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.
virtual GLOBAL_MAPPING_EXPORT void v_ApplyChristoffelCovar(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
int m_nConvectiveFields
Number of velocity components.
virtual GLOBAL_MAPPING_EXPORT void v_GetInvMetricTensor(Array< OneD, Array< OneD, NekDouble > > &outarray)
virtual GLOBAL_MAPPING_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const TiXmlElement *pMapping)
virtual GLOBAL_MAPPING_EXPORT void v_ContravarToCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
virtual GLOBAL_MAPPING_EXPORT void v_ApplyChristoffelContravar(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Array< OneD, Array< OneD, NekDouble > > m_deriv
static std::string className
Name of the class.
Array< OneD, NekDouble > m_jac
void CalculateChristoffel()
virtual GLOBAL_MAPPING_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const TiXmlElement *pMapping)
void CalculateMetricTerms()
bool m_constantJacobian
Flag defining if the Jacobian is constant.
virtual GLOBAL_MAPPING_EXPORT void v_GetMetricTensor(Array< OneD, Array< OneD, NekDouble > > &outarray)
virtual GLOBAL_MAPPING_EXPORT void v_CovarToCartesian(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Array< OneD, Array< OneD, NekDouble > > m_Christoffel
Base class for mapping to be applied to the coordinate system.
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.
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.
MultiRegions::Direction const DirCartesianMap[]
MappingGeneral(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
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 plus vector): z = w*x - y
virtual GLOBAL_MAPPING_EXPORT void v_GetJacobian(Array< OneD, NekDouble > &outarray)
Array< OneD, Array< OneD, NekDouble > > m_metricTensor
virtual GLOBAL_MAPPING_EXPORT void v_UpdateGeomInfo()
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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 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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.