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

This class is the base class for Navier Stokes problems. More...

#include <IncNavierStokes.h>

Inheritance diagram for Nektar::IncNavierStokes:
[legend]

Public Member Functions

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

Protected Member Functions

 IncNavierStokes (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Constructor. More...
 
EquationType GetEquationType (void)
 
void EvaluateAdvectionTerms (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
void WriteModalEnergy (void)
 
void SetBoundaryConditions (NekDouble time)
 time dependent boundary conditions updating More...
 
void SetRadiationBoundaryForcing (int fieldid)
 Set Radiation forcing term. More...
 
void SetZeroNormalVelocity ()
 Set Normal Velocity Component to Zero. More...
 
void SetWomersleyBoundary (const int fldid, const int bndid)
 Set Womersley Profile if specified. More...
 
void SetUpWomersley (const int fldid, const int bndid, std::string womstr)
 Set Up Womersley details. More...
 
virtual MultiRegions::ExpListSharedPtr v_GetPressure ()
 
virtual void v_TransCoeffToPhys (void)
 Virtual function for transformation to physical space. More...
 
virtual void v_TransPhysToCoeff (void)
 Virtual function for transformation to coefficient space. More...
 
virtual int v_GetForceDimension ()=0
 
virtual Array< OneD, NekDoublev_GetMaxStdVelocity (const NekDouble SpeedSoundFactor)
 
virtual bool v_PreIntegrate (int step)
 
- Protected Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise ()
 Sets up initial conditions. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s)
 Print a summary of time stepping parameters. More...
 
virtual SOLVER_UTILS_EXPORT void v_AppendOutput1D (Array< OneD, Array< OneD, NekDouble >> &solution1D)
 Print the solution at each solution point in a txt file. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
virtual SOLVER_UTILS_EXPORT void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble >> vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
virtual SOLVER_UTILS_EXPORT bool UpdateTimeStepCheck ()
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_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 void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 

Protected Attributes

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

Additional Inherited Members

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

Detailed Description

This class is the base class for Navier Stokes problems.

Definition at line 135 of file IncNavierStokes.h.

Constructor & Destructor Documentation

◆ ~IncNavierStokes()

Nektar::IncNavierStokes::~IncNavierStokes ( void  )
virtual

Destructor

Definition at line 281 of file IncNavierStokes.cpp.

282  {
283  }

◆ IncNavierStokes()

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

Constructor.

Constructor. Creates ...

Parameters

Definition at line 69 of file IncNavierStokes.cpp.

71  :
72  UnsteadySystem(pSession, pGraph),
73  AdvectionSystem(pSession, pGraph),
74  m_SmoothAdvection(false)
75  {
76  }
bool m_SmoothAdvection
bool to identify if advection term smoothing is requested
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

◆ AddForcing()

void Nektar::IncNavierStokes::AddForcing ( const SolverUtils::ForcingSharedPtr pForce)

Add an additional forcing term programmatically.

Definition at line 786 of file IncNavierStokes.cpp.

788  {
789  m_forcing.push_back(pForce);
790  }
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Forcing terms.

References m_forcing.

Referenced by Nektar::VortexWaveInteraction::ExecuteRoll().

◆ EvaluateAdvectionTerms()

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

Evaluation -N(V) for all fields except pressure using m_velocity

Definition at line 288 of file IncNavierStokes.cpp.

292  {
293  int i;
294  int VelDim = m_velocity.size();
295  Array<OneD, Array<OneD, NekDouble> > velocity(VelDim);
296 
297  int npoints = m_fields[0]->GetNpoints();
298  for (i = 0; i < VelDim; ++i)
299  {
300  velocity[i] = Array<OneD, NekDouble>(npoints);
301  Vmath::Vcopy(npoints, inarray[m_velocity[i]], 1, velocity[i], 1);
302  }
303  for (auto &x : m_forcing)
304  {
305  x->PreApply(m_fields, velocity, velocity, time);
306  }
307 
309  velocity, inarray, outarray, time);
310  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
int m_nConvectiveFields
Number of fields to be convected;.
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199

References Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::SolverUtils::EquationSystem::m_fields, m_forcing, m_nConvectiveFields, m_velocity, and Vmath::Vcopy().

Referenced by Nektar::CoupledLinearNS::EvaluateAdvection(), Nektar::CoupledLinearNS::EvaluateNewtonRHS(), Nektar::VCSMapping::v_EvaluateAdvection_SetPressureBCs(), and Nektar::VelocityCorrectionScheme::v_EvaluateAdvection_SetPressureBCs().

◆ GetDensity()

void Nektar::IncNavierStokes::GetDensity ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  density 
)
virtual

Extract array with density from physfield.

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 842 of file IncNavierStokes.cpp.

845  {
846  int nPts = physfield[0].size();
847  Vmath::Fill(nPts, 1.0, density, 1);
848  }
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45

References Vmath::Fill().

◆ GetEquationType()

EquationType Nektar::IncNavierStokes::GetEquationType ( void  )
inlineprotected

Definition at line 220 of file IncNavierStokes.h.

221  {
222  return m_equationType;
223  }
EquationType m_equationType
equation type;

References m_equationType.

◆ GetNConvectiveFields()

int Nektar::IncNavierStokes::GetNConvectiveFields ( void  )
inline

Definition at line 144 of file IncNavierStokes.h.

145  {
146  return m_nConvectiveFields;
147  }

References m_nConvectiveFields.

◆ GetPressure()

void Nektar::IncNavierStokes::GetPressure ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, NekDouble > &  pressure 
)
virtual

Extract array with pressure from physfield.

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 832 of file IncNavierStokes.cpp.

