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

#include <CompressibleFlowSystem.h>

Inheritance diagram for Nektar::CompressibleFlowSystem:
[legend]

Public Member Functions

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

Protected Member Functions

 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
void v_InitObject (bool DeclareFields=true) override
 Initialization object for CompressibleFlowSystem class. More...
 
void v_GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure) override
 
void v_GetDensity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
 
bool v_HasConstantDensity () override
 
void v_GetVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity) override
 
void InitialiseParameters ()
 Load CFS parameters from the session file. More...
 
void InitAdvection ()
 Create advection and diffusion objects for CFS. More...
 
void DoOdeRhs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the right-hand side. More...
 
void DoOdeProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection. More...
 
void DoAdvection (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
 Compute the advection terms for the right-hand side. More...
 
void DoDiffusion (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)
 Add the diffusions terms to the right-hand side. More...
 
void GetFluxVector (const Array< OneD, const Array< OneD, NekDouble > > &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations. More...
 
void GetFluxVectorDeAlias (const Array< OneD, const Array< OneD, NekDouble > > &physfield, TensorOfArray3D< NekDouble > &flux)
 Return the flux vector for the compressible Euler equations by using the de-aliasing technique. More...
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
 
void SetBoundaryConditionsBwdWeight ()
 Set up a weight on physical boundaries for boundary condition applications. More...
 
void GetElmtTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &tstep)
 Calculate the maximum timestep on each element subject to CFL restrictions. More...
 
NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray) override
 Calculate the maximum timestep subject to CFL restrictions. More...
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
 Set up logic for residual calculation. More...
 
void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time=0.0) override
 
NekDouble GetGamma ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals ()
 
MultiRegions::ExpListSharedPtr v_GetPressure () override
 
void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
 
virtual void v_DoDiffusion (const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const Array< OneD, Array< OneD, NekDouble > > &pFwd, const Array< OneD, Array< OneD, NekDouble > > &pBwd)=0
 
Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor) override
 Compute the advection velocity in the standard space for each element of the expansion. More...
 
void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2) override
 
virtual bool v_SupportsShockCaptType (const std::string type) const =0
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step) override
 
virtual SOLVER_UTILS_EXPORT Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor=1.0)
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareField=true) override
 Init object for UnsteadySystem class. More...
 
SOLVER_UTILS_EXPORT void v_DoSolve () override
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintStatusInformation (const int step, const NekDouble cpuTime)
 Print Status Information. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintSummaryStatistics (const NekDouble intTime)
 Print Summary Statistics. More...
 
SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true) override
 Sets up initial conditions. More...
 
SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
virtual SOLVER_UTILS_EXPORT void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
virtual SOLVER_UTILS_EXPORT bool v_UpdateTimeStepCheck ()
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble > > vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
SOLVER_UTILS_EXPORT void DoDummyProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Perform dummy projection. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareFeld=true)
 Initialisation object for EquationSystem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true)
 Virtual function for initialisation implementation. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Virtual function for solve implementation. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys ()
 Virtual function for transformation to physical space. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &l)
 Virtual function for generating summary information. More...
 
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure (void)
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp (void)
 Virtual function to identify if operator is negated in DoSolve. More...
 
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
- Protected Member Functions inherited from Nektar::SolverUtils::FluidInterface
virtual SOLVER_UTILS_EXPORT void v_GetVelocity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)=0
 
virtual SOLVER_UTILS_EXPORT bool v_HasConstantDensity ()=0
 
virtual SOLVER_UTILS_EXPORT void v_GetDensity (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density)=0
 
virtual SOLVER_UTILS_EXPORT void v_GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)=0
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameProjectionMat (const boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameProjectionMat (boost::numeric::ublas::matrix< NekDouble > &vProjMat)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameDisp (const Array< OneD, NekDouble > &vFrameDisp)
 
virtual SOLVER_UTILS_EXPORT void v_GetMovingFrameDisp (Array< OneD, NekDouble > &vFrameDisp)
 
virtual SOLVER_UTILS_EXPORT void v_SetAeroForce (Array< OneD, NekDouble > forces)
 
virtual SOLVER_UTILS_EXPORT void v_GetAeroForce (Array< OneD, NekDouble > forces)
 

Protected Attributes

SolverUtils::DiffusionSharedPtr m_diffusion
 
ArtificialDiffusionSharedPtr m_artificialDiffusion
 
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
 
NekDouble m_gamma
 
std::string m_shockCaptureType
 
NekDouble m_filterAlpha
 
NekDouble m_filterExponent
 
NekDouble m_filterCutoff
 
bool m_useFiltering
 
bool m_useLocalTimeStep
 
Array< OneD, NekDoublem_muav
 
Array< OneD, NekDoublem_muavTrace
 
VariableConverterSharedPtr m_varConv
 
std::vector< CFSBndCondSharedPtrm_bndConds
 
NekDouble m_bndEvaluateTime
 
std::vector< SolverUtils::ForcingSharedPtrm_forcing
 
- Protected Attributes inherited from Nektar::SolverUtils::AdvectionSystem
SolverUtils::AdvectionSharedPtr m_advObject
 Advection term. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::UnsteadySystem
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::vector< int > m_intVariables
 
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1). More...
 
