Nektar++
Loading...
Searching...
No Matches
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

NekDouble GetStabilityLimit (int n)
 Function to calculate the stability limit for DG/CG.
 
Array< OneD, NekDoubleGetStabilityLimitVector (const Array< OneD, int > &ExpOrder)
 Function to calculate the stability limit for DG/CG (a vector of them).
 
- 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=default
 
SOLVER_UTILS_EXPORT AdvectionSharedPtr GetAdvObject ()
 Returns the advection object held by this instance.
 
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=default
 Destructor.
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Calculate the larger time-step mantaining the problem stable.
 
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.
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeOperatorsGetTimeIntegrationSchemeOperators ()
 Returns the time integration scheme operators.
 
- Public Member Functions inherited from Nektar::SolverUtils::EquationSystem
virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor.
 
SOLVER_UTILS_EXPORT void InitObject (bool DeclareField=true)
 Initialises the members of this object.
 
SOLVER_UTILS_EXPORT void DoInitialise (bool dumpInitialConditions=true)
 Perform any initialisation necessary before solving the problem.
 
SOLVER_UTILS_EXPORT void DoSolve ()
 Solve the problem.
 
SOLVER_UTILS_EXPORT void TransCoeffToPhys ()
 Transform from coefficient to physical space.
 
SOLVER_UTILS_EXPORT void TransPhysToCoeff ()
 Transform from physical to coefficient space.
 
SOLVER_UTILS_EXPORT void Output ()
 Perform output operations after solve.
 
SOLVER_UTILS_EXPORT std::string GetSessionName ()
 Get Session name.
 
template<class T >
std::shared_ptr< T > as ()
 
SOLVER_UTILS_EXPORT void ResetSessionName (std::string newname)
 Reset Session name.
 
SOLVER_UTILS_EXPORT LibUtilities::SessionReaderSharedPtr GetSession ()
 Get Session name.
 
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure ()
 Get pressure field if available.
 
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.
 
SOLVER_UTILS_EXPORT void SetLambda (NekDouble lambda)
 Set parameter m_lambda.
 
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction (std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
 Get a SessionFunction by name.
 
SOLVER_UTILS_EXPORT void SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Initialise the data in the dependent fields.
 
SOLVER_UTILS_EXPORT void EvaluateExactSolution (int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 Evaluates an exact solution.
 
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.
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, bool Normalised=false)
 Compute the L2 error of the fields.
 
SOLVER_UTILS_EXPORT NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation.
 
SOLVER_UTILS_EXPORT NekDouble H1Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
 Compute the H1 error between fields and a given exact solution.
 
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].
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n)
 Write checkpoint file of m_fields.
 
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.
 
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow (const int n)
 Write base flow file of m_fields.
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname)
 Write field data to the given filename.
 
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.
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
 Input field data from the given file.
 
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.
 
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.
 
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.
 
SOLVER_UTILS_EXPORT void SessionSummary (SummaryList &vSummary)
 Write out a session summary.
 
SOLVER_UTILS_EXPORT Array< OneD, MultiRegions::ExpListSharedPtr > & UpdateFields ()
 
SOLVER_UTILS_EXPORT LibUtilities::FieldMetaDataMapUpdateFieldMetaDataMap ()
 Get hold of FieldInfoMap so it can be updated.
 
SOLVER_UTILS_EXPORT NekDouble GetTime ()
 Return final time.
 
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 void SetSteps (const int steps)
 
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 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.
 
SOLVER_UTILS_EXPORT bool NegatedOp ()
 Identify if operator is negated in DoSolve.
 
- Public Member Functions inherited from Nektar::SolverUtils::ALEHelper
virtual ~ALEHelper ()=default
 
SOLVER_UTILS_EXPORT void InitObject (int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
 
virtual SOLVER_UTILS_EXPORT void v_UpdateGridVelocity (const NekDouble &time)
 
virtual SOLVER_UTILS_EXPORT void v_ALEPreMultiplyMass (Array< OneD, Array< OneD, NekDouble > > &fields)
 
SOLVER_UTILS_EXPORT void ALEDoElmtInvMass (Array< OneD, Array< OneD, NekDouble > > &traceNormals, Array< OneD, Array< OneD, NekDouble > > &fields, NekDouble time)
 Update m_fields with u^n by multiplying by inverse mass matrix. That's then used in e.g. checkpoint output and L^2 error calculation.
 
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
SOLVER_UTILS_EXPORT void MoveMesh (const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
 
SOLVER_UTILS_EXPORT void ResetMatricesNormal (Array< OneD, Array< OneD, NekDouble > > &traceNormals)
 
SOLVER_UTILS_EXPORT void UpdateNormalsFlag ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocity ()
 
bool & GetUpdateNormalsFlag ()
 
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocityTrace ()
 
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
SOLVER_UTILS_EXPORT void ExtraFldOutputGrid (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 
- 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.
 
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.
 
SOLVER_UTILS_EXPORT void GetPressure (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &pressure)
 Extract array with pressure from physfield.
 
SOLVER_UTILS_EXPORT void SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels, const int step)
 
SOLVER_UTILS_EXPORT bool GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels, const int step)
 
SOLVER_UTILS_EXPORT void SetMovingFrameDisp (const Array< OneD, NekDouble > &vFrameDisp, const int step)
 
SOLVER_UTILS_EXPORT void SetMovingFramePivot (const Array< OneD, NekDouble > &vFramePivot)
 
SOLVER_UTILS_EXPORT bool GetMovingFrameDisp (Array< OneD, NekDouble > &vFrameDisp, const int step)
 
SOLVER_UTILS_EXPORT void SetAeroForce (Array< OneD, NekDouble > forces)
 Set aerodynamic force and moment.
 
SOLVER_UTILS_EXPORT void GetAeroForce (Array< OneD, NekDouble > forces)
 Get aerodynamic force and moment.
 

Protected Member Functions

 CompressibleFlowSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
 ~CompressibleFlowSystem () override=default
 
void v_InitObject (bool DeclareFields=true) override
 Initialization object for CompressibleFlowSystem class.
 
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 v_ALEInitObject (int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) override
 
void InitialiseParameters ()
 Load CFS parameters from the session file.
 
void InitAdvection ()
 Create advection and diffusion objects for CFS.
 
void DoOdeRhs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the right-hand side.
 
void DoOdeProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Compute the projection and call the method for imposing the boundary conditions in case of discontinuous projection.
 
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 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.
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
 
void SetBoundaryConditionsBwdWeight ()
 Set up a weight on physical boundaries for boundary condition applications.
 
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.
 
NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray) override
 Calculate the maximum timestep subject to CFL restrictions.
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 Print a summary of time stepping parameters.
 
void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
 Set up logic for residual calculation.
 
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.
 
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
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members.
 
SOLVER_UTILS_EXPORT void v_InitObject (bool DeclareField=true) override
 Init object for UnsteadySystem class.
 
SOLVER_UTILS_EXPORT void v_DoSolve () override
 Solves an unsteady problem.
 
virtual SOLVER_UTILS_EXPORT void v_PrintStatusInformation (const int step, const NekDouble cpuTime)
 Print Status Information.
 
virtual SOLVER_UTILS_EXPORT void v_PrintSummaryStatistics (const NekDouble intTime)
 Print Summary Statistics.
 
SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true) override
 Sets up initial conditions.
 
SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s) override
 Print a summary of time stepping parameters.
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
virtual SOLVER_UTILS_EXPORT bool v_UpdateTimeStepCheck ()
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control.
 
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.
 
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.
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members.
 
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.
 
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.
 
virtual SOLVER_UTILS_EXPORT NekDouble v_H1Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the H_1 error computation between fields and a given exact solution.
 
virtual SOLVER_UTILS_EXPORT void v_TransCoeffToPhys ()
 Virtual function for transformation to physical space.
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space.
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp (void)
 Virtual function to identify if operator is negated in DoSolve.
 
- Protected Member Functions inherited from Nektar::SolverUtils::FluidInterface
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameVelocities (const Array< OneD, NekDouble > &vFrameVels, const int step)
 
virtual SOLVER_UTILS_EXPORT bool v_GetMovingFrameVelocities (Array< OneD, NekDouble > &vFrameVels, const int step)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFrameDisp (const Array< OneD, NekDouble > &vFrameDisp, const int step)
 
virtual SOLVER_UTILS_EXPORT void v_SetMovingFramePivot (const Array< OneD, NekDouble > &vFramePivot)
 
virtual SOLVER_UTILS_EXPORT bool v_GetMovingFrameDisp (Array< OneD, NekDouble > &vFrameDisp, const int step)
 
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.
 
- Protected Attributes inherited from Nektar::SolverUtils::UnsteadySystem
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme.
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use.
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check.
 
std::vector< int > m_intVariables
 
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1).
 
NekDouble m_CFLGrowth
 CFL growth rate.
 
NekDouble m_CFLEnd
 Maximun cfl in cfl growth.
 
int m_abortSteps
 Number of steps between checks for abort conditions.
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used.
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used.
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used.
 
int m_steadyStateSteps
 Check for steady state at step interval.
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at.
 
int m_filtersInfosteps
 Number of time steps between outputting filters information.
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state.
 
std::ofstream m_errFile
 
NekDouble m_epsilon
 Diffusion coefficient.
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator.
 
bool m_verbose
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader.
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions.
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output.
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables.
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object.
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh.
 
std::string m_sessionName
 Name of the session.
 
NekDouble m_time
 Current time of simulation.
 
int m_initialStep
 Number of the step where the simulation should begin.
 
NekDouble m_fintime
 Finish time of the simulation.
 
NekDouble m_timestep
 Time step size.
 
NekDouble m_lambda
 Lambda constant in real system if one required.
 
NekDouble m_checktime
 Time between checkpoints.
 
NekDouble m_lastCheckTime
 
NekDouble m_TimeIncrementFactor
 
int m_nchk
 Number of checkpoints written so far.
 
int m_steps
 Number of steps to take.
 
int m_checksteps
 Number of steps between checkpoints.
 
int m_infosteps
 Number of time steps between outputting status information.
 
int m_iterPIT = 0
 Number of parallel-in-time time iteration.
 
int m_windowPIT = 0
 Index of windows for parallel-in-time time iteration.
 
int m_spacedim
 Spatial dimension (>= expansion dim).
 
int m_expdim
 Expansion dimension.
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used.
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used.
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used.
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform.
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations.
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous.
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction.
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity.
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields.
 
Array< OneD, NekDoublem_movingFrameData
 Moving reference frame status in the inertial frame X, Y, Z, Theta_x, Theta_y, Theta_z, U, V, W, Omega_x, Omega_y, Omega_z, A_x, A_y, A_z, DOmega_x, DOmega_y, DOmega_z, pivot_x, pivot_y, pivot_z.
 
std::vector< std::string > m_strFrameData
 variable name in m_movingFrameData
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error.
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous)
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous)
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous)
 
int m_npointsX
 number of points in X direction (if homogeneous)
 
int m_npointsY
 number of points in Y direction (if homogeneous)
 
int m_npointsZ
 number of points in Z direction (if homogeneous)
 
int m_HomoDirec
 number of homogenous directions
 
- Protected Attributes inherited from Nektar::SolverUtils::ALEHelper
Array< OneD, MultiRegions::ExpListSharedPtrm_fieldsALE
 
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
 
Array< OneD, Array< OneD, NekDouble > > m_gridVelocityTrace
 
std::vector< ALEBaseShPtrm_ALEs
 
bool m_ALESolver = false
 
bool m_meshDistorted = false
 
bool m_implicitALESolver = false
 
bool m_updateNormals = false
 
NekDouble m_prevStageTime = 0.0
 
int m_spaceDim
 

Private Member Functions

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

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

Constructor & Destructor Documentation

◆ 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.

◆ ~CompressibleFlowSystem()

Nektar::CompressibleFlowSystem::~CompressibleFlowSystem ( )
overrideprotecteddefault

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

365{
366 int nvariables = inarray.size();
367 Array<OneD, Array<OneD, NekDouble>> advVel(m_spacedim);
368
369 if (m_meshDistorted)
370 {
371 auto advWeakDGObject =
372 std::dynamic_pointer_cast<SolverUtils::AdvectionWeakDG>(
374 advWeakDGObject->AdvectCoeffs(nvariables, m_fields, advVel, inarray,
375 outarray, time, pFwd, pBwd);
376 }
377 else
378 {
379 m_advObject->Advect(nvariables, m_fields, advVel, inarray, outarray,
380 time, pFwd, pBwd);
381 }
382}
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, Nektar::SolverUtils::ALEHelper::m_meshDistorted, 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 387 of file CompressibleFlowSystem.cpp.

392{
393 v_DoDiffusion(inarray, outarray, pFwd, pBwd);
394}
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 313 of file CompressibleFlowSystem.cpp.

316{
317 size_t nvariables = inarray.size();
318
319 // Perform ALE movement
320 if (m_ALESolver)
321 {
323 }
324
325 switch (m_projectionType)
326 {
328 {
329 // Just copy over array
330 for (size_t i = 0; i < nvariables; ++i)
331 {
332 Vmath::Vcopy(inarray[i].size(), inarray[i], 1, outarray[i], 1);
333
334 if (m_useFiltering)
335 {
336 m_fields[i]->ExponentialFilter(outarray[i], m_filterAlpha,
339 }
340 }
341 SetBoundaryConditions(outarray, time);
342 break;
343 }
346 {
347 NEKERROR(ErrorUtil::efatal, "No Continuous Galerkin for full "
348 "compressible Navier-Stokes equations");
349 break;
350 }
351 default:
352 NEKERROR(ErrorUtil::efatal, "Unknown projection scheme");
353 break;
354 }
355}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
SOLVER_UTILS_EXPORT void MoveMesh(const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
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::ALEHelper::m_ALESolver, Nektar::SolverUtils::EquationSystem::m_fields, m_filterAlpha, m_filterCutoff, m_filterExponent, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::SolverUtils::EquationSystem::m_traceNormals, m_useFiltering, Nektar::SolverUtils::ALEHelper::MoveMesh(), 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 214 of file CompressibleFlowSystem.cpp.

217{
218 LibUtilities::Timer timer;
219
220 size_t nvariables = inarray.size();
221 size_t nTracePts = GetTraceTotPoints();
222
223 // This converts our Mu in coefficient space to u in physical space for ALE
224 Array<OneD, Array<OneD, NekDouble>> tmpIn(nvariables);
225 if (m_meshDistorted)
226 {
228 }
229 else
230 {
231 tmpIn = inarray;
232 }
233
234 m_bndEvaluateTime = time;
235
236 // Store forwards/backwards space along trace space
237 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
238 Array<OneD, Array<OneD, NekDouble>> Bwd(nvariables);
239
241 {
244 }
245 else
246 {
247 for (size_t i = 0; i < nvariables; ++i)
248 {
249 Fwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
250 Bwd[i] = Array<OneD, NekDouble>(nTracePts, 0.0);
251 m_fields[i]->GetFwdBwdTracePhys(tmpIn[i], Fwd[i], Bwd[i]);
252 }
253 m_fields[0]->PeriodicBwdRot(Bwd);
254 if (m_fields[0]->GetGraph()->GetMovement()->GetSectorRotateFlag())
255 {
256 m_fields[0]->RotLocalBwdTrace(Bwd);
257 }
258 }
259
260 // Calculate advection
261 timer.Start();
262 DoAdvection(tmpIn, outarray, time, Fwd, Bwd);
263 timer.Stop();
264 timer.AccumulateRegion("DoAdvection");
265
266 // Negate results
267 for (size_t i = 0; i < nvariables; ++i)
268 {
269 Vmath::Neg(outarray[i].size(), outarray[i], 1);
270 }
271
272 // Add diffusion terms
273 timer.Start();
274 DoDiffusion(tmpIn, outarray, Fwd, Bwd);
275 timer.Stop();
276 timer.AccumulateRegion("DoDiffusion");
277
278 // Add forcing terms
279 for (auto &x : m_forcing)
280 {
281 x->Apply(m_fields, tmpIn, outarray, time);
282 }
283
285 {
286 size_t nElements = m_fields[0]->GetExpSize();
287 int nq, offset;
288 NekDouble fac;
289 Array<OneD, NekDouble> tmp;
290
291 Array<OneD, NekDouble> tstep(nElements, 0.0);
292 GetElmtTimeStep(tmpIn, tstep);
293
294 // Loop over elements
295 for (size_t n = 0; n < nElements; ++n)
296 {
297 nq = m_fields[0]->GetExp(n)->GetTotPoints();
298 offset = m_fields[0]->GetPhys_Offset(n);
299 fac = tstep[n] / m_timestep;
300 for (size_t i = 0; i < nvariables; ++i)
301 {
302 Vmath::Smul(nq, fac, outarray[i] + offset, 1,
303 tmp = outarray[i] + offset, 1);
304 }
305 }
306 }
307}
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.
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
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(), Nektar::SolverUtils::ALEHelper::ALEDoElmtInvMassBwdTrans(), DoAdvection(), DoDiffusion(), Nektar::SolverUtils::EquationSystem::eHomogeneous1D, GetElmtTimeStep(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), m_bndEvaluateTime, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, Nektar::SolverUtils::EquationSystem::m_HomogeneousType, Nektar::SolverUtils::ALEHelper::m_meshDistorted, 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 1123 of file CompressibleFlowSystem.cpp.

1126{
1127 NekDouble beta, u0, v0, x0, y0;
1128
1129 int nTotQuadPoints = GetTotPoints();
1130 Array<OneD, NekDouble> x(nTotQuadPoints);
1131 Array<OneD, NekDouble> y(nTotQuadPoints);
1132 Array<OneD, NekDouble> z(nTotQuadPoints);
1133 Array<OneD, Array<OneD, NekDouble>> u(m_spacedim + 2);
1134
1135 m_fields[0]->GetCoords(x, y, z);
1136
1137 for (int i = 0; i < m_spacedim + 2; ++i)
1138 {
1139 u[i] = Array<OneD, NekDouble>(nTotQuadPoints);
1140 }
1141 m_session->LoadParameter("IsentropicBeta", beta, 5.0);
1142 m_session->LoadParameter("IsentropicU0", u0, 1.0);
1143 m_session->LoadParameter("IsentropicV0", v0, 0.5);
1144 m_session->LoadParameter("IsentropicX0", x0, 5.0);
1145 m_session->LoadParameter("IsentropicY0", y0, 0.0);
1146
1147 // Flow parameters
1148 NekDouble r, xbar, ybar, tmp;
1149 NekDouble fac = 1.0 / (16.0 * m_gamma * M_PI * M_PI);
1150
1151 // In 3D zero rhow field.
1152 if (m_spacedim == 3)
1153 {
1154 Vmath::Zero(nTotQuadPoints, &u[3][o], 1);
1155 }
1156
1157 // Fill storage
1158 for (int i = 0; i < nTotQuadPoints; ++i)
1159 {
1160 xbar = x[i] - u0 * time - x0;
1161 ybar = y[i] - v0 * time - y0;
1162 r = sqrt(xbar * xbar + ybar * ybar);
1163 tmp = beta * exp(1 - r * r);
1164 u[0][i + o] =
1165 pow(1.0 - (m_gamma - 1.0) * tmp * tmp * fac, 1.0 / (m_gamma - 1.0));
1166 u[1][i + o] = u[0][i + o] * (u0 - tmp * ybar / (2 * M_PI));
1167 u[2][i + o] = u[0][i + o] * (v0 + tmp * xbar / (2 * M_PI));
1168 u[m_spacedim + 1][i + o] =
1169 pow(u[0][i + o], m_gamma) / (m_gamma - 1.0) +
1170 0.5 * (u[1][i + o] * u[1][i + o] + u[2][i + o] * u[2][i + o]) /
1171 u[0][i + o];
1172 }
1173 Vmath::Vcopy(nTotQuadPoints, u[field].data(), 1, outfield.data(), 1);
1174}
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:290

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

624{
625 size_t nElements = m_fields[0]->GetExpSize();
626
627 // Change value of m_timestep (in case it is set to zero)
628 NekDouble tmp = m_timestep;
629 m_timestep = 1.0;
630
631 Array<OneD, NekDouble> cfl(nElements);
632 cfl = GetElmtCFLVals();
633
634 // Factors to compute the time-step limit
636
637 // Loop over elements to compute the time-step limit for each element
638 for (size_t n = 0; n < nElements; ++n)
639 {
640 tstep[n] = m_cflSafetyFactor * alpha / cfl[n];
641 }
642
643 // Restore value of m_timestep
644 m_timestep = tmp;
645}
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(), 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 1179 of file CompressibleFlowSystem.cpp.

1181{
1182 int nTotQuadPoints = GetTotPoints();
1183
1184 Array<OneD, NekDouble> rho(nTotQuadPoints, 100.0);
1185 Array<OneD, NekDouble> rhou(nTotQuadPoints);
1186 Array<OneD, NekDouble> rhov(nTotQuadPoints);
1187 Array<OneD, NekDouble> E(nTotQuadPoints);
1188 Array<OneD, NekDouble> x(nTotQuadPoints);
1189 Array<OneD, NekDouble> y(nTotQuadPoints);
1190 Array<OneD, NekDouble> z(nTotQuadPoints);
1191
1192 m_fields[0]->GetCoords(x, y, z);
1193
1194 // Flow parameters
1195 NekDouble c, k, phi, r, J, VV, pp, sint, P, ss;
1196 NekDouble J11, J12, J21, J22, det;
1197 NekDouble Fx, Fy;
1198 NekDouble xi, yi;
1199 NekDouble dV;
1200 NekDouble dtheta;
1201 NekDouble par1;
1202 NekDouble theta = M_PI / 4.0;
1203 NekDouble kExt = 0.7;
1204 NekDouble V = kExt * sin(theta);
1205 NekDouble toll = 1.0e-8;
1206 NekDouble errV = 1.0;
1207 NekDouble errTheta = 1.0;
1208 NekDouble gamma = m_gamma;
1209 NekDouble gamma_1_2 = (gamma - 1.0) / 2.0;
1210
1211 for (int i = 0; i < nTotQuadPoints; ++i)
1212 {
1213 while ((abs(errV) > toll) || (abs(errTheta) > toll))
1214 {
1215 VV = V * V;
1216 sint = sin(theta);
1217 c = sqrt(1.0 - gamma_1_2 * VV);
1218 k = V / sint;
1219 phi = 1.0 / k;
1220 pp = phi * phi;
1221 J = 1.0 / c + 1.0 / (3.0 * c * c * c) +
1222 1.0 / (5.0 * c * c * c * c * c) -
1223 0.5 * log((1.0 + c) / (1.0 - c));
1224
1225 r = pow(c, 1.0 / gamma_1_2);
1226 xi = 1.0 / (2.0 * r) * (1.0 / VV - 2.0 * pp) + J / 2.0;
1227 yi = phi / (r * V) * sqrt(1.0 - VV * pp);
1228 par1 = 25.0 - 5.0 * VV;
1229 ss = sint * sint;
1230
1231 Fx = xi - x[i];
1232 Fy = yi - y[i];
1233
1234 J11 =
1235 39062.5 / pow(par1, 3.5) * (1.0 / VV - 2.0 / VV * ss) * V +
1236 1562.5 / pow(par1, 2.5) *
1237 (-2.0 / (VV * V) + 4.0 / (VV * V) * ss) +
1238 12.5 / pow(par1, 1.5) * V + 312.5 / pow(par1, 2.5) * V +
1239 7812.5 / pow(par1, 3.5) * V -
1240 0.25 *
1241 (-1.0 / pow(par1, 0.5) * V / (1.0 - 0.2 * pow(par1, 0.5)) -
1242 (1.0 + 0.2 * pow(par1, 0.5)) /
1243 pow((1.0 - 0.2 * pow(par1, 0.5)), 2.0) /
1244 pow(par1, 0.5) * V) /
1245 (1.0 + 0.2 * pow(par1, 0.5)) * (1.0 - 0.2 * pow(par1, 0.5));
1246
1247 J12 = -6250.0 / pow(par1, 2.5) / VV * sint * cos(theta);
1248 J21 = -6250.0 / (VV * V) * sint / pow(par1, 2.5) *
1249 pow((1.0 - ss), 0.5) +
1250 78125.0 / V * sint / pow(par1, 3.5) * pow((1.0 - ss), 0.5);
1251
1252 // the matrix is singular when theta = pi/2
1253 if (abs(y[i]) < toll && abs(cos(theta)) < toll)
1254 {
1255 J22 = -39062.5 / pow(par1, 3.5) / V +
1256 3125 / pow(par1, 2.5) / (VV * V) +
1257 12.5 / pow(par1, 1.5) * V + 312.5 / pow(par1, 2.5) * V +
1258 7812.5 / pow(par1, 3.5) * V -
1259 0.25 *
1260 (-1.0 / pow(par1, 0.5) * V /
1261 (1.0 - 0.2 * pow(par1, 0.5)) -
1262 (1.0 + 0.2 * pow(par1, 0.5)) /
1263 pow((1.0 - 0.2 * pow(par1, 0.5)), 2.0) /
1264 pow(par1, 0.5) * V) /
1265 (1.0 + 0.2 * pow(par1, 0.5)) *
1266 (1.0 - 0.2 * pow(par1, 0.5));
1267
1268 // dV = -dV/dx * Fx
1269 dV = -1.0 / J22 * Fx;
1270 dtheta = 0.0;
1271 theta = M_PI / 2.0;
1272 }
1273 else
1274 {
1275 J22 = 3125.0 / VV * cos(theta) / pow(par1, 2.5) *
1276 pow((1.0 - ss), 0.5) -
1277 3125.0 / VV * ss / pow(par1, 2.5) / pow((1.0 - ss), 0.5) *
1278 cos(theta);
1279
1280 det = -1.0 / (J11 * J22 - J12 * J21);
1281
1282 // [dV dtheta]' = -[invJ]*[Fx Fy]'
1283 dV = det * (J22 * Fx - J12 * Fy);
1284 dtheta = det * (-J21 * Fx + J11 * Fy);
1285 }
1286
1287 V = V + dV;
1288 theta = theta + dtheta;
1289
1290 errV = abs(dV);
1291 errTheta = abs(dtheta);
1292 }
1293
1294 c = sqrt(1.0 - gamma_1_2 * VV);
1295 r = pow(c, 1.0 / gamma_1_2);
1296
1297 rho[i] = r;
1298 rhou[i] = rho[i] * V * cos(theta);
1299 rhov[i] = rho[i] * V * sin(theta);
1300 P = (c * c) * rho[i] / gamma;
1301 E[i] = P / (gamma - 1.0) +
1302 0.5 * (rhou[i] * rhou[i] / rho[i] + rhov[i] * rhov[i] / rho[i]);
1303
1304 // Resetting the guess value
1305 errV = 1.0;
1306 errTheta = 1.0;
1307 theta = M_PI / 4.0;
1308 V = kExt * sin(theta);
1309 }
1310
1311 switch (field)
1312 {
1313 case 0:
1314 outarray = rho;
1315 break;
1316 case 1:
1317 outarray = rhou;
1318 break;
1319 case 2:
1320 outarray = rhov;
1321 break;
1322 case 3:
1323 outarray = E;
1324 break;
1325 default:
1326 ASSERTL0(false, "Error in variable number!");
1327 break;
1328 }
1329}
#define ASSERTL0(condition, msg)
@ P
Monomial polynomials .
Definition BasisType.h:62
scalarT< T > abs(scalarT< T > in)
Definition scalar.hpp:295
scalarT< T > log(scalarT< T > in)
Definition scalar.hpp:310

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

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

455{
456 size_t nVariables = physfield.size();
457 size_t nPts = physfield[0].size();
458
459 constexpr unsigned short maxVel = 3;
460 constexpr unsigned short maxFld = 5;
461
462 // hardcoding done for performance reasons
463 ASSERTL1(nVariables <= maxFld, "GetFluxVector, hard coded max fields");
464
465 for (size_t p = 0; p < nPts; ++p)
466 {
467 // local storage
468 std::array<NekDouble, maxFld> fieldTmp = {0};
469 std::array<NekDouble, maxVel> velocity = {0};
470
471 // rearrenge and load data
472 for (size_t f = 0; f < nVariables; ++f)
473 {
474 fieldTmp[f] = physfield[f][p]; // load
475 }
476
477 // 1 / rho
478 NekDouble oneOrho = 1.0 / fieldTmp[0];
479
480 for (size_t d = 0; d < m_spacedim; ++d)
481 {
482 // Flux vector for the rho equation
483 flux[0][d][p] = fieldTmp[d + 1]; // store
484 // compute velocity
485 velocity[d] = fieldTmp[d + 1] * oneOrho;
486 }
487
488 NekDouble pressure = m_varConv->GetPressure(fieldTmp.data());
489 NekDouble ePlusP = fieldTmp[m_spacedim + 1] + pressure;
490 for (size_t f = 0; f < m_spacedim; ++f)
491 {
492 // Flux vector for the velocity fields
493 for (size_t d = 0; d < m_spacedim; ++d)
494 {
495 flux[f + 1][d][p] = velocity[d] * fieldTmp[f + 1]; // store
496 }
497
498 // Add pressure to appropriate field
499 flux[f + 1][f][p] += pressure;
500
501 // Flux vector for energy
502 flux[m_spacedim + 1][f][p] = ePlusP * velocity[f]; // store
503 }
504 }
505
506 // @TODO : for each row (3 columns) negative grid velocity component (d * d
507 // + 2 (4 rows)) rho, rhou, rhov, rhow, E,
508 // @TODO : top row is flux for rho etc... each row subtract v_g * conserved
509 // variable for that row... For grid velocity subtract v_g * conserved
510 // variable
511 if (m_ALESolver)
512 {
513 for (int i = 0; i < m_spacedim + 2; ++i)
514 {
515 for (int j = 0; j < m_spacedim; ++j)
516 {
517 for (int k = 0; k < nPts; ++k)
518 {
519 flux[i][j][k] -= physfield[i][k] * m_gridVelocity[j][k];
520 }
521 }
522 }
523 }
524}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
VariableConverterSharedPtr m_varConv
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
Definition ALEHelper.h:141
std::vector< double > p(NPUPPER)
std::vector< double > d(NPUPPER *NPUPPER)

References ASSERTL1, Nektar::SolverUtils::ALEHelper::m_ALESolver, Nektar::SolverUtils::ALEHelper::m_gridVelocity, Nektar::SolverUtils::EquationSystem::m_spacedim, and m_varConv.

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

536{
537 int i, j;
538 size_t nq = physfield[0].size();
539 size_t nVariables = m_fields.size();
540
541 // Factor to rescale 1d points in dealiasing
542 NekDouble OneDptscale = 2;
543 nq = m_fields[0]->Get1DScaledTotPoints(OneDptscale);
544
545 Array<OneD, NekDouble> pressure(nq);
546 Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
547
548 Array<OneD, Array<OneD, NekDouble>> physfield_interp(nVariables);
549 TensorOfArray3D<NekDouble> flux_interp(nVariables);
550
551 for (size_t i = 0; i < nVariables; ++i)
552 {
553 physfield_interp[i] = Array<OneD, NekDouble>(nq);
554 flux_interp[i] = Array<OneD, Array<OneD, NekDouble>>(m_spacedim);
555 m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i],
556 physfield_interp[i]);
557
558 for (j = 0; j < m_spacedim; ++j)
559 {
560 flux_interp[i][j] = Array<OneD, NekDouble>(nq);
561 }
562 }
563
564 // Flux vector for the rho equation
565 for (i = 0; i < m_spacedim; ++i)
566 {
567 velocity[i] = Array<OneD, NekDouble>(nq);
568
569 // Galerkin project solution back to original space
570 m_fields[0]->PhysGalerkinProjection1DScaled(
571 OneDptscale, physfield_interp[i + 1], flux[0][i]);
572 }
573
574 m_varConv->GetVelocityVector(physfield_interp, velocity);
575 m_varConv->GetPressure(physfield_interp, pressure);
576
577 // Evaluation of flux vector for the velocity fields
578 for (i = 0; i < m_spacedim; ++i)
579 {
580 for (j = 0; j < m_spacedim; ++j)
581 {
582 Vmath::Vmul(nq, velocity[j], 1, physfield_interp[i + 1], 1,
583 flux_interp[i + 1][j], 1);
584 }
585
586 // Add pressure to appropriate field
587 Vmath::Vadd(nq, flux_interp[i + 1][i], 1, pressure, 1,
588 flux_interp[i + 1][i], 1);
589 }
590
591 // Galerkin project solution back to original space
592 for (i = 0; i < m_spacedim; ++i)
593 {
594 for (j = 0; j < m_spacedim; ++j)
595 {
596 m_fields[0]->PhysGalerkinProjection1DScaled(
597 OneDptscale, flux_interp[i + 1][j], flux[i + 1][j]);
598 }
599 }
600
601 // Evaluation of flux vector for energy
602 Vmath::Vadd(nq, physfield_interp[m_spacedim + 1], 1, pressure, 1, pressure,
603 1);
604
605 for (j = 0; j < m_spacedim; ++j)
606 {
607 Vmath::Vmul(nq, velocity[j], 1, pressure, 1,
608 flux_interp[m_spacedim + 1][j], 1);
609
610 // Galerkin project solution back to original space
611 m_fields[0]->PhysGalerkinProjection1DScaled(
612 OneDptscale, flux_interp[m_spacedim + 1][j],
613 flux[m_spacedim + 1][j]);
614 }
615}
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, Vmath::Vadd(), and Vmath::Vmul().

Referenced by InitAdvection().

◆ GetGamma()

NekDouble Nektar::CompressibleFlowSystem::GetGamma ( )
inlineprotected

Definition at line 182 of file CompressibleFlowSystem.h.

183 {
184 return m_gamma;
185 }

References m_gamma.

Referenced by InitAdvection().

◆ GetNormals()

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

Definition at line 192 of file CompressibleFlowSystem.h.

193 {
194 return m_traceNormals;
195 }

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

916{
917 ASSERTL0(n <= 20, "Illegal modes dimension for CFL calculation "
918 "(P has to be less then 20)");
919
920 NekDouble CFLDG[21] = {2.0000, 6.0000, 11.8424, 19.1569, 27.8419,
921 37.8247, 49.0518, 61.4815, 75.0797, 89.8181,
922 105.6700, 122.6200, 140.6400, 159.7300, 179.8500,
923 201.0100, 223.1800, 246.3600, 270.5300, 295.6900,
924 321.8300}; // CFLDG 1D [0-20]
925 NekDouble CFL = 0.0;
926
928 {
929 CFL = CFLDG[n];
930 }
931 else
932 {
933 NEKERROR(ErrorUtil::efatal, "Continuous Galerkin stability "
934 "coefficients not introduced yet.");
935 }
936
937 return CFL;
938}

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

949{
950 int i;
951 Array<OneD, NekDouble> returnval(m_fields[0]->GetExpSize(), 0.0);
952 for (i = 0; i < m_fields[0]->GetExpSize(); i++)
953 {
954 returnval[i] = GetStabilityLimit(ExpOrder[i]);
955 }
956 return returnval;
957}
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 187 of file CompressibleFlowSystem.h.

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

165{
166 // Check if projection type is correct
168 "Unsupported projection type.");
169
170 std::string advName, riemName;
171 m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
172
175
177 {
178 m_advObject->SetFluxVector(
180 }
181 else
182 {
184 this);
185 }
186
187 // Setting up Riemann solver for advection operator
188 m_session->LoadSolverInfo("UpwindType", riemName, "Average");
189
192 riemName, m_session);
193
194 // Tell Riemann Solver if doing ALE and provide trace grid velocity
195 riemannSolver->SetALEFlag(m_ALESolver);
196 riemannSolver->SetUpdateNormalsFlag(&ALEHelper::GetUpdateNormalsFlag, this);
197
198 riemannSolver->SetVector("vgt", &ALEHelper::GetGridVelocityTrace, this);
199
200 // Setting up parameters for advection operator Riemann solver
201 riemannSolver->SetParam("gamma", &CompressibleFlowSystem::GetGamma, this);
202 riemannSolver->SetAuxVec("vecLocs", &CompressibleFlowSystem::GetVecLocs,
203 this);
204 riemannSolver->SetVector("N", &CompressibleFlowSystem::GetNormals, this);
205
206 // Concluding initialisation of advection / diffusion operators
207 m_advObject->SetRiemannSolver(riemannSolver);
208 m_advObject->InitObject(m_session, m_fields);
209}
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.
SOLVER_UTILS_EXPORT const Array< OneD, const Array< OneD, NekDouble > > & GetGridVelocityTrace()
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(), Nektar::SolverUtils::ALEHelper::GetGridVelocityTrace(), GetNormals(), Nektar::SolverUtils::GetRiemannSolverFactory(), Nektar::SolverUtils::ALEHelper::GetUpdateNormalsFlag(), GetVecLocs(), Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::SolverUtils::ALEHelper::m_ALESolver, 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 128 of file CompressibleFlowSystem.cpp.

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

