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

#include <NonlinearPeregrine.h>

Inheritance diagram for Nektar::NonlinearPeregrine:
[legend]

Public Member Functions

 ~NonlinearPeregrine () override
 
- Public Member Functions inherited from Nektar::ShallowWaterSystem
 ~ShallowWaterSystem () override
 Destructor. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::UnsteadySystem
SOLVER_UTILS_EXPORT ~UnsteadySystem () override
 Destructor. More...
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Calculate the larger time-step mantaining the problem stable. More...
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void SetTimeStep (const NekDouble timestep)
 
SOLVER_UTILS_EXPORT void SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeSharedPtrGetTimeIntegrationScheme ()
 Returns the time integration scheme. More...
 
SOLVER_UTILS_EXPORT LibUtilities::TimeIntegrationSchemeOperatorsGetTimeIntegrationSchemeOperators ()
 Returns the time integration scheme operators. More...
 
- Public Member Functions inherited from Nektar::SolverUtils::EquationSystem
virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void InitObject (bool DeclareField=true)
 Initialises the members of this object. More...
 
SOLVER_UTILS_EXPORT void DoInitialise (bool dumpInitialConditions=true)
 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 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 NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation. 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 GetTime ()
 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, const Array< OneD, const NekDouble > &input)
 
SOLVER_UTILS_EXPORT Array< OneD, NekDouble > & UpdatePhysField (const int i)
 
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 int GetInfoSteps ()
 
SOLVER_UTILS_EXPORT void SetInfoSteps (int num)
 
SOLVER_UTILS_EXPORT void SetIterationNumberPIT (int num)
 
SOLVER_UTILS_EXPORT void SetWindowNumberPIT (int num)
 
SOLVER_UTILS_EXPORT Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals ()
 