NekDouble m_CFLGrowth
 CFL growth rate. More...
 
NekDouble m_CFLEnd
 Maximun cfl in cfl growth. More...
 
int m_abortSteps
 Number of steps between checks for abort conditions. More...
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used. More...
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used. More...
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used. More...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_filtersInfosteps
 Number of time steps between outputting filters information. More...
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
std::ofstream m_errFile
 
NekDouble m_epsilon
 Diffusion coefficient. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
bool m_verbose
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
NekDouble m_checktime
 Time between checkpoints. More...
 
NekDouble m_lastCheckTime
 
NekDouble m_TimeIncrementFactor
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_infosteps
 Number of time steps between outputting status information. More...
 
int m_iterPIT = 0
 Number of parallel-in-time time iteration. More...
 
int m_windowPIT = 0
 Index of windows for parallel-in-time time iteration. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
Array< OneD, NekDoublem_movingFrameVelsxyz
 Moving frame of reference velocities (u, v, w, omega_x, omega_y, omega_z, a_x, a_y, a_z, domega_x, domega_y, domega_z) More...
 
Array< OneD, NekDoublem_movingFrameData
 Moving frame of reference angles with respect to the. More...
 
boost::numeric::ublas::matrix< NekDoublem_movingFrameProjMat
 Projection matrix for transformation between inertial and moving. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

Private Member Functions

void EvaluateIsentropicVortex (unsigned int field, Array< OneD, NekDouble > &outfield, NekDouble time, const int o=0)
 Isentropic Vortex Test Case. More...
 
void GetExactRinglebFlow (int field, Array< OneD, NekDouble > &outarray)
 Ringleb Flow Test Case. More...
 

Friends

class MemoryManager< CompressibleFlowSystem >
 

Additional Inherited Members

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

Detailed Description

Definition at line 59 of file CompressibleFlowSystem.h.

Constructor & Destructor Documentation

◆ ~CompressibleFlowSystem()

Nektar::CompressibleFlowSystem::~CompressibleFlowSystem ( )
overridedefault

◆ 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), AdvectionSystem(pSession, pGraph)
47{
48}
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 332 of file CompressibleFlowSystem.cpp.

337{
338 int nvariables = inarray.size();
339 Array<OneD, Array<OneD, NekDouble>> advVel(m_spacedim);
340
341 m_advObject->Advect(nvariables, m_fields, advVel, inarray, outarray, time,
342 pFwd, pBwd);
343}
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 348 of file CompressibleFlowSystem.cpp.

353{
354 v_DoDiffusion(inarray, outarray, pFwd, pBwd);
355}
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 291 of file CompressibleFlowSystem.cpp.

