Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Nektar::VCSMapping Class Reference

#include <VCSMapping.h>

Inheritance diagram for Nektar::VCSMapping:
[legend]

Public Member Functions

 VCSMapping (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Constructor. More...
 
void ApplyIncNSMappingForcing (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
virtual ~VCSMapping ()
 
virtual void v_InitObject ()
 Init object for UnsteadySystem class. More...
 
- Public Member Functions inherited from Nektar::VelocityCorrectionScheme
 VelocityCorrectionScheme (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Constructor. More...
 
virtual ~VelocityCorrectionScheme ()
 
void SetUpPressureForcing (const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
 
void SetUpViscousForcing (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
 
void SolvePressure (const Array< OneD, NekDouble > &Forcing)
 
void SolveViscous (const Array< OneD, const Array< OneD, NekDouble > > &Forcing, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
 
void SolveUnsteadyStokesSystem (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble a_iixDt)
 
void EvaluateAdvection_SetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
- Public Member Functions inherited from Nektar::IncNavierStokes
virtual ~IncNavierStokes ()
 
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...
 

Static Public Member Functions

static SolverUtils::EquationSystemSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::VelocityCorrectionScheme
static SolverUtils::EquationSystemSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 
- Static Public Attributes inherited from Nektar::VelocityCorrectionScheme
static std::string className
 Name of class. More...
 

Protected Member Functions

virtual void v_DoInitialise (void)
 Sets up initial conditions. More...
 
virtual void v_SetUpPressureForcing (const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
 
virtual void v_SetUpViscousForcing (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
 
virtual void v_SolvePressure (const Array< OneD, NekDouble > &Forcing)
 
virtual void v_SolveViscous (const Array< OneD, const Array< OneD, NekDouble > > &Forcing, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
 
virtual void v_EvaluateAdvection_SetPressureBCs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
- Protected Member Functions inherited from Nektar::VelocityCorrectionScheme
void SetupFlowrate (NekDouble aii_dt)
 Set up the Stokes solution used to impose constant flowrate through a boundary. More...
 
NekDouble MeasureFlowrate (const Array< OneD, Array< OneD, NekDouble > > &inarray)
 Measure the volumetric flow rate through the volumetric flow rate reference surface. More...
 
virtual bool v_PostIntegrate (int step)
 
virtual void v_GenerateSummary (SolverUtils::SummaryList &s)
 Print a summary of time stepping parameters. More...
 
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 Array< OneD, bool > v_GetSystemSingularChecks ()
 
virtual int v_GetForceDimension ()
 
virtual bool v_RequireFwdTrans ()
 
virtual std::string v_GetExtrapolateStr (void)
 
virtual std::string v_GetSubSteppingExtrapolateStr (const std::string &instr)
 
void SetUpSVV (void)
 
void SetUpExtrapolation (void)
 
void SVVVarDiffCoeff (const NekDouble velmag, Array< OneD, NekDouble > &diffcoeff, const Array< OneD, Array< OneD, NekDouble > > &vel=NullNekDoubleArrayofArray)
 
void AppendSVVFactors (StdRegions::ConstFactorMap &factors, MultiRegions::VarFactorsMap &varFactorsMap)
 
- Protected Member Functions inherited from Nektar::IncNavierStokes
 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 Array< OneD, NekDoublev_GetMaxStdVelocity ()
 
virtual bool v_PreIntegrate (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_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...
 
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

GlobalMapping::MappingSharedPtr m_mapping
 
bool m_verbose
 
bool m_implicitPressure
 
bool m_implicitViscous
 
bool m_neglectViscous
 
NekDouble m_pressureTolerance
 
NekDouble m_viscousTolerance
 
NekDouble m_pressureRelaxation
 
NekDouble m_viscousRelaxation
 
Array< OneD, Array< OneD, NekDouble > > m_gradP
 
- Protected Attributes inherited from Nektar::VelocityCorrectionScheme
bool m_useHomo1DSpecVanVisc
 bool to identify if spectral vanishing viscosity is active. More...
 
bool m_useSpecVanVisc
 bool to identify if spectral vanishing viscosity is active. More...
 
NekDouble m_sVVCutoffRatio
 cutt off ratio from which to start decayhing modes More...
 
NekDouble m_sVVDiffCoeff
 Diffusion coefficient of SVV modes. More...
 
NekDouble m_sVVCutoffRatioHomo1D
 
NekDouble m_sVVDiffCoeffHomo1D
 Diffusion coefficient of SVV modes in homogeneous 1D Direction. More...
 
Array< OneD, NekDoublem_svvVarDiffCoeff
 Array of coefficient if power kernel is used in SVV. More...
 
bool m_IsSVVPowerKernel
 Identifier for Power Kernel otherwise DG kernel. More...
 
Array< OneD, NekDoublem_diffCoeff
 Diffusion coefficients (will be kinvis for velocities) More...
 
StdRegions::VarCoeffMap m_varCoeffLap
 Variable Coefficient map for the Laplacian which can be activated as part of SVV or otherwise. More...
 
NekDouble m_flowrate
 Desired volumetric flowrate. More...
 
NekDouble m_flowrateArea
 Area of the boundary through which we are measuring the flowrate. More...
 
bool m_homd1DFlowinPlane
 
NekDouble m_greenFlux
 Flux of the Stokes function solution. More...
 
NekDouble m_alpha
 Current flowrate correction. More...
 
int m_flowrateBndID
 Boundary ID of the flowrate reference surface. More...
 
int m_planeID
 Plane ID for cases with homogeneous expansion. More...
 
MultiRegions::ExpListSharedPtr m_flowrateBnd
 Flowrate reference surface. More...
 
Array< OneD, Array< OneD, NekDouble > > m_flowrateStokes
 Stokes solution used to impose flowrate. More...
 
std::ofstream m_flowrateStream
 Output stream to record flowrate. More...
 
int m_flowrateSteps
 Interval at which to record flowrate data. More...
 
NekDouble m_flowrateAiidt
 Value of aii_dt used to compute Stokes flowrate solution. More...
 
Array< OneD, Array< OneD, NekDouble > > m_F
 
- Protected Attributes inherited from Nektar::IncNavierStokes
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...
 

Private Member Functions

void MappingAdvectionCorrection (const Array< OneD, const Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void MappingAccelerationCorrection (const Array< OneD, const Array< OneD, NekDouble > > &vel, const Array< OneD, const Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void MappingPressureCorrection (Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void MappingViscousCorrection (const Array< OneD, const Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
 

Private Attributes

Array< OneD, Array< OneD, NekDouble > > m_presForcingCorrection
 

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

Definition at line 43 of file VCSMapping.h.

Constructor & Destructor Documentation

◆ VCSMapping()

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

Constructor.

Constructor. Creates ...

Parameters

Definition at line 56 of file VCSMapping.cpp.

59  : UnsteadySystem(pSession, pGraph),
60  VelocityCorrectionScheme(pSession, pGraph)
61  {
62 
63  }
VelocityCorrectionScheme(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Constructor.
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.

◆ ~VCSMapping()

Nektar::VCSMapping::~VCSMapping ( void  )
virtual

Destructor

Definition at line 149 of file VCSMapping.cpp.

150  {
151  }

Member Function Documentation

◆ ApplyIncNSMappingForcing()

void Nektar::VCSMapping::ApplyIncNSMappingForcing ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)

Explicit terms of the mapping

Definition at line 755 of file VCSMapping.cpp.

References Nektar::SolverUtils::EquationSystem::m_fields, m_implicitPressure, m_implicitViscous, Nektar::IncNavierStokes::m_kinvis, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, m_neglectViscous, MappingAccelerationCorrection(), MappingAdvectionCorrection(), MappingPressureCorrection(), MappingViscousCorrection(), Vmath::Smul(), Vmath::Vadd(), and Vmath::Vcopy().

Referenced by v_EvaluateAdvection_SetPressureBCs().

758  {
759  int physTot = m_fields[0]->GetTotPoints();
760  Array<OneD, Array<OneD, NekDouble> > vel(m_nConvectiveFields);
761  Array<OneD, Array<OneD, NekDouble> > velPhys(m_nConvectiveFields);
762  Array<OneD, Array<OneD, NekDouble> > Forcing(m_nConvectiveFields);
763  Array<OneD, Array<OneD, NekDouble> > tmp(m_nConvectiveFields);
764  for (int i = 0; i < m_nConvectiveFields; ++i)
765  {
766  velPhys[i] = Array<OneD, NekDouble> (physTot, 0.0);
767  Forcing[i] = Array<OneD, NekDouble> (physTot, 0.0);
768  tmp[i] = Array<OneD, NekDouble> (physTot, 0.0);
769  }
770 
771  // Get fields and store velocity in wavespace and physical space
772  if(m_fields[0]->GetWaveSpace())
773  {
774  for (int i = 0; i < m_nConvectiveFields; ++i)
775  {
776  vel[i] = inarray[i];
777  m_fields[0]->HomogeneousBwdTrans(vel[i],velPhys[i]);
778  }
779  }
780  else
781  {
782  for (int i = 0; i < m_nConvectiveFields; ++i)
783  {
784  vel[i] = inarray[i];
785  Vmath::Vcopy(physTot, inarray[i], 1, velPhys[i], 1);
786  }
787  }
788 
789  //Advection contribution
790  MappingAdvectionCorrection(velPhys, Forcing);
791 
792  // Time-derivative contribution
793  if ( m_mapping->IsTimeDependent() )
794  {
795  MappingAccelerationCorrection(vel, velPhys, tmp);
796  for (int i = 0; i < m_nConvectiveFields; ++i)
797  {
798  Vmath::Vadd(physTot, tmp[i], 1, Forcing[i], 1, Forcing[i], 1);
799  }
800  }
801 
802  // Pressure contribution
803  if (!m_implicitPressure)
804  {
806  for (int i = 0; i < m_nConvectiveFields; ++i)
807  {
808  Vmath::Vadd(physTot, tmp[i], 1, Forcing[i], 1, Forcing[i], 1);
809  }
810  }
811  // Viscous contribution
812  if ( (!m_implicitViscous) && (!m_neglectViscous))
813  {
814  MappingViscousCorrection(velPhys, tmp);
815  for (int i = 0; i < m_nConvectiveFields; ++i)
816  {
817  Vmath::Smul(physTot, m_kinvis, tmp[i], 1, tmp[i], 1);
818  Vmath::Vadd(physTot, tmp[i], 1, Forcing[i], 1, Forcing[i], 1);
819  }
820  }
821 
822  // If necessary, transform to wavespace
823  if(m_fields[0]->GetWaveSpace())
824  {
825  for (int i = 0; i < m_nConvectiveFields; ++i)
826  {
827  m_fields[0]->HomogeneousFwdTrans(Forcing[i],Forcing[i]);
828  }
829  }
830 
831  // Add to outarray
832  for (int i = 0; i < m_nConvectiveFields; ++i)
833  {
834  Vmath::Vadd(physTot, outarray[i], 1, Forcing[i], 1, outarray[i], 1);
835  }
836  }
void MappingAccelerationCorrection(const Array< OneD, const Array< OneD, NekDouble > > &vel, const Array< OneD, const Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:863
NekDouble m_kinvis
Kinematic viscosity.
void MappingAdvectionCorrection(const Array< OneD, const Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:838
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
int m_nConvectiveFields
Number of fields to be convected;.
void MappingViscousCorrection(const Array< OneD, const Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:969
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
void MappingPressureCorrection(Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:942
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:1064
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302

◆ create()

static SolverUtils::EquationSystemSharedPtr Nektar::VCSMapping::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr pGraph 
)
inlinestatic

Creates an instance of this class.

Definition at line 48 of file VCSMapping.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

51  {
54  p->InitObject();
55  return p;
56  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.

◆ MappingAccelerationCorrection()

void Nektar::VCSMapping::MappingAccelerationCorrection ( const Array< OneD, const Array< OneD, NekDouble > > &  vel,
const Array< OneD, const Array< OneD, NekDouble > > &  velPhys,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

Definition at line 863 of file VCSMapping.cpp.

References Nektar::MultiRegions::DirCartesianMap, Nektar::SolverUtils::EquationSystem::m_fields, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Vmath::Neg(), Vmath::Vadd(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by ApplyIncNSMappingForcing().

867  {
868  int physTot = m_fields[0]->GetTotPoints();
869  int nvel = m_nConvectiveFields;
870 
871  Array<OneD, Array<OneD, NekDouble> > wk(nvel*nvel);
872  Array<OneD, Array<OneD, NekDouble> > tmp(nvel);
873  Array<OneD, Array<OneD, NekDouble> > coordVel(nvel);
874  for (int i = 0; i< nvel; i++)
875  {
876  tmp[i] = Array<OneD, NekDouble> (physTot, 0.0);
877  coordVel[i] = Array<OneD, NekDouble> (physTot, 0.0);
878  }
879  // Get coordinates velocity in transformed system
880  m_mapping->GetCoordVelocity(tmp);
881  m_mapping->ContravarFromCartesian(tmp, coordVel);
882 
883  // Calculate first term: U^j u^i,j = U^j (du^i/dx^j + {i,kj}u^k)
884  m_mapping->ApplyChristoffelContravar(velPhys, wk);
885  for (int i=0; i< nvel; i++)
886  {
887  Vmath::Zero(physTot,outarray[i],1);
888 
889  m_fields[0]->PhysDeriv(velPhys[i], tmp[0], tmp[1]);
890  for (int j=0; j< nvel; j++)
891  {
892  if (j == 2)
893  {
894  m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[j],
895  vel[i], tmp[2]);
896  if (m_fields[0]->GetWaveSpace())
897  {
898  m_fields[0]->HomogeneousBwdTrans(tmp[2],tmp[2]);
899  }
900  }
901 
902  Vmath::Vadd(physTot,wk[i*nvel+j],1,tmp[j],1,
903  wk[i*nvel+j], 1);
904 
905  Vmath::Vvtvp(physTot, coordVel[j], 1, wk[i*nvel+j], 1,
906  outarray[i], 1, outarray[i], 1);
907  }
908  }
909 
910  // Set wavespace to false and store current value
911  bool wavespace = m_fields[0]->GetWaveSpace();
912  m_fields[0]->SetWaveSpace(false);
913 
914  // Add -u^j U^i,j
915  m_mapping->ApplyChristoffelContravar(coordVel, wk);
916  for (int i=0; i< nvel; i++)
917  {
918  if(nvel == 2)
919  {
920  m_fields[0]->PhysDeriv(coordVel[i], tmp[0], tmp[1]);
921  }
922  else
923  {
924  m_fields[0]->PhysDeriv(coordVel[i], tmp[0], tmp[1], tmp[2]);
925  }
926 
927  for (int j=0; j< nvel; j++)
928  {
929  Vmath::Vadd(physTot,wk[i*nvel+j],1,tmp[j],1,
930  wk[i*nvel+j], 1);
931  Vmath::Neg(physTot, wk[i*nvel+j], 1);
932 
933  Vmath::Vvtvp(physTot, velPhys[j], 1, wk[i*nvel+j], 1,
934  outarray[i], 1, outarray[i], 1);
935  }
936  }
937 
938  // Restore value of wavespace
939  m_fields[0]->SetWaveSpace(wavespace);
940  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
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
int m_nConvectiveFields
Number of fields to be convected;.
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:88
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302

◆ MappingAdvectionCorrection()

void Nektar::VCSMapping::MappingAdvectionCorrection ( const Array< OneD, const Array< OneD, NekDouble > > &  velPhys,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

Definition at line 838 of file VCSMapping.cpp.

References Nektar::SolverUtils::EquationSystem::m_fields, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Vmath::Neg(), Vmath::Vvtvp(), and Vmath::Zero().

Referenced by ApplyIncNSMappingForcing().

841  {
842  int physTot = m_fields[0]->GetTotPoints();
843  int nvel = m_nConvectiveFields;
844 
845  Array<OneD, Array<OneD, NekDouble> > wk(nvel*nvel);
846 
847  // Apply Christoffel symbols to obtain {i,kj}vel(k)
848  m_mapping->ApplyChristoffelContravar(velPhys, wk);
849 
850  // Calculate correction -U^j*{i,kj}vel(k)
851  for (int i = 0; i< nvel; i++)
852  {
853  Vmath::Zero(physTot,outarray[i],1);
854  for (int j = 0; j< nvel; j++)
855  {
856  Vmath::Vvtvp(physTot,wk[i*nvel+j],1,velPhys[j],1,
857  outarray[i],1,outarray[i],1);
858  }
859  Vmath::Neg(physTot, outarray[i], 1);
860  }
861  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
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
int m_nConvectiveFields
Number of fields to be convected;.
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376

◆ MappingPressureCorrection()

void Nektar::VCSMapping::MappingPressureCorrection ( Array< OneD, Array< OneD, NekDouble > > &  outarray)
private

Definition at line 942 of file VCSMapping.cpp.

References Nektar::SolverUtils::EquationSystem::m_fields, m_gradP, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Vmath::Vdiv(), and Vmath::Vsub().

Referenced by ApplyIncNSMappingForcing().

944  {
945  int physTot = m_fields[0]->GetTotPoints();
946  int nvel = m_nConvectiveFields;
947 
948  // Calculate g^(ij)p_(,j)
949  m_mapping->RaiseIndex(m_gradP, outarray);
950 
951  // Calculate correction = (nabla p)/J - g^(ij)p_,j
952  // (Jac is not required if it is constant)
953  if ( !m_mapping->HasConstantJacobian())
954  {
955  Array<OneD, NekDouble> Jac(physTot, 0.0);
956  m_mapping->GetJacobian(Jac);
957  for(int i = 0; i < nvel; ++i)
958  {
959  Vmath::Vdiv(physTot, m_gradP[i], 1, Jac, 1, m_gradP[i], 1);
960  }
961  }
962  for(int i = 0; i < nvel; ++i)
963  {
964  Vmath::Vsub(physTot, m_gradP[i], 1,outarray[i], 1,
965  outarray[i],1);
966  }
967  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
void Vdiv(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:244
int m_nConvectiveFields
Number of fields to be convected;.
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:94
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:346
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.

◆ MappingViscousCorrection()

void Nektar::VCSMapping::MappingViscousCorrection ( const Array< OneD, const Array< OneD, NekDouble > > &  velPhys,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

Definition at line 969 of file VCSMapping.cpp.

References m_mapping.

Referenced by ApplyIncNSMappingForcing().

972  {
973  // L(U) - 1.0*d^2(u^i)/dx^jdx^j
974  m_mapping->VelocityLaplacian(velPhys, outarray, 1.0);
975  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77

◆ v_DoInitialise()

void Nektar::VCSMapping::v_DoInitialise ( void  )
protectedvirtual

Sets up initial conditions.

Sets the initial conditions.

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 153 of file VCSMapping.cpp.

References Nektar::MultiRegions::DirCartesianMap, Nektar::VelocityCorrectionScheme::m_F, Nektar::SolverUtils::EquationSystem::m_fieldMetaDataMap, Nektar::SolverUtils::EquationSystem::m_fields, m_gradP, Nektar::IncNavierStokes::m_kinvis, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Nektar::IncNavierStokes::m_pressure, Nektar::SolverUtils::EquationSystem::m_timestep, and Nektar::SolverUtils::UnsteadySystem::v_DoInitialise().

154  {
156 
157  // Set up Field Meta Data for output files
158  m_fieldMetaDataMap["Kinvis"] =
159  boost::lexical_cast<std::string>(m_kinvis);
160  m_fieldMetaDataMap["TimeStep"] =
161  boost::lexical_cast<std::string>(m_timestep);
162 
163  // Correct Dirichlet boundary conditions to account for mapping
164  m_mapping->UpdateBCs(0.0);
165  //
166  m_F = Array<OneD, Array< OneD, NekDouble> > (m_nConvectiveFields);
167  for(int i = 0; i < m_nConvectiveFields; ++i)
168  {
169  m_fields[i]->LocalToGlobal();
170  m_fields[i]->ImposeDirichletConditions(m_fields[i]->UpdateCoeffs());
171  m_fields[i]->GlobalToLocal();
172  m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
173  m_fields[i]->UpdatePhys());
174  m_F[i] = Array< OneD, NekDouble> (m_fields[0]->GetTotPoints(), 0.0);
175  }
176 
177  // Initialise m_gradP
178  int physTot = m_fields[0]->GetTotPoints();
179  m_gradP = Array<OneD, Array<OneD, NekDouble> >(m_nConvectiveFields);
180  for(int i = 0; i < m_nConvectiveFields; ++i)
181  {
182  m_gradP[i] = Array<OneD, NekDouble>(physTot,0.0);
184  m_pressure->GetPhys(),
185  m_gradP[i]);
186  if(m_pressure->GetWaveSpace())
187  {
188  m_pressure->HomogeneousBwdTrans(m_gradP[i],m_gradP[i]);
189  }
190  }
191  }
NekDouble m_kinvis
Kinematic viscosity.
NekDouble m_timestep
Time step size.
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
int m_nConvectiveFields
Number of fields to be convected;.
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:94
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
Array< OneD, Array< OneD, NekDouble > > m_F
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:88
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
virtual SOLVER_UTILS_EXPORT void v_DoInitialise()
Sets up initial conditions.

◆ v_EvaluateAdvection_SetPressureBCs()

void Nektar::VCSMapping::v_EvaluateAdvection_SetPressureBCs ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  time 
)
protectedvirtual

Explicit part of the method - Advection, Forcing + HOPBCs

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 196 of file VCSMapping.cpp.

References ApplyIncNSMappingForcing(), Nektar::IncNavierStokes::EvaluateAdvectionTerms(), Nektar::IncNavierStokes::m_extrapolation, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::IncNavierStokes::m_forcing, Nektar::IncNavierStokes::m_kinvis, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Nektar::IncNavierStokes::m_pressure, Nektar::IncNavierStokes::m_SmoothAdvection, and Nektar::SolverUtils::EquationSystem::m_timestep.

200  {
201  EvaluateAdvectionTerms(inarray, outarray);
202 
203  // Smooth advection
205  {
206  for(int i = 0; i < m_nConvectiveFields; ++i)
207  {
208  m_pressure->SmoothField(outarray[i]);
209  }
210  }
211 
212  // Add forcing terms
213  for (auto &x : m_forcing)
214  {
215  x->Apply(m_fields, inarray, outarray, time);
216  }
217 
218  // Add mapping terms
219  ApplyIncNSMappingForcing( inarray, outarray);
220 
221  // Calculate High-Order pressure boundary conditions
222  m_extrapolation->EvaluatePressureBCs(inarray,outarray,m_kinvis);
223 
224  // Update mapping and deal with Dirichlet boundary conditions
225  if (m_mapping->IsTimeDependent())
226  {
227  if (m_mapping->IsFromFunction())
228  {
229  // If the transformation is explicitly defined, update it here
230  // Otherwise, it will be done somewhere else (ForcingMovingBody)
231  m_mapping->UpdateMapping(time+m_timestep);
232  }
233  m_mapping->UpdateBCs(time+m_timestep);
234  }
235  }
void ApplyIncNSMappingForcing(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:755
NekDouble m_kinvis
Kinematic viscosity.
NekDouble m_timestep
Time step size.
ExtrapolateSharedPtr m_extrapolation
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
void EvaluateAdvectionTerms(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
int m_nConvectiveFields
Number of fields to be convected;.
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Forcing terms.
bool m_SmoothAdvection
bool to identify if advection term smoothing is requested
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.

◆ v_InitObject()

void Nektar::VCSMapping::v_InitObject ( )
virtual

Init object for UnsteadySystem class.

Initialization object for UnsteadySystem class.

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 65 of file VCSMapping.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::LibUtilities::eIMEXGear, Nektar::LibUtilities::eIMEXOrder1, Nektar::LibUtilities::eIMEXOrder2, Nektar::LibUtilities::eIMEXOrder3, Nektar::LibUtilities::eIMEXOrder4, Nektar::GetExtrapolateFactory(), Nektar::GlobalMapping::Mapping::Load(), Nektar::SolverUtils::AdvectionSystem::m_advObject, Nektar::IncNavierStokes::m_extrapolation, Nektar::SolverUtils::EquationSystem::m_fields, m_implicitPressure, m_implicitViscous, Nektar::SolverUtils::UnsteadySystem::m_intScheme, m_mapping, m_neglectViscous, m_presForcingCorrection, Nektar::IncNavierStokes::m_pressure, m_pressureRelaxation, m_pressureTolerance, Nektar::SolverUtils::EquationSystem::m_session, Nektar::IncNavierStokes::m_velocity, m_verbose, m_viscousRelaxation, m_viscousTolerance, and Nektar::VelocityCorrectionScheme::v_InitObject().

66  {
68 
71  "Could not create mapping in VCSMapping.");
72 
73  std::string vExtrapolation = "Mapping";
75  vExtrapolation,
76  m_session,
77  m_fields,
78  m_pressure,
79  m_velocity,
80  m_advObject);
81  m_extrapolation->SubSteppingTimeIntegration(
82  m_intScheme->GetIntegrationMethod(), m_intScheme);
83  m_extrapolation->GenerateHOPBCMap(m_session);
84 
85  // Storage to extrapolate pressure forcing
86  int physTot = m_fields[0]->GetTotPoints();
87  int intSteps = 1;
88  int intMethod = m_intScheme->GetIntegrationMethod();
89  switch(intMethod)
90  {
92  {
93  intSteps = 1;
94  }
95  break;
98  {
99  intSteps = 2;
100  }
101  break;
103  {
104  intSteps = 3;
105  }
106  break;
108  {
109  intSteps = 4;
110  }
111  break;
112  }
113  m_presForcingCorrection= Array<OneD, Array<OneD, NekDouble> >(intSteps);
114  for(int i = 0; i < m_presForcingCorrection.num_elements(); i++)
115  {
116  m_presForcingCorrection[i] = Array<OneD, NekDouble>(physTot,0.0);
117  }
118  m_verbose = (m_session->DefinesCmdLineArgument("verbose"))? true :false;
119 
120  // Load solve parameters related to the mapping
121  // Flags determining if pressure/viscous terms should be treated implicitly
122  m_session->MatchSolverInfo("MappingImplicitPressure","True",
123  m_implicitPressure,false);
124  m_session->MatchSolverInfo("MappingImplicitViscous","True",
125  m_implicitViscous,false);
126  m_session->MatchSolverInfo("MappingNeglectViscous","True",
127  m_neglectViscous,false);
128 
129  if (m_neglectViscous)
130  {
131  m_implicitViscous = false;
132  }
133 
134  // Tolerances and relaxation parameters for implicit terms
135  m_session->LoadParameter("MappingPressureTolerance",
136  m_pressureTolerance,1e-12);
137  m_session->LoadParameter("MappingViscousTolerance",
138  m_viscousTolerance,1e-12);
139  m_session->LoadParameter("MappingPressureRelaxation",
141  m_session->LoadParameter("MappingViscousRelaxation",
142  m_viscousRelaxation,1.0);
143 
144  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
NekDouble m_pressureTolerance
Definition: VCSMapping.h:88
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:49
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
ExtrapolateSharedPtr m_extrapolation
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
NekDouble m_viscousRelaxation
Definition: VCSMapping.h:91
IMEX 2nd order scheme using Backward Different Formula & Extrapolation.
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_presForcingCorrection
Definition: VCSMapping.h:123
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
IMEX 3rd order scheme using Backward Different Formula & Extrapolation.
LibUtilities::TimeIntegrationWrapperSharedPtr m_intScheme
Wrapper to the time integration scheme.
NekDouble m_viscousTolerance
Definition: VCSMapping.h:89
IMEX 4th order scheme using Backward Different Formula & Extrapolation.
virtual void v_InitObject()
Init object for UnsteadySystem class.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
IMEX 1st order scheme using Euler Backwards/Euler Forwards.
static GLOBAL_MAPPING_EXPORT MappingSharedPtr Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
Return a pointer to the mapping, creating it on first call.
Definition: Mapping.cpp:268
NekDouble m_pressureRelaxation
Definition: VCSMapping.h:90

◆ v_SetUpPressureForcing()

void Nektar::VCSMapping::v_SetUpPressureForcing ( const Array< OneD, const Array< OneD, NekDouble > > &  fields,
Array< OneD, Array< OneD, NekDouble > > &  Forcing,
const NekDouble  aii_Dt 
)
protectedvirtual

Forcing term for Poisson solver solver

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 241 of file VCSMapping.cpp.

References Nektar::MultiRegions::DirCartesianMap, Nektar::IncNavierStokes::m_extrapolation, Nektar::SolverUtils::EquationSystem::m_fields, m_implicitViscous, Nektar::IncNavierStokes::m_kinvis, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, m_presForcingCorrection, Vmath::Smul(), Nektar::VelocityCorrectionScheme::v_SetUpPressureForcing(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vdiv(), Vmath::Vmul(), Vmath::Vsub(), and Vmath::Zero().

245  {
246  if (m_mapping->HasConstantJacobian())
247  {
249  Forcing, aii_Dt);
250  }
251  else
252  {
253  int physTot = m_fields[0]->GetTotPoints();
254  int nvel = m_nConvectiveFields;
255  Array<OneD, NekDouble> wk(physTot, 0.0);
256 
257  Array<OneD, NekDouble> Jac(physTot,0.0);
258  m_mapping->GetJacobian(Jac);
259 
260  // Calculate div(J*u/Dt)
261  Vmath::Zero(physTot,Forcing[0],1);
262  for(int i = 0; i < nvel; ++i)
263  {
264  if (m_fields[i]->GetWaveSpace())
265  {
266  m_fields[i]->HomogeneousBwdTrans(fields[i],wk);
267  }
268  else
269  {
270  Vmath::Vcopy(physTot, fields[i], 1, wk, 1);
271  }
272  Vmath::Vmul(physTot,wk,1,Jac,1,wk,1);
273  if (m_fields[i]->GetWaveSpace())
274  {
275  m_fields[i]->HomogeneousFwdTrans(wk,wk);
276  }
277  m_fields[i]->PhysDeriv(MultiRegions::DirCartesianMap[i],wk, wk);
278  Vmath::Vadd(physTot,wk,1,Forcing[0],1,Forcing[0],1);
279  }
280  Vmath::Smul(physTot,1.0/aii_Dt,Forcing[0],1,Forcing[0],1);
281 
282  //
283  // If the mapping viscous terms are being treated explicitly
284  // we need to apply a correction to the forcing
285  if (!m_implicitViscous)
286  {
287  bool wavespace = m_fields[0]->GetWaveSpace();
288  m_fields[0]->SetWaveSpace(false);
289 
290  //
291  // Part 1: div(J*grad(U/J . grad(J)))
292  Array<OneD, Array<OneD, NekDouble> > tmp (nvel);
293  Array<OneD, Array<OneD, NekDouble> > velocity (nvel);
294  for(int i = 0; i < tmp.num_elements(); i++)
295  {
296  tmp[i] = Array<OneD, NekDouble>(physTot,0.0);
297  velocity[i] = Array<OneD, NekDouble>(physTot,0.0);
298  if (wavespace)
299  {
300  m_fields[0]->HomogeneousBwdTrans(m_fields[i]->GetPhys(),
301  velocity[i]);
302  }
303  else
304  {
305  Vmath::Vcopy(physTot, m_fields[i]->GetPhys(), 1,
306  velocity[i], 1);
307  }
308  }
309  // Calculate wk = U.grad(J)
310  m_mapping->DotGradJacobian(velocity, wk);
311  // Calculate wk = (U.grad(J))/J
312  Vmath::Vdiv(physTot, wk, 1, Jac, 1, wk, 1);
313  // J*grad[(U.grad(J))/J]
314  for(int i = 0; i < nvel; ++i)
315  {
316  m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[i],
317  wk, tmp[i]);
318  Vmath::Vmul(physTot, Jac, 1, tmp[i], 1, tmp[i], 1);
319  }
320  // div(J*grad[(U.grad(J))/J])
321  Vmath::Zero(physTot, wk, 1);
322  for(int i = 0; i < nvel; ++i)
323  {
324  m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[i],
325  tmp[i], tmp[i]);
326  Vmath::Vadd(physTot, wk, 1, tmp[i], 1, wk, 1);
327  }
328 
329  // Part 2: grad(J) . curl(curl(U))
330  m_mapping->CurlCurlField(velocity, tmp, m_implicitViscous);
331  // dont need velocity any more, so reuse it
332  m_mapping->DotGradJacobian(tmp, velocity[0]);
333 
334  // Add two parts
335  Vmath::Vadd(physTot, velocity[0], 1, wk, 1, wk, 1);
336 
337  // Multiply by kinvis and prepare to extrapolate
338  int nlevels = m_presForcingCorrection.num_elements();
339  Vmath::Smul(physTot, m_kinvis, wk, 1,
340  m_presForcingCorrection[nlevels-1], 1);
341 
342  // Extrapolate correction
343  m_extrapolation->ExtrapolateArray(m_presForcingCorrection);
344 
345  // Put in wavespace
346  if (wavespace)
347  {
348  m_fields[0]->HomogeneousFwdTrans(
349  m_presForcingCorrection[nlevels-1],wk);
350  }
351  else
352  {
353  Vmath::Vcopy(physTot, m_presForcingCorrection[nlevels-1], 1,
354  wk, 1);
355  }
356  // Apply correction: Forcing = Forcing - correction
357  Vmath::Vsub(physTot, Forcing[0], 1, wk, 1, Forcing[0], 1);
358 
359  m_fields[0]->SetWaveSpace(wavespace);
360  }
361  }
362  }
NekDouble m_kinvis
Kinematic viscosity.
ExtrapolateSharedPtr m_extrapolation
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
void Vdiv(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:244
int m_nConvectiveFields
Number of fields to be convected;.
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
Array< OneD, Array< OneD, NekDouble > > m_presForcingCorrection
Definition: VCSMapping.h:123
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:346
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:88
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:376
virtual void v_SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble > > &fields, Array< OneD, Array< OneD, NekDouble > > &Forcing, const NekDouble aii_Dt)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302
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

◆ v_SetUpViscousForcing()

void Nektar::VCSMapping::v_SetUpViscousForcing ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, Array< OneD, NekDouble > > &  Forcing,
const NekDouble  aii_Dt 
)
protectedvirtual

Forcing term for Helmholtz solver

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 367 of file VCSMapping.cpp.

References Blas::Daxpy(), Blas::Dscal(), Nektar::SolverUtils::EquationSystem::m_fields, m_gradP, m_implicitPressure, Nektar::IncNavierStokes::m_kinvis, m_mapping, Nektar::IncNavierStokes::m_pressure, Nektar::IncNavierStokes::m_velocity, Vmath::Vcopy(), and Vmath::Vdiv().

371  {
372  NekDouble aii_dtinv = 1.0/aii_Dt;
373  int physTot = m_fields[0]->GetTotPoints();
374 
375  // Grad p
376  m_pressure->BwdTrans(m_pressure->GetCoeffs(),m_pressure->UpdatePhys());
377 
378  int nvel = m_velocity.num_elements();
379  if(nvel == 2)
380  {
381  m_pressure->PhysDeriv(m_pressure->GetPhys(), Forcing[0], Forcing[1]);
382  }
383  else
384  {
385  m_pressure->PhysDeriv(m_pressure->GetPhys(), Forcing[0], Forcing[1],
386  Forcing[2]);
387  }
388 
389  // Copy grad p in physical space to m_gradP to reuse later
390  if (m_pressure->GetWaveSpace())
391  {
392  for (int i=0; i<nvel; i++)
393  {
394  m_pressure->HomogeneousBwdTrans(Forcing[i],m_gradP[i]);
395  }
396  }
397  else
398  {
399  for (int i=0; i<nvel; i++)
400  {
401  Vmath::Vcopy(physTot, Forcing[i], 1, m_gradP[i], 1);
402  }
403  }
404 
405  if ( (!m_mapping->HasConstantJacobian()) || m_implicitPressure)
406  {
407  // If pressure terms are treated explicitly, we need to divide by J
408  // if they are implicit, we need to calculate G(p)
409  if (m_implicitPressure)
410  {
411  m_mapping->RaiseIndex(m_gradP, Forcing);
412  }
413  else
414  {
415  Array<OneD, NekDouble> Jac(physTot,0.0);
416  m_mapping->GetJacobian(Jac);
417  for (int i=0; i<nvel; i++)
418  {
419  Vmath::Vdiv(physTot, m_gradP[i], 1, Jac, 1, Forcing[i], 1);
420  }
421  }
422  // Transform back to wavespace
423  if (m_pressure->GetWaveSpace())
424  {
425  for (int i=0; i<nvel; i++)
426  {
427  m_pressure->HomogeneousFwdTrans(Forcing[i],Forcing[i]);
428  }
429  }
430  }
431 
432  // Subtract inarray/(aii_dt) and divide by kinvis. Kinvis will
433  // need to be updated for the convected fields.
434  for(int i = 0; i < nvel; ++i)
435  {
436  Blas::Daxpy(physTot,-aii_dtinv,inarray[i],1,Forcing[i],1);
437  Blas::Dscal(physTot,1.0/m_kinvis,&(Forcing[i])[0],1);
438  }
439  }
NekDouble m_kinvis
Kinematic viscosity.
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
void Vdiv(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:244
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:94
double NekDouble
static void Dscal(const int &n, const double &alpha, double *x, const int &incx)
BLAS level 1: x = alpha x.
Definition: Blas.hpp:125
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
static void Daxpy(const int &n, const double &alpha, const double *x, const int &incx, const double *y, const int &incy)
BLAS level 1: y = alpha x plus y.
Definition: Blas.hpp:110
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ v_SolvePressure()

void Nektar::VCSMapping::v_SolvePressure ( const Array< OneD, NekDouble > &  Forcing)
protectedvirtual

Solve pressure system

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 444 of file VCSMapping.cpp.

References ASSERTL0, Nektar::MultiRegions::DirCartesianMap, Nektar::StdRegions::eFactorLambda, Nektar::IncNavierStokes::m_extrapolation, Nektar::SolverUtils::EquationSystem::m_fields, m_implicitPressure, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Nektar::IncNavierStokes::m_pressure, m_pressureRelaxation, m_pressureTolerance, Nektar::SolverUtils::EquationSystem::m_session, m_verbose, Vmath::Neg(), Nektar::NullFlagList, Vmath::Smul(), Nektar::VelocityCorrectionScheme::v_SolvePressure(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vmul(), and Vmath::Vsub().

446  {
447  if (!m_implicitPressure)
448  {
450  }
451  else
452  {
453  int physTot = m_fields[0]->GetTotPoints();
454  int nvel = m_nConvectiveFields;
455  bool converged = false; // flag to mark if system converged
456  int s = 0; // iteration counter
457  NekDouble error; // L2 error at current iteration
458  NekDouble forcing_L2 = 0.0; // L2 norm of F
459 
460  int maxIter;
461  m_session->LoadParameter("MappingMaxIter",maxIter,5000);
462 
463  // rhs of the equation at current iteration
464  Array< OneD, NekDouble> F_corrected(physTot, 0.0);
465  // Pressure field at previous iteration
466  Array<OneD, NekDouble> previous_iter (physTot, 0.0);
467  // Temporary variables
468  Array<OneD, Array<OneD, NekDouble> > wk1(nvel);
469  Array<OneD, Array<OneD, NekDouble> > wk2(nvel);
470  Array<OneD, Array<OneD, NekDouble> > gradP(nvel);
471  for(int i = 0; i < nvel; ++i)
472  {
473  wk1[i] = Array<OneD, NekDouble> (physTot, 0.0);
474  wk2[i] = Array<OneD, NekDouble> (physTot, 0.0);
475  gradP[i] = Array<OneD, NekDouble> (physTot, 0.0);
476  }
477 
478  // Jacobian
479  Array<OneD, NekDouble> Jac(physTot, 0.0);
480  m_mapping->GetJacobian(Jac);
481 
482  // Factors for Laplacian system
484  factors[StdRegions::eFactorLambda] = 0.0;
485 
486  m_pressure->BwdTrans(m_pressure->GetCoeffs(),
487  m_pressure->UpdatePhys());
488  forcing_L2 = m_pressure->L2(Forcing, wk1[0]);
489  while (!converged)
490  {
491  // Update iteration counter and set previous iteration field
492  // (use previous timestep solution for first iteration)
493  s++;
494  ASSERTL0(s < maxIter,
495  "VCSMapping exceeded maximum number of iterations.");
496 
497  Vmath::Vcopy(physTot, m_pressure->GetPhys(), 1,
498  previous_iter, 1);
499 
500  // Correct pressure bc to account for iteration
501  m_extrapolation->CorrectPressureBCs(previous_iter);
502 
503  //
504  // Calculate forcing term for this iteration
505  //
506  for(int i = 0; i < nvel; ++i)
507  {
509  previous_iter, gradP[i]);
510  if(m_pressure->GetWaveSpace())
511  {
512  m_pressure->HomogeneousBwdTrans(gradP[i], wk1[i]);
513  }
514  else
515  {
516  Vmath::Vcopy(physTot, gradP[i], 1, wk1[i], 1);
517  }
518  }
519  m_mapping->RaiseIndex(wk1, wk2); // G(p)
520 
521  m_mapping->Divergence(wk2, F_corrected); // div(G(p))
522  if (!m_mapping->HasConstantJacobian())
523  {
524  Vmath::Vmul(physTot, F_corrected, 1,
525  Jac, 1,
526  F_corrected, 1);
527  }
528  // alpha*J*div(G(p))
529  Vmath::Smul(physTot, m_pressureRelaxation, F_corrected, 1,
530  F_corrected, 1);
531  if(m_pressure->GetWaveSpace())
532  {
533  m_pressure->HomogeneousFwdTrans(F_corrected, F_corrected);
534  }
535  // alpha*J*div(G(p)) - p_ii
536  for (int i = 0; i < m_nConvectiveFields; ++i)
537  {
539  gradP[i], wk1[0]);
540  Vmath::Vsub(physTot, F_corrected, 1, wk1[0], 1,
541  F_corrected, 1);
542  }
543  // p_i,i - J*div(G(p))
544  Vmath::Neg(physTot, F_corrected, 1);
545  // alpha*F - alpha*J*div(G(p)) + p_i,i
546  Vmath::Smul(physTot, m_pressureRelaxation, Forcing, 1,
547  wk1[0], 1);
548  Vmath::Vadd(physTot, wk1[0], 1, F_corrected, 1, F_corrected, 1);
549 
550  //
551  // Solve system
552  //
553  m_pressure->HelmSolve(F_corrected, m_pressure->UpdateCoeffs(),
554  NullFlagList, factors);
555  m_pressure->BwdTrans(m_pressure->GetCoeffs(),
556  m_pressure->UpdatePhys());
557 
558  //
559  // Test convergence
560  //
561  error = m_pressure->L2(m_pressure->GetPhys(), previous_iter);
562  if ( forcing_L2 != 0)
563  {
564  if ( (error/forcing_L2 < m_pressureTolerance))
565  {
566  converged = true;
567  }
568  }
569  else
570  {
571  if ( error < m_pressureTolerance)
572  {
573  converged = true;
574  }
575  }
576  }
577  if (m_verbose && m_session->GetComm()->GetRank()==0)
578  {
579  std::cout << " Pressure system (mapping) converged in " << s <<
580  " iterations with error = " << error << std::endl;
581  }
582  }
583  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
NekDouble m_pressureTolerance
Definition: VCSMapping.h:88
ExtrapolateSharedPtr m_extrapolation
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
int m_nConvectiveFields
Number of fields to be convected;.
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
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:399
double NekDouble
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing)
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:346
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:88
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302
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
NekDouble m_pressureRelaxation
Definition: VCSMapping.h:90
static FlagList NullFlagList
An empty flag list.

◆ v_SolveViscous()

void Nektar::VCSMapping::v_SolveViscous ( const Array< OneD, const Array< OneD, NekDouble > > &  Forcing,
Array< OneD, Array< OneD, NekDouble > > &  outarray,
const NekDouble  aii_Dt 
)
protectedvirtual

Solve velocity system

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 588 of file VCSMapping.cpp.

References ASSERTL0, Nektar::StdRegions::eFactorLambda, Nektar::StdRegions::eFactorSVVCutoffRatio, Nektar::StdRegions::eFactorSVVDiffCoeff, Nektar::SolverUtils::EquationSystem::m_fields, m_implicitViscous, Nektar::IncNavierStokes::m_kinvis, m_mapping, Nektar::IncNavierStokes::m_nConvectiveFields, Nektar::SolverUtils::EquationSystem::m_session, Nektar::VelocityCorrectionScheme::m_sVVCutoffRatio, Nektar::VelocityCorrectionScheme::m_sVVDiffCoeff, Nektar::VelocityCorrectionScheme::m_useSpecVanVisc, m_verbose, m_viscousRelaxation, m_viscousTolerance, Nektar::NullFlagList, Vmath::Smul(), Nektar::VelocityCorrectionScheme::v_SolveViscous(), Vmath::Vadd(), and Vmath::Vcopy().

592  {
593  if(!m_implicitViscous)
594  {
595  VelocityCorrectionScheme::v_SolveViscous(Forcing, outarray, aii_Dt);
596  }
597  else
598  {
599  int physTot = m_fields[0]->GetTotPoints();
600  int nvel = m_nConvectiveFields;
601  bool converged = false; // flag to mark if system converged
602  int s = 0; // iteration counter
603  NekDouble error, max_error; // L2 error at current iteration
604 
605  int maxIter;
606  m_session->LoadParameter("MappingMaxIter",maxIter,5000);
607 
608  //L2 norm of F
609  Array<OneD, NekDouble> forcing_L2(m_nConvectiveFields,0.0);
610 
611  // rhs of the equation at current iteration
612  Array<OneD, Array<OneD, NekDouble> > F_corrected(nvel);
613  // Solution at previous iteration
614  Array<OneD, Array<OneD, NekDouble> > previous_iter(nvel);
615  // Working space
616  Array<OneD, Array<OneD, NekDouble> > wk(nvel);
617  for(int i = 0; i < nvel; ++i)
618  {
619  F_corrected[i] = Array<OneD, NekDouble> (physTot, 0.0);
620  previous_iter[i] = Array<OneD, NekDouble> (physTot, 0.0);
621  wk[i] = Array<OneD, NekDouble> (physTot, 0.0);
622  }
623 
624  // Factors for Helmholtz system
626  factors[StdRegions::eFactorLambda] =
627  1.0*m_viscousRelaxation/aii_Dt/m_kinvis;
628  if(m_useSpecVanVisc)
629  {
633  }
634 
635  // Calculate L2-norm of F and set initial solution for iteration
636  for(int i = 0; i < nvel; ++i)
637  {
638  forcing_L2[i] = m_fields[0]->L2(Forcing[i],wk[0]);
639  m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
640  previous_iter[i]);
641  }
642 
643  while (!converged)
644  {
645  converged = true;
646  // Iteration counter
647  s++;
648  ASSERTL0(s < maxIter,
649  "VCSMapping exceeded maximum number of iterations.");
650 
651  max_error = 0.0;
652 
653  //
654  // Calculate forcing term for next iteration
655  //
656 
657  // Calculate L(U)- in this parts all components might be coupled
658  if(m_fields[0]->GetWaveSpace())
659  {
660  for (int i = 0; i < nvel; ++i)
661  {
662  m_fields[0]->HomogeneousBwdTrans(previous_iter[i],
663  wk[i]);
664  }
665  }
666  else
667  {
668  for (int i = 0; i < nvel; ++i)
669  {
670  Vmath::Vcopy(physTot, previous_iter[i], 1, wk[i], 1);
671  }
672  }
673 
674  // (L(U^i) - 1/alpha*U^i_jj)
675  m_mapping->VelocityLaplacian(wk, F_corrected,
676  1.0/m_viscousRelaxation);
677 
678  if(m_fields[0]->GetWaveSpace())
679  {
680  for (int i = 0; i < nvel; ++i)
681  {
682  m_fields[0]->HomogeneousFwdTrans(F_corrected[i],
683  F_corrected[i]);
684  }
685  }
686  else
687  {
688  for (int i = 0; i < nvel; ++i)
689  {
690  Vmath::Vcopy(physTot, F_corrected[i], 1,
691  F_corrected[i], 1);
692  }
693  }
694 
695  // Loop velocity components
696  for (int i = 0; i < nvel; ++i)
697  {
698  // (-alpha*L(U^i) + U^i_jj)
699  Vmath::Smul(physTot, -1.0*m_viscousRelaxation,
700  F_corrected[i], 1,
701  F_corrected[i], 1);
702  // F_corrected = alpha*F + (-alpha*L(U^i) + U^i_jj)
703  Vmath::Smul(physTot, m_viscousRelaxation, Forcing[i], 1,
704  wk[0], 1);
705  Vmath::Vadd(physTot, wk[0], 1, F_corrected[i], 1,
706  F_corrected[i], 1);
707 
708  //
709  // Solve System
710  //
711  m_fields[i]->HelmSolve(F_corrected[i],
712  m_fields[i]->UpdateCoeffs(),
713  NullFlagList, factors);
714  m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),outarray[i]);
715 
716  //
717  // Test convergence
718  //
719  error = m_fields[i]->L2(outarray[i], previous_iter[i]);
720 
721  if ( forcing_L2[i] != 0)
722  {
723  if ( (error/forcing_L2[i] >= m_viscousTolerance))
724  {
725  converged = false;
726  }
727  }
728  else
729  {
730  if ( error >= m_viscousTolerance)
731  {
732  converged = false;
733  }
734  }
735  if (error > max_error)
736  {
737  max_error = error;
738  }
739 
740  // Copy field to previous_iter
741  Vmath::Vcopy(physTot, outarray[i], 1, previous_iter[i], 1);
742  }
743  }
744  if (m_verbose && m_session->GetComm()->GetRank()==0)
745  {
746  std::cout << " Velocity system (mapping) converged in " << s <<
747  " iterations with error = " << max_error << std::endl;
748  }
749  }
750  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
NekDouble m_kinvis
Kinematic viscosity.
NekDouble m_sVVDiffCoeff
Diffusion coefficient of SVV modes.
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:77
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
int m_nConvectiveFields
Number of fields to be convected;.
NekDouble m_viscousRelaxation
Definition: VCSMapping.h:91
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
virtual void v_SolveViscous(const Array< OneD, const Array< OneD, NekDouble > > &Forcing, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble aii_Dt)
NekDouble m_sVVCutoffRatio
cutt off ratio from which to start decayhing modes
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
bool m_useSpecVanVisc
bool to identify if spectral vanishing viscosity is active.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
NekDouble m_viscousTolerance
Definition: VCSMapping.h:89
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:302
static FlagList NullFlagList
An empty flag list.

Member Data Documentation

◆ className

string Nektar::VCSMapping::className
static
Initial value:

Name of class.

Definition at line 59 of file VCSMapping.h.

◆ m_gradP

Array<OneD, Array<OneD, NekDouble> > Nektar::VCSMapping::m_gradP
protected

Definition at line 94 of file VCSMapping.h.

Referenced by MappingPressureCorrection(), v_DoInitialise(), and v_SetUpViscousForcing().

◆ m_implicitPressure

bool Nektar::VCSMapping::m_implicitPressure
protected

◆ m_implicitViscous

bool Nektar::VCSMapping::m_implicitViscous
protected

◆ m_mapping

GlobalMapping::MappingSharedPtr Nektar::VCSMapping::m_mapping
protected

◆ m_neglectViscous

bool Nektar::VCSMapping::m_neglectViscous
protected

Definition at line 85 of file VCSMapping.h.

Referenced by ApplyIncNSMappingForcing(), and v_InitObject().

◆ m_presForcingCorrection

Array<OneD, Array<OneD, NekDouble> > Nektar::VCSMapping::m_presForcingCorrection
private

Definition at line 123 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SetUpPressureForcing().

◆ m_pressureRelaxation

NekDouble Nektar::VCSMapping::m_pressureRelaxation
protected

Definition at line 90 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolvePressure().

◆ m_pressureTolerance

NekDouble Nektar::VCSMapping::m_pressureTolerance
protected

Definition at line 88 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolvePressure().

◆ m_verbose

bool Nektar::VCSMapping::m_verbose
protected

Definition at line 79 of file VCSMapping.h.

Referenced by v_InitObject(), v_SolvePressure(), and v_SolveViscous().

◆ m_viscousRelaxation

NekDouble Nektar::VCSMapping::m_viscousRelaxation
protected

Definition at line 91 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolveViscous().

◆ m_viscousTolerance

NekDouble Nektar::VCSMapping::m_viscousTolerance
protected

Definition at line 89 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolveViscous().