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

#include <CompressibleFlowSystem.h>

Inheritance diagram for Nektar::CompressibleFlowSystem:
[legend]

Public Member Functions

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...
 
virtual void GetPressure (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &pressure)
 Extract array with pressure from physfield. More...
 
virtual void GetDensity (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &density)
 Extract array with density from physfield. More...
 
virtual bool HasConstantDensity ()
 
virtual void GetVelocity (const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &velocity)
 Extract array with velocity from physfield. More...
 
- 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 (bool DeclareField=true)
 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 Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals ()
 
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 SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void SetMovingFrameProjectionMat (const boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void GetMovingFrameProjectionMat (boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void SetMovingFrameAngles (const Array< OneD, NekDouble > &vFrameTheta)
 
virtual SOLVER_UTILS_EXPORT void GetMovingFrameAngles (Array< OneD, NekDouble > &vFrameTheta)
 

Protected Member Functions

 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
virtual void v_InitObject (bool DeclareFields=true)
 Initialization object for CompressibleFlowSystem class. More...
 
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...
 
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 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)
 Apply artificial diffusion (Laplacian operator) More...
 
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 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

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...
 
Array< OneD, NekDoublem_movingFrameVelsxyz
 Moving frame of reference velocities. More...
 
Array< OneD, NekDoublem_movingFrameTheta
 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< CompressibleFlowSystem >
 

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...
 
- Static Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
static std::string cmdSetStartTime
 
static std::string cmdSetStartChkNum
 
- 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 60 of file CompressibleFlowSystem.h.

Constructor & Destructor Documentation

◆ ~CompressibleFlowSystem()

Nektar::CompressibleFlowSystem::~CompressibleFlowSystem ( )
virtual

Destructor for CompressibleFlowSystem class.

Definition at line 129 of file CompressibleFlowSystem.cpp.

130 {
131 }

◆ CompressibleFlowSystem()

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

Definition at line 45 of file CompressibleFlowSystem.cpp.

48  : UnsteadySystem(pSession, pGraph), AdvectionSystem(pSession, pGraph)
49 {
50 }
SOLVER_UTILS_EXPORT AdvectionSystem(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

◆ DoAdvection()

void Nektar::CompressibleFlowSystem::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 
)
protected

Compute the advection terms for the right-hand side.

Definition at line 336 of file CompressibleFlowSystem.cpp.

341 {
342  int nvariables = inarray.size();
343  Array<OneD, Array<OneD, NekDouble>> advVel(m_spacedim);
344 
345  m_advObject->Advect(nvariables, m_fields, advVel, inarray, outarray, time,
346  pFwd, pBwd);
347 }
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
int m_spacedim
Spatial dimension (>= expansion dim).
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.

References Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::SolverUtils::EquationSystem::m_fields, and Nektar::SolverUtils::EquationSystem::m_spacedim.

Referenced by DoOdeRhs().

◆ DoDiffusion()

void Nektar::CompressibleFlowSystem::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 
)
protected

Add the diffusions terms to the right-hand side.

Definition at line 352 of file CompressibleFlowSystem.cpp.

357 {
358  v_DoDiffusion(inarray, outarray, pFwd, pBwd);
359 }
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)
Apply artificial diffusion (Laplacian operator)

References v_DoDiffusion().

Referenced by DoOdeRhs().

◆ DoOdeProjection()

void Nektar::CompressibleFlowSystem::DoOdeProjection ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const NekDouble  time 
)
protected

Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection.

Definition at line 294 of file CompressibleFlowSystem.cpp.

297 {
298  int nvariables = inarray.size();
299 
300  switch (m_projectionType)
301  {
303  {
304  // Just copy over array
305  int npoints = GetNpoints();
306 
307  for (int i = 0; i < nvariables; ++i)
308  {
309  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
310  if (m_useFiltering)
311  {
312  m_fields[i]->ExponentialFilter(outarray[i], m_filterAlpha,
315  }
316  }
317  SetBoundaryConditions(outarray, time);
318  break;
319  }
322  {
323  NEKERROR(ErrorUtil::efatal, "No Continuous Galerkin for full "
324  "compressible Navier-Stokes equations");
325  break;
326  }
327  default:
328  NEKERROR(ErrorUtil::efatal, "Unknown projection scheme");
329  break;
330  }
331 }
#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 SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
SOLVER_UTILS_EXPORT int GetNpoints()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255

References Nektar::MultiRegions::eDiscontinuous, Nektar::ErrorUtil::efatal, Nektar::MultiRegions::eGalerkin, Nektar::MultiRegions::eMixed_CG_Discontinuous, Nektar::SolverUtils::EquationSystem::GetNpoints(), Nektar::SolverUtils::EquationSystem::m_fields, m_filterAlpha, m_filterCutoff, m_filterExponent, Nektar::SolverUtils::EquationSystem::m_projectionType, m_useFiltering, NEKERROR, SetBoundaryConditions(), and Vmath::Vcopy().

Referenced by Nektar::CFSImplicit::NonlinSysEvaluatorCoeff(), Nektar::CFSImplicit::PreconCoeff(), and v_InitObject().

◆ DoOdeRhs()

void Nektar::CompressibleFlowSystem::DoOdeRhs ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const NekDouble  time 
)
protected

Compute the right-hand side.

Definition at line 211 of file CompressibleFlowSystem.cpp.

