Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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:
Inheritance graph
[legend]
Collaboration diagram for Nektar::NonlinearPeregrine:
Collaboration graph
[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...
 
- Public Member Functions inherited from Nektar::SolverUtils::EquationSystem
virtual SOLVER_UTILS_EXPORT ~EquationSystem ()
 Destructor. More...
 
SOLVER_UTILS_EXPORT void SetUpTraceNormals (void)
 
SOLVER_UTILS_EXPORT void InitObject ()
 Initialises the members of this object. More...
 
SOLVER_UTILS_EXPORT void DoInitialise ()
 Perform any initialisation necessary before solving the problem. More...
 
SOLVER_UTILS_EXPORT void DoSolve ()
 Solve the problem. More...
 
SOLVER_UTILS_EXPORT void TransCoeffToPhys ()
 Transform from coefficient to physical space. More...
 
SOLVER_UTILS_EXPORT void TransPhysToCoeff ()
 Transform from physical to coefficient space. More...
 
SOLVER_UTILS_EXPORT void Output ()
 Perform output operations after solve. More...
 
SOLVER_UTILS_EXPORT NekDouble LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Linf error computation. More...
 
SOLVER_UTILS_EXPORT std::string GetSessionName ()
 Get Session name. More...
 
template<class T >
boost::shared_ptr< T > as ()
 
SOLVER_UTILS_EXPORT void ResetSessionName (std::string newname)
 Reset Session name. More...
 
SOLVER_UTILS_EXPORT
LibUtilities::SessionReaderSharedPtr 
GetSession ()
 Get Session name. More...
 
SOLVER_UTILS_EXPORT
MultiRegions::ExpListSharedPtr 
GetPressure ()
 Get pressure field if available. More...
 
SOLVER_UTILS_EXPORT void PrintSummary (std::ostream &out)
 Print a summary of parameters and solver characteristics. More...
 
SOLVER_UTILS_EXPORT void SetLambda (NekDouble lambda)
 Set parameter m_lambda. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (Array< OneD, Array< OneD, NekDouble > > &pArray, std::string pFunctionName, const NekDouble pTime=0.0, const int domain=0)
 Evaluates a function as specified in the session file. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::vector< std::string > pFieldNames, Array< OneD, Array< OneD, NekDouble > > &pFields, const std::string &pName, const NekDouble &pTime=0.0, const int domain=0)
 Populate given fields with the function from session. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::vector< std::string > pFieldNames, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const std::string &pName, const NekDouble &pTime=0.0, const int domain=0)
 Populate given fields with the function from session. More...
 
SOLVER_UTILS_EXPORT void EvaluateFunction (std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, const NekDouble &pTime=0.0, const int domain=0)
 
SOLVER_UTILS_EXPORT std::string DescribeFunction (std::string pFieldName, const std::string &pFunctionName, const int domain)
 Provide a description of a function for a given field name. More...
 
SOLVER_UTILS_EXPORT void InitialiseBaseFlow (Array< OneD, Array< OneD, NekDouble > > &base)
 Perform initialisation of the base flow. More...
 
SOLVER_UTILS_EXPORT void SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 Initialise the data in the dependent fields. More...
 
SOLVER_UTILS_EXPORT void EvaluateExactSolution (int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 Evaluates an exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln, bool Normalised=false)
 Compute the L2 error between fields and a given exact solution. More...
 
SOLVER_UTILS_EXPORT NekDouble L2Error (unsigned int field, bool Normalised=false)
 Compute the L2 error of the fields. More...
 
SOLVER_UTILS_EXPORT Array
< OneD, NekDouble
ErrorExtraPoints (unsigned int field)
 Compute error (L2 and L_inf) over an larger set of quadrature points return [L2 Linf]. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionGreensDivergenceForm (const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
 Compute the inner product $ (\nabla \phi \cdot F) $. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionDivergenceForm (const Array< OneD, Array< OneD, NekDouble > > &F, Array< OneD, NekDouble > &outarray)
 Compute the inner product $ (\phi, \nabla \cdot F) $. More...
 
SOLVER_UTILS_EXPORT void WeakAdvectionNonConservativeForm (const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, bool UseContCoeffs=false)
 Compute the inner product $ (\phi, V\cdot \nabla u) $. More...
 
f SOLVER_UTILS_EXPORT void AdvectionNonConservativeForm (const Array< OneD, Array< OneD, NekDouble > > &V, const Array< OneD, const NekDouble > &u, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wk=NullNekDouble1DArray)
 Compute the non-conservative advection. More...
 
SOLVER_UTILS_EXPORT void WeakDGAdvection (const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false, int nvariables=0)
 Calculate the weak discontinuous Galerkin advection. More...
 
SOLVER_UTILS_EXPORT void WeakDGDiffusion (const Array< OneD, Array< OneD, NekDouble > > &InField, Array< OneD, Array< OneD, NekDouble > > &OutField, bool NumericalFluxIncludesNormal=true, bool InFieldIsInPhysSpace=false)
 Calculate weak DG Diffusion in the LDG form. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n)
 Write checkpoint file of m_fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_Output (const int n, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write checkpoint file of custom data fields. More...
 
SOLVER_UTILS_EXPORT void Checkpoint_BaseFlow (const int n)
 Write base flow file of m_fields. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname)
 Write field data to the given filename. More...
 
SOLVER_UTILS_EXPORT void WriteFld (const std::string &outname, MultiRegions::ExpListSharedPtr &field, std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
 Write input fields to the given filename. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields)
 Input field data from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFldToMultiDomains (const std::string &infile, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const int ndomains)
 Input field data from the given file to multiple domains. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, std::vector< std::string > &fieldStr, Array< OneD, Array< OneD, NekDouble > > &coeffs)
 Output a field. Input field data into array from the given file. More...
 
SOLVER_UTILS_EXPORT void ImportFld (const std::string &infile, MultiRegions::ExpListSharedPtr &pField, std::string &pFieldName)
 Output a field. Input field data into ExpList from the given file. More...
 
