Nektar++
Public Member Functions | Protected Attributes | List of all members
Nektar::VariableConverter Class Reference

#include <VariableConverter.h>

Public Member Functions

 VariableConverter (const LibUtilities::SessionReaderSharedPtr &pSession, const int spaceDim, const SpatialDomains::MeshGraphSharedPtr &pGraph=nullptr)
 
 ~VariableConverter ()=default
 
void GetDynamicEnergy (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &energy)
 Compute the dynamic energy \( e = rho*V^2/2 \). More...
 
void GetInternalEnergy (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &energy)
 Compute the specific internal energy \( e = (E - rho*V^2/2)/rho \). More...
 
template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
GetInternalEnergy (T *physfield)
 
void GetEnthalpy (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &enthalpy)
 Compute the specific enthalpy \( h = e + p/rho \). More...
 
void GetVelocityVector (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
 Compute the velocity field \( \mathbf{v} \) given the momentum \( \rho\mathbf{v} \). More...
 
void GetMach (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &soundspeed, Array< OneD, NekDouble > &mach)
 Compute the mach number \( M = \| \mathbf{v} \|^2 / c \). More...
 
void GetDynamicViscosity (const Array< OneD, const NekDouble > &temperature, Array< OneD, NekDouble > &mu)
 Compute the dynamic viscosity using the Sutherland's law \( \mu = \mu_star * (T / T_star)^3/2 * (1 + C) / (T/T_star + C) \), C : 110. /Tref Tref : the reference temperature, Tref, should always given in Kelvin, if non-dimensional should be the reference for non-dimensionalizing muref : the dynamic viscosity or the 1/Re corresponding to Tref T_star : m_pInf / (m_rhoInf * m_gasConstant),non-dimensional or dimensional. More...
 
template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
GetDynamicViscosity (T &temperature)
 
void GetAbsoluteVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &Vtot)
 
void GetTemperature (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &temperature)
 Compute the temperature using the equation of state. More...
 
template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
GetTemperature (T *physfield)
 
void GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)
 Calculate the pressure using the equation of state. More...
 
template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
GetPressure (T *physfield)
 
void GetSoundSpeed (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &soundspeed)
 Compute the sound speed using the equation of state. More...
 
void GetEntropy (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &entropy)
 Compute the entropy using the equation of state. More...
 
void GetEFromRhoP (const Array< OneD, NekDouble > &rho, const Array< OneD, NekDouble > &pressure, Array< OneD, NekDouble > &energy)
 Compute \( e(rho,p) \) using the equation of state. More...
 
void GetRhoFromPT (const Array< OneD, NekDouble > &pressure, const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &rho)
 Compute \( rho(p,T) \) using the equation of state. More...
 
void GetDmuDT (const Array< OneD, const NekDouble > &temperature, const Array< OneD, const NekDouble > &mu, Array< OneD, NekDouble > &DmuDT)
 Compute the dynamic viscosity using the Sutherland's law \( \mu = \mu_star * (T / T_star)^3/2 * (T_star + 110) / (T + 110) \),. More...
 
const EquationOfStateSharedPtr Geteos ()
 
void SetAv (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const Array< OneD, NekDouble > > &consVar, const Array< OneD, NekDouble > &div=NullNekDouble1DArray, const Array< OneD, NekDouble > &curlSquared=NullNekDouble1DArray)
 
Array< OneD, NekDouble > & GetAv ()
 
Array< OneD, NekDouble > & GetAvTrace ()
 
bool GetFlagCalcDivCurl (void) const
 