398{
399 size_t nTracePts = GetTraceTotPoints();
400 size_t nvariables = physarray.size();
401
402 // This converts our Mu in coefficient space to u in physical space for ALE
403 Array<OneD, Array<OneD, NekDouble>> tmpIn(nvariables);
404
405 if (m_meshDistorted)
406 {
407 ALEHelper::ALEDoElmtInvMassBwdTrans(physarray, tmpIn);
408 }
409 else
410 {
411 tmpIn = physarray;
412 }
413
414 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
415 for (size_t i = 0; i < nvariables; ++i)
416 {
417 Fwd[i] = Array<OneD, NekDouble>(nTracePts);
418 m_fields[i]->ExtractTracePhys(tmpIn[i], Fwd[i]);
419 }
420
421 if (!m_bndConds.empty())
422 {
423 // Loop over user-defined boundary conditions
424 for (auto &x : m_bndConds)
425 {
426 x->Apply(Fwd, tmpIn, time);
427 }
428 }
429}
std::vector< CFSBndCondSharedPtr > m_bndConds

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

Referenced by DoOdeProjection().

◆ SetBoundaryConditionsBwdWeight()

void Nektar::CompressibleFlowSystem::SetBoundaryConditionsBwdWeight ( )
protected

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

Definition at line 434 of file CompressibleFlowSystem.cpp.