294{
295 switch (m_projectionType)
296 {
298 {
299 // Just copy over array
300 size_t nvariables = inarray.size();
301 size_t npoints = GetNpoints();
302
303 for (size_t i = 0; i < nvariables; ++i)
304 {
305 Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
306 if (m_useFiltering)
307 {
308 m_fields[i]->ExponentialFilter(outarray[i], m_filterAlpha,
311 }
312 }
313 SetBoundaryConditions(outarray, time);
314 break;
315 }
318 {
319 NEKERROR(ErrorUtil::efatal, "No Continuous Galerkin for full "
320 "compressible Navier-Stokes equations");
321 break;
322 }
323 default:
324 NEKERROR(ErrorUtil::efatal, "Unknown projection scheme");
325 break;
326 }
327}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
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.hpp:825

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

210{
211 LibUtilities::Timer timer;
212
213 size_t nvariables = inarray.size();
214 size_t nTracePts = GetTraceTotPoints();
215 size_t npoints = GetNpoints();
216
217 m_bndEvaluateTime = time;
218
219 // Store forwards/backwards space along trace space
220 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
221 Array<OneD, Array<OneD, NekDouble>> Bwd(nvariables);
222
224 {
227 }
228 else
229 {
230 for (size_t i = 0; i < nvariables; ++i)
231 {
232 Fwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
233 Bwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
234 m_fields[i]->GetFwdBwdTracePhys(inarray[i], Fwd[i], Bwd[i]);
235 }
236 }
237
238 // Calculate advection
239 timer.Start();
240 DoAdvection(inarray, outarray, time, Fwd, Bwd);
241 timer.Stop();
242 timer.AccumulateRegion("DoAdvection");
243
244 // Negate results
245 for (size_t i = 0; i < nvariables; ++i)
246 {
247 Vmath::Neg(npoints, outarray[i], 1);
248 }
249
250 // Add diffusion terms
251 timer.Start();
252 DoDiffusion(inarray, outarray, Fwd, Bwd);
253 timer.Stop();
254 timer.AccumulateRegion("DoDiffusion");
255
256 // Add forcing terms
257 for (auto &x : m_forcing)
258 {
259 x->Apply(m_fields, inarray, outarray, time);
260 }
261
263 {
264 size_t nElements = m_fields[0]->GetExpSize();
265 int nq, offset;
266 NekDouble fac;
267 Array<OneD, NekDouble> tmp;
268
269 Array<OneD, NekDouble> tstep(nElements, 0.0);
270 GetElmtTimeStep(inarray, tstep);
271
272 // Loop over elements
273 for (size_t n = 0; n < nElements; ++n)
274 {
275 nq = m_fields[0]->GetExp(n)->GetTotPoints();
276 offset = m_fields[0]->GetPhys_Offset(n);
277 fac = tstep[n] / m_timestep;
278 for (size_t i = 0; i < nvariables; ++i)
279 {
280 Vmath::Smul(nq, fac, outarray[i] + offset, 1,
281 tmp = outarray[i] + offset, 1);
282 }
283 }
284 }
285}
void GetElmtTimeStep(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &tstep)
Calculate the maximum timestep on each element subject to CFL restrictions.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
void DoAdvection(const Array< OneD, 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.
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.hpp:292
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100

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

◆ EvaluateIsentropicVortex()

void Nektar::CompressibleFlowSystem::EvaluateIsentropicVortex ( unsigned int  field,
Array< OneD, NekDouble > &  outfield,
NekDouble  time,
const int  o = 0 
)
private

Isentropic Vortex Test Case.

Definition at line 1040 of file CompressibleFlowSystem.cpp.

1043{
1044 NekDouble beta, u0, v0, x0, y0;
1045
1046 int nTotQuadPoints = GetTotPoints();
1047 Array<OneD, NekDouble> x(nTotQuadPoints);
1048 Array<OneD, NekDouble> y(nTotQuadPoints);
1049 Array<OneD, NekDouble> z(nTotQuadPoints);
1050 Array<OneD, Array<OneD, NekDouble>> u(m_spacedim + 2);
1051
1052 m_fields[0]->GetCoords(x, y, z);
1053
1054 for (int i = 0; i < m_spacedim + 2; ++i)
1055 {
1056 u[i] = Array<OneD, NekDouble>(nTotQuadPoints);
1057 }
1058 m_session->LoadParameter("IsentropicBeta", beta, 5.0);
1059 m_session->LoadParameter("IsentropicU0", u0, 1.0);
1060 m_session->LoadParameter("IsentropicV0", v0, 0.5);
1061 m_session->LoadParameter("IsentropicX0", x0, 5.0);
1062 m_session->LoadParameter("IsentropicY0", y0, 0.0);
1063
1064 // Flow parameters
1065 NekDouble r, xbar, ybar, tmp;
1066 NekDouble fac = 1.0 / (16.0 * m_gamma * M_PI * M_PI);
1067
1068 // In 3D zero rhow field.
1069 if (m_spacedim == 3)
1070 {
1071 Vmath::Zero(nTotQuadPoints, &u[3][o], 1);
1072 }
1073
1074 // Fill storage
1075 for (int i = 0; i < nTotQuadPoints; ++i)
1076 {
1077 xbar = x[i] - u0 * time - x0;
1078 ybar = y[i] - v0 * time - y0;
1079 r = sqrt(xbar * xbar + ybar * ybar);
1080 tmp = beta * exp(1 - r * r);
1081 u[0][i + o] =
1082 pow(1.0 - (m_gamma - 1.0) * tmp * tmp * fac, 1.0 / (m_gamma - 1.0));
1083 u[1][i + o] = u[0][i + o] * (u0 - tmp * ybar / (2 * M_PI));
1084 u[2][i + o] = u[0][i + o] * (v0 + tmp * xbar / (2 * M_PI));
1085 u[m_spacedim + 1][i + o] =
1086 pow(u[0][i + o], m_gamma) / (m_gamma - 1.0) +
1087 0.5 * (u[1][i + o] * u[1][i + o] + u[2][i + o] * u[2][i + o]) /
1088 u[0][i + o];
1089 }
1090 Vmath::Vcopy(nTotQuadPoints, u[field].get(), 1, outfield.get(), 1);
1091}
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
SOLVER_UTILS_EXPORT int GetTotPoints()
@ beta
Gauss Radau pinned at x=-1,.
Definition: PointsType.h:59
std::vector< double > z(NPUPPER)
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.hpp:273
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294

References Nektar::LibUtilities::beta, Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, m_gamma, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_spacedim, tinysimd::sqrt(), Vmath::Vcopy(), Nektar::UnitTests::z(), and Vmath::Zero().

Referenced by v_EvaluateExactSolution(), and v_SetInitialConditions().

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

554{
555 size_t nElements = m_fields[0]->GetExpSize();
556
557 // Change value of m_timestep (in case it is set to zero)
558 NekDouble tmp = m_timestep;
559 m_timestep = 1.0;
560
561 Array<OneD, NekDouble> cfl(nElements);
562 cfl = GetElmtCFLVals();
563
564 // Factors to compute the time-step limit
566
567 // Loop over elements to compute the time-step limit for each element
568 for (size_t n = 0; n < nElements; ++n)
569 {
570 tstep[n] = m_cflSafetyFactor * alpha / cfl[n];
571 }
572
573 // Restore value of m_timestep
574 m_timestep = tmp;
575}
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().

◆ GetExactRinglebFlow()

void Nektar::CompressibleFlowSystem::GetExactRinglebFlow ( int  field,
Array< OneD, NekDouble > &  outarray 
)
private

Ringleb Flow Test Case.

Compute the exact solution for the Ringleb flow problem.

Definition at line 1096 of file CompressibleFlowSystem.cpp.

1098{
1099 int nTotQuadPoints = GetTotPoints();
1100
1101 Array<OneD, NekDouble> rho(nTotQuadPoints, 100.0);
1102 Array<OneD, NekDouble> rhou(nTotQuadPoints);
1103 Array<OneD, NekDouble> rhov(nTotQuadPoints);
1104 Array<OneD, NekDouble> E(nTotQuadPoints);
1105 Array<OneD, NekDouble> x(nTotQuadPoints);
1106 Array<OneD, NekDouble> y(nTotQuadPoints);
1107 Array<OneD, NekDouble> z(nTotQuadPoints);
1108
1109 m_fields[0]->GetCoords(x, y, z);
1110
1111 // Flow parameters
1112 NekDouble c, k, phi, r, J, VV, pp, sint, P, ss;
1113 NekDouble J11, J12, J21, J22, det;
1114 NekDouble Fx, Fy;
1115 NekDouble xi, yi;
1116 NekDouble dV;
1117 NekDouble dtheta;
1118 NekDouble par1;
1119 NekDouble theta = M_PI / 4.0;
1120 NekDouble kExt = 0.7;
1121 NekDouble V = kExt * sin(theta);
1122 NekDouble toll = 1.0e-8;
1123 NekDouble errV = 1.0;
1124 NekDouble errTheta = 1.0;
1125 NekDouble gamma = m_gamma;
1126 NekDouble gamma_1_2 = (gamma - 1.0) / 2.0;
1127
1128 for (int i = 0; i < nTotQuadPoints; ++i)
1129 {
1130 while ((abs(errV) > toll) || (abs(errTheta) > toll))
1131 {
1132 VV = V * V;
1133 sint = sin(theta);
1134 c = sqrt(1.0 - gamma_1_2 * VV);
1135 k = V / sint;
1136 phi = 1.0 / k;
1137 pp = phi * phi;
1138 J = 1.0 / c + 1.0 / (3.0 * c * c * c) +
1139 1.0 / (5.0 * c * c * c * c * c) -
1140 0.5 * log((1.0 + c) / (1.0 - c));
1141
1142 r = pow(c, 1.0 / gamma_1_2);
1143 xi = 1.0 / (2.0 * r) * (1.0 / VV - 2.0 * pp) + J / 2.0;
1144 yi = phi / (r * V) * sqrt(1.0 - VV * pp);
1145 par1 = 25.0 - 5.0 * VV;
1146 ss = sint * sint;
1147
1148 Fx = xi - x[i];
1149 Fy = yi - y[i];
1150
1151 J11 =
1152 39062.5 / pow(par1, 3.5) * (1.0 / VV - 2.0 / VV * ss) * V +
1153 1562.5 / pow(par1, 2.5) *
1154 (-2.0 / (VV * V) + 4.0 / (VV * V) * ss) +
1155 12.5 / pow(par1, 1.5) * V + 312.5 / pow(par1, 2.5) * V +
1156 7812.5 / pow(par1, 3.5) * V -
1157 0.25 *
1158 (-1.0 / pow(par1, 0.5) * V / (1.0 - 0.2 * pow(par1, 0.5)) -
1159 (1.0 + 0.2 * pow(par1, 0.5)) /
1160 pow((1.0 - 0.2 * pow(par1, 0.5)), 2.0) /
1161 pow(par1, 0.5) * V) /
1162 (1.0 + 0.2 * pow(par1, 0.5)) * (1.0 - 0.2 * pow(par1, 0.5));
1163
1164 J12 = -6250.0 / pow(par1, 2.5) / VV * sint * cos(theta);
1165 J21 = -6250.0 / (VV * V) * sint / pow(par1, 2.5) *
1166 pow((1.0 - ss), 0.5) +
1167 78125.0 / V * sint / pow(par1, 3.5) * pow((1.0 - ss), 0.5);
1168
1169 // the matrix is singular when theta = pi/2
1170 if (abs(y[i]) < toll && abs(cos(theta)) < toll)
1171 {
1172 J22 = -39062.5 / pow(par1, 3.5) / V +
1173 3125 / pow(par1, 2.5) / (VV * V) +
1174 12.5 / pow(par1, 1.5) * V + 312.5 / pow(par1, 2.5) * V +
1175 7812.5 / pow(par1, 3.5) * V -
1176 0.25 *
1177 (-1.0 / pow(par1, 0.5) * V /
1178 (1.0 - 0.2 * pow(par1, 0.5)) -
1179 (1.0 + 0.2 * pow(par1, 0.5)) /
1180 pow((1.0 - 0.2 * pow(par1, 0.5)), 2.0) /
1181 pow(par1, 0.5) * V) /
1182 (1.0 + 0.2 * pow(par1, 0.5)) *
1183 (1.0 - 0.2 * pow(par1, 0.5));
1184
1185 // dV = -dV/dx * Fx
1186 dV = -1.0 / J22 * Fx;
1187 dtheta = 0.0;
1188 theta = M_PI / 2.0;
1189 }
1190 else
1191 {
1192 J22 = 3125.0 / VV * cos(theta) / pow(par1, 2.5) *
1193 pow((1.0 - ss), 0.5) -
1194 3125.0 / VV * ss / pow(par1, 2.5) / pow((1.0 - ss), 0.5) *
1195 cos(theta);
1196
1197 det = -1.0 / (J11 * J22 - J12 * J21);
1198
1199 // [dV dtheta]' = -[invJ]*[Fx Fy]'
1200 dV = det * (J22 * Fx - J12 * Fy);
1201 dtheta = det * (-J21 * Fx + J11 * Fy);
1202 }
1203
1204 V = V + dV;
1205 theta = theta + dtheta;
1206
1207 errV = abs(dV);
1208 errTheta = abs(dtheta);
1209 }
1210
1211 c = sqrt(1.0 - gamma_1_2 * VV);
1212 r = pow(c, 1.0 / gamma_1_2);
1213
1214 rho[i] = r;
1215 rhou[i] = rho[i] * V * cos(theta);
1216 rhov[i] = rho[i] * V * sin(theta);
1217 P = (c * c) * rho[i] / gamma;
1218 E[i] = P / (gamma - 1.0) +
1219 0.5 * (rhou[i] * rhou[i] / rho[i] + rhov[i] * rhov[i] / rho[i]);
1220
1221 // Resetting the guess value
1222 errV = 1.0;
1223 errTheta = 1.0;
1224 theta = M_PI / 4.0;
1225 V = kExt * sin(theta);
1226 }
1227
1228 switch (field)
1229 {
1230 case 0:
1231 outarray = rho;
1232 break;
1233 case 1:
1234 outarray = rhou;
1235 break;
1236 case 2:
1237 outarray = rhov;
1238 break;
1239 case 3:
1240 outarray = E;
1241 break;
1242 default:
1243 ASSERTL0(false, "Error in variable number!");
1244 break;
1245 }
1246}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
@ P
Monomial polynomials .
Definition: BasisType.h:62
scalarT< T > abs(scalarT< T > in)
Definition: scalar.hpp:298
scalarT< T > log(scalarT< T > in)
Definition: scalar.hpp:303

References tinysimd::abs(), ASSERTL0, Nektar::SolverUtils::EquationSystem::GetTotPoints(), tinysimd::log(), Nektar::SolverUtils::EquationSystem::m_fields, m_gamma, Nektar::LibUtilities::P, tinysimd::sqrt(), and Nektar::UnitTests::z().

Referenced by v_EvaluateExactSolution().

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

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

References ASSERTL1, Nektar::UnitTests::d(), Nektar::SolverUtils::EquationSystem::m_spacedim, m_varConv, CellMLToNektar.cellml_metadata::p, CG_Iterations::pressure, and Nektar::MovementTests::velocity.

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

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

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

Referenced by InitAdvection().

◆ GetGamma()

NekDouble Nektar::CompressibleFlowSystem::GetGamma ( )
inlineprotected

Definition at line 181 of file CompressibleFlowSystem.h.

182 {
183 return m_gamma;
184 }

References m_gamma.

Referenced by InitAdvection().

◆ GetNormals()

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

Definition at line 191 of file CompressibleFlowSystem.h.

192 {
193 return m_traceNormals;
194 }
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 838 of file CompressibleFlowSystem.cpp.

839{
840 ASSERTL0(n <= 20, "Illegal modes dimension for CFL calculation "
841 "(P has to be less then 20)");
842
843 NekDouble CFLDG[21] = {2.0000, 6.0000, 11.8424, 19.1569, 27.8419,
844 37.8247, 49.0518, 61.4815, 75.0797, 89.8181,
845 105.6700, 122.6200, 140.6400, 159.7300, 179.8500,
846 201.0100, 223.1800, 246.3600, 270.5300, 295.6900,
847 321.8300}; // CFLDG 1D [0-20]
848 NekDouble CFL = 0.0;
849
851 {
852 CFL = CFLDG[n];
853 }
854 else
855 {
856 NEKERROR(ErrorUtil::efatal, "Continuous Galerkin stability "
857 "coefficients not introduced yet.");
858 }
859
860 return CFL;
861}

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

872{
873 int i;
874 Array<OneD, NekDouble> returnval(m_fields[0]->GetExpSize(), 0.0);
875 for (i = 0; i < m_fields[0]->GetExpSize(); i++)
876 {
877 returnval[i] = GetStabilityLimit(ExpOrder[i]);
878 }
879 return returnval;
880}
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 186 of file CompressibleFlowSystem.h.

187 {
188 return m_vecLocs;
189 }
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 163 of file CompressibleFlowSystem.cpp.

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

128{
129 // Get gamma parameter from session file.
130 m_session->LoadParameter("Gamma", m_gamma, 1.4);
131
132 // Shock capture
133 m_session->LoadSolverInfo("ShockCaptureType", m_shockCaptureType, "Off");
134
135 // Check if the shock capture type is supported
136 std::string err_msg = "Warning, ShockCaptureType = " + m_shockCaptureType +
137 " is not supported by this solver";
139
140 // Load parameters for exponential filtering
141 m_session->MatchSolverInfo("ExponentialFiltering", "True", m_useFiltering,
142 false);
143 if (m_useFiltering)
144 {
145 m_session->LoadParameter("FilterAlpha", m_filterAlpha, 36);
146 m_session->LoadParameter("FilterExponent", m_filterExponent, 16);
147 m_session->LoadParameter("FilterCutoff", m_filterCutoff, 0);
148 }
149
150 // Load CFL for local time-stepping (for steady state)
151 m_session->MatchSolverInfo("LocalTimeStep", "True", m_useLocalTimeStep,
152 false);
154 {
156 "Local time stepping requires CFL parameter.");
157 }
158}
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 357 of file CompressibleFlowSystem.cpp.

359{
360 size_t nTracePts = GetTraceTotPoints();
361 size_t nvariables = physarray.size();
362
363 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
364 for (size_t i = 0; i < nvariables; ++i)
365 {
366 Fwd[i] = Array<OneD, NekDouble>(nTracePts);
367 m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
368 }
369
370 if (m_bndConds.size())
371 {
372 // Loop over user-defined boundary conditions
373 for (auto &x : m_bndConds)
374 {
375 x->Apply(Fwd, physarray, time);
376 }
377 }
378}
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 383 of file CompressibleFlowSystem.cpp.

384{
385 if (m_bndConds.size())
386 {
387 // Loop over user-defined boundary conditions
388 for (auto &x : m_bndConds)
389 {
390 x->ApplyBwdWeight();
391 }
392 }
393}

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

void Nektar::CompressibleFlowSystem::v_EvaluateExactSolution ( unsigned int  field,
Array< OneD, NekDouble > &  outfield,
const NekDouble  time = 0.0 
)
overrideprotectedvirtual

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 684 of file CompressibleFlowSystem.cpp.

686{
687
688 if (!m_session->DefinesFunction("ExactSolution") &&
689 m_session->DefinesSolverInfo("ICTYPE"))
690 {
691 if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
692 "IsentropicVortex"))
693 {
694 EvaluateIsentropicVortex(field, outfield, time);
695 }
696 else if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
697 "RinglebFlow"))
698 {
699 GetExactRinglebFlow(field, outfield);
700 }
701 }
702 else
703 {
704 EquationSystem::v_EvaluateExactSolution(field, outfield, time);
705 }
706}
void GetExactRinglebFlow(int field, Array< OneD, NekDouble > &outarray)
Ringleb Flow Test Case.
void EvaluateIsentropicVortex(unsigned int field, Array< OneD, NekDouble > &outfield, NekDouble time, const int o=0)
Isentropic Vortex Test Case.
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution(unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)