SOLVER_UTILS_EXPORT void ScanForHistoryPoints ()
 Builds map of which element holds each history point. More...
 
SOLVER_UTILS_EXPORT void WriteHistoryData (std::ostream &out)
 Probe each history point and write to file. More...
 
SOLVER_UTILS_EXPORT void SessionSummary (SummaryList &vSummary)
 Write out a session summary. More...
 
SOLVER_UTILS_EXPORT Array
< OneD,
MultiRegions::ExpListSharedPtr > & 
UpdateFields ()
 
SOLVER_UTILS_EXPORT
LibUtilities::FieldMetaDataMap
UpdateFieldMetaDataMap ()
 Get hold of FieldInfoMap so it can be updated. More...
 
SOLVER_UTILS_EXPORT NekDouble GetFinalTime ()
 Return final time. More...
 
SOLVER_UTILS_EXPORT int GetNcoeffs ()
 
SOLVER_UTILS_EXPORT int GetNcoeffs (const int eid)
 
SOLVER_UTILS_EXPORT int GetNumExpModes ()
 
SOLVER_UTILS_EXPORT const
Array< OneD, int > 
GetNumExpModesPerExp ()
 
SOLVER_UTILS_EXPORT int GetNvariables ()
 
SOLVER_UTILS_EXPORT const
std::string 
GetVariable (unsigned int i)
 
SOLVER_UTILS_EXPORT int GetTraceTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTraceNpoints ()
 
SOLVER_UTILS_EXPORT int GetExpSize ()
 
SOLVER_UTILS_EXPORT int GetPhys_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetCoeff_Offset (int n)
 
SOLVER_UTILS_EXPORT int GetTotPoints ()
 
SOLVER_UTILS_EXPORT int GetTotPoints (int n)
 
SOLVER_UTILS_EXPORT int GetNpoints ()
 
SOLVER_UTILS_EXPORT int GetNumElmVelocity ()
 
SOLVER_UTILS_EXPORT int GetSteps ()
 
SOLVER_UTILS_EXPORT NekDouble GetTimeStep ()
 
SOLVER_UTILS_EXPORT void CopyFromPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void CopyToPhysField (const int i, Array< OneD, NekDouble > &output)
 
SOLVER_UTILS_EXPORT void SetSteps (const int steps)
 
SOLVER_UTILS_EXPORT void ZeroPhysFields ()
 
SOLVER_UTILS_EXPORT void FwdTransFields ()
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &fluxX, Array< OneD, Array< OneD, NekDouble > > &fluxY)
 
SOLVER_UTILS_EXPORT void GetFluxVector (const int i, const int j, Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &flux)
 
SOLVER_UTILS_EXPORT void NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
 
SOLVER_UTILS_EXPORT void NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
SOLVER_UTILS_EXPORT void NumFluxforScalar (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
SOLVER_UTILS_EXPORT void NumFluxforVector (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
SOLVER_UTILS_EXPORT void SetModifiedBasis (const bool modbasis)
 
SOLVER_UTILS_EXPORT int NoCaseStringCompare (const std::string &s1, const std::string &s2)
 Perform a case-insensitive string comparison. More...
 
SOLVER_UTILS_EXPORT int GetCheckpointNumber ()
 
SOLVER_UTILS_EXPORT void SetCheckpointNumber (int num)
 
SOLVER_UTILS_EXPORT int GetCheckpointSteps ()
 
SOLVER_UTILS_EXPORT void SetCheckpointSteps (int num)
 
SOLVER_UTILS_EXPORT void SetTime (const NekDouble time)
 
SOLVER_UTILS_EXPORT void SetInitialStep (const int step)
 
SOLVER_UTILS_EXPORT void SetBoundaryConditions (NekDouble time)
 Evaluates the boundary conditions at the given time. More...
 
virtual SOLVER_UTILS_EXPORT bool v_NegatedOp ()
 Virtual function to identify if operator is negated in DoSolve. More...
 

Static Public Member Functions

static
SolverUtils::EquationSystemSharedPtr 
create (const LibUtilities::SessionReaderSharedPtr &pSession)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::ShallowWaterSystem
static
SolverUtils::EquationSystemSharedPtr 
create (const LibUtilities::SessionReaderSharedPtr &pSession)
 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...
 

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)
 
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)
 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)
 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 void v_NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numflux)
 
virtual SOLVER_UTILS_EXPORT void v_NumericalFlux (Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &numfluxX, Array< OneD, Array< OneD, NekDouble > > &numfluxY)
 
virtual SOLVER_UTILS_EXPORT void v_NumFluxforScalar (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &uflux)
 
virtual SOLVER_UTILS_EXPORT void v_NumFluxforVector (const Array< OneD, Array< OneD, NekDouble > > &ufield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &qfield, Array< OneD, Array< OneD, NekDouble > > &qflux)
 
virtual SOLVER_UTILS_EXPORT
NekDouble 
v_GetTimeStep (const Array< OneD, const Array< OneD, NekDouble > > &inarray)
 Return the timestep to be used for the next step in the time-marching loop. More...
 
virtual SOLVER_UTILS_EXPORT bool v_PreIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_PostIntegrate (int step)
 
virtual SOLVER_UTILS_EXPORT bool v_SteadyStateCheck (int step)
 
SOLVER_UTILS_EXPORT void CheckForRestartTime (NekDouble &time)
 
SOLVER_UTILS_EXPORT void SVVVarDiffCoeff (const Array< OneD, Array< OneD, NekDouble > > vel, StdRegions::VarCoeffMap &varCoeffMap)
 Evaluate the SVV diffusion coefficient according to Moura's paper where it should proportional to h time velocity. More...
 
- Protected Member Functions inherited from Nektar::SolverUtils::EquationSystem
SOLVER_UTILS_EXPORT EquationSystem (const LibUtilities::SessionReaderSharedPtr &pSession)
 Initialises EquationSystem class members. More...
 
int nocase_cmp (const std::string &s1, const std::string &s2)
 
