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

 ~NavierStokesCFE () override=default
 
- Public Member Functions inherited from Nektar::CompressibleFlowSystem
 ~CompressibleFlowSystem () override=default
 
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...
 
- Public Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT AdvectionSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
SOLVER_UTILS_EXPORT ~AdvectionSystem () override
 
SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareField=true) override
 Initialisation object for EquationSystem. More...
 
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
SOLVER_UTILS_EXPORT ~UnsteadySystem () override
 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 NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void SetTimeStep (const NekDouble timestep)
 
SOLVER_UTILS_EXPORT void SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeSharedPtrGetTimeIntegrationScheme ()
 Returns the time integration scheme. More...
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeOperatorsGetTimeIntegrationSchemeOperators ()
 Returns the time integration scheme operators. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::EquationSystem
virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void InitObject (bool DeclareField=true)
 Initialises the members of this object. More...
 
SOLVER_UTILS_EXPORT void DoInitialise (bool dumpInitialConditions=true)
 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 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 NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation. 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 GetTime ()
 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, const Array< OneD, const NekDouble > &input)
 
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > & UpdatePhysField (const int i)
 
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 int GetInfoSteps ()
 
SOLVER_UTILS_EXPORT void SetInfoSteps (int num)
 
SOLVER_UTILS_EXPORT void SetIterationNumberPIT (int num)
 
SOLVER_UTILS_EXPORT void SetWindowNumberPIT (int num)
 
SOLVER_UTILS_EXPORT Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals ()
 
SOLVER_UTILS_EXPORT void SetTime (const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetTimeStep (const NekDouble timestep)
 
SOLVER_UTILS_EXPORT void SetInitialStep (const int step)
 
SOLVER_UTILS_EXPORT void SetBoundaryConditions (NekDouble time)
 Evaluates the boundary conditions at the given time. More...
 
SOLVER_UTILS_EXPORT bool NegatedOp ()
 Identify if operator is negated in DoSolve. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::FluidInterface
virtual ~FluidInterface ()=default
 
SOLVER_UTILS_EXPORT void GetVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
 Extract array with velocity from physfield. More...
 
SOLVER_UTILS_EXPORT bool HasConstantDensity ()
 
SOLVER_UTILS_EXPORT void GetDensity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density)
 Extract array with density from physfield. More...
 
SOLVER_UTILS_EXPORT void GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)
 Extract array with pressure from physfield. More...
 
SOLVER_UTILS_EXPORT void SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels)
 
SOLVER_UTILS_EXPORT void GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels)
 
SOLVER_UTILS_EXPORT void SetMovingFrameProjectionMat (const boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
SOLVER_UTILS_EXPORT void GetMovingFrameProjectionMat (boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
SOLVER_UTILS_EXPORT void SetMovingFrameDisp (const Array< OneD, NekDouble > &vFrameDisp)
 
SOLVER_UTILS_EXPORT void GetMovingFrameDisp (Array< OneD, NekDouble > &vFrameDisp)
 
SOLVER_UTILS_EXPORT void SetAeroForce (Array< OneD, NekDouble > forces)
 Set aerodynamic force and moment. More...
 
SOLVER_UTILS_EXPORT void GetAeroForce (Array< OneD, NekDouble > forces)
 Get aerodynamic force and moment. More...
 

Static Public Member Functions

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

Static Public Attributes

static std::string className
 
- Static Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
static std::string cmdSetStartTime
 
static std::string cmdSetStartChkNum
 

Protected Member Functions

 NavierStokesCFE (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
void GetViscousFluxVectorConservVar (const size_t 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)
 
void GetViscousSymmtrFluxConservVar (const size_t 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)
 
void CalcViscosity (const Array< OneD, const Array< OneD, NekDouble > > &inaverg, Array< OneD, NekDouble > &mu)
 
void InitObject_Explicit ()
 
void v_InitObject (bool DeclareField=true) override
 Initialization object for CompressibleFlowSystem class. More...
 
void v_DoDiffusion (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd) override
 
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)
 
void Ducros (Array< OneD, NekDouble > &field)
 
void C0Smooth (Array< OneD, NekDouble > &field)
 
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...
 
void GetDivCurlSquared (const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &cnsVar, Array< OneD, NekDouble > &div, Array< OneD, NekDouble > &curlSquare, const Array< OneD, Array< OneD, NekDouble > > &cnsVarFwd, const Array< OneD, Array< OneD, NekDouble > > &cnsVarBwd)
 Get divergence and curl squared. More...
 
void GetDivCurlFromDvelT (const TensorOfArray3D< NekDouble > &pVarDer, Array< OneD, NekDouble > &div, Array< OneD, NekDouble > &curlSquare)
 Get divergence and curl from velocity derivative tensor. More...
 
void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
 
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 size_t 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)
 Return the flux vector for the IP diffusion problem, based on conservative variables. More...
 
bool v_SupportsShockCaptType (const std::string type) const override
 
- Protected Member Functions inherited from Nektar::CompressibleFlowSystem
 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
void v_InitObject (bool DeclareFields=true) override
 Initialization object for CompressibleFlowSystem class. More...
 
void v_GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure) override
 
void v_GetDensity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
 
bool v_HasConstantDensity () override
 
void v_GetVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity) override
 
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, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
 Compute the advection terms for the right-hand side. More...
 
void DoDiffusion (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, 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...
 
NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray) override
 Calculate the maximum timestep subject to CFL restrictions. More...
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
 Set up logic for residual calculation. More...
 
void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time=0.0) override
 
NekDouble GetGamma ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals ()
 
MultiRegions::ExpListSharedPtr v_GetPressure () override
 
void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
 
virtual void v_DoDiffusion (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)=0
 
Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor) override
 Compute the advection velocity in the standard space for each element of the expansion. More...
 
void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2) override
 
virtual bool v_SupportsShockCaptType (const std::string type) const =0
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step) override
 
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor=1.0)
 
- 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 void v_InitObject (bool DeclareField=true) override
 Init object for UnsteadySystem class. More...
 
SOLVER_UTILS_EXPORT void v_DoSolve () override
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintStatusInformation (const int step, const NekDouble cpuTime)
 Print Status Information. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintSummaryStatistics (const NekDouble intTime)
 Print Summary Statistics. More...
 
SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true) override
 Sets up initial conditions. More...
 
SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s) override
 Print a summary of time stepping parameters. 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_PostIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
virtual SOLVER_UTILS_EXPORT void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
virtual SOLVER_UTILS_EXPORT bool v_UpdateTimeStepCheck ()
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
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...
 
SOLVER_UTILS_EXPORT void DoDummyProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Perform dummy projection. More...
 
- 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 void v_InitObject (bool DeclareFeld=true)
 Initialisation object for EquationSystem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true)
 Virtual function for initialisation implementation. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Virtual function for solve implementation. 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_GenerateSummary (SummaryList &l)
 Virtual function for generating summary information. More...
 
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 
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)
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp (void)
 Virtual function to identify if operator is negated in DoSolve. More...
 
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
- Protected Member Functions inherited from Nektar::SolverUtils::FluidInterface
virtual SOLVER_UTILS_EXPORT void v_GetVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)=0
 
virtual SOLVER_UTILS_EXPORT bool v_HasConstantDensity ()=0
 
virtual SOLVER_UTILS_EXPORT void v_GetDensity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density)=0
 