835  {
836  pressure = physfield[m_nConvectiveFields];
837  }

References m_nConvectiveFields, and CG_Iterations::pressure.

◆ GetVelocity() [1/2]

void Nektar::IncNavierStokes::GetVelocity ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  velocity 
)
virtual

Extract array with velocity from physfield.

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 853 of file IncNavierStokes.cpp.

856  {
857  for(int i = 0; i < m_spacedim; ++i)
858  {
859  velocity[i] = physfield[i];
860  }
861  }
int m_spacedim
Spatial dimension (>= expansion dim).

References Nektar::SolverUtils::EquationSystem::m_spacedim.

◆ GetVelocity() [2/2]

Array<OneD, int>& Nektar::IncNavierStokes::GetVelocity ( void  )
inline

Definition at line 149 of file IncNavierStokes.h.

150  {
151  return m_velocity;
152  }

References m_velocity.

◆ HasConstantDensity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 164 of file IncNavierStokes.h.

165  {
166  return true;
167  }

◆ SetBoundaryConditions()

void Nektar::IncNavierStokes::SetBoundaryConditions ( NekDouble  time)
protected

time dependent boundary conditions updating

Time dependent boundary conditions updating

Definition at line 315 of file IncNavierStokes.cpp.

316  {
317  int i, n;
318  std::string varName;
319  int nvariables = m_fields.size();
320 
321  for (i = 0; i < nvariables; ++i)
322  {
323  for(n = 0; n < m_fields[i]->GetBndConditions().size(); ++n)
324  {
325  if(m_fields[i]->GetBndConditions()[n]->IsTimeDependent())
326  {
327  varName = m_session->GetVariable(i);
328  m_fields[i]->EvaluateBoundaryConditions(time, varName);
329  }
330  else if(boost::istarts_with(
331  m_fields[i]->GetBndConditions()[n]->GetUserDefined(),
332  "Womersley"))
333  {
335  }
336  }
337 
338  // Set Radiation conditions if required
340  }
341 
343  }
void SetWomersleyBoundary(const int fldid, const int bndid)
Set Womersley Profile if specified.
void SetZeroNormalVelocity()
Set Normal Velocity Component to Zero.
void SetRadiationBoundaryForcing(int fieldid)
Set Radiation forcing term.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.

References Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_session, SetRadiationBoundaryForcing(), SetWomersleyBoundary(), and SetZeroNormalVelocity().

Referenced by Nektar::VelocityCorrectionScheme::v_DoInitialise(), and v_PreIntegrate().

◆ SetRadiationBoundaryForcing()

void Nektar::IncNavierStokes::SetRadiationBoundaryForcing ( int  fieldid)
protected

Set Radiation forcing term.

Probably should be pushed back into ContField?

Definition at line 348 of file IncNavierStokes.cpp.