virtual SOLVER_UTILS_EXPORT
NekDouble 
v_LinfError (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray)
 Virtual function for the L_inf error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT
NekDouble 
v_L2Error (unsigned int field, const Array< OneD, NekDouble > &exactsoln=NullNekDouble1DArray, bool Normalised=false)
 Virtual function for the L_2 error computation between fields and a given exact solution. More...
 
virtual SOLVER_UTILS_EXPORT void v_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)
 
SOLVER_UTILS_EXPORT void SetUpBaseFields (SpatialDomains::MeshGraphSharedPtr &mesh)
 
SOLVER_UTILS_EXPORT void ImportFldBase (std::string pInfile, SpatialDomains::MeshGraphSharedPtr pGraph)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT
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...
 
LibUtilities::TimeIntegrationWrapperSharedPtr m_intScheme
 Wrapper to the time integration scheme. More...
 
LibUtilities::TimeIntegrationSchemeOperators m_ode
 The time integration scheme operators to use. More...
 
LibUtilities::TimeIntegrationSolutionSharedPtr m_intSoln
 
NekDouble m_epsilon
 
bool m_explicitDiffusion
 Indicates if explicit or implicit treatment of diffusion is used. More...
 
bool m_explicitAdvection
 Indicates if explicit or implicit treatment of advection is used. More...
 
bool m_explicitReaction
 Indicates if explicit or implicit treatment of reaction is used. More...
 
bool m_homoInitialFwd
 Flag to determine if simulation should start in homogeneous forward transformed state. More...
 
std::vector< int > m_intVariables
 
std::vector< FilterSharedPtrm_filters
 
- Protected Attributes inherited from Nektar::SolverUtils::EquationSystem
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
LibUtilities::SessionReaderSharedPtr m_session
 The session reader. More...
 
LibUtilities::FieldIOSharedPtr m_fld
 Field input/output. More...
 
std::map< std::string, Array
< OneD, Array< OneD, float > > > 
m_interpWeights
 Map of the interpolation weights for a specific filename. More...
 
std::map< std::string, Array
< OneD, Array< OneD, unsigned
int > > > 
m_interpInds
 Map of the interpolation indices for a specific filename. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_fields
 Array holding all dependent variables. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_base
 Base fields. More...
 
Array< OneD,
MultiRegions::ExpListSharedPtr
m_derivedfields
 Array holding all dependent variables. More...
 
SpatialDomains::BoundaryConditionsSharedPtr m_boundaryConditions
 Pointer to boundary conditions object. More...
 
SpatialDomains::MeshGraphSharedPtr m_graph
 Pointer to graph defining mesh. More...
 
std::string m_sessionName
 Name of the session. More...
 
NekDouble m_time
 Current time of simulation. More...
 
int m_initialStep
 Number of the step where the simulation should begin. More...
 
NekDouble m_fintime
 Finish time of the simulation. More...
 
NekDouble m_timestep
 Time step size. More...
 
NekDouble m_lambda
 Lambda constant in real system if one required. More...
 
std::set< std::string > m_loadedFields
 
NekDouble m_checktime
 Time between checkpoints. More...
 
int m_nchk
 Number of checkpoints written so far. More...
 
int m_steps
 Number of steps to take. More...
 
int m_checksteps
 Number of steps between checkpoints. More...
 
int m_spacedim
 Spatial dimension (>= expansion dim). More...
 
int m_expdim
 Expansion dimension. More...
 
bool m_singleMode
 Flag to determine if single homogeneous mode is used. More...
 
bool m_halfMode
 Flag to determine if half homogeneous mode is used. More...
 
bool m_multipleModes
 Flag to determine if use multiple homogenenous modes are used. More...
 
bool m_useFFT
 Flag to determine if FFT is used for homogeneous transform. More...
 
bool m_homogen_dealiasing
 Flag to determine if dealiasing is used for homogeneous simulations. More...
 
bool m_specHP_dealiasing
 Flag to determine if dealisising is usde for the Spectral/hp element discretisation. More...
 
enum MultiRegions::ProjectionType m_projectionType
 Type of projection; e.g continuous or discontinuous. More...
 
Array< OneD, Array< OneD,
NekDouble > > 
m_traceNormals
 Array holding trace normals for DG simulations in the forwards direction. More...
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_gradtan
 1 x nvariable x nq More...
 
Array< OneD, Array< OneD,
Array< OneD, NekDouble > > > 
m_tanbasis
 2 x m_spacedim x nq More...
 
Array< OneD, bool > m_checkIfSystemSingular
 Flag to indicate if the fields should be checked for singularity. More...
 
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap
 Map to identify relevant solver info to dump in output fields. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

Private Member Functions

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

Detailed Description

Definition at line 59 of file NonlinearPeregrine.h.

Constructor & Destructor Documentation

Nektar::NonlinearPeregrine::~NonlinearPeregrine ( )
virtual

problem type selector

Definition at line 167 of file NonlinearPeregrine.cpp.

168 {
169 
170 }
Nektar::NonlinearPeregrine::NonlinearPeregrine ( const LibUtilities::SessionReaderSharedPtr pSession)
protected

Definition at line 54 of file NonlinearPeregrine.cpp.

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

56  : ShallowWaterSystem(pSession), m_factors()
57 {
59  m_factors[StdRegions::eFactorTau] = 1000000.0;
60  // note: eFactorTau = 1.0 becomes unstable...
61  // we need to investigate the behaviuor w.r.t. tau
62 }
StdRegions::ConstFactorMap m_factors
ShallowWaterSystem(const LibUtilities::SessionReaderSharedPtr &pSession)
Initialises UnsteadySystem class members.

Member Function Documentation

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

Definition at line 173 of file NonlinearPeregrine.cpp.

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

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

Definition at line 225 of file NonlinearPeregrine.cpp.

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