virtual SOLVER_UTILS_EXPORT void v_GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)=0
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameProjectionMat (const boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameProjectionMat (boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameDisp (const Array< OneD, NekDouble > &vFrameDisp)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameDisp (Array< OneD, NekDouble > &vFrameDisp)
 
virtual SOLVER_UTILS_EXPORT void v_SetAeroForce (Array< OneD, NekDouble > forces)
 
virtual SOLVER_UTILS_EXPORT void v_GetAeroForce (Array< OneD, NekDouble > forces)
 

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...
 
bool m_is_shockCaptPhys {false}
 flag for shock capturing switch on/off an enum could be added for more options More...
 
NekDouble m_Cp
 
NekDouble m_Cv
 
NekDouble m_Prandtl
 
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
 
- 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
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::vector< int > m_intVariables
 
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1). More...
 
NekDouble m_CFLGrowth
 CFL growth rate. More...
 
NekDouble m_CFLEnd
 Maximun cfl in cfl growth. More...
 
int m_abortSteps
 Number of steps between checks for abort conditions. More...
 
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...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_filtersInfosteps
 Number of time steps between outputting filters information. More...
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
std::ofstream m_errFile
 
NekDouble m_epsilon
 Diffusion coefficient. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
bool m_verbose
 
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_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_infosteps
 Number of time steps between outputting status information. More...
 
int m_iterPIT = 0
 Number of parallel-in-time time iteration. More...
 
int m_windowPIT = 0
 Index of windows for parallel-in-time time iteration. 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...
 
Array< OneD, NekDoublem_movingFrameVelsxyz
 Moving frame of reference velocities (u, v, w, omega_x, omega_y, omega_z, a_x, a_y, a_z, domega_x, domega_y, domega_z) More...
 
Array< OneD, NekDoublem_movingFrameData
 Moving frame of reference angles with respect to the. More...
 
boost::numeric::ublas::matrix< NekDoublem_movingFrameProjMat
 Projection matrix for transformation between inertial and moving. 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

- 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 []
 
static std::string projectionTypeLookupIds []
 

Detailed Description

Definition at line 49 of file NavierStokesCFE.h.

Constructor & Destructor Documentation

◆ ~NavierStokesCFE()

Nektar::NavierStokesCFE::~NavierStokesCFE ( )
overridedefault

◆ 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), CompressibleFlowSystem(pSession, pGraph)
50{
51}
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

◆ CalcViscosity()

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

◆ 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

◆ GetArtificialViscosity()

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

◆ GetDivCurlFromDvelT()

void Nektar::NavierStokesCFE::GetDivCurlFromDvelT ( const TensorOfArray3D< NekDouble > &  pVarDer,
Array< OneD, NekDouble > &  div,
Array< OneD, NekDouble > &  curlSquare 
)
protected

Get divergence and curl from velocity derivative tensor.

Definition at line 768 of file NavierStokesCFE.cpp.

771{
772 size_t nDim = pVarDer.size();
773 size_t nPts = div.size();
774
775 // div velocity
776 for (size_t p = 0; p < nPts; ++p)
777 {
778 NekDouble divTmp = 0;
779 for (unsigned short j = 0; j < nDim; ++j)
780 {
781 divTmp += pVarDer[j][j][p];
782 }
783 div[p] = divTmp;
784 }
785
786 // |curl velocity| ** 2
787 if (nDim > 2)
788 {
789 for (size_t p = 0; p < nPts; ++p)
790 {
791 // curl[0] 3/2 - 2/3
792 NekDouble curl032 = pVarDer[2][1][p]; // load 1x
793 NekDouble curl023 = pVarDer[1][2][p]; // load 1x
794 NekDouble curl0 = curl032 - curl023;
795 // square curl[0]
796 NekDouble curl0sqr = curl0 * curl0;
797
798 // curl[1] 3/1 - 1/3
799 NekDouble curl131 = pVarDer[2][0][p]; // load 1x
800 NekDouble curl113 = pVarDer[0][2][p]; // load 1x
801 NekDouble curl1 = curl131 - curl113;
802 // square curl[1]
803 NekDouble curl1sqr = curl1 * curl1;
804
805 // curl[2] 1/2 - 2/1
806 NekDouble curl212 = pVarDer[0][1][p]; // load 1x
807 NekDouble curl221 = pVarDer[1][0][p]; // load 1x
808 NekDouble curl2 = curl212 - curl221;
809 // square curl[2]
810 NekDouble curl2sqr = curl2 * curl2;
811
812 // reduce
813 curl0sqr += curl1sqr + curl2sqr;
814 // store
815 curlSquare[p] = curl0sqr; // store 1x
816 }
817 }
818 else if (nDim > 1)
819 {
820 for (size_t p = 0; p < nPts; ++p)
821 {
822 // curl[2] 1/2
823 NekDouble c212 = pVarDer[0][1][p]; // load 1x
824 // curl[2] 2/1
825 NekDouble c221 = pVarDer[1][0][p]; // load 1x
826 // curl[2] 1/2 - 2/1
827 NekDouble curl = c212 - c221;
828 // square curl[2]
829 curlSquare[p] = curl * curl; // store 1x
830 }
831 }
832 else
833 {
834 Vmath::Fill(nPts, 0.0, curlSquare, 1);
835 }
836}
double NekDouble
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::Fill(), and CellMLToNektar.cellml_metadata::p.

Referenced by GetDivCurlSquared().

◆ GetDivCurlSquared()

void Nektar::NavierStokesCFE::GetDivCurlSquared ( const Array< OneD, MultiRegions::ExpListSharedPtr > &  fields,
const Array< OneD, Array< OneD, NekDouble > > &  cnsVar,
Array< OneD, NekDouble > &  div,
Array< OneD, NekDouble > &  curlSquare,
const Array< OneD, Array< OneD, NekDouble > > &  cnsVarFwd,
const Array< OneD, Array< OneD, NekDouble > > &  cnsVarBwd 
)
protected

Get divergence and curl squared.

Parameters
inputfields -> expansion list pointer cnsVar -> conservative variables cnsVarFwd -> forward trace of conservative variables cnsVarBwd -> backward trace of conservative variables @paran output divSquare -> divergence curlSquare -> curl squared

Definition at line 700 of file NavierStokesCFE.cpp.

