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

#include <CompressibleFlowSystem.h>

Inheritance diagram for Nektar::CompressibleFlowSystem:
[legend]

Public Member Functions

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

Protected Member Functions

 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
virtual void v_InitObject (bool DeclareFields=true) override
 Initialization object for CompressibleFlowSystem class. More...
 
void InitialiseParameters ()
 Load CFS parameters from the session file. More...
 
void InitAdvection ()
 Create advection and diffusion objects for CFS. More...
 
void DoOdeRhs (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
 Compute the right-hand side. More...
 
void DoOdeProjection (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
 Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection. More...
 
void DoAdvection (const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const Array< OneD, Array< OneD, NekDouble >> &pFwd, const Array< OneD, Array< OneD, NekDouble >> &pBwd)
 Compute the advection terms for the right-hand side. More...
 
void DoDiffusion (const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, Array< OneD, NekDouble >> &pFwd, const Array< OneD, Array< OneD, NekDouble >> &pBwd)
 Add the diffusions terms to the right-hand side. More...
 
void GetFluxVector (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations. More...
 
void GetFluxVectorDeAlias (const Array< OneD, const Array< OneD, NekDouble >> &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations by using the de-aliasing technique. More...
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
 
void SetBoundaryConditionsBwdWeight ()
 Set up a weight on physical boundaries for boundary condition applications. More...
 
void GetElmtTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, NekDouble > &tstep)
 Calculate the maximum timestep on each element subject to CFL restrictions. More...
 
virtual NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray) override
 Calculate the maximum timestep subject to CFL restrictions. More...
 
virtual void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
 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 MultiRegions::ExpListSharedPtr v_GetPressure () override
 
virtual void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables) override
 
virtual void v_DoDiffusion (const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, Array< OneD, NekDouble >> &pFwd, const Array< OneD, Array< OneD, NekDouble >> &pBwd)=0
 
virtual Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor) override
 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) override
 
virtual bool v_SupportsShockCaptType (const std::string type) const =0
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step) override
 
- 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 () override
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise () override
 Sets up initial conditions. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s) override
 Print a summary of time stepping parameters. 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 v_UpdateTimeStepCheck ()
 
SOLVER_UTILS_EXPORT void DoDummyProjection (const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
 Perform dummy projection. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT 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)
 
