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

Protected Member Functions

 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)
 
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 ()
 
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 ()
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble >> vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_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::TimeIntegrationWrapperSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln
 
NekDouble m_epsilon
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used. More...
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used. More...
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used. More...
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::ofstream m_errFile
 
std::vector< int > m_intVariables
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
NekDouble m_filterTimeWarning
 Number of time steps between outputting status information. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
NekDouble m_checktime
 Time between checkpoints. More...
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

Additional Inherited Members

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

Detailed Description

This class is the base class for Navier Stokes problems.

Definition at line 136 of file IncNavierStokes.h.

Constructor & Destructor Documentation

◆ ~IncNavierStokes()

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

Destructor

Definition at line 280 of file IncNavierStokes.cpp.

281  {
282  }

◆ IncNavierStokes()

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

Constructor.

Constructor. Creates ...

Parameters

Definition at line 68 of file IncNavierStokes.cpp.

70  :
71  UnsteadySystem(pSession, pGraph),
72  AdvectionSystem(pSession, pGraph),
73  m_SmoothAdvection(false)
74  {
75  }
bool m_SmoothAdvection
bool to identify if advection term smoothing is requested
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.
SOLVER_UTILS_EXPORT AdvectionSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)

Member Function Documentation

◆ AddForcing()

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

Add an additional forcing term programmatically.

Definition at line 778 of file IncNavierStokes.cpp.

References m_forcing.

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

780  {
781  m_forcing.push_back(pForce);
782  }
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Forcing terms.

◆ EvaluateAdvectionTerms()

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

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

Definition at line 287 of file IncNavierStokes.cpp.

References Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::SolverUtils::EquationSystem::m_fields, m_nConvectiveFields, Nektar::SolverUtils::EquationSystem::m_time, and m_velocity.

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

290  {
291  int i;
292  int VelDim = m_velocity.num_elements();
293  Array<OneD, Array<OneD, NekDouble> > velocity(VelDim);
294 
295  for(i = 0; i < VelDim; ++i)
296  {
297  velocity[i] = inarray[m_velocity[i]];
298  }
299 
301  velocity, inarray, outarray, m_time);
302  }
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
NekDouble m_time
Current time of simulation.
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;.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.

◆ 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 832 of file IncNavierStokes.cpp.

References Vmath::Fill().

835  {
836  int nPts = physfield[0].num_elements();
837  Vmath::Fill(nPts, 1.0, density, 1);
838  }
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
Definition: Vmath.cpp:45

◆ GetEquationType()

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

Definition at line 221 of file IncNavierStokes.h.

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

◆ GetNConvectiveFields()

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

Definition at line 145 of file IncNavierStokes.h.

146  {
147  return m_nConvectiveFields;
148  }
int m_nConvectiveFields
Number of fields to be convected;.

◆ 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 822 of file IncNavierStokes.cpp.

References m_nConvectiveFields.

825  {
826  pressure = physfield[m_nConvectiveFields];
827  }
int m_nConvectiveFields
Number of fields to be convected;.

◆ GetVelocity() [1/2]

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

Definition at line 150 of file IncNavierStokes.h.

References Nektar::SolverUtils::ForcingSharedPtr, and CG_Iterations::pressure.

151  {
152  return m_velocity;
153  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);