706{
707 size_t nDim = fields[0]->GetCoordim(0);
708 size_t nVar = cnsVar.size();
709 size_t nPts = cnsVar[0].size();
710 size_t nPtsTrc = cnsVarFwd[0].size();
711
712 // These should be allocated once
713 Array<OneD, Array<OneD, NekDouble>> primVar(nVar - 1), primVarFwd(nVar - 1),
714 primVarBwd(nVar - 1);
715
716 for (unsigned short d = 0; d < nVar - 2; ++d)
717 {
718 primVar[d] = Array<OneD, NekDouble>(nPts, 0.0);
719 primVarFwd[d] = Array<OneD, NekDouble>(nPtsTrc, 0.0);
720 primVarBwd[d] = Array<OneD, NekDouble>(nPtsTrc, 0.0);
721 }
722 size_t ergLoc = nVar - 2;
723 primVar[ergLoc] = Array<OneD, NekDouble>(nPts, 0.0);
724 primVarFwd[ergLoc] = Array<OneD, NekDouble>(nPtsTrc, 0.0);
725 primVarBwd[ergLoc] = Array<OneD, NekDouble>(nPtsTrc, 0.0);
726
727 // Get primitive variables [u,v,w,T=0]
728 // Possibly should be changed to [rho,u,v,w,T] to make IP and LDGNS more
729 // consistent with each other
730 for (unsigned short d = 0; d < nVar - 2; ++d)
731 {
732 // Volume
733 for (size_t p = 0; p < nPts; ++p)
734 {
735 primVar[d][p] = cnsVar[d + 1][p] / cnsVar[0][p];
736 }
737 // Trace
738 for (size_t p = 0; p < nPtsTrc; ++p)
739 {
740 primVarFwd[d][p] = cnsVarFwd[d + 1][p] / cnsVarFwd[0][p];
741 primVarBwd[d][p] = cnsVarBwd[d + 1][p] / cnsVarBwd[0][p];
742 }
743 }
744
745 // this should be allocated once
747 for (unsigned short j = 0; j < nDim; ++j)
748 {
749 primVarDer[j] = Array<OneD, Array<OneD, NekDouble>>(nVar - 1);
750 for (unsigned short i = 0; i < nVar - 1; ++i)
751 {
752 primVarDer[j][i] = Array<OneD, NekDouble>(nPts, 0.0);
753 }
754 }
755
756 // Get derivative tensor
757 m_diffusion->DiffuseCalcDerivative(fields, primVar, primVarDer, primVarFwd,
758 primVarBwd);
759
760 // Get div curl squared
761 GetDivCurlFromDvelT(primVarDer, div, curlSquare);
762}
SolverUtils::DiffusionSharedPtr m_diffusion
void GetDivCurlFromDvelT(const TensorOfArray3D< NekDouble > &pVarDer, Array< OneD, NekDouble > &div, Array< OneD, NekDouble > &curlSquare)
Get divergence and curl from velocity derivative tensor.
std::vector< double > d(NPUPPER *NPUPPER)

References Nektar::UnitTests::d(), GetDivCurlFromDvelT(), Nektar::CompressibleFlowSystem::m_diffusion, and CellMLToNektar.cellml_metadata::p.

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

◆ GetPhysicalAV()

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

◆ 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 655 of file NavierStokesCFE.cpp.

658{
659 size_t nPts = temperature.size();
660
661 for (size_t p = 0; p < nPts; ++p)
662 {
664 thermalCond[p]);
665 }
666
667 // Add artificial viscosity if wanted
668 // move this above and add in kernel
670 {
671 size_t nTracePts = m_fields[0]->GetTrace()->GetTotPoints();
672 if (nPts != nTracePts)
673 {
674 Vmath::Vadd(nPts, mu, 1, m_varConv->GetAv(), 1, mu, 1);
675 }
676 else
677 {
678 Vmath::Vadd(nPts, mu, 1, m_varConv->GetAvTrace(), 1, mu, 1);
679 }
680
681 // Update thermal conductivity
682 NekDouble tRa = m_Cp / m_Prandtl;
683 Vmath::Smul(nPts, tRa, mu, 1, thermalCond, 1);
684 }
685}
VariableConverterSharedPtr m_varConv
bool m_is_shockCaptPhys
flag for shock capturing switch on/off an enum could be added for more options
void GetViscosityAndThermalCondFromTempKernel(const T &temperature, T &mu, T &thermalCond)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
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
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 GetViscosityAndThermalCondFromTempKernel(), m_Cp, Nektar::SolverUtils::EquationSystem::m_fields, m_is_shockCaptPhys, m_Prandtl, Nektar::CompressibleFlowSystem::m_varConv, CellMLToNektar.cellml_metadata::p, Vmath::Smul(), and Vmath::Vadd().

Referenced by GetViscousFluxVectorConservVar(), GetViscousSymmtrFluxConservVar(), Nektar::NavierStokesImplicitCFE::v_CalcMuDmuDT(), Nektar::NavierStokesImplicitCFE::v_GetFluxDerivJacDirctn(), 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 186 of file NavierStokesCFE.h.

187 {
188 // Variable viscosity through the Sutherland's law
190 {
191 mu = m_varConv->GetDynamicViscosity(temperature);
192 }
193 else
194 {
195 mu = m_muRef;
196 }
197 }
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().

◆ 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 210 of file NavierStokesCFE.h.

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

References Nektar::UnitTests::d(), Nektar::CompressibleFlowSystem::m_gamma, and m_Prandtl.

Referenced by GetViscousFluxVectorConservVar(), and GetViscousSymmtrFluxConservVar().

◆ GetViscousFluxVectorConservVar() [1/2]

template<bool IS_TRACE>
void Nektar::NavierStokesCFE::GetViscousFluxVectorConservVar ( const size_t  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 
)
inlineprotected

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

Definition at line 346 of file NavierStokesCFE.h.

