Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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:
Inheritance graph
[legend]
Collaboration diagram for Nektar::VCSMapping:
Collaboration graph
[legend]

Public Member Functions

 VCSMapping (const LibUtilities::SessionReaderSharedPtr &pSession)
 Constructor. More...
 
void ApplyIncNSMappingForcing (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)
 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 ()
 
virtual void v_GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
virtual void v_NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
 
int GetNConvectiveFields (void)
 
Array< OneD, int > & GetVelocity (void)
 
Array< OneD, NekDoubleGetElmtCFLVals (void)
 
NekDouble GetCFLEstimate (int &elmtid)
 
void AddForcing (const SolverUtils::ForcingSharedPtr &pForce)
 
- Public Member Functions inherited from Nektar::SolverUtils::AdvectionSystem
SOLVER_UTILS_EXPORT AdvectionSystem (const LibUtilities::SessionReaderSharedPtr &pSession)
 
virtual SOLVER_UTILS_EXPORT ~AdvectionSystem ()
 
AdvectionSharedPtr GetAdvObject ()
 Returns the advection object held by this instance. More...
 
- 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 >
boost::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 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 void EvaluateFunction (Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
 Evaluates a function as specified in the session file. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::vector< std::string > pFieldNames, Array< OneD, Array< OneD, NekDouble > > &pFields, const std::string &pName, const NekDouble &pTime=0.0, const int domain=0)
 Populate given fields with the function from session. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::vector< std::string > pFieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const std::string &pName, const NekDouble &pTime=0.0, const int domain=0)
 Populate given fields with the function from session. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, const NekDouble &pTime=0.0, const int domain=0)
 
SOLVER_UTILS_EXPORT std::string DescribeFunction (std::string pFieldName, const std::string &pFunctionName, const int domain)
 Provide a description of a function for a given field name. More...
 
SOLVER_UTILS_EXPORT void InitialiseBaseFlow (Array< OneD, Array< OneD, NekDouble > > &base)
 Perform initialisation of the base flow. 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, NekDouble