◆ GetVelocity() [2/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 843 of file IncNavierStokes.cpp.

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

846  {
847  for(int i = 0; i < m_spacedim; ++i)
848  {
849  velocity[i] = physfield[i];
850  }
851  }
int m_spacedim
Spatial dimension (>= expansion dim).

◆ HasConstantDensity()

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

Implements Nektar::SolverUtils::FluidInterface.

Definition at line 165 of file IncNavierStokes.h.

166  {
167  return true;
168  }

◆ SetBoundaryConditions()

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

time dependent boundary conditions updating

Time dependent boundary conditions updating

Definition at line 307 of file IncNavierStokes.cpp.

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

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

308  {
309  int i, n;
310  std::string varName;
311  int nvariables = m_fields.num_elements();
312 
313  for (i = 0; i < nvariables; ++i)
314  {
315  for(n = 0; n < m_fields[i]->GetBndConditions().num_elements(); ++n)
316  {
317  if(m_fields[i]->GetBndConditions()[n]->IsTimeDependent())
318  {
319  varName = m_session->GetVariable(i);
320  m_fields[i]->EvaluateBoundaryConditions(time, varName);
321  }
322  else if(boost::istarts_with(
323  m_fields[i]->GetBndConditions()[n]->GetUserDefined(),
324  "Womersley"))
325  {
327  }
328  }
329 
330  // Set Radiation conditions if required
332  }
333 
335  }
void SetZeroNormalVelocity()
Set Normal Velocity Component to Zero.
void SetRadiationBoundaryForcing(int fieldid)
Set Radiation forcing term.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
void SetWomersleyBoundary(const int fldid, const int bndid)
Set Womersley Profile if specified.

◆ SetRadiationBoundaryForcing()

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

Set Radiation forcing term.

Probably should be pushed back into ContField?

Definition at line 340 of file IncNavierStokes.cpp.

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

341  {
342  int i,n;
343 
344  Array<OneD, const SpatialDomains::BoundaryConditionShPtr > BndConds;
345  Array<OneD, MultiRegions::ExpListSharedPtr> BndExp;
346 
347  BndConds = m_fields[fieldid]->GetBndConditions();
348  BndExp = m_fields[fieldid]->GetBndCondExpansions();
349 
352 
353  int cnt;
354  int elmtid,nq,offset, boundary;
355  Array<OneD, NekDouble> Bvals, U;
356  int cnt1 = 0;
357 
358  for(cnt = n = 0; n < BndConds.num_elements(); ++n)
359  {
360  std::string type = BndConds[n]->GetUserDefined();
361 
362  if((BndConds[n]->GetBoundaryConditionType() ==
364  (boost::iequals(type,"Radiation")))
365  {
366  for(i = 0; i < BndExp[n]->GetExpSize(); ++i,cnt++)
367  {
368  elmtid = m_fieldsBCToElmtID[m_velocity[fieldid]][cnt];
369  elmt = m_fields[fieldid]->GetExp(elmtid);
370  offset = m_fields[fieldid]->GetPhys_Offset(elmtid);
371 
372  U = m_fields[fieldid]->UpdatePhys() + offset;
373  Bc = BndExp[n]->GetExp(i);
374 
375  boundary = m_fieldsBCToTraceID[fieldid][cnt];
376 
377  // Get edge values and put into ubc
378  nq = Bc->GetTotPoints();
379  Array<OneD, NekDouble> ubc(nq);
380  elmt->GetTracePhysVals(boundary,Bc,U,ubc);
381 
382  Vmath::Vmul(nq,&m_fieldsRadiationFactor[fieldid][cnt1 +
383  BndExp[n]->GetPhys_Offset(i)],1,
384  &ubc[0],1,&ubc[0],1);
385 
386  Bvals = BndExp[n]->UpdateCoeffs()+BndExp[n]->
387  GetCoeff_Offset(i);
388 
389  Bc->IProductWRTBase(ubc,Bvals);
390  }
391  cnt1 += BndExp[n]->GetTotPoints();
392  }
393  else
394  {
395  cnt += BndExp[n]->GetExpSize();
396  }
397  }
398  }
Array< OneD, Array< OneD, int > > m_fieldsBCToTraceID
Mapping from BCs to Elmt Edge IDs.
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
SOLVER_UTILS_EXPORT int GetCoeff_Offset(int n)
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
Array< OneD, Array< OneD, NekDouble > > m_fieldsRadiationFactor
RHS Factor for Radiation Condition.
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:186

◆ 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 562 of file IncNavierStokes.cpp.

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

Referenced by v_InitObject().

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

◆ SetWomersleyBoundary()

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

Set Womersley Profile if specified.

Womersley boundary condition defintion

Definition at line 491 of file IncNavierStokes.cpp.

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

Referenced by SetBoundaryConditions().

492  {
493  ASSERTL1(m_womersleyParams.count(bndid) == 1,
494  "Womersley parameters for this boundary have not been set up");
495 
496  WomersleyParamsSharedPtr WomParam = m_womersleyParams[fldid][bndid];
497  NekComplexDouble zvel;
498  int i,j,k;
499 
500  int M_coeffs = WomParam->m_wom_vel.size();
501 
502  NekDouble T = WomParam->m_period;
503  NekDouble axis_normal = WomParam->m_axisnormal[fldid];
504 
505  // Womersley Number
506  NekComplexDouble omega_c (2.0*M_PI/T, 0.0);
507  NekComplexDouble k_c (0.0, 0.0);
508  NekComplexDouble m_time_c (m_time, 0.0);
509  NekComplexDouble zi (0.0,1.0);
510  NekComplexDouble i_pow_3q2 (-1.0/sqrt(2.0),1.0/sqrt(2.0));
511 
513  BndCondExp = m_fields[fldid]->GetBndCondExpansions()[bndid];
514 
516  int cnt=0;
517  int nfq;
518  Array<OneD, NekDouble> Bvals;
519  int exp_npts = BndCondExp->GetExpSize();
520  Array<OneD, NekDouble> wbc(exp_npts,0.0);
521 
522  Array<OneD, NekComplexDouble> zt(M_coeffs);
523 
524  // preallocate the exponent
525  for (k=1; k < M_coeffs; k++)
526  {
527  k_c = NekComplexDouble((NekDouble) k, 0.0);
528  zt[k] = std::exp(zi * omega_c * k_c * m_time_c);
529  }
530 
531  // Loop over each element in an expansion
532  for(i = 0; i < exp_npts; ++i,cnt++)
533  {
534  // Get Boundary and trace expansion
535  bc = BndCondExp->GetExp(i);
536  nfq = bc->GetTotPoints();
537  Array<OneD, NekDouble> wbc(nfq,0.0);
538 
539  // Compute womersley solution
540  for (j=0; j < nfq; j++)
541  {
542  wbc[j] = WomParam->m_poiseuille[i][j];
543  for (k=1; k < M_coeffs; k++)
544  {
545  zvel = WomParam->m_zvel[i][j][k] * zt[k];
546  wbc[j] = wbc[j] + zvel.real();
547  }
548  }
549 
550  // Multiply w by normal to get u,v,w component of velocity
551  Vmath::Smul(nfq,axis_normal,wbc,1,wbc,1);
552  // get the offset
553  Bvals = BndCondExp->UpdateCoeffs()+
554  BndCondExp->GetCoeff_Offset(i);
555 
556  // Push back to Coeff space
557  bc->FwdTrans(wbc,Bvals);
558  }
559  }
std::complex< double > NekComplexDouble
std::map< int, std::map< int, WomersleyParamsSharedPtr > > m_womersleyParams
Womersley parameters if required.
NekDouble m_time
Current time of simulation.
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:250
std::shared_ptr< WomersleyParams > WomersleyParamsSharedPtr

◆ SetZeroNormalVelocity()

void Nektar::IncNavierStokes::SetZeroNormalVelocity ( )
protected

Set Normal Velocity Component to Zero.

Definition at line 401 of file IncNavierStokes.cpp.

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

402  {
403  // use static trip since cannot use UserDefinedTag for zero
404  // velocity and have time dependent conditions
405  static bool Setup = false;
406 
407  if(Setup == true)
408  {
409  return;
410  }
411  Setup = true;
412 
413  int i,n;
414 
415  Array<OneD, Array<OneD, const SpatialDomains::BoundaryConditionShPtr > >
416  BndConds(m_spacedim);
417  Array<OneD, Array<OneD, MultiRegions::ExpListSharedPtr> >
418  BndExp(m_spacedim);
419 
420 
421  for(i = 0; i < m_spacedim; ++i)
422  {
423  BndConds[i] = m_fields[m_velocity[i]]->GetBndConditions();
424  BndExp[i] = m_fields[m_velocity[i]]->GetBndCondExpansions();
425  }
426 
428 
429  int cnt;
430  int elmtid,nq, boundary;
431 
432  Array<OneD, Array<OneD, NekDouble> > normals;
433  Array<OneD, NekDouble> Bphys,Bcoeffs;
434 
435  int fldid = m_velocity[0];
436 
437  for(cnt = n = 0; n < BndConds[0].num_elements(); ++n)
438  {
439  if((BndConds[0][n]->GetBoundaryConditionType() ==
441  (boost::iequals(BndConds[0][n]->GetUserDefined(),
442  "ZeroNormalComponent")))
443  {
444  for(i = 0; i < BndExp[0][n]->GetExpSize(); ++i,cnt++)
445  {
446  elmtid = m_fieldsBCToElmtID[fldid][cnt];
447  elmt = m_fields[0]->GetExp(elmtid);
448  boundary = m_fieldsBCToTraceID[fldid][cnt];
449 
450  normals = elmt->GetSurfaceNormal(boundary);
451 
452  nq = BndExp[0][n]->GetExp(i)->GetTotPoints();
453  Array<OneD, NekDouble> normvel(nq,0.0);
454 
455  for(int k = 0; k < m_spacedim; ++k)
456  {
457  Bphys = BndExp[k][n]->UpdatePhys()+
458  BndExp[k][n]->GetPhys_Offset(i);
459  Bc = BndExp[k][n]->GetExp(i);
460  Vmath::Vvtvp(nq,normals[k],1,Bphys,1,normvel,1,
461  normvel,1);
462  }
463 
464  // negate normvel for next step
465  Vmath::Neg(nq,normvel,1);
466 
467  for(int k = 0; k < m_spacedim; ++k)
468  {
469  Bphys = BndExp[k][n]->UpdatePhys()+
470  BndExp[k][n]->GetPhys_Offset(i);
471  Bcoeffs = BndExp[k][n]->UpdateCoeffs()+
472  BndExp[k][n]->GetCoeff_Offset(i);
473  Bc = BndExp[k][n]->GetExp(i);
474  Vmath::Vvtvp(nq,normvel,1,normals[k],1,Bphys,1,
475  Bphys,1);
476  Bc->FwdTrans_BndConstrained(Bphys,Bcoeffs);
477  }
478  }
479  }
480  else
481  {
482  cnt += BndExp[0][n]->GetExpSize();
483  }
484  }
485  }
Array< OneD, Array< OneD, int > > m_fieldsBCToTraceID
Mapping from BCs to Elmt Edge IDs.
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:445
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
int m_spacedim
Spatial dimension (>= expansion dim).
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.

◆ v_GetForceDimension()

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

◆ v_GetMaxStdVelocity()

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

Reimplemented from Nektar::SolverUtils::AdvectionSystem.

Definition at line 787 of file IncNavierStokes.cpp.

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

788  {
789  int nvel = m_velocity.num_elements();
790  int nelmt = m_fields[0]->GetExpSize();
791 
792  Array<OneD, NekDouble> stdVelocity(nelmt, 0.0);
793  Array<OneD, Array<OneD, NekDouble> > velfields;
794 
795  if(m_HomogeneousType == eHomogeneous1D) // just do check on 2D info
796  {
797  velfields = Array<OneD, Array<OneD, NekDouble> >(2);
798 
799  for(int i = 0; i < 2; ++i)
800  {
801  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
802  }
803  }
804  else
805  {
806  velfields = Array<OneD, Array<OneD, NekDouble> >(nvel);
807 
808  for(int i = 0; i < nvel; ++i)
809  {
810  velfields[i] = m_fields[m_velocity[i]]->UpdatePhys();
811  }
812  }
813 
814  stdVelocity = m_extrapolation->GetMaxStdVelocity(velfields);
815 
816  return stdVelocity;
817  }
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
ExtrapolateSharedPtr m_extrapolation
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
enum HomogeneousType m_HomogeneousType

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

◆ 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::CoupledLinearNS, Nektar::VCSMapping, and Nektar::VelocityCorrectionScheme.

Definition at line 77 of file IncNavierStokes.cpp.

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::VelocityCorrectionScheme::v_InitObject(), and Nektar::CoupledLinearNS::v_InitObject().

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

◆ v_PreIntegrate()

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

Perform the extrapolation.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 856 of file IncNavierStokes.cpp.

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

857  {
858  m_extrapolation->SubStepSaveFields(step);
859  m_extrapolation->SubStepAdvance(m_intSoln,step,m_time);
861  return false;
862  }
void SetBoundaryConditions(NekDouble time)
time dependent boundary conditions updating
NekDouble m_time
Current time of simulation.
NekDouble m_timestep
Time step size.
ExtrapolateSharedPtr m_extrapolation
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln

◆ 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::CoupledLinearNS, and Nektar::VelocityCorrectionScheme.

Definition at line 254 of file IncNavierStokes.h.

References ASSERTL0.

255  {
256  ASSERTL0(false,"This method is not defined in this class");
257  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

◆ 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::CoupledLinearNS, and Nektar::VelocityCorrectionScheme.

Definition at line 259 of file IncNavierStokes.h.

References ASSERTL0.

260  {
261  ASSERTL0(false,"This method is not defined in this class");
262  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216

◆ 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 201 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 207 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 209 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 211 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 215 of file IncNavierStokes.h.

◆ m_kinvis

NekDouble Nektar::IncNavierStokes::m_kinvis
protected

◆ m_mdlFile

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

modal energy file

Definition at line 181 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().