351 {
352 size_t nConvectiveFields = inarray.size();
353 size_t nPts = inarray[0].size();
354 size_t n_nonZero = nConvectiveFields - 1;
355
356 // max outfield dimensions
357 constexpr unsigned short nOutMax = 3 - 2 * IS_TRACE;
358 constexpr unsigned short nVarMax = 5;
359 constexpr unsigned short nDimMax = 3;
360
361 // Update viscosity and thermal conductivity
362 // unfortunately the artificial viscosity is difficult to vectorize
363 // with the current implementation
364 Array<OneD, NekDouble> temperature(nPts, 0.0);
365 Array<OneD, NekDouble> mu(nPts, 0.0);
366 Array<OneD, NekDouble> thermalConductivity(nPts, 0.0);
367 m_varConv->GetTemperature(inarray, temperature);
369 thermalConductivity);
370
371 // vector loop
372 using namespace tinysimd;
373 using vec_t = simd<NekDouble>;
374 size_t sizeVec = (nPts / vec_t::width) * vec_t::width;
375 size_t p = 0;
376
377 for (; p < sizeVec; p += vec_t::width)
378 {
379 // there is a significant penalty to use std::vector
380 alignas(vec_t::alignment) std::array<vec_t, nVarMax> inTmp,
381 qfieldsTmp, outTmp;
382 alignas(vec_t::alignment) std::array<vec_t, nDimMax> normalTmp;
383 alignas(vec_t::alignment) std::array<vec_t, nVarMax * nOutMax>
384 outArrTmp{{}};
385
386 // rearrenge and load data
387 for (size_t f = 0; f < nConvectiveFields; ++f)
388 {
389 inTmp[f].load(&(inarray[f][p]), is_not_aligned);
390 // zero output vector
391 if (IS_TRACE)
392 {
393 outArrTmp[f] = 0.0;
394 }
395 else
396 {
397 for (size_t d = 0; d < nDim; ++d)
398 {
399 outArrTmp[f + nConvectiveFields * d] = 0.0;
400 }
401 }
402 }
403 if (IS_TRACE)
404 {
405 for (size_t d = 0; d < nDim; ++d)
406 {
407 normalTmp[d].load(&(normal[d][p]), is_not_aligned);
408 }
409 }
410
411 // get viscosity
412 vec_t muV{};
413 muV.load(&(mu[p]), is_not_aligned);
414
415 for (size_t nderiv = 0; nderiv < nDim; ++nderiv)
416 {
417 // rearrenge and load data
418 for (size_t f = 0; f < nConvectiveFields; ++f)
419 {
420 qfieldsTmp[f].load(&(qfields[nderiv][f][p]),
422 }
423
424 for (size_t d = 0; d < nDim; ++d)
425 {
427 nDim, d, nderiv, inTmp.data(), qfieldsTmp.data(), muV,
428 outTmp.data());
429
430 if (IS_TRACE)
431 {
432 for (size_t f = 0; f < nConvectiveFields; ++f)
433 {
434 outArrTmp[f] += normalTmp[d] * outTmp[f];
435 }
436 }
437 else
438 {
439 for (size_t f = 0; f < nConvectiveFields; ++f)
440 {
441 outArrTmp[f + nConvectiveFields * d] += outTmp[f];
442 }
443 }
444 }
445 }
446
447 // store data
448 if (IS_TRACE)
449 {
450 for (size_t f = 0; f < nConvectiveFields; ++f)
451 {
452 outArrTmp[f].store(&(outarray[0][f][p]), is_not_aligned);
453 }
454 }
455 else
456 {
457 for (size_t d = 0; d < nDim; ++d)
458 {
459 for (size_t f = 0; f < nConvectiveFields; ++f)
460 {
461 outArrTmp[f + nConvectiveFields * d].store(
462 &(outarray[d][f][p]), is_not_aligned);
463 }
464 }
465 }
466 }
467
468 // scalar loop
469 for (; p < nPts; ++p)
470 {
471 std::array<NekDouble, nVarMax> inTmp, qfieldsTmp, outTmp;
472 std::array<NekDouble, nDimMax> normalTmp;
473 std::array<NekDouble, nVarMax * nOutMax> outArrTmp{{}};
474 // rearrenge and load data
475 for (size_t f = 0; f < nConvectiveFields; ++f)
476 {
477 inTmp[f] = inarray[f][p];
478 // zero output vector
479 if (IS_TRACE)
480 {
481 outArrTmp[f] = 0.0;
482 }
483 else
484 {
485 for (size_t d = 0; d < nDim; ++d)
486 {
487 outArrTmp[f + nConvectiveFields * d] = 0.0;
488 }
489 }
490 }
491
492 if (IS_TRACE)
493 {
494 for (size_t d = 0; d < nDim; ++d)
495 {
496 normalTmp[d] = normal[d][p];
497 }
498 }
499
500 // get viscosity
501 NekDouble muS = mu[p];
502
503 for (size_t nderiv = 0; nderiv < nDim; ++nderiv)
504 {
505 // rearrenge and load data
506 for (size_t f = 0; f < nConvectiveFields; ++f)
507 {
508 qfieldsTmp[f] = qfields[nderiv][f][p];
509 }
510
511 for (size_t d = 0; d < nDim; ++d)
512 {
514 nDim, d, nderiv, inTmp.data(), qfieldsTmp.data(), muS,
515 outTmp.data());
516
517 if (IS_TRACE)
518 {
519 for (size_t f = 0; f < nConvectiveFields; ++f)
520 {
521 outArrTmp[f] += normalTmp[d] * outTmp[f];
522 }
523 }
524 else
525 {
526 for (size_t f = 0; f < nConvectiveFields; ++f)
527 {
528 outArrTmp[f + nConvectiveFields * d] += outTmp[f];
529 }
530 }
531 }
532 }
533
534 // store data
535 if (IS_TRACE)
536 {
537 for (size_t f = 0; f < nConvectiveFields; ++f)
538 {
539 outarray[0][f][p] = outArrTmp[f];
540 }
541 }
542 else
543 {
544 for (size_t d = 0; d < nDim; ++d)
545 {
546 for (size_t f = 0; f < nConvectiveFields; ++f)
547 {
548 outarray[d][f][p] =
549 outArrTmp[f + nConvectiveFields * d];
550 }
551 }
552 }
553 }
554
555 // this is always the same, it should be initialized with the IP class
556 nonZeroIndex = Array<OneD, int>{n_nonZero, 0};
557 for (int i = 1; i < n_nonZero + 1; ++i)
558 {
559 nonZeroIndex[n_nonZero - i] = nConvectiveFields - i;
560 }
561 }
void GetViscosityAndThermalCondFromTemp(const Array< OneD, NekDouble > &temperature, Array< OneD, NekDouble > &mu, Array< OneD, NekDouble > &thermalCond)
Update viscosity todo: add artificial viscosity here.
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, width >::type simd
Definition: tinysimd.hpp:80

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

◆ GetViscousFluxVectorConservVar() [2/2]

void Nektar::NavierStokesCFE::GetViscousFluxVectorConservVar ( const size_t  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 
)
protected

◆ GetViscousSymmtrFluxConservVar()

void Nektar::NavierStokesCFE::GetViscousSymmtrFluxConservVar ( const size_t  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 561 of file NavierStokesCFE.cpp.

566{
567 size_t nConvectiveFields = inarray.size();
568 size_t nPts = inaverg[nConvectiveFields - 1].size();
569 nonZeroIndex = Array<OneD, int>{nConvectiveFields - 1, 0};
570 for (size_t i = 0; i < nConvectiveFields - 1; ++i)
571 {
572 nonZeroIndex[i] = i + 1;
573 }
574
575 Array<OneD, NekDouble> mu(nPts, 0.0);
576 Array<OneD, NekDouble> thermalConductivity(nPts, 0.0);
577 Array<OneD, NekDouble> temperature(nPts, 0.0);
578 m_varConv->GetTemperature(inaverg, temperature);
579 GetViscosityAndThermalCondFromTemp(temperature, mu, thermalConductivity);
580
581 std::vector<NekDouble> inAvgTmp(nConvectiveFields);
582 std::vector<NekDouble> inTmp(nConvectiveFields);
583 std::vector<NekDouble> outTmp(nConvectiveFields);
584 for (size_t d = 0; d < nDim; ++d)
585 {
586 for (size_t nderiv = 0; nderiv < nDim; ++nderiv)
587 {
588 for (size_t p = 0; p < nPts; ++p)
589 {
590 // rearrenge data
591 for (size_t f = 0; f < nConvectiveFields; ++f)
592 {
593 inAvgTmp[f] = inaverg[f][p];
594 inTmp[f] = inarray[f][p];
595 }
596
598 inAvgTmp.data(), inTmp.data(),
599 mu[p], outTmp.data());
600
601 for (size_t f = 0; f < nConvectiveFields; ++f)
602 {
603 outarray[d][f][p] += normal[nderiv][p] * outTmp[f];
604 }
605 }
606 }
607 }
608}

References Nektar::UnitTests::d(), GetViscosityAndThermalCondFromTemp(), 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 65 of file NavierStokesCFE.cpp.