SOLVER_UTILS_EXPORT void SetTime (const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetTimeStep (const NekDouble timestep)
 
SOLVER_UTILS_EXPORT void SetInitialStep (const int step)
 
SOLVER_UTILS_EXPORT void SetBoundaryConditions (NekDouble time)
 Evaluates the boundary conditions at the given time. More...
 
SOLVER_UTILS_EXPORT bool NegatedOp ()
 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::ShallowWaterSystem
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::ShallowWaterSystem
static std::string className
 Name of class. More...
 
- Static Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
static std::string cmdSetStartTime
 
static std::string cmdSetStartChkNum
 

Protected Member Functions

 NonlinearPeregrine (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
void v_InitObject (bool DeclareFields=true) override
 Init object for UnsteadySystem class. More...
 
void DoOdeRhs (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
void DoOdeProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 
void GetFluxVector (const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
void v_PrimitiveToConservative () override
 
void v_ConservativeToPrimitive () override
 
void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0) override
 Set the initial conditions. More...
 
const Array< OneD, NekDouble > & GetDepthFwd ()
 
const Array< OneD, NekDouble > & GetDepthBwd ()
 
- Protected Member Functions inherited from Nektar::ShallowWaterSystem
 ShallowWaterSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises UnsteadySystem class members. More...
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
void v_InitObject (bool DeclareFields=true) override
 Init object for UnsteadySystem class. More...
 
void PrimitiveToConservative ()
 
virtual void v_PrimitiveToConservative ()
 
void ConservativeToPrimitive ()
 
virtual void v_ConservativeToPrimitive ()
 
NekDouble GetGravity ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs ()
 
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals ()
 
const Array< OneD, NekDouble > & GetDepth ()
 
bool IsConstantDepth ()
 
void CopyBoundaryTrace (const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
 
- 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 void v_InitObject (bool DeclareField=true) override
 Init object for UnsteadySystem class. More...
 
SOLVER_UTILS_EXPORT void v_DoSolve () override
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintStatusInformation (const int step, const NekDouble cpuTime)
 Print Status Information. More...
 
virtual SOLVER_UTILS_EXPORT void v_PrintSummaryStatistics (const NekDouble intTime)
 Print Summary Statistics. More...
 
SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true) override
 Sets up initial conditions. More...
 
SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &s) override
 Print a summary of time stepping parameters. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_RequireFwdTrans ()
 
virtual SOLVER_UTILS_EXPORT void v_SteadyStateResidual (int step, Array< OneD, NekDouble > &L2)
 
virtual SOLVER_UTILS_EXPORT bool v_UpdateTimeStepCheck ()
 
SOLVER_UTILS_EXPORT NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. 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...
 
SOLVER_UTILS_EXPORT void DoDummyProjection (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
 Perform dummy projection. 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 void v_InitObject (bool DeclareFeld=true)
 Initialisation object for EquationSystem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise (bool dumpInitialConditions=true)
 Virtual function for initialisation implementation. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Virtual function for solve implementation. 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_TransCoeffToPhys ()
 Virtual function for transformation to physical space. More...
 
virtual SOLVER_UTILS_EXPORT void v_TransPhysToCoeff ()
 Virtual function for transformation to coefficient space. More...
 
virtual SOLVER_UTILS_EXPORT void v_GenerateSummary (SummaryList &l)
 Virtual function for generating summary information. 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 MultiRegions::ExpListSharedPtr v_GetPressure (void)
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp (void)
 Virtual function to identify if operator is negated in DoSolve. More...
 
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 

Private Member Functions

void NumericalFlux1D (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX)
 
void NumericalFlux2D (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
void LaitoneSolitaryWave (NekDouble amp, NekDouble d, NekDouble time, NekDouble x_offset)
 
void SetBoundaryConditions (Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
 
void WallBoundary2D (int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
 
void WallBoundary (int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
 Wall boundary condition. More...
 
void AddCoriolis (const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void AddVariableDepth (const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
 
void ConservativeToPrimitive (const Array< OneD, const Array< OneD, NekDouble > > &physin, Array< OneD, Array< OneD, NekDouble > > &physout)
 
void PrimitiveToConservative (const Array< OneD, const Array< OneD, NekDouble > > &physin, Array< OneD, Array< OneD, NekDouble > > &physout)
 
void GetVelocityVector (const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
 Compute the velocity field \( \mathbf{v} \) given the momentum \( h\mathbf{v} \). More...
 
void WCESolve (Array< OneD, NekDouble > &fce, NekDouble lambda)
 
void NumericalFluxForcing (const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &numfluxX, Array< OneD, NekDouble > &numfluxY)
 
void SetBoundaryConditionsForcing (Array< OneD, Array< OneD, NekDouble > > &inarray, NekDouble time)
 
void WallBoundaryForcing (int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &inarray)
 
void SetBoundaryConditionsContVariables (Array< OneD, NekDouble > &inarray, NekDouble time)
 
void WallBoundaryContVariables (int bcRegion, int cnt, Array< OneD, NekDouble > &inarray)
 
void NumericalFluxConsVariables (Array< OneD, NekDouble > &physfield, Array< OneD, NekDouble > &outX, Array< OneD, NekDouble > &outY)
 

Private Attributes

StdRegions::ConstFactorMap m_factors
 
Array< OneD, NekDoublem_dFwd
 Still water depth traces. More...
 
Array< OneD, NekDoublem_dBwd
 problem type selector More...
 
ProblemType m_problemType
 
NekDouble m_const_depth
 

Friends

class MemoryManager< NonlinearPeregrine >
 

Additional Inherited Members

- Protected Types inherited from Nektar::SolverUtils::EquationSystem
enum  HomogeneousType { eHomogeneous1D , eHomogeneous2D , eHomogeneous3D , eNotHomogeneous }
 Parameter for homogeneous expansions. More...
 
- Protected Attributes inherited from Nektar::ShallowWaterSystem
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
 
SolverUtils::AdvectionSharedPtr m_advection
 
SolverUtils::DiffusionSharedPtr m_diffusion
 
bool m_primitive
 Indicates if variables are primitive or conservative. More...
 
bool m_constantDepth
 Indicates if constant depth case. More...
 
NekDouble m_g
 Acceleration of gravity. More...
 
Array< OneD, NekDoublem_depth
 Still water depth. More...
 
Array< OneD, Array< OneD, NekDouble > > m_bottomSlope
 
Array< OneD, NekDoublem_coriolis
 Coriolis force. More...
 
Array< OneD, Array< OneD, NekDouble > > m_vecLocs
 
- Protected Attributes inherited from Nektar::SolverUtils::UnsteadySystem
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::vector< int > m_intVariables
 
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1). More...
 
NekDouble m_CFLGrowth
 CFL growth rate. More...
 
NekDouble m_CFLEnd
 Maximun cfl in cfl growth. More...
 
int m_abortSteps
 Number of steps between checks for abort conditions. More...
 
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...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_filtersInfosteps
 Number of time steps between outputting filters information. More...
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
std::ofstream m_errFile
 
NekDouble m_epsilon
 Diffusion coefficient. More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
bool m_verbose
 
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...
 
NekDouble m_lastCheckTime
 
NekDouble m_TimeIncrementFactor
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_infosteps
 Number of time steps between outputting status information. More...
 
int m_iterPIT = 0
 Number of parallel-in-time time iteration. More...
 
int m_windowPIT = 0
 Index of windows for parallel-in-time time iteration. 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...
 
Array< OneD, NekDoublem_movingFrameVelsxyz
 Moving frame of reference velocities (u, v, w, omega_x, omega_y, omega_z, a_x, a_y, a_z, domega_x, domega_y, domega_z) More...
 
Array< OneD, NekDoublem_movingFrameData
 Moving frame of reference angles with respect to the. More...
 
boost::numeric::ublas::matrix< NekDoublem_movingFrameProjMat
 Projection matrix for transformation between inertial and moving. 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...
 
- Static Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
static std::string equationSystemTypeLookupIds []
 
static std::string projectionTypeLookupIds []
 

Detailed Description

Definition at line 58 of file NonlinearPeregrine.h.

Constructor & Destructor Documentation

◆ ~NonlinearPeregrine()

Nektar::NonlinearPeregrine::~NonlinearPeregrine ( )
override

Definition at line 167 of file NonlinearPeregrine.cpp.

168{
169}

◆ NonlinearPeregrine()

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

Definition at line 54 of file NonlinearPeregrine.cpp.

57 : ShallowWaterSystem(pSession, pGraph), m_factors()
58{
61 // note: eFactorTau = 1.0 becomes unstable...
62 // we need to investigate the behaviuor w.r.t. tau
63}
StdRegions::ConstFactorMap m_factors
ShallowWaterSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.

References Nektar::StdRegions::eFactorLambda, Nektar::StdRegions::eFactorTau, and m_factors.

Member Function Documentation

◆ AddCoriolis()

void Nektar::NonlinearPeregrine::AddCoriolis ( const Array< OneD, const Array< OneD, NekDouble > > &  physarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

Definition at line 172 of file NonlinearPeregrine.cpp.

175{
176
177 int ncoeffs = GetNcoeffs();
178 int nq = GetTotPoints();
179
180 Array<OneD, NekDouble> tmp(nq);
181 Array<OneD, NekDouble> mod(ncoeffs);
182
183 switch (m_projectionType)
184 {
186 {
187 // add to hu equation
188 Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
189 m_fields[0]->IProductWRTBase(tmp, mod);
190 m_fields[0]->MultiplyByElmtInvMass(mod, mod);
191 m_fields[0]->BwdTrans(mod, tmp);
192 Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
193
194 // add to hv equation
195 Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
196 Vmath::Neg(nq, tmp, 1);
197 m_fields[0]->IProductWRTBase(tmp, mod);
198 m_fields[0]->MultiplyByElmtInvMass(mod, mod);
199 m_fields[0]->BwdTrans(mod, tmp);
200 Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
201 break;
202 }
205 {
206 // add to hu equation
207 Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
208 Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
209
210 // add to hv equation
211 Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
212 Vmath::Neg(nq, tmp, 1);
213 Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
214 break;
215 }
216 default:
217 ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
218 break;
219 }
220}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
Array< OneD, NekDouble > m_coriolis
Coriolis force.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetNcoeffs()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT int GetTotPoints()
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.hpp:72
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.hpp:292
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.hpp:180

References ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, Nektar::MultiRegions::eMixed_CG_Discontinuous, Nektar::SolverUtils::EquationSystem::GetNcoeffs(), Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_coriolis, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_projectionType, Vmath::Neg(), Vmath::Vadd(), and Vmath::Vmul().

Referenced by DoOdeRhs().

◆ AddVariableDepth()

void Nektar::NonlinearPeregrine::AddVariableDepth ( const Array< OneD, const Array< OneD, NekDouble > > &  physarray,
Array< OneD, Array< OneD, NekDouble > > &  outarray 
)
private

Definition at line 223 of file NonlinearPeregrine.cpp.

226{
227 int ncoeffs = GetNcoeffs();
228 int nq = GetTotPoints();
229
230 Array<OneD, NekDouble> tmp(nq);
231 Array<OneD, NekDouble> mod(ncoeffs);
232
233 switch (m_projectionType)
234 {
236 {
237 for (int i = 0; i < m_spacedim; ++i)
238 {
239 Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
240 Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
241 m_fields[0]->IProductWRTBase(tmp, mod);
242 m_fields[0]->MultiplyByElmtInvMass(mod, mod);
243 m_fields[0]->BwdTrans(mod, tmp);
244 Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
245 }
246 break;
247 }
250 {
251 for (int i = 0; i < m_spacedim; ++i)
252 {
253 Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
254 Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
255 Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
256 }
257 break;
258 }
259 default:
260 ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
261 break;
262 }
263}
NekDouble m_g
Acceleration of gravity.
Array< OneD, Array< OneD, NekDouble > > m_bottomSlope
int m_spacedim
Spatial dimension (>= expansion dim).
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
Definition: Vmath.hpp:100

References ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, Nektar::MultiRegions::eMixed_CG_Discontinuous, Nektar::SolverUtils::EquationSystem::GetNcoeffs(), Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_bottomSlope, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::ShallowWaterSystem::m_g, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Smul(), Vmath::Vadd(), and Vmath::Vmul().

◆ ConservativeToPrimitive()

void Nektar::NonlinearPeregrine::ConservativeToPrimitive ( const Array< OneD, const Array< OneD, NekDouble > > &  physin,
Array< OneD, Array< OneD, NekDouble > > &  physout 
)
private

Definition at line 739 of file NonlinearPeregrine.cpp.

742{
743 int nq = GetTotPoints();
744
745 if (physin.get() == physout.get())
746 {
747 // copy indata and work with tmp array
748 Array<OneD, Array<OneD, NekDouble>> tmp(3);
749 for (int i = 0; i < 3; ++i)
750 {
751 // deep copy
752 tmp[i] = Array<OneD, NekDouble>(nq);
753 Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
754 }
755
756 // \eta = h - d
757 Vmath::Vsub(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
758
759 // u = hu/h
760 Vmath::Vdiv(nq, tmp[1], 1, tmp[0], 1, physout[1], 1);
761
762 // v = hv/ v
763 Vmath::Vdiv(nq, tmp[2], 1, tmp[0], 1, physout[2], 1);
764 }
765 else
766 {
767 // \eta = h - d
768 Vmath::Vsub(nq, physin[0], 1, m_depth, 1, physout[0], 1);
769
770 // u = hu/h
771 Vmath::Vdiv(nq, physin[1], 1, physin[0], 1, physout[1], 1);
772
773 // v = hv/ v
774 Vmath::Vdiv(nq, physin[2], 1, physin[0], 1, physout[2], 1);
775 }
776}
Array< OneD, NekDouble > m_depth
Still water depth.
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.hpp:126
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.hpp:220

References Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_depth, Vmath::Vcopy(), Vmath::Vdiv(), and Vmath::Vsub().

◆ create()

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

Creates an instance of this class.

Definition at line 64 of file NonlinearPeregrine.h.

67 {
70 pGraph);
71 p->InitObject();
72 return p;
73 }
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.

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

◆ DoOdeProjection()

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

Definition at line 486 of file NonlinearPeregrine.cpp.

489{
490 int i;
491 int nvariables = inarray.size();
492
493 switch (m_projectionType)
494 {
496 {
497
498 // Just copy over array
499 if (inarray != outarray)
500 {
501 int npoints = GetNpoints();
502
503 for (i = 0; i < nvariables; ++i)
504 {
505 Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
506 }
507 }
508
509 SetBoundaryConditions(outarray, time);
510 break;
511 }
514 {
515
517 Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs(), 0.0);
518
519 for (i = 0; i < nvariables; ++i)
520 {
521 m_fields[i]->FwdTrans(inarray[i], coeffs);
522 m_fields[i]->BwdTrans(coeffs, outarray[i]);
523 }
524 break;
525 }
526 default:
527 ASSERTL0(false, "Unknown projection scheme");
528 break;
529 }
530}
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
SOLVER_UTILS_EXPORT int GetNpoints()
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.

References ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, Nektar::MultiRegions::eMixed_CG_Discontinuous, Nektar::SolverUtils::EquationSystem::GetNcoeffs(), Nektar::SolverUtils::EquationSystem::GetNpoints(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_projectionType, SetBoundaryConditions(), Nektar::SolverUtils::EquationSystem::SetBoundaryConditions(), and Vmath::Vcopy().

Referenced by v_InitObject().

◆ DoOdeRhs()

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

Definition at line 265 of file NonlinearPeregrine.cpp.

268{
269 int i;
270 int nvariables = inarray.size();
271 int ncoeffs = GetNcoeffs();
272 int nq = GetTotPoints();
273
274 switch (m_projectionType)
275 {
277 {
278
279 //-------------------------------------------------------
280 // inarray in physical space
281 Array<OneD, Array<OneD, NekDouble>> modarray(2);
282 for (i = 0; i < 2; ++i)
283 {
284 modarray[i] = Array<OneD, NekDouble>(ncoeffs, 0.0);
285 }
286 //-------------------------------------------------------
287
288 //-------------------------------------------------------
289 // Compute the DG advection including the numerical flux
290 // by using SolverUtils/Advection
291 // Input and output in physical space
292 m_advection->Advect(nvariables - 1, m_fields,
293 NullNekDoubleArrayOfArray, inarray, outarray,
294 time);
295 //-------------------------------------------------------
296
297 //-------------------------------------------------------
298 // negate the outarray since moving terms to the rhs
299 for (i = 0; i < nvariables - 1; ++i)
300 {
301 Vmath::Neg(nq, outarray[i], 1);
302 }
303 //-------------------------------------------------------
304
305 //-------------------------------------------------
306 // Add "source terms"
307 // Input and output in physical space
308
309 // Coriolis forcing
310 if (m_coriolis.size() != 0)
311 {
312 AddCoriolis(inarray, outarray);
313 }
314
315 // Variable Depth
316 if (m_constantDepth != true)
317 {
318 ASSERTL0(false,
319 "Variable depth not supported for the Peregrine "
320 "equations");
321 }
322
323 //-------------------------------------------------
324
325 //---------------------------------------
326 // As no more terms is required for the
327 // continuity equation and we have aleady evaluated
328 // the values for h_t we are done for h
329 //---------------------------------------
330
331 //-------------------------------------------------
332 // go to modal space
333 m_fields[0]->IProductWRTBase(outarray[1], modarray[0]);
334 m_fields[0]->IProductWRTBase(outarray[2], modarray[1]);
335
336 // store f1 and f2 for later use (modal space)
337 Array<OneD, NekDouble> f1(ncoeffs);
338 Array<OneD, NekDouble> f2(ncoeffs);
339
340 Vmath::Vcopy(ncoeffs, modarray[0], 1, f1, 1); // f1
341 Vmath::Vcopy(ncoeffs, modarray[1], 1, f2, 1); // f2
342
343 // Solve the remaining block-diagonal systems
344 m_fields[0]->MultiplyByElmtInvMass(modarray[0], modarray[0]);
345 m_fields[0]->MultiplyByElmtInvMass(modarray[1], modarray[1]);
346 //---------------------------------------------
347
348 //---------------------------------------------
349
350 //-------------------------------------------------
351 // create tmp fields to be used during
352 // the dispersive section
353
354 Array<OneD, Array<OneD, NekDouble>> coeffsfield(2);
355 Array<OneD, Array<OneD, NekDouble>> physfield(2);
356
357 for (i = 0; i < 2; ++i)
358 {
359 coeffsfield[i] = Array<OneD, NekDouble>(ncoeffs);
360 physfield[i] = Array<OneD, NekDouble>(nq);
361 }
362 //---------------------------------------------
363
364 //---------------------------------------------
365 // Go from modal to physical space
366 Vmath::Vcopy(nq, outarray[1], 1, physfield[0], 1);
367 Vmath::Vcopy(nq, outarray[2], 1, physfield[1], 1);
368 //---------------------------------------
369
370 //---------------------------------------
371 // Start for solve of mixed dispersive terms
372 // using the 'WCE method'
373 // (Eskilsson & Sherwin, JCP 2006)
374
375 // constant depth case
376 // \nabla \cdot (\nabla z) - invgamma z
377 // = - invgamma (\nabla \cdot {\bf f}_(2,3)
378
379 NekDouble gamma = (m_const_depth * m_const_depth) * (1.0 / 3.0);
380 NekDouble invgamma = 1.0 / gamma;
381
382 int nTraceNumPoints = GetTraceTotPoints();
383 Array<OneD, NekDouble> upwindX(nTraceNumPoints);
384 Array<OneD, NekDouble> upwindY(nTraceNumPoints);
385 //--------------------------------------------
386
387 //--------------------------------------------
388 // Compute the forcing function for the
389 // wave continuity equation
390
391 // Set boundary condidtions for z
392 SetBoundaryConditionsForcing(physfield, time);
393
394 // \nabla \phi \cdot f_{2,3}
395 m_fields[0]->IProductWRTDerivBase(0, physfield[0], coeffsfield[0]);
396 m_fields[0]->IProductWRTDerivBase(1, physfield[1], coeffsfield[1]);
397 Vmath::Vadd(ncoeffs, coeffsfield[0], 1, coeffsfield[1], 1,
398 coeffsfield[0], 1);
399 Vmath::Neg(ncoeffs, coeffsfield[0], 1);
400
401 // Evaluate upwind numerical flux (physical space)
402 NumericalFluxForcing(physfield, upwindX, upwindY);
403 Array<OneD, NekDouble> normflux(nTraceNumPoints);
404 Vmath::Vvtvvtp(nTraceNumPoints, upwindX, 1, m_traceNormals[0], 1,
405 upwindY, 1, m_traceNormals[1], 1, normflux, 1);
406 m_fields[0]->AddTraceIntegral(normflux, coeffsfield[0]);
407 m_fields[0]->MultiplyByElmtInvMass(coeffsfield[0], coeffsfield[0]);
408 m_fields[0]->BwdTrans(coeffsfield[0], physfield[0]);
409
410 Vmath::Smul(nq, -invgamma, physfield[0], 1, physfield[0], 1);
411
412 // ok: forcing function for HelmSolve... done!
413 //--------------------------------------
414
415 //--------------------------------------
416 // Solve the Helmhotz-type equation
417 // for the wave continuity equation
418 // (missing slope terms...)
419
420 // note: this is just valid for the constant depth case:
421
422 // as of now we need not to specify any
423 // BC routine for the WCE: periodic
424 // and zero Neumann (for walls)
425
426 WCESolve(physfield[0], invgamma);
427
428 Vmath::Vcopy(nq, physfield[0], 1, outarray[3], 1); // store z
429
430 // ok: Wave Continuity Equation... done!
431 //------------------------------------
432
433 //------------------------------------
434 // Return to the primary variables
435
436 // (h {\bf u})_t = gamma \nabla z + {\bf f}_{2,3}
437
438 Vmath::Smul(nq, gamma, physfield[0], 1, physfield[0], 1);
439
440 // Set boundary conditions
441 SetBoundaryConditionsContVariables(physfield[0], time);
442
443 m_fields[0]->IProductWRTDerivBase(0, physfield[0], coeffsfield[0]);
444 m_fields[0]->IProductWRTDerivBase(1, physfield[0], coeffsfield[1]);
445
446 Vmath::Neg(ncoeffs, coeffsfield[0], 1);
447 Vmath::Neg(ncoeffs, coeffsfield[1], 1);
448
449 // Evaluate upwind numerical flux (physical space)
450 NumericalFluxConsVariables(physfield[0], upwindX, upwindY);
451
452 {
453 Array<OneD, NekDouble> uptemp(nTraceNumPoints, 0.0);
454 Vmath::Vvtvvtp(nTraceNumPoints, upwindX, 1, m_traceNormals[0],
455 1, uptemp, 1, m_traceNormals[1], 1, normflux, 1);
456 m_fields[0]->AddTraceIntegral(normflux, coeffsfield[0]);
457 Vmath::Vvtvvtp(nTraceNumPoints, uptemp, 1, m_traceNormals[0], 1,
458 upwindY, 1, m_traceNormals[1], 1, normflux, 1);
459 m_fields[0]->AddTraceIntegral(normflux, coeffsfield[1]);
460 }
461
462 Vmath::Vadd(ncoeffs, f1, 1, coeffsfield[0], 1, modarray[0], 1);
463 Vmath::Vadd(ncoeffs, f2, 1, coeffsfield[1], 1, modarray[1], 1);
464
465 m_fields[1]->MultiplyByElmtInvMass(modarray[0], modarray[0]);
466 m_fields[2]->MultiplyByElmtInvMass(modarray[1], modarray[1]);
467
468 m_fields[1]->BwdTrans(modarray[0], outarray[1]);
469 m_fields[2]->BwdTrans(modarray[1], outarray[2]);
470
471 // ok: returned to conservative variables... done!
472 //---------------------
473
474 break;
475 }
478 ASSERTL0(false, "Unknown projection scheme for the Peregrine");
479 break;
480 default:
481 ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
482 break;
483 }
484}
void SetBoundaryConditionsForcing(Array< OneD, Array< OneD, NekDouble > > &inarray, NekDouble time)
void NumericalFluxForcing(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &numfluxX, Array< OneD, NekDouble > &numfluxY)
void SetBoundaryConditionsContVariables(Array< OneD, NekDouble > &inarray, NekDouble time)
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
void NumericalFluxConsVariables(Array< OneD, NekDouble > &physfield, Array< OneD, NekDouble > &outX, Array< OneD, NekDouble > &outY)
void WCESolve(Array< OneD, NekDouble > &fce, NekDouble lambda)
SolverUtils::AdvectionSharedPtr m_advection
bool m_constantDepth
Indicates if constant depth case.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):
Definition: Vmath.hpp:439

References AddCoriolis(), ASSERTL0, Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, Nektar::MultiRegions::eMixed_CG_Discontinuous, Nektar::SolverUtils::EquationSystem::GetNcoeffs(), Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::ShallowWaterSystem::m_advection, m_const_depth, Nektar::ShallowWaterSystem::m_constantDepth, Nektar::ShallowWaterSystem::m_coriolis, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::SolverUtils::EquationSystem::m_traceNormals, Vmath::Neg(), Nektar::NullNekDoubleArrayOfArray, NumericalFluxConsVariables(), NumericalFluxForcing(), SetBoundaryConditionsContVariables(), SetBoundaryConditionsForcing(), Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), Vmath::Vvtvvtp(), and WCESolve().

Referenced by v_InitObject().

◆ GetDepthBwd()

const Array< OneD, NekDouble > & Nektar::NonlinearPeregrine::GetDepthBwd ( )
inlineprotected

Definition at line 111 of file NonlinearPeregrine.h.

112 {
113 return m_dBwd;
114 }
Array< OneD, NekDouble > m_dBwd
problem type selector

References m_dBwd.

◆ GetDepthFwd()

const Array< OneD, NekDouble > & Nektar::NonlinearPeregrine::GetDepthFwd ( )
inlineprotected

Definition at line 107 of file NonlinearPeregrine.h.

108 {
109 return m_dFwd;
110 }
Array< OneD, NekDouble > m_dFwd
Still water depth traces.

References m_dFwd.

◆ GetFluxVector()

void Nektar::NonlinearPeregrine::GetFluxVector ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  flux 
)
protected

Definition at line 701 of file NonlinearPeregrine.cpp.

704{
705 int i, j;
706 int nq = m_fields[0]->GetTotPoints();
707
708 NekDouble g = m_g;
709 Array<OneD, Array<OneD, NekDouble>> velocity(m_spacedim);
710
711 // Flux vector for the mass equation
712 for (i = 0; i < m_spacedim; ++i)
713 {
714 velocity[i] = Array<OneD, NekDouble>(nq);
715 Vmath::Vcopy(nq, physfield[i + 1], 1, flux[0][i], 1);
716 }
717
718 GetVelocityVector(physfield, velocity);
719
720 // Put (0.5 g h h) in tmp
721 Array<OneD, NekDouble> tmp(nq);
722 Vmath::Vmul(nq, physfield[0], 1, physfield[0], 1, tmp, 1);
723 Vmath::Smul(nq, 0.5 * g, tmp, 1, tmp, 1);
724
725 // Flux vector for the momentum equations
726 for (i = 0; i < m_spacedim; ++i)
727 {
728 for (j = 0; j < m_spacedim; ++j)
729 {
730 Vmath::Vmul(nq, velocity[j], 1, physfield[i + 1], 1, flux[i + 1][j],
731 1);
732 }
733
734 // Add (0.5 g h h) to appropriate field
735 Vmath::Vadd(nq, flux[i + 1][i], 1, tmp, 1, flux[i + 1][i], 1);
736 }
737}
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
const std::vector< NekDouble > velocity

References GetVelocityVector(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::ShallowWaterSystem::m_g, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), Nektar::MovementTests::velocity, and Vmath::Vmul().

Referenced by v_InitObject().

◆ GetVelocityVector()

void Nektar::NonlinearPeregrine::GetVelocityVector ( const Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  velocity 
)
private

Compute the velocity field \( \mathbf{v} \) given the momentum \( h\mathbf{v} \).

Parameters
physfieldMomentum field.
velocityVelocity field.

Definition at line 859 of file NonlinearPeregrine.cpp.

862{
863 const int npts = physfield[0].size();
864
865 for (int i = 0; i < m_spacedim; ++i)
866 {
867 Vmath::Vdiv(npts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
868 }
869}

References Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Vdiv(), and Nektar::MovementTests::velocity.

Referenced by GetFluxVector().

◆ LaitoneSolitaryWave()

void Nektar::NonlinearPeregrine::LaitoneSolitaryWave ( NekDouble  amp,
NekDouble  d,
NekDouble  time,
NekDouble  x_offset 
)
private

Definition at line 1131 of file NonlinearPeregrine.cpp.

1133{
1134 int nq = GetTotPoints();
1135
1136 NekDouble A = 1.0;
1137 NekDouble C = sqrt(m_g * d) * (1.0 + 0.5 * (amp / d));
1138
1139 Array<OneD, NekDouble> x0(nq);
1140 Array<OneD, NekDouble> x1(nq);
1141 Array<OneD, NekDouble> zeros(nq, 0.0);
1142
1143 // get the coordinates (assuming all fields have the same
1144 // discretisation)
1145 m_fields[0]->GetCoords(x0, x1);
1146
1147 for (int i = 0; i < nq; i++)
1148 {
1149 (m_fields[0]->UpdatePhys())[i] =
1150 amp * pow((1.0 / cosh(sqrt(0.75 * (amp / (d * d * d))) *
1151 (A * (x0[i] + x_offset) - C * time))),
1152 2.0);
1153 (m_fields[1]->UpdatePhys())[i] =
1154 (amp / d) *
1155 pow((1.0 / cosh(sqrt(0.75 * (amp / (d * d * d))) *
1156 (A * (x0[i] + x_offset) - C * time))),
1157 2.0) *
1158 sqrt(m_g * d);
1159 }
1160
1161 Vmath::Sadd(nq, d, m_fields[0]->GetPhys(), 1, m_fields[0]->UpdatePhys(), 1);
1162 Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
1163 m_fields[1]->UpdatePhys(), 1);
1164 Vmath::Vcopy(nq, zeros, 1, m_fields[2]->UpdatePhys(), 1);
1165 Vmath::Vcopy(nq, zeros, 1, m_fields[3]->UpdatePhys(), 1);
1166
1167 // Forward transform to fill the coefficient space
1168 for (int i = 0; i < 4; ++i)
1169 {
1170 m_fields[i]->SetPhysState(true);
1171 m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
1172 m_fields[i]->UpdateCoeffs());
1173 }
1174}
std::vector< double > d(NPUPPER *NPUPPER)
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
Definition: Vmath.hpp:194
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294

References Nektar::UnitTests::d(), Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::ShallowWaterSystem::m_g, Vmath::Sadd(), tinysimd::sqrt(), Vmath::Vcopy(), and Vmath::Vmul().

Referenced by v_SetInitialConditions().

◆ NumericalFlux1D()

void Nektar::NonlinearPeregrine::NumericalFlux1D ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numfluxX 
)
private

◆ NumericalFlux2D()

void Nektar::NonlinearPeregrine::NumericalFlux2D ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numfluxX,
Array< OneD, Array< OneD, NekDouble > > &  numfluxY 
)
private

◆ NumericalFluxConsVariables()

void Nektar::NonlinearPeregrine::NumericalFluxConsVariables ( Array< OneD, NekDouble > &  physfield,
Array< OneD, NekDouble > &  outX,
Array< OneD, NekDouble > &  outY 
)
private

Definition at line 1100 of file NonlinearPeregrine.cpp.

1103{
1104 int i;
1105 int nTraceNumPoints = GetTraceTotPoints();
1106
1107 //-----------------------------------------------------
1108 // get temporary arrays
1109 Array<OneD, NekDouble> Fwd(nTraceNumPoints);
1110 Array<OneD, NekDouble> Bwd(nTraceNumPoints);
1111 //-----------------------------------------------------
1112
1113 //-----------------------------------------------------
1114 // get the physical values at the trace
1115 // (we have put any time-dependent BC in field[1])
1116
1117 m_fields[1]->GetFwdBwdTracePhys(physfield, Fwd, Bwd);
1118 //-----------------------------------------------------
1119
1120 //-----------------------------------------------------
1121 // use centred fluxes for the numerical flux
1122 for (i = 0; i < nTraceNumPoints; ++i)
1123 {
1124 outX[i] = 0.5 * (Fwd[i] + Bwd[i]);
1125 outY[i] = 0.5 * (Fwd[i] + Bwd[i]);
1126 }
1127 //-----------------------------------------------------
1128}

References Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), and Nektar::SolverUtils::EquationSystem::m_fields.

Referenced by DoOdeRhs().

◆ NumericalFluxForcing()

void Nektar::NonlinearPeregrine::NumericalFluxForcing ( const Array< OneD, const Array< OneD, NekDouble > > &  inarray,
Array< OneD, NekDouble > &  numfluxX,
Array< OneD, NekDouble > &  numfluxY 
)
private

Definition at line 903 of file NonlinearPeregrine.cpp.

906{
907 int i;
908 int nTraceNumPoints = GetTraceTotPoints();
909
910 //-----------------------------------------------------
911 // get temporary arrays
912 Array<OneD, Array<OneD, NekDouble>> Fwd(2);
913 Array<OneD, Array<OneD, NekDouble>> Bwd(2);
914
915 for (i = 0; i < 2; ++i)
916 {
917 Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
918 Bwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
919 }
920 //-----------------------------------------------------
921
922 //-----------------------------------------------------
923 // get the physical values at the trace
924 // (any time-dependent BC previously put in fields[1] and [2]
925
926 m_fields[1]->GetFwdBwdTracePhys(inarray[0], Fwd[0], Bwd[0]);
927 m_fields[2]->GetFwdBwdTracePhys(inarray[1], Fwd[1], Bwd[1]);
928 //-----------------------------------------------------
929
930 //-----------------------------------------------------
931 // use centred fluxes for the numerical flux
932 for (i = 0; i < nTraceNumPoints; ++i)
933 {
934 numfluxX[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
935 numfluxY[i] = 0.5 * (Fwd[1][i] + Bwd[1][i]);
936 }
937 //-----------------------------------------------------
938}

References Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), and Nektar::SolverUtils::EquationSystem::m_fields.

Referenced by DoOdeRhs().

◆ PrimitiveToConservative()

void Nektar::NonlinearPeregrine::PrimitiveToConservative ( const Array< OneD, const Array< OneD, NekDouble > > &  physin,
Array< OneD, Array< OneD, NekDouble > > &  physout 
)
private

Definition at line 795 of file NonlinearPeregrine.cpp.

798{
799
800 int nq = GetTotPoints();
801
802 if (physin.get() == physout.get())
803 {
804 // copy indata and work with tmp array
805 Array<OneD, Array<OneD, NekDouble>> tmp(3);
806 for (int i = 0; i < 3; ++i)
807 {
808 // deep copy
809 tmp[i] = Array<OneD, NekDouble>(nq);
810 Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
811 }
812
813 // h = \eta + d
814 Vmath::Vadd(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
815
816 // hu = h * u
817 Vmath::Vmul(nq, physout[0], 1, tmp[1], 1, physout[1], 1);
818
819 // hv = h * v
820 Vmath::Vmul(nq, physout[0], 1, tmp[2], 1, physout[2], 1);
821 }
822 else
823 {
824 // h = \eta + d
825 Vmath::Vadd(nq, physin[0], 1, m_depth, 1, physout[0], 1);
826
827 // hu = h * u
828 Vmath::Vmul(nq, physout[0], 1, physin[1], 1, physout[1], 1);
829
830 // hv = h * v
831 Vmath::Vmul(nq, physout[0], 1, physin[2], 1, physout[2], 1);
832 }
833}

References Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_depth, Vmath::Vadd(), Vmath::Vcopy(), and Vmath::Vmul().

◆ SetBoundaryConditions()

void Nektar::NonlinearPeregrine::SetBoundaryConditions ( Array< OneD, Array< OneD, NekDouble > > &  physarray,
NekDouble  time 
)
private

Definition at line 533 of file NonlinearPeregrine.cpp.

535{
536
537 int nvariables = m_fields.size();
538 int cnt = 0;
539 int nTracePts = GetTraceTotPoints();
540
541 // Extract trace for boundaries. Needs to be done on all processors to avoid
542 // deadlock.
543 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables - 1);
544 for (int i = 0; i < nvariables - 1; ++i)
545 {
546 Fwd[i] = Array<OneD, NekDouble>(nTracePts);
547 m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
548 }
549
550 // loop over Boundary Regions
551 for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
552 {
553
554 // Wall Boundary Condition
555 if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
556 "Wall"))
557 {
558 WallBoundary2D(n, cnt, Fwd, inarray);
559 }
560
561 // Time Dependent Boundary Condition (specified in meshfile)
562 if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
563 {
564 for (int i = 0; i < nvariables; ++i)
565 {
566 m_fields[i]->EvaluateBoundaryConditions(time);
567 }
568 }
569 cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
570 }
571}
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)

References Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, and WallBoundary2D().

Referenced by DoOdeProjection().

◆ SetBoundaryConditionsContVariables()

void Nektar::NonlinearPeregrine::SetBoundaryConditionsContVariables ( Array< OneD, NekDouble > &  inarray,
NekDouble  time 
)
private

Definition at line 1046 of file NonlinearPeregrine.cpp.

1048{
1049 int cnt = 0;
1050
1051 // loop over Boundary Regions
1052 for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
1053 {
1054 // Use wall for all
1055 // Wall Boundary Condition
1056 if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
1057 "Wall"))
1058 {
1059 WallBoundaryContVariables(n, cnt, inarray);
1060 }
1061
1062 if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
1063 {
1064 WallBoundaryContVariables(n, cnt, inarray);
1065 }
1066
1067 cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize() - 1;
1068 }
1069}
void WallBoundaryContVariables(int bcRegion, int cnt, Array< OneD, NekDouble > &inarray)

References Nektar::SolverUtils::EquationSystem::m_fields, and WallBoundaryContVariables().

Referenced by DoOdeRhs().

◆ SetBoundaryConditionsForcing()

void Nektar::NonlinearPeregrine::SetBoundaryConditionsForcing ( Array< OneD, Array< OneD, NekDouble > > &  inarray,
NekDouble  time 
)
private

Definition at line 940 of file NonlinearPeregrine.cpp.

943{
944 int cnt = 0;
945
946 // loop over Boundary Regions
947 for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
948 {
949 // Use wall for all BC...
950 // Wall Boundary Condition
951 if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
952 "Wall"))
953 {
954 WallBoundaryForcing(n, cnt, inarray);
955 }
956
957 // Timedependent Boundary Condition
958 if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
959 {
960 ASSERTL0(false, "time-dependent BC not implemented for Boussinesq");
961 }
962 cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
963 }
964}
void WallBoundaryForcing(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &inarray)

References ASSERTL0, Nektar::SolverUtils::EquationSystem::m_fields, and WallBoundaryForcing().

Referenced by DoOdeRhs().

◆ v_ConservativeToPrimitive()

void Nektar::NonlinearPeregrine::v_ConservativeToPrimitive ( )
overrideprotectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 778 of file NonlinearPeregrine.cpp.

779{
780 int nq = GetTotPoints();
781
782 // u = hu/h
783 Vmath::Vdiv(nq, m_fields[1]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
784 m_fields[1]->UpdatePhys(), 1);
785
786 // v = hv/ v
787 Vmath::Vdiv(nq, m_fields[2]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
788 m_fields[2]->UpdatePhys(), 1);
789
790 // \eta = h - d
791 Vmath::Vsub(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
792 m_fields[0]->UpdatePhys(), 1);
793}

References Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_depth, Nektar::SolverUtils::EquationSystem::m_fields, Vmath::Vdiv(), and Vmath::Vsub().

◆ v_GenerateSummary()

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

Print a summary of time stepping parameters.

Prints a summary with some information regards the time-stepping.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 871 of file NonlinearPeregrine.cpp.

872{
874 SolverUtils::AddSummaryItem(s, "Variables", "h should be in field[0]");
875 SolverUtils::AddSummaryItem(s, "", "hu should be in field[1]");
876 SolverUtils::AddSummaryItem(s, "", "hv should be in field[2]");
877 SolverUtils::AddSummaryItem(s, "", "z should be in field[3]");
878}
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:47

References Nektar::SolverUtils::AddSummaryItem(), and Nektar::ShallowWaterSystem::v_GenerateSummary().

◆ v_InitObject()

void Nektar::NonlinearPeregrine::v_InitObject ( bool  DeclareField = true)
overrideprotectedvirtual

Init object for UnsteadySystem class.

Initialization object for UnsteadySystem class.

Reimplemented from Nektar::SolverUtils::UnsteadySystem.

Definition at line 65 of file NonlinearPeregrine.cpp.

66{
68
69 if (m_session->DefinesSolverInfo("PROBLEMTYPE"))
70 {
71 int i;
72 std::string ProblemTypeStr = m_session->GetSolverInfo("PROBLEMTYPE");
73 for (i = 0; i < (int)SIZE_ProblemType; ++i)
74 {
75 if (boost::iequals(ProblemTypeMap[i], ProblemTypeStr))
76 {
78 break;
79 }
80 }
81 }
82 else
83 {
85 }
86
88 {
91 }
92 else
93 {
94 ASSERTL0(false, "Implicit Peregrine not set up.");
95 }
96
97 // NB! At the moment only the constant depth case is
98 // supported for the Peregrine eq.
99 if (m_session->DefinesParameter("ConstDepth"))
100 {
101 m_const_depth = m_session->GetParameter("ConstDepth");
102 }
103 else
104 {
105 ASSERTL0(false, "Constant Depth not specified");
106 }
107
108 // Type of advection class to be used
109 switch (m_projectionType)
110 {
111 // Continuous field
113 {
114 ASSERTL0(false,
115 "Continuous projection type not supported for Peregrine.");
116 break;
117 }
118 // Discontinuous field
120 {
121 string advName;
122 string diffName;
123 string riemName;
124
125 //---------------------------------------------------------------
126 // Setting up advection and diffusion operators
127 // NB: diffusion not set up for SWE at the moment
128 // but kept here for future use ...
129 m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
130 // m_session->LoadSolverInfo("DiffusionType", diffName, "LDG");
132 advName, advName);
133
135 this);
136
137 // Setting up Riemann solver for advection operator
138 m_session->LoadSolverInfo("UpwindType", riemName, "NoSolver");
139
142 riemName, m_session);
143
144 // Setting up parameters for advection operator Riemann solver
145 m_riemannSolver->SetParam("gravity",
147 m_riemannSolver->SetAuxVec("vecLocs",
150 this);
152 this);
153
154 // Concluding initialisation of advection / diffusion operators
155 m_advection->SetRiemannSolver(m_riemannSolver);
156 m_advection->InitObject(m_session, m_fields);
157 break;
158 }
159 default:
160 {
161 ASSERTL0(false, "Unsupported projection type.");
162 break;
163 }
164 }
165}
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:143
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
const Array< OneD, NekDouble > & GetDepth()
void v_InitObject(bool DeclareFields=true) override
Init object for UnsteadySystem class.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:43
RiemannSolverFactory & GetRiemannSolverFactory()
const char *const ProblemTypeMap[]
@ SIZE_ProblemType
Length of enum list.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::LibUtilities::TimeIntegrationSchemeOperators::DefineOdeRhs(), Nektar::LibUtilities::TimeIntegrationSchemeOperators::DefineProjection(), DoOdeProjection(), DoOdeRhs(), Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, Nektar::SolverUtils::GetAdvectionFactory(), Nektar::ShallowWaterSystem::GetDepth(), GetFluxVector(), Nektar::ShallowWaterSystem::GetGravity(), Nektar::ShallowWaterSystem::GetNormals(), Nektar::SolverUtils::GetRiemannSolverFactory(), Nektar::ShallowWaterSystem::GetVecLocs(), Nektar::ShallowWaterSystem::m_advection, m_const_depth, Nektar::SolverUtils::UnsteadySystem::m_explicitAdvection, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::UnsteadySystem::m_ode, m_problemType, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::ShallowWaterSystem::m_riemannSolver, Nektar::SolverUtils::EquationSystem::m_session, Nektar::ProblemTypeMap, Nektar::SIZE_ProblemType, and Nektar::ShallowWaterSystem::v_InitObject().