435{
436 if (m_bndConds.size())
437 {
438 // Loop over user-defined boundary conditions
439 for (auto &x : m_bndConds)
440 {
441 x->ApplyBwdWeight();
442 }
443 }
444}

References m_bndConds.

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

◆ v_ALEInitObject()

void Nektar::CompressibleFlowSystem::v_ALEInitObject ( int  spaceDim,
Array< OneD, MultiRegions::ExpListSharedPtr > &  fields 
)
overrideprotectedvirtual

Reimplemented from Nektar::SolverUtils::ALEHelper.

Definition at line 1331 of file CompressibleFlowSystem.cpp.

1333{
1334 m_spaceDim = spaceDim;
1335 m_fieldsALE = fields;
1336
1337 if (fields[0]->GetGraph() != nullptr)
1338 {
1339 fields[0]->GetGraph()->GetMovement()->SetMeshDistortedFlag(
1341 }
1342
1343 // Initialise grid velocities as 0s
1344 m_gridVelocity = Array<OneD, Array<OneD, NekDouble>>(m_spaceDim);
1345 m_gridVelocityTrace = Array<OneD, Array<OneD, NekDouble>>(m_spaceDim);
1346 for (int i = 0; i < spaceDim; ++i)
1347 {
1348 m_gridVelocity[i] =
1349 Array<OneD, NekDouble>(fields[0]->GetTotPoints(), 0.0);
1351 Array<OneD, NekDouble>(fields[0]->GetTrace()->GetTotPoints(), 0.0);
1352 }
1353
1354 ALEHelper::InitObject(spaceDim, fields);
1355}
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsALE
Definition ALEHelper.h:140
SOLVER_UTILS_EXPORT void InitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Definition ALEHelper.cpp:48
Array< OneD, Array< OneD, NekDouble > > m_gridVelocityTrace
Definition ALEHelper.h:142

References Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::SolverUtils::ALEHelper::InitObject(), Nektar::SolverUtils::ALEHelper::m_fieldsALE, Nektar::SolverUtils::ALEHelper::m_gridVelocity, Nektar::SolverUtils::ALEHelper::m_gridVelocityTrace, Nektar::SolverUtils::ALEHelper::m_meshDistorted, and Nektar::SolverUtils::ALEHelper::m_spaceDim.

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

756{
757
758 if (!m_session->DefinesFunction("ExactSolution") &&
759 m_session->DefinesSolverInfo("ICTYPE"))
760 {
761 if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
762 "IsentropicVortex"))
763 {
764 EvaluateIsentropicVortex(field, outfield, time);
765 }
766 else if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
767 "RinglebFlow"))
768 {
769 GetExactRinglebFlow(field, outfield);
770 }
771 }
772 else
773 {
774 EquationSystem::v_EvaluateExactSolution(field, outfield, time);
775 }
776}
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 959 of file CompressibleFlowSystem.cpp.