void SetElmtMinHP (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 Compute an estimate of minimum h/p for each element of the expansion. More...
 
Array< OneD, NekDouble > & GetElmtMinHP ()
 
void GetSensor (const MultiRegions::ExpListSharedPtr &field, const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, NekDouble > &Sensor, Array< OneD, NekDouble > &SensorKappa, int offset=1)
 
void GetMuAv (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &muAv)
 Calculate the physical artificial viscosity based on modal sensor. More...
 
void GetMuAv (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const Array< OneD, NekDouble > > &consVar, const Array< OneD, NekDouble > &div, Array< OneD, NekDouble > &muAv)
 Calculate the physical artificial viscosity based on dilatation of velocity vector. More...
 
void ApplyDucros (const Array< OneD, NekDouble > &div, const Array< OneD, NekDouble > &curlSquare, Array< OneD, NekDouble > &muAv)
 Apply Ducros (anti-vorticity) sensor averaged over the element. More...
 
void ApplyC0Smooth (Array< OneD, NekDouble > &field)
 Make field C0. More...
 

Protected Attributes

LibUtilities::SessionReaderSharedPtr m_session
 
EquationOfStateSharedPtr m_eos
 
size_t m_spacedim
 
NekDouble m_pInf
 
NekDouble m_rhoInf
 
NekDouble m_gasConstant
 
NekDouble m_mu
 
NekDouble m_Skappa
 
NekDouble m_Kappa
 
NekDouble m_oneOverT_star
 
NekDouble m_Tref
 
NekDouble m_TRatioSutherland
 
NekDouble m_mu0
 Shock sensor. More...
 
std::string m_shockCaptureType
 
std::string m_shockSensorType
 
std::string m_ducrosSensor
 
std::string m_smoothing
 
MultiRegions::ContFieldSharedPtr m_C0ProjectExp = nullptr
 
Array< OneD, NekDoublem_hOverP
 h/p scaling More...
 
Array< OneD, NekDoublem_muAv
 storage More...
 
Array< OneD, NekDoublem_muAvTrace
 
bool m_flagCalcDivCurl = false
 

Detailed Description

Definition at line 51 of file VariableConverter.h.

Constructor & Destructor Documentation

◆ VariableConverter()

Nektar::VariableConverter::VariableConverter ( const LibUtilities::SessionReaderSharedPtr pSession,
const int  spaceDim,
const SpatialDomains::MeshGraphSharedPtr pGraph = nullptr 
)

Definition at line 47 of file VariableConverter.cpp.

50 : m_session(pSession), m_spacedim(spaceDim)
51{
52 // Create equation of state object
53 std::string eosType;
54 m_session->LoadSolverInfo("EquationOfState", eosType, "IdealGas");
56
57 // Parameters for dynamic viscosity
58 m_session->LoadParameter("pInf", m_pInf, 101325);
59 m_session->LoadParameter("rhoInf", m_rhoInf, 1.225);
60 m_session->LoadParameter("GasConstant", m_gasConstant, 287.058);
61 m_session->LoadParameter("mu", m_mu, 1.78e-05);
63
64 // Parameters for sensor
65 m_session->LoadParameter("Skappa", m_Skappa, -1.0);
66 m_session->LoadParameter("Kappa", m_Kappa, 0.25);
67
69
70 // Shock sensor
71 m_session->LoadSolverInfo("ShockCaptureType", m_shockCaptureType, "Off");
72 if (m_shockCaptureType == "Physical")
73 {
74 // Artificial viscosity scaling constant
75 m_session->LoadParameter("mu0", m_mu0, 1.0);
76
79
80 // Check for Modal/Dilatation sensor
81 m_session->LoadSolverInfo("ShockSensorType", m_shockSensorType,
82 "Dilatation");
83
84 // Check for Ducros sensor
85 m_session->LoadSolverInfo("DucrosSensor", m_ducrosSensor, "Off");
86
87 if (m_ducrosSensor != "Off" || m_shockSensorType == "Dilatation")
88 {
89 m_flagCalcDivCurl = true;
90 }
91 }
92 // Load smoothing type.
93 // We only allocate the smoother if a mesh-graph was passed to the
94 // constructor. This is done to prevent the smoother from being allocated
95 // in cases when it won't be used. Otherwise, any class in the code that
96 // allocates a VariableConverter object try to will allocate a smoother,
97 // even if no mesh graph was passed to the constructor.
98 // TODO: the smoother should be separated from the VariableConverter class.
99 m_session->LoadSolverInfo("Smoothing", m_smoothing, "Off");
100 if (m_smoothing == "C0" && pGraph.get() != nullptr)
101 {
104 m_session, pGraph, m_session->GetVariable(0));
105 }
106
107 std::string viscosityType;
108 m_session->LoadSolverInfo("ViscosityType", viscosityType, "Constant");
109 if ("Variable" == viscosityType)
110 {
111 WARNINGL0(
112 m_session->DefinesParameter("Tref"),
113 "The Tref should be given in Kelvin for using the Sutherland's law "
114 "of dynamic viscosity. The default is 288.15. Note the mu or "
115 "Reynolds number should coorespond to this temperature.");
116 m_session->LoadParameter("Tref", m_Tref, 288.15);
117 m_TRatioSutherland = 110.0 / m_Tref;
118 }
119}
#define WARNINGL0(condition, msg)
Definition: ErrorUtil.hpp:215
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
EquationOfStateSharedPtr m_eos
Array< OneD, NekDouble > m_hOverP
h/p scaling
Array< OneD, NekDouble > m_muAvTrace
MultiRegions::ContFieldSharedPtr m_C0ProjectExp
LibUtilities::SessionReaderSharedPtr m_session
NekDouble m_mu0
Shock sensor.
Array< OneD, NekDouble > m_muAv
storage
EquationOfStateFactory & GetEquationOfStateFactory()
Declaration of the equation of state factory singleton.
static Array< OneD, NekDouble > NullNekDouble1DArray

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::GetEquationOfStateFactory(), m_C0ProjectExp, m_ducrosSensor, m_eos, m_flagCalcDivCurl, m_gasConstant, m_hOverP, m_Kappa, m_mu, m_mu0, m_muAv, m_muAvTrace, m_oneOverT_star, m_pInf, m_rhoInf, m_session, m_shockCaptureType, m_shockSensorType, m_Skappa, m_smoothing, m_TRatioSutherland, m_Tref, Nektar::NullNekDouble1DArray, and WARNINGL0.

◆ ~VariableConverter()

Nektar::VariableConverter::~VariableConverter ( )
default

Member Function Documentation

◆ ApplyC0Smooth()

void Nektar::VariableConverter::ApplyC0Smooth ( Array< OneD, NekDouble > &  field)

Make field C0.

Parameters
fieldInput Field

Definition at line 764 of file VariableConverter.cpp.

765{
766 // Make sure that the C0 projection operator has been allocated. Note that
767 // the VariableConverter object can be allocated without the C0 smoother.
768 // This is why this check is needed. Ideally, the C0 smoother is separated
769 // from the VariableConverter class.
770 ASSERTL0(m_C0ProjectExp.get() != nullptr,
771 "C0 projection operator not initialized in "
772 "VariableConverter::ApplyC0Smooth()");
773
774 int nCoeffs = m_C0ProjectExp->GetNcoeffs();
775 Array<OneD, NekDouble> muFwd(nCoeffs);
776 Array<OneD, NekDouble> weights(nCoeffs, 1.0);
777 // Assemble global expansion coefficients for viscosity
778 m_C0ProjectExp->FwdTransLocalElmt(field, m_C0ProjectExp->UpdateCoeffs());
779 m_C0ProjectExp->Assemble();
780 Vmath::Vcopy(nCoeffs, m_C0ProjectExp->GetCoeffs(), 1, muFwd, 1);
781 // Global coefficients
782 Vmath::Vcopy(nCoeffs, weights, 1, m_C0ProjectExp->UpdateCoeffs(), 1);
783 // This is the sign vector
784 m_C0ProjectExp->GlobalToLocal();
785 // Get weights
786 m_C0ProjectExp->Assemble();
787 // Divide
788 Vmath::Vdiv(nCoeffs, muFwd, 1, m_C0ProjectExp->GetCoeffs(), 1,
789 m_C0ProjectExp->UpdateCoeffs(), 1);
790 // Get local coefficients
791 m_C0ProjectExp->GlobalToLocal();
792 // Get C0 field
793 m_C0ProjectExp->BwdTrans(m_C0ProjectExp->GetCoeffs(), field);
794}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
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.
Definition: Vmath.hpp:126
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References ASSERTL0, FilterPython_Function::field, m_C0ProjectExp, Vmath::Vcopy(), and Vmath::Vdiv().

Referenced by SetAv().

◆ ApplyDucros()

void Nektar::VariableConverter::ApplyDucros ( const Array< OneD, NekDouble > &  div,
const Array< OneD, NekDouble > &  curlSquare,
Array< OneD, NekDouble > &  muAv 
)

