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)
 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 (void)
 
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...
 
- 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...
 

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, 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, const 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, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
 Return the flux vector for the compressible Euler equations. More...
 
void GetFluxVectorDeAlias (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, 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 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, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
 
virtual Array< OneD, NekDoublev_GetMaxStdVelocity ()
 Compute the advection velocity in the standard space for each element of the expansion. More...
 
- 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...
 
- 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
 
VariableConverterSharedPtr m_varConv
 
std::vector< CFSBndCondSharedPtrm_bndConds
 
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::TimeIntegrationWrapperSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln
 
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...
 
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...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
NekDouble m_checktime
 Time between checkpoints. More...
 
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...
 
- 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 59 of file CompressibleFlowSystem.h.

Constructor & Destructor Documentation

◆ ~CompressibleFlowSystem()

Nektar::CompressibleFlowSystem::~CompressibleFlowSystem ( )
virtual

Destructor for CompressibleFlowSystem class.

Definition at line 136 of file CompressibleFlowSystem.cpp.

137  {
138 
139  }

◆ CompressibleFlowSystem()

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

Definition at line 43 of file CompressibleFlowSystem.cpp.

46  : UnsteadySystem(pSession, pGraph),
47  AdvectionSystem(pSession, pGraph)
48  {
49  }
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.
SOLVER_UTILS_EXPORT AdvectionSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)

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, Array< OneD, NekDouble > > &  pFwd,
const Array< OneD, Array< OneD, NekDouble > > &  pBwd 
)
protected

Compute the advection terms for the right-hand side.

Definition at line 341 of file CompressibleFlowSystem.cpp.

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

Referenced by DoOdeRhs().

347  {
348  int nvariables = inarray.num_elements();
349  Array<OneD, Array<OneD, NekDouble> > advVel(m_spacedim);
350 
351  m_advObject->Advect(nvariables, m_fields, advVel, inarray,
352  outarray, time, pFwd, pBwd);
353  }
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
int m_spacedim
Spatial dimension (>= expansion dim).
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.

◆ DoDiffusion()