962{
963 bool extraFields;
964 m_session->MatchSolverInfo("OutputExtraFields", "True", extraFields, true);
965 if (extraFields)
966 {
967 const int nPhys = m_fields[0]->GetNpoints();
968 const int nCoeffs = m_fields[0]->GetNcoeffs();
969 Array<OneD, Array<OneD, NekDouble>> tmp(m_fields.size());
970
971 for (int i = 0; i < m_fields.size(); ++i)
972 {
973 tmp[i] = m_fields[i]->GetPhys();
974 }
975
976 Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
977 Array<OneD, Array<OneD, NekDouble>> velFwd(m_spacedim);
978 for (int i = 0; i < m_spacedim; ++i)
979 {
980 velocity[i] = Array<OneD, NekDouble>(nPhys);
981 velFwd[i] = Array<OneD, NekDouble>(nCoeffs);
982 }
983
984 Array<OneD, NekDouble> pressure(nPhys), temperature(nPhys);
985 Array<OneD, NekDouble> entropy(nPhys);
986 Array<OneD, NekDouble> soundspeed(nPhys), mach(nPhys);
987 Array<OneD, NekDouble> sensor(nPhys), SensorKappa(nPhys);
988
989 m_varConv->GetVelocityVector(tmp, velocity);
990 m_varConv->GetPressure(tmp, pressure);
991 m_varConv->GetTemperature(tmp, temperature);
992 m_varConv->GetEntropy(tmp, entropy);
993 m_varConv->GetSoundSpeed(tmp, soundspeed);
994 m_varConv->GetMach(tmp, soundspeed, mach);
995
996 int sensorOffset;
997 m_session->LoadParameter("SensorOffset", sensorOffset, 1);
998 m_varConv->GetSensor(m_fields[0], tmp, sensor, SensorKappa,
999 sensorOffset);
1000
1001 Array<OneD, NekDouble> pFwd(nCoeffs), TFwd(nCoeffs);
1002 Array<OneD, NekDouble> sFwd(nCoeffs);
1003 Array<OneD, NekDouble> aFwd(nCoeffs), mFwd(nCoeffs);
1004 Array<OneD, NekDouble> sensFwd(nCoeffs);
1005
1006 std::string velNames[3] = {"u", "v", "w"};
1007 for (int i = 0; i < m_spacedim; ++i)
1008 {
1009 m_fields[0]->FwdTransLocalElmt(velocity[i], velFwd[i]);
1010 variables.push_back(velNames[i]);
1011 fieldcoeffs.push_back(velFwd[i]);
1012 }
1013
1014 m_fields[0]->FwdTransLocalElmt(pressure, pFwd);
1015 m_fields[0]->FwdTransLocalElmt(temperature, TFwd);
1016 m_fields[0]->FwdTransLocalElmt(entropy, sFwd);
1017 m_fields[0]->FwdTransLocalElmt(soundspeed, aFwd);
1018 m_fields[0]->FwdTransLocalElmt(mach, mFwd);
1019 m_fields[0]->FwdTransLocalElmt(sensor, sensFwd);
1020
1021 variables.push_back("p");
1022 variables.push_back("T");
1023 variables.push_back("s");
1024 variables.push_back("a");
1025 variables.push_back("Mach");
1026 variables.push_back("Sensor");
1027 fieldcoeffs.push_back(pFwd);
1028 fieldcoeffs.push_back(TFwd);
1029 fieldcoeffs.push_back(sFwd);
1030 fieldcoeffs.push_back(aFwd);
1031 fieldcoeffs.push_back(mFwd);
1032 fieldcoeffs.push_back(sensFwd);
1033
1035 {
1036 // reuse pressure
1037 Array<OneD, NekDouble> sensorFwd(nCoeffs);
1038 m_artificialDiffusion->GetArtificialViscosity(tmp, pressure);
1039 m_fields[0]->FwdTransLocalElmt(pressure, sensorFwd);
1040
1041 variables.push_back("ArtificialVisc");
1042 fieldcoeffs.push_back(sensorFwd);
1043 }
1044
1045 if (m_ALESolver)
1046 {
1047 ExtraFldOutputGrid(fieldcoeffs, variables);
1048 ExtraFldOutputGridVelocity(fieldcoeffs, variables);
1049 }
1050 }
1051}
ArtificialDiffusionSharedPtr m_artificialDiffusion
SOLVER_UTILS_EXPORT void ExtraFldOutputGrid(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)