214 {
215  int nvariables = inarray.size();
216  int npoints = GetNpoints();
217  int nTracePts = GetTraceTotPoints();
218 
219  m_bndEvaluateTime = time;
220 
221  // Store forwards/backwards space along trace space
222  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
223  Array<OneD, Array<OneD, NekDouble>> Bwd(nvariables);
224 
226  {
229  }
230  else
231  {
232  for (int i = 0; i < nvariables; ++i)
233  {
234  Fwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
235  Bwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
236  m_fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
237  }
238  }
239 
240  // Calculate advection
241  LibUtilities::Timer timer;
242  timer.Start();
243  DoAdvection(inarray, outarray, time, Fwd, Bwd);
244  timer.Stop();
245  timer.AccumulateRegion("DoAdvection");
246 
247  // Negate results
248  for (int i = 0; i < nvariables; ++i)
249  {
250  Vmath::Neg(npoints, outarray[i], 1);
251  }
252 
253  // Add diffusion terms
254  timer.Start();
255  DoDiffusion(inarray, outarray, Fwd, Bwd);
256  timer.Stop();
257  timer.AccumulateRegion("DoDiffusion");
258 
259  // Add forcing terms
260  for (auto &x : m_forcing)
261  {
262  x->Apply(m_fields, inarray, outarray, time);
263  }
264 
265  if (m_useLocalTimeStep)
266  {
267  int nElements = m_fields[0]->GetExpSize();
268  int nq, offset;
269  NekDouble fac;
270  Array<OneD, NekDouble> tmp;
271 
272  Array<OneD, NekDouble> tstep(nElements, 0.0);
273  GetElmtTimeStep(inarray, tstep);
274 
275  // Loop over elements
276  for (int n = 0; n < nElements; ++n)
277  {
278  nq = m_fields[0]->GetExp(n)->GetTotPoints();
279  offset = m_fields[0]->GetPhys_Offset(n);
280  fac = tstep[n] / m_timestep;
281  for (int i = 0; i < nvariables; ++i)
282  {
283  Vmath::Smul(nq, fac, outarray[i] + offset, 1,
284  tmp = outarray[i] + offset, 1);
285  }
286  }
287  }
288 }
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.
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.
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.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
enum HomogeneousType m_HomogeneousType
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:518
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:248

References Nektar::LibUtilities::Timer::AccumulateRegion(), DoAdvection(), DoDiffusion(), Nektar::SolverUtils::EquationSystem::eHomogeneous1D, GetElmtTimeStep(), Nektar::SolverUtils::EquationSystem::GetNpoints(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), m_bndEvaluateTime, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::EquationSystem::m_HomogeneousType, Nektar::SolverUtils::EquationSystem::m_timestep, m_useLocalTimeStep, Vmath::Neg(), Nektar::NullNekDoubleArrayOfArray, Vmath::Smul(), Nektar::LibUtilities::Timer::Start(), and Nektar::LibUtilities::Timer::Stop().

Referenced by v_InitObject(), and v_SteadyStateResidual().

◆ GetDensity()

void Nektar::CompressibleFlowSystem::GetDensity ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, NekDouble > &  density 
)
virtual

Extract array with density from physfield.

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 945 of file CompressibleFlowSystem.cpp.

948 {
949  density = physfield[0];
950 }

◆ GetElmtTimeStep()

void Nektar::CompressibleFlowSystem::GetElmtTimeStep ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, NekDouble > &  tstep 
)
protected

Calculate the maximum timestep on each element subject to CFL restrictions.

Definition at line 555 of file CompressibleFlowSystem.cpp.

558 {
559  boost::ignore_unused(inarray);
560 
561  int nElements = m_fields[0]->GetExpSize();
562 
563  // Change value of m_timestep (in case it is set to zero)
564  NekDouble tmp = m_timestep;
565  m_timestep = 1.0;
566 
567  Array<OneD, NekDouble> cfl(nElements);
568  cfl = GetElmtCFLVals();
569 
570  // Factors to compute the time-step limit
572 
573  // Loop over elements to compute the time-step limit for each element
574  for (int n = 0; n < nElements; ++n)
575  {
576  tstep[n] = m_cflSafetyFactor * alpha / cfl[n];
577  }
578 
579  // Restore value of m_timestep
580  m_timestep = tmp;
581 }
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > GetElmtCFLVals(const bool FlagAcousticCFL=true)
NekDouble m_cflSafetyFactor
CFL safety factor (comprise between 0 to 1).
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator()
Get the maximum timestep estimator for cfl control.

References Nektar::SolverUtils::AdvectionSystem::GetElmtCFLVals(), Nektar::SolverUtils::UnsteadySystem::m_cflSafetyFactor, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_timestep, and Nektar::SolverUtils::UnsteadySystem::MaxTimeStepEstimator().

Referenced by DoOdeRhs(), Nektar::CFSImplicit::DoOdeRhsCoeff(), and v_GetTimeStep().

◆ GetFluxVector()

void Nektar::CompressibleFlowSystem::GetFluxVector ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
TensorOfArray3D< NekDouble > &  flux 
)
protected

Return the flux vector for the compressible Euler equations.

Parameters
physfieldFields.
fluxResulting flux.

Definition at line 405 of file CompressibleFlowSystem.cpp.

408 {
409  auto nVariables = physfield.size();
410  auto nPts = physfield[0].size();
411 
412  constexpr unsigned short maxVel = 3;
413  constexpr unsigned short maxFld = 5;
414 
415  // hardcoding done for performance reasons
416  ASSERTL1(nVariables <= maxFld, "GetFluxVector, hard coded max fields");
417 
418  for (size_t p = 0; p < nPts; ++p)
419  {
420  // local storage
421  std::array<NekDouble, maxFld> fieldTmp;
422  std::array<NekDouble, maxVel> velocity;
423 
424  // rearrenge and load data
425  for (size_t f = 0; f < nVariables; ++f)
426  {
427  fieldTmp[f] = physfield[f][p]; // load
428  }
429 
430  // 1 / rho
431  NekDouble oneOrho = 1.0 / fieldTmp[0];
432 
433  for (size_t d = 0; d < m_spacedim; ++d)
434  {
435  // Flux vector for the rho equation
436  flux[0][d][p] = fieldTmp[d + 1]; // store
437  // compute velocity
438  velocity[d] = fieldTmp[d + 1] * oneOrho;
439  }
440 
441  NekDouble pressure = m_varConv->GetPressure(fieldTmp.data());
442  NekDouble ePlusP = fieldTmp[m_spacedim + 1] + pressure;
443  for (size_t f = 0; f < m_spacedim; ++f)
444  {
445  // Flux vector for the velocity fields
446  for (size_t d = 0; d < m_spacedim; ++d)
447  {
448  flux[f + 1][d][p] = velocity[d] * fieldTmp[f + 1]; // store
449  }
450 
451  // Add pressure to appropriate field
452  flux[f + 1][f][p] += pressure;
453 
454  // Flux vector for energy
455  flux[m_spacedim + 1][f][p] = ePlusP * velocity[f]; // store
456  }
457  }
458 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
VariableConverterSharedPtr m_varConv

References ASSERTL1, Nektar::SolverUtils::EquationSystem::m_spacedim, m_varConv, CellMLToNektar.cellml_metadata::p, and CG_Iterations::pressure.

Referenced by InitAdvection().

◆ GetFluxVectorDeAlias()

void Nektar::CompressibleFlowSystem::GetFluxVectorDeAlias ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
TensorOfArray3D< NekDouble > &  flux 
)
protected