void Nektar::CompressibleFlowSystem::DoDiffusion ( const Array< OneD, const 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 358 of file CompressibleFlowSystem.cpp.

References GetElmtMinHP(), m_artificialDiffusion, m_shockCaptureType, and v_DoDiffusion().

Referenced by DoOdeRhs().

363  {
364  v_DoDiffusion(inarray, outarray, pFwd, pBwd);
365 
366  if (m_shockCaptureType != "Off")
367  {
368  // Get min h/p
369  m_artificialDiffusion->SetElmtHP(GetElmtMinHP());
370  m_artificialDiffusion->DoArtificialDiffusion(inarray, outarray);
371  }
372  }
virtual void v_DoDiffusion(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
ArtificialDiffusionSharedPtr m_artificialDiffusion
Array< OneD, NekDouble > GetElmtMinHP(void)
Function to get estimate of min h/p factor per element.

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

References ASSERTL0, Nektar::MultiRegions::eDiscontinuous, 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, SetBoundaryConditions(), and Vmath::Vcopy().

Referenced by v_InitObject().

302  {
303  int i;
304  int nvariables = inarray.num_elements();
305 
306  switch(m_projectionType)
307  {
309  {
310  // Just copy over array
311  int npoints = GetNpoints();
312 
313  for(i = 0; i < nvariables; ++i)
314  {
315  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
316  if(m_useFiltering)
317  {
318  m_fields[i]->ExponentialFilter(outarray[i],
320  }
321  }
322  SetBoundaryConditions(outarray, time);
323  break;
324  }
327  {
328  ASSERTL0(false, "No Continuous Galerkin for full compressible "
329  "Navier-Stokes equations");
330  break;
331  }
332  default:
333  ASSERTL0(false, "Unknown projection scheme");
334  break;
335  }
336  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

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

References DoAdvection(), DoDiffusion(), Nektar::SolverUtils::EquationSystem::eHomogeneous1D, GetElmtTimeStep(), Nektar::SolverUtils::EquationSystem::GetNpoints(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::EquationSystem::m_HomogeneousType, Nektar::SolverUtils::EquationSystem::m_timestep, m_useLocalTimeStep, Vmath::Neg(), Nektar::NullNekDoubleArrayofArray, and Vmath::Smul().

Referenced by v_InitObject().

226  {
227  int i;
228  int nvariables = inarray.num_elements();
229  int npoints = GetNpoints();
230  int nTracePts = GetTraceTotPoints();
231 
232  // Store forwards/backwards space along trace space
233  Array<OneD, Array<OneD, NekDouble> > Fwd (nvariables);
234  Array<OneD, Array<OneD, NekDouble> > Bwd (nvariables);
235 
237  {
240  }
241  else
242  {
243  for(i = 0; i < nvariables; ++i)
244  {
245  Fwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
246  Bwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
247  m_fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
248  }
249  }
250 
251  // Calculate advection
252  DoAdvection(inarray, outarray, time, Fwd, Bwd);
253 
254  // Negate results
255  for (i = 0; i < nvariables; ++i)
256  {
257  Vmath::Neg(npoints, outarray[i], 1);
258  }
259 
260  // Add diffusion terms
261  DoDiffusion(inarray, outarray, Fwd, Bwd);
262 
263  // Add forcing terms
264  for (auto &x : m_forcing)
265  {
266  x->Apply(m_fields, inarray, outarray, time);
267  }
268 
269  if (m_useLocalTimeStep)
270  {
271  int nElements = m_fields[0]->GetExpSize();
272  int nq, offset;
273  NekDouble fac;
274  Array<OneD, NekDouble> tmp;
275 
276  Array<OneD, NekDouble> tstep (nElements, 0.0);
277  GetElmtTimeStep(inarray, tstep);
278 
279  // Loop over elements
280  for(int n = 0; n < nElements; ++n)
281  {
282  nq = m_fields[0]->GetExp(n)->GetTotPoints();
283  offset = m_fields[0]->GetPhys_Offset(n);
284  fac = tstep[n] / m_timestep;
285  for(i = 0; i < nvariables; ++i)
286  {
287  Vmath::Smul(nq, fac, outarray[i] + offset, 1,
288  tmp = outarray[i] + offset, 1);
289  }
290  }
291  }
292  }
void DoDiffusion(const Array< OneD, const 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.
NekDouble m_timestep
Time step size.
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.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
double NekDouble
void DoAdvection(const Array< OneD, const 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.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayofArray
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
enum HomogeneousType m_HomogeneousType

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

926  {
927  density = physfield[0];
928  }

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

References ASSERTL0, Nektar::LocalRegions::Expansion1D::GetGeom1D(), Nektar::SolverUtils::EquationSystem::m_expdim, and Nektar::SolverUtils::EquationSystem::m_fields.

Referenced by DoDiffusion(), and v_ExtraFldOutput().

945 {
946  int nElements = m_fields[0]->GetExpSize();
947  Array<OneD, NekDouble> hOverP(nElements, 1.0);
948 
949  // Determine h/p scaling
950  Array<OneD, int> pOrderElmt = m_fields[0]->EvalBasisNumModesMaxPerExp();
951  for (int e = 0; e < nElements; e++)
952  {
953  NekDouble h = 1.0e+10;
954  switch(m_expdim)
955  {
956  case 3:
957  {
959  exp3D = m_fields[0]->GetExp(e)->as<LocalRegions::Expansion3D>();
960  for(int i = 0; i < exp3D->GetNedges(); ++i)
961  {
962  h = min(h, exp3D->GetGeom3D()->GetEdge(i)->GetVertex(0)->
963  dist(*(exp3D->GetGeom3D()->GetEdge(i)->GetVertex(1))));
964  }
965  break;
966  }
967 
968  case 2:
969  {
971  exp2D = m_fields[0]->GetExp(e)->as<LocalRegions::Expansion2D>();
972  for(int i = 0; i < exp2D->GetNedges(); ++i)
973  {
974  h = min(h, exp2D->GetGeom2D()->GetEdge(i)->GetVertex(0)->
975  dist(*(exp2D->GetGeom2D()->GetEdge(i)->GetVertex(1))));
976  }
977  break;
978  }
979  case 1:
980  {
982  exp1D = m_fields[0]->GetExp(e)->as<LocalRegions::Expansion1D>();
983 
984  h = min(h, exp1D->GetGeom1D()->GetVertex(0)->
985  dist(*(exp1D->GetGeom1D()->GetVertex(1))));
986 
987  break;
988  }
989  default:
990  {
991  ASSERTL0(false,"Dimension out of bound.")
992  }
993  }
994 
995  // Determine h/p scaling
996  hOverP[e] = h/max(pOrderElmt[e]-1,1);
997 
998  }
999  return hOverP;
1000 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
int m_expdim
Expansion dimension.
std::shared_ptr< Expansion3D > Expansion3DSharedPtr
Definition: Expansion2D.h:49
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:47
std::shared_ptr< Expansion1D > Expansion1DSharedPtr
Definition: Expansion1D.h:51

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

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(), and v_GetTimeStep().

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

◆ GetFluxVector()

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

Return the flux vector for the compressible Euler equations.

Parameters
physfieldFields.
fluxResulting flux.

Definition at line 404 of file CompressibleFlowSystem.cpp.

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

Referenced by InitAdvection().

407  {
408  int i, j;
409  int nq = physfield[0].num_elements();
410  int nVariables = m_fields.num_elements();
411 
412  Array<OneD, NekDouble> pressure(nq);
413  Array<OneD, Array<OneD, NekDouble> > velocity(m_spacedim);
414 
415  // Flux vector for the rho equation
416  for (i = 0; i < m_spacedim; ++i)
417  {
418  velocity[i] = Array<OneD, NekDouble>(nq);
419  Vmath::Vcopy(nq, physfield[i+1], 1, flux[0][i], 1);
420  }
421 
422  m_varConv->GetVelocityVector(physfield, velocity);
423  m_varConv->GetPressure(physfield, pressure);
424 
425  // Flux vector for the velocity fields
426  for (i = 0; i < m_spacedim; ++i)
427  {
428  for (j = 0; j < m_spacedim; ++j)
429  {
430  Vmath::Vmul(nq, velocity[j], 1, physfield[i+1], 1,
431  flux[i+1][j], 1);
432  }
433 
434  // Add pressure to appropriate field
435  Vmath::Vadd(nq, flux[i+1][i], 1, pressure, 1, flux[i+1][i], 1);
436  }
437 
438  // Flux vector for energy.
439  Vmath::Vadd(nq, physfield[m_spacedim+1], 1, pressure, 1,
440  pressure, 1);
441 
442  for (j = 0; j < m_spacedim; ++j)
443  {
444  Vmath::Vmul(nq, velocity[j], 1, pressure, 1,
445  flux[m_spacedim+1][j], 1);
446  }
447 
448  // For the smooth viscosity model
449  if (nVariables == m_spacedim+3)
450  {
451  // Add a zero row for the advective fluxes
452  for (j = 0; j < m_spacedim; ++j)
453  {
454  Vmath::Zero(nq, flux[m_spacedim+2][j], 1);
455  }
456  }
457  }
VariableConverterSharedPtr m_varConv
int m_spacedim
Spatial dimension (>= expansion dim).
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
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:302
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:186

◆ GetFluxVectorDeAlias()

void Nektar::CompressibleFlowSystem::GetFluxVectorDeAlias ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, Array< OneD, 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 466 of file CompressibleFlowSystem.cpp.

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

Referenced by InitAdvection().

469  {
470  int i, j;
471  int nq = physfield[0].num_elements();
472  int nVariables = m_fields.num_elements();
473 
474  // Factor to rescale 1d points in dealiasing
475  NekDouble OneDptscale = 2;
476  nq = m_fields[0]->Get1DScaledTotPoints(OneDptscale);
477 
478  Array<OneD, NekDouble> pressure(nq);
479  Array<OneD, Array<OneD, NekDouble> > velocity(m_spacedim);
480 
481  Array<OneD, Array<OneD, NekDouble> > physfield_interp(nVariables);
482  Array<OneD, Array<OneD, Array<OneD, NekDouble> > > flux_interp(
483  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(
490  OneDptscale, physfield[i], 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,
537  pressure, 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,
547  flux_interp[m_spacedim+1][j],
548  flux[m_spacedim+1][j]);
549  }
550  }
VariableConverterSharedPtr m_varConv
int m_spacedim
Spatial dimension (>= expansion dim).
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302
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:186

◆ GetGamma()

NekDouble Nektar::CompressibleFlowSystem::GetGamma ( )
inlineprotected

Definition at line 175 of file CompressibleFlowSystem.h.

References m_gamma.

Referenced by InitAdvection().

176  {
177  return m_gamma;
178  }

◆ GetNormals()

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

Definition at line 185 of file CompressibleFlowSystem.h.

References Nektar::SolverUtils::EquationSystem::m_traceNormals, and v_ExtraFldOutput().

Referenced by InitAdvection().

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

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

References m_varConv.

916  {
917  m_varConv->GetPressure(physfield, pressure);
918  }
VariableConverterSharedPtr m_varConv

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

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

Referenced by GetStabilityLimitVector().

775  {
776  ASSERTL0(n <= 20, "Illegal modes dimension for CFL calculation "
777  "(P has to be less then 20)");
778 
779  NekDouble CFLDG[21] = { 2.0000, 6.0000, 11.8424, 19.1569,
780  27.8419, 37.8247, 49.0518, 61.4815,
781  75.0797, 89.8181, 105.6700, 122.6200,
782  140.6400, 159.7300, 179.8500, 201.0100,
783  223.1800, 246.3600, 270.5300, 295.6900,
784  321.8300}; //CFLDG 1D [0-20]
785  NekDouble CFL = 0.0;
786 
788  {
789  CFL = CFLDG[n];
790  }
791  else
792  {
793  ASSERTL0(false, "Continuous Galerkin stability coefficients "
794  "not introduced yet.");
795  }
796 
797  return CFL;
798  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
double NekDouble

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

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

809  {
810  int i;
811  Array<OneD,NekDouble> returnval(m_fields[0]->GetExpSize(), 0.0);
812  for (i =0; i<m_fields[0]->GetExpSize(); i++)
813  {
814  returnval[i] = GetStabilityLimit(ExpOrder[i]);
815  }
816  return returnval;
817  }
NekDouble GetStabilityLimit(int n)
Function to calculate the stability limit for DG/CG.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()

◆ GetVecLocs()

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

Definition at line 180 of file CompressibleFlowSystem.h.

References m_vecLocs.

Referenced by InitAdvection().

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

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

References m_varConv.

Referenced by HasConstantDensity().

936  {
937  m_varConv->GetVelocityVector(physfield, velocity);
938  }
VariableConverterSharedPtr m_varConv

◆ HasConstantDensity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 87 of file CompressibleFlowSystem.h.

References GetVelocity().

88  {
89  return false;
90  }

◆ InitAdvection()

void Nektar::CompressibleFlowSystem::InitAdvection ( )
protected

Create advection and diffusion objects for CFS.

Definition at line 176 of file CompressibleFlowSystem.cpp.

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().

177  {
178  // Check if projection type is correct
180  "Unsupported projection type.");
181 
182  string advName, riemName;
183  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
184 
186  .CreateInstance(advName, advName);
187 
189  {
190  m_advObject->SetFluxVector(&CompressibleFlowSystem::
191  GetFluxVectorDeAlias, this);
192  }
193  else
194  {
195  m_advObject->SetFluxVector (&CompressibleFlowSystem::
196  GetFluxVector, this);
197  }
198 
199  // Setting up Riemann solver for advection operator
200  m_session->LoadSolverInfo("UpwindType", riemName, "Average");
201 
203  riemannSolver = SolverUtils::GetRiemannSolverFactory()
204  .CreateInstance(riemName, m_session);
205 
206  // Setting up parameters for advection operator Riemann solver
207  riemannSolver->SetParam (
208  "gamma", &CompressibleFlowSystem::GetGamma, this);
209  riemannSolver->SetAuxVec(
210  "vecLocs", &CompressibleFlowSystem::GetVecLocs, this);
211  riemannSolver->SetVector(
213 
214  // Concluding initialisation of advection / diffusion operators
215  m_advObject->SetRiemannSolver (riemannSolver);
216  m_advObject->InitObject (m_session, m_fields);
217  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
CompressibleFlowSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
std::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
void GetFluxVectorDeAlias(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
Return the flux vector for the compressible Euler equations by using the de-aliasing technique...
RiemannSolverFactory & GetRiemannSolverFactory()
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:47
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void GetFluxVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
Return the flux vector for the compressible Euler equations.

◆ InitialiseParameters()

void Nektar::CompressibleFlowSystem::InitialiseParameters ( )
protected

Load CFS parameters from the session file.

Definition at line 144 of file CompressibleFlowSystem.cpp.

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().

145  {
146  // Get gamma parameter from session file.
147  m_session->LoadParameter("Gamma", m_gamma, 1.4);
148 
149  // Shock capture
150  m_session->LoadSolverInfo("ShockCaptureType",
151  m_shockCaptureType, "Off");
152 
153  // Load parameters for exponential filtering
154  m_session->MatchSolverInfo("ExponentialFiltering","True",
155  m_useFiltering, false);
156  if(m_useFiltering)
157  {
158  m_session->LoadParameter ("FilterAlpha", m_filterAlpha, 36);
159  m_session->LoadParameter ("FilterExponent", m_filterExponent, 16);
160  m_session->LoadParameter ("FilterCutoff", m_filterCutoff, 0);
161  }
162 
163  // Load CFL for local time-stepping (for steady state)
164  m_session->MatchSolverInfo("LocalTimeStep","True",
165  m_useLocalTimeStep, false);
167  {
169  "Local time stepping requires CFL parameter.");
170  }
171  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
NekDouble m_cflSafetyFactor
CFL safety factor (comprise between 0 to 1).
LibUtilities::SessionReaderSharedPtr m_session
The session reader.

◆ SetBoundaryConditions()

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

Definition at line 374 of file CompressibleFlowSystem.cpp.

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

Referenced by DoOdeProjection().

377  {
378  int nTracePts = GetTraceTotPoints();
379  int nvariables = physarray.num_elements();
380 
381  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
382  for (int i = 0; i < nvariables; ++i)
383  {
384  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
385  m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
386  }
387 
388  if (m_bndConds.size())
389  {
390  // Loop over user-defined boundary conditions
391  for (auto &x : m_bndConds)
392  {
393  x->Apply(Fwd, physarray, time);
394  }
395  }
396  }
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
std::vector< CFSBndCondSharedPtr > m_bndConds

◆ 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, Array< OneD, NekDouble > > &  pFwd,
const Array< OneD, Array< OneD, NekDouble > > &  pBwd 
)
inlineprotectedvirtual

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

Definition at line 194 of file CompressibleFlowSystem.h.

References v_GetMaxStdVelocity().

Referenced by DoDiffusion().

199  {
200  boost::ignore_unused(inarray, outarray, pFwd, pBwd);
201  // Do nothing by default
202  }

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

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.

Referenced by GetNormals().

822  {
823  bool extraFields;
824  m_session->MatchSolverInfo("OutputExtraFields","True",
825  extraFields, true);
826  if (extraFields)
827  {
828  const int nPhys = m_fields[0]->GetNpoints();
829  const int nCoeffs = m_fields[0]->GetNcoeffs();
830  Array<OneD, Array<OneD, NekDouble> > tmp(m_fields.num_elements());
831 
832  for (int i = 0; i < m_fields.num_elements(); ++i)
833  {
834  tmp[i] = m_fields[i]->GetPhys();
835  }
836 
837  Array<OneD, Array<OneD, NekDouble> > velocity(m_spacedim);
838  Array<OneD, Array<OneD, NekDouble> > velFwd (m_spacedim);
839  for (int i = 0; i < m_spacedim; ++i)
840  {
841  velocity[i] = Array<OneD, NekDouble> (nPhys);
842  velFwd[i] = Array<OneD, NekDouble> (nCoeffs);
843  }
844 
845  Array<OneD, NekDouble> pressure(nPhys), temperature(nPhys);
846  Array<OneD, NekDouble> entropy(nPhys);
847  Array<OneD, NekDouble> soundspeed(nPhys), mach(nPhys);
848  Array<OneD, NekDouble> sensor(nPhys), SensorKappa(nPhys);
849 
850  m_varConv->GetVelocityVector(tmp, velocity);
851  m_varConv->GetPressure (tmp, pressure);
852  m_varConv->GetTemperature(tmp, temperature);
853  m_varConv->GetEntropy (tmp, entropy);
854  m_varConv->GetSoundSpeed(tmp, soundspeed);
855  m_varConv->GetMach (tmp, soundspeed, mach);
856 
857  int sensorOffset;
858  m_session->LoadParameter ("SensorOffset", sensorOffset, 1);
859  m_varConv->GetSensor (m_fields[0], tmp, sensor, SensorKappa,
860  sensorOffset);
861 
862  Array<OneD, NekDouble> pFwd(nCoeffs), TFwd(nCoeffs);
863  Array<OneD, NekDouble> sFwd(nCoeffs);
864  Array<OneD, NekDouble> aFwd(nCoeffs), mFwd(nCoeffs);
865  Array<OneD, NekDouble> sensFwd(nCoeffs);
866 
867  string velNames[3] = {"u", "v", "w"};
868  for (int i = 0; i < m_spacedim; ++i)
869  {
870  m_fields[0]->FwdTrans_IterPerExp(velocity[i], velFwd[i]);
871  variables.push_back(velNames[i]);
872  fieldcoeffs.push_back(velFwd[i]);
873  }
874 
875  m_fields[0]->FwdTrans_IterPerExp(pressure, pFwd);
876  m_fields[0]->FwdTrans_IterPerExp(temperature,TFwd);
877  m_fields[0]->FwdTrans_IterPerExp(entropy, sFwd);
878  m_fields[0]->FwdTrans_IterPerExp(soundspeed, aFwd);
879  m_fields[0]->FwdTrans_IterPerExp(mach, mFwd);
880  m_fields[0]->FwdTrans_IterPerExp(sensor, sensFwd);
881 
882  variables.push_back ("p");
883  variables.push_back ("T");
884  variables.push_back ("s");
885  variables.push_back ("a");
886  variables.push_back ("Mach");
887  variables.push_back ("Sensor");
888  fieldcoeffs.push_back(pFwd);
889  fieldcoeffs.push_back(TFwd);
890  fieldcoeffs.push_back(sFwd);
891  fieldcoeffs.push_back(aFwd);
892  fieldcoeffs.push_back(mFwd);
893  fieldcoeffs.push_back(sensFwd);
894 
896  {
897  // Get min h/p
898  m_artificialDiffusion->SetElmtHP(GetElmtMinHP());
899  // reuse pressure
900  Array<OneD, NekDouble> sensorFwd(nCoeffs);
901  m_artificialDiffusion->GetArtificialViscosity(tmp, pressure);
902  m_fields[0]->FwdTrans_IterPerExp(pressure, sensorFwd);
903 
904  variables.push_back ("ArtificialVisc");
905  fieldcoeffs.push_back(sensorFwd);
906  }
907  }
908  }
VariableConverterSharedPtr m_varConv
int m_spacedim
Spatial dimension (>= expansion dim).
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
ArtificialDiffusionSharedPtr m_artificialDiffusion
Array< OneD, NekDouble > GetElmtMinHP(void)
Function to get estimate of min h/p factor per element.

◆ v_GetMaxStdVelocity()

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

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

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Definition at line 648 of file CompressibleFlowSystem.cpp.

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

Referenced by v_DoDiffusion().

649  {
650  int nTotQuadPoints = GetTotPoints();
651  int n_element = m_fields[0]->GetExpSize();
652  int expdim = m_fields[0]->GetGraph()->GetMeshDimension();
653  int nfields = m_fields.num_elements();
654  int offset;
655  Array<OneD, NekDouble> tmp;
656 
657  Array<OneD, Array<OneD, NekDouble> > physfields(nfields);
658  for (int i = 0; i < nfields; ++i)
659  {
660  physfields[i] = m_fields[i]->GetPhys();
661  }
662 
663  Array<OneD, NekDouble> stdV(n_element, 0.0);
664 
665  // Getting the velocity vector on the 2D normal space
666  Array<OneD, Array<OneD, NekDouble> > velocity (m_spacedim);
667  Array<OneD, Array<OneD, NekDouble> > stdVelocity(m_spacedim);
668  Array<OneD, Array<OneD, NekDouble> > stdSoundSpeed(m_spacedim);
669  Array<OneD, NekDouble> soundspeed (nTotQuadPoints);
671 
672  for (int i = 0; i < m_spacedim; ++i)
673  {
674  velocity [i] = Array<OneD, NekDouble>(nTotQuadPoints);
675  stdVelocity[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
676  stdSoundSpeed[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
677  }
678 
679  m_varConv->GetVelocityVector(physfields, velocity);
680  m_varConv->GetSoundSpeed (physfields, soundspeed);
681 
682  for(int el = 0; el < n_element; ++el)
683  {
684  ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
685  offset = m_fields[0]->GetPhys_Offset(el);
686  int nq = m_fields[0]->GetExp(el)->GetTotPoints();
687 
688  const SpatialDomains::GeomFactorsSharedPtr metricInfo =
689  m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo();
690  const Array<TwoD, const NekDouble> &gmat =
691  m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo()
692  ->GetDerivFactors(ptsKeys);
693 
694  // Convert to standard element
695  // consider soundspeed in all directions
696  // (this might overestimate the cfl)
697  if(metricInfo->GetGtype() == SpatialDomains::eDeformed)
698  {
699  // d xi/ dx = gmat = 1/J * d x/d xi
700  for (int i = 0; i < expdim; ++i)
701  {
702  Vmath::Vmul(nq, gmat[i], 1,
703  velocity[0] + offset, 1,
704  tmp = stdVelocity[i] + offset, 1);
705  Vmath::Vmul(nq, gmat[i], 1,
706  soundspeed + offset, 1,
707  tmp = stdSoundSpeed[i] + offset, 1);
708  for (int j = 1; j < expdim; ++j)
709  {
710  Vmath::Vvtvp(nq, gmat[expdim*j+i], 1,
711  velocity[j] + offset, 1,
712  stdVelocity[i] + offset, 1,
713  tmp = stdVelocity[i] + offset, 1);
714  Vmath::Vvtvp(nq, gmat[expdim*j+i], 1,
715  soundspeed + offset, 1,
716  stdSoundSpeed[i] + offset, 1,
717  tmp = stdSoundSpeed[i] + offset, 1);
718  }
719  }
720  }
721  else
722  {
723  for (int i = 0; i < expdim; ++i)
724  {
725  Vmath::Smul(nq, gmat[i][0],
726  velocity[0] + offset, 1,
727  tmp = stdVelocity[i] + offset, 1);
728  Vmath::Smul(nq, gmat[i][0],
729  soundspeed + offset, 1,
730  tmp = stdSoundSpeed[i] + offset, 1);
731  for (int j = 1; j < expdim; ++j)
732  {
733  Vmath::Svtvp(nq, gmat[expdim*j+i][0],
734  velocity[j] + offset, 1,
735  stdVelocity[i] + offset, 1,
736  tmp = stdVelocity[i] + offset, 1);
737  Vmath::Svtvp(nq, gmat[expdim*j+i][0],
738  soundspeed + offset, 1,
739  stdSoundSpeed[i] + offset, 1,
740  tmp = stdSoundSpeed[i] + offset, 1);
741  }
742  }
743  }
744 
745  NekDouble vel;
746  for (int i = 0; i < nq; ++i)
747  {
748  NekDouble pntVelocity = 0.0;
749  for (int j = 0; j < expdim; ++j)
750  {
751  // Add sound speed
752  vel = std::abs(stdVelocity[j][offset + i]) +
753  std::abs(stdSoundSpeed[j][offset + i]);
754  pntVelocity += vel * vel;
755  }
756  pntVelocity = sqrt(pntVelocity);
757  if (pntVelocity > stdV[el])
758  {
759  stdV[el] = pntVelocity;
760  }
761  }
762  }
763 
764  return stdV;
765  }
std::vector< PointsKey > PointsKeyVector
Definition: Points.h:246
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
VariableConverterSharedPtr m_varConv
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:488
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:445
SOLVER_UTILS_EXPORT int GetTotPoints()
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216
int m_spacedim
Spatial dimension (>= expansion dim).
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
Geometry is curved or has non-constant factors.
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:186

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

References GetElmtTimeStep(), Nektar::SolverUtils::EquationSystem::m_comm, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::LibUtilities::ReduceMin, and Vmath::Vmin().

590  {
591  int nElements = m_fields[0]->GetExpSize();
592  Array<OneD, NekDouble> tstep (nElements, 0.0);
593 
594  GetElmtTimeStep(inarray, tstep);
595 
596  // Get the minimum time-step limit and return the time-step
597  NekDouble TimeStep = Vmath::Vmin(nElements, tstep, 1);
598  m_comm->AllReduce(TimeStep, LibUtilities::ReduceMin);
599  return TimeStep;
600  }
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:874
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.
LibUtilities::CommSharedPtr m_comm
Communicator.
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.

◆ v_InitObject()

void Nektar::CompressibleFlowSystem::v_InitObject ( )
protectedvirtual

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

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

Definition at line 54 of file CompressibleFlowSystem.cpp.

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::UnsteadySystem::m_explicitAdvection, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, 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, and Nektar::SolverUtils::AdvectionSystem::v_InitObject().

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

55  {
57 
60 
61  ASSERTL0(m_session->DefinesSolverInfo("UPWINDTYPE"),
62  "No UPWINDTYPE defined in session.");
63 
64  // Do not forwards transform initial condition
65  m_homoInitialFwd = false;
66 
67  // Set up locations of velocity vector.
68  m_vecLocs = Array<OneD, Array<OneD, NekDouble> >(1);
69  m_vecLocs[0] = Array<OneD, NekDouble>(m_spacedim);
70  for (int i = 0; i < m_spacedim; ++i)
71  {
72  m_vecLocs[0][i] = 1 + i;
73  }
74 
75  // Loading parameters from session file
77 
78  // Setting up advection and diffusion operators
79  InitAdvection();
80 
81  // Create artificial diffusion
82  if (m_shockCaptureType != "Off")
83  {
86  m_session,
87  m_fields,
88  m_spacedim);
89  }
90 
91  // Forcing terms for the sponge region
92  m_forcing = SolverUtils::Forcing::Load(m_session, shared_from_this(),
93  m_fields, m_fields.num_elements());
94 
95  // User-defined boundary conditions
96  int cnt = 0;
97  for (int n = 0; n < m_fields[0]->GetBndConditions().num_elements(); ++n)
98  {
99  std::string type =
100  m_fields[0]->GetBndConditions()[n]->GetUserDefined();
101 
102  if (m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType()
104  {
105  continue;
106  }
107 
108  if(!type.empty())
109  {
110  m_bndConds.push_back(GetCFSBndCondFactory().CreateInstance(
111  type,
112  m_session,
113  m_fields,
115  m_spacedim,
116  n,
117  cnt));
118  }
119  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
120  }
121 
123  {
126  }
127  else
128  {
129  ASSERTL0(false, "Implicit CFS not set up.");
130  }
131  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
VariableConverterSharedPtr m_varConv
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
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 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...
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
CFSBndCondFactory & GetCFSBndCondFactory()
Declaration of the boundary condition factory singleton.
Definition: CFSBndCond.cpp:41
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
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:85
int m_spacedim
Spatial dimension (>= expansion dim).
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
void InitialiseParameters()
Load CFS parameters from the session file.
ArtificialDiffusionFactory & GetArtificialDiffusionFactory()
Declaration of the artificial diffusion factory singleton.
void InitAdvection()
Create advection and diffusion objects for CFS.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
ArtificialDiffusionSharedPtr m_artificialDiffusion
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Init object for UnsteadySystem class.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
std::vector< CFSBndCondSharedPtr > m_bndConds

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

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().

609  {
610  boost::ignore_unused(domain);
611 
612  EquationSystem::v_SetInitialConditions(initialtime, false);
613 
614  // insert white noise in initial condition
615  NekDouble Noise;
616  int phystot = m_fields[0]->GetTotPoints();
617  Array<OneD, NekDouble> noise(phystot);
618 
619  m_session->LoadParameter("Noise", Noise,0.0);
620  int m_nConvectiveFields = m_fields.num_elements();
621 
622  if (Noise > 0.0)
623  {
624  int seed = - m_comm->GetRank()*m_nConvectiveFields;
625  for (int i = 0; i < m_nConvectiveFields; i++)
626  {
627  Vmath::FillWhiteNoise(phystot, Noise, noise, 1,
628  seed);
629  --seed;
630  Vmath::Vadd(phystot, m_fields[i]->GetPhys(), 1,
631  noise, 1, m_fields[i]->UpdatePhys(), 1);
632  m_fields[i]->FwdTrans_IterPerExp(m_fields[i]->GetPhys(),
633  m_fields[i]->UpdateCoeffs());
634  }
635  }
636 
637  if (dumpInitialConditions && m_checksteps)
638  {
640  m_nchk++;
641  }
642  }
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.
LibUtilities::CommSharedPtr m_comm
Communicator.
double NekDouble
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void FillWhiteNoise(int n, const T eps, T *x, const int incx, int outseed)
Fills a vector with white noise.
Definition: Vmath.cpp:139
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:302

Friends And Related Function Documentation

◆ MemoryManager< CompressibleFlowSystem >

friend class MemoryManager< CompressibleFlowSystem >
friend

Definition at line 64 of file CompressibleFlowSystem.h.

Member Data Documentation

◆ m_artificialDiffusion

ArtificialDiffusionSharedPtr Nektar::CompressibleFlowSystem::m_artificialDiffusion
protected

Definition at line 98 of file CompressibleFlowSystem.h.

Referenced by DoDiffusion(), v_ExtraFldOutput(), and v_InitObject().

◆ m_bndConds

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

Definition at line 116 of file CompressibleFlowSystem.h.

Referenced by SetBoundaryConditions(), and v_InitObject().

◆ m_diffusion

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

◆ m_filterAlpha

NekDouble Nektar::CompressibleFlowSystem::m_filterAlpha
protected

Definition at line 104 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterCutoff

NekDouble Nektar::CompressibleFlowSystem::m_filterCutoff
protected

Definition at line 106 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterExponent

NekDouble Nektar::CompressibleFlowSystem::m_filterExponent
protected

Definition at line 105 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_forcing

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

Definition at line 119 of file CompressibleFlowSystem.h.

Referenced by DoOdeRhs(), and v_InitObject().

◆ m_gamma

NekDouble Nektar::CompressibleFlowSystem::m_gamma
protected

◆ m_shockCaptureType

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

Definition at line 101 of file CompressibleFlowSystem.h.

Referenced by DoDiffusion(), InitialiseParameters(), and v_InitObject().

◆ m_useFiltering

bool Nektar::CompressibleFlowSystem::m_useFiltering
protected

Definition at line 107 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_useLocalTimeStep

bool Nektar::CompressibleFlowSystem::m_useLocalTimeStep
protected

Definition at line 110 of file CompressibleFlowSystem.h.

Referenced by DoOdeRhs(), and InitialiseParameters().

◆ m_varConv

VariableConverterSharedPtr Nektar::CompressibleFlowSystem::m_varConv
protected

◆ m_vecLocs

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

Definition at line 99 of file CompressibleFlowSystem.h.

Referenced by GetVecLocs(), and v_InitObject().