References Nektar::SolverUtils::ALEHelper::ExtraFldOutputGrid(), Nektar::SolverUtils::ALEHelper::ExtraFldOutputGridVelocity(), Nektar::SolverUtils::ALEHelper::m_ALESolver, m_artificialDiffusion, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_spacedim, and m_varConv.

◆ v_GenerateSummary()

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

Print a summary of time stepping parameters.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 665 of file CompressibleFlowSystem.cpp.

666{
668 if (m_session->DefinesSolverInfo("ICTYPE"))
669 {
670 if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
671 "IsentropicVortex"))
672 {
673 SolverUtils::AddSummaryItem(s, "Problem Type", "IsentropicVortex");
674 }
675 else if (boost::iequals(m_session->GetSolverInfo("ICTYPE"),
676 "RinglebFlow"))
677 {
678 SolverUtils::AddSummaryItem(s, "Problem Type", "RinglebFlow");
679 }
680 else
681 {
682 NEKERROR(ErrorUtil::efatal, "unknow initial condition");
683 }
684 }
685}
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 1066 of file CompressibleFlowSystem.cpp.

1069{
1070 density = physfield[0];
1071}

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

784{
785 size_t nTotQuadPoints = GetTotPoints();
786 size_t n_element = m_fields[0]->GetExpSize();
787 size_t expdim = m_fields[0]->GetGraph()->GetMeshDimension();
788 size_t nfields = m_fields.size();
789 int offset;
790 Array<OneD, NekDouble> tmp;
791
792 Array<OneD, Array<OneD, NekDouble>> physfields(nfields);
793 for (size_t i = 0; i < nfields; ++i)
794 {
795 physfields[i] = m_fields[i]->GetPhys();
796 }
797
798 Array<OneD, NekDouble> stdV(n_element, 0.0);
799
800 // Getting the velocity vector on the 2D normal space
801 Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
802 Array<OneD, Array<OneD, NekDouble>> stdVelocity(m_spacedim);
803 Array<OneD, Array<OneD, NekDouble>> stdSoundSpeed(m_spacedim);
804 Array<OneD, NekDouble> soundspeed(nTotQuadPoints);
806
807 for (int i = 0; i < m_spacedim; ++i)
808 {
809 velocity[i] = Array<OneD, NekDouble>(nTotQuadPoints);
810 stdVelocity[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
811 stdSoundSpeed[i] = Array<OneD, NekDouble>(nTotQuadPoints, 0.0);
812 }
813
814 m_varConv->GetVelocityVector(physfields, velocity);
815 m_varConv->GetSoundSpeed(physfields, soundspeed);
816
817 // Subtract Ug from the velocity for the ALE formulation
818 for (size_t i = 0; i < m_spacedim; ++i)
819 {
820 Vmath::Vsub(nTotQuadPoints, velocity[i], 1, m_gridVelocity[i], 1,
821 velocity[i], 1);
822 }
823
824 for (int el = 0; el < n_element; ++el)
825 {
826 ptsKeys = m_fields[0]->GetExp(el)->GetPointsKeys();
827 offset = m_fields[0]->GetPhys_Offset(el);
828 int nq = m_fields[0]->GetExp(el)->GetTotPoints();
829
830 const SpatialDomains::GeomFactorsSharedPtr metricInfo =
831 m_fields[0]->GetExp(el)->GetGeom()->GetMetricInfo();
832 const Array<TwoD, const NekDouble> &gmat =
833 m_fields[0]
834 ->GetExp(el)
835 ->GetGeom()
836 ->GetMetricInfo()
837 ->GetDerivFactors(ptsKeys);
838
839 // Convert to standard element
840 // consider soundspeed in all directions
841 // (this might overestimate the cfl)
842 if (metricInfo->GetGtype() == SpatialDomains::eDeformed)
843 {
844 // d xi/ dx = gmat = 1/J * d x/d xi
845 for (size_t i = 0; i < expdim; ++i)
846 {
847 Vmath::Vmul(nq, gmat[i], 1, velocity[0] + offset, 1,
848 tmp = stdVelocity[i] + offset, 1);
849 Vmath::Vmul(nq, gmat[i], 1, soundspeed + offset, 1,
850 tmp = stdSoundSpeed[i] + offset, 1);
851 for (size_t j = 1; j < expdim; ++j)
852 {
853 Vmath::Vvtvp(nq, gmat[expdim * j + i], 1,
854 velocity[j] + offset, 1,
855 stdVelocity[i] + offset, 1,
856 tmp = stdVelocity[i] + offset, 1);
857 Vmath::Vvtvp(nq, gmat[expdim * j + i], 1,
858 soundspeed + offset, 1,
859 stdSoundSpeed[i] + offset, 1,
860 tmp = stdSoundSpeed[i] + offset, 1);
861 }
862 }
863 }
864 else
865 {
866 for (size_t i = 0; i < expdim; ++i)
867 {
868 Vmath::Smul(nq, gmat[i][0], velocity[0] + offset, 1,
869 tmp = stdVelocity[i] + offset, 1);
870 Vmath::Smul(nq, gmat[i][0], soundspeed + offset, 1,
871 tmp = stdSoundSpeed[i] + offset, 1);
872 for (size_t j = 1; j < expdim; ++j)
873 {
874 Vmath::Svtvp(nq, gmat[expdim * j + i][0],
875 velocity[j] + offset, 1,
876 stdVelocity[i] + offset, 1,
877 tmp = stdVelocity[i] + offset, 1);
878 Vmath::Svtvp(nq, gmat[expdim * j + i][0],
879 soundspeed + offset, 1,
880 stdSoundSpeed[i] + offset, 1,
881 tmp = stdSoundSpeed[i] + offset, 1);
882 }
883 }
884 }
885
886 NekDouble vel;
887 for (size_t i = 0; i < nq; ++i)
888 {
889 NekDouble pntVelocity = 0.0;
890 for (size_t j = 0; j < expdim; ++j)
891 {
892 // Add sound speed
893 vel = std::abs(stdVelocity[j][offset + i]) +
894 SpeedSoundFactor * std::abs(stdSoundSpeed[j][offset + i]);
895 pntVelocity += vel * vel;
896 }
897 pntVelocity = sqrt(pntVelocity);
898 if (pntVelocity > stdV[el])
899 {
900 stdV[el] = pntVelocity;
901 }
902 }
903 }
904
905 return stdV;
906}
std::vector< PointsKey > PointsKeyVector
Definition Points.h:231
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition GeomFactors.h:58
@ 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
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition Vmath.hpp:220

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

◆ v_GetPressure() [1/2]

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

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 197 of file CompressibleFlowSystem.h.

198 {
199 ASSERTL0(false, "This function is not valid for this class");
201 return null;
202 }
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 1056 of file CompressibleFlowSystem.cpp.

1059{
1060 m_varConv->GetPressure(physfield, pressure);
1061}

References m_varConv.

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

652{
653 int nElements = m_fields[0]->GetExpSize();
654 Array<OneD, NekDouble> tstep(nElements, 0.0);
655
656 GetElmtTimeStep(inarray, tstep);
657
658 // Get the minimum time-step limit and return the time-step
659 NekDouble TimeStep = Vmath::Vmin(nElements, tstep, 1);
660 m_comm->GetSpaceComm()->AllReduce(TimeStep, LibUtilities::ReduceMin);
661
662 return TimeStep;
663}
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 1076 of file CompressibleFlowSystem.cpp.

1079{
1080 m_varConv->GetVelocityVector(physfield, velocity);
1081}

References m_varConv.

◆ v_HasConstantDensity()

bool Nektar::CompressibleFlowSystem::v_HasConstantDensity ( )
inlineoverrideprotectedvirtual

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 118 of file CompressibleFlowSystem.h.

119 {
120 return false;
121 }

◆ 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::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 {
114 m_spacedim, n, cnt));
115 }
116 cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
117 }
118
121
123}
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)
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:76
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.
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::ALEHelper::m_gridVelocityTrace, 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 690 of file CompressibleFlowSystem.cpp.