◆ v_PrimitiveToConservative()

void Nektar::NonlinearPeregrine::v_PrimitiveToConservative ( )
overrideprotectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 835 of file NonlinearPeregrine.cpp.

836{
837 int nq = GetTotPoints();
838
839 // h = \eta + d
840 Vmath::Vadd(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
841 m_fields[0]->UpdatePhys(), 1);
842
843 // hu = h * u
844 Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
845 m_fields[1]->UpdatePhys(), 1);
846
847 // hv = h * v
848 Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[2]->GetPhys(), 1,
849 m_fields[2]->UpdatePhys(), 1);
850}

References Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_depth, Nektar::SolverUtils::EquationSystem::m_fields, Vmath::Vadd(), and Vmath::Vmul().

◆ v_SetInitialConditions()

void Nektar::NonlinearPeregrine::v_SetInitialConditions ( NekDouble  initialtime = 0.0,
bool  dumpInitialConditions = true,
const int  domain = 0 
)
overrideprotectedvirtual

Set the initial conditions.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 1179 of file NonlinearPeregrine.cpp.

1182{
1183 switch (m_problemType)
1184 {
1185 case eSolitaryWave:
1186 {
1187 LaitoneSolitaryWave(0.1, m_const_depth, 0.0, 0.0);
1188 break;
1189 }
1190 default:
1191 {
1192 EquationSystem::v_SetInitialConditions(initialtime, false);
1193 m_nchk--; // Note: m_nchk has been incremented in EquationSystem.
1194 break;
1195 }
1196 }
1197
1198 if (dumpInitialConditions && m_checksteps && m_nchk == 0 &&
1199 !m_comm->IsParallelInTime())
1200 {
1202 }
1203 else if (dumpInitialConditions && m_nchk == 0 && m_comm->IsParallelInTime())
1204 {
1205 std::string newdir = m_sessionName + ".pit";
1206 if (!fs::is_directory(newdir))
1207 {
1208 fs::create_directory(newdir);
1209 }
1210 if (m_comm->GetTimeComm()->GetRank() == 0)
1211 {
1212 WriteFld(newdir + "/" + m_sessionName + "_0.fld");
1213 }
1214 }
1215 m_nchk++;
1216}
void LaitoneSolitaryWave(NekDouble amp, NekDouble d, NekDouble time, NekDouble x_offset)
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
LibUtilities::CommSharedPtr m_comm
Communicator.
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname)
Write field data to the given filename.
std::string m_sessionName
Name of the session.
int m_nchk
Number of checkpoints written so far.
int m_checksteps
Number of steps between checkpoints.
@ eSolitaryWave
First order Laitone solitary wave.