Apply Ducros (anti-vorticity) sensor averaged over the element.

Parameters
fieldInput Field

Definition at line 738 of file VariableConverter.cpp.

741{
742 // machine eps**2
743 NekDouble eps = std::numeric_limits<NekDouble>::epsilon();
744 eps *= eps;
745
746 // loop over points
747 size_t nPts = div.size();
748 for (size_t p = 0; p < nPts; ++p)
749 {
750 NekDouble tmpDiv2 = div[p];
751 tmpDiv2 *= tmpDiv2;
752 NekDouble denDuc = tmpDiv2 + curlSquare[p] + eps;
753 NekDouble Duc = tmpDiv2 / denDuc;
754 // apply
755 muAv[p] *= Duc;
756 }
757}
double NekDouble

References CellMLToNektar.cellml_metadata::p.

Referenced by SetAv().

◆ GetAbsoluteVelocity()

void Nektar::VariableConverter::GetAbsoluteVelocity ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  Vtot 
)

Definition at line 276 of file VariableConverter.cpp.

279{
280 const size_t nPts = physfield[0].size();
281
282 // Getting the velocity vector on the 2D normal space
284
285 Vmath::Zero(Vtot.size(), Vtot, 1);
286
287 for (size_t i = 0; i < m_spacedim; ++i)
288 {
289 velocity[i] = Array<OneD, NekDouble>(nPts);
290 }
291
292 GetVelocityVector(physfield, velocity);
293
294 for (size_t i = 0; i < m_spacedim; ++i)
295 {
296 Vmath::Vvtvp(nPts, velocity[i], 1, velocity[i], 1, Vtot, 1, Vtot, 1);
297 }
298
299 Vmath::Vsqrt(nPts, Vtot, 1, Vtot, 1);
300}
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
Definition: Vmath.hpp:340
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
Definition: Vmath.hpp:366
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273

References GetVelocityVector(), m_spacedim, Vmath::Vsqrt(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by GetMuAv().

◆ GetAv()

Array< OneD, NekDouble > & Nektar::VariableConverter::GetAv ( )
inline

Definition at line 166 of file VariableConverter.h.

167 {
168 ASSERTL1(m_muAv != NullNekDouble1DArray, "m_muAv not set");
169 return m_muAv;
170 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242

References ASSERTL1, m_muAv, and Nektar::NullNekDouble1DArray.

◆ GetAvTrace()

Array< OneD, NekDouble > & Nektar::VariableConverter::GetAvTrace ( )
inline

Definition at line 172 of file VariableConverter.h.

173 {
174 ASSERTL1(m_muAvTrace != NullNekDouble1DArray, "m_muAvTrace not set");
175 return m_muAvTrace;
176 }

References ASSERTL1, m_muAvTrace, and Nektar::NullNekDouble1DArray.

◆ GetDmuDT()

void Nektar::VariableConverter::GetDmuDT ( const Array< OneD, const NekDouble > &  temperature,
const Array< OneD, const NekDouble > &  mu,
Array< OneD, NekDouble > &  DmuDT 
)

Compute the dynamic viscosity using the Sutherland's law \( \mu = \mu_star * (T / T_star)^3/2 * (T_star + 110) / (T + 110) \),.

Definition at line 259 of file VariableConverter.cpp.

262{
263 const size_t nPts = temperature.size();
264 NekDouble tmp = 0.0;
265 NekDouble ratio;
266
267 for (size_t i = 0; i < nPts; ++i)
268 {
269 ratio = temperature[i] * m_oneOverT_star;
270 tmp = 0.5 * (ratio + 3.0 * m_TRatioSutherland) /
271 (ratio * (ratio + m_TRatioSutherland));
272 DmuDT[i] = mu[i] * tmp * m_oneOverT_star;
273 }
274}

References m_oneOverT_star, and m_TRatioSutherland.

◆ GetDynamicEnergy()

void Nektar::VariableConverter::GetDynamicEnergy ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  energy 
)

Compute the dynamic energy \( e = rho*V^2/2 \).

Definition at line 125 of file VariableConverter.cpp.

128{
129 size_t nPts = physfield[m_spacedim + 1].size();
130 Vmath::Zero(nPts, energy, 1);
131
132 // tmp = (rho * u_i)^2
133 for (size_t i = 0; i < m_spacedim; ++i)
134 {
135 Vmath::Vvtvp(nPts, physfield[i + 1], 1, physfield[i + 1], 1, energy, 1,
136 energy, 1);
137 }
138 // Divide by rho and multiply by 0.5 --> tmp = 0.5 * rho * u^2
139 Vmath::Vdiv(nPts, energy, 1, physfield[0], 1, energy, 1);
140 Vmath::Smul(nPts, 0.5, energy, 1, energy, 1);
141}
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100

References m_spacedim, Vmath::Smul(), Vmath::Vdiv(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by GetInternalEnergy().

◆ GetDynamicViscosity() [1/2]

void Nektar::VariableConverter::GetDynamicViscosity ( const Array< OneD, const NekDouble > &  temperature,
Array< OneD, NekDouble > &  mu 
)

Compute the dynamic viscosity using the Sutherland's law \( \mu = \mu_star * (T / T_star)^3/2 * (1 + C) / (T/T_star + C) \), C : 110. /Tref Tref : the reference temperature, Tref, should always given in Kelvin, if non-dimensional should be the reference for non-dimensionalizing muref : the dynamic viscosity or the 1/Re corresponding to Tref T_star : m_pInf / (m_rhoInf * m_gasConstant),non-dimensional or dimensional.

WARNING, if this routine is modified the same must be done in the FieldConvert utility ProcessWSS.cpp (this class should be restructured).

Parameters
temperatureInput temperature.
muThe resulting dynamic viscosity.

Definition at line 244 of file VariableConverter.cpp.

246{
247 const size_t nPts = temperature.size();
248
249 for (size_t i = 0; i < nPts; ++i)
250 {
251 mu[i] = GetDynamicViscosity(temperature[i]);
252 }
253}
void GetDynamicViscosity(const Array< OneD, const NekDouble > &temperature, Array< OneD, NekDouble > &mu)
Compute the dynamic viscosity using the Sutherland's law , C : 110. /Tref Tref : the reference temper...

References GetDynamicViscosity().

Referenced by GetDynamicViscosity().

◆ GetDynamicViscosity() [2/2]

template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
T Nektar::VariableConverter::GetDynamicViscosity ( T &  temperature)
inline

Definition at line 100 of file VariableConverter.h.

101 {
102 const NekDouble onePlusC = 1.0 + m_TRatioSutherland;
103
104 NekDouble mu_star = m_mu;
105
106 T ratio = temperature * m_oneOverT_star;
107 return mu_star * ratio * sqrt(ratio) * onePlusC /
108 (ratio + m_TRatioSutherland);
109 }
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:285

References m_mu, m_oneOverT_star, m_TRatioSutherland, and tinysimd::sqrt().

◆ GetEFromRhoP()

void Nektar::VariableConverter::GetEFromRhoP ( const Array< OneD, NekDouble > &  rho,
const Array< OneD, NekDouble > &  pressure,
Array< OneD, NekDouble > &  energy 
)

Compute \( e(rho,p) \) using the equation of state.

Parameters
rhoInput density
pressureInput pressure
energyThe resulting internal energy.

Definition at line 393 of file VariableConverter.cpp.

396{
397 size_t nPts = rho.size();
398
399 for (size_t i = 0; i < nPts; ++i)
400 {
401 energy[i] = m_eos->GetEFromRhoP(rho[i], pressure[i]);
402 }
403}

References m_eos, and CG_Iterations::pressure.

◆ GetElmtMinHP()

Array< OneD, NekDouble > & Nektar::VariableConverter::GetElmtMinHP ( )

Definition at line 538 of file VariableConverter.cpp.

539{
540 ASSERTL1(m_hOverP != NullNekDouble1DArray, "m_hOverP not set");
541 return m_hOverP;
542}

References ASSERTL1, m_hOverP, and Nektar::NullNekDouble1DArray.

◆ GetEnthalpy()

void Nektar::VariableConverter::GetEnthalpy ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  enthalpy 
)

Compute the specific enthalpy \( h = e + p/rho \).

Definition at line 165 of file VariableConverter.cpp.

168{
169 size_t nPts = physfield[0].size();
170 Array<OneD, NekDouble> energy(nPts, 0.0);
172
173 GetInternalEnergy(physfield, energy);
174 GetPressure(physfield, pressure);
175
176 // Calculate p/rho
177 Vmath::Vdiv(nPts, pressure, 1, physfield[0], 1, enthalpy, 1);
178 // Calculate h = e + p/rho
179 Vmath::Vadd(nPts, energy, 1, enthalpy, 1, enthalpy, 1);
180}
void GetInternalEnergy(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &energy)
Compute the specific internal energy .
void GetPressure(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)
Calculate the pressure using the equation of state.
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.
Definition: Vmath.hpp:180

References GetInternalEnergy(), GetPressure(), CG_Iterations::pressure, Vmath::Vadd(), and Vmath::Vdiv().

◆ GetEntropy()

void Nektar::VariableConverter::GetEntropy ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  entropy 
)