693{
694 if (m_session->DefinesSolverInfo("ICTYPE") &&
695 boost::iequals(m_session->GetSolverInfo("ICTYPE"), "IsentropicVortex"))
696 {
697 // Forward transform to fill the coefficient space
698 for (int i = 0; i < m_fields.size(); ++i)
699 {
700 EvaluateIsentropicVortex(i, m_fields[i]->UpdatePhys(), initialtime);
701 m_fields[i]->SetPhysState(true);
702 m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
703 m_fields[i]->UpdateCoeffs());
704 }
705 }
706 else
707 {
708 EquationSystem::v_SetInitialConditions(initialtime, false);
709 m_nchk--; // Note: m_nchk has been incremented in EquationSystem.
710
711 // insert white noise in initial condition
712 NekDouble Noise;
713 int phystot = m_fields[0]->GetTotPoints();
714 Array<OneD, NekDouble> noise(phystot);
715
716 m_session->LoadParameter("Noise", Noise, 0.0);
717 int m_nConvectiveFields = m_fields.size();
718
719 if (Noise > 0.0)
720 {
721 int seed = -m_comm->GetSpaceComm()->GetRank() * m_nConvectiveFields;
722 for (int i = 0; i < m_nConvectiveFields; i++)
723 {
724 Vmath::FillWhiteNoise(phystot, Noise, noise, 1, seed);
725 --seed;
726 Vmath::Vadd(phystot, m_fields[i]->GetPhys(), 1, noise, 1,
727 m_fields[i]->UpdatePhys(), 1);
728 m_fields[i]->FwdTransLocalElmt(m_fields[i]->GetPhys(),
729 m_fields[i]->UpdateCoeffs());
730 }
731 }
732 }
733
734 if (dumpInitialConditions && m_nchk == 0 && m_checksteps &&
735 !m_comm->IsParallelInTime())
736 {
738 }
739 else if (dumpInitialConditions && m_nchk == 0 && m_comm->IsParallelInTime())
740 {
741 std::string newdir = m_sessionName + ".pit";
742 if (!fs::is_directory(newdir))
743 {
744 fs::create_directory(newdir);
745 }
746 if (m_comm->GetTimeComm()->GetRank() == 0)
747 {
748 WriteFld(newdir + "/" + m_sessionName + "_0.fld");
749 }
750 }
751 m_nchk++;
752}
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 1083 of file CompressibleFlowSystem.cpp.

1085{
1086 const size_t nPoints = GetTotPoints();
1087 const size_t nFields = m_fields.size();
1088 Array<OneD, Array<OneD, NekDouble>> rhs(nFields);
1089 Array<OneD, Array<OneD, NekDouble>> inarray(nFields);
1090 for (size_t i = 0; i < nFields; ++i)
1091 {
1092 rhs[i] = Array<OneD, NekDouble>(nPoints, 0.0);
1093 inarray[i] = m_fields[i]->UpdatePhys();
1094 }
1095
1096 DoOdeRhs(inarray, rhs, m_time);
1097
1098 // Holds L2 errors.
1099 Array<OneD, NekDouble> tmp;
1100 Array<OneD, NekDouble> RHSL2(nFields);
1101 Array<OneD, NekDouble> residual(nFields);
1102
1103 for (size_t i = 0; i < nFields; ++i)
1104 {
1105 tmp = rhs[i];
1106
1107 Vmath::Vmul(nPoints, tmp, 1, tmp, 1, tmp, 1);
1108 residual[i] = Vmath::Vsum(nPoints, tmp, 1);
1109 }
1110
1111 m_comm->GetSpaceComm()->AllReduce(residual, LibUtilities::ReduceSum);
1112
1113 NekDouble onPoints = 1.0 / NekDouble(nPoints);
1114 for (size_t i = 0; i < nFields; ++i)
1115 {
1116 L2[i] = sqrt(residual[i] * onPoints);
1117 }
1118}
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 Symbol 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 78 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterCutoff

NekDouble Nektar::CompressibleFlowSystem::m_filterCutoff
protected

Definition at line 80 of file CompressibleFlowSystem.h.

Referenced by DoOdeProjection(), and InitialiseParameters().

◆ m_filterExponent

NekDouble Nektar::CompressibleFlowSystem::m_filterExponent
protected

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

◆ m_muavTrace

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

Definition at line 90 of file CompressibleFlowSystem.h.

◆ m_shockCaptureType

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

◆ m_useFiltering

bool Nektar::CompressibleFlowSystem::m_useFiltering
protected

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

Referenced by GetVecLocs(), and v_InitObject().