References EvaluateIsentropicVortex(), GetExactRinglebFlow(), Nektar::SolverUtils::EquationSystem::m_session, and Nektar::SolverUtils::EquationSystem::v_EvaluateExactSolution().

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

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

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

◆ v_GenerateSummary()

void Nektar::CompressibleFlowSystem::v_GenerateSummary ( SolverUtils::SummaryList s)
overrideprotectedvirtual

Print a summary of time stepping parameters.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 595 of file CompressibleFlowSystem.cpp.

596{
598 if (m_session->DefinesSolverInfo("ICTYPE"))
599 {
600 if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
601 "IsentropicVortex"))
602 {
603 SolverUtils::AddSummaryItem(s, "Problem Type", "IsentropicVortex");
604 }
605 else if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
606 "RinglebFlow"))
607 {
608 SolverUtils::AddSummaryItem(s, "Problem Type", "RinglebFlow");
609 }
610 else
611 {
612 NEKERROR(ErrorUtil::efatal, "unknow initial condition");
613 }
614 }
615}
SOLVER_UTILS_EXPORT void v_GenerateSummary(SummaryList &s) override
Print a summary of time stepping parameters.
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:47

References Nektar::SolverUtils::AddSummaryItem(), Nektar::ErrorUtil::efatal, Nektar::SolverUtils::EquationSystem::m_session, NEKERROR, and Nektar::SolverUtils::UnsteadySystem::v_GenerateSummary().