Compute the entropy using the equation of state.

Parameters
physfieldInput physical field
soundspeedThe resulting sound speed \( c \).

Definition at line 371 of file VariableConverter.cpp.

374{
375 size_t nPts = physfield[0].size();
376
377 Array<OneD, NekDouble> energy(nPts);
378 GetInternalEnergy(physfield, energy);
379
380 for (size_t i = 0; i < nPts; ++i)
381 {
382 entropy[i] = m_eos->GetEntropy(physfield[0][i], energy[i]);
383 }
384}

References GetInternalEnergy(), and m_eos.

◆ Geteos()

const EquationOfStateSharedPtr Nektar::VariableConverter::Geteos ( )
inline

Definition at line 154 of file VariableConverter.h.

155 {
156 return m_eos;
157 }

References m_eos.

◆ GetFlagCalcDivCurl()

bool Nektar::VariableConverter::GetFlagCalcDivCurl ( void  ) const
inline

Definition at line 178 of file VariableConverter.h.

179 {
180 return m_flagCalcDivCurl;
181 }

References m_flagCalcDivCurl.

◆ GetInternalEnergy() [1/2]

void Nektar::VariableConverter::GetInternalEnergy ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  energy 
)

Compute the specific internal energy \( e = (E - rho*V^2/2)/rho \).

Definition at line 147 of file VariableConverter.cpp.

150{
151 size_t nPts = physfield[0].size();
152 Array<OneD, NekDouble> tmp(nPts);
153
154 GetDynamicEnergy(physfield, tmp);
155
156 // Calculate rhoe = E - rho*V^2/2
157 Vmath::Vsub(nPts, physfield[m_spacedim + 1], 1, tmp, 1, energy, 1);
158 // Divide by rho
159 Vmath::Vdiv(nPts, energy, 1, physfield[0], 1, energy, 1);
160}
void GetDynamicEnergy(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &energy)
Compute the dynamic energy .
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.
Definition: Vmath.hpp:220

References GetDynamicEnergy(), m_spacedim, Vmath::Vdiv(), and Vmath::Vsub().

Referenced by GetEnthalpy(), GetEntropy(), GetPressure(), GetSoundSpeed(), and GetTemperature().

◆ GetInternalEnergy() [2/2]

template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
T Nektar::VariableConverter::GetInternalEnergy ( T *  physfield)
inline

Definition at line 71 of file VariableConverter.h.

72 {
73 // get dynamic energy
74 T oneOrho = 1.0 / physfield[0];
75 T dynEne{};
76 for (size_t d = 1; d < m_spacedim + 1; ++d)
77 {
78 T tmp = physfield[d]; // load 1x
79 dynEne += tmp * tmp;
80 }
81 dynEne = 0.5 * dynEne * oneOrho;
82
83 // Calculate rhoe = E - rho*V^2/2
84 T energy = physfield[m_spacedim + 1] - dynEne;
85 return energy * oneOrho;
86 }
std::vector< double > d(NPUPPER *NPUPPER)

References Nektar::UnitTests::d(), and m_spacedim.

◆ GetMach()

