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

Protected Member Functions

 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
virtual void v_InitObject ()
 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, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
 Compute the advection terms for the right-hand side. More...
 
void DoDiffusion (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
 Add the diffusions terms to the right-hand side. More...
 
void GetFluxVector (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations. More...
 
void GetFluxVectorDeAlias (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations by using the de-aliasing technique. More...
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
 
void SetBoundaryConditionsBwdWeight ()
 Set up a weight on physical boundaries for boundary condition applications. More...
 
void GetElmtTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, NekDouble > &tstep)
 Calculate the maximum timestep on each element subject to CFL restrictions. More...
 
virtual NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Calculate the maximum timestep subject to CFL restrictions. More...
 
virtual void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Set up logic for residual calculation. More...
 
NekDouble GetGamma ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals ()
 
virtual void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
virtual void v_DoDiffusion (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
 
virtual Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor)
 Compute the advection velocity in the standard space for each element of the expansion. More...
 
virtual void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise ()
 Sets up initial conditions. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s)
 Print a summary of time stepping parameters. More...
 
virtual SOLVER_UTILS_EXPORT void v_AppendOutput1D (Array< OneD, Array< OneD, NekDouble >> &solution1D)
 Print the solution at each solution point in a txt file. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble >> vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
virtual SOLVER_UTILS_EXPORT bool UpdateTimeStepCheck ()
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys ()
 Virtual function for transformation to physical space. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space. More...
 
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure (void)
 

Protected Attributes

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

Friends

class MemoryManager< 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...
 
- 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 61 of file CompressibleFlowSystem.h.

Constructor & Destructor Documentation

◆ ~CompressibleFlowSystem()

Nektar::CompressibleFlowSystem::~CompressibleFlowSystem ( )
virtual

Destructor for CompressibleFlowSystem class.

Definition at line 153 of file CompressibleFlowSystem.cpp.

154  {
155 
156  }

◆ 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),
49  AdvectionSystem(pSession, pGraph)
50  {
51  }
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, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const NekDouble  time,
const Array< OneD, const Array< OneD, NekDouble >> &  pFwd,
const Array< OneD, const Array< OneD, NekDouble >> &  pBwd 
)
protected

Compute the advection terms for the right-hand side.

Definition at line 367 of file CompressibleFlowSystem.cpp.

373  {
374  int nvariables = inarray.size();
375  Array<OneD, Array<OneD, NekDouble>> advVel(m_spacedim);
376 
377  m_advObject->Advect(nvariables, m_fields, advVel, inarray,
378  outarray, time, pFwd, pBwd);
379  }
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, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const Array< OneD, const Array< OneD, NekDouble >> &  pFwd,
const Array< OneD, const Array< OneD, NekDouble >> &  pBwd 
)
protected

Add the diffusions terms to the right-hand side.

Definition at line 384 of file CompressibleFlowSystem.cpp.