228 {
229 
230  int ncoeffs = GetNcoeffs();
231  int nq = GetTotPoints();
232 
233  Array<OneD, NekDouble> tmp(nq);
234  Array<OneD, NekDouble> mod(ncoeffs);
235 
236  switch (m_projectionType)
237  {
239  {
240  for (int i = 0; i < m_spacedim; ++i)
241  {
242  Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
243  Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
244  m_fields[0]->IProductWRTBase(tmp, mod);
245  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
246  m_fields[0]->BwdTrans(mod, tmp);
247  Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
248  }
249  break;
250  }
253  {
254  for (int i = 0; i < m_spacedim; ++i)
255  {
256  Vmath::Vmul(nq, m_bottomSlope[i], 1, physarray[0], 1, tmp, 1);
257  Vmath::Smul(nq, m_g, tmp, 1, tmp, 1);
258  Vmath::Vadd(nq, tmp, 1, outarray[i + 1], 1, outarray[i + 1], 1);
259  }
260  break;
261  }
262  default:
263  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
264  break;
265  }
266 
267 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT int GetTotPoints()
Array< OneD, Array< OneD, NekDouble > > m_bottomSlope
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:199
int m_spacedim
Spatial dimension (>= expansion dim).
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetNcoeffs()
NekDouble m_g
Acceleration of gravity.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::NonlinearPeregrine::ConservativeToPrimitive ( const Array< OneD, const Array< OneD, NekDouble > > &  physin,
Array< OneD, Array< OneD, NekDouble > > &  physout 
)
private

Definition at line 750 of file NonlinearPeregrine.cpp.

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

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

Creates an instance of this class.

Definition at line 65 of file NonlinearPeregrine.h.

67  {
68  SolverUtils::EquationSystemSharedPtr p = MemoryManager<
69  NonlinearPeregrine>::AllocateSharedPtr(pSession);
70  p->InitObject();
71  return p;
72  }
NonlinearPeregrine(const LibUtilities::SessionReaderSharedPtr &pSession)
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
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 492 of file NonlinearPeregrine.cpp.

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

496 {
497  int i;
498  int nvariables = inarray.num_elements();
499 
500  switch (m_projectionType)
501  {
503  {
504 
505  // Just copy over array
506  int npoints = GetNpoints();
507 
508  for (i = 0; i < nvariables; ++i)
509  {
510  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
511  }
512 
513  SetBoundaryConditions(outarray, time);
514  break;
515  }
518  {
519 
521  Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs());
522 
523  for (i = 0; i < nvariables; ++i)
524  {
525  m_fields[i]->FwdTrans(inarray[i], coeffs);
526  m_fields[i]->BwdTrans_IterPerExp(coeffs, outarray[i]);
527  }
528  break;
529  }
530  default:
531  ASSERTL0(false, "Unknown projection scheme");
532  break;
533  }
534 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetNcoeffs()
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
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 269 of file NonlinearPeregrine.cpp.

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

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

Definition at line 121 of file NonlinearPeregrine.h.

References m_dBwd.

122  {
123  return m_dBwd;
124  }
Array< OneD, NekDouble > m_dBwd
const Array<OneD, NekDouble>& Nektar::NonlinearPeregrine::GetDepthFwd ( )
inlineprotected

Definition at line 117 of file NonlinearPeregrine.h.

References m_dFwd.

118  {
119  return m_dFwd;
120  }
Array< OneD, NekDouble > m_dFwd
Still water depth traces.
void Nektar::NonlinearPeregrine::GetFluxVector ( const Array< OneD, const Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &  flux 
)
protected

Definition at line 711 of file NonlinearPeregrine.cpp.

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

714 {
715  int i, j;
716  int nq = m_fields[0]->GetTotPoints();
717 
718  NekDouble g = m_g;
719  Array<OneD, Array<OneD, NekDouble> > velocity(m_spacedim);
720 
721  // Flux vector for the mass equation
722  for (i = 0; i < m_spacedim; ++i)
723  {
724  velocity[i] = Array<OneD, NekDouble>(nq);
725  Vmath::Vcopy(nq, physfield[i + 1], 1, flux[0][i], 1);
726  }
727 
728  GetVelocityVector(physfield, velocity);
729 
730  // Put (0.5 g h h) in tmp
731  Array<OneD, NekDouble> tmp(nq);
732  Vmath::Vmul(nq, physfield[0], 1, physfield[0], 1, tmp, 1);
733  Vmath::Smul(nq, 0.5 * g, tmp, 1, tmp, 1);
734 
735  // Flux vector for the momentum equations
736  for (i = 0; i < m_spacedim; ++i)
737  {
738  for (j = 0; j < m_spacedim; ++j)
739  {
740  Vmath::Vmul(nq, velocity[j], 1, physfield[i + 1], 1,
741  flux[i + 1][j], 1);
742  }
743 
744  // Add (0.5 g h h) to appropriate field
745  Vmath::Vadd(nq, flux[i + 1][i], 1, tmp, 1, flux[i + 1][i], 1);
746  }
747 
748 }
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:199
int m_spacedim
Spatial dimension (>= expansion dim).
double NekDouble
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
NekDouble m_g
Acceleration of gravity.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::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 873 of file NonlinearPeregrine.cpp.

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

Referenced by GetFluxVector().

876 {
877  const int npts = physfield[0].num_elements();
878 
879  for (int i = 0; i < m_spacedim; ++i)
880  {
881  Vmath::Vdiv(npts, physfield[1 + i], 1, physfield[0], 1, velocity[i], 1);
882  }
883 }
void Vdiv(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x/y.
Definition: Vmath.cpp:227
static std::string npts
Definition: InputFld.cpp:43
int m_spacedim
Spatial dimension (>= expansion dim).
void Nektar::NonlinearPeregrine::LaitoneSolitaryWave ( NekDouble  amp,
NekDouble  d,
NekDouble  time,
NekDouble  x_offset 
)
private

Definition at line 1161 of file NonlinearPeregrine.cpp.

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

Referenced by v_SetInitialConditions().

1166 {
1167  int nq = GetTotPoints();
1168 
1169  NekDouble A = 1.0;
1170  NekDouble C = sqrt(m_g * d) * (1.0 + 0.5 * (amp / d));
1171 
1172  Array<OneD, NekDouble> x0(nq);
1173  Array<OneD, NekDouble> x1(nq);
1174  Array<OneD, NekDouble> zeros(nq, 0.0);
1175 
1176  // get the coordinates (assuming all fields have the same
1177  // discretisation)
1178  m_fields[0]->GetCoords(x0, x1);
1179 
1180  for (int i = 0; i < nq; i++)
1181  {
1182  (m_fields[0]->UpdatePhys())[i] = amp * pow((1.0 / cosh(
1183  sqrt(0.75 * (amp / (d * d * d))) *
1184  (A * (x0[i] + x_offset) - C * time))), 2.0);
1185  (m_fields[1]->UpdatePhys())[i] = (amp / d) * pow((1.0 / cosh(
1186  sqrt(0.75 * (amp / (d * d * d))) *
1187  (A * (x0[i] + x_offset) - C * time)
1188  )), 2.0) * sqrt(m_g * d);
1189  }
1190 
1191  Vmath::Sadd(nq, d, m_fields[0]->GetPhys(), 1, m_fields[0]->UpdatePhys(), 1);
1192  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
1193  m_fields[1]->UpdatePhys(), 1);
1194  Vmath::Vcopy(nq, zeros, 1, m_fields[2]->UpdatePhys(), 1);
1195  Vmath::Vcopy(nq, zeros, 1, m_fields[3]->UpdatePhys(), 1);
1196 
1197  // Forward transform to fill the coefficient space
1198  for (int i = 0; i < 4; ++i)
1199  {
1200  m_fields[i]->SetPhysState(true);
1201  m_fields[i]->FwdTrans(m_fields[i]->GetPhys(),
1202  m_fields[i]->UpdateCoeffs());
1203  }
1204 
1205 }
SOLVER_UTILS_EXPORT int GetTotPoints()
double NekDouble
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:301
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
NekDouble m_g
Acceleration of gravity.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::NonlinearPeregrine::NumericalFlux1D ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numfluxX 
)
private
void Nektar::NonlinearPeregrine::NumericalFlux2D ( Array< OneD, Array< OneD, NekDouble > > &  physfield,
Array< OneD, Array< OneD, NekDouble > > &  numfluxX,
Array< OneD, Array< OneD, NekDouble > > &  numfluxY 
)
private
void Nektar::NonlinearPeregrine::NumericalFluxConsVariables ( Array< OneD, NekDouble > &  physfield,
Array< OneD, NekDouble > &  outX,
Array< OneD, NekDouble > &  outY 
)
private