66{
67 // Get gas constant from session file and compute Cp
68 NekDouble gasConstant;
69 m_session->LoadParameter("GasConstant", gasConstant, 287.058);
70 m_Cp = m_gamma / (m_gamma - 1.0) * gasConstant;
71 m_Cv = m_Cp / m_gamma;
72
73 m_session->LoadParameter("Twall", m_Twall, 300.15);
74
75 // Viscosity
76 m_session->LoadSolverInfo("ViscosityType", m_ViscosityType, "Constant");
77 m_session->LoadParameter("mu", m_muRef, 1.78e-05);
78 if (m_ViscosityType == "Variable")
79 {
80 m_is_mu_variable = true;
81 }
82
83 // Thermal conductivity or Prandtl
84 if (m_session->DefinesParameter("thermalConductivity"))
85 {
86 ASSERTL0(!m_session->DefinesParameter("Pr"),
87 "Cannot define both Pr and thermalConductivity.");
88
89 m_session->LoadParameter("thermalConductivity",
92 }
93 else
94 {
95 m_session->LoadParameter("Pr", m_Prandtl, 0.72);
97 }
98
99 if (m_shockCaptureType == "Physical")
100 {
101 m_is_shockCaptPhys = true;
102 }
103
104 string diffName;
105 m_session->LoadSolverInfo("DiffusionType", diffName, "LDGNS");
106
109 if ("InteriorPenalty" == diffName)
110 {
111 m_is_diffIP = true;
113 }
114
115 if ("LDGNS" == diffName || "LDGNS3DHomogeneous1D" == diffName)
116 {
117 m_diffusion->SetFluxPenaltyNS(&NavierStokesCFE::v_GetFluxPenalty, this);
118 }
119
121 {
122 m_diffusion->SetFluxVectorNS(
124 }
125 else
126 {
128 this);
129 }
130
131 m_diffusion->SetDiffusionFluxCons(
132 &NavierStokesCFE::GetViscousFluxVectorConservVar<false>, this);
133
134 m_diffusion->SetDiffusionFluxConsTrace(
135 &NavierStokesCFE::GetViscousFluxVectorConservVar<true>, this);
136
137 m_diffusion->SetSpecialBndTreat(&NavierStokesCFE::SpecialBndTreat, this);
138
139 m_diffusion->SetDiffusionSymmFluxCons(
141
142 // Concluding initialisation of diffusion operator
143 m_diffusion->InitObject(m_session, m_fields);
144}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
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:143
void SpecialBndTreat(Array< OneD, Array< OneD, NekDouble > > &consvar)
For very special treatment. For general boundaries it does nothing But for WallViscous and WallAdiaba...
NekDouble m_thermalConductivityRef
void GetViscousSymmtrFluxConservVar(const size_t 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.
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.
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.
bool m_is_diffIP
flag to switch between IP and LDG an enum could be added for more options
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_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:39

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::SolverUtils::GetDiffusionFactory(), GetViscousSymmtrFluxConservVar(), m_Cp, m_Cv, Nektar::CompressibleFlowSystem::m_diffusion, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::CompressibleFlowSystem::m_gamma, m_is_diffIP, m_is_mu_variable, m_is_shockCaptPhys, m_muRef, m_Prandtl, Nektar::SolverUtils::EquationSystem::m_session, Nektar::CompressibleFlowSystem::m_shockCaptureType, Nektar::SolverUtils::EquationSystem::m_specHP_dealiasing, 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 472 of file NavierStokesCFE.cpp.

474{
475 size_t nConvectiveFields = consvar.size();
476 size_t ndens = 0;
477 size_t nengy = nConvectiveFields - 1;
478
479 Array<OneD, Array<OneD, NekDouble>> bndCons{nConvectiveFields};
480 Array<OneD, NekDouble> bndTotEngy;
481 Array<OneD, NekDouble> bndPressure;
483 Array<OneD, NekDouble> bndIntEndy;
484 size_t nLengthArray = 0;
485
486 size_t cnt = 0;
487 size_t nBndRegions = m_fields[nengy]->GetBndCondExpansions().size();
488 for (size_t j = 0; j < nBndRegions; ++j)
489 {
490 if (m_fields[nengy]
491 ->GetBndConditions()[j]
492 ->GetBoundaryConditionType() == SpatialDomains::ePeriodic)
493 {
494 continue;
495 }
496
497 size_t nBndEdges =
498 m_fields[nengy]->GetBndCondExpansions()[j]->GetExpSize();
499 for (size_t e = 0; e < nBndEdges; ++e)
500 {
501 size_t nBndEdgePts = m_fields[nengy]
502 ->GetBndCondExpansions()[j]
503 ->GetExp(e)
504 ->GetTotPoints();
505
506 int id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
507 m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt++));
508
509 // Imposing Temperature Twall at the wall
510 if (boost::iequals(
511 m_fields[nengy]->GetBndConditions()[j]->GetUserDefined(),
512 "WallViscous"))
513 {
514 if (nBndEdgePts != nLengthArray)
515 {
516 for (size_t i = 0; i < nConvectiveFields; ++i)
517 {
518 bndCons[i] = Array<OneD, NekDouble>{nBndEdgePts, 0.0};
519 }
520 bndTotEngy = Array<OneD, NekDouble>{nBndEdgePts, 0.0};
521 bndPressure = Array<OneD, NekDouble>{nBndEdgePts, 0.0};
522 bndRho = Array<OneD, NekDouble>{nBndEdgePts, 0.0};
523 bndIntEndy = Array<OneD, NekDouble>{nBndEdgePts, 0.0};
524 nLengthArray = nBndEdgePts;
525 }
526 else
527 {
528 Vmath::Zero(nLengthArray, bndPressure, 1);
529 Vmath::Zero(nLengthArray, bndRho, 1);
530 Vmath::Zero(nLengthArray, bndIntEndy, 1);
531 }
532
534
535 for (size_t k = 0; k < nConvectiveFields; ++k)
536 {
537 Vmath::Vcopy(nBndEdgePts, tmp = consvar[k] + id2, 1,
538 bndCons[k], 1);
539 }
540
541 m_varConv->GetPressure(bndCons, bndPressure);
542 Vmath::Fill(nLengthArray, m_Twall, bndTotEngy, 1);
543 m_varConv->GetRhoFromPT(bndPressure, bndTotEngy, bndRho);
544 m_varConv->GetEFromRhoP(bndRho, bndPressure, bndIntEndy);
545 m_varConv->GetDynamicEnergy(bndCons, bndTotEngy);
546
547 Vmath::Vvtvp(nBndEdgePts, bndIntEndy, 1, bndCons[ndens], 1,
548 bndTotEngy, 1, bndTotEngy, 1);
549
550 Vmath::Vcopy(nBndEdgePts, bndTotEngy, 1,
551 tmp = consvar[nengy] + id2, 1);
552 }
553 }
554 }
555}
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
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References Nektar::SpatialDomains::ePeriodic, Vmath::Fill(), 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, Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const Array< OneD, Array< OneD, NekDouble > > &  pFwd,
const Array< OneD, Array< OneD, NekDouble > > &  pBwd 
)
overrideprotectedvirtual

Implements Nektar::CompressibleFlowSystem.

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

Definition at line 146 of file NavierStokesCFE.cpp.