void Nektar::VariableConverter::GetMach ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  soundspeed,
Array< OneD, NekDouble > &  mach 
)

Compute the mach number \( M = \| \mathbf{v} \|^2 / c \).

Parameters
physfieldInput physical field.
soundfieldThe speed of sound corresponding to physfield.
machThe resulting mach number \( M \).

Definition at line 208 of file VariableConverter.cpp.

211{
212 const size_t nPts = physfield[0].size();
213
214 Vmath::Vmul(nPts, physfield[1], 1, physfield[1], 1, mach, 1);
215
216 for (size_t i = 1; i < m_spacedim; ++i)
217 {
218 Vmath::Vvtvp(nPts, physfield[1 + i], 1, physfield[1 + i], 1, mach, 1,
219 mach, 1);
220 }
221
222 Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
223 Vmath::Vdiv(nPts, mach, 1, physfield[0], 1, mach, 1);
224 Vmath::Vsqrt(nPts, mach, 1, mach, 1);
225
226 Vmath::Vdiv(nPts, mach, 1, soundspeed, 1, mach, 1);
227}
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.
Definition: Vmath.hpp:72

References m_spacedim, Vmath::Vdiv(), Vmath::Vmul(), Vmath::Vsqrt(), and Vmath::Vvtvp().

◆ GetMuAv() [1/2]

void Nektar::VariableConverter::GetMuAv ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  consVar,
const Array< OneD, NekDouble > &  div,
Array< OneD, NekDouble > &  muAv 
)

Calculate the physical artificial viscosity based on dilatation of velocity vector.

Parameters

Definition at line 689 of file VariableConverter.cpp.

693{
694 size_t nPts = consVar[0].size();
695
696 // Get sound speed
697 // theoretically it should be used the critical sound speed, this
698 // matters for large Mach numbers (above 3.0)
699 Array<OneD, NekDouble> soundSpeed(nPts, 0.0);
700 GetSoundSpeed(consVar, soundSpeed);
701
702 // Get abosolute velocity to compute lambda
703 Array<OneD, NekDouble> absVelocity(nPts, 0.0);
704 GetAbsoluteVelocity(consVar, absVelocity);
705
706 // Loop over elements
707 size_t nElmt = fields[0]->GetExpSize();
708 for (size_t e = 0; e < nElmt; ++e)
709 {
710 int nElmtPoints = fields[0]->GetExp(e)->GetTotPoints();
711 int physOffset = fields[0]->GetPhys_Offset(e);
712 int physEnd = physOffset + nElmtPoints;
713
714 NekDouble hOpTmp = m_hOverP[e];
715
716 // Loop over the points
717 for (int p = physOffset; p < physEnd; ++p)
718 {
719 // Get non-dimensional sensor based on dilatation
720 NekDouble sSpeedTmp = soundSpeed[p];
721 // (only compression waves)
722 NekDouble divTmp = -div[p];
723 divTmp = std::max(divTmp, 0.0);
724 NekDouble sensor = m_mu0 * hOpTmp * divTmp / sSpeedTmp;
725 // Scale to viscosity scale
726 NekDouble rho = consVar[0][p];
727 NekDouble lambda = sSpeedTmp + absVelocity[p];
728 muAv[p] = sensor * rho * lambda * hOpTmp;
729 }
730 }
731}
void GetAbsoluteVelocity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &Vtot)
void GetSoundSpeed(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &soundspeed)
Compute the sound speed using the equation of state.

References GetAbsoluteVelocity(), GetSoundSpeed(), m_hOverP, m_mu0, and CellMLToNektar.cellml_metadata::p.

◆ GetMuAv() [2/2]

void Nektar::VariableConverter::GetMuAv ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  consVar,
Array< OneD, NekDouble > &  muAv 
)

Calculate the physical artificial viscosity based on modal sensor.

Parameters
consVarInput field.

Definition at line 641 of file VariableConverter.cpp.

645{
646 size_t nPts = consVar[0].size();
647 // Determine the maximum wavespeed
648 Array<OneD, NekDouble> Lambdas(nPts, 0.0);
649 Array<OneD, NekDouble> soundspeed(nPts, 0.0);
650 Array<OneD, NekDouble> absVelocity(nPts, 0.0);
651 GetSoundSpeed(consVar, soundspeed);
652 GetAbsoluteVelocity(consVar, absVelocity);
653 Vmath::Vadd(nPts, absVelocity, 1, soundspeed, 1, Lambdas, 1);
654
655 // Compute sensor based on rho
656 Array<OneD, NekDouble> Sensor(nPts, 0.0);
657 GetSensor(fields[0], consVar, Sensor, muAv, 1);
658
660 size_t nElmt = fields[0]->GetExpSize();
661 for (size_t e = 0; e < nElmt; ++e)
662 {
663 int physOffset = fields[0]->GetPhys_Offset(e);
664 int nElmtPoints = fields[0]->GetExp(e)->GetTotPoints();
665
666 // Compute the maximum wave speed
667 NekDouble LambdaElmt = 0.0;
668 LambdaElmt = Vmath::Vmax(nElmtPoints, tmp = Lambdas + physOffset, 1);
669
670 // Compute average bounded density
671 NekDouble rhoAve =
672 Vmath::Vsum(nElmtPoints, tmp = consVar[0] + physOffset, 1);
673 rhoAve = rhoAve / nElmtPoints;
674 rhoAve = Smath::Smax(rhoAve, 1.0e-4, 1.0e+4);
675
676 // Scale sensor by coeff, h/p, and density
677 LambdaElmt *= m_mu0 * m_hOverP[e] * rhoAve;
678 Vmath::Smul(nElmtPoints, LambdaElmt, tmp = muAv + physOffset, 1,
679 tmp = muAv + physOffset, 1);
680 }
681}
void GetSensor(const MultiRegions::ExpListSharedPtr &field, const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, NekDouble > &Sensor, Array< OneD, NekDouble > &SensorKappa, int offset=1)
T Smax(const T a, const T b, const T k)
Return the soft max of between two scalars.
Definition: Smath.hpp:53
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
Definition: Vmath.hpp:608
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.hpp:644

References GetAbsoluteVelocity(), GetSensor(), GetSoundSpeed(), m_hOverP, m_mu0, Smath::Smax(), Vmath::Smul(), Vmath::Vadd(), Vmath::Vmax(), and Vmath::Vsum().