349  {
350  int i,n;
351 
352  Array<OneD, const SpatialDomains::BoundaryConditionShPtr > BndConds;
353  Array<OneD, MultiRegions::ExpListSharedPtr> BndExp;
354 
355  BndConds = m_fields[fieldid]->GetBndConditions();
356  BndExp = m_fields[fieldid]->GetBndCondExpansions();
357 
360 
361  int cnt;
362  int elmtid,nq,offset, boundary;
363  Array<OneD, NekDouble> Bvals, U;
364  int cnt1 = 0;
365 
366  for(cnt = n = 0; n < BndConds.size(); ++n)
367  {
368  std::string type = BndConds[n]->GetUserDefined();
369 
370  if((BndConds[n]->GetBoundaryConditionType() ==
372  (boost::iequals(type,"Radiation")))
373  {
374  for(i = 0; i < BndExp[n]->GetExpSize(); ++i,cnt++)
375  {
376  elmtid = m_fieldsBCToElmtID[m_velocity[fieldid]][cnt];
377  elmt = m_fields[fieldid]->GetExp(elmtid);
378  offset = m_fields[fieldid]->GetPhys_Offset(elmtid);
379 
380  U = m_fields[fieldid]->UpdatePhys() + offset;
381  Bc = BndExp[n]->GetExp(i);
382 
383  boundary = m_fieldsBCToTraceID[fieldid][cnt];
384 
385  // Get edge values and put into ubc
386  nq = Bc->GetTotPoints();
387  Array<OneD, NekDouble> ubc(nq);
388  elmt->GetTracePhysVals(boundary,Bc,U,ubc);
389 
390  Vmath::Vmul(nq,&m_fieldsRadiationFactor[fieldid][cnt1 +
391  BndExp[n]->GetPhys_Offset(i)],1,
392  &ubc[0],1,&ubc[0],1);
393 
394  Bvals = BndExp[n]->UpdateCoeffs()+BndExp[n]->
395  GetCoeff_Offset(i);
396 
397  Bc->IProductWRTBase(ubc,Bvals);
398  }
399  cnt1 += BndExp[n]->GetTotPoints();
400  }
401  else
402  {
403  cnt += BndExp[n]->GetExpSize();
404  }
405  }
406  }
Array< OneD, Array< OneD, int > > m_fieldsBCToTraceID
Mapping from BCs to Elmt Edge IDs.
Array< OneD, Array< OneD, NekDouble > > m_fieldsRadiationFactor
RHS Factor for Radiation Condition.
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
SOLVER_UTILS_EXPORT int GetCoeff_Offset(int n)
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:192

References Nektar::SpatialDomains::eRobin, Nektar::SolverUtils::EquationSystem::GetCoeff_Offset(), Nektar::SolverUtils::EquationSystem::GetPhys_Offset(), Nektar::SolverUtils::EquationSystem::m_fields, m_fieldsBCToElmtID, m_fieldsBCToTraceID, m_fieldsRadiationFactor, m_velocity, and Vmath::Vmul().

Referenced by SetBoundaryConditions().

◆ SetUpWomersley()

void Nektar::IncNavierStokes::SetUpWomersley ( const int  fldid,
const int  bndid,
std::string  womstr 
)
protected

Set Up Womersley details.

Error value returned by TinyXML.

Definition at line 570 of file IncNavierStokes.cpp.

571  {
572  std::string::size_type indxBeg = womStr.find_first_of(':') + 1;
573  string filename = womStr.substr(indxBeg,string::npos);
574 
575  TiXmlDocument doc(filename);
576 
577  bool loadOkay = doc.LoadFile();
578  ASSERTL0(loadOkay,(std::string("Failed to load file: ") +
579  filename).c_str());
580 
581  TiXmlHandle docHandle(&doc);
582 
583  int err; /// Error value returned by TinyXML.
584 
585  TiXmlElement *nektar = doc.FirstChildElement("NEKTAR");
586  ASSERTL0(nektar, "Unable to find NEKTAR tag in file.");
587 
588  TiXmlElement *wombc = nektar->FirstChildElement("WOMERSLEYBC");
589  ASSERTL0(wombc, "Unable to find WOMERSLEYBC tag in file.");
590 
591  // read womersley parameters
592  TiXmlElement *womparam = wombc->FirstChildElement("WOMPARAMS");
593  ASSERTL0(womparam, "Unable to find WOMPARAMS tag in file.");
594 
595  // Input coefficients
596  TiXmlElement *params = womparam->FirstChildElement("W");
597  map<std::string,std::string> Wparams;
598 
599  // read parameter list
600  while (params)
601  {
602 
603  std::string propstr;
604  propstr = params->Attribute("PROPERTY");
605 
606  ASSERTL0(!propstr.empty(),
607  "Failed to read PROPERTY value Womersley BC Parameter");
608 
609 
610  std::string valstr;
611  valstr = params->Attribute("VALUE");
612 
613  ASSERTL0(!valstr.empty(),
614  "Failed to read VALUE value Womersley BC Parameter");
615 
616  std::transform(propstr.begin(),propstr.end(),propstr.begin(),
617  ::toupper);
618  Wparams[propstr] = valstr;
619 
620  params = params->NextSiblingElement("W");
621  }
622  bool parseGood;
623 
624  // Read parameters
625 
626  ASSERTL0(Wparams.count("RADIUS") == 1,
627  "Failed to find Radius parameter in Womersley boundary conditions");
628  std::vector<NekDouble> rad;
629  ParseUtils::GenerateVector(Wparams["RADIUS"],rad);
630  m_womersleyParams[fldid][bndid]->m_radius = rad[0];
631 
632  ASSERTL0(Wparams.count("PERIOD") == 1,
633  "Failed to find period parameter in Womersley boundary conditions");
634  std::vector<NekDouble> period;
635  parseGood = ParseUtils::GenerateVector(Wparams["PERIOD"],period);
636  m_womersleyParams[fldid][bndid]->m_period = period[0];
637 
638 
639  ASSERTL0(Wparams.count("AXISNORMAL") == 1,
640  "Failed to find axisnormal parameter in Womersley boundary conditions");
641  std::vector<NekDouble> anorm;
642  parseGood = ParseUtils::GenerateVector(Wparams["AXISNORMAL"],anorm);
643  m_womersleyParams[fldid][bndid]->m_axisnormal[0] = anorm[0];
644  m_womersleyParams[fldid][bndid]->m_axisnormal[1] = anorm[1];
645  m_womersleyParams[fldid][bndid]->m_axisnormal[2] = anorm[2];
646 
647 
648  ASSERTL0(Wparams.count("AXISPOINT") == 1,
649  "Failed to find axispoint parameter in Womersley boundary conditions");
650  std::vector<NekDouble> apt;
651  parseGood = ParseUtils::GenerateVector(Wparams["AXISPOINT"],apt);
652  m_womersleyParams[fldid][bndid]->m_axispoint[0] = apt[0];
653  m_womersleyParams[fldid][bndid]->m_axispoint[1] = apt[1];
654  m_womersleyParams[fldid][bndid]->m_axispoint[2] = apt[2];
655 
656  // Read Temporal Fourier Coefficients.
657 
658  // Find the FourierCoeff tag
659  TiXmlElement *coeff = wombc->FirstChildElement("FOURIERCOEFFS");
660 
661  // Input coefficients
662  TiXmlElement *fval = coeff->FirstChildElement("F");
663 
664  int indx;
665  int nextFourierCoeff = -1;
666 
667  while (fval)
668  {
669  nextFourierCoeff++;
670 
671  TiXmlAttribute *fvalAttr = fval->FirstAttribute();
672  std::string attrName(fvalAttr->Name());
673 
674  ASSERTL0(attrName == "ID",
675  (std::string("Unknown attribute name: ") + attrName).c_str());
676 
677  err = fvalAttr->QueryIntValue(&indx);
678  ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute ID.");
679 
680  std::string coeffStr = fval->FirstChild()->ToText()->ValueStr();
681  vector<NekDouble> coeffvals;
682 
683  parseGood = ParseUtils::GenerateVector(coeffStr, coeffvals);
684  ASSERTL0(parseGood,
685  (std::string("Problem reading value of fourier coefficient, ID=") +
686  boost::lexical_cast<string>(indx)).c_str());
687  ASSERTL1(coeffvals.size() == 2,
688  (std::string("Have not read two entries of Fourier coefficicent from ID="+
689  boost::lexical_cast<string>(indx)).c_str()));
690 
691  m_womersleyParams[fldid][bndid]->m_wom_vel.push_back(NekComplexDouble (coeffvals[0], coeffvals[1]));
692 
693  fval = fval->NextSiblingElement("F");
694  }
695 
696  // starting point of precalculation
697  int i,j,k;
698  // M fourier coefficients
699  int M_coeffs = m_womersleyParams[fldid][bndid]->m_wom_vel.size();
700  NekDouble R = m_womersleyParams[fldid][bndid]->m_radius;
701  NekDouble T = m_womersleyParams[fldid][bndid]->m_period;
702  Array<OneD, NekDouble > x0 = m_womersleyParams[fldid][bndid]->m_axispoint;
703 
704  NekComplexDouble rqR;
705  // Womersley Number
706  NekComplexDouble omega_c (2.0*M_PI/T, 0.0);
707  NekComplexDouble alpha_c (R*sqrt(omega_c.real()/m_kinvis), 0.0);
708  NekComplexDouble z1 (1.0,0.0);
709  NekComplexDouble i_pow_3q2 (-1.0/sqrt(2.0),1.0/sqrt(2.0));
710 
712  BndCondExp = m_fields[fldid]->GetBndCondExpansions()[bndid];
713 
715  int cnt = 0;
716  int nfq;
717  Array<OneD, NekDouble> Bvals;
718 
719  int exp_npts = BndCondExp->GetExpSize();
720  Array<OneD, NekDouble> wbc(exp_npts,0.0);
721 
722  // allocate time indepedent variables
723  m_womersleyParams[fldid][bndid]->m_poiseuille = Array<OneD, Array<OneD, NekDouble> > (exp_npts);
724  m_womersleyParams[fldid][bndid]->m_zvel = Array<OneD, Array<OneD, Array<OneD, NekComplexDouble> > > (exp_npts);
725  // could use M_coeffs - 1 but need to avoid complicating things
726  Array<OneD, NekComplexDouble> zJ0(M_coeffs);
727  Array<OneD, NekComplexDouble> lamda_n(M_coeffs);
728  Array<OneD, NekComplexDouble> k_c(M_coeffs);
729  NekComplexDouble zJ0r;
730 
731  for (k=1; k < M_coeffs; k++)
732  {
733  k_c[k] = NekComplexDouble((NekDouble) k, 0.0);
734  lamda_n[k] = i_pow_3q2 * alpha_c * sqrt(k_c[k]);
735  zJ0[k] = Polylib::ImagBesselComp(0,lamda_n[k]);
736  }
737 
738  // Loop over each element in an expansion
739  for(i = 0; i < exp_npts; ++i,cnt++)
740  {
741  // Get Boundary and trace expansion
742  bc = BndCondExp->GetExp(i);
743  nfq = bc->GetTotPoints();
744 
745  Array<OneD, NekDouble> x(nfq,0.0);
746  Array<OneD, NekDouble> y(nfq,0.0);
747  Array<OneD, NekDouble> z(nfq,0.0);
748  bc->GetCoords(x,y,z);
749 
750  m_womersleyParams[fldid][bndid]->m_poiseuille[i] =
751  Array<OneD, NekDouble> (nfq);
752  m_womersleyParams[fldid][bndid]->m_zvel[i] =
753  Array<OneD, Array<OneD, NekComplexDouble> > (nfq);
754 
755  // Compute coefficients
756  for (j=0; j < nfq; j++)
757  {
758  rqR = NekComplexDouble (sqrt((x[j]-x0[0])*(x[j]-x0[0]) +
759  (y[j]-x0[1])*(y[j]-x0[1]) +
760  (z[j]-x0[2])*(z[j]-x0[2]))/R, 0.0);
761 
762  // Compute Poiseulle Flow
763  m_womersleyParams[fldid][bndid]->m_poiseuille[i][j] =
764  m_womersleyParams[fldid][bndid]->m_wom_vel[0].real() *
765  (1. - rqR.real()*rqR.real());
766 
767 
768  m_womersleyParams[fldid][bndid]->m_zvel[i][j] =
769  Array<OneD, NekComplexDouble> (M_coeffs);
770 
771  // compute the velocity information
772  for (k=1; k < M_coeffs; k++)
773  {
774  zJ0r = Polylib::ImagBesselComp(0,rqR * lamda_n[k]);
775  m_womersleyParams[fldid][bndid]->m_zvel[i][j][k] =
776  m_womersleyParams[fldid][bndid]->m_wom_vel[k] *
777  (z1 - (zJ0r / zJ0[k]));
778  }
779  }
780  }
781  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:250
NekDouble m_kinvis
Kinematic viscosity.
std::map< int, std::map< int, WomersleyParamsSharedPtr > > m_womersleyParams
Womersley parameters if required.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
Definition: ParseUtils.cpp:135
static NekDouble rad(NekDouble x, NekDouble y)
Definition: Interpreter.cpp:86
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::complex< double > NekComplexDouble
double NekDouble
std::complex< Nektar::NekDouble > ImagBesselComp(int n, std::complex< Nektar::NekDouble > y)
Calcualte the bessel function of the first kind with complex double input y. Taken from Numerical Rec...
Definition: Polylib.cpp:1651
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:267

References ASSERTL0, ASSERTL1, Nektar::ParseUtils::GenerateVector(), Polylib::ImagBesselComp(), Nektar::SolverUtils::EquationSystem::m_fields, m_kinvis, m_womersleyParams, Nektar::LibUtilities::rad(), and tinysimd::sqrt().

Referenced by v_InitObject().

◆ SetWomersleyBoundary()

void Nektar::IncNavierStokes::SetWomersleyBoundary ( const int  fldid,
const int  bndid 
)
protected

Set Womersley Profile if specified.

Womersley boundary condition defintion

Definition at line 499 of file IncNavierStokes.cpp.

500  {
501  ASSERTL1(m_womersleyParams.count(bndid) == 1,
502  "Womersley parameters for this boundary have not been set up");
503 
504  WomersleyParamsSharedPtr WomParam = m_womersleyParams[fldid][bndid];
505  NekComplexDouble zvel;
506  int i,j,k;
507 
508  int M_coeffs = WomParam->m_wom_vel.size();
509 
510  NekDouble T = WomParam->m_period;
511  NekDouble axis_normal = WomParam->m_axisnormal[fldid];
512 
513  // Womersley Number
514  NekComplexDouble omega_c (2.0*M_PI/T, 0.0);
515  NekComplexDouble k_c (0.0, 0.0);
516  NekComplexDouble m_time_c (m_time, 0.0);
517  NekComplexDouble zi (0.0,1.0);
518  NekComplexDouble i_pow_3q2 (-1.0/sqrt(2.0),1.0/sqrt(2.0));
519 
521  BndCondExp = m_fields[fldid]->GetBndCondExpansions()[bndid];
522 
524  int cnt=0;
525  int nfq;
526  Array<OneD, NekDouble> Bvals;
527  int exp_npts = BndCondExp->GetExpSize();
528  Array<OneD, NekDouble> wbc(exp_npts,0.0);
529 
530  Array<OneD, NekComplexDouble> zt(M_coeffs);
531 
532  // preallocate the exponent
533  for (k=1; k < M_coeffs; k++)
534  {
535  k_c = NekComplexDouble((NekDouble) k, 0.0);
536  zt[k] = std::exp(zi * omega_c * k_c * m_time_c);
537  }
538 
539  // Loop over each element in an expansion
540  for(i = 0; i < exp_npts; ++i,cnt++)
541  {
542  // Get Boundary and trace expansion
543  bc = BndCondExp->GetExp(i);
544  nfq = bc->GetTotPoints();
545  Array<OneD, NekDouble> wbc(nfq,0.0);
546 
547  // Compute womersley solution
548  for (j=0; j < nfq; j++)
549  {
550  wbc[j] = WomParam->m_poiseuille[i][j];
551  for (k=1; k < M_coeffs; k++)
552  {
553  zvel = WomParam->m_zvel[i][j][k] * zt[k];
554  wbc[j] = wbc[j] + zvel.real();
555  }
556  }
557 
558  // Multiply w by normal to get u,v,w component of velocity
559  Vmath::Smul(nfq,axis_normal,wbc,1,wbc,1);
560  // get the offset
561  Bvals = BndCondExp->UpdateCoeffs()+
562  BndCondExp->GetCoeff_Offset(i);
563 
564  // Push back to Coeff space
565  bc->FwdTrans(wbc,Bvals);
566  }
567  }
NekDouble m_time
Current time of simulation.
std::shared_ptr< WomersleyParams > WomersleyParamsSharedPtr
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.cpp:225

References ASSERTL1, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_time, m_womersleyParams, Vmath::Smul(), and tinysimd::sqrt().

Referenced by SetBoundaryConditions().

◆ SetZeroNormalVelocity()

void Nektar::IncNavierStokes::SetZeroNormalVelocity ( )
protected

Set Normal Velocity Component to Zero.

Definition at line 409 of file IncNavierStokes.cpp.

410  {
411  // use static trip since cannot use UserDefinedTag for zero
412  // velocity and have time dependent conditions
413  static bool Setup = false;
414 
415  if(Setup == true)
416  {
417  return;
418  }
419  Setup = true;
420 
421  int i,n;
422 
423  Array<OneD, Array<OneD, const SpatialDomains::BoundaryConditionShPtr > >
424  BndConds(m_spacedim);
425  Array<OneD, Array<OneD, MultiRegions::ExpListSharedPtr> >
426  BndExp(m_spacedim);
427 
428 
429  for(i = 0; i < m_spacedim; ++i)
430  {
431  BndConds[i] = m_fields[m_velocity[i]]->GetBndConditions();
432  BndExp[i] = m_fields[m_velocity[i]]->GetBndCondExpansions();
433  }
434 
436 
437  int cnt;
438  int elmtid,nq, boundary;
439 
440  Array<OneD, Array<OneD, NekDouble> > normals;
441  Array<OneD, NekDouble> Bphys,Bcoeffs;
442 
443  int fldid = m_velocity[0];
444 
445  for(cnt = n = 0; n < BndConds[0].size(); ++n)
446  {
447  if((BndConds[0][n]->GetBoundaryConditionType() ==
449  (boost::iequals(BndConds[0][n]->GetUserDefined(),
450  "ZeroNormalComponent")))
451  {
452  for(i = 0; i < BndExp[0][n]->GetExpSize(); ++i,cnt++)
453  {
454  elmtid = m_fieldsBCToElmtID[fldid][cnt];
455  elmt = m_fields[0]->GetExp(elmtid);
456  boundary = m_fieldsBCToTraceID[fldid][cnt];
457 
458  normals = elmt->GetTraceNormal(boundary);
459 
460  nq = BndExp[0][n]->GetExp(i)->GetTotPoints();
461  Array<OneD, NekDouble> normvel(nq,0.0);
462 
463  for(int k = 0; k < m_spacedim; ++k)
464  {
465  Bphys = BndExp[k][n]->UpdatePhys()+
466  BndExp[k][n]->GetPhys_Offset(i);
467  Bc = BndExp[k][n]->GetExp(i);
468  Vmath::Vvtvp(nq,normals[k],1,Bphys,1,normvel,1,
469  normvel,1);
470  }
471 
472  // negate normvel for next step
473  Vmath::Neg(nq,normvel,1);
474 
475  for(int k = 0; k < m_spacedim; ++k)
476  {
477  Bphys = BndExp[k][n]->UpdatePhys()+
478  BndExp[k][n]->GetPhys_Offset(i);
479  Bcoeffs = BndExp[k][n]->UpdateCoeffs()+
480  BndExp[k][n]->GetCoeff_Offset(i);
481  Bc = BndExp[k][n]->GetExp(i);
482  Vmath::Vvtvp(nq,normvel,1,normals[k],1,Bphys,1,
483  Bphys,1);
484  Bc->FwdTrans_BndConstrained(Bphys,Bcoeffs);
485  }
486  }
487  }
488  else
489  {
490  cnt += BndExp[0][n]->GetExpSize();
491  }
492  }
493  }
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:461
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:513

References Nektar::SpatialDomains::eDirichlet, Nektar::SolverUtils::EquationSystem::m_fields, m_fieldsBCToElmtID, m_fieldsBCToTraceID, Nektar::SolverUtils::EquationSystem::m_spacedim, m_velocity, Vmath::Neg(), and Vmath::Vvtvp().

Referenced by SetBoundaryConditions().

◆ v_GetForceDimension()

virtual int Nektar::IncNavierStokes::v_GetForceDimension ( )
protectedpure virtual

◆ v_GetMaxStdVelocity()

Array< OneD, NekDouble > Nektar::IncNavierStokes::v_GetMaxStdVelocity ( const NekDouble  SpeedSoundFactor)
protectedvirtual

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Definition at line 795 of file IncNavierStokes.cpp.

797  {
798  boost::ignore_unused(SpeedSoundFactor);
799  int nvel = m_velocity.size();
800  int nelmt = m_fields[0]->GetExpSize();
801 
802  Array<OneD, NekDouble> stdVelocity(nelmt, 0.0);
803  Array<OneD, Array<OneD, NekDouble> > velfields;
804 
805  if(m_HomogeneousType == eHomogeneous1D) // just do check on 2D info
806  {
807  velfields = Array<OneD, Array<OneD, NekDouble> >(2);
808 
809  for(int i = 0; i < 2; ++i)
810  {
811  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
812  }
813  }
814  else
815  {
816  velfields = Array<OneD, Array<OneD, NekDouble> >(nvel);
817 
818  for(int i = 0; i < nvel; ++i)
819  {
820  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
821  }
822  }
823 
824  stdVelocity = m_extrapolation->GetMaxStdVelocity(velfields);
825 
826  return stdVelocity;
827  }
ExtrapolateSharedPtr m_extrapolation
enum HomogeneousType m_HomogeneousType

References Nektar::SolverUtils::EquationSystem::eHomogeneous1D, m_extrapolation, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_HomogeneousType, and m_velocity.

◆ v_GetPressure()

virtual MultiRegions::ExpListSharedPtr Nektar::IncNavierStokes::v_GetPressure ( void  )
inlineprotectedvirtual

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 249 of file IncNavierStokes.h.

250  {
251  return m_pressure;
252  }
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.

References m_pressure.

◆ v_InitObject()

void Nektar::IncNavierStokes::v_InitObject ( )
virtual

Init object for UnsteadySystem class.

Initialization object for UnsteadySystem class.

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Reimplemented in Nektar::VelocityCorrectionScheme, Nektar::VCSMapping, Nektar::SmoothedProfileMethod, and Nektar::CoupledLinearNS.

Definition at line 78 of file IncNavierStokes.cpp.

79  {
81 
82  int i,j;
83  int numfields = m_fields.size();
84  std::string velids[] = {"u","v","w"};
85 
86  // Set up Velocity field to point to the first m_expdim of m_fields;
87  m_velocity = Array<OneD,int>(m_spacedim);
88 
89  for(i = 0; i < m_spacedim; ++i)
90  {
91  for(j = 0; j < numfields; ++j)
92  {
93  std::string var = m_boundaryConditions->GetVariable(j);
94  if(boost::iequals(velids[i], var))
95  {
96  m_velocity[i] = j;
97  break;
98  }
99 
100  ASSERTL0(j != numfields, "Failed to find field: " + var);
101  }
102  }
103 
104  // Set up equation type enum using kEquationTypeStr
105  for(i = 0; i < (int) eEquationTypeSize; ++i)
106  {
107  bool match;
108  m_session->MatchSolverInfo("EQTYPE",
109  kEquationTypeStr[i],match,false);
110  if(match)
111  {
113  break;
114  }
115  }
117  "EQTYPE not found in SOLVERINFO section");
118 
119  // This probably should to into specific implementations
120  // Equation specific Setups
121  switch(m_equationType)
122  {
123  case eSteadyStokes:
124  case eSteadyOseen:
125  case eSteadyNavierStokes:
126  case eSteadyLinearisedNS:
128  case eUnsteadyStokes:
129  break;
130  case eNoEquationType:
131  default:
132  ASSERTL0(false,"Unknown or undefined equation type");
133  }
134 
135  m_session->LoadParameter("Kinvis", m_kinvis);
136 
137  // Default advection type per solver
138  std::string vConvectiveType;
139  switch(m_equationType)
140  {
141  case eUnsteadyStokes:
142  case eSteadyLinearisedNS:
143  vConvectiveType = "NoAdvection";
144  break;
146  case eSteadyNavierStokes:
147  vConvectiveType = "Convective";
148  break;
150  vConvectiveType = "Linearised";
151  break;
152  default:
153  break;
154  }
155 
156  // Check if advection type overridden
157  if (m_session->DefinesTag("AdvectiveType") &&
160  {
161  vConvectiveType = m_session->GetTag("AdvectiveType");
162  }
163 
164  // Initialise advection
166  vConvectiveType, vConvectiveType);
167  m_advObject->InitObject( m_session, m_fields);
168 
169  // Forcing terms
170  m_forcing = SolverUtils::Forcing::Load(m_session, shared_from_this(),
172 
173  // check to see if any Robin boundary conditions and if so set
174  // up m_field to boundary condition maps;
175  m_fieldsBCToElmtID = Array<OneD, Array<OneD, int> >(numfields);
176  m_fieldsBCToTraceID = Array<OneD, Array<OneD, int> >(numfields);
178  Array<OneD, Array<OneD, NekDouble> > (numfields);
179 
180  for (i = 0; i < m_fields.size(); ++i)
181  {
182  bool Set = false;
183 
184  Array<OneD, const SpatialDomains::BoundaryConditionShPtr > BndConds;
185  Array<OneD, MultiRegions::ExpListSharedPtr> BndExp;
186  int radpts = 0;
187 
188  BndConds = m_fields[i]->GetBndConditions();
189  BndExp = m_fields[i]->GetBndCondExpansions();
190  for(int n = 0; n < BndConds.size(); ++n)
191  {
192  if(boost::iequals(BndConds[n]->GetUserDefined(),"Radiation"))
193  {
194  ASSERTL0(BndConds[n]->GetBoundaryConditionType() ==
196  "Radiation boundary condition must be of type Robin <R>");
197 
198  if(Set == false)
199  {
200  m_fields[i]->GetBoundaryToElmtMap(
202  Set = true;
203  }
204  radpts += BndExp[n]->GetTotPoints();
205  }
206  if(boost::iequals(BndConds[n]->GetUserDefined(),
207  "ZeroNormalComponent"))
208  {
209  ASSERTL0(BndConds[n]->GetBoundaryConditionType() ==
211  "Zero Normal Component boundary condition option must be of type Dirichlet <D>");
212 
213  if(Set == false)
214  {
215  m_fields[i]->GetBoundaryToElmtMap(
217  Set = true;
218  }
219  }
220  }
221 
222  m_fieldsRadiationFactor[i] = Array<OneD, NekDouble>(radpts);
223 
224  radpts = 0; // reset to use as a counter
225 
226  for(int n = 0; n < BndConds.size(); ++n)
227  {
228  if(boost::iequals(BndConds[n]->GetUserDefined(),"Radiation"))
229  {
230 
231  int npoints = BndExp[n]->GetNpoints();
232  Array<OneD, NekDouble> x0(npoints,0.0);
233  Array<OneD, NekDouble> x1(npoints,0.0);
234  Array<OneD, NekDouble> x2(npoints,0.0);
235  Array<OneD, NekDouble> tmpArray;
236 
237  BndExp[n]->GetCoords(x0,x1,x2);
238 
239  LibUtilities::Equation coeff =
240  std::static_pointer_cast<
241  SpatialDomains::RobinBoundaryCondition
242  >(BndConds[n])->m_robinPrimitiveCoeff;
243 
244  coeff.Evaluate(x0,x1,x2,m_time,
245  tmpArray = m_fieldsRadiationFactor[i]+ radpts);
246  //Vmath::Neg(npoints,tmpArray = m_fieldsRadiationFactor[i]+ radpts,1);
247  radpts += npoints;
248  }
249  }
250  }
251 
252  // Set up maping for womersley BC - and load variables
253  for (int i = 0; i < m_fields.size(); ++i)
254  {
255  for(int n = 0; n < m_fields[i]->GetBndConditions().size(); ++n)
256  {
257  if(boost::istarts_with(m_fields[i]->GetBndConditions()[n]->GetUserDefined(),"Womersley"))
258  {
259  // assumes that boundary condition is applied in normal direction
260  // and is decomposed for each direction. There could be a
261  // unique file for each direction
263  // Read in fourier coeffs and precompute coefficients
264  SetUpWomersley(i, n,
265  m_fields[i]->GetBndConditions()[n]->GetUserDefined());
266 
267  m_fields[i]->GetBoundaryToElmtMap(m_fieldsBCToElmtID[i],m_fieldsBCToTraceID[i]);
268 
269  }
270  }
271  }
272 
273  // Set up Field Meta Data for output files
274  m_fieldMetaDataMap["Kinvis"] = boost::lexical_cast<std::string>(m_kinvis);
275  m_fieldMetaDataMap["TimeStep"] = boost::lexical_cast<std::string>(m_timestep);
276  }
virtual int v_GetForceDimension()=0
void SetUpWomersley(const int fldid, const int bndid, std::string womstr)
Set Up Womersley details.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual SOLVER_UTILS_EXPORT void v_InitObject()
Init object for UnsteadySystem class.
NekDouble m_timestep
Time step size.
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
Pointer to boundary conditions object.
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
Definition: Forcing.cpp:128
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:47
@ eSteadyNavierStokes
@ eUnsteadyStokes
@ eUnsteadyNavierStokes
@ eSteadyLinearisedNS
@ eUnsteadyLinearisedNS
@ eEquationTypeSize
@ eNoEquationType
const std::string kEquationTypeStr[]

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::SpatialDomains::eDirichlet, Nektar::eEquationTypeSize, Nektar::eNoEquationType, Nektar::SpatialDomains::eRobin, Nektar::eSteadyLinearisedNS, Nektar::eSteadyNavierStokes, Nektar::eSteadyOseen, Nektar::eSteadyStokes, Nektar::eUnsteadyLinearisedNS, Nektar::eUnsteadyNavierStokes, Nektar::eUnsteadyStokes, Nektar::LibUtilities::Equation::Evaluate(), Nektar::SolverUtils::GetAdvectionFactory(), Nektar::kEquationTypeStr, Nektar::SolverUtils::Forcing::Load(), Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::SolverUtils::EquationSystem::m_boundaryConditions, m_equationType, Nektar::SolverUtils::EquationSystem::m_fieldMetaDataMap, Nektar::SolverUtils::EquationSystem::m_fields, m_fieldsBCToElmtID, m_fieldsBCToTraceID, m_fieldsRadiationFactor, m_forcing, m_kinvis, Nektar::SolverUtils::EquationSystem::m_session, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::SolverUtils::EquationSystem::m_time, Nektar::SolverUtils::EquationSystem::m_timestep, m_velocity, m_womersleyParams, SetUpWomersley(), v_GetForceDimension(), and Nektar::SolverUtils::AdvectionSystem::v_InitObject().

Referenced by Nektar::CoupledLinearNS::v_InitObject(), and Nektar::VelocityCorrectionScheme::v_InitObject().

◆ v_PreIntegrate()

bool Nektar::IncNavierStokes::v_PreIntegrate ( int  step)
protectedvirtual

Perform the extrapolation.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 866 of file IncNavierStokes.cpp.

867  {
868  m_extrapolation->SubStepSaveFields(step);
869  m_extrapolation->SubStepAdvance(step,m_time);
871  return false;
872  }
void SetBoundaryConditions(NekDouble time)
time dependent boundary conditions updating

References m_extrapolation, Nektar::SolverUtils::EquationSystem::m_time, Nektar::SolverUtils::EquationSystem::m_timestep, and SetBoundaryConditions().

◆ v_TransCoeffToPhys()

virtual void Nektar::IncNavierStokes::v_TransCoeffToPhys ( void  )
inlineprotectedvirtual

Virtual function for transformation to physical space.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Reimplemented in Nektar::VelocityCorrectionScheme, and Nektar::CoupledLinearNS.

Definition at line 254 of file IncNavierStokes.h.

255  {
256  ASSERTL0(false,"This method is not defined in this class");
257  }

References ASSERTL0.

◆ v_TransPhysToCoeff()

virtual void Nektar::IncNavierStokes::v_TransPhysToCoeff ( void  )
inlineprotectedvirtual

Virtual function for transformation to coefficient space.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Reimplemented in Nektar::VelocityCorrectionScheme, and Nektar::CoupledLinearNS.

Definition at line 259 of file IncNavierStokes.h.

260  {
261  ASSERTL0(false,"This method is not defined in this class");
262  }

References ASSERTL0.

◆ WriteModalEnergy()

void Nektar::IncNavierStokes::WriteModalEnergy ( void  )
protected

Member Data Documentation

◆ m_energysteps

int Nektar::IncNavierStokes::m_energysteps
protected

dump energy to file at steps time

Definition at line 200 of file IncNavierStokes.h.

◆ m_equationType

EquationType Nektar::IncNavierStokes::m_equationType
protected

◆ m_extrapolation

ExtrapolateSharedPtr Nektar::IncNavierStokes::m_extrapolation
protected

◆ m_fieldsBCToElmtID

Array<OneD, Array<OneD, int> > Nektar::IncNavierStokes::m_fieldsBCToElmtID
protected

Mapping from BCs to Elmt IDs.

Definition at line 206 of file IncNavierStokes.h.

Referenced by SetRadiationBoundaryForcing(), SetZeroNormalVelocity(), and v_InitObject().

◆ m_fieldsBCToTraceID

Array<OneD, Array<OneD, int> > Nektar::IncNavierStokes::m_fieldsBCToTraceID
protected

Mapping from BCs to Elmt Edge IDs.

Definition at line 208 of file IncNavierStokes.h.

Referenced by SetRadiationBoundaryForcing(), SetZeroNormalVelocity(), and v_InitObject().

◆ m_fieldsRadiationFactor

Array<OneD, Array<OneD, NekDouble> > Nektar::IncNavierStokes::m_fieldsRadiationFactor
protected

RHS Factor for Radiation Condition.

Definition at line 210 of file IncNavierStokes.h.

Referenced by SetRadiationBoundaryForcing(), and v_InitObject().

◆ m_forcing

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

◆ m_intSteps

int Nektar::IncNavierStokes::m_intSteps
protected

Number of time integration steps AND Order of extrapolation for pressure boundary conditions.

Definition at line 214 of file IncNavierStokes.h.

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

◆ m_kinvis

NekDouble Nektar::IncNavierStokes::m_kinvis
protected

◆ m_mdlFile

std::ofstream Nektar::IncNavierStokes::m_mdlFile
protected

modal energy file

Definition at line 180 of file IncNavierStokes.h.

◆ m_nConvectiveFields

int Nektar::IncNavierStokes::m_nConvectiveFields
protected

◆ m_pressure

MultiRegions::ExpListSharedPtr Nektar::IncNavierStokes::m_pressure
protected

◆ m_SmoothAdvection

bool Nektar::IncNavierStokes::m_SmoothAdvection
protected

◆ m_velocity

Array<OneD, int> Nektar::IncNavierStokes::m_velocity
protected

◆ m_womersleyParams

std::map<int, std::map<int,WomersleyParamsSharedPtr> > Nektar::IncNavierStokes::m_womersleyParams
protected

Womersley parameters if required.

Definition at line 247 of file IncNavierStokes.h.

Referenced by SetUpWomersley(), SetWomersleyBoundary(), and v_InitObject().