Definition at line 1127 of file NonlinearPeregrine.cpp.

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

Referenced by DoOdeRhs().

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

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

Referenced by DoOdeRhs().

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 }
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::NonlinearPeregrine::PrimitiveToConservative ( const Array< OneD, const Array< OneD, NekDouble > > &  physin,
Array< OneD, Array< OneD, NekDouble > > &  physout 
)
private

Definition at line 806 of file NonlinearPeregrine.cpp.

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

809 {
810 
811  int nq = GetTotPoints();
812 
813  if (physin.get() == physout.get())
814  {
815  // copy indata and work with tmp array
816  Array<OneD, Array<OneD, NekDouble> > tmp(3);
817  for (int i = 0; i < 3; ++i)
818  {
819  // deep copy
820  tmp[i] = Array<OneD, NekDouble>(nq);
821  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
822  }
823 
824  // h = \eta + d
825  Vmath::Vadd(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
826 
827  // hu = h * u
828  Vmath::Vmul(nq, physout[0], 1, tmp[1], 1, physout[1], 1);
829 
830  // hv = h * v
831  Vmath::Vmul(nq, physout[0], 1, tmp[2], 1, physout[2], 1);
832 
833  }
834  else
835  {
836  // h = \eta + d
837  Vmath::Vadd(nq, physin[0], 1, m_depth, 1, physout[0], 1);
838 
839  // hu = h * u
840  Vmath::Vmul(nq, physout[0], 1, physin[1], 1, physout[1], 1);
841 
842  // hv = h * v
843  Vmath::Vmul(nq, physout[0], 1, physin[2], 1, physout[2], 1);
844 
845  }
846 
847 }
Array< OneD, NekDouble > m_depth
Still water depth.
SOLVER_UTILS_EXPORT int GetTotPoints()
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::NonlinearPeregrine::SetBoundaryConditions ( Array< OneD, Array< OneD, NekDouble > > &  physarray,
NekDouble  time 
)
private

Definition at line 537 of file NonlinearPeregrine.cpp.

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

Referenced by DoOdeProjection().

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

Definition at line 1070 of file NonlinearPeregrine.cpp.

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

Referenced by DoOdeRhs().

1073 {
1074  int cnt = 0;
1075 
1076  // loop over Boundary Regions
1077  for (int n = 0; n < m_fields[0]->GetBndConditions().num_elements(); ++n)
1078  {
1079  // Use wall for all
1080  // Wall Boundary Condition
1081  if(boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
1082  {
1083  WallBoundaryContVariables(n, cnt, inarray);
1084  }
1085 
1086  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
1087  {
1088  WallBoundaryContVariables(n, cnt, inarray);
1089  }
1090 
1091  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize() - 1;
1092  }
1093 }
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void WallBoundaryContVariables(int bcRegion, int cnt, Array< OneD, NekDouble > &inarray)
void Nektar::NonlinearPeregrine::SetBoundaryConditionsForcing ( Array< OneD, Array< OneD, NekDouble > > &  inarray,
NekDouble  time 
)
private

Definition at line 959 of file NonlinearPeregrine.cpp.

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

Referenced by DoOdeRhs().

962 {
963  int cnt = 0;
964 
965  // loop over Boundary Regions
966  for (int n = 0; n < m_fields[0]->GetBndConditions().num_elements(); ++n)
967  {
968  // Use wall for all BC...
969  // Wall Boundary Condition
970  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),"Wall"))
971  {
972  WallBoundaryForcing(n, cnt, inarray);
973  }
974 
975  //Timedependent Boundary Condition
976  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
977  {
978  ASSERTL0(false, "time-dependent BC not implemented for Boussinesq");
979  }
980  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
981  }
982 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
void WallBoundaryForcing(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &inarray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::NonlinearPeregrine::v_ConservativeToPrimitive ( )
protectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 789 of file NonlinearPeregrine.cpp.

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

790 {
791  int nq = GetTotPoints();
792 
793  // u = hu/h
794  Vmath::Vdiv(nq, m_fields[1]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
795  m_fields[1]->UpdatePhys(), 1);
796 
797  // v = hv/ v
798  Vmath::Vdiv(nq, m_fields[2]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
799  m_fields[2]->UpdatePhys(), 1);
800 
801  // \eta = h - d
802  Vmath::Vsub(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
803  m_fields[0]->UpdatePhys(), 1);
804 }
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:227
SOLVER_UTILS_EXPORT int GetTotPoints()
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:329
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Nektar::NonlinearPeregrine::v_GenerateSummary ( SolverUtils::SummaryList s)
protectedvirtual

Print a summary of time stepping parameters.

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 885 of file NonlinearPeregrine.cpp.

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

886 {
888  SolverUtils::AddSummaryItem(s, "Variables", "h should be in field[0]");
889  SolverUtils::AddSummaryItem(s, "", "hu should be in field[1]");
890  SolverUtils::AddSummaryItem(s, "", "hv should be in field[2]");
891  SolverUtils::AddSummaryItem(s, "", "z should be in field[3]");
892 }
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
Definition: Misc.cpp:50
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
void Nektar::NonlinearPeregrine::v_InitObject ( )
protectedvirtual

Init object for UnsteadySystem class.

Initialization object for UnsteadySystem class.

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 64 of file NonlinearPeregrine.cpp.

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::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().

65 {
67 
68  if (m_session->DefinesSolverInfo("PROBLEMTYPE"))
69  {
70  int i;
71  std::string ProblemTypeStr = m_session->GetSolverInfo("PROBLEMTYPE");
72  for (i = 0; i < (int) SIZE_ProblemType; ++i)
73  {
74  if (boost::iequals(ProblemTypeMap[i], ProblemTypeStr))
75  {
77  break;
78  }
79  }
80  }
81  else
82  {
84  }
85 
87  {
90  }
91  else
92  {
93  ASSERTL0(false, "Implicit Peregrine not set up.");
94  }
95 
96  // NB! At the moment only the constant depth case is
97  // supported for the Peregrine eq.
98  if (m_session->DefinesParameter("ConstDepth"))
99  {
100  m_const_depth = m_session->GetParameter("ConstDepth");
101  }
102  else
103  {
104  ASSERTL0(false, "Constant Depth not specified");
105  }
106 
107  // Type of advection class to be used
108  switch (m_projectionType)
109  {
110  // Continuous field
112  {
113  ASSERTL0(false,
114  "Continuous projection type not supported for Peregrine.");
115  break;
116  }
117  // Discontinuous field
119  {
120  string advName;
121  string diffName;
122  string riemName;
123 
124  //---------------------------------------------------------------
125  // Setting up advection and diffusion operators
126  // NB: diffusion not set up for SWE at the moment
127  // but kept here for future use ...
128  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
129  // m_session->LoadSolverInfo("DiffusionType", diffName, "LDG");
131  advName, advName);
132 
134  this);
135 
136  // Setting up Riemann solver for advection operator
137  m_session->LoadSolverInfo("UpwindType", riemName, "NoSolver");
138 
141  riemName);
142 
143  // Setting up parameters for advection operator Riemann solver
144  m_riemannSolver->SetParam("gravity",
146  m_riemannSolver->SetAuxVec("vecLocs",
149  this);
150  m_riemannSolver->SetScalar("depth", &NonlinearPeregrine::GetDepth,
151  this);
152 
153  // Concluding initialisation of advection / diffusion operators
154  m_advection->SetRiemannSolver(m_riemannSolver);
155  m_advection->InitObject(m_session, m_fields);
156  break;
157  }
158  default:
159  {
160  ASSERTL0(false, "Unsupported projection type.");
161  break;
162  }
163  }
164 
165 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:162
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
SolverUtils::AdvectionSharedPtr m_advection
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
const Array< OneD, NekDouble > & GetDepth()
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
virtual void v_InitObject()
Init object for UnsteadySystem class.
RiemannSolverFactory & GetRiemannSolverFactory()
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
Definition: Advection.cpp:46
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Length of enum list.
Definition: EulerADCFE.h:47
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
ProblemType
Definition: EulerADCFE.h:44
const char *const ProblemTypeMap[]
Definition: EulerADCFE.h:50
void Nektar::NonlinearPeregrine::v_PrimitiveToConservative ( )
protectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 849 of file NonlinearPeregrine.cpp.

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