References Nektar::SolverUtils::EquationSystem::Checkpoint_Output(), Nektar::eSolitaryWave, LaitoneSolitaryWave(), Nektar::SolverUtils::EquationSystem::m_checksteps, Nektar::SolverUtils::EquationSystem::m_comm, m_const_depth, Nektar::SolverUtils::EquationSystem::m_nchk, m_problemType, Nektar::SolverUtils::EquationSystem::m_sessionName, Nektar::SolverUtils::EquationSystem::v_SetInitialConditions(), and Nektar::SolverUtils::EquationSystem::WriteFld().

◆ WallBoundary()

void Nektar::NonlinearPeregrine::WallBoundary ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray 
)
private

Wall boundary condition.

Definition at line 577 of file NonlinearPeregrine.cpp.

580{
581 int i;
582 int nvariables = physarray.size();
583
584 // Adjust the physical values of the trace to take
585 // user defined boundaries into account
586 int e, id1, id2, npts;
588 m_fields[0]->GetBndCondExpansions()[bcRegion];
589 for (e = 0; e < bcexp->GetExpSize(); ++e)
590 {
591 npts = bcexp->GetExp(e)->GetTotPoints();
592 id1 = bcexp->GetPhys_Offset(e);
593 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
594 m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
595
596 // For 2D/3D, define: v* = v - 2(v.n)n
597 Array<OneD, NekDouble> tmp(npts, 0.0);
598
599 // Calculate (v.n)
600 for (i = 0; i < m_spacedim; ++i)
601 {
602 Vmath::Vvtvp(npts, &Fwd[1 + i][id2], 1, &m_traceNormals[i][id2], 1,
603 &tmp[0], 1, &tmp[0], 1);
604 }
605
606 // Calculate 2.0(v.n)
607 Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1);
608
609 // Calculate v* = v - 2.0(v.n)n
610 for (i = 0; i < m_spacedim; ++i)
611 {
612 Vmath::Vvtvp(npts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
613 &Fwd[1 + i][id2], 1, &Fwd[1 + i][id2], 1);
614 }
615
616 // copy boundary adjusted values into the boundary expansion
617 for (i = 0; i < nvariables; ++i)
618 {
619 bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
620 Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
621 }
622 }
623}
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.hpp:366

References Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_spacedim, Nektar::SolverUtils::EquationSystem::m_traceNormals, Vmath::Smul(), Vmath::Vcopy(), and Vmath::Vvtvp().

◆ WallBoundary2D()

void Nektar::NonlinearPeregrine::WallBoundary2D ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray 
)
private

Definition at line 625 of file NonlinearPeregrine.cpp.

628{
629 int i;
630 int nvariables = 3;
631
632 // Adjust the physical values of the trace to take
633 // user defined boundaries into account
634 int e, id1, id2, npts;
636 m_fields[0]->GetBndCondExpansions()[bcRegion];
637
638 for (e = 0; e < bcexp->GetExpSize(); ++e)
639 {
640 npts = bcexp->GetExp(e)->GetNumPoints(0);
641 id1 = bcexp->GetPhys_Offset(e);
642 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
643 m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
644
645 switch (m_expdim)
646 {
647 case 1:
648 {
649 // negate the forward flux
650 Vmath::Neg(npts, &Fwd[1][id2], 1);
651 break;
652 }
653 case 2:
654 {
655 Array<OneD, NekDouble> tmp_n(npts);
656 Array<OneD, NekDouble> tmp_t(npts);
657
658 Vmath::Vmul(npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
659 &tmp_n[0], 1);
660 Vmath::Vvtvp(npts, &Fwd[2][id2], 1, &m_traceNormals[1][id2], 1,
661 &tmp_n[0], 1, &tmp_n[0], 1);
662
663 Vmath::Vmul(npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
664 &tmp_t[0], 1);
665 Vmath::Vvtvm(npts, &Fwd[2][id2], 1, &m_traceNormals[0][id2], 1,
666 &tmp_t[0], 1, &tmp_t[0], 1);
667
668 // negate the normal flux
669 Vmath::Neg(npts, tmp_n, 1);
670
671 // rotate back to Cartesian
672 Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
673 &Fwd[1][id2], 1);
674 Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
675 &Fwd[1][id2], 1, &Fwd[1][id2], 1);
676
677 Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
678 &Fwd[2][id2], 1);
679 Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
680 &Fwd[2][id2], 1, &Fwd[2][id2], 1);
681 break;
682 }
683 case 3:
684 ASSERTL0(false,
685 "3D not implemented for Shallow Water Equations");
686 break;
687 default:
688 ASSERTL0(false, "Illegal expansion dimension");
689 }
690
691 // copy boundary adjusted values into the boundary expansion
692 for (i = 0; i < nvariables; ++i)
693 {
694 bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
695 Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
696 }
697 }
698}
int m_expdim
Expansion dimension.
void Vvtvm(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)
vvtvm (vector times vector minus vector): z = w*x - y
Definition: Vmath.hpp:381