◆ v_GetDensity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 983 of file CompressibleFlowSystem.cpp.

986{
987 density = physfield[0];
988}

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

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

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(), Nektar::MovementTests::velocity, Vmath::Vmul(), and Vmath::Vvtvp().

◆ v_GetPressure() [1/2]

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

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 196 of file CompressibleFlowSystem.h.

197 {
198 ASSERTL0(false, "This function is not valid for this class");
200 return null;
201 }
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 
)
overrideprotectedvirtual

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 973 of file CompressibleFlowSystem.cpp.

976{
977 m_varConv->GetPressure(physfield, pressure);
978}

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

582{
583 int nElements = m_fields[0]->GetExpSize();
584 Array<OneD, NekDouble> tstep(nElements, 0.0);
585
586 GetElmtTimeStep(inarray, tstep);
587
588 // Get the minimum time-step limit and return the time-step
589 NekDouble TimeStep = Vmath::Vmin(nElements, tstep, 1);
590 m_comm->GetSpaceComm()->AllReduce(TimeStep, LibUtilities::ReduceMin);
591
592 return TimeStep;
593}
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.hpp:725

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

◆ v_GetVelocity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 993 of file CompressibleFlowSystem.cpp.

996{
997 m_varConv->GetVelocityVector(physfield, velocity);
998}

