Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | 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

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

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

Public Attributes

ProblemType m_problemType
 
- Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
NekDouble m_cflSafetyFactor
 CFL safety factor (comprise between 0 to 1). More...
 
NekDouble m_cflNonAcoustic
 
NekDouble m_CFLGrowth
 CFL growth rate. More...
 
NekDouble m_CFLEnd
 maximun cfl in cfl growth More...
 

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

Protected Member Functions

 NonlinearPeregrine (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
virtual void v_InitObject ()
 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)
 
virtual void v_GenerateSummary (SolverUtils::SummaryList &s)
 Print a summary of time stepping parameters. More...
 
virtual void v_PrimitiveToConservative ()
 
virtual void v_ConservativeToPrimitive ()
 
virtual void v_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 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 PrimitiveToConservative ()
 
void 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 NekDouble MaxTimeStepEstimator ()
 Get the maximum timestep estimator for cfl control. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoSolve ()
 Solves an unsteady problem. More...
 
virtual SOLVER_UTILS_EXPORT void v_DoInitialise ()
 Sets up initial conditions. More...
 
virtual SOLVER_UTILS_EXPORT void v_AppendOutput1D (Array< OneD, Array< OneD, NekDouble >> &solution1D)
 Print the solution at each solution point in a txt file. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble >> &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_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)
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time, int &nchk)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble >> vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
virtual SOLVER_UTILS_EXPORT bool UpdateTimeStepCheck ()
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 Initialises EquationSystem class members. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT NekDouble v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_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_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 void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 

Protected Attributes

StdRegions::ConstFactorMap m_factors
 
Array< OneD, NekDoublem_dFwd
 Still water depth traces. More...
 
Array< OneD, NekDoublem_dBwd
 
- Protected Attributes inherited from Nektar::ShallowWaterSystem
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
 
SolverUtils::RiemannSolverSharedPtr m_riemannSolverLDG
 
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
int m_infosteps
 Number of time steps between outputting status information. More...
 
int m_abortSteps
 Number of steps between checks for abort conditions. More...
 
int m_filtersInfosteps
 Number of time steps between outputting filters information. More...
 
int m_nanSteps
 
LibUtilities::TimeIntegrationSchemeSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
NekDouble m_epsilon
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used. More...
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used. More...
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used. More...
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
NekDouble m_steadyStateTol
 Tolerance to which steady state should be evaluated at. More...
 
int m_steadyStateSteps
 Check for steady state at step interval. More...
 
NekDouble m_steadyStateRes = 1.0
 
NekDouble m_steadyStateRes0 = 1.0
 
Array< OneD, Array< OneD, NekDouble > > m_previousSolution
 Storage for previous solution for steady-state check. More...
 
std::ofstream m_errFile
 
std::vector< int > m_intVariables
 
std::vector< std::pair< std::string, FilterSharedPtr > > m_filters
 
NekDouble m_filterTimeWarning
 Number of time steps between outputting status information. More...
 
NekDouble m_TimeIntegLambda =0.0
 coefff of spacial derivatives(rhs or m_F in GLM) in calculating the residual of the whole equation(used in unsteady time integrations) More...
 
bool m_flagImplicitItsStatistics
 
bool m_flagImplicitSolver = false
 
Array< OneD, NekDoublem_magnitdEstimat
 estimate the magnitude of each conserved varibles More...
 
Array< OneD, NekDoublem_locTimeStep
 local time step(notice only for jfnk other see m_cflSafetyFactor) More...
 
NekDouble m_inArrayNorm =-1.0
 
int m_TotLinItePerStep =0
 
int m_StagesPerStep =1
 
bool m_flagUpdatePreconMat
 
int m_maxLinItePerNewton
 
int m_TotNewtonIts =0
 
int m_TotLinIts =0
 
int m_TotImpStages =0
 
bool m_CalcPhysicalAV = true
 flag to update artificial viscosity More...
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
bool m_verbose
 
bool m_root
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
std::map< std::string, SolverUtils::SessionFunctionSharedPtrm_sessionFunctions
 Map of known SessionFunctions. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