Referenced by SetAv().

◆ GetPressure() [1/2]

void Nektar::VariableConverter::GetPressure ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  pressure 
)

Calculate the pressure using the equation of state.

Parameters
physfieldInput momentum.
pressureComputed pressure field.

Definition at line 308 of file VariableConverter.cpp.

311{
312 size_t nPts = physfield[0].size();
313
314 Array<OneD, NekDouble> energy(nPts);
315 GetInternalEnergy(physfield, energy);
316
317 for (size_t i = 0; i < nPts; ++i)
318 {
319 pressure[i] = m_eos->GetPressure(physfield[0][i], energy[i]);
320 }
321}

References GetInternalEnergy(), m_eos, and CG_Iterations::pressure.

Referenced by GetEnthalpy().

◆ GetPressure() [2/2]

template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
T Nektar::VariableConverter::GetPressure ( T *  physfield)
inline

Definition at line 133 of file VariableConverter.h.

134 {
135 T energy = GetInternalEnergy(physfield);
136 return m_eos->GetPressure(physfield[0], energy);
137 }

References GetInternalEnergy(), and m_eos.

◆ GetRhoFromPT()

void Nektar::VariableConverter::GetRhoFromPT ( const Array< OneD, NekDouble > &  pressure,
const Array< OneD, NekDouble > &  temperature,
Array< OneD, NekDouble > &  rho 
)

Compute \( rho(p,T) \) using the equation of state.

Parameters
pressureInput pressure
temperatureInput temperature
rhoThe resulting density

Definition at line 412 of file VariableConverter.cpp.

415{
416 size_t nPts = pressure.size();
417
418 for (size_t i = 0; i < nPts; ++i)
419 {
420 rho[i] = m_eos->GetRhoFromPT(pressure[i], temperature[i]);
421 }
422}

References m_eos, and CG_Iterations::pressure.

◆ GetSensor()

void Nektar::VariableConverter::GetSensor ( const MultiRegions::ExpListSharedPtr field,
const Array< OneD, const Array< OneD, NekDouble > > &  physarray,
Array< OneD, NekDouble > &  Sensor,
Array< OneD, NekDouble > &  SensorKappa,
int  offset = 1 
)

Definition at line 544 of file VariableConverter.cpp.

549{
550 NekDouble Skappa;
551 NekDouble order;
553 Array<OneD, int> expOrderElement = field->EvalBasisNumModesMaxPerExp();
554
555 for (int e = 0; e < field->GetExpSize(); e++)
556 {
557 int numModesElement = expOrderElement[e];
558 int nElmtPoints = field->GetExp(e)->GetTotPoints();
559 int physOffset = field->GetPhys_Offset(e);
560 int nElmtCoeffs = field->GetExp(e)->GetNcoeffs();
561 int numCutOff = numModesElement - offset;
562
563 if (numModesElement <= offset)
564 {
565 Vmath::Fill(nElmtPoints, 0.0, tmp = Sensor + physOffset, 1);
566 Vmath::Fill(nElmtPoints, 0.0, tmp = SensorKappa + physOffset, 1);
567 continue;
568 }
569
570 // create vector to save the solution points per element at P = p;
571 Array<OneD, NekDouble> elmtPhys(nElmtPoints,
572 tmp = physarray[0] + physOffset);
573 // Compute coefficients
574 Array<OneD, NekDouble> elmtCoeffs(nElmtCoeffs, 0.0);
575 field->GetExp(e)->FwdTrans(elmtPhys, elmtCoeffs);
576
577 // ReduceOrderCoeffs reduces the polynomial order of the solution
578 // that is represented by the coeffs given as an inarray. This is
579 // done by projecting the higher order solution onto the orthogonal
580 // basis and padding the higher order coefficients with zeros.
581 Array<OneD, NekDouble> reducedElmtCoeffs(nElmtCoeffs, 0.0);
582 field->GetExp(e)->ReduceOrderCoeffs(numCutOff, elmtCoeffs,
583 reducedElmtCoeffs);
584
585 Array<OneD, NekDouble> reducedElmtPhys(nElmtPoints, 0.0);
586 field->GetExp(e)->BwdTrans(reducedElmtCoeffs, reducedElmtPhys);
587
588 NekDouble numerator = 0.0;
589 NekDouble denominator = 0.0;
590
591 // Determining the norm of the numerator of the Sensor
592 Array<OneD, NekDouble> difference(nElmtPoints, 0.0);
593 Vmath::Vsub(nElmtPoints, elmtPhys, 1, reducedElmtPhys, 1, difference,
594 1);
595
596 numerator = Vmath::Dot(nElmtPoints, difference, difference);
597 denominator = Vmath::Dot(nElmtPoints, elmtPhys, elmtPhys);
598
599 NekDouble elmtSensor = sqrt(numerator / denominator);
600 elmtSensor =
601 log10(std::max(elmtSensor, NekConstants::kNekMachineEpsilon));
602
603 Vmath::Fill(nElmtPoints, elmtSensor, tmp = Sensor + physOffset, 1);
604
605 // Compute reference value for sensor
606 order = std::max(numModesElement - 1, 1);
607 if (order > 0)
608 {
609 Skappa = m_Skappa - 4.25 * log10(static_cast<NekDouble>(order));
610 }
611 else
612 {
613 Skappa = 0.0;
614 }
615
616 // Compute artificial viscosity
617 NekDouble elmtSensorKappa;
618 if (elmtSensor < (Skappa - m_Kappa))
619 {
620 elmtSensorKappa = 0;
621 }
622 else if (elmtSensor > (Skappa + m_Kappa))
623 {
624 elmtSensorKappa = 1.0;
625 }
626 else
627 {
628 elmtSensorKappa =
629 0.5 * (1 + sin(M_PI * (elmtSensor - Skappa) / (2 * m_Kappa)));
630 }
631 Vmath::Fill(nElmtPoints, elmtSensorKappa,
632 tmp = SensorKappa + physOffset, 1);
633 }
634}
static const NekDouble kNekMachineEpsilon
T Dot(int n, const T *w, const T *x)
dot product
Definition: Vmath.hpp:761
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.hpp:54