References m_varConv, and Nektar::MovementTests::velocity.

◆ v_HasConstantDensity()

bool Nektar::CompressibleFlowSystem::v_HasConstantDensity ( )
inlineoverrideprotectedvirtual

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 121 of file CompressibleFlowSystem.h.

122 {
123 return false;
124 }

◆ v_InitObject()

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

Initialization object for CompressibleFlowSystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

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

Definition at line 53 of file CompressibleFlowSystem.cpp.

54{
55 AdvectionSystem::v_InitObject(DeclareFields);
56
57 for (size_t i = 0; i < m_fields.size(); i++)
58 {
59 // Use BwdTrans to make sure initial condition is in solution space
60 m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
61 m_fields[i]->UpdatePhys());
62 }
63
66
67 ASSERTL0(m_session->DefinesSolverInfo("UPWINDTYPE"),
68 "No UPWINDTYPE defined in session.");
69
70 // Do not forwards transform initial condition
71 m_homoInitialFwd = false;
72
73 // Set up locations of velocity vector.
74 m_vecLocs = Array<OneD, Array<OneD, NekDouble>>(1);
75 m_vecLocs[0] = Array<OneD, NekDouble>(m_spacedim);
76 for (int i = 0; i < m_spacedim; ++i)
77 {
78 m_vecLocs[0][i] = 1 + i;
79 }
80
81 // Loading parameters from session file
83
84 // Setting up advection and diffusion operators
86
87 // Create artificial diffusion with laplacian operator
88 if (m_shockCaptureType == "NonSmooth")
89 {
92 }
93
94 // Forcing terms for the sponge region
96 m_fields, m_fields.size());
97
98 // User-defined boundary conditions
99 size_t cnt = 0;
100 for (size_t n = 0; n < (size_t)m_fields[0]->GetBndConditions().size(); ++n)
101 {
102 std::string type = m_fields[0]->GetBndConditions()[n]->GetUserDefined();
103
104 if (m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType() ==
106 {
107 continue;
108 }
109
110 if (!type.empty())
111 {
113 type, m_session, m_fields, m_traceNormals, m_spacedim, n, cnt));
114 }
115 cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
116 }
117
120
122}
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 InitAdvection()
Create advection and diffusion objects for CFS.
void SetBoundaryConditionsBwdWeight()
Set up a weight on physical boundaries for boundary condition applications.
void InitialiseParameters()
Load CFS parameters from the session file.
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 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.
SOLVER_UTILS_EXPORT void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
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:118
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.