151{
152 size_t nvariables = inarray.size();
153 size_t npoints = GetNpoints();
154 size_t nTracePts = GetTraceTotPoints();
155
156 // this should be preallocated
157 Array<OneD, Array<OneD, NekDouble>> outarrayDiff(nvariables);
158 for (size_t i = 0; i < nvariables; ++i)
159 {
160 outarrayDiff[i] = Array<OneD, NekDouble>(npoints, 0.0);
161 }
162
163 // Set artificial viscosity based on NS viscous tensor
165 {
166 if (m_varConv->GetFlagCalcDivCurl())
167 {
168 Array<OneD, NekDouble> div(npoints), curlSquare(npoints);
169 GetDivCurlSquared(m_fields, inarray, div, curlSquare, pFwd, pBwd);
170
171 // Set volume and trace artificial viscosity
172 m_varConv->SetAv(m_fields, inarray, div, curlSquare);
173 }
174 else
175 {
176 m_varConv->SetAv(m_fields, inarray);
177 }
178 }
179
180 if (m_is_diffIP)
181 {
182 if (m_bndEvaluateTime < 0.0)
183 {
184 NEKERROR(ErrorUtil::efatal, "m_bndEvaluateTime not setup");
185 }
186 m_diffusion->Diffuse(nvariables, m_fields, inarray, outarrayDiff,
187 m_bndEvaluateTime, pFwd, pBwd);
188 for (size_t i = 0; i < nvariables; ++i)
189 {
190 Vmath::Vadd(npoints, outarrayDiff[i], 1, outarray[i], 1,
191 outarray[i], 1);
192 }
193 }
194 else
195 {
196 // Get primitive variables [u,v,w,T]
197 Array<OneD, Array<OneD, NekDouble>> inarrayDiff(nvariables - 1);
198 Array<OneD, Array<OneD, NekDouble>> inFwd(nvariables - 1);
199 Array<OneD, Array<OneD, NekDouble>> inBwd(nvariables - 1);
200
201 for (size_t i = 0; i < nvariables - 1; ++i)
202 {
203 inarrayDiff[i] = Array<OneD, NekDouble>{npoints};
204 inFwd[i] = Array<OneD, NekDouble>{nTracePts};
205 inBwd[i] = Array<OneD, NekDouble>{nTracePts};
206 }
207
208 // Extract pressure
209 // (use inarrayDiff[0] as a temporary storage for the pressure)
210 m_varConv->GetPressure(inarray, inarrayDiff[0]);
211
212 // Extract temperature
213 m_varConv->GetTemperature(inarray, inarrayDiff[nvariables - 2]);
214
215 // Extract velocities
216 m_varConv->GetVelocityVector(inarray, inarrayDiff);
217
218 // Repeat calculation for trace space
219 if (pFwd == NullNekDoubleArrayOfArray ||
221 {
224 }
225 else
226 {
227 m_varConv->GetPressure(pFwd, inFwd[0]);
228 m_varConv->GetPressure(pBwd, inBwd[0]);
229
230 m_varConv->GetTemperature(pFwd, inFwd[nvariables - 2]);
231 m_varConv->GetTemperature(pBwd, inBwd[nvariables - 2]);
232
233 m_varConv->GetVelocityVector(pFwd, inFwd);
234 m_varConv->GetVelocityVector(pBwd, inBwd);
235 }
236
237 // Diffusion term in physical rhs form
238 m_diffusion->Diffuse(nvariables, m_fields, inarrayDiff, outarrayDiff,
239 inFwd, inBwd);
240
241 for (size_t i = 0; i < nvariables; ++i)
242 {
243 Vmath::Vadd(npoints, outarrayDiff[i], 1, outarray[i], 1,
244 outarray[i], 1);
245 }
246 }
247
248 // Add artificial diffusion through Laplacian operator
250 {
251 m_artificialDiffusion->DoArtificialDiffusion(inarray, outarray);
252 }
253}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
ArtificialDiffusionSharedPtr m_artificialDiffusion
void GetDivCurlSquared(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &cnsVar, Array< OneD, NekDouble > &div, Array< OneD, NekDouble > &curlSquare, const Array< OneD, Array< OneD, NekDouble > > &cnsVarFwd, const Array< OneD, Array< OneD, NekDouble > > &cnsVarBwd)
Get divergence and curl squared.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT int GetNpoints()
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray

References Nektar::ErrorUtil::efatal, GetDivCurlSquared(), Nektar::SolverUtils::EquationSystem::GetNpoints(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::CompressibleFlowSystem::m_artificialDiffusion, Nektar::CompressibleFlowSystem::m_bndEvaluateTime, Nektar::CompressibleFlowSystem::m_diffusion, Nektar::SolverUtils::EquationSystem::m_fields, m_is_diffIP, m_is_shockCaptPhys, 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 
)
overrideprotectedvirtual

Reimplemented from Nektar::CompressibleFlowSystem.

Definition at line 838 of file NavierStokesCFE.cpp.

841{
842 bool extraFields;
843 m_session->MatchSolverInfo("OutputExtraFields", "True", extraFields, true);
844 if (extraFields)
845 {
846 const int nPhys = m_fields[0]->GetNpoints();
847 const int nCoeffs = m_fields[0]->GetNcoeffs();
849
850 for (size_t i = 0; i < m_fields.size(); ++i)
851 {
852 cnsVar[i] = m_fields[i]->GetPhys();
853 }
854
857 for (int i = 0; i < m_spacedim; ++i)
858 {
860 velFwd[i] = Array<OneD, NekDouble>(nCoeffs);
861 }
862
863 Array<OneD, NekDouble> pressure(nPhys), temperature(nPhys);
864 Array<OneD, NekDouble> entropy(nPhys);
865 Array<OneD, NekDouble> soundspeed(nPhys), mach(nPhys);
866 Array<OneD, NekDouble> sensor(nPhys), SensorKappa(nPhys);
867
868 m_varConv->GetVelocityVector(cnsVar, velocity);
869 m_varConv->GetPressure(cnsVar, pressure);
870 m_varConv->GetTemperature(cnsVar, temperature);
871 m_varConv->GetEntropy(cnsVar, entropy);
872 m_varConv->GetSoundSpeed(cnsVar, soundspeed);
873 m_varConv->GetMach(cnsVar, soundspeed, mach);
874
875 int sensorOffset;
876 m_session->LoadParameter("SensorOffset", sensorOffset, 1);
877 m_varConv->GetSensor(m_fields[0], cnsVar, sensor, SensorKappa,
878 sensorOffset);
879
880 Array<OneD, NekDouble> pFwd(nCoeffs), TFwd(nCoeffs);
881 Array<OneD, NekDouble> sFwd(nCoeffs);
882 Array<OneD, NekDouble> aFwd(nCoeffs), mFwd(nCoeffs);
883 Array<OneD, NekDouble> sensFwd(nCoeffs);
884
885 string velNames[3] = {"u", "v", "w"};
886 for (int i = 0; i < m_spacedim; ++i)
887 {
888 m_fields[0]->FwdTransLocalElmt(velocity[i], velFwd[i]);
889 variables.push_back(velNames[i]);
890 fieldcoeffs.push_back(velFwd[i]);
891 }
892
893 m_fields[0]->FwdTransLocalElmt(pressure, pFwd);
894 m_fields[0]->FwdTransLocalElmt(temperature, TFwd);
895 m_fields[0]->FwdTransLocalElmt(entropy, sFwd);
896 m_fields[0]->FwdTransLocalElmt(soundspeed, aFwd);
897 m_fields[0]->FwdTransLocalElmt(mach, mFwd);
898 m_fields[0]->FwdTransLocalElmt(sensor, sensFwd);
899
900 variables.push_back("p");
901 variables.push_back("T");
902 variables.push_back("s");
903 variables.push_back("a");
904 variables.push_back("Mach");
905 variables.push_back("Sensor");
906 fieldcoeffs.push_back(pFwd);
907 fieldcoeffs.push_back(TFwd);
908 fieldcoeffs.push_back(sFwd);
909 fieldcoeffs.push_back(aFwd);
910 fieldcoeffs.push_back(mFwd);
911 fieldcoeffs.push_back(sensFwd);
912
914 {
915 // reuse pressure
916 Array<OneD, NekDouble> sensorFwd(nCoeffs);
917 m_artificialDiffusion->GetArtificialViscosity(cnsVar, pressure);
918 m_fields[0]->FwdTransLocalElmt(pressure, sensorFwd);
919
920 variables.push_back("ArtificialVisc");
921 fieldcoeffs.push_back(sensorFwd);
922 }
923
925 {
926
928 cnsVarBwd(m_fields.size());
929
930 for (size_t i = 0; i < m_fields.size(); ++i)
931 {
934 m_fields[i]->GetFwdBwdTracePhys(cnsVar[i], cnsVarFwd[i],
935 cnsVarBwd[i]);
936 }
937
938 Array<OneD, NekDouble> div(nPhys), curlSquare(nPhys);
939 GetDivCurlSquared(m_fields, cnsVar, div, curlSquare, cnsVarFwd,
940 cnsVarBwd);
941
942 Array<OneD, NekDouble> divFwd(nCoeffs, 0.0);
943 m_fields[0]->FwdTransLocalElmt(div, divFwd);
944 variables.push_back("div");
945 fieldcoeffs.push_back(divFwd);
946
947 Array<OneD, NekDouble> curlFwd(nCoeffs, 0.0);
948 m_fields[0]->FwdTransLocalElmt(curlSquare, curlFwd);
949 variables.push_back("curl^2");
950 fieldcoeffs.push_back(curlFwd);
951
952 m_varConv->SetAv(m_fields, cnsVar, div, curlSquare);
953
954 Array<OneD, NekDouble> muavFwd(nCoeffs);
955 m_fields[0]->FwdTransLocalElmt(m_varConv->GetAv(), muavFwd);
956 variables.push_back("ArtificialVisc");
957 fieldcoeffs.push_back(muavFwd);
958 }
959 }
960}
int m_spacedim
Spatial dimension (>= expansion dim).
const std::vector< NekDouble > velocity

References GetDivCurlSquared(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::CompressibleFlowSystem::m_artificialDiffusion, Nektar::SolverUtils::EquationSystem::m_fields, m_is_shockCaptPhys, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::CompressibleFlowSystem::m_varConv, CG_Iterations::pressure, and Nektar::MovementTests::velocity.

◆ 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 613 of file NavierStokesCFE.cpp.

617{
618 size_t nTracePts = uFwd[0].size();
619
620 // Compute average temperature
621 size_t nVariables = uFwd.size();
622 Array<OneD, NekDouble> tAve{nTracePts, 0.0};
623 Vmath::Svtsvtp(nTracePts, 0.5, uFwd[nVariables - 1], 1, 0.5,
624 uBwd[nVariables - 1], 1, tAve, 1);
625
626 // Get average viscosity and thermal conductivity
627 Array<OneD, NekDouble> muAve{nTracePts, 0.0};
628 Array<OneD, NekDouble> tcAve{nTracePts, 0.0};
629
630 GetViscosityAndThermalCondFromTemp(tAve, muAve, tcAve);
631
632 // Compute penalty term
633 for (size_t i = 0; i < nVariables; ++i)
634 {
635 // Get jump of u variables
636 Vmath::Vsub(nTracePts, uFwd[i], 1, uBwd[i], 1, penaltyCoeff[i], 1);
637 // Multiply by variable coefficient = {coeff} ( u^+ - u^- )
638 if (i < nVariables - 1)
639 {
640 Vmath::Vmul(nTracePts, muAve, 1, penaltyCoeff[i], 1,
641 penaltyCoeff[i], 1);
642 }
643 else
644 {
645 Vmath::Vmul(nTracePts, tcAve, 1, penaltyCoeff[i], 1,
646 penaltyCoeff[i], 1);
647 }
648 }
649}
void Svtsvtp(int n, const T alpha, const T *x, int incx, const T beta, const T *y, int incy, T *z, int incz)
Svtsvtp (scalar times vector plus scalar times vector):
Definition: Vmath.hpp:473
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
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 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 259 of file NavierStokesCFE.cpp.

263{
264 // Auxiliary variables
265 size_t nScalar = physfield.size();
266 size_t nPts = physfield[0].size();
267 Array<OneD, NekDouble> divVel(nPts, 0.0);
268
269 // Stokes hypothesis
270 const NekDouble lambda = -2.0 / 3.0;
271
272 // Update viscosity and thermal conductivity
273 Array<OneD, NekDouble> mu(nPts, 0.0);
274 Array<OneD, NekDouble> thermalConductivity(nPts, 0.0);
275 GetViscosityAndThermalCondFromTemp(physfield[nScalar - 1], mu,
276 thermalConductivity);
277
278 // Velocity divergence
279 for (int j = 0; j < m_spacedim; ++j)
280 {
281 Vmath::Vadd(nPts, divVel, 1, derivativesO1[j][j], 1, divVel, 1);
282 }
283
284 // Velocity divergence scaled by lambda * mu
285 Vmath::Smul(nPts, lambda, divVel, 1, divVel, 1);
286 Vmath::Vmul(nPts, mu, 1, divVel, 1, divVel, 1);
287
288 // Viscous flux vector for the rho equation = 0
289 for (int i = 0; i < m_spacedim; ++i)
290 {
291 Vmath::Zero(nPts, viscousTensor[i][0], 1);
292 }
293
294 // Viscous stress tensor (for the momentum equations)
295 for (int i = 0; i < m_spacedim; ++i)
296 {
297 for (int j = i; j < m_spacedim; ++j)
298 {
299 Vmath::Vadd(nPts, derivativesO1[i][j], 1, derivativesO1[j][i], 1,
300 viscousTensor[i][j + 1], 1);
301
302 Vmath::Vmul(nPts, mu, 1, viscousTensor[i][j + 1], 1,
303 viscousTensor[i][j + 1], 1);
304
305 if (i == j)
306 {
307 // Add divergence term to diagonal
308 Vmath::Vadd(nPts, viscousTensor[i][j + 1], 1, divVel, 1,
309 viscousTensor[i][j + 1], 1);
310 }
311 else
312 {
313 // Copy to make symmetric
314 Vmath::Vcopy(nPts, viscousTensor[i][j + 1], 1,
315 viscousTensor[j][i + 1], 1);
316 }
317 }
318 }
319
320 // Terms for the energy equation
321 for (int i = 0; i < m_spacedim; ++i)
322 {
323 Vmath::Zero(nPts, viscousTensor[i][m_spacedim + 1], 1);
324 // u_j * tau_ij
325 for (int j = 0; j < m_spacedim; ++j)
326 {
327 Vmath::Vvtvp(nPts, physfield[j], 1, viscousTensor[i][j + 1], 1,
328 viscousTensor[i][m_spacedim + 1], 1,
329 viscousTensor[i][m_spacedim + 1], 1);
330 }
331 // Add k*T_i
332 Vmath::Vvtvp(nPts, thermalConductivity, 1, derivativesO1[i][m_spacedim],
333 1, viscousTensor[i][m_spacedim + 1], 1,
334 viscousTensor[i][m_spacedim + 1], 1);
335 }
336}

References GetViscosityAndThermalCondFromTemp(), Nektar::SolverUtils::EquationSystem::m_spacedim, 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 342 of file NavierStokesCFE.cpp.

346{
347 // Factor to rescale 1d points in dealiasing.
348 NekDouble OneDptscale = 2;
349 // Get number of points to dealias a cubic non-linearity
350 size_t nScalar = physfield.size();
351 size_t nPts = m_fields[0]->Get1DScaledTotPoints(OneDptscale);
352 size_t nPts_orig = physfield[0].size();
353
354 // Auxiliary variables
355 Array<OneD, NekDouble> divVel(nPts, 0.0);
356
357 // Stokes hypothesis
358 const NekDouble lambda = -2.0 / 3.0;
359
360 // Update viscosity and thermal conductivity
361 Array<OneD, NekDouble> mu(nPts, 0.0);
362 Array<OneD, NekDouble> thermalConductivity(nPts, 0.0);
363 GetViscosityAndThermalCondFromTemp(physfield[nScalar - 1], mu,
364 thermalConductivity);
365
366 // Interpolate inputs and initialise interpolated output
370 for (int i = 0; i < m_spacedim; ++i)
371 {
372 // Interpolate velocity
373 vel_interp[i] = Array<OneD, NekDouble>(nPts);
374 m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i],
375 vel_interp[i]);
376
377 // Interpolate derivatives
378 deriv_interp[i] = Array<OneD, Array<OneD, NekDouble>>(m_spacedim + 1);
379 for (int j = 0; j < m_spacedim + 1; ++j)
380 {
381 deriv_interp[i][j] = Array<OneD, NekDouble>(nPts);
382 m_fields[0]->PhysInterp1DScaled(OneDptscale, derivativesO1[i][j],
383 deriv_interp[i][j]);
384 }
385
386 // Output (start from j=1 since flux is zero for rho)
388 for (int j = 1; j < m_spacedim + 2; ++j)
389 {
390 out_interp[i][j] = Array<OneD, NekDouble>(nPts);
391 }
392 }
393
394 // Velocity divergence
395 for (int j = 0; j < m_spacedim; ++j)
396 {
397 Vmath::Vadd(nPts, divVel, 1, deriv_interp[j][j], 1, divVel, 1);
398 }
399
400 // Velocity divergence scaled by lambda * mu
401 Vmath::Smul(nPts, lambda, divVel, 1, divVel, 1);
402 Vmath::Vmul(nPts, mu, 1, divVel, 1, divVel, 1);
403
404 // Viscous flux vector for the rho equation = 0 (no need to dealias)
405 for (int i = 0; i < m_spacedim; ++i)
406 {
407 Vmath::Zero(nPts_orig, viscousTensor[i][0], 1);
408 }
409
410 // Viscous stress tensor (for the momentum equations)
411 for (int i = 0; i < m_spacedim; ++i)
412 {
413 for (int j = i; j < m_spacedim; ++j)
414 {
415 Vmath::Vadd(nPts, deriv_interp[i][j], 1, deriv_interp[j][i], 1,
416 out_interp[i][j + 1], 1);
417
418 Vmath::Vmul(nPts, mu, 1, out_interp[i][j + 1], 1,
419 out_interp[i][j + 1], 1);
420
421 if (i == j)
422 {
423 // Add divergence term to diagonal
424 Vmath::Vadd(nPts, out_interp[i][j + 1], 1, divVel, 1,
425 out_interp[i][j + 1], 1);
426 }
427 else
428 {
429 // Make symmetric
430 out_interp[j][i + 1] = out_interp[i][j + 1];
431 }
432 }
433 }
434
435 // Terms for the energy equation
436 for (int i = 0; i < m_spacedim; ++i)
437 {
438 Vmath::Zero(nPts, out_interp[i][m_spacedim + 1], 1);
439 // u_j * tau_ij
440 for (int j = 0; j < m_spacedim; ++j)
441 {
442 Vmath::Vvtvp(nPts, vel_interp[j], 1, out_interp[i][j + 1], 1,
443 out_interp[i][m_spacedim + 1], 1,
444 out_interp[i][m_spacedim + 1], 1);
445 }
446 // Add k*T_i
447 Vmath::Vvtvp(nPts, thermalConductivity, 1, deriv_interp[i][m_spacedim],
448 1, out_interp[i][m_spacedim + 1], 1,
449 out_interp[i][m_spacedim + 1], 1);
450 }
451
452 // Project to original space
453 for (int i = 0; i < m_spacedim; ++i)
454 {
455 for (int j = 1; j < m_spacedim + 2; ++j)
456 {
457 m_fields[0]->PhysGalerkinProjection1DScaled(
458 OneDptscale, out_interp[i][j], viscousTensor[i][j]);
459 }
460 }
461}

