Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Nektar::NavierStokesCFE Class Reference

#include <NavierStokesCFE.h>

Inheritance diagram for Nektar::NavierStokesCFE:
[legend]

Public Member Functions

virtual ~NavierStokesCFE ()
 
- Public Member Functions inherited from Nektar::CompressibleFlowSystem
virtual ~CompressibleFlowSystem ()
 Destructor for CompressibleFlowSystem class. More...
 
NekDouble GetStabilityLimit (int n)
 Function to calculate the stability limit for DG/CG. More...
 
Array< OneD, NekDoubleGetStabilityLimitVector (const Array< OneD, int > &ExpOrder)
 Function to calculate the stability limit for DG/CG (a vector of them). More...
 
Array< OneD, NekDoubleGetElmtMinHP (void)
 Function to get estimate of min h/p factor per element. More...
 
virtual void GetPressure (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &pressure)
 
virtual void GetDensity (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &density)
 
virtual bool HasConstantDensity ()
 
virtual void GetVelocity (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &velocity)
 
- Public Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT AdvectionSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
virtual SOLVER_UTILS_EXPORT ~AdvectionSystem ()
 
SOLVER_UTILS_EXPORT AdvectionSharedPtr GetAdvObject ()
 Returns the advection object held by this instance. More...
 
SOLVER_UTILS_EXPORT Array< OneD, NekDoubleGetElmtCFLVals (const bool FlagAcousticCFL=true)
 
SOLVER_UTILS_EXPORT NekDouble GetCFLEstimate (int &elmtid)
 
- Public Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
virtual SOLVER_UTILS_EXPORT ~UnsteadySystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray)
 Calculate the larger time-step mantaining the problem stable. More...
 
SOLVER_UTILS_EXPORT void SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
- Public Member Functions inherited from Nektar::SolverUtils::EquationSystem
virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void SetUpTraceNormals (void)
 
SOLVER_UTILS_EXPORT void InitObject ()
 Initialises the members of this object. More...
 
SOLVER_UTILS_EXPORT void DoInitialise ()
 Perform any initialisation necessary before solving the problem. More...
 
SOLVER_UTILS_EXPORT void DoSolve ()
 Solve the problem. More...
 
SOLVER_UTILS_EXPORT void TransCoeffToPhys ()
 Transform from coefficient to physical space. More...
 
SOLVER_UTILS_EXPORT void TransPhysToCoeff ()
 Transform from physical to coefficient space. More...
 
SOLVER_UTILS_EXPORT void Output ()
 Perform output operations after solve. More...
 
SOLVER_UTILS_EXPORT NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation. More...
 
SOLVER_UTILS_EXPORT std::string GetSessionName ()
 Get Session name. More...
 
template<class T >
std::shared_ptr< T > as ()
 
SOLVER_UTILS_EXPORT void ResetSessionName (std::string newname)
 Reset Session name. More...
 
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession ()
 Get Session name. More...
 
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure ()
 Get pressure field if available. More...
 
SOLVER_UTILS_EXPORT void ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
SOLVER_UTILS_EXPORT void PrintSummary (std::ostream &out)
 Print a summary of parameters and solver characteristics. More...
 
SOLVER_UTILS_EXPORT void SetLambda (NekDouble lambda)
 Set parameter m_lambda. More...
 
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction (std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
 Get a SessionFunction by name. More...
 
SOLVER_UTILS_EXPORT void SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Initialise the data in the dependent fields. More...
 
SOLVER_UTILS_EXPORT void EvaluateExactSolution (int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 Evaluates an exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
 Compute the L2 error between fields and a given exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, bool Normalised=false)
 Compute the L2 error of the fields. More...
 
SOLVER_UTILS_EXPORT Array< OneD, NekDoubleErrorExtraPoints (unsigned int field)
 Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf]. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n)
 Write checkpoint file of m_fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write checkpoint file of custom data fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow (const int n)
 Write base flow file of m_fields. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname)
 Write field data to the given filename. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write input fields to the given filename. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
 Input field data from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
 Input field data from the given file to multiple domains. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, std::vector< std::string > &fieldStr, Array< OneD, Array< OneD, NekDouble > > &coeffs)
 Output a field. Input field data into array from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, MultiRegions::ExpListSharedPtr &pField, std::string &pFieldName)
 Output a field. Input field data into ExpList from the given file. More...
 
SOLVER_UTILS_EXPORT void SessionSummary (SummaryList &vSummary)
 Write out a session summary. More...
 
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields ()
 
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMapUpdateFieldMetaDataMap ()
 Get hold of FieldInfoMap so it can be updated. More...
 
SOLVER_UTILS_EXPORT NekDouble GetFinalTime ()
 Return final time. More...
 
SOLVER_UTILS_EXPORT int GetNcoeffs ()
 
SOLVER_UTILS_EXPORT int GetNcoeffs (const int eid)
 
SOLVER_UTILS_EXPORT int GetNumExpModes ()
 
SOLVER_UTILS_EXPORT const Array< OneD, int > GetNumExpModesPerExp ()
 
SOLVER_UTILS_EXPORT int GetNvariables ()
 
SOLVER_UTILS_EXPORT const std::string GetVariable (unsigned int i)
 
SOLVER_UTILS_EXPORT int GetTraceTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTraceNpoints ()
 
SOLVER_UTILS_EXPORT int GetExpSize ()
 
SOLVER_UTILS_EXPORT int GetPhys_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetCoeff_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTotPoints (int n)
 
SOLVER_UTILS_EXPORT int GetNpoints ()
 
SOLVER_UTILS_EXPORT int GetSteps ()
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void CopyFromPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void CopyToPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void SetSteps (const int steps)
 
SOLVER_UTILS_EXPORT void ZeroPhysFields ()
 
SOLVER_UTILS_EXPORT void FwdTransFields ()
 
SOLVER_UTILS_EXPORT void SetModifiedBasis (const bool modbasis)
 
SOLVER_UTILS_EXPORT int GetCheckpointNumber ()
 
SOLVER_UTILS_EXPORT void SetCheckpointNumber (int num)
 
SOLVER_UTILS_EXPORT int GetCheckpointSteps ()
 
SOLVER_UTILS_EXPORT void SetCheckpointSteps (int num)
 
SOLVER_UTILS_EXPORT void SetTime (const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetInitialStep (const int step)
 
SOLVER_UTILS_EXPORT void SetBoundaryConditions (NekDouble time)
 Evaluates the boundary conditions at the given time. More...
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp ()
 Virtual function to identify if operator is negated in DoSolve. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::FluidInterface
virtual ~FluidInterface ()=default
 
virtual SOLVER_UTILS_EXPORT void GetVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)=0
 Extract array with velocity from physfield. More...
 
virtual SOLVER_UTILS_EXPORT void GetDensity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density)=0
 Extract array with density from physfield. More...
 
virtual SOLVER_UTILS_EXPORT void GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)=0
 Extract array with pressure from physfield. More...
 

Static Public Member Functions

static SolverUtils::EquationSystemSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 

Static Public Attributes

static std::string className
 

Protected Member Functions

 NavierStokesCFE (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
void GetViscousFluxVectorConservVar (const int nDim, const Array< OneD, Array< OneD, NekDouble > > &inarray, const TensorOfArray3D< NekDouble > &qfields, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex=NullInt1DArray, const Array< OneD, Array< OneD, NekDouble >> &normal=NullNekDoubleArrayOfArray, const Array< OneD, NekDouble > &ArtifDiffFactor=NullNekDouble1DArray)
 
void GetViscousSymmtrFluxConservVar (const int nSpaceDim, const Array< OneD, Array< OneD, NekDouble > > &inaverg, const Array< OneD, Array< OneD, NekDouble > > &inarray, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex, const Array< OneD, Array< OneD, NekDouble > > &normals)
 Calculate and return the Symmetric flux in IP method. More...
 
void SpecialBndTreat (Array< OneD, Array< OneD, NekDouble > > &consvar)
 For very special treatment. For general boundaries it does nothing But for WallViscous and WallAdiabatic, special treatment is needed because they get the same Bwd value, special treatment is needed for boundary treatment of diffusion flux Note: This special treatment could be removed by seperating WallViscous and WallAdiabatic into two different classes. More...
 
void GetArtificialViscosity (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &muav)
 Calculate and return the ArtificialViscosity for shock-capturing. More...
 
void CalcViscosity (const Array< OneD, const Array< OneD, NekDouble >> &inaverg, Array< OneD, NekDouble > &mu)
 
void InitObject_Explicit ()
 
virtual void v_InitObject ()
 Initialization object for CompressibleFlowSystem class. More...
 
virtual void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables)
 