850 {
851  int nq = GetTotPoints();
852 
853  // h = \eta + d
854  Vmath::Vadd(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
855  m_fields[0]->UpdatePhys(), 1);
856 
857  // hu = h * u
858  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
859  m_fields[1]->UpdatePhys(), 1);
860 
861  // hv = h * v
862  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[2]->GetPhys(), 1,
863  m_fields[2]->UpdatePhys(), 1);
864 }
Array< OneD, NekDouble > m_depth
Still water depth.
SOLVER_UTILS_EXPORT int GetTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
Definition: Vmath.cpp:285
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::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 1210 of file NonlinearPeregrine.cpp.

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

1214 {
1215 
1216  switch (m_problemType)
1217  {
1218  case eSolitaryWave:
1219  {
1220  LaitoneSolitaryWave(0.1, m_const_depth, 0.0, 0.0);
1221  break;
1222  }
1223  default:
1224  {
1225  EquationSystem::v_SetInitialConditions(initialtime, false);
1226  break;
1227  }
1228  }
1229 
1230  if (dumpInitialConditions)
1231  {
1232  // Dump initial conditions to file
1233  Checkpoint_Output(0);
1234  }
1235 }
SOLVER_UTILS_EXPORT void Checkpoint_Output(const int n)
Write checkpoint file of m_fields.
virtual SOLVER_UTILS_EXPORT void v_SetInitialConditions(NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
First order Laitone solitary wave.
void LaitoneSolitaryWave(NekDouble amp, NekDouble d, NekDouble time, NekDouble x_offset)
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 581 of file NonlinearPeregrine.cpp.

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

584 {
585  int i;
586  int nvariables = physarray.num_elements();
587 
588  // Adjust the physical values of the trace to take
589  // user defined boundaries into account
590  int e, id1, id2, npts;
592  m_fields[0]->GetBndCondExpansions()[bcRegion];
593  for (e = 0; e < bcexp->GetExpSize(); ++e)
594  {
595  npts = bcexp->GetExp(e)->GetTotPoints();
596  id1 = bcexp->GetPhys_Offset(e);
597  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
598  m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(
599  cnt + e));
600 
601  // For 2D/3D, define: v* = v - 2(v.n)n
602  Array<OneD, NekDouble> tmp(npts, 0.0);
603 
604  // Calculate (v.n)
605  for (i = 0; i < m_spacedim; ++i)
606  {
607  Vmath::Vvtvp(npts, &Fwd[1 + i][id2], 1, &m_traceNormals[i][id2], 1,
608  &tmp[0], 1, &tmp[0], 1);
609  }
610 
611  // Calculate 2.0(v.n)
612  Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1);
613 
614  // Calculate v* = v - 2.0(v.n)n
615  for (i = 0; i < m_spacedim; ++i)
616  {
617  Vmath::Vvtvp(npts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
618  &Fwd[1 + i][id2], 1, &Fwd[1 + i][id2], 1);
619  }
620 
621  // copy boundary adjusted values into the boundary expansion
622  for (i = 0; i < nvariables; ++i)
623  {
624  bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
625  Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
626  }
627  }
628 }
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:199
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static std::string npts
Definition: InputFld.cpp:43
int m_spacedim
Spatial dimension (>= expansion dim).
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Nektar::NonlinearPeregrine::WallBoundary2D ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  Fwd,
Array< OneD, Array< OneD, NekDouble > > &  physarray 
)
private