References ASSERTL0, Nektar::SolverUtils::EquationSystem::m_expdim, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_traceNormals, Vmath::Neg(), Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvm(), and Vmath::Vvtvp().

Referenced by SetBoundaryConditions().

◆ WallBoundaryContVariables()

void Nektar::NonlinearPeregrine::WallBoundaryContVariables ( int  bcRegion,
int  cnt,
Array< OneD, NekDouble > &  inarray 
)
private

Definition at line 1071 of file NonlinearPeregrine.cpp.

1073{
1074 int nTraceNumPoints = GetTraceTotPoints();
1075
1076 // get physical values of z for the forward trace
1077 Array<OneD, NekDouble> z(nTraceNumPoints);
1078 m_fields[0]->ExtractTracePhys(inarray, z);
1079
1080 // Adjust the physical values of the trace to take
1081 // user defined boundaries into account
1082 int e, id1, id2, npts;
1084 m_fields[0]->GetBndCondExpansions()[bcRegion];
1085
1086 for (e = 0; e < bcexp->GetExpSize(); ++e)
1087 {
1088 npts = bcexp->GetExp(e)->GetTotPoints();
1089 id1 = bcexp->GetPhys_Offset(e);
1090 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1091 m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
1092
1093 // copy boundary adjusted values into the boundary expansion
1094 // field[1] and field[2]
1095 bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1096 Vmath::Vcopy(npts, &z[id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1097 }
1098}
std::vector< double > z(NPUPPER)

References Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::SolverUtils::EquationSystem::m_fields, Vmath::Vcopy(), and Nektar::UnitTests::z().

Referenced by SetBoundaryConditionsContVariables().

◆ WallBoundaryForcing()

void Nektar::NonlinearPeregrine::WallBoundaryForcing ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  inarray 
)
private

Definition at line 967 of file NonlinearPeregrine.cpp.

969{
970 int nTraceNumPoints = GetTraceTotPoints();
971 int nvariables = 2;
972
973 // get physical values of f1 and f2 for the forward trace
974 Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
975 for (int i = 0; i < nvariables; ++i)
976 {
977 Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
978 m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
979 }
980
981 // Adjust the physical values of the trace to take
982 // user defined boundaries into account
983 int e, id1, id2, npts;
985 m_fields[0]->GetBndCondExpansions()[bcRegion];
986 for (e = 0; e < bcexp->GetExpSize(); ++e)
987 {
988 npts = bcexp->GetExp(e)->GetTotPoints();
989 id1 = bcexp->GetPhys_Offset(e);
990 id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
991 m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
992
993 switch (m_expdim)
994 {
995 case 1:
996 {
997 ASSERTL0(false, "1D not yet implemented for Boussinesq");
998 break;
999 }
1000 case 2:
1001 {
1002 Array<OneD, NekDouble> tmp_n(npts);
1003 Array<OneD, NekDouble> tmp_t(npts);
1004
1005 Vmath::Vmul(npts, &Fwd[0][id2], 1, &m_traceNormals[0][id2], 1,
1006 &tmp_n[0], 1);
1007 Vmath::Vvtvp(npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
1008 &tmp_n[0], 1, &tmp_n[0], 1);
1009
1010 Vmath::Vmul(npts, &Fwd[0][id2], 1, &m_traceNormals[1][id2], 1,
1011 &tmp_t[0], 1);
1012 Vmath::Vvtvm(npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
1013 &tmp_t[0], 1, &tmp_t[0], 1);
1014
1015 // negate the normal flux
1016 Vmath::Neg(npts, tmp_n, 1);
1017
1018 // rotate back to Cartesian
1019 Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
1020 &Fwd[0][id2], 1);
1021 Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
1022 &Fwd[0][id2], 1, &Fwd[0][id2], 1);
1023
1024 Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
1025 &Fwd[1][id2], 1);
1026 Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
1027 &Fwd[1][id2], 1, &Fwd[1][id2], 1);
1028 break;
1029 }
1030 case 3:
1031 ASSERTL0(false, "3D not implemented for Boussinesq equations");
1032 break;
1033 default:
1034 ASSERTL0(false, "Illegal expansion dimension");
1035 }
1036
1037 // copy boundary adjusted values into the boundary expansion
1038 bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1039 Vmath::Vcopy(npts, &Fwd[0][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1040
1041 bcexp = m_fields[2]->GetBndCondExpansions()[bcRegion];
1042 Vmath::Vcopy(npts, &Fwd[1][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1043 }
1044}

References ASSERTL0, Nektar::SolverUtils::EquationSystem::GetTraceTotPoints(), Nektar::SolverUtils::EquationSystem::m_expdim, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_traceNormals, Vmath::Neg(), Vmath::Vcopy(), Vmath::Vmul(), Vmath::Vvtvm(), and Vmath::Vvtvp().

Referenced by SetBoundaryConditionsForcing().

◆ WCESolve()

void Nektar::NonlinearPeregrine::WCESolve ( Array< OneD, NekDouble > &  fce,
NekDouble  lambda 
)
private

Definition at line 880 of file NonlinearPeregrine.cpp.

881{
882 int nq = GetTotPoints();
883
885
886 for (int j = 0; j < nq; j++)
887 {
888 (m_fields[3]->UpdatePhys())[j] = fce[j];
889 }
890
891 m_fields[3]->SetPhysState(true);
892
893 m_fields[3]->HelmSolve(m_fields[3]->GetPhys(), m_fields[3]->UpdateCoeffs(),
894 m_factors);
895
896 m_fields[3]->BwdTrans(m_fields[3]->GetCoeffs(), m_fields[3]->UpdatePhys());
897
898 m_fields[3]->SetPhysState(true);
899
900 Vmath::Vcopy(nq, m_fields[3]->GetPhys(), 1, fce, 1);
901}

References Nektar::StdRegions::eFactorLambda, Nektar::SolverUtils::EquationSystem::GetTotPoints(), m_factors, Nektar::SolverUtils::EquationSystem::m_fields, and Vmath::Vcopy().

Referenced by DoOdeRhs().

Friends And Related Function Documentation

◆ MemoryManager< NonlinearPeregrine >

friend class MemoryManager< NonlinearPeregrine >
friend

Definition at line 51 of file NonlinearPeregrine.h.

Member Data Documentation

◆ className

string Nektar::NonlinearPeregrine::className
static
Initial value:
=
"NonlinearPeregrine", NonlinearPeregrine::create,
"Nonlinear Peregrine equations in conservative variables.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:197
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
EquationSystemFactory & GetEquationSystemFactory()

Name of class.

Definition at line 75 of file NonlinearPeregrine.h.

◆ m_const_depth

NekDouble Nektar::NonlinearPeregrine::m_const_depth
private

Definition at line 188 of file NonlinearPeregrine.h.

Referenced by DoOdeRhs(), v_InitObject(), and v_SetInitialConditions().

◆ m_dBwd

Array<OneD, NekDouble> Nektar::NonlinearPeregrine::m_dBwd
private

problem type selector

Definition at line 183 of file NonlinearPeregrine.h.

Referenced by GetDepthBwd().

◆ m_dFwd

Array<OneD, NekDouble> Nektar::NonlinearPeregrine::m_dFwd
private

Still water depth traces.

Definition at line 182 of file NonlinearPeregrine.h.

Referenced by GetDepthFwd().

◆ m_factors

StdRegions::ConstFactorMap Nektar::NonlinearPeregrine::m_factors
private

Definition at line 179 of file NonlinearPeregrine.h.

Referenced by NonlinearPeregrine(), and WCESolve().

◆ m_problemType

ProblemType Nektar::NonlinearPeregrine::m_problemType
private

Definition at line 186 of file NonlinearPeregrine.h.

Referenced by v_InitObject(), and v_SetInitialConditions().