Array< OneD, MultiRegions::ExpListSharedPtrm_fields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_timestepMax = -1.0
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
NekDouble m_checktime
 Time between checkpoints. More...
 
NekDouble m_lastCheckTime
 
NekDouble m_TimeIncrementFactor
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

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

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...
 
- Static Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
static std::string equationSystemTypeLookupIds []
 

Detailed Description

Definition at line 58 of file NonlinearPeregrine.h.

Constructor & Destructor Documentation

◆ ~NonlinearPeregrine()

Nektar::NonlinearPeregrine::~NonlinearPeregrine ( )
virtual

problem type selector

Definition at line 169 of file NonlinearPeregrine.cpp.

170 {
171 
172 }

◆ NonlinearPeregrine()

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

Definition at line 55 of file NonlinearPeregrine.cpp.

58  : ShallowWaterSystem(pSession, pGraph), m_factors()
59 {
61  m_factors[StdRegions::eFactorTau] = 1000000.0;
62  // note: eFactorTau = 1.0 becomes unstable...
63  // we need to investigate the behaviuor w.r.t. tau
64 }
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 175 of file NonlinearPeregrine.cpp.

178 {
179 
180  int ncoeffs = GetNcoeffs();
181  int nq = GetTotPoints();
182 
183  Array<OneD, NekDouble> tmp(nq);
184  Array<OneD, NekDouble> mod(ncoeffs);
185 
186  switch (m_projectionType)
187  {
189  {
190  // add to hu equation
191  Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
192  m_fields[0]->IProductWRTBase(tmp, mod);
193  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
194  m_fields[0]->BwdTrans(mod, tmp);
195  Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
196 
197  // add to hv equation
198  Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
199  Vmath::Neg(nq, tmp, 1);
200  m_fields[0]->IProductWRTBase(tmp, mod);
201  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
202  m_fields[0]->BwdTrans(mod, tmp);
203  Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
204  break;
205  }
208  {
209  // add to hu equation
210  Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
211  Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
212 
213  // add to hv equation
214  Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
215  Vmath::Neg(nq, tmp, 1);
216  Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
217  break;
218  }
219  default:
220  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
221  break;
222  }
223 
224 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
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.cpp:192
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:461
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:322

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 227 of file NonlinearPeregrine.cpp.

230 {
231 
232  int ncoeffs = GetNcoeffs();
233  int nq = GetTotPoints();
234 
235  Array<OneD, NekDouble> tmp(nq);
236  Array<OneD, NekDouble> mod(ncoeffs);
237 
238  switch (m_projectionType)
239  {
241  {
242  for (int i = 0; i < m_spacedim; ++i)
243  {
244  Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
245  Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
246  m_fields[0]->IProductWRTBase(tmp, mod);
247  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
248  m_fields[0]->BwdTrans(mod, tmp);
249  Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
250  }
251  break;
252  }
255  {
256  for (int i = 0; i < m_spacedim; ++i)
257  {
258  Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
259  Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
260  Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
261  }
262  break;
263  }
264  default:
265  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
266  break;
267  }
268 
269 }
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.cpp:225

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 751 of file NonlinearPeregrine.cpp.

754 {
755  int nq = GetTotPoints();
756 
757  if (physin.get() == physout.get())
758  {
759  // copy indata and work with tmp array
760  Array<OneD, Array<OneD, NekDouble> > tmp(3);
761  for (int i = 0; i < 3; ++i)
762  {
763  // deep copy
764  tmp[i] = Array<OneD, NekDouble>(nq);
765  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
766  }
767 
768  // \eta = h - d
769  Vmath::Vsub(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
770 
771  // u = hu/h
772  Vmath::Vdiv(nq, tmp[1], 1, tmp[0], 1, physout[1], 1);
773 
774  // v = hv/ v
775  Vmath::Vdiv(nq, tmp[2], 1, tmp[0], 1, physout[2], 1);
776  }
777  else
778  {
779  // \eta = h - d
780  Vmath::Vsub(nq, physin[0], 1, m_depth, 1, physout[0], 1);
781 
782  // u = hu/h
783  Vmath::Vdiv(nq, physin[1], 1, physin[0], 1, physout[1], 1);
784 
785  // v = hv/ v
786  Vmath::Vdiv(nq, physin[2], 1, physin[0], 1, physout[2], 1);
787  }
788 }
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.cpp:257
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1199
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:372

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  {
69  NonlinearPeregrine>::AllocateSharedPtr(pSession, pGraph);
70  p->InitObject();
71  return p;
72  }
NonlinearPeregrine(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.

References 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 494 of file NonlinearPeregrine.cpp.

498 {
499  int i;
500  int nvariables = inarray.size();
501 
502  switch (m_projectionType)
503  {
505  {
506 
507  // Just copy over array
508  int npoints = GetNpoints();
509 
510  for (i = 0; i < nvariables; ++i)
511  {
512  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
513  }
514 
515  SetBoundaryConditions(outarray, time);
516  break;
517  }
520  {
521 
523  Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs(),0.0);
524 
525  for (i = 0; i < nvariables; ++i)
526  {
527  m_fields[i]->FwdTrans(inarray[i], coeffs);
528  m_fields[i]->BwdTrans_IterPerExp(coeffs, outarray[i]);
529  }
530  break;
531  }
532  default:
533  ASSERTL0(false, "Unknown projection scheme");
534  break;
535  }
536 }
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 271 of file NonlinearPeregrine.cpp.

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

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, Vmath::Neg(), NumericalFluxConsVariables(), NumericalFluxForcing(), SetBoundaryConditionsContVariables(), SetBoundaryConditionsForcing(), Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), and WCESolve().

Referenced by v_InitObject().

◆ GetDepthBwd()

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

Definition at line 122 of file NonlinearPeregrine.h.

123  {
124  return m_dBwd;
125  }
Array< OneD, NekDouble > m_dBwd

References m_dBwd.

◆ GetDepthFwd()

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

Definition at line 118 of file NonlinearPeregrine.h.

119  {
120  return m_dFwd;
121  }
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 712 of file NonlinearPeregrine.cpp.

715 {
716  int i, j;
717  int nq = m_fields[0]->GetTotPoints();
718 
719  NekDouble g = m_g;
720  Array<OneD, Array<OneD, NekDouble> > velocity(m_spacedim);
721 
722  // Flux vector for the mass equation
723  for (i = 0; i < m_spacedim; ++i)
724  {
725  velocity[i] = Array<OneD, NekDouble>(nq);
726  Vmath::Vcopy(nq, physfield[i + 1], 1, flux[0][i], 1);
727  }
728 
729  GetVelocityVector(physfield, velocity);
730 
731  // Put (0.5 g h h) in tmp
732  Array<OneD, NekDouble> tmp(nq);
733  Vmath::Vmul(nq, physfield[0], 1, physfield[0], 1, tmp, 1);
734  Vmath::Smul(nq, 0.5 * g, tmp, 1, tmp, 1);
735 
736  // Flux vector for the momentum equations
737  for (i = 0; i < m_spacedim; ++i)
738  {
739  for (j = 0; j < m_spacedim; ++j)
740  {
741  Vmath::Vmul(nq, velocity[j], 1, physfield[i + 1], 1,
742  flux[i + 1][j], 1);
743  }
744 
745  // Add (0.5 g h h) to appropriate field
746  Vmath::Vadd(nq, flux[i + 1][i], 1, tmp, 1, flux[i + 1][i], 1);
747  }
748 
749 }
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .

References GetVelocityVector(), Nektar::SolverUtils::EquationSystem::m_fields, Nektar::ShallowWaterSystem::m_g, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Smul(), Vmath::Vadd(), Vmath::Vcopy(), 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 874 of file NonlinearPeregrine.cpp.

877 {
878  const int npts = physfield[0].size();
879 
880  for (int i = 0; i < m_spacedim; ++i)
881  {
882  Vmath::Vdiv(npts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
883  }
884 }

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

Referenced by GetFluxVector().

◆ LaitoneSolitaryWave()

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

Definition at line 1164 of file NonlinearPeregrine.cpp.

1169 {
1170  int nq = GetTotPoints();
1171 
1172  NekDouble A = 1.0;
1173  NekDouble C = sqrt(m_g * d) * (1.0 + 0.5 * (amp / d));
1174 
1175  Array<OneD, NekDouble> x0(nq);
1176  Array<OneD, NekDouble> x1(nq);
1177  Array<OneD, NekDouble> zeros(nq, 0.0);
1178 
1179  // get the coordinates (assuming all fields have the same
1180  // discretisation)
1181  m_fields[0]->GetCoords(x0, x1);
1182 
1183  for (int i = 0; i < nq; i++)
1184  {
1185  (m_fields[0]->UpdatePhys())[i] = amp * pow((1.0 / cosh(
1186  sqrt(0.75 * (amp / (d * d * d))) *
1187  (A * (x0[i] + x_offset) - C * time))), 2.0);
1188  (m_fields[1]->UpdatePhys())[i] = (amp / d) * pow((1.0 / cosh(
1189  sqrt(0.75 * (amp / (d * d * d))) *
1190  (A * (x0[i] + x_offset) - C * time)
1191  )), 2.0) * sqrt(m_g * d);
1192  }
1193 
1194  Vmath::Sadd(nq, d, m_fields[0]->GetPhys(), 1, m_fields[0]->UpdatePhys(), 1);
1195  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
1196  m_fields[1]->UpdatePhys(), 1);
1197  Vmath::Vcopy(nq, zeros, 1, m_fields[2]->UpdatePhys(), 1);
1198  Vmath::Vcopy(nq, zeros, 1, m_fields[3]->UpdatePhys(), 1);
1199 
1200  // Forward transform to fill the coefficient space
1201  for (int i = 0; i < 4; ++i)
1202  {
1203  m_fields[i]->SetPhysState(true);
1204  m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
1205  m_fields[i]->UpdateCoeffs());
1206  }
1207 
1208 }
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.cpp:341
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:267