ErrorExtraPoints (unsigned int field)
 Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf]. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm (const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
 Compute the inner product $ (\nabla \phi \cdot F) $. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionDivergenceForm (const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
 Compute the inner product $ (\phi, \nabla \cdot F) $. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionNonConservativeForm (const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, bool UseContCoeffs=false)
 Compute the inner product $ (\phi, V\cdot \nabla u) $. More...
 
f SOLVER_UTILS_EXPORT void AdvectionNonConservativeForm (const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
 Compute the non-conservative advection. More...
 
SOLVER_UTILS_EXPORT void WeakDGAdvection (const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false, int nvariables=0)
 Calculate the weak discontinuous Galerkin advection. More...
 
SOLVER_UTILS_EXPORT void WeakDGDiffusion (const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false)
 Calculate weak DG Diffusion in the LDG form. 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 ScanForHistoryPoints ()
 Builds map of which element holds each history point. More...
 
SOLVER_UTILS_EXPORT void WriteHistoryData (std::ostream &out)
 Probe each history point and write to 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::FieldMetaDataMap
UpdateFieldMetaDataMap ()
 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 GetNumElmVelocity ()
 
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 GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &fluxX, Array< OneD, Array< OneD, NekDouble > > &fluxY)
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, const int j, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
SOLVER_UTILS_EXPORT void NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
 
SOLVER_UTILS_EXPORT void NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
SOLVER_UTILS_EXPORT void NumFluxforScalar (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
SOLVER_UTILS_EXPORT void NumFluxforVector (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
SOLVER_UTILS_EXPORT void SetModifiedBasis (const bool modbasis)
 
SOLVER_UTILS_EXPORT int NoCaseStringCompare (const std::string &s1, const std::string &s2)
 Perform a case-insensitive string comparison. More...
 
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)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::VelocityCorrectionScheme
static
SolverUtils::EquationSystemSharedPtr 
create (const LibUtilities::SessionReaderSharedPtr &pSession)
 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
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 ()
 
- Protected Member Functions inherited from Nektar::IncNavierStokes
 IncNavierStokes (const LibUtilities::SessionReaderSharedPtr &pSession)
 Constructor. More...
 
EquationType GetEquationType (void)
 
void EvaluateAdvectionTerms (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
 
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...
 
bool CalcSteadyState (void)
 evaluate steady state More...
 
virtual
MultiRegions::ExpListSharedPtr 
v_GetPressure ()
 
virtual bool v_PreIntegrate (int step)
 
virtual bool v_PostIntegrate (int step)
 
- Protected Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT UnsteadySystem (const LibUtilities::SessionReaderSharedPtr &pSession)
 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 void v_NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
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_SteadyStateCheck (int step)
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time)
 
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)
 Initialises EquationSystem class members. More...
 
int nocase_cmp (const std::string &s1, const std::string &s2)
 
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)
 
SOLVER_UTILS_EXPORT void SetUpBaseFields (SpatialDomains::MeshGraphSharedPtr &mesh)
 
SOLVER_UTILS_EXPORT void ImportFldBase (std::string pInfile, SpatialDomains::MeshGraphSharedPtr pGraph)
 
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...
 
Array< OneD, NekDoublem_saved_aii_Dt
 Save aiiDt value to use as a trip to reset global matrix setup. More...
 
StdRegions::VarCoeffMap m_varCoeffLap
 Variable Coefficient map for the Laplacian which can be activated as part of SVV or otherwise. More...
 
- 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::ForcingSharedPtr
m_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...
 
int m_cflsteps
 dump cfl estimate More...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
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...
 
- 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...
 
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...
 
std::vector< int > m_intVariables
 
std::vector< FilterSharedPtrm_filters
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
std::map< std::string, Array
< OneD, Array< OneD, float > > > 
m_interpWeights
 Map of the interpolation weights for a specific filename. More...
 
std::map< std::string, Array
< OneD, Array< OneD, unsigned
int > > > 
m_interpInds
 Map of the interpolation indices for a specific filename. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_fields
 Array holding all dependent variables. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_base
 Base fields. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_derivedfields
 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...
 
std::set< std::string > m_loadedFields
 
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, Array< OneD,
Array< OneD, NekDouble > > > 
m_gradtan
 1 x nvariable x nq More...
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_tanbasis
 2 x m_spacedim x nq 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, Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void MappingAccelerationCorrection (const Array< OneD, Array< OneD, NekDouble > > &vel, const Array< OneD, Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void MappingPressureCorrection (Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void MappingViscousCorrection (const Array< OneD, 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...
 

Detailed Description

Definition at line 44 of file VCSMapping.h.

Constructor & Destructor Documentation

Nektar::VCSMapping::VCSMapping ( const LibUtilities::SessionReaderSharedPtr pSession)

Constructor.

Constructor. Creates ...

Parameters
param

Definition at line 57 of file VCSMapping.cpp.

59  : UnsteadySystem(pSession),
60  VelocityCorrectionScheme(pSession)
61  {
62 
63  }
VelocityCorrectionScheme(const LibUtilities::SessionReaderSharedPtr &pSession)
Constructor.
SOLVER_UTILS_EXPORT UnsteadySystem(const LibUtilities::SessionReaderSharedPtr &pSession)
Initialises UnsteadySystem class members.
Nektar::VCSMapping::~VCSMapping ( void  )
virtual

Destructor

Definition at line 143 of file VCSMapping.cpp.

144  {
145  }

Member Function Documentation

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

Explicit terms of the mapping

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

743  {
744  int physTot = m_fields[0]->GetTotPoints();
745  Array<OneD, Array<OneD, NekDouble> > vel(m_nConvectiveFields);
746  Array<OneD, Array<OneD, NekDouble> > velPhys(m_nConvectiveFields);
747  Array<OneD, Array<OneD, NekDouble> > Forcing(m_nConvectiveFields);
748  Array<OneD, Array<OneD, NekDouble> > tmp(m_nConvectiveFields);
749  for (int i = 0; i < m_nConvectiveFields; ++i)
750  {
751  velPhys[i] = Array<OneD, NekDouble> (physTot, 0.0);
752  Forcing[i] = Array<OneD, NekDouble> (physTot, 0.0);
753  tmp[i] = Array<OneD, NekDouble> (physTot, 0.0);
754  }
755 
756  // Get fields and store velocity in wavespace and physical space
757  if(m_fields[0]->GetWaveSpace())
758  {
759  for (int i = 0; i < m_nConvectiveFields; ++i)
760  {
761  vel[i] = m_fields[i]->GetPhys();
762  m_fields[0]->HomogeneousBwdTrans(vel[i],velPhys[i]);
763  }
764  }
765  else
766  {
767  for (int i = 0; i < m_nConvectiveFields; ++i)
768  {
769  vel[i] = m_fields[i]->GetPhys();
770  Vmath::Vcopy(physTot, m_fields[i]->GetPhys(), 1, velPhys[i], 1);
771  }
772  }
773 
774  //Advection contribution
775  MappingAdvectionCorrection(velPhys, Forcing);
776 
777  // Time-derivative contribution
778  if ( m_mapping->IsTimeDependent() )
779  {
780  MappingAccelerationCorrection(vel, velPhys, tmp);
781  for (int i = 0; i < m_nConvectiveFields; ++i)
782  {
783  Vmath::Vadd(physTot, tmp[i], 1, Forcing[i], 1, Forcing[i], 1);
784  }
785  }
786 
787  // Pressure contribution
788  if (!m_implicitPressure)
789  {
791  for (int i = 0; i < m_nConvectiveFields; ++i)
792  {
793  Vmath::Vadd(physTot, tmp[i], 1, Forcing[i], 1, Forcing[i], 1);
794  }
795  }
796  // Viscous contribution
797  if ( (!m_implicitViscous) && (!m_neglectViscous))
798  {
799  MappingViscousCorrection(velPhys, tmp);
800  for (int i = 0; i < m_nConvectiveFields; ++i)
801  {
802  Vmath::Smul(physTot, m_kinvis, tmp[i], 1, tmp[i], 1);
803  Vmath::Vadd(physTot, tmp[i], 1, Forcing[i], 1, Forcing[i], 1);
804  }
805  }
806 
807  // If necessary, transform to wavespace
808  if(m_fields[0]->GetWaveSpace())
809  {
810  for (int i = 0; i < m_nConvectiveFields; ++i)
811  {
812  m_fields[0]->HomogeneousFwdTrans(Forcing[i],Forcing[i]);
813  }
814  }
815 
816  // Add to outarray
817  for (int i = 0; i < m_nConvectiveFields; ++i)
818  {
819  Vmath::Vadd(physTot, outarray[i], 1, Forcing[i], 1, outarray[i], 1);
820  }
821  }
NekDouble m_kinvis
Kinematic viscosity.
void MappingAccelerationCorrection(const Array< OneD, Array< OneD, NekDouble > > &vel, const Array< OneD, Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:848
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
int m_nConvectiveFields
Number of fields to be convected;.
void MappingViscousCorrection(const Array< OneD, Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:954
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:199
void MappingAdvectionCorrection(const Array< OneD, Array< OneD, NekDouble > > &velPhys, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:823
void MappingPressureCorrection(Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:927
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:1047
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:285
static SolverUtils::EquationSystemSharedPtr Nektar::VCSMapping::create ( const LibUtilities::SessionReaderSharedPtr pSession)
inlinestatic

Creates an instance of this class.

Definition at line 49 of file VCSMapping.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

50  {
53  AllocateSharedPtr(pSession);
54  p->InitObject();
55  return p;
56  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
void Nektar::VCSMapping::MappingAccelerationCorrection ( const Array< OneD, Array< OneD, NekDouble > > &  vel,
const Array< OneD, Array< OneD, NekDouble > > &  velPhys,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

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

852  {
853  int physTot = m_fields[0]->GetTotPoints();
854  int nvel = m_nConvectiveFields;
855 
856  Array<OneD, Array<OneD, NekDouble> > wk(nvel*nvel);
857  Array<OneD, Array<OneD, NekDouble> > tmp(nvel);
858  Array<OneD, Array<OneD, NekDouble> > coordVel(nvel);
859  for (int i = 0; i< nvel; i++)
860  {
861  tmp[i] = Array<OneD, NekDouble> (physTot, 0.0);
862  coordVel[i] = Array<OneD, NekDouble> (physTot, 0.0);
863  }
864  // Get coordinates velocity in transformed system
865  m_mapping->GetCoordVelocity(tmp);
866  m_mapping->ContravarFromCartesian(tmp, coordVel);
867 
868  // Calculate first term: U^j u^i,j = U^j (du^i/dx^j + {i,kj}u^k)
869  m_mapping->ApplyChristoffelContravar(velPhys, wk);
870  for (int i=0; i< nvel; i++)
871  {
872  Vmath::Zero(physTot,outarray[i],1);
873 
874  m_fields[0]->PhysDeriv(velPhys[i], tmp[0], tmp[1]);
875  for (int j=0; j< nvel; j++)
876  {
877  if (j == 2)
878  {
879  m_fields[0]->PhysDeriv(MultiRegions::DirCartesianMap[j],
880  vel[i], tmp[2]);
881  if (m_fields[0]->GetWaveSpace())
882  {
883  m_fields[0]->HomogeneousBwdTrans(tmp[2],tmp[2]);
884  }
885  }
886 
887  Vmath::Vadd(physTot,wk[i*nvel+j],1,tmp[j],1,
888  wk[i*nvel+j], 1);
889 
890  Vmath::Vvtvp(physTot, coordVel[j], 1, wk[i*nvel+j], 1,
891  outarray[i], 1, outarray[i], 1);
892  }
893  }
894 
895  // Set wavespace to false and store current value
896  bool wavespace = m_fields[0]->GetWaveSpace();
897  m_fields[0]->SetWaveSpace(false);
898 
899  // Add -u^j U^i,j
900  m_mapping->ApplyChristoffelContravar(coordVel, wk);
901  for (int i=0; i< nvel; i++)
902  {
903  if(nvel == 2)
904  {
905  m_fields[0]->PhysDeriv(coordVel[i], tmp[0], tmp[1]);
906  }
907  else
908  {
909  m_fields[0]->PhysDeriv(coordVel[i], tmp[0], tmp[1], tmp[2]);
910  }
911 
912  for (int j=0; j< nvel; j++)
913  {
914  Vmath::Vadd(physTot,wk[i*nvel+j],1,tmp[j],1,
915  wk[i*nvel+j], 1);
916  Vmath::Neg(physTot, wk[i*nvel+j], 1);
917 
918  Vmath::Vvtvp(physTot, velPhys[j], 1, wk[i*nvel+j], 1,
919  outarray[i], 1, outarray[i], 1);
920  }
921  }
922 
923  // Restore value of wavespace
924  m_fields[0]->SetWaveSpace(wavespace);
925  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
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:428
int m_nConvectiveFields
Number of fields to be convected;.
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:86
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:359
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:285
void Nektar::VCSMapping::MappingAdvectionCorrection ( const Array< OneD, Array< OneD, NekDouble > > &  velPhys,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

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

826  {
827  int physTot = m_fields[0]->GetTotPoints();
828  int nvel = m_nConvectiveFields;
829 
830  Array<OneD, Array<OneD, NekDouble> > wk(nvel*nvel);
831 
832  // Apply Christoffel symbols to obtain {i,kj}vel(k)
833  m_mapping->ApplyChristoffelContravar(velPhys, wk);
834 
835  // Calculate correction -U^j*{i,kj}vel(k)
836  for (int i = 0; i< nvel; i++)
837  {
838  Vmath::Zero(physTot,outarray[i],1);
839  for (int j = 0; j< nvel; j++)
840  {
841  Vmath::Vvtvp(physTot,wk[i*nvel+j],1,velPhys[j],1,
842  outarray[i],1,outarray[i],1);
843  }
844  Vmath::Neg(physTot, outarray[i], 1);
845  }
846  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
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:428
int m_nConvectiveFields
Number of fields to be convected;.
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
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:359
void Nektar::VCSMapping::MappingPressureCorrection ( Array< OneD, Array< OneD, NekDouble > > &  outarray)
private

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

929  {
930  int physTot = m_fields[0]->GetTotPoints();
931  int nvel = m_nConvectiveFields;
932 
933  // Calculate g^(ij)p_(,j)
934  m_mapping->RaiseIndex(m_gradP, outarray);
935 
936  // Calculate correction = (nabla p)/J - g^(ij)p_,j
937  // (Jac is not required if it is constant)
938  if ( !m_mapping->HasConstantJacobian())
939  {
940  Array<OneD, NekDouble> Jac(physTot, 0.0);
941  m_mapping->GetJacobian(Jac);
942  for(int i = 0; i < nvel; ++i)
943  {
944  Vmath::Vdiv(physTot, m_gradP[i], 1, Jac, 1, m_gradP[i], 1);
945  }
946  }
947  for(int i = 0; i < nvel; ++i)
948  {
949  Vmath::Vsub(physTot, m_gradP[i], 1,outarray[i], 1,
950  outarray[i],1);
951  }
952  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
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:227
int m_nConvectiveFields
Number of fields to be convected;.
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:92
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:329
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::VCSMapping::MappingViscousCorrection ( const Array< OneD, Array< OneD, NekDouble > > &  velPhys,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

Definition at line 954 of file VCSMapping.cpp.

References m_mapping.

Referenced by ApplyIncNSMappingForcing().

957  {
958  // L(U) - 1.0*d^2(u^i)/dx^jdx^j
959  m_mapping->VelocityLaplacian(velPhys, outarray, 1.0);
960  }
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
void Nektar::VCSMapping::v_DoInitialise ( void  )
protectedvirtual

Sets up initial conditions.

Sets the initial conditions.

Reimplemented from Nektar::VelocityCorrectionScheme.

Definition at line 147 of file VCSMapping.cpp.

References Nektar::MultiRegions::DirCartesianMap, 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().

148  {
150 
151  // Set up Field Meta Data for output files
152  m_fieldMetaDataMap["Kinvis"] =
153  boost::lexical_cast<std::string>(m_kinvis);
154  m_fieldMetaDataMap["TimeStep"] =
155  boost::lexical_cast<std::string>(m_timestep);
156 
157  // Correct Dirichlet boundary conditions to account for mapping
158  m_mapping->UpdateBCs(0.0);
159  //
160  for(int i = 0; i < m_nConvectiveFields; ++i)
161  {
162  m_fields[i]->LocalToGlobal();
163  m_fields[i]->ImposeDirichletConditions(m_fields[i]->UpdateCoeffs());
164  m_fields[i]->GlobalToLocal();
165  m_fields[i]->BwdTrans(m_fields[i]->GetCoeffs(),
166  m_fields[i]->UpdatePhys());
167  }
168 
169  // Initialise m_gradP
170  int physTot = m_fields[0]->GetTotPoints();
171  m_gradP = Array<OneD, Array<OneD, NekDouble> >(m_nConvectiveFields);
172  for(int i = 0; i < m_nConvectiveFields; ++i)
173  {
174  m_gradP[i] = Array<OneD, NekDouble>(physTot,0.0);
176  m_pressure->GetPhys(),
177  m_gradP[i]);
178  if(m_pressure->GetWaveSpace())
179  {
180  m_pressure->HomogeneousBwdTrans(m_gradP[i],m_gradP[i]);
181  }
182  }
183  }
NekDouble m_kinvis
Kinematic viscosity.
NekDouble m_timestep
Time step size.
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
int m_nConvectiveFields
Number of fields to be convected;.
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:92
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
Map to identify relevant solver info to dump in output fields.
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:86
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.
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 188 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, and Nektar::IncNavierStokes::m_SmoothAdvection.

192  {
193  // Update mapping and Deal with Dirichlet boundary conditions
194  if (m_mapping->IsTimeDependent())
195  {
196  if (m_mapping->IsFromFunction())
197  {
198  // If the transformation is explicitly defined, update it here
199  // Otherwise, it will be done somewhere else (ForcingMovingBody)
200  m_mapping->UpdateMapping(time);
201  }
202  m_mapping->UpdateBCs(time);
203  }
204 
205  EvaluateAdvectionTerms(inarray, outarray);
206 
207  // Smooth advection
209  {
210  for(int i = 0; i < m_nConvectiveFields; ++i)
211  {
212  m_pressure->SmoothField(outarray[i]);
213  }
214  }
215 
216  // Add forcing terms
217  std::vector<SolverUtils::ForcingSharedPtr>::const_iterator x;
218  for (x = m_forcing.begin(); x != m_forcing.end(); ++x)
219  {
220  (*x)->Apply(m_fields, inarray, outarray, time);
221  }
222 
223  // Add mapping terms
224  ApplyIncNSMappingForcing( outarray );
225 
226  // Calculate High-Order pressure boundary conditions
227  m_extrapolation->EvaluatePressureBCs(inarray,outarray,m_kinvis);
228  }
void ApplyIncNSMappingForcing(Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: VCSMapping.cpp:741
NekDouble m_kinvis
Kinematic viscosity.
ExtrapolateSharedPtr m_extrapolation
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
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
void EvaluateAdvectionTerms(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
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, >::CreateInstance(), Nektar::LibUtilities::eIMEXOrder1, Nektar::LibUtilities::eIMEXOrder2, Nektar::LibUtilities::eIMEXOrder3, 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();
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;
97  {
98  intSteps = 2;
99  }
100  break;
102  {
103  intSteps = 3;
104  }
105  break;
106  }
107  m_presForcingCorrection= Array<OneD, Array<OneD, NekDouble> >(intSteps);
108  for(int i = 0; i < m_presForcingCorrection.num_elements(); i++)
109  {
110  m_presForcingCorrection[i] = Array<OneD, NekDouble>(physTot,0.0);
111  }
112  m_verbose = (m_session->DefinesCmdLineArgument("verbose"))? true :false;
113 
114  // Load solve parameters related to the mapping
115  // Flags determining if pressure/viscous terms should be treated implicitly
116  m_session->MatchSolverInfo("MappingImplicitPressure","True",
117  m_implicitPressure,false);
118  m_session->MatchSolverInfo("MappingImplicitViscous","True",
119  m_implicitViscous,false);
120  m_session->MatchSolverInfo("MappingNeglectViscous","True",
121  m_neglectViscous,false);
122 
123  if (m_neglectViscous)
124  {
125  m_implicitViscous = false;
126  }
127 
128  // Tolerances and relaxation parameters for implicit terms
129  m_session->LoadParameter("MappingPressureTolerance",
130  m_pressureTolerance,1e-12);
131  m_session->LoadParameter("MappingViscousTolerance",
132  m_viscousTolerance,1e-12);
133  m_session->LoadParameter("MappingPressureRelaxation",
135  m_session->LoadParameter("MappingViscousRelaxation",
136  m_viscousRelaxation,1.0);
137 
138  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
NekDouble m_pressureTolerance
Definition: VCSMapping.h:86
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:50
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:75
NekDouble m_viscousRelaxation
Definition: VCSMapping.h:89
IMEX 2nd order scheme using Backward Different Formula & Extrapolation.
Array< OneD, Array< OneD, NekDouble > > m_presForcingCorrection
Definition: VCSMapping.h:121
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:87
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:266
NekDouble m_pressureRelaxation
Definition: VCSMapping.h:88
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 234 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().

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

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

357  {
358  NekDouble aii_dtinv = 1.0/aii_Dt;
359  int physTot = m_fields[0]->GetTotPoints();
360 
361  // Grad p
362  m_pressure->BwdTrans(m_pressure->GetCoeffs(),m_pressure->UpdatePhys());
363 
364  int nvel = m_velocity.num_elements();
365  if(nvel == 2)
366  {
367  m_pressure->PhysDeriv(m_pressure->GetPhys(), Forcing[0], Forcing[1]);
368  }
369  else
370  {
371  m_pressure->PhysDeriv(m_pressure->GetPhys(), Forcing[0], Forcing[1],
372  Forcing[2]);
373  }
374 
375  // Copy grad p in physical space to m_gradP to reuse later
376  if (m_pressure->GetWaveSpace())
377  {
378  for (int i=0; i<nvel; i++)
379  {
380  m_pressure->HomogeneousBwdTrans(Forcing[i],m_gradP[i]);
381  }
382  }
383  else
384  {
385  for (int i=0; i<nvel; i++)
386  {
387  Vmath::Vcopy(physTot, Forcing[i], 1, m_gradP[i], 1);
388  }
389  }
390 
391  if ( (!m_mapping->HasConstantJacobian()) || m_implicitPressure)
392  {
393  // If pressure terms are treated explicitly, we need to divide by J
394  // if they are implicit, we need to calculate G(p)
395  if (m_implicitPressure)
396  {
397  m_mapping->RaiseIndex(m_gradP, Forcing);
398  }
399  else
400  {
401  Array<OneD, NekDouble> Jac(physTot,0.0);
402  m_mapping->GetJacobian(Jac);
403  for (int i=0; i<nvel; i++)
404  {
405  Vmath::Vdiv(physTot, m_gradP[i], 1, Jac, 1, Forcing[i], 1);
406  }
407  }
408  // Transform back to wavespace
409  if (m_pressure->GetWaveSpace())
410  {
411  for (int i=0; i<nvel; i++)
412  {
413  m_pressure->HomogeneousFwdTrans(Forcing[i],Forcing[i]);
414  }
415  }
416  }
417 
418  // Subtract inarray/(aii_dt) and divide by kinvis. Kinvis will
419  // need to be updated for the convected fields.
420  for(int i = 0; i < nvel; ++i)
421  {
422  Blas::Daxpy(physTot,-aii_dtinv,inarray[i],1,Forcing[i],1);
423  Blas::Dscal(physTot,1.0/m_kinvis,&(Forcing[i])[0],1);
424  }
425  }
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:75
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:227
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:92
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
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:1047
void Nektar::VCSMapping::v_SolvePressure ( const Array< OneD, NekDouble > &  Forcing)
protectedvirtual

Solve pressure system

Reimplemented from Nektar::VelocityCorrectionScheme.

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

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

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

Member Data Documentation

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

Name of class.

Definition at line 59 of file VCSMapping.h.

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

Definition at line 92 of file VCSMapping.h.

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

bool Nektar::VCSMapping::m_implicitPressure
protected
bool Nektar::VCSMapping::m_implicitViscous
protected
GlobalMapping::MappingSharedPtr Nektar::VCSMapping::m_mapping
protected
bool Nektar::VCSMapping::m_neglectViscous
protected

Definition at line 83 of file VCSMapping.h.

Referenced by ApplyIncNSMappingForcing(), and v_InitObject().

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

Definition at line 121 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SetUpPressureForcing().

NekDouble Nektar::VCSMapping::m_pressureRelaxation
protected

Definition at line 88 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolvePressure().

NekDouble Nektar::VCSMapping::m_pressureTolerance
protected

Definition at line 86 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolvePressure().

bool Nektar::VCSMapping::m_verbose
protected

Definition at line 77 of file VCSMapping.h.

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

NekDouble Nektar::VCSMapping::m_viscousRelaxation
protected

Definition at line 89 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolveViscous().

NekDouble Nektar::VCSMapping::m_viscousTolerance
protected

Definition at line 87 of file VCSMapping.h.

Referenced by v_InitObject(), and v_SolveViscous().