Definition at line 630 of file NonlinearPeregrine.cpp.

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

Referenced by SetBoundaryConditions().

635 {
636 
637  int i;
638  int nvariables = 3;
639 
640  // Adjust the physical values of the trace to take
641  // user defined boundaries into account
642  int e, id1, id2, npts;
644  m_fields[0]->GetBndCondExpansions()[bcRegion];
645 
646  for (e = 0; e < bcexp->GetExpSize();
647  ++e)
648  {
649  npts = bcexp->GetExp(e)->GetNumPoints(0);
650  id1 = bcexp->GetPhys_Offset(e);
651  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
652  m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(
653  cnt + e));
654 
655  switch (m_expdim)
656  {
657  case 1:
658  {
659  // negate the forward flux
660  Vmath::Neg(npts, &Fwd[1][id2], 1);
661  break;
662  }
663  case 2:
664  {
665  Array<OneD, NekDouble> tmp_n(npts);
666  Array<OneD, NekDouble> tmp_t(npts);
667 
668  Vmath::Vmul (npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
669  &tmp_n[0], 1);
670  Vmath::Vvtvp(npts, &Fwd[2][id2], 1, &m_traceNormals[1][id2], 1,
671  &tmp_n[0], 1, &tmp_n[0], 1);
672 
673  Vmath::Vmul (npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
674  &tmp_t[0], 1);
675  Vmath::Vvtvm(npts, &Fwd[2][id2], 1, &m_traceNormals[0][id2], 1,
676  &tmp_t[0], 1, &tmp_t[0], 1);
677 
678  // negate the normal flux
679  Vmath::Neg(npts, tmp_n, 1);
680 
681  // rotate back to Cartesian
682  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
683  &Fwd[1][id2], 1);
684  Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
685  &Fwd[1][id2], 1, &Fwd[1][id2], 1);
686 
687  Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
688  &Fwd[2][id2], 1);
689  Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
690  &Fwd[2][id2], 1, &Fwd[2][id2], 1);
691  break;
692  }
693  case 3:
694  ASSERTL0(false,
695  "3D not implemented for Shallow Water Equations");
696  break;
697  default:
698  ASSERTL0(false, "Illegal expansion dimension");
699  }
700 
701  // copy boundary adjusted values into the boundary expansion
702  for (i = 0; i < nvariables; ++i)
703  {
704  bcexp = m_fields[i]->GetBndCondExpansions()[bcRegion];
705  Vmath::Vcopy(npts, &Fwd[i][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
706  }
707  }
708 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
int m_expdim
Expansion dimension.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static std::string npts
Definition: InputFld.cpp:43
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void 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:451
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::NonlinearPeregrine::WallBoundaryContVariables ( int  bcRegion,
int  cnt,
Array< OneD, NekDouble > &  inarray 
)
private

Definition at line 1095 of file NonlinearPeregrine.cpp.

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

Referenced by SetBoundaryConditionsContVariables().

1099 {
1100  int nTraceNumPoints = GetTraceTotPoints();
1101 
1102  // get physical values of z for the forward trace
1103  Array<OneD, NekDouble> z(nTraceNumPoints);
1104  m_fields[0]->ExtractTracePhys(inarray, z);
1105 
1106  // Adjust the physical values of the trace to take
1107  // user defined boundaries into account
1108  int e, id1, id2, npts;
1110  m_fields[0]->GetBndCondExpansions()[bcRegion];
1111 
1112  for (e = 0; e < bcexp->GetExpSize(); ++e)
1113  {
1114  npts = bcexp->GetExp(e)->GetTotPoints();
1115  id1 = bcexp->GetPhys_Offset(e);
1116  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1117  m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(
1118  cnt + e));
1119 
1120  // copy boundary adjusted values into the boundary expansion field[1] and field[2]
1121  bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1122  Vmath::Vcopy(npts, &z[id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1123 
1124  }
1125 }
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static std::string npts
Definition: InputFld.cpp:43
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Nektar::NonlinearPeregrine::WallBoundaryForcing ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble > > &  inarray 
)
private

Definition at line 985 of file NonlinearPeregrine.cpp.

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

Referenced by SetBoundaryConditionsForcing().

989 {
990 
991  //std::cout << " WallBoundaryForcing" << std::endl;
992 
993  int nTraceNumPoints = GetTraceTotPoints();
994  int nvariables = 2;
995 
996  // get physical values of f1 and f2 for the forward trace
997  Array<OneD, Array<OneD, NekDouble> > Fwd(nvariables);
998  for (int i = 0; i < nvariables; ++i)
999  {
1000  Fwd[i] = Array<OneD, NekDouble>(nTraceNumPoints);
1001  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
1002  }
1003 
1004  // Adjust the physical values of the trace to take
1005  // user defined boundaries into account
1006  int e, id1, id2, npts;
1008  m_fields[0]->GetBndCondExpansions()[bcRegion];
1009  for (e = 0; e < bcexp->GetExpSize(); ++e)
1010  {
1011  npts = bcexp->GetExp(e)->GetTotPoints();
1012  id1 = bcexp->GetPhys_Offset(e);
1013  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
1014  m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(
1015  cnt + e));
1016 
1017  switch (m_expdim)
1018  {
1019  case 1:
1020  {
1021  ASSERTL0(false, "1D not yet implemented for Boussinesq");
1022  break;
1023  }
1024  case 2:
1025  {
1026  Array<OneD, NekDouble> tmp_n(npts);
1027  Array<OneD, NekDouble> tmp_t(npts);
1028 
1029  Vmath::Vmul (npts, &Fwd[0][id2], 1, &m_traceNormals[0][id2], 1,
1030  &tmp_n[0], 1);
1031  Vmath::Vvtvp(npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
1032  &tmp_n[0], 1, &tmp_n[0], 1);
1033 
1034  Vmath::Vmul (npts, &Fwd[0][id2], 1, &m_traceNormals[1][id2], 1,
1035  &tmp_t[0], 1);
1036  Vmath::Vvtvm(npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
1037  &tmp_t[0], 1, &tmp_t[0], 1);
1038 
1039  // negate the normal flux
1040  Vmath::Neg(npts, tmp_n, 1);
1041 
1042  // rotate back to Cartesian
1043  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
1044  &Fwd[0][id2], 1);
1045  Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
1046  &Fwd[0][id2], 1, &Fwd[0][id2], 1);
1047 
1048  Vmath::Vmul (npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
1049  &Fwd[1][id2], 1);
1050  Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
1051  &Fwd[1][id2], 1, &Fwd[1][id2], 1);
1052  break;
1053  }
1054  case 3:
1055  ASSERTL0(false, "3D not implemented for Boussinesq equations");
1056  break;
1057  default:
1058  ASSERTL0(false, "Illegal expansion dimension");
1059  }
1060 
1061  // copy boundary adjusted values into the boundary expansion
1062  bcexp = m_fields[1]->GetBndCondExpansions()[bcRegion];
1063  Vmath::Vcopy(npts, &Fwd[0][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1064 
1065  bcexp = m_fields[2]->GetBndCondExpansions()[bcRegion];
1066  Vmath::Vcopy(npts, &Fwd[1][id2], 1, &(bcexp->UpdatePhys())[id1], 1);
1067  }
1068 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
int m_expdim
Expansion dimension.
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
Definition: Vmath.cpp:428
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static std::string npts
Definition: InputFld.cpp:43
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:382
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
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:451
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
Definition: Vmath.cpp:169
void Nektar::NonlinearPeregrine::WCESolve ( Array< OneD, NekDouble > &  fce,
NekDouble  lambda 
)
private

Definition at line 894 of file NonlinearPeregrine.cpp.

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

Referenced by DoOdeRhs().

897 {
898  int nq = GetTotPoints();
899 
901 
902  for (int j = 0; j < nq; j++)
903  {
904  (m_fields[3]->UpdatePhys())[j] = fce[j];
905  }
906 
907  m_fields[3]->SetPhysState(true);
908 
909  m_fields[3]->HelmSolve(m_fields[3]->GetPhys(),
910  m_fields[3]->UpdateCoeffs(),
911  NullFlagList,
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 }
SOLVER_UTILS_EXPORT int GetTotPoints()
StdRegions::ConstFactorMap m_factors
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1047
static FlagList NullFlagList
An empty flag list.

Friends And Related Function Documentation

friend class MemoryManager< NonlinearPeregrine >
friend

Definition at line 62 of file NonlinearPeregrine.h.

Member Data Documentation

string Nektar::NonlinearPeregrine::className
static
Initial value:
=
"NonlinearPeregrine", NonlinearPeregrine::create,
"Nonlinear Peregrine equations in conservative variables.")

Name of class.

Definition at line 74 of file NonlinearPeregrine.h.

NekDouble Nektar::NonlinearPeregrine::m_const_depth
private

Definition at line 127 of file NonlinearPeregrine.h.

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

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

Definition at line 90 of file NonlinearPeregrine.h.

Referenced by GetDepthBwd().

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

Still water depth traces.

Definition at line 89 of file NonlinearPeregrine.h.

Referenced by GetDepthFwd().

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

Definition at line 82 of file NonlinearPeregrine.h.

Referenced by NonlinearPeregrine(), and WCESolve().

ProblemType Nektar::NonlinearPeregrine::m_problemType

Definition at line 79 of file NonlinearPeregrine.h.

Referenced by v_InitObject(), and v_SetInitialConditions().