References 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 1130 of file NonlinearPeregrine.cpp.

1133 {
1134  int i;
1135  int nTraceNumPoints = GetTraceTotPoints();
1136 
1137  //-----------------------------------------------------
1138  // get temporary arrays
1139  Array<OneD, Array<OneD, NekDouble> > Fwd(1);
1140  Array<OneD, Array<OneD, NekDouble> > Bwd(1);
1141 
1142  Fwd[0] = Array<OneD, NekDouble>(nTraceNumPoints);
1143  Bwd[0] = Array<OneD, NekDouble>(nTraceNumPoints);
1144  //-----------------------------------------------------
1145 
1146  //-----------------------------------------------------
1147  // get the physical values at the trace
1148  // (we have put any time-dependent BC in field[1])
1149 
1150  m_fields[1]->GetFwdBwdTracePhys(physfield, Fwd[0], Bwd[0]);
1151  //-----------------------------------------------------
1152 
1153  //-----------------------------------------------------
1154  // use centred fluxes for the numerical flux
1155  for (i = 0; i < nTraceNumPoints; ++i)
1156  {
1157  outX[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
1158  outY[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
1159  }
1160  //-----------------------------------------------------
1161 }

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 921 of file NonlinearPeregrine.cpp.

925 {
926  int i;
927  int nTraceNumPoints = GetTraceTotPoints();
928 
929  //-----------------------------------------------------
930  // get temporary arrays
931  Array<OneD, Array<OneD, NekDouble> > Fwd(2);
932  Array<OneD, Array<OneD, NekDouble> > Bwd(2);
933 
934  for (i = 0; i < 2; ++i)
935  {
936  Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
937  Bwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
938  }
939  //-----------------------------------------------------
940 
941  //-----------------------------------------------------
942  // get the physical values at the trace
943  // (any time-dependent BC previuosly put in fields[1] and [2]
944 
945  m_fields[1]->GetFwdBwdTracePhys(inarray[0], Fwd[0], Bwd[0]);
946  m_fields[2]->GetFwdBwdTracePhys(inarray[1], Fwd[1], Bwd[1]);
947  //-----------------------------------------------------
948 
949  //-----------------------------------------------------
950  // use centred fluxes for the numerical flux
951  for (i = 0; i < nTraceNumPoints; ++i)
952  {
953  numfluxX[i] = 0.5 * (Fwd[0][i] + Bwd[0][i]);
954  numfluxY[i] = 0.5 * (Fwd[1][i] + Bwd[1][i]);
955  }
956  //-----------------------------------------------------
957 }

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 807 of file NonlinearPeregrine.cpp.

810 {
811 
812  int nq = GetTotPoints();
813 
814  if (physin.get() == physout.get())
815  {
816  // copy indata and work with tmp array
817  Array<OneD, Array<OneD, NekDouble> > tmp(3);
818  for (int i = 0; i < 3; ++i)
819  {
820  // deep copy
821  tmp[i] = Array<OneD, NekDouble>(nq);
822  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
823  }
824 
825  // h = \eta + d
826  Vmath::Vadd(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
827 
828  // hu = h * u
829  Vmath::Vmul(nq, physout[0], 1, tmp[1], 1, physout[1], 1);
830 
831  // hv = h * v
832  Vmath::Vmul(nq, physout[0], 1, tmp[2], 1, physout[2], 1);
833 
834  }
835  else
836  {
837  // h = \eta + d
838  Vmath::Vadd(nq, physin[0], 1, m_depth, 1, physout[0], 1);
839 
840  // hu = h * u
841  Vmath::Vmul(nq, physout[0], 1, physin[1], 1, physout[1], 1);
842 
843  // hv = h * v
844  Vmath::Vmul(nq, physout[0], 1, physin[2], 1, physout[2], 1);
845 
846  }
847 
848 }

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 539 of file NonlinearPeregrine.cpp.

542 {
543 
544  int nvariables = m_fields.size();
545  int cnt = 0;
546  int nTracePts = GetTraceTotPoints();
547 
548  // Extract trace for boundaries. Needs to be done on all processors to avoid
549  // deadlock.
550  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
551  for (int i = 0; i < nvariables; ++i)
552  {
553  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
554  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
555  }
556 
557  // loop over Boundary Regions
558  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
559  {
560 
561  // Wall Boundary Condition
562  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
563  {
564  WallBoundary2D(n, cnt, Fwd, inarray);
565  }
566 
567  // Time Dependent Boundary Condition (specified in meshfile)
568  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
569  {
570  for (int i = 0; i < nvariables; ++i)
571  {
572  m_fields[i]->EvaluateBoundaryConditions(time);
573  }
574  }
575  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
576  }
577 }
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 1071 of file NonlinearPeregrine.cpp.

1074 {
1075  boost::ignore_unused(time);
1076 
1077  int cnt = 0;
1078 
1079  // loop over Boundary Regions
1080  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
1081  {
1082  // Use wall for all
1083  // Wall Boundary Condition
1084  if(boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
1085  {
1086  WallBoundaryContVariables(n, cnt, inarray);
1087  }
1088 
1089  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
1090  {
1091  WallBoundaryContVariables(n, cnt, inarray);
1092  }
1093 
1094  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize() - 1;
1095  }
1096 }
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 959 of file NonlinearPeregrine.cpp.

962 {
963  boost::ignore_unused(time);
964 
965  int cnt = 0;
966 
967  // loop over Boundary Regions
968  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
969  {
970  // Use wall for all BC...
971  // Wall Boundary Condition
972  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
973  {
974  WallBoundaryForcing(n, cnt, inarray);
975  }
976 
977  //Timedependent Boundary Condition
978  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
979  {
980  ASSERTL0(false, "time-dependent BC not implemented for Boussinesq");
981  }
982  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
983  }
984 }
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 ( )
protectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 790 of file NonlinearPeregrine.cpp.

791 {
792  int nq = GetTotPoints();
793 
794  // u = hu/h
795  Vmath::Vdiv(nq, m_fields[1]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
796  m_fields[1]->UpdatePhys(), 1);
797 
798  // v = hv/ v
799  Vmath::Vdiv(nq, m_fields[2]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
800  m_fields[2]->UpdatePhys(), 1);
801 
802  // \eta = h - d
803  Vmath::Vsub(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
804  m_fields[0]->UpdatePhys(), 1);
805 }

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)
protectedvirtual

Print a summary of time stepping parameters.

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 886 of file NonlinearPeregrine.cpp.

887 {
889  SolverUtils::AddSummaryItem(s, "Variables", "h should be in field[0]");
890  SolverUtils::AddSummaryItem(s, "", "hu should be in field[1]");
891  SolverUtils::AddSummaryItem(s, "", "hv should be in field[2]");
892  SolverUtils::AddSummaryItem(s, "", "z should be in field[3]");
893 }
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
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 ( )
protectedvirtual

Init object for UnsteadySystem class.

Initialization object for UnsteadySystem class.

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 66 of file NonlinearPeregrine.cpp.

67 {
69 
70  if (m_session->DefinesSolverInfo("PROBLEMTYPE"))
71  {
72  int i;
73  std::string ProblemTypeStr = m_session->GetSolverInfo("PROBLEMTYPE");
74  for (i = 0; i < (int) SIZE_ProblemType; ++i)
75  {
76  if (boost::iequals(ProblemTypeMap[i], ProblemTypeStr))
77  {
79  break;
80  }
81  }
82  }
83  else
84  {
86  }
87 
89  {
92  }
93  else
94  {
95  ASSERTL0(false, "Implicit Peregrine not set up.");
96  }
97 
98  // NB! At the moment only the constant depth case is
99  // supported for the Peregrine eq.
100  if (m_session->DefinesParameter("ConstDepth"))
101  {
102  m_const_depth = m_session->GetParameter("ConstDepth");
103  }
104  else
105  {
106  ASSERTL0(false, "Constant Depth not specified");
107  }
108 
109  // Type of advection class to be used
110  switch (m_projectionType)
111  {
112  // Continuous field
114  {
115  ASSERTL0(false,
116  "Continuous projection type not supported for Peregrine.");
117  break;
118  }
119  // Discontinuous field
121  {
122  string advName;
123  string diffName;
124  string riemName;
125 
126  //---------------------------------------------------------------
127  // Setting up advection and diffusion operators
128  // NB: diffusion not set up for SWE at the moment
129  // but kept here for future use ...
130  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
131  // m_session->LoadSolverInfo("DiffusionType", diffName, "LDG");
133  advName, advName);
134 
136  this);
137 
138  // Setting up Riemann solver for advection operator
139  m_session->LoadSolverInfo("UpwindType", riemName, "NoSolver");
140 
143  riemName, m_session);
144 
145  // Setting up parameters for advection operator Riemann solver
146  m_riemannSolver->SetParam("gravity",
148  m_riemannSolver->SetAuxVec("vecLocs",
151  this);
152  m_riemannSolver->SetScalar("depth", &NonlinearPeregrine::GetDepth,
153  this);
154 
155  // Concluding initialisation of advection / diffusion operators
156  m_advection->SetRiemannSolver(m_riemannSolver);
157  m_advection->InitObject(m_session, m_fields);
158  break;
159  }
160  default:
161  {
162  ASSERTL0(false, "Unsupported projection type.");
163  break;
164  }
165  }
166 
167 }
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:145
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)
virtual void v_InitObject()
Init object for UnsteadySystem class.
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
const Array< OneD, NekDouble > & GetDepth()
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:47
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 ( )
protectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 850 of file NonlinearPeregrine.cpp.