Return the flux vector for the compressible Euler equations by using the de-aliasing technique.

Parameters
physfieldFields.
fluxResulting flux.

Definition at line 467 of file CompressibleFlowSystem.cpp.

470 {
471  int i, j;
472  int nq = physfield[0].size();
473  int nVariables = m_fields.size();
474 
475  // Factor to rescale 1d points in dealiasing
476  NekDouble OneDptscale = 2;
477  nq = m_fields[0]->Get1DScaledTotPoints(OneDptscale);
478 
479  Array<OneD, NekDouble> pressure(nq);
480  Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
481 
482  Array<OneD, Array<OneD, NekDouble>> physfield_interp(nVariables);
483  TensorOfArray3D<NekDouble> flux_interp(nVariables);
484 
485  for (i = 0; i < nVariables; ++i)
486  {
487  physfield_interp[i] = Array<OneD, NekDouble>(nq);
488  flux_interp[i] = Array<OneD, Array<OneD, NekDouble>>(m_spacedim);
489  m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i],
490  physfield_interp[i]);
491 
492  for (j = 0; j < m_spacedim; ++j)
493  {
494  flux_interp[i][j] = Array<OneD, NekDouble>(nq);
495  }
496  }
497 
498  // Flux vector for the rho equation
499  for (i = 0; i < m_spacedim; ++i)
500  {
501  velocity[i] = Array<OneD, NekDouble>(nq);
502 
503  // Galerkin project solution back to original space
504  m_fields[0]->PhysGalerkinProjection1DScaled(
505  OneDptscale, physfield_interp[i + 1], flux[0][i]);
506  }
507 
508  m_varConv->GetVelocityVector(physfield_interp, velocity);
509  m_varConv->GetPressure(physfield_interp, pressure);
510 
511  // Evaluation of flux vector for the velocity fields
512  for (i = 0; i < m_spacedim; ++i)
513  {
514  for (j = 0; j < m_spacedim; ++j)
515  {
516  Vmath::Vmul(nq, velocity[j], 1, physfield_interp[i + 1], 1,
517  flux_interp[i + 1][j], 1);
518  }
519 
520  // Add pressure to appropriate field
521  Vmath::Vadd(nq, flux_interp[i + 1][i], 1, pressure, 1,
522  flux_interp[i + 1][i], 1);
523  }
524 
525  // Galerkin project solution back to original space
526  for (i = 0; i < m_spacedim; ++i)
527  {
528  for (j = 0; j < m_spacedim; ++j)
529  {
530  m_fields[0]->PhysGalerkinProjection1DScaled(
531  OneDptscale, flux_interp[i + 1][j], flux[i + 1][j]);
532  }
533  }
534 
535  // Evaluation of flux vector for energy
536  Vmath::Vadd(nq, physfield_interp[m_spacedim + 1], 1, pressure, 1, pressure,
537  1);
538 
539  for (j = 0; j < m_spacedim; ++j)
540  {
541  Vmath::Vmul(nq, velocity[j], 1, pressure, 1,
542  flux_interp[m_spacedim + 1][j], 1);
543 
544  // Galerkin project solution back to original space
545  m_fields[0]->PhysGalerkinProjection1DScaled(
546  OneDptscale, flux_interp[m_spacedim + 1][j],
547  flux[m_spacedim + 1][j]);
548  }
549 }
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:209
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:359

References Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_spacedim, m_varConv, CG_Iterations::pressure, Vmath::Vadd(), and Vmath::Vmul().

Referenced by InitAdvection().

◆ GetGamma()

NekDouble Nektar::CompressibleFlowSystem::GetGamma ( )
inlineprotected

Definition at line 176 of file CompressibleFlowSystem.h.

177  {
178  return m_gamma;
179  }

References m_gamma.

Referenced by InitAdvection().

◆ GetNormals()

const Array<OneD, const Array<OneD, NekDouble> >& Nektar::CompressibleFlowSystem::GetNormals ( )
inlineprotected

Definition at line 186 of file CompressibleFlowSystem.h.

187  {
188  return m_traceNormals;
189  }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.

References Nektar::SolverUtils::EquationSystem::m_traceNormals.

Referenced by InitAdvection().

◆ GetPressure()

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

Extract array with pressure from physfield.

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 935 of file CompressibleFlowSystem.cpp.

938 {
939  m_varConv->GetPressure(physfield, pressure);
940 }

References m_varConv, and CG_Iterations::pressure.

◆ GetStabilityLimit()

NekDouble Nektar::CompressibleFlowSystem::GetStabilityLimit ( int  n)

Function to calculate the stability limit for DG/CG.

Set the denominator to compute the time step when a cfl control is employed. This function is no longer used but is still here for being utilised in the future.

Parameters
nOrder of expansion element by element.

Definition at line 800 of file CompressibleFlowSystem.cpp.