- Protected Member Functions inherited from Nektar::SolverUtils::FluidInterface
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameProjectionMat (const boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameProjectionMat (boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameAngles (const Array< OneD, NekDouble > &vFrameTheta)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameAngles (Array< OneD, NekDouble > &vFrameTheta)
 

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_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
 
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_infosteps
 Number of time steps between outputting status information. More...
 
int m_pararealIter
 Number of parareal time iteration. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_useInitialCondition
 Flag to determine if IC are used. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
Array< OneD, NekDoublem_movingFrameVelsxyz
 Moving frame of reference velocities. More...
 
Array< OneD, NekDoublem_movingFrameTheta
 Moving frame of reference angles with respect to the. More...
 
boost::numeric::ublas::matrix< NekDoublem_movingFrameProjMat
 Projection matrix for transformation between inertial and moving. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

Friends

class MemoryManager< CompressibleFlowSystem >
 

Additional Inherited Members

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

Detailed Description

Definition at line 60 of file CompressibleFlowSystem.h.

Constructor & Destructor Documentation

◆ ~CompressibleFlowSystem()

Nektar::CompressibleFlowSystem::~CompressibleFlowSystem ( )
virtual

Destructor for CompressibleFlowSystem class.

Definition at line 129 of file CompressibleFlowSystem.cpp.

130 {
131 }

◆ CompressibleFlowSystem()

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

Definition at line 45 of file CompressibleFlowSystem.cpp.

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

Member Function Documentation

◆ DoAdvection()

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

Compute the advection terms for the right-hand side.

Definition at line 341 of file CompressibleFlowSystem.cpp.

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

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

Referenced by DoOdeRhs().

◆ DoDiffusion()

void Nektar::CompressibleFlowSystem::DoDiffusion ( const Array< OneD, Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const Array< OneD, Array< OneD, NekDouble >> &  pFwd,
const Array< OneD, Array< OneD, NekDouble >> &  pBwd 
)
protected

Add the diffusions terms to the right-hand side.

Definition at line 357 of file CompressibleFlowSystem.cpp.

362 {
363  v_DoDiffusion(inarray, outarray, pFwd, pBwd);
364 }
virtual void v_DoDiffusion(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, Array< OneD, NekDouble >> &pFwd, const Array< OneD, Array< OneD, NekDouble >> &pBwd)=0

References v_DoDiffusion().

Referenced by DoOdeRhs().

◆ DoOdeProjection()

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

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

Definition at line 299 of file CompressibleFlowSystem.cpp.

302 {
303  size_t nvariables = inarray.size();
304 
305  switch (m_projectionType)
306  {
308  {
309  // Just copy over array
310  int npoints = GetNpoints();
311 
312  for (size_t i = 0; i < nvariables; ++i)
313  {
314  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
315  if (m_useFiltering)
316  {
317  m_fields[i]->ExponentialFilter(outarray[i], m_filterAlpha,
320  }
321  }
322  SetBoundaryConditions(outarray, time);
323  break;
324  }
327  {
328  NEKERROR(ErrorUtil::efatal, "No Continuous Galerkin for full "
329  "compressible Navier-Stokes equations");
330  break;
331  }
332  default:
333  NEKERROR(ErrorUtil::efatal, "Unknown projection scheme");
334  break;
335  }
336 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
SOLVER_UTILS_EXPORT int GetNpoints()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255

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

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

◆ DoOdeRhs()

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

Compute the right-hand side.

Definition at line 216 of file CompressibleFlowSystem.cpp.

219 {
220  size_t nvariables = inarray.size();
221  size_t npoints = GetNpoints();
222  size_t nTracePts = GetTraceTotPoints();
223 
224  m_bndEvaluateTime = time;
225 
226  // Store forwards/backwards space along trace space
227  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
228  Array<OneD, Array<OneD, NekDouble>> Bwd(nvariables);
229 
231  {
234  }
235  else
236  {
237  for (size_t i = 0; i < nvariables; ++i)
238  {
239  Fwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
240  Bwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
241  m_fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
242  }
243  }
244 
245  // Calculate advection
246  LibUtilities::Timer timer;
247  timer.Start();
248  DoAdvection(inarray, outarray, time, Fwd, Bwd);
249  timer.Stop();
250  timer.AccumulateRegion("DoAdvection");
251 
252  // Negate results
253  for (size_t i = 0; i < nvariables; ++i)
254  {
255  Vmath::Neg(npoints, outarray[i], 1);
256  }
257 
258  // Add diffusion terms
259  timer.Start();
260  DoDiffusion(inarray, outarray, Fwd, Bwd);
261  timer.Stop();
262  timer.AccumulateRegion("DoDiffusion");
263 
264  // Add forcing terms
265  for (auto &x : m_forcing)
266  {
267  x->Apply(m_fields, inarray, outarray, time);
268  }
269 
270  if (m_useLocalTimeStep)
271  {
272  size_t nElements = m_fields[0]->GetExpSize();
273  int nq, offset;
274  NekDouble fac;
275  Array<OneD, NekDouble> tmp;
276 
277  Array<OneD, NekDouble> tstep(nElements, 0.0);
278  GetElmtTimeStep(inarray, tstep);
279 
280  // Loop over elements
281  for (size_t n = 0; n < nElements; ++n)
282  {
283  nq = m_fields[0]->GetExp(n)->GetTotPoints();
284  offset = m_fields[0]->GetPhys_Offset(n);
285  fac = tstep[n] / m_timestep;
286  for (size_t i = 0; i < nvariables; ++i)
287  {
288  Vmath::Smul(nq, fac, outarray[i] + offset, 1,
289  tmp = outarray[i] + offset, 1);
290  }
291  }
292  }
293 }
void DoAdvection(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time, const Array< OneD, Array< OneD, NekDouble >> &pFwd, const Array< OneD, Array< OneD, NekDouble >> &pBwd)
Compute the advection terms for the right-hand side.
void DoDiffusion(const Array< OneD, Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const Array< OneD, Array< OneD, NekDouble >> &pFwd, const Array< OneD, Array< OneD, NekDouble >> &pBwd)
Add the diffusions terms to the right-hand side.
void GetElmtTimeStep(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, NekDouble > &tstep)
Calculate the maximum timestep on each element subject to CFL restrictions.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
enum HomogeneousType m_HomogeneousType
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:518
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.cpp:248

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

Referenced by v_InitObject(), and v_SteadyStateResidual().

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

563 {
564  boost::ignore_unused(inarray);
565 
566  size_t nElements = m_fields[0]->GetExpSize();
567 
568  // Change value of m_timestep (in case it is set to zero)
569  NekDouble tmp = m_timestep;
570  m_timestep = 1.0;
571 
572  Array<OneD, NekDouble> cfl(nElements);
573  cfl = GetElmtCFLVals();
574 
575  // Factors to compute the time-step limit
577 
578  // Loop over elements to compute the time-step limit for each element
579  for (size_t n = 0; n < nElements; ++n)
580  {
581  tstep[n] = m_cflSafetyFactor * alpha / cfl[n];
582  }
583 
584  // Restore value of m_timestep
585  m_timestep = tmp;
586 }
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 410 of file CompressibleFlowSystem.cpp.

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

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

Referenced by InitAdvection().

◆ GetFluxVectorDeAlias()

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

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

Parameters
physfieldFields.
fluxResulting flux.

Definition at line 472 of file CompressibleFlowSystem.cpp.

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

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

Referenced by InitAdvection().

◆ GetGamma()

NekDouble Nektar::CompressibleFlowSystem::GetGamma ( )
inlineprotected

Definition at line 176 of file CompressibleFlowSystem.h.

177  {
178  return m_gamma;
179  }

References m_gamma.

Referenced by InitAdvection().

◆ GetNormals()

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

Definition at line 186 of file CompressibleFlowSystem.h.

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

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

Referenced by InitAdvection().

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

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

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

Referenced by GetStabilityLimitVector().

◆ GetStabilityLimitVector()

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

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

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

Parameters
ExpOrderOrder of expansion element by element.

Definition at line 835 of file CompressibleFlowSystem.cpp.

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

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

◆ GetVecLocs()

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

Definition at line 181 of file CompressibleFlowSystem.h.

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

References m_vecLocs.

Referenced by InitAdvection().

◆ InitAdvection()

void Nektar::CompressibleFlowSystem::InitAdvection ( )
protected

Create advection and diffusion objects for CFS.

Definition at line 172 of file CompressibleFlowSystem.cpp.

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

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

Referenced by v_InitObject().

◆ InitialiseParameters()

void Nektar::CompressibleFlowSystem::InitialiseParameters ( )
protected

Load CFS parameters from the session file.

Definition at line 136 of file CompressibleFlowSystem.cpp.

137 {
138  // Get gamma parameter from session file.
139  m_session->LoadParameter("Gamma", m_gamma, 1.4);
140 
141  // Shock capture
142  m_session->LoadSolverInfo("ShockCaptureType", m_shockCaptureType, "Off");
143 
144  // Check if the shock capture type is supported
145  std::string err_msg = "Warning, ShockCaptureType = " + m_shockCaptureType +
146  " is not supported by this solver";
148 
149  // Load parameters for exponential filtering
150  m_session->MatchSolverInfo("ExponentialFiltering", "True", m_useFiltering,
151  false);
152  if (m_useFiltering)
153  {
154  m_session->LoadParameter("FilterAlpha", m_filterAlpha, 36);
155  m_session->LoadParameter("FilterExponent", m_filterExponent, 16);
156  m_session->LoadParameter("FilterCutoff", m_filterCutoff, 0);
157  }
158 
159  // Load CFL for local time-stepping (for steady state)
160  m_session->MatchSolverInfo("LocalTimeStep", "True", m_useLocalTimeStep,
161  false);
162  if (m_useLocalTimeStep)
163  {
165  "Local time stepping requires CFL parameter.");
166  }
167 }
virtual bool v_SupportsShockCaptType(const std::string type) const =0

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

Referenced by v_InitObject().

◆ SetBoundaryConditions()

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

Definition at line 366 of file CompressibleFlowSystem.cpp.

368 {
369  size_t nTracePts = GetTraceTotPoints();
370  size_t nvariables = physarray.size();
371 
372  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
373  for (size_t i = 0; i < nvariables; ++i)
374  {
375  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
376  m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
377  }
378 
379  if (m_bndConds.size())
380  {
381  // Loop over user-defined boundary conditions
382  for (auto &x : m_bndConds)
383  {
384  x->Apply(Fwd, physarray, time);
385  }
386  }
387 }
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 392 of file CompressibleFlowSystem.cpp.

393 {
394  if (m_bndConds.size())
395  {
396  // Loop over user-defined boundary conditions
397  for (auto &x : m_bndConds)
398  {
399  x->ApplyBwdWeight();
400  }
401  }
402 }

References m_bndConds.

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

◆ v_DoDiffusion()

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

◆ v_ExtraFldOutput()

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

Reimplemented from Nektar::SolverUtils::EquationSystem.

Reimplemented in Nektar::NavierStokesCFE.

Definition at line 847 of file CompressibleFlowSystem.cpp.

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

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

◆ v_GetDensity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 948 of file CompressibleFlowSystem.cpp.

951 {
952  density = physfield[0];
953 }

◆ v_GetMaxStdVelocity()

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

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

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Definition at line 677 of file CompressibleFlowSystem.cpp.

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

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_GetPressure() [1/2]

virtual MultiRegions::ExpListSharedPtr Nektar::CompressibleFlowSystem::v_GetPressure ( void  )
inlineoverrideprotectedvirtual

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 191 of file CompressibleFlowSystem.h.

192  {
193  ASSERTL0(false, "This function is not valid for this class");
195  return null;
196  }
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.

References ASSERTL0.

◆ v_GetPressure() [2/2]

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 938 of file CompressibleFlowSystem.cpp.

941 {
942  m_varConv->GetPressure(physfield, pressure);
943 }

References m_varConv, and CG_Iterations::pressure.

◆ v_GetTimeStep()

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

Calculate the maximum timestep subject to CFL restrictions.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 591 of file CompressibleFlowSystem.cpp.

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

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

◆ v_GetVelocity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 958 of file CompressibleFlowSystem.cpp.

961 {
962  m_varConv->GetVelocityVector(physfield, velocity);
963 }

References m_varConv.

◆ v_HasConstantDensity()

virtual bool Nektar::CompressibleFlowSystem::v_HasConstantDensity ( )
inlineoverridevirtual

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 84 of file CompressibleFlowSystem.h.

85  {
86  return false;
87  }

◆ v_InitObject()

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

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

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

Definition at line 55 of file CompressibleFlowSystem.cpp.

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

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

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

◆ v_SetInitialConditions()

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

Set up logic for residual calculation.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Reimplemented in Nektar::IsentropicVortex.

Definition at line 622 of file CompressibleFlowSystem.cpp.

625 {
626  boost::ignore_unused(domain);
627 
628  EquationSystem::v_SetInitialConditions(initialtime, false);
629 
630  // insert white noise in initial condition
631  NekDouble Noise;
632  int phystot = m_fields[0]->GetTotPoints();
633  Array<OneD, NekDouble> noise(phystot);
634 
635  m_session->LoadParameter("Noise", Noise, 0.0);
636  int m_nConvectiveFields = m_fields.size();
637 
638  if (Noise > 0.0)
639  {
640  int seed = -m_comm->GetRank() * m_nConvectiveFields;
641  for (int i = 0; i < m_nConvectiveFields; i++)
642  {
643  Vmath::FillWhiteNoise(phystot, Noise, noise, 1, seed);
644  --seed;
645  Vmath::Vadd(phystot, m_fields[i]->GetPhys(), 1, noise, 1,
646  m_fields[i]->UpdatePhys(), 1);
647  m_fields[i]->FwdTransLocalElmt(m_fields[i]->GetPhys(),
648  m_fields[i]->UpdateCoeffs());
649  }
650  }
651 
652  if (dumpInitialConditions && m_checksteps && !ParallelInTime())
653  {
655  m_nchk++;
656  }
657  else if (dumpInitialConditions && m_useInitialCondition && m_nchk == 0 &&
658  ParallelInTime())
659  {
660  std::string newdir = m_sessionName + ".pit";
661  if (!fs::is_directory(newdir))
662  {
663  fs::create_directory(newdir);
664  }
665  if (m_comm->GetTimeComm()->GetRank() == 0)
666  {
667  WriteFld(newdir + "/" + m_sessionName + "_0.fld");
668  }
669  m_nchk++;
670  }
671 }
SOLVER_UTILS_EXPORT bool ParallelInTime()
Check if solver use Parallel-in-Time.
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.
bool m_useInitialCondition
Flag to determine if IC are used.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
std::string m_sessionName
Name of the session.
int m_nchk
Number of checkpoints written so far.
int m_checksteps
Number of steps between checkpoints.
void FillWhiteNoise(int n, const T eps, T *x, const int incx, int outseed)
Fills a vector with white noise.
Definition: Vmath.cpp:155

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

◆ v_SteadyStateResidual()

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

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 965 of file CompressibleFlowSystem.cpp.

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

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

◆ v_SupportsShockCaptType()

virtual bool Nektar::CompressibleFlowSystem::v_SupportsShockCaptType ( const std::string  type) const
protectedpure virtual

Friends And Related Function Documentation

◆ MemoryManager< CompressibleFlowSystem >

friend class MemoryManager< CompressibleFlowSystem >
friend

Definition at line 1 of file CompressibleFlowSystem.h.

Member Data Documentation

◆ m_artificialDiffusion

ArtificialDiffusionSharedPtr Nektar::CompressibleFlowSystem::m_artificialDiffusion
protected

◆ m_bndConds

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

◆ m_bndEvaluateTime

NekDouble Nektar::CompressibleFlowSystem::m_bndEvaluateTime
protected

◆ m_diffusion

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

◆ m_filterAlpha

NekDouble Nektar::CompressibleFlowSystem::m_filterAlpha
protected

Definition at line 101 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterCutoff

NekDouble Nektar::CompressibleFlowSystem::m_filterCutoff
protected

Definition at line 103 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterExponent

NekDouble Nektar::CompressibleFlowSystem::m_filterExponent
protected

Definition at line 102 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_forcing

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

◆ m_gamma

NekDouble Nektar::CompressibleFlowSystem::m_gamma
protected

◆ m_muav

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

Definition at line 110 of file CompressibleFlowSystem.h.

◆ m_muavTrace

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

Definition at line 113 of file CompressibleFlowSystem.h.

◆ m_shockCaptureType

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

◆ m_useFiltering

bool Nektar::CompressibleFlowSystem::m_useFiltering
protected

Definition at line 104 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_useLocalTimeStep

bool Nektar::CompressibleFlowSystem::m_useLocalTimeStep
protected

◆ m_varConv

VariableConverterSharedPtr Nektar::CompressibleFlowSystem::m_varConv
protected

◆ m_vecLocs

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

Definition at line 96 of file CompressibleFlowSystem.h.

Referenced by GetVecLocs(), and v_InitObject().