Definition at line 620 of file CompressibleFlowSystem.cpp.

623{
624 if (m_session->DefinesSolverInfo("ICTYPE") &&
625 boost::iequals(m_session->GetSolverInfo("ICTYPE"), "IsentropicVortex"))
626 {
627 // Forward transform to fill the coefficient space
628 for (int i = 0; i < m_fields.size(); ++i)
629 {
630 EvaluateIsentropicVortex(i, m_fields[i]->UpdatePhys(), initialtime);
631 m_fields[i]->SetPhysState(true);
632 m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
633 m_fields[i]->UpdateCoeffs());
634 }
635 }
636 else
637 {
638 EquationSystem::v_SetInitialConditions(initialtime, false);
639 m_nchk--; // Note: m_nchk has been incremented in EquationSystem.
640
641 // insert white noise in initial condition
642 NekDouble Noise;
643 int phystot = m_fields[0]->GetTotPoints();
644 Array<OneD, NekDouble> noise(phystot);
645
646 m_session->LoadParameter("Noise", Noise, 0.0);
647 int m_nConvectiveFields = m_fields.size();
648
649 if (Noise > 0.0)
650 {
651 int seed = -m_comm->GetSpaceComm()->GetRank() * m_nConvectiveFields;
652 for (int i = 0; i < m_nConvectiveFields; i++)
653 {
654 Vmath::FillWhiteNoise(phystot, Noise, noise, 1, seed);
655 --seed;
656 Vmath::Vadd(phystot, m_fields[i]->GetPhys(), 1, noise, 1,
657 m_fields[i]->UpdatePhys(), 1);
658 m_fields[i]->FwdTransLocalElmt(m_fields[i]->GetPhys(),
659 m_fields[i]->UpdateCoeffs());
660 }
661 }
662 }
663
664 if (dumpInitialConditions && m_nchk == 0 && m_checksteps &&
665 !m_comm->IsParallelInTime())
666 {
668 }
669 else if (dumpInitialConditions && m_nchk == 0 && m_comm->IsParallelInTime())
670 {
671 std::string newdir = m_sessionName + ".pit";
672 if (!fs::is_directory(newdir))
673 {
674 fs::create_directory(newdir);
675 }
676 if (m_comm->GetTimeComm()->GetRank() == 0)
677 {
678 WriteFld(newdir + "/" + m_sessionName + "_0.fld");
679 }
680 }
681 m_nchk++;
682}
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.
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:154

References Nektar::SolverUtils::EquationSystem::Checkpoint_Output(), EvaluateIsentropicVortex(), 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::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 1000 of file CompressibleFlowSystem.cpp.

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

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

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterCutoff

NekDouble Nektar::CompressibleFlowSystem::m_filterCutoff
protected

Definition at line 85 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterExponent

NekDouble Nektar::CompressibleFlowSystem::m_filterExponent
protected

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

◆ m_muavTrace

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

Definition at line 95 of file CompressibleFlowSystem.h.

◆ m_shockCaptureType

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

◆ m_useFiltering

bool Nektar::CompressibleFlowSystem::m_useFiltering
protected

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

Referenced by GetVecLocs(), and v_InitObject().