801 {
802  ASSERTL0(n <= 20, "Illegal modes dimension for CFL calculation "
803  "(P has to be less then 20)");
804 
805  NekDouble CFLDG[21] = {2.0000, 6.0000, 11.8424, 19.1569, 27.8419,
806  37.8247, 49.0518, 61.4815, 75.0797, 89.8181,
807  105.6700, 122.6200, 140.6400, 159.7300, 179.8500,
808  201.0100, 223.1800, 246.3600, 270.5300, 295.6900,
809  321.8300}; // CFLDG 1D [0-20]
810  NekDouble CFL = 0.0;
811 
813  {
814  CFL = CFLDG[n];
815  }
816  else
817  {
818  NEKERROR(ErrorUtil::efatal, "Continuous Galerkin stability "
819  "coefficients not introduced yet.");
820  }
821 
822  return CFL;
823 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215

References ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::ErrorUtil::efatal, Nektar::SolverUtils::EquationSystem::m_projectionType, and NEKERROR.

Referenced by GetStabilityLimitVector().

◆ GetStabilityLimitVector()

Array< OneD, NekDouble > Nektar::CompressibleFlowSystem::GetStabilityLimitVector ( const Array< OneD, int > &  ExpOrder)

Function to calculate the stability limit for DG/CG (a vector of them).

Compute the vector of denominators to compute the time step when a cfl control is employed. This function is no longer used but is still here for being utilised in the future.

Parameters
ExpOrderOrder of expansion element by element.

Definition at line 832 of file CompressibleFlowSystem.cpp.

834 {
835  int i;
836  Array<OneD, NekDouble> returnval(m_fields[0]->GetExpSize(), 0.0);
837  for (i = 0; i < m_fields[0]->GetExpSize(); i++)
838  {
839  returnval[i] = GetStabilityLimit(ExpOrder[i]);
840  }
841  return returnval;
842 }
NekDouble GetStabilityLimit(int n)
Function to calculate the stability limit for DG/CG.
SOLVER_UTILS_EXPORT int GetExpSize()

References Nektar::SolverUtils::EquationSystem::GetExpSize(), GetStabilityLimit(), and Nektar::SolverUtils::EquationSystem::m_fields.

◆ GetVecLocs()

const Array<OneD, const Array<OneD, NekDouble> >& Nektar::CompressibleFlowSystem::GetVecLocs ( )
inlineprotected

Definition at line 181 of file CompressibleFlowSystem.h.

182  {
183  return m_vecLocs;
184  }
Array< OneD, Array< OneD, NekDouble > > m_vecLocs

References m_vecLocs.

Referenced by InitAdvection().

◆ GetVelocity()

void Nektar::CompressibleFlowSystem::GetVelocity ( const Array< OneD, const Array< OneD, NekDouble >> &  physfield,
Array< OneD, Array< OneD, NekDouble >> &  velocity 
)
virtual

Extract array with velocity from physfield.

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 955 of file CompressibleFlowSystem.cpp.

958 {
959  m_varConv->GetVelocityVector(physfield, velocity);
960 }

References m_varConv.

◆ HasConstantDensity()

virtual bool Nektar::CompressibleFlowSystem::HasConstantDensity ( )
inlinevirtual

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 84 of file CompressibleFlowSystem.h.

85  {
86  return false;
87  }

◆ InitAdvection()

void Nektar::CompressibleFlowSystem::InitAdvection ( )
protected

Create advection and diffusion objects for CFS.

Definition at line 167 of file CompressibleFlowSystem.cpp.

168 {
169  // Check if projection type is correct
171  "Unsupported projection type.");
172 
173  string advName, riemName;
174  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
175 
176  m_advObject =
178 
180  {
181  m_advObject->SetFluxVector(
183  }
184  else
185  {
187  this);
188  }
189 
190  // Setting up Riemann solver for advection operator
191  m_session->LoadSolverInfo("UpwindType", riemName, "Average");
192 
195  riemName, m_session);
196 
197  // Setting up parameters for advection operator Riemann solver
198  riemannSolver->SetParam("gamma", &CompressibleFlowSystem::GetGamma, this);
199  riemannSolver->SetAuxVec("vecLocs", &CompressibleFlowSystem::GetVecLocs,
200  this);
201  riemannSolver->SetVector("N", &CompressibleFlowSystem::GetNormals, this);
202 
203  // Concluding initialisation of advection / diffusion operators
204  m_advObject->SetRiemannSolver(riemannSolver);
205  m_advObject->InitObject(m_session, m_fields);
206 }
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
Return the flux vector for the compressible Euler equations.
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.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
std::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:47
RiemannSolverFactory & GetRiemannSolverFactory()

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::MultiRegions::eDiscontinuous, Nektar::SolverUtils::GetAdvectionFactory(), GetFluxVector(), GetFluxVectorDeAlias(), GetGamma(), GetNormals(), Nektar::SolverUtils::GetRiemannSolverFactory(), GetVecLocs(), Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::SolverUtils::EquationSystem::m_session, and Nektar::SolverUtils::EquationSystem::m_specHP_dealiasing.

Referenced by v_InitObject().

◆ InitialiseParameters()

void Nektar::CompressibleFlowSystem::InitialiseParameters ( )
protected

Load CFS parameters from the session file.

Definition at line 136 of file CompressibleFlowSystem.cpp.

137 {
138  // Get gamma parameter from session file.
139  m_session->LoadParameter("Gamma", m_gamma, 1.4);
140 
141  // Shock capture
142  m_session->LoadSolverInfo("ShockCaptureType", m_shockCaptureType, "Off");
143 
144  // Load parameters for exponential filtering
145  m_session->MatchSolverInfo("ExponentialFiltering", "True", m_useFiltering,
146  false);
147  if (m_useFiltering)
148  {
149  m_session->LoadParameter("FilterAlpha", m_filterAlpha, 36);
150  m_session->LoadParameter("FilterExponent", m_filterExponent, 16);
151  m_session->LoadParameter("FilterCutoff", m_filterCutoff, 0);
152  }
153 
154  // Load CFL for local time-stepping (for steady state)
155  m_session->MatchSolverInfo("LocalTimeStep", "True", m_useLocalTimeStep,
156  false);
157  if (m_useLocalTimeStep)
158  {
160  "Local time stepping requires CFL parameter.");
161  }
162 }

References ASSERTL0, Nektar::SolverUtils::UnsteadySystem::m_cflSafetyFactor, m_filterAlpha, m_filterCutoff, m_filterExponent, m_gamma, Nektar::SolverUtils::EquationSystem::m_session, m_shockCaptureType, m_useFiltering, and m_useLocalTimeStep.

Referenced by v_InitObject().

◆ SetBoundaryConditions()

void Nektar::CompressibleFlowSystem::SetBoundaryConditions ( Array< OneD, Array< OneD, NekDouble >> &  physarray,
NekDouble  time 
)
protected

Definition at line 361 of file CompressibleFlowSystem.cpp.