References Vmath::Dot(), FilterPython_Function::field, Vmath::Fill(), Nektar::NekConstants::kNekMachineEpsilon, m_Kappa, m_Skappa, tinysimd::sqrt(), and Vmath::Vsub().

Referenced by GetMuAv().

◆ GetSoundSpeed()

void Nektar::VariableConverter::GetSoundSpeed ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  soundspeed 
)

Compute the sound speed using the equation of state.

Parameters
physfieldInput physical field
soundspeedThe resulting sound speed \( c \).

Definition at line 350 of file VariableConverter.cpp.

353{
354 size_t nPts = physfield[0].size();
355
356 Array<OneD, NekDouble> energy(nPts);
357 GetInternalEnergy(physfield, energy);
358
359 for (size_t i = 0; i < nPts; ++i)
360 {
361 soundspeed[i] = m_eos->GetSoundSpeed(physfield[0][i], energy[i]);
362 }
363}

References GetInternalEnergy(), and m_eos.

Referenced by GetMuAv().

◆ GetTemperature() [1/2]

void Nektar::VariableConverter::GetTemperature ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  temperature 
)

Compute the temperature using the equation of state.

Parameters
physfieldInput physical field.
temperatureThe resulting temperature \( T \).

Definition at line 329 of file VariableConverter.cpp.

332{
333 size_t nPts = physfield[0].size();
334
335 Array<OneD, NekDouble> energy(nPts);
336 GetInternalEnergy(physfield, energy);
337
338 for (size_t i = 0; i < nPts; ++i)
339 {
340 temperature[i] = m_eos->GetTemperature(physfield[0][i], energy[i]);
341 }
342}

References GetInternalEnergy(), and m_eos.

◆ GetTemperature() [2/2]

template<class T , typename = typename std::enable_if< std::is_floating_point_v<T> || tinysimd::is_vector_floating_point_v<T>>::type>
T Nektar::VariableConverter::GetTemperature ( T *  physfield)
inline

Definition at line 122 of file VariableConverter.h.

123 {
124 T energy = GetInternalEnergy(physfield);
125 return m_eos->GetTemperature(physfield[0], energy);
126 }

References GetInternalEnergy(), and m_eos.

◆ GetVelocityVector()

void Nektar::VariableConverter::GetVelocityVector ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  velocity 
)

Compute the velocity field \( \mathbf{v} \) given the momentum \( \rho\mathbf{v} \).

Parameters
physfieldMomentum field.
velocityVelocity field.

Definition at line 189 of file VariableConverter.cpp.

192{
193 const size_t nPts = physfield[0].size();
194
195 for (size_t i = 0; i < m_spacedim; ++i)
196 {
197 Vmath::Vdiv(nPts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
198 }
199}

References m_spacedim, and Vmath::Vdiv().

Referenced by GetAbsoluteVelocity().

◆ SetAv()

void Nektar::VariableConverter::SetAv ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, const Array< OneD, NekDouble > > &  consVar,
const Array< OneD, NekDouble > &  div = NullNekDouble1DArray,
const Array< OneD, NekDouble > &  curlSquared = NullNekDouble1DArray 
)

Definition at line 424 of file VariableConverter.cpp.

429{
430 size_t nTracePts = fields[0]->GetTrace()->GetTotPoints();
432 {
433 size_t nPts = fields[0]->GetTotPoints();
434 m_muAv = Array<OneD, NekDouble>(nPts, 0.0);
435 m_muAvTrace = Array<OneD, NekDouble>(nTracePts, 0.0);
436 SetElmtMinHP(fields);
437 }
438
439 if (m_shockSensorType == "Modal")
440 {
441 // Get viscosity based on modal sensor
442 GetMuAv(fields, consVar, m_muAv);
443 }
444 else
445 {
446 // Get viscosity based on dilatation sensor
447 GetMuAv(fields, consVar, div, m_muAv);
448 }
449
450 // Apply Ducros sensor
451 if (m_ducrosSensor != "Off")
452 {
453 ApplyDucros(div, curlSquared, m_muAv);
454 }
455
456 // Apply approximate C0 smoothing
457 if (m_smoothing == "C0")
458 {
460 }
461
462 // Set trace AV
463 Array<OneD, NekDouble> muFwd(nTracePts, 0.0), muBwd(nTracePts, 0.0);
464 fields[0]->GetFwdBwdTracePhys(m_muAv, muFwd, muBwd, false, false, false);
465 for (size_t p = 0; p < nTracePts; ++p)
466 {
467 m_muAvTrace[p] = 0.5 * (muFwd[p] + muBwd[p]);
468 }
469}
void ApplyC0Smooth(Array< OneD, NekDouble > &field)
Make field C0.
void GetMuAv(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &muAv)
Calculate the physical artificial viscosity based on modal sensor.
void SetElmtMinHP(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Compute an estimate of minimum h/p for each element of the expansion.
void ApplyDucros(const Array< OneD, NekDouble > &div, const Array< OneD, NekDouble > &curlSquare, Array< OneD, NekDouble > &muAv)
Apply Ducros (anti-vorticity) sensor averaged over the element.

References ApplyC0Smooth(), ApplyDucros(), GetMuAv(), m_ducrosSensor, m_muAv, m_muAvTrace, m_shockSensorType, m_smoothing, Nektar::NullNekDouble1DArray, CellMLToNektar.cellml_metadata::p, and SetElmtMinHP().

◆ SetElmtMinHP()

void Nektar::VariableConverter::SetElmtMinHP ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields)

Compute an estimate of minimum h/p for each element of the expansion.

Definition at line 475 of file VariableConverter.cpp.