virtual void v_DoDiffusion (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
 
virtual void v_GetViscousFluxVector (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &derivatives, TensorOfArray3D< NekDouble > &viscousTensor)
 Return the flux vector for the LDG diffusion problem. More...
 
virtual void v_GetViscousFluxVectorDeAlias (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &derivatives, TensorOfArray3D< NekDouble > &viscousTensor)
 Return the flux vector for the LDG diffusion problem. More...
 
void GetPhysicalAV (const Array< OneD, const Array< OneD, NekDouble >> &physfield)
 Calculate the physical artificial viscosity. More...
 
void Ducros (Array< OneD, NekDouble > &field)
 Applied Ducros (anti-vorticity) sensor. More...
 
void C0Smooth (Array< OneD, NekDouble > &field)
 Make field C0. More...
 
virtual void v_GetFluxPenalty (const Array< OneD, const Array< OneD, NekDouble >> &uFwd, const Array< OneD, const Array< OneD, NekDouble >> &uBwd, Array< OneD, Array< OneD, NekDouble >> &penaltyCoeff)
 Return the penalty vector for the LDGNS diffusion problem. More...
 
void GetViscosityAndThermalCondFromTemp (const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &mu, Array< OneD, NekDouble > &thermalCond)
 Update viscosity todo: add artificial viscosity here. More...
 
template<class T , typename = typename std::enable_if < std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value >::type>
void GetViscosityAndThermalCondFromTempKernel (const T &temperature, T &mu, T &thermalCond)
 
template<class T , typename = typename std::enable_if < std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value >::type>
void GetViscosityFromTempKernel (const T &temperature, T &mu)
 
template<class T , typename = typename std::enable_if < std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value >::type>
void GetViscousFluxBilinearFormKernel (const unsigned short nDim, const unsigned short FluxDirection, const unsigned short DerivDirection, const T *inaverg, const T *injumpp, const T &mu, T *outarray)
 Calculate diffusion flux using the Jacobian form. More...
 
template<bool IS_TRACE>
void GetViscousFluxVectorConservVar (const int nDim, const Array< OneD, Array< OneD, NekDouble > > &inarray, const TensorOfArray3D< NekDouble > &qfields, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex, const Array< OneD, Array< OneD, NekDouble > > &normal, const Array< OneD, NekDouble > &ArtifDiffFactor)
 Return the flux vector for the IP diffusion problem, based on conservative variables. More...
 
- Protected Member Functions inherited from Nektar::CompressibleFlowSystem
 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
void InitialiseParameters ()
 Load CFS parameters from the session file. More...
 
void InitAdvection ()
 Create advection and diffusion objects for CFS. More...
 
void DoOdeRhs (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
 Compute the right-hand side. More...
 
void DoOdeProjection (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
 Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection. More...
 
void DoAdvection (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
 Compute the advection terms for the right-hand side. More...
 
void DoDiffusion (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
 Add the diffusions terms to the right-hand side. More...
 
void GetFluxVector (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations. More...
 
void GetFluxVectorDeAlias (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations by using the de-aliasing technique. More...
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
 
void SetBoundaryConditionsBwdWeight ()
 Set up a weight on physical boundaries for boundary condition applications. More...
 
void GetElmtTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, NekDouble > &tstep)
 Calculate the maximum timestep on each element subject to CFL restrictions. More...
 
virtual NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Calculate the maximum timestep subject to CFL restrictions. More...
 
virtual void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Set up logic for residual calculation. More...
 
NekDouble GetGamma ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals ()
 
virtual void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
virtual Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor)
 Compute the advection velocity in the standard space for each element of the expansion. More...
 
virtual void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise ()
 Sets up initial conditions. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s)
 Print a summary of time stepping parameters. More...
 
virtual SOLVER_UTILS_EXPORT void v_AppendOutput1D (Array< OneD, Array< OneD, NekDouble >> &solution1D)
 Print the solution at each solution point in a txt file. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble >> vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
virtual SOLVER_UTILS_EXPORT bool UpdateTimeStepCheck ()
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys ()
 Virtual function for transformation to physical space. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space. More...
 
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure (void)
 

Protected Attributes

std::string m_ViscosityType
 
bool m_is_mu_variable {false}
 flag to switch between constant viscosity and Sutherland an enum could be added for more options More...
 
bool m_is_diffIP {false}
 flag to switch between IP and LDG an enum could be added for more options More...
 
NekDouble m_Cp
 
NekDouble m_Cv
 
NekDouble m_Prandtl
 
NekDouble m_mu0
 
std::string m_physicalSensorType
 
std::string m_smoothing
 
MultiRegions::ContFieldSharedPtr m_C0ProjectExp
 
EquationOfStateSharedPtr m_eos
 Equation of system for computing temperature. More...
 
NekDouble m_Twall
 
NekDouble m_muRef
 
NekDouble m_thermalConductivityRef
 
Array< OneD, NekDoublem_mu
 
Array< OneD, NekDoublem_thermalConductivity
 
- Protected Attributes inherited from Nektar::CompressibleFlowSystem
SolverUtils::DiffusionSharedPtr m_diffusion
 
ArtificialDiffusionSharedPtr m_artificialDiffusion
 
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
 
NekDouble m_gamma
 
std::string m_shockCaptureType
 
NekDouble m_filterAlpha
 
NekDouble m_filterExponent
 
NekDouble m_filterCutoff
 
bool m_useFiltering
 
bool m_useLocalTimeStep
 
Array< OneD, NekDoublem_muav
 
Array< OneD, NekDoublem_muavTrace
 
VariableConverterSharedPtr m_varConv
 
std::vector< CFSBndCondSharedPtrm_bndConds
 
NekDouble m_bndEvaluateTime
 
std::vector< SolverUtils::ForcingSharedPtrm_forcing
 
- Protected Attributes inherited from Nektar::SolverUtils::AdvectionSystem
SolverUtils::AdvectionSharedPtr m_advObject
 Advection term. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::UnsteadySystem
int m_infosteps
 Number of time steps between outputting status information. More...
 
int m_abortSteps
 Number of steps between checks for abort conditions. More...
 
int m_filtersInfosteps
 Number of time steps between outputting filters information. More...
 
int m_nanSteps
 
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
NekDouble m_epsilon
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used. More...
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used. More...
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used. More...
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateRes = 1.0
 
NekDouble m_steadyStateRes0 = 1.0
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::ofstream m_errFile
 
std::vector< int > m_intVariables
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
NekDouble m_filterTimeWarning
 Number of time steps between outputting status information. More...
 
NekDouble m_TimeIntegLambda =0.0
 coefff of spacial derivatives(rhs or m_F in GLM) in calculating the residual of the whole equation(used in unsteady time integrations) More...
 
bool m_flagImplicitItsStatistics
 
bool m_flagImplicitSolver = false
 
Array< OneD, NekDoublem_magnitdEstimat
 estimate the magnitude of each conserved varibles More...
 
Array< OneD, NekDoublem_locTimeStep
 local time step(notice only for jfnk other see m_cflSafetyFactor) More...
 
NekDouble m_inArrayNorm =-1.0
 
int m_TotLinItePerStep =0
 
int m_StagesPerStep =1
 
bool m_flagUpdatePreconMat
 
int m_maxLinItePerNewton
 
int m_TotNewtonIts =0
 
int m_TotLinIts =0
 
int m_TotImpStages =0
 
bool m_CalcPhysicalAV = true
 flag to update artificial viscosity More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
bool m_verbose
 
bool m_root
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_timestepMax = -1.0
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
NekDouble m_checktime
 Time between checkpoints. More...
 
NekDouble m_lastCheckTime
 
NekDouble m_TimeIncrementFactor
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

Friends

class MemoryManager< NavierStokesCFE >
 

Additional Inherited Members

- Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1). More...
 
NekDouble m_cflNonAcoustic
 
NekDouble m_CFLGrowth
 CFL growth rate. More...
 
NekDouble m_CFLEnd
 maximun cfl in cfl growth More...
 
- Protected Types inherited from Nektar::SolverUtils::EquationSystem
enum  HomogeneousType { eHomogeneous1D , eHomogeneous2D , eHomogeneous3D , eNotHomogeneous }
 Parameter for homogeneous expansions. More...
 
- Static Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
static std::string equationSystemTypeLookupIds []
 

Detailed Description

Definition at line 49 of file NavierStokesCFE.h.

Constructor & Destructor Documentation

◆ ~NavierStokesCFE()

Nektar::NavierStokesCFE::~NavierStokesCFE ( )
virtual

Definition at line 54 of file NavierStokesCFE.cpp.

55  {
56 
57  }

◆ NavierStokesCFE()

Nektar::NavierStokesCFE::NavierStokesCFE ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr pGraph 
)
protected

Definition at line 46 of file NavierStokesCFE.cpp.

49  : UnsteadySystem(pSession, pGraph),
50  CompressibleFlowSystem(pSession, pGraph)
51  {
52  }
CompressibleFlowSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.

Member Function Documentation

◆ C0Smooth()

void Nektar::NavierStokesCFE::C0Smooth ( Array< OneD, NekDouble > &  field)
protected

Make field C0.

Parameters
fieldInput Field

Definition at line 893 of file NavierStokesCFE.cpp.

894  {
895  int nCoeffs = m_C0ProjectExp->GetNcoeffs();
896  Array<OneD, NekDouble> muFwd(nCoeffs);
897  Array<OneD, NekDouble> weights(nCoeffs, 1.0);
898  // Assemble global expansion coefficients for viscosity
899  m_C0ProjectExp->FwdTrans_IterPerExp(field,
900  m_C0ProjectExp->UpdateCoeffs());
901  m_C0ProjectExp->Assemble();
902  Vmath::Vcopy(nCoeffs, m_C0ProjectExp->GetCoeffs(), 1, muFwd, 1);
903  // Global coefficients
904  Vmath::Vcopy(nCoeffs, weights, 1,
905  m_C0ProjectExp->UpdateCoeffs(), 1);
906  // This is the sign vector
907  m_C0ProjectExp->GlobalToLocal();
908  // Get weights
909  m_C0ProjectExp->Assemble();
910  // Divide
911  Vmath::Vdiv(nCoeffs, muFwd, 1, m_C0ProjectExp->GetCoeffs(), 1,
912  m_C0ProjectExp->UpdateCoeffs(), 1);
913  // Get local coefficients
914  m_C0ProjectExp->GlobalToLocal();
915  // Get C0 field
916  m_C0ProjectExp->BwdTrans_IterPerExp(
917  m_C0ProjectExp->GetCoeffs(), field);
918  }
MultiRegions::ContFieldSharedPtr m_C0ProjectExp
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.cpp:257
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199

References m_C0ProjectExp, Vmath::Vcopy(), and Vmath::Vdiv().

Referenced by v_GetViscousFluxVector(), and v_GetViscousFluxVectorDeAlias().

◆ CalcViscosity()

void Nektar::NavierStokesCFE::CalcViscosity ( const Array< OneD, const Array< OneD, NekDouble >> &  inaverg,
Array< OneD, NekDouble > &  mu 
)
protected

Definition at line 869 of file NavierStokesCFE.cpp.

872  {
873  int nConvectiveFields = inaverg.size();
874  int nPts = inaverg[nConvectiveFields-1].size();
875 
876  if (m_ViscosityType == "Variable")
877  {
878  Array<OneD, NekDouble> tmp(nPts,0.0);
879  m_varConv->GetTemperature(inaverg,tmp);
880  m_varConv->GetDynamicViscosity(tmp, mu);
881  }
882  else
883  {
884  //mu may be on volume or trace
885  Vmath::Fill(nPts, m_mu[0], mu, 1);
886  }
887  }
VariableConverterSharedPtr m_varConv
Array< OneD, NekDouble > m_mu
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45

References Vmath::Fill(), m_mu, Nektar::CompressibleFlowSystem::m_varConv, and m_ViscosityType.

Referenced by InitObject_Explicit().

◆ create()

static SolverUtils::EquationSystemSharedPtr Nektar::NavierStokesCFE::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr pGraph 
)
inlinestatic

Definition at line 55 of file NavierStokesCFE.h.

58  {
61  p->InitObject();
62  return p;
63  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

◆ Ducros()

void Nektar::NavierStokesCFE::Ducros ( Array< OneD, NekDouble > &  field)
protected

Applied Ducros (anti-vorticity) sensor.

Parameters
fieldInput Field

Definition at line 925 of file NavierStokesCFE.cpp.

926  {
927  int nPts = m_fields[0]->GetTotPoints();
929  Array<OneD, NekDouble> ducros(nPts, 0.0);
930  Vmath::Vadd(nPts, denDuc, 1, m_diffusion->m_divVelSquare, 1,
931  denDuc, 1);
932  Vmath::Vadd(nPts, denDuc, 1, m_diffusion->m_curlVelSquare, 1,
933  denDuc, 1);
934  Vmath::Vdiv(nPts, m_diffusion->m_divVelSquare, 1, denDuc, 1,
935  ducros, 1);
936  // Average in cell
938  for (int e = 0; e < m_fields[0]->GetExpSize(); e++)
939  {
940  int nElmtPoints = m_fields[0]->GetExp(e)->GetTotPoints();
941  int physOffset = m_fields[0]->GetPhys_Offset(e);
942 
943  NekDouble eAve = Vmath::Vsum(nElmtPoints,
944  tmp = ducros + physOffset, 1);
945  eAve = eAve / nElmtPoints;
946  Vmath::Fill(nElmtPoints, eAve, tmp = ducros + physOffset, 1);
947  }
948  Vmath::Vmul(nPts, ducros, 1, field, 1, field, 1);
949  }
SolverUtils::DiffusionSharedPtr m_diffusion
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
static const NekDouble kNekZeroTol
double NekDouble
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.cpp:192
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
Definition: Vmath.cpp:846
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.cpp:322

References Vmath::Fill(), Nektar::NekConstants::kNekZeroTol, Nektar::CompressibleFlowSystem::m_diffusion, Nektar::SolverUtils::EquationSystem::m_fields, Vmath::Vadd(), Vmath::Vdiv(), Vmath::Vmul(), and Vmath::Vsum().

Referenced by v_ExtraFldOutput(), v_GetViscousFluxVector(), and v_GetViscousFluxVectorDeAlias().

◆ GetArtificialViscosity()

void Nektar::NavierStokesCFE::GetArtificialViscosity ( const Array< OneD, Array< OneD, NekDouble > > &  inarray,
Array< OneD, NekDouble > &  muav 
)
protected

Calculate and return the ArtificialViscosity for shock-capturing.

Definition at line 760 of file NavierStokesCFE.cpp.

763  {
764  m_artificialDiffusion->GetArtificialViscosity(inarray, muav);
765  }
ArtificialDiffusionSharedPtr m_artificialDiffusion

References Nektar::CompressibleFlowSystem::m_artificialDiffusion.

Referenced by InitObject_Explicit().

◆ GetPhysicalAV()

void Nektar::NavierStokesCFE::GetPhysicalAV ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield)
protected

Calculate the physical artificial viscosity.

Parameters
physfieldInput field.

Definition at line 825 of file NavierStokesCFE.cpp.

827  {
828  int nPts = physfield[0].size();
829  int nElements = m_fields[0]->GetExpSize();
830  Array <OneD, NekDouble > hOverP(nElements, 0.0);
831  hOverP = GetElmtMinHP();
832 
833  // Determine the maximum wavespeed
834  Array <OneD, NekDouble > Lambdas(nPts, 0.0);
835  Array <OneD, NekDouble > soundspeed(nPts, 0.0);
836  Array <OneD, NekDouble > absVelocity(nPts, 0.0);
837  m_varConv->GetSoundSpeed(physfield, soundspeed);
838  m_varConv->GetAbsoluteVelocity(physfield, absVelocity);
839 
840  Vmath::Vadd(nPts, absVelocity, 1, soundspeed, 1, Lambdas, 1);
841 
842  // Compute sensor based on rho
843  Array<OneD, NekDouble> Sensor(nPts, 0.0);
844  m_varConv->GetSensor(m_fields[0], physfield, Sensor, m_muav, 1);
845 
847  for (int e = 0; e < nElements; e++)
848  {
849  int physOffset = m_fields[0]->GetPhys_Offset(e);
850  int nElmtPoints = m_fields[0]->GetExp(e)->GetTotPoints();
851 
852  // Compute the maximum wave speed
853  NekDouble LambdaElmt = Vmath::Vmax(nElmtPoints, tmp = Lambdas
854  + physOffset, 1);
855 
856  // Compute average bounded density
857  NekDouble rhoAve = Vmath::Vsum(nElmtPoints, tmp = physfield[0]
858  + physOffset, 1);
859  rhoAve = rhoAve / nElmtPoints;
860  rhoAve = Smath::Smax(rhoAve , 1.0e-4, 1.0e+4);
861 
862  // Scale sensor by coeff, h/p, and density
863  LambdaElmt *= m_mu0 * hOverP[e] * rhoAve;
864  Vmath::Smul(nElmtPoints, LambdaElmt, tmp = m_muav + physOffset, 1,
865  tmp = m_muav + physOffset, 1);
866  }
867  }
Array< OneD, NekDouble > GetElmtMinHP(void)
Function to get estimate of min h/p factor per element.
T Smax(const T a, const T b, const T k)
Return the soft max of between two scalars.
Definition: Smath.hpp:53
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.cpp:225
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.cpp:892

References Nektar::CompressibleFlowSystem::GetElmtMinHP(), Nektar::SolverUtils::EquationSystem::m_fields, m_mu0, Nektar::CompressibleFlowSystem::m_muav, Nektar::CompressibleFlowSystem::m_varConv, Smath::Smax(), Vmath::Smul(), Vmath::Vadd(), Vmath::Vmax(), and Vmath::Vsum().

Referenced by v_DoDiffusion(), and Nektar::NavierStokesImplicitCFE::v_DoDiffusionCoeff().

◆ GetViscosityAndThermalCondFromTemp()

void Nektar::NavierStokesCFE::GetViscosityAndThermalCondFromTemp ( const Array< OneD, NekDouble > &  temperature,
Array< OneD, NekDouble > &  mu,
Array< OneD, NekDouble > &  thermalCond 
)
protected

Update viscosity todo: add artificial viscosity here.

Definition at line 998 of file NavierStokesCFE.cpp.

1002  {
1003  int nPts = temperature.size();
1004 
1005  for (size_t p = 0; p < nPts; ++p)
1006  {
1007  GetViscosityAndThermalCondFromTempKernel(temperature[p], mu[p],
1008  thermalCond[p]);
1009  }
1010  }
void GetViscosityAndThermalCondFromTempKernel(const T &temperature, T &mu, T &thermalCond)

References GetViscosityAndThermalCondFromTempKernel(), and CellMLToNektar.cellml_metadata::p.

Referenced by v_GetFluxPenalty(), v_GetViscousFluxVector(), Nektar::NavierStokesCFEAxisym::v_GetViscousFluxVector(), and v_GetViscousFluxVectorDeAlias().

◆ GetViscosityAndThermalCondFromTempKernel()

template<class T , typename = typename std::enable_if < std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value >::type>
void Nektar::NavierStokesCFE::GetViscosityAndThermalCondFromTempKernel ( const T &  temperature,
T &  mu,
T &  thermalCond 
)
inlineprotected

Definition at line 175 of file NavierStokesCFE.h.

177  {
178  GetViscosityFromTempKernel(temperature, mu);
179  NekDouble tRa = m_Cp / m_Prandtl;
180  thermalCond = tRa * mu;
181  }
void GetViscosityFromTempKernel(const T &temperature, T &mu)

References GetViscosityFromTempKernel(), m_Cp, and m_Prandtl.

Referenced by GetViscosityAndThermalCondFromTemp().

◆ GetViscosityFromTempKernel()

template<class T , typename = typename std::enable_if < std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value >::type>
void Nektar::NavierStokesCFE::GetViscosityFromTempKernel ( const T &  temperature,
T &  mu 
)
inlineprotected

Definition at line 189 of file NavierStokesCFE.h.

191  {
192  // Variable viscosity through the Sutherland's law
193  if (m_is_mu_variable)
194  {
195  mu = m_varConv->GetDynamicViscosity(temperature);
196  }
197  else
198  {
199  mu = m_muRef;
200  }
201  }
bool m_is_mu_variable
flag to switch between constant viscosity and Sutherland an enum could be added for more options

References m_is_mu_variable, m_muRef, and Nektar::CompressibleFlowSystem::m_varConv.

Referenced by GetViscosityAndThermalCondFromTempKernel(), GetViscousFluxVectorConservVar(), and GetViscousSymmtrFluxConservVar().

◆ GetViscousFluxBilinearFormKernel()

template<class T , typename = typename std::enable_if < std::is_floating_point<T>::value || tinysimd::is_vector_floating_point<T>::value >::type>
void Nektar::NavierStokesCFE::GetViscousFluxBilinearFormKernel ( const unsigned short  nDim,
const unsigned short  FluxDirection,
const unsigned short  DerivDirection,
const T *  inaverg,
const T *  injumpp,
const T &  mu,
T *  outarray 
)
inlineprotected

Calculate diffusion flux using the Jacobian form.

Parameters
in
outoutarray[nvars] flux

Definition at line 217 of file NavierStokesCFE.h.

226  {
227  // Constants
228  unsigned short nDim_plus_one = nDim + 1;
229  unsigned short FluxDirection_plus_one = FluxDirection + 1;
230  unsigned short DerivDirection_plus_one = DerivDirection + 1;
231 
232  NekDouble gammaoPr = m_gamma / m_Prandtl;
233  NekDouble one_minus_gammaoPr = 1.0 - gammaoPr;
234 
235  constexpr NekDouble OneThird = 1. / 3.;
236  constexpr NekDouble TwoThird = 2. * OneThird;
237  constexpr NekDouble FourThird = 4. * OneThird;
238 
239 
240  if (DerivDirection == FluxDirection)
241  {
242  // rho flux always zero
243  outarray[0] = 0.0; // store 1x
244 
245  // load 1/rho
246  T oneOrho = 1.0 / inaverg[0]; // load 1x
247  // get vel, vel^2, sum of vel^2
248  std::array<T, 3> u = {{0.0, 0.0, 0.0}};
249  std::array<T, 3> u2 = {{0.0, 0.0, 0.0}};
250  T u2sum{};
251  for (unsigned short d = 0; d < nDim; ++d)
252  {
253  u[d] = inaverg[d+1] * oneOrho; // load 1x
254  u2[d] = u[d]*u[d];
255  u2sum += u2[d];
256  }
257 
258  // get E - sum v^2
259  T E_minus_u2sum = inaverg[nDim_plus_one]; // load 1x
260  E_minus_u2sum *= oneOrho;
261  E_minus_u2sum -= u2sum;
262 
263  // get nu = mu/rho
264  T nu = mu * oneOrho; // load 1x
265 
266  // ^^^^ above is almost the same for both loops
267 
268  T tmp1 = OneThird * u2[FluxDirection] + u2sum;
269  tmp1 += gammaoPr * E_minus_u2sum;
270  tmp1 *= injumpp[0]; //load 1x
271 
272  T tmp2 = gammaoPr * injumpp[nDim_plus_one] - tmp1; //load 1x
273 
274  // local var for energy output
275  T outTmpE = 0.0;
276  for (unsigned short d = 0; d < nDim; ++d)
277  {
278  unsigned short d_plus_one = d + 1;
279  //flux[rhou, rhov, rhow]
280  T outTmpD = injumpp[d_plus_one] - u[d] * injumpp[0];
281  outTmpD *= nu;
282  //flux rhoE
283  T tmp3 = one_minus_gammaoPr * u[d];
284  outTmpE += tmp3 * injumpp[d_plus_one];
285 
286  if (d == FluxDirection)
287  {
288  outTmpD *= FourThird;
289  T tmp4 = OneThird * u[FluxDirection];
290  outTmpE += tmp4 * injumpp[FluxDirection_plus_one];
291  }
292 
293  outarray[d_plus_one] = outTmpD; //store 1x
294  }
295 
296  outTmpE += tmp2;
297  outTmpE *= nu;
298  outarray[nDim_plus_one] = outTmpE; //store 1x
299 
300  }
301  else
302  {
303  // rho flux always zero
304  outarray[0] = 0.0; // store 1x
305 
306  // load 1/rho
307  T oneOrho = 1.0 / inaverg[0]; // load 1x
308  // get vel, vel^2, sum of vel^2
309  std::array<T, 3> u, u2;
310  T u2sum{};
311  for (unsigned short d = 0; d < nDim; ++d)
312  {
313  unsigned short d_plus_one = d + 1;
314  u[d] = inaverg[d_plus_one] * oneOrho; // load 1x
315  u2[d] = u[d]*u[d];
316  u2sum += u2[d];
317  // Not all directions are set
318  // one could work out the one that is not set
319  outarray[d_plus_one] = 0.0; // store 1x
320  }
321 
322  // get E - sum v^2
323  T E_minus_u2sum = inaverg[nDim_plus_one]; // load 1x
324  E_minus_u2sum *= oneOrho;
325  E_minus_u2sum -= u2sum;
326 
327  // get nu = mu/rho
328  T nu = mu * oneOrho; // load 1x
329 
330  // ^^^^ above is almost the same for both loops
331 
332  T tmp1 = u[DerivDirection] * injumpp[0] -
333  injumpp[DerivDirection_plus_one]; // load 2x
334  tmp1 *= TwoThird;
335  outarray[FluxDirection_plus_one] = nu * tmp1; // store 1x
336 
337  tmp1 = injumpp[FluxDirection_plus_one] - u[FluxDirection] * injumpp[0];
338  outarray[DerivDirection_plus_one] = nu * tmp1; // store 1x
339 
340  tmp1 = OneThird * u[FluxDirection] * u[DerivDirection];
341  tmp1 *= injumpp[0];
342 
343  T tmp2 = TwoThird * u[FluxDirection] *
344  injumpp[DerivDirection_plus_one];
345 
346  tmp1 += tmp2;
347 
348  tmp1 = u[DerivDirection] * injumpp[FluxDirection_plus_one] -
349  tmp1;
350  outarray[nDim_plus_one] = nu * tmp1; // store 1x
351 
352  }
353  }

References Nektar::CompressibleFlowSystem::m_gamma, and m_Prandtl.

Referenced by GetViscousFluxVectorConservVar(), and GetViscousSymmtrFluxConservVar().

◆ GetViscousFluxVectorConservVar() [1/2]

template<bool IS_TRACE>
void Nektar::NavierStokesCFE::GetViscousFluxVectorConservVar ( const int  nDim,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
const TensorOfArray3D< NekDouble > &  qfields,
TensorOfArray3D< NekDouble > &  outarray,
Array< OneD, int > &  nonZeroIndex,
const Array< OneD, Array< OneD, NekDouble > > &  normal,
const Array< OneD, NekDouble > &  ArtifDiffFactor 
)
inlineprotected

Return the flux vector for the IP diffusion problem, based on conservative variables.

Definition at line 362 of file NavierStokesCFE.h.

370  {
371  size_t nConvectiveFields = inarray.size();
372  size_t nPts = inarray[0].size();
373  size_t n_nonZero = nConvectiveFields - 1;
374 
375  // max outfield dimensions
376  constexpr unsigned short nOutMax = 3 - 2 * IS_TRACE;
377  constexpr unsigned short nVarMax = 5;
378  constexpr unsigned short nDimMax = 3;
379 
380  // vector loop
381  using namespace tinysimd;
382  using vec_t = simd<NekDouble>;
383  size_t sizeVec = (nPts / vec_t::width) * vec_t::width;
384  size_t p = 0;
385 
386  for (; p < sizeVec; p += vec_t::width)
387  {
388  // there is a significant penalty to use std::vector
389  alignas(vec_t::alignment) std::array<vec_t, nVarMax> inTmp,
390  qfieldsTmp, outTmp;
391  alignas(vec_t::alignment) std::array<vec_t, nDimMax> normalTmp;
392  alignas(vec_t::alignment) std::array<vec_t, nVarMax * nOutMax>
393  outArrTmp{{}};
394 
395  // rearrenge and load data
396  for (size_t f = 0; f < nConvectiveFields; ++f)
397  {
398  inTmp[f].load(&(inarray[f][p]), is_not_aligned);
399  // zero output vector
400  if (IS_TRACE)
401  {
402  outArrTmp[f] = 0.0;
403  }
404  else
405  {
406  for (int d = 0; d < nDim; ++d)
407  {
408  outArrTmp[f + nConvectiveFields * d] = 0.0;
409  }
410  }
411  }
412  if (IS_TRACE)
413  {
414  for (size_t d = 0; d < nDim; ++d)
415  {
416  normalTmp[d].load(&(normal[d][p]), is_not_aligned);
417  }
418  }
419 
420  // get temp
421  vec_t temperature = m_varConv->GetTemperature(inTmp.data());
422  // get viscosity
423  vec_t mu;
424  GetViscosityFromTempKernel(temperature, mu);
425 
426  for (size_t nderiv = 0; nderiv < nDim; ++nderiv)
427  {
428  // rearrenge and load data
429  for (size_t f = 0; f < nConvectiveFields; ++f)
430  {
431  qfieldsTmp[f].load(&(qfields[nderiv][f][p]), is_not_aligned);
432  }
433 
434  for (size_t d = 0; d < nDim; ++d)
435  {
436  GetViscousFluxBilinearFormKernel(nDim, d, nderiv,
437  inTmp.data(), qfieldsTmp.data(), mu, outTmp.data());
438 
439  if (IS_TRACE)
440  {
441  for (size_t f = 0; f < nConvectiveFields; ++f)
442  {
443  outArrTmp[f] += normalTmp[d] * outTmp[f];
444  }
445  }
446  else
447  {
448  for (size_t f = 0; f < nConvectiveFields; ++f)
449  {
450  outArrTmp[f + nConvectiveFields * d] += outTmp[f];
451  }
452  }
453  }
454  }
455 
456  // store data
457  if (IS_TRACE)
458  {
459  for (int f = 0; f < nConvectiveFields; ++f)
460  {
461  outArrTmp[f].store(&(outarray[0][f][p]), is_not_aligned);
462  }
463  }
464  else
465  {
466  for (int d = 0; d < nDim; ++d)
467  {
468  for (int f = 0; f < nConvectiveFields; ++f)
469  {
470  outArrTmp[f + nConvectiveFields * d].store(
471  &(outarray[d][f][p]), is_not_aligned);
472  }
473  }
474  }
475  }
476 
477  // scalar loop
478  for (; p < nPts; ++p)
479  {
480  std::array<NekDouble, nVarMax> inTmp, qfieldsTmp, outTmp;
481  std::array<NekDouble, nDimMax> normalTmp;
482  std::array<NekDouble, nVarMax * nOutMax> outArrTmp{{}};
483  // rearrenge and load data
484  for (int f = 0; f < nConvectiveFields; ++f)
485  {
486  inTmp[f] = inarray[f][p];
487  // zero output vector
488  if (IS_TRACE)
489  {
490  outArrTmp[f] = 0.0;
491  }
492  else
493  {
494  for (int d = 0; d < nDim; ++d)
495  {
496  outArrTmp[f + nConvectiveFields * d] = 0.0;
497  }
498  }
499  }
500 
501 
502  if (IS_TRACE)
503  {
504  for (int d = 0; d < nDim; ++d)
505  {
506  normalTmp[d] = normal[d][p];
507  }
508  }
509 
510  // get temp
511  NekDouble temperature = m_varConv->GetTemperature(inTmp.data());
512  // get viscosity
513  NekDouble mu;
514  GetViscosityFromTempKernel(temperature, mu);
515 
516  for (int nderiv = 0; nderiv < nDim; ++nderiv)
517  {
518  // rearrenge and load data
519  for (int f = 0; f < nConvectiveFields; ++f)
520  {
521  qfieldsTmp[f] = qfields[nderiv][f][p];
522  }
523 
524  for (int d = 0; d < nDim; ++d)
525  {
526  GetViscousFluxBilinearFormKernel(nDim, d, nderiv,
527  inTmp.data(), qfieldsTmp.data(), mu, outTmp.data());
528 
529  if (IS_TRACE)
530  {
531  for (size_t f = 0; f < nConvectiveFields; ++f)
532  {
533  outArrTmp[f] += normalTmp[d] * outTmp[f];
534  }
535  }
536  else
537  {
538  for (size_t f = 0; f < nConvectiveFields; ++f)
539  {
540  outArrTmp[f + nConvectiveFields * d] += outTmp[f];
541  }
542  }
543 
544  }
545  }
546 
547  // store data
548  if (IS_TRACE)
549  {
550  for (int f = 0; f < nConvectiveFields; ++f)
551  {
552  outarray[0][f][p] = outArrTmp[f];
553  }
554  }
555  else
556  {
557  for (int d = 0; d < nDim; ++d)
558  {
559  for (int f = 0; f < nConvectiveFields; ++f)
560  {
561  outarray[d][f][p] = outArrTmp[f + nConvectiveFields * d];
562  }
563  }
564  }
565  }
566 
567 
568  // this loop would need to be brought up into the main loop so that it
569  // can be vectorized as well
570  if (ArtifDiffFactor.size())
571  {
572  n_nonZero = nConvectiveFields;
573 
574  for (size_t p = 0; p < nPts; ++p)
575  {
576  for (int d = 0; d < nDim; ++d)
577  {
578  if (IS_TRACE)
579  {
580  NekDouble tmp = ArtifDiffFactor[p] * normal[d][p];
581 
582  for (int j = 0; j < nConvectiveFields; ++j)
583  {
584  outarray[0][j][p] += tmp * qfields[d][j][p];
585  }
586  }
587  else
588  {
589  for (int j = 0; j < nConvectiveFields; ++j)
590  {
591  outarray[d][j][p] += ArtifDiffFactor[p] * qfields[d][j][p];
592  }
593  }
594  }
595  }
596  }
597 
598  // this is always the same, it should be initialized with the IP class
599  nonZeroIndex = Array< OneD, int > {n_nonZero, 0};
600  for (int i = 1; i < n_nonZero + 1; ++i)
601  {
602  nonZeroIndex[n_nonZero - i] = nConvectiveFields - i;
603  }
604  }
void GetViscousFluxBilinearFormKernel(const unsigned short nDim, const unsigned short FluxDirection, const unsigned short DerivDirection, const T *inaverg, const T *injumpp, const T &mu, T *outarray)
Calculate diffusion flux using the Jacobian form.
tinysimd::simd< NekDouble > vec_t
static constexpr struct tinysimd::is_not_aligned_t is_not_aligned
typename abi< ScalarType >::type simd
Definition: tinysimd.hpp:83

References GetViscosityFromTempKernel(), GetViscousFluxBilinearFormKernel(), tinysimd::is_not_aligned, Nektar::CompressibleFlowSystem::m_varConv, and CellMLToNektar.cellml_metadata::p.

◆ GetViscousFluxVectorConservVar() [2/2]

void Nektar::NavierStokesCFE::GetViscousFluxVectorConservVar ( const int  nDim,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
const TensorOfArray3D< NekDouble > &  qfields,
TensorOfArray3D< NekDouble > &  outarray,
Array< OneD, int > &  nonZeroIndex = NullInt1DArray,
const Array< OneD, Array< OneD, NekDouble >> &  normal = NullNekDoubleArrayOfArray,
const Array< OneD, NekDouble > &  ArtifDiffFactor = NullNekDouble1DArray 
)
protected

◆ GetViscousSymmtrFluxConservVar()

void Nektar::NavierStokesCFE::GetViscousSymmtrFluxConservVar ( const int  nSpaceDim,
const Array< OneD, Array< OneD, NekDouble > > &  inaverg,
const Array< OneD, Array< OneD, NekDouble > > &  inarray,
TensorOfArray3D< NekDouble > &  outarray,
Array< OneD, int > &  nonZeroIndex,
const Array< OneD, Array< OneD, NekDouble > > &  normals 
)
protected

Calculate and return the Symmetric flux in IP method.

Definition at line 770 of file NavierStokesCFE.cpp.

777  {
778  size_t nConvectiveFields = inarray.size();
779  size_t nPts = inaverg[nConvectiveFields - 1].size();
780  nonZeroIndex = Array<OneD, int>{nConvectiveFields - 1, 0};
781  for (int i = 0; i < nConvectiveFields - 1; ++i)
782  {
783  nonZeroIndex[i] = i + 1;
784  }
785 
786  std::vector<NekDouble> inAvgTmp(nConvectiveFields);
787  std::vector<NekDouble> inTmp(nConvectiveFields);
788  std::vector<NekDouble> outTmp(nConvectiveFields);
789  for (int d = 0; d < nDim; ++d)
790  {
791  for (int nderiv = 0; nderiv < nDim; ++nderiv)
792  {
793  for (size_t p = 0; p < nPts; ++p)
794  {
795  // rearrenge data
796  for (int f = 0; f < nConvectiveFields; ++f)
797  {
798  inAvgTmp[f] = inaverg[f][p];
799  inTmp[f] = inarray[f][p];
800  }
801 
802  // get temp
803  NekDouble temperature = m_varConv->GetTemperature(inTmp.data());
804  // get viscosity
805  NekDouble mu;
806  GetViscosityFromTempKernel(temperature, mu);
807 
808  GetViscousFluxBilinearFormKernel(nDim, d, nderiv,
809  inAvgTmp.data(), inTmp.data(), mu, outTmp.data());
810 
811  for (int f = 0; f < nConvectiveFields; ++f)
812  {
813  outarray[d][f][p] += normal[d][p] * outTmp[f];
814  }
815  }
816  }
817  }
818  }

References GetViscosityFromTempKernel(), GetViscousFluxBilinearFormKernel(), Nektar::CompressibleFlowSystem::m_varConv, and CellMLToNektar.cellml_metadata::p.

Referenced by InitObject_Explicit().

◆ InitObject_Explicit()

void Nektar::NavierStokesCFE::InitObject_Explicit ( )
protected

Definition at line 71 of file NavierStokesCFE.cpp.

72  {
73  // Get gas constant from session file and compute Cp
74  NekDouble gasConstant;
75  m_session->LoadParameter ("GasConstant", gasConstant, 287.058);
76  m_Cp = m_gamma / (m_gamma - 1.0) * gasConstant;
77  m_Cv = m_Cp / m_gamma;
78 
79  m_session->LoadParameter ("Twall", m_Twall, 300.15);
80 
81  // Viscosity
82  int nPts = m_fields[0]->GetNpoints();
83  m_session->LoadSolverInfo("ViscosityType", m_ViscosityType, "Constant");
84  m_session->LoadParameter ("mu", m_muRef, 1.78e-05);
86  if (m_ViscosityType == "Variable")
87  {
88  m_is_mu_variable = true;
89  }
90 
91  // Thermal conductivity or Prandtl
92  if ( m_session->DefinesParameter("thermalConductivity"))
93  {
94  ASSERTL0( !m_session->DefinesParameter("Pr"),
95  "Cannot define both Pr and thermalConductivity.");
96 
97  m_session->LoadParameter ("thermalConductivity",
100  }
101  else
102  {
103  m_session->LoadParameter ("Pr", m_Prandtl, 0.72);
105  }
108 
109  // Artificial viscosity parameter
110  m_session->LoadParameter("mu0", m_mu0, 1.0);
111 
112  // load smoothing tipe
113  m_session->LoadSolverInfo("Smoothing", m_smoothing, "Off");
114  if (m_smoothing == "C0")
115  {
118  }
119  // load physical sensor type
120  m_session->LoadSolverInfo("PhysicalSensorType", m_physicalSensorType,
121  "Off");
122 
123  string diffName;
124  m_session->LoadSolverInfo("DiffusionType", diffName, "LDGNS");
125 
127  .CreateInstance(diffName, diffName);
128  if ("InteriorPenalty" == diffName)
129  {
130  m_is_diffIP = true;
132  }
133 
134  if ("LDGNS" == diffName||
135  "LDGNS3DHomogeneous1D" == diffName)
136  {
137  m_diffusion->SetFluxPenaltyNS(&NavierStokesCFE::
138  v_GetFluxPenalty, this);
139  }
140 
142  {
143  m_diffusion->SetFluxVectorNS(
145  this);
146  }
147  else
148  {
149  m_diffusion->SetFluxVectorNS(&NavierStokesCFE::
150  v_GetViscousFluxVector, this);
151  }
152 
153  m_diffusion->SetDiffusionFluxCons(
154  &NavierStokesCFE::GetViscousFluxVectorConservVar<false>, this);
155 
156  m_diffusion->SetDiffusionFluxConsTrace(
157  &NavierStokesCFE::GetViscousFluxVectorConservVar<true>, this);
158 
159  m_diffusion->SetSpecialBndTreat(
161 
162  m_diffusion->SetDiffusionSymmFluxCons(
164 
165  if (m_shockCaptureType != "Off")
166  {
167  m_diffusion->SetArtificialDiffusionVector(
169  }
170 
171  m_diffusion->SetCalcViscosity(
173 
174  // Concluding initialisation of diffusion operator
175  m_diffusion->InitObject (m_session, m_fields);
176 
177  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
void SetBoundaryConditionsBwdWeight()
Set up a weight on physical boundaries for boundary condition applications.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
void CalcViscosity(const Array< OneD, const Array< OneD, NekDouble >> &inaverg, Array< OneD, NekDouble > &mu)
virtual void v_GetViscousFluxVector(const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &derivatives, TensorOfArray3D< NekDouble > &viscousTensor)
Return the flux vector for the LDG diffusion problem.
void SpecialBndTreat(Array< OneD, Array< OneD, NekDouble > > &consvar)
For very special treatment. For general boundaries it does nothing But for WallViscous and WallAdiaba...
void GetViscousSymmtrFluxConservVar(const int nSpaceDim, const Array< OneD, Array< OneD, NekDouble > > &inaverg, const Array< OneD, Array< OneD, NekDouble > > &inarray, TensorOfArray3D< NekDouble > &outarray, Array< OneD, int > &nonZeroIndex, const Array< OneD, Array< OneD, NekDouble > > &normals)
Calculate and return the Symmetric flux in IP method.
Array< OneD, NekDouble > m_thermalConductivity
std::string m_physicalSensorType
NekDouble m_thermalConductivityRef
virtual void v_GetViscousFluxVectorDeAlias(const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &derivatives, TensorOfArray3D< NekDouble > &viscousTensor)
Return the flux vector for the LDG diffusion problem.
bool m_is_diffIP
flag to switch between IP and LDG an enum could be added for more options
virtual void v_GetFluxPenalty(const Array< OneD, const Array< OneD, NekDouble >> &uFwd, const Array< OneD, const Array< OneD, NekDouble >> &uBwd, Array< OneD, Array< OneD, NekDouble >> &penaltyCoeff)
Return the penalty vector for the LDGNS diffusion problem.
void GetArtificialViscosity(const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &muav)
Calculate and return the ArtificialViscosity for shock-capturing.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
DiffusionFactory & GetDiffusionFactory()
Definition: Diffusion.cpp:41

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, CalcViscosity(), Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), GetArtificialViscosity(), Nektar::SolverUtils::GetDiffusionFactory(), GetViscousSymmtrFluxConservVar(), m_C0ProjectExp, m_Cp, m_Cv, Nektar::CompressibleFlowSystem::m_diffusion, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::CompressibleFlowSystem::m_gamma, Nektar::SolverUtils::EquationSystem::m_graph, m_is_diffIP, m_is_mu_variable, m_mu, m_mu0, m_muRef, m_physicalSensorType, m_Prandtl, Nektar::SolverUtils::EquationSystem::m_session, Nektar::CompressibleFlowSystem::m_shockCaptureType, m_smoothing, Nektar::SolverUtils::EquationSystem::m_specHP_dealiasing, m_thermalConductivity, m_thermalConductivityRef, m_Twall, m_ViscosityType, Nektar::CompressibleFlowSystem::SetBoundaryConditionsBwdWeight(), SpecialBndTreat(), v_GetFluxPenalty(), v_GetViscousFluxVector(), and v_GetViscousFluxVectorDeAlias().

Referenced by v_InitObject(), and Nektar::NavierStokesImplicitCFE::v_InitObject().

◆ SpecialBndTreat()

void Nektar::NavierStokesCFE::SpecialBndTreat ( Array< OneD, Array< OneD, NekDouble > > &  consvar)
protected

For very special treatment. For general boundaries it does nothing But for WallViscous and WallAdiabatic, special treatment is needed because they get the same Bwd value, special treatment is needed for boundary treatment of diffusion flux Note: This special treatment could be removed by seperating WallViscous and WallAdiabatic into two different classes.

Definition at line 671 of file NavierStokesCFE.cpp.

673  {
674  size_t nConvectiveFields = consvar.size();
675  int ndens = 0;
676  int nengy = nConvectiveFields - 1;
677 
678  Array<OneD, Array<OneD, NekDouble>> bndCons {nConvectiveFields};
679  Array<OneD, NekDouble> bndTotEngy;
680  Array<OneD, NekDouble> bndPressure;
681  Array<OneD, NekDouble> bndRho;
682  Array<OneD, NekDouble> bndIntEndy;
683  int nLengthArray = 0;
684 
685  int cnt = 0;
686  int nBndRegions = m_fields[nengy]->
687  GetBndCondExpansions().size();
688  for (int j = 0; j < nBndRegions; ++j)
689  {
690  if (m_fields[nengy]->GetBndConditions()[j]->
691  GetBoundaryConditionType() ==
693  {
694  continue;
695  }
696 
697  size_t nBndEdges = m_fields[nengy]->
698  GetBndCondExpansions()[j]->GetExpSize();
699  for (int e = 0; e < nBndEdges; ++e)
700  {
701  size_t nBndEdgePts = m_fields[nengy]->
702  GetBndCondExpansions()[j]->GetExp(e)->GetTotPoints();
703 
704  int id2 = m_fields[0]->GetTrace()->
705  GetPhys_Offset(m_fields[0]->GetTraceMap()->
706  GetBndCondIDToGlobalTraceID(cnt++));
707 
708  // Imposing Temperature Twall at the wall
709  if (boost::iequals(m_fields[nengy]->GetBndConditions()[j]->
710  GetUserDefined(), "WallViscous"))
711  {
712  if (nBndEdgePts != nLengthArray)
713  {
714  for (int i = 0; i < nConvectiveFields; ++i)
715  {
716  bndCons[i] = Array<OneD, NekDouble>
717  {nBndEdgePts, 0.0};
718  }
719  bndTotEngy = Array<OneD, NekDouble> {nBndEdgePts, 0.0};
720  bndPressure = Array<OneD, NekDouble> {nBndEdgePts, 0.0};
721  bndRho = Array<OneD, NekDouble> {nBndEdgePts, 0.0};
722  bndIntEndy = Array<OneD, NekDouble> {nBndEdgePts, 0.0};
723  nLengthArray = nBndEdgePts;
724  }
725  else
726  {
727  Vmath::Zero(nLengthArray, bndPressure, 1);
728  Vmath::Zero(nLengthArray, bndRho , 1);
729  Vmath::Zero(nLengthArray, bndIntEndy , 1);
730  }
731 
733 
734  for (int k = 0; k < nConvectiveFields; ++k)
735  {
736  Vmath::Vcopy(nBndEdgePts, tmp = consvar[k] + id2, 1,
737  bndCons[k], 1);
738  }
739 
740  m_varConv->GetPressure(bndCons, bndPressure);
741  Vmath::Fill(nLengthArray, m_Twall, bndTotEngy, 1);
742  m_varConv->GetRhoFromPT(bndPressure, bndTotEngy, bndRho);
743  m_varConv->GetEFromRhoP(bndRho, bndPressure, bndIntEndy);
744  m_varConv->GetDynamicEnergy(bndCons, bndTotEngy);
745 
746  Vmath::Vvtvp(nBndEdgePts, bndIntEndy, 1, bndCons[ndens], 1,
747  bndTotEngy, 1, bndTotEngy, 1);
748 
749  Vmath::Vcopy(nBndEdgePts,
750  bndTotEngy, 1,
751  tmp = consvar[nengy] + id2, 1);
752  }
753  }
754  }
755  }
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
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.cpp:513
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:436

References Nektar::SpatialDomains::ePeriodic, Vmath::Fill(), Nektar::SolverUtils::EquationSystem::GetPhys_Offset(), Nektar::SolverUtils::EquationSystem::m_fields, m_Twall, Nektar::CompressibleFlowSystem::m_varConv, Vmath::Vcopy(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by InitObject_Explicit().

◆ v_DoDiffusion()

void Nektar::NavierStokesCFE::v_DoDiffusion ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const Array< OneD, const Array< OneD, NekDouble >> &  pFwd,
const Array< OneD, const Array< OneD, NekDouble >> &  pBwd 
)
protectedvirtual

Reimplemented from Nektar::CompressibleFlowSystem.

Reimplemented in Nektar::NavierStokesCFEAxisym.

Definition at line 301 of file NavierStokesCFE.cpp.

306  {
307  size_t nvariables = inarray.size();
308  size_t npoints = GetNpoints();
309  size_t nTracePts = GetTraceTotPoints();
310 
311  // this should be preallocated
312  Array<OneD, Array<OneD, NekDouble> > outarrayDiff(nvariables);
313  for (int i = 0; i < nvariables; ++i)
314  {
315  outarrayDiff[i] = Array<OneD, NekDouble>(npoints, 0.0);
316  }
317 
318  // get artificial viscosity
319  if (m_shockCaptureType == "Physical" && m_CalcPhysicalAV)
320  {
321  GetPhysicalAV(inarray);
322  }
323 
324  if (m_is_diffIP)
325  {
326  if (m_bndEvaluateTime < 0.0)
327  {
328  NEKERROR(ErrorUtil::efatal, "m_bndEvaluateTime not setup");
329  }
330  m_diffusion->Diffuse(nvariables, m_fields, inarray, outarrayDiff,
332  pFwd, pBwd);
333  for (int i = 0; i < nvariables; ++i)
334  {
335  Vmath::Vadd(npoints,
336  outarrayDiff[i], 1,
337  outarray[i], 1,
338  outarray[i], 1);
339  }
340  }
341  else
342  {
343  Array<OneD, Array<OneD, NekDouble> > inarrayDiff(nvariables-1);
344  Array<OneD, Array<OneD, NekDouble> > inFwd(nvariables-1);
345  Array<OneD, Array<OneD, NekDouble> > inBwd(nvariables-1);
346 
347 
348  for (int i = 0; i < nvariables - 1; ++i)
349  {
350  inarrayDiff[i] = Array<OneD, NekDouble>{npoints};
351  inFwd[i] = Array<OneD, NekDouble>{nTracePts};
352  inBwd[i] = Array<OneD, NekDouble>{nTracePts};
353  }
354 
355  // Extract pressure
356  // (use inarrayDiff[0] as a temporary storage for the pressure)
357  m_varConv->GetPressure(inarray, inarrayDiff[0]);
358 
359  // Extract temperature
360  m_varConv->GetTemperature(inarray, inarrayDiff[nvariables - 2]);
361 
362  // Extract velocities
363  m_varConv->GetVelocityVector(inarray, inarrayDiff);
364 
365  // Repeat calculation for trace space
366  if (pFwd == NullNekDoubleArrayOfArray ||
368  {
371  }
372  else
373  {
374  m_varConv->GetPressure(pFwd, inFwd[0]);
375  m_varConv->GetPressure(pBwd, inBwd[0]);
376 
377  m_varConv->GetTemperature(pFwd, inFwd[nvariables - 2]);
378  m_varConv->GetTemperature(pBwd, inBwd[nvariables - 2]);
379 
380  m_varConv->GetVelocityVector(pFwd, inFwd);
381  m_varConv->GetVelocityVector(pBwd, inBwd);
382  }
383 
384  // Diffusion term in physical rhs form
385  m_diffusion->Diffuse(nvariables, m_fields, inarrayDiff,
386  outarrayDiff, inFwd, inBwd);
387 
388  for (int i = 0; i < nvariables; ++i)
389  {
390  Vmath::Vadd(npoints,
391  outarrayDiff[i], 1,
392  outarray[i], 1,
393  outarray[i], 1);
394  }
395  }
396  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
void GetPhysicalAV(const Array< OneD, const Array< OneD, NekDouble >> &physfield)
Calculate the physical artificial viscosity.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT int GetNpoints()
bool m_CalcPhysicalAV
flag to update artificial viscosity
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray

References Nektar::ErrorUtil::efatal, Nektar::SolverUtils::EquationSystem::GetNpoints(), GetPhysicalAV(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::CompressibleFlowSystem::m_bndEvaluateTime, Nektar::SolverUtils::UnsteadySystem::m_CalcPhysicalAV, Nektar::CompressibleFlowSystem::m_diffusion, Nektar::SolverUtils::EquationSystem::m_fields, m_is_diffIP, Nektar::CompressibleFlowSystem::m_shockCaptureType, Nektar::CompressibleFlowSystem::m_varConv, NEKERROR, Nektar::NullNekDoubleArrayOfArray, and Vmath::Vadd().

Referenced by Nektar::NavierStokesCFEAxisym::v_DoDiffusion().

◆ v_ExtraFldOutput()

void Nektar::NavierStokesCFE::v_ExtraFldOutput ( std::vector< Array< OneD, NekDouble >> &  fieldcoeffs,
std::vector< std::string > &  variables 
)
protectedvirtual

Definition at line 179 of file NavierStokesCFE.cpp.

182  {
183  bool extraFields;
184  m_session->MatchSolverInfo("OutputExtraFields","True",
185  extraFields, true);
186  if (extraFields)
187  {
188  const int nPhys = m_fields[0]->GetNpoints();
189  const int nCoeffs = m_fields[0]->GetNcoeffs();
191 
192  for (int i = 0; i < m_fields.size(); ++i)
193  {
194  tmp[i] = m_fields[i]->GetPhys();
195  }
196 
199  for (int i = 0; i < m_spacedim; ++i)
200  {
201  velocity[i] = Array<OneD, NekDouble> (nPhys);
202  velFwd[i] = Array<OneD, NekDouble> (nCoeffs);
203  }
204 
205  Array<OneD, NekDouble> pressure(nPhys), temperature(nPhys);
206  Array<OneD, NekDouble> entropy(nPhys);
207  Array<OneD, NekDouble> soundspeed(nPhys), mach(nPhys);
208  Array<OneD, NekDouble> sensor(nPhys), SensorKappa(nPhys);
209 
210  m_varConv->GetVelocityVector(tmp, velocity);
211  m_varConv->GetPressure (tmp, pressure);
212  m_varConv->GetTemperature(tmp, temperature);
213  m_varConv->GetEntropy (tmp, entropy);
214  m_varConv->GetSoundSpeed(tmp, soundspeed);
215  m_varConv->GetMach (tmp, soundspeed, mach);
216 
217  int sensorOffset;
218  m_session->LoadParameter ("SensorOffset", sensorOffset, 1);
219  m_varConv->GetSensor (m_fields[0], tmp, sensor, SensorKappa,
220  sensorOffset);
221 
222  Array<OneD, NekDouble> pFwd(nCoeffs), TFwd(nCoeffs);
223  Array<OneD, NekDouble> sFwd(nCoeffs);
224  Array<OneD, NekDouble> aFwd(nCoeffs), mFwd(nCoeffs);
225  Array<OneD, NekDouble> sensFwd(nCoeffs);
226 
227  string velNames[3] = {"u", "v", "w"};
228  for (int i = 0; i < m_spacedim; ++i)
229  {
230  m_fields[0]->FwdTrans_IterPerExp(velocity[i], velFwd[i]);
231  variables.push_back(velNames[i]);
232  fieldcoeffs.push_back(velFwd[i]);
233  }
234 
235  m_fields[0]->FwdTrans_IterPerExp(pressure, pFwd);
236  m_fields[0]->FwdTrans_IterPerExp(temperature,TFwd);
237  m_fields[0]->FwdTrans_IterPerExp(entropy, sFwd);
238  m_fields[0]->FwdTrans_IterPerExp(soundspeed, aFwd);
239  m_fields[0]->FwdTrans_IterPerExp(mach, mFwd);
240  m_fields[0]->FwdTrans_IterPerExp(sensor, sensFwd);
241 
242  variables.push_back ("p");
243  variables.push_back ("T");
244  variables.push_back ("s");
245  variables.push_back ("a");
246  variables.push_back ("Mach");
247  variables.push_back ("Sensor");
248  fieldcoeffs.push_back(pFwd);
249  fieldcoeffs.push_back(TFwd);
250  fieldcoeffs.push_back(sFwd);
251  fieldcoeffs.push_back(aFwd);
252  fieldcoeffs.push_back(mFwd);
253  fieldcoeffs.push_back(sensFwd);
254 
256  {
257  // Get min h/p
258  // m_artificialDiffusion->m_hOverP = GetElmtMinHP();
259  // reuse pressure
260  Array<OneD, NekDouble> sensorFwd(nCoeffs);
261  m_artificialDiffusion->GetArtificialViscosity(tmp, pressure);
262  m_fields[0]->FwdTrans_IterPerExp(pressure, sensorFwd);
263 
264  variables.push_back ("ArtificialVisc");
265  fieldcoeffs.push_back(sensorFwd);
266 
267  }
268 
269  if (m_shockCaptureType == "Physical")
270  {
271  Array<OneD, NekDouble> muavFwd(nCoeffs);
272  m_fields[0]->FwdTrans_IterPerExp(m_muav, muavFwd);
273  variables.push_back ("ArtificialVisc");
274  fieldcoeffs.push_back(muavFwd);
275 
276  // Debug Ducros
277  // div square
278  Array<OneD, NekDouble> dv2Fwd(nCoeffs);
279  m_fields[0]->FwdTrans_IterPerExp(m_diffusion->m_divVelSquare,
280  dv2Fwd);
281  variables.push_back ("divVelSquare");
282  fieldcoeffs.push_back(dv2Fwd);
283  // curl square
284  Array<OneD, NekDouble> cv2Fwd(nCoeffs);
285  m_fields[0]->FwdTrans_IterPerExp(m_diffusion->m_curlVelSquare,
286  cv2Fwd);
287  variables.push_back ("curlVelSquare");
288  fieldcoeffs.push_back(cv2Fwd);
289  // Ducros
290  Array<OneD, NekDouble> duc(nPhys,1.0);
291  Ducros(duc);
292  Array<OneD, NekDouble> ducFwd(nCoeffs);
293  m_fields[0]->FwdTrans_IterPerExp(duc, ducFwd);
294  variables.push_back ("Ducros");
295  fieldcoeffs.push_back(ducFwd);
296 
297  }
298  }
299  }
void Ducros(Array< OneD, NekDouble > &field)
Applied Ducros (anti-vorticity) sensor.
int m_spacedim
Spatial dimension (>= expansion dim).

References Ducros(), Nektar::CompressibleFlowSystem::m_artificialDiffusion, Nektar::CompressibleFlowSystem::m_diffusion, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::CompressibleFlowSystem::m_muav, Nektar::SolverUtils::EquationSystem::m_session, Nektar::CompressibleFlowSystem::m_shockCaptureType, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::CompressibleFlowSystem::m_varConv, and CG_Iterations::pressure.

◆ v_GetFluxPenalty()

void Nektar::NavierStokesCFE::v_GetFluxPenalty ( const Array< OneD, const Array< OneD, NekDouble >> &  uFwd,
const Array< OneD, const Array< OneD, NekDouble >> &  uBwd,
Array< OneD, Array< OneD, NekDouble >> &  penaltyCoeff 
)
protectedvirtual

Return the penalty vector for the LDGNS diffusion problem.

Definition at line 955 of file NavierStokesCFE.cpp.

959  {
960  unsigned int nTracePts = uFwd[0].size();
961 
962  // Compute average temperature
963  unsigned int nVariables = uFwd.size();
964  Array<OneD, NekDouble> tAve{nTracePts, 0.0};
965  Vmath::Svtsvtp(nTracePts, 0.5, uFwd[nVariables-1], 1,
966  0.5, uBwd[nVariables-1], 1, tAve, 1);
967 
968  // Get average viscosity and thermal conductivity
969  Array<OneD, NekDouble> muAve{nTracePts, 0.0};
970  Array<OneD, NekDouble> tcAve{nTracePts, 0.0};
971 
972  GetViscosityAndThermalCondFromTemp(tAve, muAve, tcAve);
973 
974  // Compute penalty term
975  for (int i = 0; i < nVariables; ++i)
976  {
977  // Get jump of u variables
978  Vmath::Vsub(nTracePts, uFwd[i], 1, uBwd[i], 1, penaltyCoeff[i], 1);
979  // Multiply by variable coefficient = {coeff} ( u^+ - u^- )
980  if ( i < nVariables-1 )
981  {
982  Vmath::Vmul(nTracePts, muAve, 1, penaltyCoeff[i], 1,
983  penaltyCoeff[i], 1);
984  }
985  else
986  {
987  Vmath::Vmul(nTracePts, tcAve, 1, penaltyCoeff[i], 1,
988  penaltyCoeff[i], 1);
989  }
990  }
991  }
void GetViscosityAndThermalCondFromTemp(const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &mu, Array< OneD, NekDouble > &thermalCond)
Update viscosity todo: add artificial viscosity here.
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
vvtvvtp (scalar times vector plus scalar times vector):
Definition: Vmath.cpp:691
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.cpp:372

References GetViscosityAndThermalCondFromTemp(), Vmath::Svtsvtp(), Vmath::Vmul(), and Vmath::Vsub().

Referenced by InitObject_Explicit().

◆ v_GetViscousFluxVector()

void Nektar::NavierStokesCFE::v_GetViscousFluxVector ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
TensorOfArray3D< NekDouble > &  derivativesO1,
TensorOfArray3D< NekDouble > &  viscousTensor 
)
protectedvirtual

Return the flux vector for the LDG diffusion problem.

Todo:
Complete the viscous flux vector

Reimplemented in Nektar::NavierStokesCFEAxisym.

Definition at line 404 of file NavierStokesCFE.cpp.

408  {
409  // Auxiliary variables
410  size_t nScalar = physfield.size();
411  size_t nPts = physfield[0].size();
412  Array<OneD, NekDouble > divVel (nPts, 0.0);
413 
414  // Stokes hypothesis
415  const NekDouble lambda = -2.0/3.0;
416 
417  // Update viscosity and thermal conductivity
418  GetViscosityAndThermalCondFromTemp(physfield[nScalar-1], m_mu,
420 
421  // Add artificial viscosity if wanted
422  if (m_shockCaptureType == "Physical")
423  {
424  // Apply Ducros sensor
425  if (m_physicalSensorType == "Ducros" && m_CalcPhysicalAV)
426  {
427  Ducros(m_muav);
428  }
429  // Apply approximate c0 smoothing
430  if (m_smoothing == "C0" && m_CalcPhysicalAV)
431  {
432  C0Smooth(m_muav);
433  }
434  Vmath::Vadd(nPts, m_mu, 1, m_muav, 1, m_mu, 1);
435  // Freeze AV for Implicit time stepping
436  if (m_explicitDiffusion == false)
437  {
438  m_CalcPhysicalAV = false;
439  }
440  }
441 
442  // Velocity divergence
443  for (int j = 0; j < m_spacedim; ++j)
444  {
445  Vmath::Vadd(nPts, divVel, 1, derivativesO1[j][j], 1,
446  divVel, 1);
447  }
448 
449  // Velocity divergence scaled by lambda * mu
450  Vmath::Smul(nPts, lambda, divVel, 1, divVel, 1);
451  Vmath::Vmul(nPts, m_mu, 1, divVel, 1, divVel, 1);
452 
453  // Viscous flux vector for the rho equation = 0
454  for (int i = 0; i < m_spacedim; ++i)
455  {
456  Vmath::Zero(nPts, viscousTensor[i][0], 1);
457  }
458 
459  // Viscous stress tensor (for the momentum equations)
460  for (int i = 0; i < m_spacedim; ++i)
461  {
462  for (int j = i; j < m_spacedim; ++j)
463  {
464  Vmath::Vadd(nPts, derivativesO1[i][j], 1,
465  derivativesO1[j][i], 1,
466  viscousTensor[i][j+1], 1);
467 
468  Vmath::Vmul(nPts, m_mu, 1,
469  viscousTensor[i][j+1], 1,
470  viscousTensor[i][j+1], 1);
471 
472  if (i == j)
473  {
474  // Add divergence term to diagonal
475  Vmath::Vadd(nPts, viscousTensor[i][j+1], 1,
476  divVel, 1,
477  viscousTensor[i][j+1], 1);
478  }
479  else
480  {
481  // Copy to make symmetric
482  Vmath::Vcopy(nPts, viscousTensor[i][j+1], 1,
483  viscousTensor[j][i+1], 1);
484  }
485  }
486  }
487 
488  // Terms for the energy equation
489  for (int i = 0; i < m_spacedim; ++i)
490  {
491  Vmath::Zero(nPts, viscousTensor[i][m_spacedim+1], 1);
492  // u_j * tau_ij
493  for (int j = 0; j < m_spacedim; ++j)
494  {
495  Vmath::Vvtvp(nPts, physfield[j], 1,
496  viscousTensor[i][j+1], 1,
497  viscousTensor[i][m_spacedim+1], 1,
498  viscousTensor[i][m_spacedim+1], 1);
499  }
500  // Add k*T_i
502  derivativesO1[i][m_spacedim], 1,
503  viscousTensor[i][m_spacedim+1], 1,
504  viscousTensor[i][m_spacedim+1], 1);
505  }
506  }
void C0Smooth(Array< OneD, NekDouble > &field)
Make field C0.
bool m_explicitDiffusion
Indicates if explicit or implicit treatment of diffusion is used.

References C0Smooth(), Ducros(), GetViscosityAndThermalCondFromTemp(), Nektar::SolverUtils::UnsteadySystem::m_CalcPhysicalAV, Nektar::SolverUtils::UnsteadySystem::m_explicitDiffusion, m_mu, Nektar::CompressibleFlowSystem::m_muav, m_physicalSensorType, Nektar::CompressibleFlowSystem::m_shockCaptureType, m_smoothing, Nektar::SolverUtils::EquationSystem::m_spacedim, m_thermalConductivity, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by InitObject_Explicit().

◆ v_GetViscousFluxVectorDeAlias()

void Nektar::NavierStokesCFE::v_GetViscousFluxVectorDeAlias ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
TensorOfArray3D< NekDouble > &  derivativesO1,
TensorOfArray3D< NekDouble > &  viscousTensor 
)
protectedvirtual

Return the flux vector for the LDG diffusion problem.

Todo:
Complete the viscous flux vector

Reimplemented in Nektar::NavierStokesCFEAxisym.

Definition at line 512 of file NavierStokesCFE.cpp.

516  {
517  // Factor to rescale 1d points in dealiasing.
518  NekDouble OneDptscale = 2;
519  // Get number of points to dealias a cubic non-linearity
520  size_t nScalar = physfield.size();
521  int nPts = m_fields[0]->Get1DScaledTotPoints(OneDptscale);
522  size_t nPts_orig = physfield[0].size();
523 
524  // Auxiliary variables
525  Array<OneD, NekDouble > divVel (nPts, 0.0);
526 
527  // Stokes hypothesis
528  const NekDouble lambda = -2.0/3.0;
529 
530  // Update viscosity and thermal conductivity
531  GetViscosityAndThermalCondFromTemp(physfield[nScalar-1], m_mu,
533 
534  // Add artificial viscosity if wanted
535  if (m_shockCaptureType == "Physical")
536  {
537  // Apply Ducros sensor
538  if (m_physicalSensorType == "Ducros" && m_CalcPhysicalAV)
539  {
540  Ducros(m_muav);
541  }
542  // Apply approximate c0 smoothing
543  if (m_smoothing == "C0" && m_CalcPhysicalAV)
544  {
545  C0Smooth(m_muav);
546  }
547  Vmath::Vadd(nPts, m_mu, 1, m_muav, 1, m_mu, 1);
548  // Freeze AV for Implicit time stepping
549  if (m_explicitDiffusion == false)
550  {
551  m_CalcPhysicalAV = false;
552  }
553  }
554 
555  // Interpolate inputs and initialise interpolated output
559  for (int i = 0; i < m_spacedim; ++i)
560  {
561  // Interpolate velocity
562  vel_interp[i] = Array<OneD, NekDouble> (nPts);
563  m_fields[0]->PhysInterp1DScaled(
564  OneDptscale, physfield[i], vel_interp[i]);
565 
566  // Interpolate derivatives
567  deriv_interp[i] = Array<OneD, Array<OneD, NekDouble> >
568  (m_spacedim+1);
569  for (int j = 0; j < m_spacedim+1; ++j)
570  {
571  deriv_interp[i][j] = Array<OneD, NekDouble> (nPts);
572  m_fields[0]->PhysInterp1DScaled(
573  OneDptscale, derivativesO1[i][j], deriv_interp[i][j]);
574  }
575 
576  // Output (start from j=1 since flux is zero for rho)
577  out_interp[i] = Array<OneD, Array<OneD, NekDouble> > (m_spacedim+2);
578  for (int j = 1; j < m_spacedim+2; ++j)
579  {
580  out_interp[i][j] = Array<OneD, NekDouble> (nPts);
581  }
582  }
583 
584  // Velocity divergence
585  for (int j = 0; j < m_spacedim; ++j)
586  {
587  Vmath::Vadd(nPts, divVel, 1, deriv_interp[j][j], 1,
588  divVel, 1);
589  }
590 
591  // Velocity divergence scaled by lambda * mu
592  Vmath::Smul(nPts, lambda, divVel, 1, divVel, 1);
593  Vmath::Vmul(nPts, m_mu, 1, divVel, 1, divVel, 1);
594 
595  // Viscous flux vector for the rho equation = 0 (no need to dealias)
596  for (int i = 0; i < m_spacedim; ++i)
597  {
598  Vmath::Zero(nPts_orig, viscousTensor[i][0], 1);
599  }
600 
601  // Viscous stress tensor (for the momentum equations)
602  for (int i = 0; i < m_spacedim; ++i)
603  {
604  for (int j = i; j < m_spacedim; ++j)
605  {
606  Vmath::Vadd(nPts, deriv_interp[i][j], 1,
607  deriv_interp[j][i], 1,
608  out_interp[i][j+1], 1);
609 
610  Vmath::Vmul(nPts, m_mu, 1,
611  out_interp[i][j+1], 1,
612  out_interp[i][j+1], 1);
613 
614  if (i == j)
615  {
616  // Add divergence term to diagonal
617  Vmath::Vadd(nPts, out_interp[i][j+1], 1,
618  divVel, 1,
619  out_interp[i][j+1], 1);
620  }
621  else
622  {
623  // Make symmetric
624  out_interp[j][i+1] = out_interp[i][j+1];
625  }
626  }
627  }
628 
629  // Terms for the energy equation
630  for (int i = 0; i < m_spacedim; ++i)
631  {
632  Vmath::Zero(nPts, out_interp[i][m_spacedim+1], 1);
633  // u_j * tau_ij
634  for (int j = 0; j < m_spacedim; ++j)
635  {
636  Vmath::Vvtvp(nPts, vel_interp[j], 1,
637  out_interp[i][j+1], 1,
638  out_interp[i][m_spacedim+1], 1,
639  out_interp[i][m_spacedim+1], 1);
640  }
641  // Add k*T_i
643  deriv_interp[i][m_spacedim], 1,
644  out_interp[i][m_spacedim+1], 1,
645  out_interp[i][m_spacedim+1], 1);
646  }
647 
648  // Project to original space
649  for (int i = 0; i < m_spacedim; ++i)
650  {
651  for (int j = 1; j < m_spacedim+2; ++j)
652  {
653  m_fields[0]->PhysGalerkinProjection1DScaled(
654  OneDptscale,
655  out_interp[i][j],
656  viscousTensor[i][j]);
657  }
658  }
659  }

References C0Smooth(), Ducros(), GetViscosityAndThermalCondFromTemp(), Nektar::SolverUtils::UnsteadySystem::m_CalcPhysicalAV, Nektar::SolverUtils::UnsteadySystem::m_explicitDiffusion, Nektar::SolverUtils::EquationSystem::m_fields, m_mu, Nektar::CompressibleFlowSystem::m_muav, m_physicalSensorType, Nektar::CompressibleFlowSystem::m_shockCaptureType, m_smoothing, Nektar::SolverUtils::EquationSystem::m_spacedim, m_thermalConductivity, Vmath::Smul(), Vmath::Vadd(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by InitObject_Explicit().

◆ v_InitObject()

void Nektar::NavierStokesCFE::v_InitObject ( )
protectedvirtual

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::CompressibleFlowSystem.

Reimplemented in Nektar::NavierStokesImplicitCFE, and Nektar::NavierStokesCFEAxisym.

Definition at line 62 of file NavierStokesCFE.cpp.

63  {
65 
66  // rest of initialisation is in this routine so it can also be called
67  // in NavierStokesImplicitCFE initialisation
69  }
virtual void v_InitObject()
Initialization object for CompressibleFlowSystem class.

References InitObject_Explicit(), and Nektar::CompressibleFlowSystem::v_InitObject().

Referenced by Nektar::NavierStokesCFEAxisym::v_InitObject().

Friends And Related Function Documentation

◆ MemoryManager< NavierStokesCFE >

friend class MemoryManager< NavierStokesCFE >
friend

Definition at line 1 of file NavierStokesCFE.h.

Member Data Documentation

◆ className

string Nektar::NavierStokesCFE::className
static
Initial value:
=
"NavierStokesCFE", NavierStokesCFE::create,
"NavierStokes equations in conservative variables.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:200
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
EquationSystemFactory & GetEquationSystemFactory()

Definition at line 65 of file NavierStokesCFE.h.

◆ m_C0ProjectExp

MultiRegions::ContFieldSharedPtr Nektar::NavierStokesCFE::m_C0ProjectExp
protected

Definition at line 85 of file NavierStokesCFE.h.

Referenced by C0Smooth(), and InitObject_Explicit().

◆ m_Cp

NekDouble Nektar::NavierStokesCFE::m_Cp
protected

◆ m_Cv

NekDouble Nektar::NavierStokesCFE::m_Cv
protected

◆ m_eos

EquationOfStateSharedPtr Nektar::NavierStokesCFE::m_eos
protected

Equation of system for computing temperature.

Definition at line 88 of file NavierStokesCFE.h.

◆ m_is_diffIP

bool Nektar::NavierStokesCFE::m_is_diffIP {false}
protected

flag to switch between IP and LDG an enum could be added for more options

Definition at line 76 of file NavierStokesCFE.h.

Referenced by InitObject_Explicit(), v_DoDiffusion(), and Nektar::NavierStokesImplicitCFE::v_DoDiffusionCoeff().

◆ m_is_mu_variable

bool Nektar::NavierStokesCFE::m_is_mu_variable {false}
protected

flag to switch between constant viscosity and Sutherland an enum could be added for more options

Definition at line 73 of file NavierStokesCFE.h.

Referenced by GetViscosityFromTempKernel(), and InitObject_Explicit().

◆ m_mu

Array<OneD, NekDouble> Nektar::NavierStokesCFE::m_mu
protected

◆ m_mu0

NekDouble Nektar::NavierStokesCFE::m_mu0
protected

Definition at line 82 of file NavierStokesCFE.h.

Referenced by GetPhysicalAV(), and InitObject_Explicit().

◆ m_muRef

NekDouble Nektar::NavierStokesCFE::m_muRef
protected

Definition at line 92 of file NavierStokesCFE.h.

Referenced by GetViscosityFromTempKernel(), and InitObject_Explicit().

◆ m_physicalSensorType

std::string Nektar::NavierStokesCFE::m_physicalSensorType
protected

◆ m_Prandtl

NekDouble Nektar::NavierStokesCFE::m_Prandtl
protected

◆ m_smoothing

std::string Nektar::NavierStokesCFE::m_smoothing
protected

◆ m_thermalConductivity

Array<OneD, NekDouble> Nektar::NavierStokesCFE::m_thermalConductivity
protected

◆ m_thermalConductivityRef

NekDouble Nektar::NavierStokesCFE::m_thermalConductivityRef
protected

Definition at line 93 of file NavierStokesCFE.h.

Referenced by InitObject_Explicit().

◆ m_Twall

NekDouble Nektar::NavierStokesCFE::m_Twall
protected

Definition at line 90 of file NavierStokesCFE.h.

Referenced by InitObject_Explicit(), and SpecialBndTreat().

◆ m_ViscosityType

std::string Nektar::NavierStokesCFE::m_ViscosityType
protected