References GetViscosityAndThermalCondFromTemp(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Smul(), Vmath::Vadd(), Vmath::Vmul(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by InitObject_Explicit().

◆ v_InitObject()

void Nektar::NavierStokesCFE::v_InitObject ( bool  DeclareField = true)
overrideprotectedvirtual

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::CompressibleFlowSystem.

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

Definition at line 56 of file NavierStokesCFE.cpp.

57{
59
60 // rest of initialisation is in this routine so it can also be called
61 // in NavierStokesImplicitCFE initialisation
63}
void v_InitObject(bool DeclareFields=true) override
Initialization object for CompressibleFlowSystem class.

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

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

◆ v_SupportsShockCaptType()

bool Nektar::NavierStokesCFE::v_SupportsShockCaptType ( const std::string  type) const
overrideprotectedvirtual

Implements Nektar::CompressibleFlowSystem.

Reimplemented in Nektar::NavierStokesImplicitCFE.

Definition at line 962 of file NavierStokesCFE.cpp.

963{
964 if (type == "NonSmooth" || type == "Physical" || type == "Off")
965 {
966 return true;
967 }
968 else
969 {
970 return false;
971 }
972}

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:197
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 87 of file NavierStokesCFE.h.

◆ 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 90 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(), Nektar::NavierStokesImplicitCFE::v_CalcPhysDeriv(), 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_is_shockCaptPhys

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

flag for shock capturing switch on/off an enum could be added for more options

Definition at line 79 of file NavierStokesCFE.h.

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

◆ m_muRef

NekDouble Nektar::NavierStokesCFE::m_muRef
protected

Definition at line 93 of file NavierStokesCFE.h.

Referenced by GetViscosityFromTempKernel(), and InitObject_Explicit().

◆ m_physicalSensorType

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

Definition at line 85 of file NavierStokesCFE.h.

◆ m_Prandtl

NekDouble Nektar::NavierStokesCFE::m_Prandtl
protected

◆ m_smoothing

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

Definition at line 86 of file NavierStokesCFE.h.

◆ m_thermalConductivityRef

NekDouble Nektar::NavierStokesCFE::m_thermalConductivityRef
protected

Definition at line 94 of file NavierStokesCFE.h.

Referenced by InitObject_Explicit().

◆ m_Twall

NekDouble Nektar::NavierStokesCFE::m_Twall
protected

Definition at line 92 of file NavierStokesCFE.h.

Referenced by InitObject_Explicit(), and SpecialBndTreat().

◆ m_ViscosityType

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