389  {
390  v_DoDiffusion(inarray, outarray, pFwd, pBwd);
391 
392  if (m_shockCaptureType != "Off" && m_shockCaptureType != "Physical")
393  {
394  m_artificialDiffusion->DoArtificialDiffusion(inarray, outarray);
395  }
396  }
virtual void v_DoDiffusion(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
ArtificialDiffusionSharedPtr m_artificialDiffusion

References m_artificialDiffusion, m_shockCaptureType, and 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 324 of file CompressibleFlowSystem.cpp.

328  {
329  int nvariables = inarray.size();
330 
331  switch(m_projectionType)
332  {
334  {
335  // Just copy over array
336  int npoints = GetNpoints();
337 
338  for (int i = 0; i < nvariables; ++i)
339  {
340  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
341  if (m_useFiltering)
342  {
343  m_fields[i]->ExponentialFilter(outarray[i],
345  }
346  }
347  SetBoundaryConditions(outarray, time);
348  break;
349  }
352  {
353  NEKERROR(ErrorUtil::efatal, "No Continuous Galerkin for full "
354  "compressible Navier-Stokes equations");
355  break;
356  }
357  default:
358  NEKERROR(ErrorUtil::efatal, "Unknown projection scheme");
359  break;
360  }
361  }
#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:1199

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 240 of file CompressibleFlowSystem.cpp.

244  {
245  int nvariables = inarray.size();
246  int npoints = GetNpoints();
247  int nTracePts = GetTraceTotPoints();
248 
249  m_bndEvaluateTime = time;
250 
251  // Store forwards/backwards space along trace space
252  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
253  Array<OneD, Array<OneD, NekDouble>> Bwd(nvariables);
254 
256  {
259  }
260  else
261  {
262  for (int i = 0; i < nvariables; ++i)
263  {
264  Fwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
265  Bwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
266  m_fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
267  }
268  }
269 
270  // Calculate advection
271  LibUtilities::Timer timer;
272  timer.Start();
273  DoAdvection(inarray, outarray, time, Fwd, Bwd);
274  timer.Stop();
275  timer.AccumulateRegion("DoAdvection");
276 
277  // Negate results
278  for (int i = 0; i < nvariables; ++i)
279  {
280  Vmath::Neg(npoints, outarray[i], 1);
281  }
282 
283  // Add diffusion terms
284  timer.Start();
285  DoDiffusion(inarray, outarray, Fwd, Bwd);
286  timer.Stop();
287  timer.AccumulateRegion("DoDiffusion");
288 
289  // Add forcing terms
290  for (auto &x : m_forcing)
291  {
292  x->Apply(m_fields, inarray, outarray, time);
293  }
294 
295  if (m_useLocalTimeStep)
296  {
297  int nElements = m_fields[0]->GetExpSize();
298  int nq, offset;
299  NekDouble fac;
300  Array<OneD, NekDouble> tmp;
301 
302  Array<OneD, NekDouble> tstep (nElements, 0.0);
303  GetElmtTimeStep(inarray, tstep);
304 
305  // Loop over elements
306  for (int n = 0; n < nElements; ++n)
307  {
308  nq = m_fields[0]->GetExp(n)->GetTotPoints();
309  offset = m_fields[0]->GetPhys_Offset(n);
310  fac = tstep[n] / m_timestep;
311  for (int i = 0; i < nvariables; ++i)
312  {
313  Vmath::Smul(nq, fac, outarray[i] + offset, 1,
314  tmp = outarray[i] + offset, 1);
315  }
316  }
317  }
318  }
void DoDiffusion(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
Add the diffusions terms to the right-hand side.
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
void DoAdvection(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const Array< OneD, const Array< OneD, NekDouble >> &pFwd, const Array< OneD, const Array< OneD, NekDouble >> &pBwd)
Compute the advection terms for the right-hand side.
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:461
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.cpp:225

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

Definition at line 978 of file CompressibleFlowSystem.cpp.

981  {
982  density = physfield[0];
983  }

◆ GetElmtMinHP()

Array< OneD, NekDouble > Nektar::CompressibleFlowSystem::GetElmtMinHP ( void  )

Function to get estimate of min h/p factor per element.

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

Definition at line 1039 of file CompressibleFlowSystem.cpp.

1040 {
1041  int nElements = m_fields[0]->GetExpSize();
1042  Array<OneD, NekDouble> hOverP(nElements, 1.0);
1043 
1044  // Determine h/p scaling
1045  Array<OneD, int> pOrderElmt = m_fields[0]->EvalBasisNumModesMaxPerExp();
1046  for (int e = 0; e < nElements; e++)
1047  {
1048  NekDouble h = 1.0e+10;
1049  switch(m_expdim)
1050  {
1051  case 3:
1052  {
1054  exp3D = m_fields[0]->GetExp(e)->as<LocalRegions::Expansion3D>();
1055  for (int i = 0; i < exp3D->GetNtraces(); ++i)
1056  {
1057  h = min(h, exp3D->GetGeom3D()->GetEdge(i)->GetVertex(0)->
1058  dist(*(exp3D->GetGeom3D()->GetEdge(i)->GetVertex(1))));
1059  }
1060  break;
1061  }
1062 
1063  case 2:
1064  {
1066  exp2D = m_fields[0]->GetExp(e)->as<LocalRegions::Expansion2D>();
1067  for (int i = 0; i < exp2D->GetNtraces(); ++i)
1068  {
1069  h = min(h, exp2D->GetGeom2D()->GetEdge(i)->GetVertex(0)->
1070  dist(*(exp2D->GetGeom2D()->GetEdge(i)->GetVertex(1))));
1071  }
1072  break;
1073  }
1074  case 1:
1075  {
1077  exp1D = m_fields[0]->GetExp(e)->as<LocalRegions::Expansion1D>();
1078 
1079  h = min(h, exp1D->GetGeom1D()->GetVertex(0)->
1080  dist(*(exp1D->GetGeom1D()->GetVertex(1))));
1081 
1082  break;
1083  }
1084  default:
1085  {
1086  NEKERROR(ErrorUtil::efatal,"Dimension out of bound.")
1087  }
1088  }
1089 
1090  // Determine h/p scaling
1091  hOverP[e] = h/max(pOrderElmt[e]-1,1);
1092 
1093  }
1094  return hOverP;
1095 }
int m_expdim
Expansion dimension.
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:47
std::shared_ptr< Expansion1D > Expansion1DSharedPtr
Definition: Expansion1D.h:51
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:49

References Nektar::ErrorUtil::efatal, Nektar::LocalRegions::Expansion1D::GetGeom1D(), Nektar::SolverUtils::EquationSystem::m_expdim, Nektar::SolverUtils::EquationSystem::m_fields, and NEKERROR.

Referenced by Nektar::NavierStokesCFE::GetPhysicalAV(), and v_ExtraFldOutput().

◆ 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 596 of file CompressibleFlowSystem.cpp.

599  {
600  boost::ignore_unused(inarray);
601 
602  int nElements = m_fields[0]->GetExpSize();
603 
604  // Change value of m_timestep (in case it is set to zero)
605  NekDouble tmp = m_timestep;
606  m_timestep = 1.0;
607 
608  Array<OneD, NekDouble> cfl(nElements);
609  cfl = GetElmtCFLVals();
610 
611  // Factors to compute the time-step limit
613 
614  // Loop over elements to compute the time-step limit for each element
615  for (int n = 0; n < nElements; ++n)
616  {
617  tstep[n] = m_cflSafetyFactor * alpha / cfl[n];
618  }
619 
620  // Restore value of m_timestep
621  m_timestep = tmp;
622  }
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 444 of file CompressibleFlowSystem.cpp.

447  {
448  auto nVariables = physfield.size();
449  auto nPts = physfield[0].size();
450 
451  constexpr unsigned short maxVel = 3;
452  constexpr unsigned short maxFld = 5;
453 
454  // hardcoding done for performance reasons
455  ASSERTL1(nVariables <= maxFld, "GetFluxVector, hard coded max fields");
456 
457  for (size_t p = 0; p < nPts; ++p)
458  {
459  // local storage
460  std::array<NekDouble, maxFld> fieldTmp;
461  std::array<NekDouble, maxVel> velocity;
462 
463  // rearrenge and load data
464  for (size_t f = 0; f < nVariables; ++f)
465  {
466  fieldTmp[f] = physfield[f][p]; // load
467  }
468 
469  // 1 / rho
470  NekDouble oneOrho = 1.0 / fieldTmp[0];
471 
472  for (size_t d = 0; d < m_spacedim; ++d)
473  {
474  // Flux vector for the rho equation
475  flux[0][d][p] = fieldTmp[d+1]; // store
476  // compute velocity
477  velocity[d] = fieldTmp[d+1] * oneOrho;
478  }
479 
480  NekDouble pressure = m_varConv->GetPressure(fieldTmp.data());
481  NekDouble ePlusP = fieldTmp[m_spacedim+1] + pressure;
482  for (size_t f = 0; f < m_spacedim; ++f)
483  {
484  // Flux vector for the velocity fields
485  for (size_t d = 0; d < m_spacedim; ++d)
486  {
487  flux[f+1][d][p] = velocity[d] * fieldTmp[f+1]; // store
488  }
489 
490  // Add pressure to appropriate field
491  flux[f+1][f][p] += pressure;
492 
493  // Flux vector for energy
494  flux[m_spacedim+1][f][p] = ePlusP * velocity[f]; // store
495  }
496 
497  }
498  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:250
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 507 of file CompressibleFlowSystem.cpp.

510  {
511  int i, j;
512  int nq = physfield[0].size();
513  int nVariables = m_fields.size();
514 
515  // Factor to rescale 1d points in dealiasing
516  NekDouble OneDptscale = 2;
517  nq = m_fields[0]->Get1DScaledTotPoints(OneDptscale);
518 
519  Array<OneD, NekDouble> pressure(nq);
520  Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
521 
522  Array<OneD, Array<OneD, NekDouble>> physfield_interp(nVariables);
523  TensorOfArray3D<NekDouble> flux_interp(nVariables);
524 
525  for (i = 0; i < nVariables; ++ i)
526  {
527  physfield_interp[i] = Array<OneD, NekDouble>(nq);
528  flux_interp[i] = Array<OneD, Array<OneD, NekDouble>>(m_spacedim);
529  m_fields[0]->PhysInterp1DScaled(
530  OneDptscale, physfield[i], physfield_interp[i]);
531 
532  for (j = 0; j < m_spacedim; ++j)
533  {
534  flux_interp[i][j] = Array<OneD, NekDouble>(nq);
535  }
536  }
537 
538  // Flux vector for the rho equation
539  for (i = 0; i < m_spacedim; ++i)
540  {
541  velocity[i] = Array<OneD, NekDouble>(nq);
542 
543  // Galerkin project solution back to original space
544  m_fields[0]->PhysGalerkinProjection1DScaled(
545  OneDptscale, physfield_interp[i+1], flux[0][i]);
546  }
547 
548  m_varConv->GetVelocityVector(physfield_interp, velocity);
549  m_varConv->GetPressure (physfield_interp, pressure);
550 
551  // Evaluation of flux vector for the velocity fields
552  for (i = 0; i < m_spacedim; ++i)
553  {
554  for (j = 0; j < m_spacedim; ++j)
555  {
556  Vmath::Vmul(nq, velocity[j], 1, physfield_interp[i+1], 1,
557  flux_interp[i+1][j], 1);
558  }
559 
560  // Add pressure to appropriate field
561  Vmath::Vadd(nq, flux_interp[i+1][i], 1, pressure,1,
562  flux_interp[i+1][i], 1);
563  }
564 
565  // Galerkin project solution back to original space
566  for (i = 0; i < m_spacedim; ++i)
567  {
568  for (j = 0; j < m_spacedim; ++j)
569  {
570  m_fields[0]->PhysGalerkinProjection1DScaled(
571  OneDptscale, flux_interp[i+1][j], flux[i+1][j]);
572  }
573  }
574 
575  // Evaluation of flux vector for energy
576  Vmath::Vadd(nq, physfield_interp[m_spacedim+1], 1, pressure, 1,
577  pressure, 1);
578 
579  for (j = 0; j < m_spacedim; ++j)
580  {
581  Vmath::Vmul(nq, velocity[j], 1, pressure, 1,
582  flux_interp[m_spacedim+1][j], 1);
583 
584  // Galerkin project solution back to original space
585  m_fields[0]->PhysGalerkinProjection1DScaled(
586  OneDptscale,
587  flux_interp[m_spacedim+1][j],
588  flux[m_spacedim+1][j]);
589  }
590  }
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:192
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:322

References 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 187 of file CompressibleFlowSystem.h.

188  {
189  return m_gamma;
190  }

References m_gamma.

Referenced by InitAdvection().

◆ GetNormals()

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

Definition at line 197 of file CompressibleFlowSystem.h.

198  {
199  return m_traceNormals;
200  }
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

Definition at line 968 of file CompressibleFlowSystem.cpp.

971  {
972  m_varConv->GetPressure(physfield, pressure);
973  }

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 829 of file CompressibleFlowSystem.cpp.

830  {
831  ASSERTL0(n <= 20, "Illegal modes dimension for CFL calculation "
832  "(P has to be less then 20)");
833 
834  NekDouble CFLDG[21] = { 2.0000, 6.0000, 11.8424, 19.1569,
835  27.8419, 37.8247, 49.0518, 61.4815,
836  75.0797, 89.8181, 105.6700, 122.6200,
837  140.6400, 159.7300, 179.8500, 201.0100,
838  223.1800, 246.3600, 270.5300, 295.6900,
839  321.8300}; //CFLDG 1D [0-20]
840  NekDouble CFL = 0.0;
841 
843  {
844  CFL = CFLDG[n];
845  }
846  else
847  {
848  NEKERROR(ErrorUtil::efatal, "Continuous Galerkin stability "
849  "coefficients not introduced yet.");
850  }
851 
852  return CFL;
853  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

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 862 of file CompressibleFlowSystem.cpp.

864  {
865  int i;
866  Array<OneD,NekDouble> returnval(m_fields[0]->GetExpSize(), 0.0);
867  for (i =0; i<m_fields[0]->GetExpSize(); i++)
868  {
869  returnval[i] = GetStabilityLimit(ExpOrder[i]);
870  }
871  return returnval;
872  }
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 192 of file CompressibleFlowSystem.h.

193  {
194  return m_vecLocs;
195  }
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

Definition at line 988 of file CompressibleFlowSystem.cpp.

991  {
992  m_varConv->GetVelocityVector(physfield, velocity);
993  }

References m_varConv.

◆ HasConstantDensity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 89 of file CompressibleFlowSystem.h.

90  {
91  return false;
92  }

◆ InitAdvection()

void Nektar::CompressibleFlowSystem::InitAdvection ( )
protected

Create advection and diffusion objects for CFS.

Definition at line 194 of file CompressibleFlowSystem.cpp.

195  {
196  // Check if projection type is correct
198  "Unsupported projection type.");
199 
200  string advName, riemName;
201  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
202 
204  .CreateInstance(advName, advName);
205 
207  {
208  m_advObject->SetFluxVector(&CompressibleFlowSystem::
209  GetFluxVectorDeAlias, this);
210  }
211  else
212  {
213  m_advObject->SetFluxVector(&CompressibleFlowSystem::
214  GetFluxVector, this);
215  }
216 
217  // Setting up Riemann solver for advection operator
218  m_session->LoadSolverInfo("UpwindType", riemName, "Average");
219 
221  riemannSolver = SolverUtils::GetRiemannSolverFactory()
222  .CreateInstance(riemName, m_session);
223 
224  // Setting up parameters for advection operator Riemann solver
225  riemannSolver->SetParam (
226  "gamma", &CompressibleFlowSystem::GetGamma, this);
227  riemannSolver->SetAuxVec(
228  "vecLocs", &CompressibleFlowSystem::GetVecLocs, this);
229  riemannSolver->SetVector(
231 
232  // Concluding initialisation of advection / diffusion operators
233  m_advObject->SetRiemannSolver(riemannSolver);
234  m_advObject->InitObject (m_session, m_fields);
235  }
CompressibleFlowSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
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:145
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 161 of file CompressibleFlowSystem.cpp.

162  {
163  // Get gamma parameter from session file.
164  m_session->LoadParameter("Gamma", m_gamma, 1.4);
165 
166  // Shock capture
167  m_session->LoadSolverInfo("ShockCaptureType",
168  m_shockCaptureType, "Off");
169 
170  // Load parameters for exponential filtering
171  m_session->MatchSolverInfo("ExponentialFiltering","True",
172  m_useFiltering, false);
173  if (m_useFiltering)
174  {
175  m_session->LoadParameter ("FilterAlpha", m_filterAlpha, 36);
176  m_session->LoadParameter ("FilterExponent", m_filterExponent, 16);
177  m_session->LoadParameter ("FilterCutoff", m_filterCutoff, 0);
178  }
179 
180  // Load CFL for local time-stepping (for steady state)
181  m_session->MatchSolverInfo("LocalTimeStep","True",
182  m_useLocalTimeStep, false);
183  if (m_useLocalTimeStep)
184  {
186  "Local time stepping requires CFL parameter.");
187  }
188 
189  }

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 399 of file CompressibleFlowSystem.cpp.

402  {
403  int nTracePts = GetTraceTotPoints();
404  int nvariables = physarray.size();
405 
406  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
407  for (int i = 0; i < nvariables; ++i)
408  {
409  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
410  m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
411  }
412 
413  if (m_bndConds.size())
414  {
415  // Loop over user-defined boundary conditions
416  for (auto &x : m_bndConds)
417  {
418  x->Apply(Fwd, physarray, time);
419  }
420  }
421  }
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 426 of file CompressibleFlowSystem.cpp.

427  {
428  if (m_bndConds.size())
429  {
430  // Loop over user-defined boundary conditions
431  for (auto &x : m_bndConds)
432  {
433  x->ApplyBwdWeight();
434  }
435  }
436  }

References m_bndConds.

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

◆ v_DoDiffusion()

virtual void Nektar::CompressibleFlowSystem::v_DoDiffusion ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const Array< OneD, const Array< OneD, NekDouble >> &  pFwd,
const Array< OneD, const Array< OneD, NekDouble >> &  pBwd 
)
inlineprotectedvirtual

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

Definition at line 206 of file CompressibleFlowSystem.h.

211  {
212  boost::ignore_unused(inarray, outarray, pFwd, pBwd);
213  // Do nothing by default
214  }

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.

Definition at line 874 of file CompressibleFlowSystem.cpp.

877  {
878  bool extraFields;
879  m_session->MatchSolverInfo("OutputExtraFields","True",
880  extraFields, true);
881  if (extraFields)
882  {
883  const int nPhys = m_fields[0]->GetNpoints();
884  const int nCoeffs = m_fields[0]->GetNcoeffs();
885  Array<OneD, Array<OneD, NekDouble>> tmp(m_fields.size());
886 
887  for (int i = 0; i < m_fields.size(); ++i)
888  {
889  tmp[i] = m_fields[i]->GetPhys();
890  }
891 
892  Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
893  Array<OneD, Array<OneD, NekDouble>> velFwd (m_spacedim);
894  for (int i = 0; i < m_spacedim; ++i)
895  {
896  velocity[i] = Array<OneD, NekDouble> (nPhys);
897  velFwd[i] = Array<OneD, NekDouble> (nCoeffs);
898  }
899 
900  Array<OneD, NekDouble> pressure(nPhys), temperature(nPhys);
901  Array<OneD, NekDouble> entropy(nPhys);
902  Array<OneD, NekDouble> soundspeed(nPhys), mach(nPhys);
903  Array<OneD, NekDouble> sensor(nPhys), SensorKappa(nPhys);
904 
905  m_varConv->GetVelocityVector(tmp, velocity);
906  m_varConv->GetPressure (tmp, pressure);
907  m_varConv->GetTemperature(tmp, temperature);
908  m_varConv->GetEntropy (tmp, entropy);
909  m_varConv->GetSoundSpeed(tmp, soundspeed);
910  m_varConv->GetMach (tmp, soundspeed, mach);
911 
912  int sensorOffset;
913  m_session->LoadParameter ("SensorOffset", sensorOffset, 1);
914  m_varConv->GetSensor (m_fields[0], tmp, sensor, SensorKappa,
915  sensorOffset);
916 
917  Array<OneD, NekDouble> pFwd(nCoeffs), TFwd(nCoeffs);
918  Array<OneD, NekDouble> sFwd(nCoeffs);
919  Array<OneD, NekDouble> aFwd(nCoeffs), mFwd(nCoeffs);
920  Array<OneD, NekDouble> sensFwd(nCoeffs);
921 
922  string velNames[3] = {"u", "v", "w"};
923  for (int i = 0; i < m_spacedim; ++i)
924  {
925  m_fields[0]->FwdTrans_IterPerExp(velocity[i], velFwd[i]);
926  variables.push_back(velNames[i]);
927  fieldcoeffs.push_back(velFwd[i]);
928  }
929 
930  m_fields[0]->FwdTrans_IterPerExp(pressure, pFwd);
931  m_fields[0]->FwdTrans_IterPerExp(temperature,TFwd);
932  m_fields[0]->FwdTrans_IterPerExp(entropy, sFwd);
933  m_fields[0]->FwdTrans_IterPerExp(soundspeed, aFwd);
934  m_fields[0]->FwdTrans_IterPerExp(mach, mFwd);
935  m_fields[0]->FwdTrans_IterPerExp(sensor, sensFwd);
936 
937  variables.push_back ("p");
938  variables.push_back ("T");
939  variables.push_back ("s");
940  variables.push_back ("a");
941  variables.push_back ("Mach");
942  variables.push_back ("Sensor");
943  fieldcoeffs.push_back(pFwd);
944  fieldcoeffs.push_back(TFwd);
945  fieldcoeffs.push_back(sFwd);
946  fieldcoeffs.push_back(aFwd);
947  fieldcoeffs.push_back(mFwd);
948  fieldcoeffs.push_back(sensFwd);
949 
951  {
952  // Get min h/p
953  m_artificialDiffusion->SetElmtHP(GetElmtMinHP());
954  // reuse pressure
955  Array<OneD, NekDouble> sensorFwd(nCoeffs);
956  m_artificialDiffusion->GetArtificialViscosity(tmp, pressure);
957  m_fields[0]->FwdTrans_IterPerExp(pressure, sensorFwd);
958 
959  variables.push_back ("ArtificialVisc");
960  fieldcoeffs.push_back(sensorFwd);
961  }
962  }
963  }
Array< OneD, NekDouble > GetElmtMinHP(void)
Function to get estimate of min h/p factor per element.

References GetElmtMinHP(), 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 701 of file CompressibleFlowSystem.cpp.

703  {
704  int nTotQuadPoints = GetTotPoints();
705  int n_element = m_fields[0]->GetExpSize();
706  int expdim = m_fields[0]->GetGraph()->GetMeshDimension();
707  int nfields = m_fields.size();
708  int offset;
709  Array<OneD, NekDouble> tmp;
710 
711  Array<OneD, Array<OneD, NekDouble>> physfields(nfields);
712  for (int i = 0; i < nfields; ++i)
713  {
714  physfields[i] = m_fields[i]->GetPhys();
715  }
716 
717  Array<OneD, NekDouble> stdV(n_element, 0.0);
718 
719  // Getting the velocity vector on the 2D normal space
720  Array<OneD, Array<OneD, NekDouble>> velocity (m_spacedim);
721  Array<OneD, Array<OneD, NekDouble>> stdVelocity(m_spacedim);
722  Array<OneD, Array<OneD, NekDouble>> stdSoundSpeed(m_spacedim);
723  Array<OneD, NekDouble> soundspeed (nTotQuadPoints);
725 
726  for (int i = 0; i < m_spacedim; ++i)
727  {
728  velocity [i] = Array<OneD, NekDouble>(nTotQuadPoints);
729  stdVelocity[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
730  stdSoundSpeed[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
731  }
732 
733  m_varConv->GetVelocityVector(physfields, velocity);
734  m_varConv->GetSoundSpeed (physfields, soundspeed);
735 
736  for (int el = 0; el < n_element; ++el)
737  {
738  ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
739  offset = m_fields[0]->GetPhys_Offset(el);
740  int nq = m_fields[0]->GetExp(el)->GetTotPoints();
741 
742  const SpatialDomains::GeomFactorsSharedPtr metricInfo =
743  m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo();
744  const Array<TwoD, const NekDouble> &gmat =
745  m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()
746  ->GetDerivFactors(ptsKeys);
747 
748  // Convert to standard element
749  // consider soundspeed in all directions
750  // (this might overestimate the cfl)
751  if (metricInfo->GetGtype() == SpatialDomains::eDeformed)
752  {
753  // d xi/ dx = gmat = 1/J * d x/d xi
754  for (int i = 0; i < expdim; ++i)
755  {
756  Vmath::Vmul(nq, gmat[i], 1,
757  velocity[0] + offset, 1,
758  tmp = stdVelocity[i] + offset, 1);
759  Vmath::Vmul(nq, gmat[i], 1,
760  soundspeed + offset, 1,
761  tmp = stdSoundSpeed[i] + offset, 1);
762  for (int j = 1; j < expdim; ++j)
763  {
764  Vmath::Vvtvp(nq, gmat[expdim*j+i], 1,
765  velocity[j] + offset, 1,
766  stdVelocity[i] + offset, 1,
767  tmp = stdVelocity[i] + offset, 1);
768  Vmath::Vvtvp(nq, gmat[expdim*j+i], 1,
769  soundspeed + offset, 1,
770  stdSoundSpeed[i] + offset, 1,
771  tmp = stdSoundSpeed[i] + offset, 1);
772  }
773  }
774  }
775  else
776  {
777  for (int i = 0; i < expdim; ++i)
778  {
779  Vmath::Smul(nq, gmat[i][0],
780  velocity[0] + offset, 1,
781  tmp = stdVelocity[i] + offset, 1);
782  Vmath::Smul(nq, gmat[i][0],
783  soundspeed + offset, 1,
784  tmp = stdSoundSpeed[i] + offset, 1);
785  for (int j = 1; j < expdim; ++j)
786  {
787  Vmath::Svtvp(nq, gmat[expdim*j+i][0],
788  velocity[j] + offset, 1,
789  stdVelocity[i] + offset, 1,
790  tmp = stdVelocity[i] + offset, 1);
791  Vmath::Svtvp(nq, gmat[expdim*j+i][0],
792  soundspeed + offset, 1,
793  stdSoundSpeed[i] + offset, 1,
794  tmp = stdSoundSpeed[i] + offset, 1);
795  }
796  }
797  }
798 
799  NekDouble vel;
800  for (int i = 0; i < nq; ++i)
801  {
802  NekDouble pntVelocity = 0.0;
803  for (int j = 0; j < expdim; ++j)
804  {
805  // Add sound speed
806  vel = std::abs(stdVelocity[j][offset + i]) +
807  SpeedSoundFactor *
808  std::abs(stdSoundSpeed[j][offset + i]);
809  pntVelocity += vel * vel;
810  }
811  pntVelocity = sqrt(pntVelocity);
812  if (pntVelocity > stdV[el])
813  {
814  stdV[el] = pntVelocity;
815  }
816  }
817  }
818 
819  return stdV;
820  }
SOLVER_UTILS_EXPORT int GetTotPoints()
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:246
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:565
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:513
scalarT< T > abs(scalarT< T > in)
Definition: scalar.hpp:272
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:267

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.

Definition at line 627 of file CompressibleFlowSystem.cpp.

629  {
630  int nElements = m_fields[0]->GetExpSize();
631  Array<OneD, NekDouble> tstep (nElements, 0.0);
632 
633  GetElmtTimeStep(inarray, tstep);
634 
635  // Get the minimum time-step limit and return the time-step
636  NekDouble TimeStep = Vmath::Vmin(nElements, tstep, 1);
637  m_comm->AllReduce(TimeStep, LibUtilities::ReduceMin);
638 
639  NekDouble tmp = m_timestep;
640  m_timestep = TimeStep;
641 
642  Array<OneD, NekDouble> cflNonAcoustic(nElements,0.0);
643  cflNonAcoustic = GetElmtCFLVals(false);
644 
645  // Get the minimum time-step limit and return the time-step
646  NekDouble MaxcflNonAcoustic = Vmath::Vmax(nElements, cflNonAcoustic, 1);
647  m_comm->AllReduce(MaxcflNonAcoustic, LibUtilities::ReduceMax);
648 
649  m_cflNonAcoustic = MaxcflNonAcoustic;
650  m_timestep = tmp;
651 
652  return TimeStep;
653  }
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:992
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Definition: Vmath.cpp:892

References Nektar::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 ( )
protectedvirtual

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

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

Definition at line 56 of file CompressibleFlowSystem.cpp.

57  {
59 
60  for (int i = 0; i < m_fields.size(); i++)
61  {
62  // Use BwdTrans to make sure initial condition is in solution space
63  m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
64  m_fields[i]->UpdatePhys());
65  }
66 
69 
70  ASSERTL0(m_session->DefinesSolverInfo("UPWINDTYPE"),
71  "No UPWINDTYPE defined in session.");
72 
73  // Do not forwards transform initial condition
74  m_homoInitialFwd = false;
75 
76  // Set up locations of velocity vector.
77  m_vecLocs = Array<OneD, Array<OneD, NekDouble>>(1);
78  m_vecLocs[0] = Array<OneD, NekDouble>(m_spacedim);
79  for (int i = 0; i < m_spacedim; ++i)
80  {
81  m_vecLocs[0][i] = 1 + i;
82  }
83 
84  // Loading parameters from session file
86 
87  // Setting up advection and diffusion operators
88  InitAdvection();
89 
90  // Create artificial diffusion
91  if (m_shockCaptureType != "Off")
92  {
93  if (m_shockCaptureType == "Physical")
94  {
95  int nPts = m_fields[0]->GetTotPoints();
96  m_muav = Array<OneD, NekDouble>(nPts, 0.0);
97 
98  int nTracePts = m_fields[0]->GetTrace()->GetTotPoints();
99  m_muavTrace = Array<OneD, NekDouble> (nTracePts,0.0);
100  }
101  else
102  {
105  m_session,
106  m_fields,
107  m_spacedim);
108  }
109  }
110 
111  // Forcing terms for the sponge region
112  m_forcing = SolverUtils::Forcing::Load(m_session, shared_from_this(),
113  m_fields, m_fields.size());
114 
115  // User-defined boundary conditions
116  int cnt = 0;
117  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
118  {
119  std::string type =
120  m_fields[0]->GetBndConditions()[n]->GetUserDefined();
121 
122  if (m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType()
124  {
125  continue;
126  }
127 
128  if (!type.empty())
129  {
130  m_bndConds.push_back(GetCFSBndCondFactory().CreateInstance(
131  type,
132  m_session,
133  m_fields,
135  m_spacedim,
136  n,
137  cnt));
138  }
139  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
140  }
141 
145 
147  }
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Compute the right-hand side.
Array< OneD, NekDouble > m_muavTrace
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()
Init object for UnsteadySystem class.
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:128
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::UnsteadySystem::m_homoInitialFwd, m_muav, m_muavTrace, 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::CFSImplicit::v_InitObject(), Nektar::EulerCFE::v_InitObject(), and Nektar::NavierStokesCFE::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 658 of file CompressibleFlowSystem.cpp.

662  {
663  boost::ignore_unused(domain);
664 
665  EquationSystem::v_SetInitialConditions(initialtime, false);
666 
667  // insert white noise in initial condition
668  NekDouble Noise;
669  int phystot = m_fields[0]->GetTotPoints();
670  Array<OneD, NekDouble> noise(phystot);
671 
672  m_session->LoadParameter("Noise", Noise,0.0);
673  int m_nConvectiveFields = m_fields.size();
674 
675  if (Noise > 0.0)
676  {
677  int seed = - m_comm->GetRank()*m_nConvectiveFields;
678  for (int i = 0; i < m_nConvectiveFields; i++)
679  {
680  Vmath::FillWhiteNoise(phystot, Noise, noise, 1,
681  seed);
682  --seed;
683  Vmath::Vadd(phystot, m_fields[i]->GetPhys(), 1,
684  noise, 1, m_fields[i]->UpdatePhys(), 1);
685  m_fields[i]->FwdTrans_IterPerExp(m_fields[i]->GetPhys(),
686  m_fields[i]->UpdateCoeffs());
687  }
688  }
689 
690  if (dumpInitialConditions && m_checksteps)
691  {
693  m_nchk++;
694  }
695  }
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:142

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 995 of file CompressibleFlowSystem.cpp.

998  {
999  boost::ignore_unused(step);
1000  const int nPoints = GetTotPoints();
1001  const int nFields = m_fields.size();
1002  Array<OneD, Array<OneD, NekDouble>> rhs (nFields);
1003  Array<OneD, Array<OneD, NekDouble>> inarray (nFields);
1004  for (int i = 0; i < nFields; ++i)
1005  {
1006  rhs[i] = Array<OneD, NekDouble> (nPoints,0.0);
1007  inarray[i] = m_fields[i]->UpdatePhys();
1008  }
1009 
1010  DoOdeRhs(inarray,rhs,m_time);
1011 
1012  // Holds L2 errors.
1013  Array<OneD, NekDouble> tmp;
1014  Array<OneD, NekDouble> RHSL2 (nFields);
1015  Array<OneD, NekDouble> residual(nFields);
1016 
1017  for (int i = 0; i < nFields; ++i)
1018  {
1019  tmp = rhs[i];
1020 
1021  Vmath::Vmul(nPoints, tmp, 1, tmp, 1, tmp, 1);
1022  residual[i] = Vmath::Vsum(nPoints, tmp, 1);
1023  }
1024 
1025  m_comm->AllReduce(residual , LibUtilities::ReduceSum);
1026 
1027  NekDouble onPoints = 1.0/NekDouble(nPoints);
1028  for (int i = 0; i < nFields; ++i)
1029  {
1030  L2[i] = sqrt(residual[i]*onPoints);
1031  }
1032  }
NekDouble m_time
Current time of simulation.
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
Definition: Vmath.cpp:846

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 106 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterCutoff

NekDouble Nektar::CompressibleFlowSystem::m_filterCutoff
protected

Definition at line 108 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterExponent

NekDouble Nektar::CompressibleFlowSystem::m_filterExponent
protected

Definition at line 107 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

◆ m_muavTrace

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

◆ m_shockCaptureType

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

◆ m_useFiltering

bool Nektar::CompressibleFlowSystem::m_useFiltering
protected

Definition at line 109 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 101 of file CompressibleFlowSystem.h.

Referenced by GetVecLocs(), and v_InitObject().