851 {
852  int nq = GetTotPoints();
853 
854  // h = \eta + d
855  Vmath::Vadd(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
856  m_fields[0]->UpdatePhys(), 1);
857 
858  // hu = h * u
859  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
860  m_fields[1]->UpdatePhys(), 1);
861 
862  // hv = h * v
863  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[2]->GetPhys(), 1,
864  m_fields[2]->UpdatePhys(), 1);
865 }

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 
)
protectedvirtual

Set the initial conditions.

Reimplemented from Nektar::SolverUtils::EquationSystem.

Definition at line 1213 of file NonlinearPeregrine.cpp.

1217 {
1218  boost::ignore_unused(domain);
1219 
1220  switch (m_problemType)
1221  {
1222  case eSolitaryWave:
1223  {
1224  LaitoneSolitaryWave(0.1, m_const_depth, 0.0, 0.0);
1225  break;
1226  }
1227  default:
1228  {
1229  EquationSystem::v_SetInitialConditions(initialtime, false);
1230  break;
1231  }
1232  }
1233 
1234  if (dumpInitialConditions)
1235  {
1236  // Dump initial conditions to file
1237  Checkpoint_Output(0);
1238  }
1239 }
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)
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
@ eSolitaryWave
First order Laitone solitary wave.

References Nektar::SolverUtils::EquationSystem::Checkpoint_Output(), Nektar::eSolitaryWave, LaitoneSolitaryWave(), m_const_depth, m_problemType, and Nektar::SolverUtils::EquationSystem::v_SetInitialConditions().