477{
478 size_t nElements = fields[0]->GetExpSize();
480 {
481 m_hOverP = Array<OneD, NekDouble>(nElements, 1.0);
482 }
483
484 // Determine h/p scaling
485 Array<OneD, int> pOrderElmt = fields[0]->EvalBasisNumModesMaxPerExp();
486 int expdim = fields[0]->GetGraph()->GetMeshDimension();
487 for (size_t e = 0; e < nElements; e++)
488 {
489 NekDouble h = 1.0e+10;
490 switch (expdim)
491 {
492 case 3:
493 {
495 exp3D = fields[0]->GetExp(e)->as<LocalRegions::Expansion3D>();
496 for (int i = 0; i < exp3D->GetNtraces(); ++i)
497 {
498 h = std::min(
499 h, exp3D->GetGeom3D()->GetEdge(i)->GetVertex(0)->dist(*(
500 exp3D->GetGeom3D()->GetEdge(i)->GetVertex(1))));
501 }
502 break;
503 }
504
505 case 2:
506 {
508 exp2D = fields[0]->GetExp(e)->as<LocalRegions::Expansion2D>();
509 for (int i = 0; i < exp2D->GetNtraces(); ++i)
510 {
511 h = std::min(
512 h, exp2D->GetGeom2D()->GetEdge(i)->GetVertex(0)->dist(*(
513 exp2D->GetGeom2D()->GetEdge(i)->GetVertex(1))));
514 }
515 break;
516 }
517 case 1:
518 {
520 exp1D = fields[0]->GetExp(e)->as<LocalRegions::Expansion1D>();
521
522 h = std::min(h, exp1D->GetGeom1D()->GetVertex(0)->dist(
523 *(exp1D->GetGeom1D()->GetVertex(1))));
524
525 break;
526 }
527 default:
528 {
529 ASSERTL0(false, "Dimension out of bound.")
530 }
531 }
532
533 // Store h/p scaling
534 m_hOverP[e] = h / std::max(pOrderElmt[e] - 1, 1);
535 }
536}
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:46
std::shared_ptr< Expansion1D > Expansion1DSharedPtr
Definition: Expansion1D.h:50
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:47

References ASSERTL0, Nektar::LocalRegions::Expansion1D::GetGeom1D(), m_hOverP, and Nektar::NullNekDouble1DArray.

Referenced by SetAv().

Member Data Documentation

◆ m_C0ProjectExp

MultiRegions::ContFieldSharedPtr Nektar::VariableConverter::m_C0ProjectExp = nullptr
protected

Definition at line 228 of file VariableConverter.h.

Referenced by ApplyC0Smooth(), and VariableConverter().

◆ m_ducrosSensor

std::string Nektar::VariableConverter::m_ducrosSensor
protected

Definition at line 226 of file VariableConverter.h.

Referenced by SetAv(), and VariableConverter().

◆ m_eos

EquationOfStateSharedPtr Nektar::VariableConverter::m_eos
protected

◆ m_flagCalcDivCurl

bool Nektar::VariableConverter::m_flagCalcDivCurl = false
protected

Definition at line 235 of file VariableConverter.h.

Referenced by GetFlagCalcDivCurl(), and VariableConverter().

◆ m_gasConstant

NekDouble Nektar::VariableConverter::m_gasConstant
protected

Definition at line 214 of file VariableConverter.h.

Referenced by VariableConverter().

◆ m_hOverP

Array<OneD, NekDouble> Nektar::VariableConverter::m_hOverP
protected

h/p scaling

Definition at line 231 of file VariableConverter.h.

Referenced by GetElmtMinHP(), GetMuAv(), SetElmtMinHP(), and VariableConverter().

◆ m_Kappa

NekDouble Nektar::VariableConverter::m_Kappa
protected

Definition at line 217 of file VariableConverter.h.

Referenced by GetSensor(), and VariableConverter().

◆ m_mu

NekDouble Nektar::VariableConverter::m_mu
protected

Definition at line 215 of file VariableConverter.h.

Referenced by GetDynamicViscosity(), and VariableConverter().

◆ m_mu0

NekDouble Nektar::VariableConverter::m_mu0
protected

Shock sensor.

Definition at line 223 of file VariableConverter.h.

Referenced by GetMuAv(), and VariableConverter().

◆ m_muAv

Array<OneD, NekDouble> Nektar::VariableConverter::m_muAv
protected

storage

Definition at line 233 of file VariableConverter.h.

Referenced by GetAv(), SetAv(), and VariableConverter().

◆ m_muAvTrace

Array<OneD, NekDouble> Nektar::VariableConverter::m_muAvTrace
protected

Definition at line 234 of file VariableConverter.h.

Referenced by GetAvTrace(), SetAv(), and VariableConverter().

◆ m_oneOverT_star

NekDouble Nektar::VariableConverter::m_oneOverT_star
protected

Definition at line 218 of file VariableConverter.h.

Referenced by GetDmuDT(), GetDynamicViscosity(), and VariableConverter().

◆ m_pInf

NekDouble Nektar::VariableConverter::m_pInf
protected

Definition at line 212 of file VariableConverter.h.

Referenced by VariableConverter().

◆ m_rhoInf

NekDouble Nektar::VariableConverter::m_rhoInf
protected

Definition at line 213 of file VariableConverter.h.

Referenced by VariableConverter().

◆ m_session

LibUtilities::SessionReaderSharedPtr Nektar::VariableConverter::m_session
protected

Definition at line 209 of file VariableConverter.h.

Referenced by VariableConverter().

◆ m_shockCaptureType

std::string Nektar::VariableConverter::m_shockCaptureType
protected

Definition at line 224 of file VariableConverter.h.

Referenced by VariableConverter().

◆ m_shockSensorType

std::string Nektar::VariableConverter::m_shockSensorType
protected

Definition at line 225 of file VariableConverter.h.

Referenced by SetAv(), and VariableConverter().

◆ m_Skappa

NekDouble Nektar::VariableConverter::m_Skappa
protected

Definition at line 216 of file VariableConverter.h.

Referenced by GetSensor(), and VariableConverter().

◆ m_smoothing

std::string Nektar::VariableConverter::m_smoothing
protected

Definition at line 227 of file VariableConverter.h.

Referenced by SetAv(), and VariableConverter().

◆ m_spacedim

size_t Nektar::VariableConverter::m_spacedim
protected

◆ m_TRatioSutherland

NekDouble Nektar::VariableConverter::m_TRatioSutherland
protected

Definition at line 220 of file VariableConverter.h.

Referenced by GetDmuDT(), GetDynamicViscosity(), and VariableConverter().

◆ m_Tref

NekDouble Nektar::VariableConverter::m_Tref
protected

Definition at line 219 of file VariableConverter.h.

Referenced by VariableConverter().