363 {
364  int nTracePts = GetTraceTotPoints();
365  int nvariables = physarray.size();
366 
367  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
368  for (int i = 0; i < nvariables; ++i)
369  {
370  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
371  m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
372  }
373 
374  if (m_bndConds.size())
375  {
376  // Loop over user-defined boundary conditions
377  for (auto &x : m_bndConds)
378  {
379  x->Apply(Fwd, physarray, time);
380  }
381  }
382 }
std::vector< CFSBndCondSharedPtr > m_bndConds

References Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), m_bndConds, and Nektar::SolverUtils::EquationSystem::m_fields.

Referenced by DoOdeProjection().

◆ SetBoundaryConditionsBwdWeight()

void Nektar::CompressibleFlowSystem::SetBoundaryConditionsBwdWeight ( )
protected

Set up a weight on physical boundaries for boundary condition applications.

Definition at line 387 of file CompressibleFlowSystem.cpp.

388 {
389  if (m_bndConds.size())
390  {
391  // Loop over user-defined boundary conditions
392  for (auto &x : m_bndConds)
393  {
394  x->ApplyBwdWeight();
395  }
396  }
397 }

References m_bndConds.

Referenced by Nektar::NavierStokesCFE::InitObject_Explicit(), and v_InitObject().

◆ v_DoDiffusion()

void Nektar::CompressibleFlowSystem::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 
)
protectedvirtual

Apply artificial diffusion (Laplacian operator)

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

Definition at line 617 of file CompressibleFlowSystem.cpp.

622 {
623  boost::ignore_unused(pFwd, pBwd);
625  {
626  m_artificialDiffusion->DoArtificialDiffusion(inarray, outarray);
627  }
628 }
ArtificialDiffusionSharedPtr m_artificialDiffusion

References m_artificialDiffusion.

Referenced by DoDiffusion().

◆ v_ExtraFldOutput()

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

Reimplemented from Nektar::SolverUtils::EquationSystem.

Reimplemented in Nektar::NavierStokesCFE.

Definition at line 844 of file CompressibleFlowSystem.cpp.

847 {
848  bool extraFields;
849  m_session->MatchSolverInfo("OutputExtraFields", "True", extraFields, true);
850  if (extraFields)
851  {
852  const int nPhys = m_fields[0]->GetNpoints();
853  const int nCoeffs = m_fields[0]->GetNcoeffs();
854  Array<OneD, Array<OneD, NekDouble>> tmp(m_fields.size());
855 
856  for (int i = 0; i < m_fields.size(); ++i)
857  {
858  tmp[i] = m_fields[i]->GetPhys();
859  }
860 
861  Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
862  Array<OneD, Array<OneD, NekDouble>> velFwd(m_spacedim);
863  for (int i = 0; i < m_spacedim; ++i)
864  {
865  velocity[i] = Array<OneD, NekDouble>(nPhys);
866  velFwd[i] = Array<OneD, NekDouble>(nCoeffs);
867  }
868 
869  Array<OneD, NekDouble> pressure(nPhys), temperature(nPhys);
870  Array<OneD, NekDouble> entropy(nPhys);
871  Array<OneD, NekDouble> soundspeed(nPhys), mach(nPhys);
872  Array<OneD, NekDouble> sensor(nPhys), SensorKappa(nPhys);
873 
874  m_varConv->GetVelocityVector(tmp, velocity);
875  m_varConv->GetPressure(tmp, pressure);
876  m_varConv->GetTemperature(tmp, temperature);
877  m_varConv->GetEntropy(tmp, entropy);
878  m_varConv->GetSoundSpeed(tmp, soundspeed);
879  m_varConv->GetMach(tmp, soundspeed, mach);
880 
881  int sensorOffset;
882  m_session->LoadParameter("SensorOffset", sensorOffset, 1);
883  m_varConv->GetSensor(m_fields[0], tmp, sensor, SensorKappa,
884  sensorOffset);
885 
886  Array<OneD, NekDouble> pFwd(nCoeffs), TFwd(nCoeffs);
887  Array<OneD, NekDouble> sFwd(nCoeffs);
888  Array<OneD, NekDouble> aFwd(nCoeffs), mFwd(nCoeffs);
889  Array<OneD, NekDouble> sensFwd(nCoeffs);
890 
891  string velNames[3] = {"u", "v", "w"};
892  for (int i = 0; i < m_spacedim; ++i)
893  {
894  m_fields[0]->FwdTransLocalElmt(velocity[i], velFwd[i]);
895  variables.push_back(velNames[i]);
896  fieldcoeffs.push_back(velFwd[i]);
897  }
898 
899  m_fields[0]->FwdTransLocalElmt(pressure, pFwd);
900  m_fields[0]->FwdTransLocalElmt(temperature, TFwd);
901  m_fields[0]->FwdTransLocalElmt(entropy, sFwd);
902  m_fields[0]->FwdTransLocalElmt(soundspeed, aFwd);
903  m_fields[0]->FwdTransLocalElmt(mach, mFwd);
904  m_fields[0]->FwdTransLocalElmt(sensor, sensFwd);
905 
906  variables.push_back("p");
907  variables.push_back("T");
908  variables.push_back("s");
909  variables.push_back("a");
910  variables.push_back("Mach");
911  variables.push_back("Sensor");
912  fieldcoeffs.push_back(pFwd);
913  fieldcoeffs.push_back(TFwd);
914  fieldcoeffs.push_back(sFwd);
915  fieldcoeffs.push_back(aFwd);
916  fieldcoeffs.push_back(mFwd);
917  fieldcoeffs.push_back(sensFwd);
918 
920  {
921  // reuse pressure
922  Array<OneD, NekDouble> sensorFwd(nCoeffs);
923  m_artificialDiffusion->GetArtificialViscosity(tmp, pressure);
924  m_fields[0]->FwdTransLocalElmt(pressure, sensorFwd);
925 
926  variables.push_back("ArtificialVisc");
927  fieldcoeffs.push_back(sensorFwd);
928  }
929  }
930 }

References m_artificialDiffusion, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_spacedim, m_varConv, and CG_Iterations::pressure.

◆ v_GetMaxStdVelocity()