◆ 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 583 of file NonlinearPeregrine.cpp.

586 {
587  int i;
588  int nvariables = physarray.size();
589 
590  // Adjust the physical values of the trace to take
591  // user defined boundaries into account
592  int e, id1, id2, npts;
594  m_fields[0]->GetBndCondExpansions()[bcRegion];
595  for (e = 0; e < bcexp->GetExpSize(); ++e)
596  {
597  npts = bcexp->GetExp(e)->GetTotPoints();
598  id1 = bcexp->GetPhys_Offset(e);
599  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
600  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
601 
602  // For 2D/3D, define: v* = v - 2(v.n)n
603  Array<OneD, NekDouble> tmp(npts, 0.0);
604 
605  // Calculate (v.n)
606  for (i = 0; i < m_spacedim; ++i)
607  {
608  Vmath::Vvtvp(npts, &Fwd[1 + i][id2], 1, &m_traceNormals[i][id2], 1,
609  &tmp[0], 1, &tmp[0], 1);
610  }
611 
612  // Calculate 2.0(v.n)
613  Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1);
614 
615  // Calculate v* = v - 2.0(v.n)n
616  for (i = 0; i < m_spacedim; ++i)
617  {
618  Vmath::Vvtvp(npts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
619  &Fwd[1 + i][id2], 1, &Fwd[1 + i][id2], 1);
620  }
621 
622  // copy boundary adjusted values into the boundary expansion
623  for (i = 0; i < nvariables; ++i)
624  {
625  bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
626  Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
627  }
628  }
629 }
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
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.cpp:513

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 631 of file NonlinearPeregrine.cpp.

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

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 1098 of file NonlinearPeregrine.cpp.

1102 {
1103  int nTraceNumPoints = GetTraceTotPoints();
1104 
1105  // get physical values of z for the forward trace
1106  Array<OneD, NekDouble> z(nTraceNumPoints);
1107  m_fields[0]->ExtractTracePhys(inarray, z);
1108 
1109  // Adjust the physical values of the trace to take
1110  // user defined boundaries into account
1111  int e, id1, id2, npts;
1113  m_fields[0]->GetBndCondExpansions()[bcRegion];
1114 
1115  for (e = 0; e < bcexp->GetExpSize(); ++e)
1116  {
1117  npts = bcexp->GetExp(e)->GetTotPoints();
1118  id1 = bcexp->GetPhys_Offset(e);
1119  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1120  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
1121 
1122  // copy boundary adjusted values into the boundary expansion
1123  // field[1] and field[2]
1124  bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1125  Vmath::Vcopy(npts, &z[id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1126 
1127  }
1128 }

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

Referenced by SetBoundaryConditionsContVariables().

◆ WallBoundaryForcing()

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

Definition at line 987 of file NonlinearPeregrine.cpp.

991 {
992 
993  //std::cout << " WallBoundaryForcing" << std::endl;
994 
995  int nTraceNumPoints = GetTraceTotPoints();
996  int nvariables = 2;
997 
998  // get physical values of f1 and f2 for the forward trace
999  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
1000  for (int i = 0; i < nvariables; ++i)
1001  {
1002  Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
1003  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
1004  }
1005 
1006  // Adjust the physical values of the trace to take
1007  // user defined boundaries into account
1008  int e, id1, id2, npts;
1010  m_fields[0]->GetBndCondExpansions()[bcRegion];
1011  for (e = 0; e < bcexp->GetExpSize(); ++e)
1012  {
1013  npts = bcexp->GetExp(e)->GetTotPoints();
1014  id1 = bcexp->GetPhys_Offset(e);
1015  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1016  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
1017 
1018  switch (m_expdim)
1019  {
1020  case 1:
1021  {
1022  ASSERTL0(false, "1D not yet implemented for Boussinesq");
1023  break;
1024  }
1025  case 2:
1026  {
1027  Array<OneD, NekDouble> tmp_n(npts);
1028  Array<OneD, NekDouble> tmp_t(npts);
1029 
1030  Vmath::Vmul (npts, &Fwd[0][id2], 1, &m_traceNormals[0][id2], 1,
1031  &tmp_n[0], 1);
1032  Vmath::Vvtvp(npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
1033  &tmp_n[0], 1, &tmp_n[0], 1);
1034 
1035  Vmath::Vmul (npts, &Fwd[0][id2], 1, &m_traceNormals[1][id2], 1,
1036  &tmp_t[0], 1);
1037  Vmath::Vvtvm(npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
1038  &tmp_t[0], 1, &tmp_t[0], 1);
1039 
1040  // negate the normal flux
1041  Vmath::Neg(npts, tmp_n, 1);
1042 
1043  // rotate back to Cartesian
1044  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
1045  &Fwd[0][id2], 1);
1046  Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
1047  &Fwd[0][id2], 1, &Fwd[0][id2], 1);
1048 
1049  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
1050  &Fwd[1][id2], 1);
1051  Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
1052  &Fwd[1][id2], 1, &Fwd[1][id2], 1);
1053  break;
1054  }
1055  case 3:
1056  ASSERTL0(false, "3D not implemented for Boussinesq equations");
1057  break;
1058  default:
1059  ASSERTL0(false, "Illegal expansion dimension");
1060  }
1061 
1062  // copy boundary adjusted values into the boundary expansion
1063  bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1064  Vmath::Vcopy(npts, &Fwd[0][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1065 
1066  bcexp = m_fields[2]->GetBndCondExpansions()[bcRegion];
1067  Vmath::Vcopy(npts, &Fwd[1][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1068  }
1069 }

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 895 of file NonlinearPeregrine.cpp.

898 {
899  int nq = GetTotPoints();
900 
902 
903  for (int j = 0; j < nq; j++)
904  {
905  (m_fields[3]->UpdatePhys())[j] = fce[j];
906  }
907 
908  m_fields[3]->SetPhysState(true);
909 
910  m_fields[3]->HelmSolve(m_fields[3]->GetPhys(),
911  m_fields[3]->UpdateCoeffs(),
912  m_factors);
913 
914  m_fields[3]->BwdTrans(m_fields[3]->GetCoeffs(), m_fields[3]->UpdatePhys());
915 
916  m_fields[3]->SetPhysState(true);
917 
918  Vmath::Vcopy(nq, m_fields[3]->GetPhys(), 1, fce, 1);
919 }

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:200
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 74 of file NonlinearPeregrine.h.

◆ m_const_depth

NekDouble Nektar::NonlinearPeregrine::m_const_depth
private

Definition at line 128 of file NonlinearPeregrine.h.

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

◆ m_dBwd

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

Definition at line 91 of file NonlinearPeregrine.h.

Referenced by GetDepthBwd().

◆ m_dFwd

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

Still water depth traces.

Definition at line 90 of file NonlinearPeregrine.h.

Referenced by GetDepthFwd().

◆ m_factors

StdRegions::ConstFactorMap Nektar::NonlinearPeregrine::m_factors
protected

Definition at line 82 of file NonlinearPeregrine.h.

Referenced by NonlinearPeregrine(), and WCESolve().

◆ m_problemType

ProblemType Nektar::NonlinearPeregrine::m_problemType

Definition at line 79 of file NonlinearPeregrine.h.

Referenced by v_InitObject(), and v_SetInitialConditions().