Array< OneD, NekDouble > Nektar::CompressibleFlowSystem::v_GetMaxStdVelocity ( const NekDouble  SpeedSoundFactor)
protectedvirtual

Compute the advection velocity in the standard space for each element of the expansion.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Definition at line 674 of file CompressibleFlowSystem.cpp.

676 {
677  int nTotQuadPoints = GetTotPoints();
678  int n_element = m_fields[0]->GetExpSize();
679  int expdim = m_fields[0]->GetGraph()->GetMeshDimension();
680  int nfields = m_fields.size();
681  int offset;
682  Array<OneD, NekDouble> tmp;
683 
684  Array<OneD, Array<OneD, NekDouble>> physfields(nfields);
685  for (int i = 0; i < nfields; ++i)
686  {
687  physfields[i] = m_fields[i]->GetPhys();
688  }
689 
690  Array<OneD, NekDouble> stdV(n_element, 0.0);
691 
692  // Getting the velocity vector on the 2D normal space
693  Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
694  Array<OneD, Array<OneD, NekDouble>> stdVelocity(m_spacedim);
695  Array<OneD, Array<OneD, NekDouble>> stdSoundSpeed(m_spacedim);
696  Array<OneD, NekDouble> soundspeed(nTotQuadPoints);
698 
699  for (int i = 0; i < m_spacedim; ++i)
700  {
701  velocity[i] = Array<OneD, NekDouble>(nTotQuadPoints);
702  stdVelocity[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
703  stdSoundSpeed[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
704  }
705 
706  m_varConv->GetVelocityVector(physfields, velocity);
707  m_varConv->GetSoundSpeed(physfields, soundspeed);
708 
709  for (int el = 0; el < n_element; ++el)
710  {
711  ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
712  offset = m_fields[0]->GetPhys_Offset(el);
713  int nq = m_fields[0]->GetExp(el)->GetTotPoints();
714 
715  const SpatialDomains::GeomFactorsSharedPtr metricInfo =
716  m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo();
717  const Array<TwoD, const NekDouble> &gmat =
718  m_fields[0]
719  ->GetExp(el)
720  ->GetGeom()
721  ->GetMetricInfo()
722  ->GetDerivFactors(ptsKeys);
723 
724  // Convert to standard element
725  // consider soundspeed in all directions
726  // (this might overestimate the cfl)
727  if (metricInfo->GetGtype() == SpatialDomains::eDeformed)
728  {
729  // d xi/ dx = gmat = 1/J * d x/d xi
730  for (int i = 0; i < expdim; ++i)
731  {
732  Vmath::Vmul(nq, gmat[i], 1, velocity[0] + offset, 1,
733  tmp = stdVelocity[i] + offset, 1);
734  Vmath::Vmul(nq, gmat[i], 1, soundspeed + offset, 1,
735  tmp = stdSoundSpeed[i] + offset, 1);
736  for (int j = 1; j < expdim; ++j)
737  {
738  Vmath::Vvtvp(nq, gmat[expdim * j + i], 1,
739  velocity[j] + offset, 1,
740  stdVelocity[i] + offset, 1,
741  tmp = stdVelocity[i] + offset, 1);
742  Vmath::Vvtvp(nq, gmat[expdim * j + i], 1,
743  soundspeed + offset, 1,
744  stdSoundSpeed[i] + offset, 1,
745  tmp = stdSoundSpeed[i] + offset, 1);
746  }
747  }
748  }
749  else
750  {
751  for (int i = 0; i < expdim; ++i)
752  {
753  Vmath::Smul(nq, gmat[i][0], velocity[0] + offset, 1,
754  tmp = stdVelocity[i] + offset, 1);
755  Vmath::Smul(nq, gmat[i][0], soundspeed + offset, 1,
756  tmp = stdSoundSpeed[i] + offset, 1);
757  for (int j = 1; j < expdim; ++j)
758  {
759  Vmath::Svtvp(nq, gmat[expdim * j + i][0],
760  velocity[j] + offset, 1,
761  stdVelocity[i] + offset, 1,
762  tmp = stdVelocity[i] + offset, 1);
763  Vmath::Svtvp(nq, gmat[expdim * j + i][0],
764  soundspeed + offset, 1,
765  stdSoundSpeed[i] + offset, 1,
766  tmp = stdSoundSpeed[i] + offset, 1);
767  }
768  }
769  }
770 
771  NekDouble vel;
772  for (int i = 0; i < nq; ++i)
773  {
774  NekDouble pntVelocity = 0.0;
775  for (int j = 0; j < expdim; ++j)
776  {
777  // Add sound speed
778  vel = std::abs(stdVelocity[j][offset + i]) +
779  SpeedSoundFactor * std::abs(stdSoundSpeed[j][offset + i]);
780  pntVelocity += vel * vel;
781  }
782  pntVelocity = sqrt(pntVelocity);
783  if (pntVelocity > stdV[el])
784  {
785  stdV[el] = pntVelocity;
786  }
787  }
788  }
789 
790  return stdV;
791 }
SOLVER_UTILS_EXPORT int GetTotPoints()
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:250
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
@ eDeformed
Geometry is curved or has non-constant factors.
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:622
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:574
scalarT< T > abs(scalarT< T > in)
Definition: scalar.hpp:295
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:291

References tinysimd::abs(), Nektar::SpatialDomains::eDeformed, Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_spacedim, m_varConv, Vmath::Smul(), tinysimd::sqrt(), Vmath::Svtvp(), Vmath::Vmul(), and Vmath::Vvtvp().

◆ v_GetTimeStep()

NekDouble Nektar::CompressibleFlowSystem::v_GetTimeStep ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray)
protectedvirtual

Calculate the maximum timestep subject to CFL restrictions.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 586 of file CompressibleFlowSystem.cpp.

588 {
589  int nElements = m_fields[0]->GetExpSize();
590  Array<OneD, NekDouble> tstep(nElements, 0.0);
591 
592  GetElmtTimeStep(inarray, tstep);
593 
594  // Get the minimum time-step limit and return the time-step
595  NekDouble TimeStep = Vmath::Vmin(nElements, tstep, 1);
596  m_comm->AllReduce(TimeStep, LibUtilities::ReduceMin);
597 
598  NekDouble tmp = m_timestep;
599  m_timestep = TimeStep;
600 
601  Array<OneD, NekDouble> cflNonAcoustic(nElements, 0.0);
602  cflNonAcoustic = GetElmtCFLVals(false);
603 
604  // Get the minimum time-step limit and return the time-step
605  NekDouble MaxcflNonAcoustic = Vmath::Vmax(nElements, cflNonAcoustic, 1);
606  m_comm->AllReduce(MaxcflNonAcoustic, LibUtilities::ReduceMax);
607 
608  m_cflNonAcoustic = MaxcflNonAcoustic;
609  m_timestep = tmp;
610 
611  return TimeStep;
612 }
LibUtilities::CommSharedPtr m_comm
Communicator.
T Vmin(int n, const T *x, const int incx)
Return the minimum element in x - called vmin to avoid conflict with min.
Definition: Vmath.cpp:1050
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:945

References Nektar::SolverUtils::AdvectionSystem::GetElmtCFLVals(), GetElmtTimeStep(), Nektar::SolverUtils::UnsteadySystem::m_cflNonAcoustic, Nektar::SolverUtils::EquationSystem::m_comm, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_timestep, Nektar::LibUtilities::ReduceMax, Nektar::LibUtilities::ReduceMin, Vmath::Vmax(), and Vmath::Vmin().

◆ v_InitObject()

void Nektar::CompressibleFlowSystem::v_InitObject ( bool  DeclareFields = true)
protectedvirtual

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Reimplemented in Nektar::NavierStokesImplicitCFE, Nektar::NavierStokesCFEAxisym, Nektar::EulerImplicitCFE, Nektar::EulerCFE, Nektar::CFSImplicit, and Nektar::NavierStokesCFE.

Definition at line 55 of file CompressibleFlowSystem.cpp.

56 {
57  AdvectionSystem::v_InitObject(DeclareFields);
58 
59  for (int i = 0; i < m_fields.size(); i++)
60  {
61  // Use BwdTrans to make sure initial condition is in solution space
62  m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
63  m_fields[i]->UpdatePhys());
64  }
65 
68 
69  ASSERTL0(m_session->DefinesSolverInfo("UPWINDTYPE"),
70  "No UPWINDTYPE defined in session.");
71 
72  // Do not forwards transform initial condition
73  m_homoInitialFwd = false;
74 
75  // Set up locations of velocity vector.
76  m_vecLocs = Array<OneD, Array<OneD, NekDouble>>(1);
77  m_vecLocs[0] = Array<OneD, NekDouble>(m_spacedim);
78  for (int i = 0; i < m_spacedim; ++i)
79  {
80  m_vecLocs[0][i] = 1 + i;
81  }
82 
83  // Loading parameters from session file
85 
86  // Setting up advection and diffusion operators
87  InitAdvection();
88 
89  // Create artificial diffusion with laplacian operator
90  if (m_shockCaptureType == "NonSmooth")
91  {
94  }
95 
96  // Forcing terms for the sponge region
97  m_forcing = SolverUtils::Forcing::Load(m_session, shared_from_this(),
98  m_fields, m_fields.size());
99 
100  // User-defined boundary conditions
101  int cnt = 0;
102  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
103  {
104  std::string type = m_fields[0]->GetBndConditions()[n]->GetUserDefined();
105 
106  if (m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType() ==
108  {
109  continue;
110  }
111 
112  if (!type.empty())
113  {
114  m_bndConds.push_back(GetCFSBndCondFactory().CreateInstance(
115  type, m_session, m_fields, m_traceNormals, m_spacedim, n, cnt));
116  }
117  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
118  }
119 
122 
124 }
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Compute the right-hand side.
void InitAdvection()
Create advection and diffusion objects for CFS.
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 discontinu...
void SetBoundaryConditionsBwdWeight()
Set up a weight on physical boundaries for boundary condition applications.
void InitialiseParameters()
Load CFS parameters from the session file.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual SOLVER_UTILS_EXPORT void v_InitObject(bool DeclareField=true)
Init object for UnsteadySystem class.
SpatialDomains::MeshGraphSharedPtr m_graph
Pointer to graph defining mesh.
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
Definition: Forcing.cpp:120
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
CFSBndCondFactory & GetCFSBndCondFactory()
Declaration of the boundary condition factory singleton.
Definition: CFSBndCond.cpp:41
ArtificialDiffusionFactory & GetArtificialDiffusionFactory()
Declaration of the artificial diffusion factory singleton.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::LibUtilities::TimeIntegrationSchemeOperators::DefineOdeRhs(), Nektar::LibUtilities::TimeIntegrationSchemeOperators::DefineProjection(), DoOdeProjection(), DoOdeRhs(), Nektar::SpatialDomains::ePeriodic, Nektar::GetArtificialDiffusionFactory(), Nektar::GetCFSBndCondFactory(), InitAdvection(), InitialiseParameters(), Nektar::SolverUtils::Forcing::Load(), m_artificialDiffusion, m_bndConds, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::EquationSystem::m_graph, Nektar::SolverUtils::UnsteadySystem::m_homoInitialFwd, Nektar::SolverUtils::UnsteadySystem::m_ode, Nektar::SolverUtils::EquationSystem::m_session, m_shockCaptureType, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::SolverUtils::EquationSystem::m_traceNormals, m_varConv, m_vecLocs, SetBoundaryConditionsBwdWeight(), and Nektar::SolverUtils::AdvectionSystem::v_InitObject().

Referenced by Nektar::NavierStokesCFE::v_InitObject(), Nektar::CFSImplicit::v_InitObject(), and Nektar::EulerCFE::v_InitObject().

◆ v_SetInitialConditions()

void Nektar::CompressibleFlowSystem::v_SetInitialConditions ( NekDouble  initialtime = 0.0,
bool  dumpInitialConditions = true,
const int  domain = 0 
)
protectedvirtual

Set up logic for residual calculation.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Reimplemented in Nektar::IsentropicVortex.

Definition at line 633 of file CompressibleFlowSystem.cpp.

636 {
637  boost::ignore_unused(domain);
638 
639  EquationSystem::v_SetInitialConditions(initialtime, false);
640 
641  // insert white noise in initial condition
642  NekDouble Noise;
643  int phystot = m_fields[0]->GetTotPoints();
644  Array<OneD, NekDouble> noise(phystot);
645 
646  m_session->LoadParameter("Noise", Noise, 0.0);
647  int m_nConvectiveFields = m_fields.size();
648 
649  if (Noise > 0.0)
650  {
651  int seed = -m_comm->GetRank() * m_nConvectiveFields;
652  for (int i = 0; i < m_nConvectiveFields; i++)
653  {
654  Vmath::FillWhiteNoise(phystot, Noise, noise, 1, seed);
655  --seed;
656  Vmath::Vadd(phystot, m_fields[i]->GetPhys(), 1, noise, 1,
657  m_fields[i]->UpdatePhys(), 1);
658  m_fields[i]->FwdTransLocalElmt(m_fields[i]->GetPhys(),
659  m_fields[i]->UpdateCoeffs());
660  }
661  }
662 
663  if (dumpInitialConditions && m_checksteps)
664  {
666  m_nchk++;
667  }
668 }
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
int m_nchk
Number of checkpoints written so far.
int m_checksteps
Number of steps between checkpoints.
void FillWhiteNoise(int n, const T eps, T *x, const int incx, int outseed)
Fills a vector with white noise.
Definition: Vmath.cpp:155

References Nektar::SolverUtils::EquationSystem::Checkpoint_Output(), Vmath::FillWhiteNoise(), Nektar::SolverUtils::EquationSystem::m_checksteps, Nektar::SolverUtils::EquationSystem::m_comm, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_nchk, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::v_SetInitialConditions(), and Vmath::Vadd().

◆ v_SteadyStateResidual()

void Nektar::CompressibleFlowSystem::v_SteadyStateResidual ( int  step,
Array< OneD, NekDouble > &  L2 
)
protectedvirtual

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 962 of file CompressibleFlowSystem.cpp.

964 {
965  boost::ignore_unused(step);
966  const int nPoints = GetTotPoints();
967  const int nFields = m_fields.size();
968  Array<OneD, Array<OneD, NekDouble>> rhs(nFields);
969  Array<OneD, Array<OneD, NekDouble>> inarray(nFields);
970  for (int i = 0; i < nFields; ++i)
971  {
972  rhs[i] = Array<OneD, NekDouble>(nPoints, 0.0);
973  inarray[i] = m_fields[i]->UpdatePhys();
974  }
975 
976  DoOdeRhs(inarray, rhs, m_time);
977 
978  // Holds L2 errors.
979  Array<OneD, NekDouble> tmp;
980  Array<OneD, NekDouble> RHSL2(nFields);
981  Array<OneD, NekDouble> residual(nFields);
982 
983  for (int i = 0; i < nFields; ++i)
984  {
985  tmp = rhs[i];
986 
987  Vmath::Vmul(nPoints, tmp, 1, tmp, 1, tmp, 1);
988  residual[i] = Vmath::Vsum(nPoints, tmp, 1);
989  }
990 
991  m_comm->AllReduce(residual, LibUtilities::ReduceSum);
992 
993  NekDouble onPoints = 1.0 / NekDouble(nPoints);
994  for (int i = 0; i < nFields; ++i)
995  {
996  L2[i] = sqrt(residual[i] * onPoints);
997  }
998 }
NekDouble m_time
Current time of simulation.
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
Definition: Vmath.cpp:895

References DoOdeRhs(), Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::SolverUtils::EquationSystem::m_comm, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_time, Nektar::LibUtilities::ReduceSum, tinysimd::sqrt(), Vmath::Vmul(), and Vmath::Vsum().

Friends And Related Function Documentation

◆ MemoryManager< CompressibleFlowSystem >

friend class MemoryManager< CompressibleFlowSystem >
friend

Definition at line 1 of file CompressibleFlowSystem.h.

Member Data Documentation

◆ m_artificialDiffusion

ArtificialDiffusionSharedPtr Nektar::CompressibleFlowSystem::m_artificialDiffusion
protected

◆ m_bndConds

std::vector<CFSBndCondSharedPtr> Nektar::CompressibleFlowSystem::m_bndConds
protected

◆ m_bndEvaluateTime

NekDouble Nektar::CompressibleFlowSystem::m_bndEvaluateTime
protected

◆ m_diffusion

SolverUtils::DiffusionSharedPtr Nektar::CompressibleFlowSystem::m_diffusion
protected

◆ m_filterAlpha

NekDouble Nektar::CompressibleFlowSystem::m_filterAlpha
protected

Definition at line 101 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterCutoff

NekDouble Nektar::CompressibleFlowSystem::m_filterCutoff
protected

Definition at line 103 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterExponent

NekDouble Nektar::CompressibleFlowSystem::m_filterExponent
protected

Definition at line 102 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_forcing

std::vector<SolverUtils::ForcingSharedPtr> Nektar::CompressibleFlowSystem::m_forcing
protected

◆ m_gamma

NekDouble Nektar::CompressibleFlowSystem::m_gamma
protected

◆ m_muav

Array<OneD, NekDouble> Nektar::CompressibleFlowSystem::m_muav
protected

Definition at line 110 of file CompressibleFlowSystem.h.

◆ m_muavTrace

Array<OneD, NekDouble> Nektar::CompressibleFlowSystem::m_muavTrace
protected

Definition at line 113 of file CompressibleFlowSystem.h.

◆ m_shockCaptureType

std::string Nektar::CompressibleFlowSystem::m_shockCaptureType
protected

◆ m_useFiltering

bool Nektar::CompressibleFlowSystem::m_useFiltering
protected

Definition at line 104 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_useLocalTimeStep

bool Nektar::CompressibleFlowSystem::m_useLocalTimeStep
protected

◆ m_varConv

VariableConverterSharedPtr Nektar::CompressibleFlowSystem::m_varConv
protected

◆ m_vecLocs

Array<OneD, Array<OneD, NekDouble> > Nektar::CompressibleFlowSystem::m_vecLocs
protected

Definition at line 96 of file CompressibleFlowSystem.h.

Referenced by GetVecLocs(), and v_InitObject().