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

#include <LinearSWE.h>

Inheritance diagram for Nektar::LinearSWE:
[legend]

Public Member Functions

virtual ~LinearSWE ()
 
- 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 (bool DeclareField=true)
 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 Array< OneD, const Array< OneD, NekDouble > > GetTraceNormals ()
 
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...
 

Static Public Attributes

static std::string className
 Name of class. More...
 
- Static Public Attributes inherited from Nektar::ShallowWaterSystem
static std::string className
 Name of class. More...
 
- Static Public Attributes inherited from Nektar::SolverUtils::UnsteadySystem
static std::string cmdSetStartTime
 
static std::string cmdSetStartChkNum
 

Protected Member Functions

 LinearSWE (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
 
virtual void v_InitObject (bool DeclareFields=true)
 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 ()
 
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_SetInitialConditions (NekDouble initialtime=0.0, bool dumpInitialConditions=true, const int domain=0)
 
virtual SOLVER_UTILS_EXPORT void v_EvaluateExactSolution (unsigned int field, Array< OneD, NekDouble > &outfield, const NekDouble time)
 
virtual SOLVER_UTILS_EXPORT void v_Output (void)
 
virtual SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr v_GetPressure (void)
 
virtual SOLVER_UTILS_EXPORT void v_ExtraFldOutput (std::vector< Array< OneD, NekDouble >> &fieldcoeffs, std::vector< std::string > &variables)
 

Protected Attributes

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...
 
Array< OneD, NekDoublem_movingFrameVelsxyz
 Moving frame of reference velocities. More...
 
Array< OneD, NekDoublem_movingFrameTheta
 Moving frame of reference angles with respect to the. More...
 
boost::numeric::ublas::matrix< NekDoublem_movingFrameProjMat
 Projection matrix for transformation between inertial and moving. More...
 
int m_NumQuadPointsError
 Number of Quadrature points used to work out the error. More...
 
enum HomogeneousType m_HomogeneousType
 
NekDouble m_LhomX
 physical length in X direction (if homogeneous) More...
 
NekDouble m_LhomY
 physical length in Y direction (if homogeneous) More...
 
NekDouble m_LhomZ
 physical length in Z direction (if homogeneous) More...
 
int m_npointsX
 number of points in X direction (if homogeneous) More...
 
int m_npointsY
 number of points in Y direction (if homogeneous) More...
 
int m_npointsZ
 number of points in Z direction (if homogeneous) More...
 
int m_HomoDirec
 number of homogenous directions More...
 

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

Friends

class MemoryManager< LinearSWE >
 

Additional Inherited Members

- 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...
 
- 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 48 of file LinearSWE.h.

Constructor & Destructor Documentation

◆ ~LinearSWE()

Nektar::LinearSWE::~LinearSWE ( )
virtual

Definition at line 159 of file LinearSWE.cpp.

160 {
161 }

◆ LinearSWE()

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

Definition at line 51 of file LinearSWE.cpp.

53  : ShallowWaterSystem(pSession, pGraph)
54 {
55 }
ShallowWaterSystem(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Initialises UnsteadySystem class members.

Member Function Documentation

◆ AddCoriolis()

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

Definition at line 164 of file LinearSWE.cpp.

167 {
168 
169  int ncoeffs = GetNcoeffs();
170  int nq = GetTotPoints();
171 
172  Array<OneD, NekDouble> tmp(nq);
173  Array<OneD, NekDouble> mod(ncoeffs);
174 
175  switch (m_projectionType)
176  {
178  {
179  // add to u equation
180  Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
181  m_fields[0]->IProductWRTBase(tmp, mod);
182  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
183  m_fields[0]->BwdTrans(mod, tmp);
184  Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
185 
186  // add to v equation
187  Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
188  Vmath::Neg(nq, tmp, 1);
189  m_fields[0]->IProductWRTBase(tmp, mod);
190  m_fields[0]->MultiplyByElmtInvMass(mod, mod);
191  m_fields[0]->BwdTrans(mod, tmp);
192  Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
193  }
194  break;
197  {
198  // add to u equation
199  Vmath::Vmul(nq, m_coriolis, 1, physarray[2], 1, tmp, 1);
200  Vmath::Vadd(nq, tmp, 1, outarray[1], 1, outarray[1], 1);
201 
202  // add to v equation
203  Vmath::Vmul(nq, m_coriolis, 1, physarray[1], 1, tmp, 1);
204  Vmath::Neg(nq, tmp, 1);
205  Vmath::Vadd(nq, tmp, 1, outarray[2], 1, outarray[2], 1);
206  }
207  break;
208  default:
209  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
210  break;
211  }
212 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
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:209
void Neg(int n, T *x, const int incx)
Negate x = -x.
Definition: Vmath.cpp:518
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:359

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

◆ ConservativeToPrimitive()

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

Definition at line 576 of file LinearSWE.cpp.

579 {
580  int nq = GetTotPoints();
581 
582  if (physin.get() == physout.get())
583  {
584  // copy indata and work with tmp array
585  Array<OneD, Array<OneD, NekDouble>> tmp(3);
586  for (int i = 0; i < 3; ++i)
587  {
588  // deep copy
589  tmp[i] = Array<OneD, NekDouble>(nq);
590  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
591  }
592 
593  // \eta = h - d
594  Vmath::Vsub(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
595 
596  // u = hu/h
597  Vmath::Vdiv(nq, tmp[1], 1, tmp[0], 1, physout[1], 1);
598 
599  // v = hv/ v
600  Vmath::Vdiv(nq, tmp[2], 1, tmp[0], 1, physout[2], 1);
601  }
602  else
603  {
604  // \eta = h - d
605  Vmath::Vsub(nq, physin[0], 1, m_depth, 1, physout[0], 1);
606 
607  // u = hu/h
608  Vmath::Vdiv(nq, physin[1], 1, physin[0], 1, physout[1], 1);
609 
610  // v = hv/ v
611  Vmath::Vdiv(nq, physin[2], 1, physin[0], 1, physout[2], 1);
612  }
613 }
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:284
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255
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:419

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

◆ create()

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

Creates an instance of this class.

Definition at line 54 of file LinearSWE.h.

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

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

◆ DoOdeProjection()

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

Definition at line 313 of file LinearSWE.cpp.

316 {
317  int i;
318  int nvariables = inarray.size();
319 
320  switch (m_projectionType)
321  {
323  {
324 
325  // Just copy over array
326  int npoints = GetNpoints();
327 
328  for (i = 0; i < nvariables; ++i)
329  {
330  Vmath::Vcopy(npoints, inarray[i], 1, outarray[i], 1);
331  }
332  SetBoundaryConditions(outarray, time);
333  break;
334  }
337  {
338 
340  Array<OneD, NekDouble> coeffs(m_fields[0]->GetNcoeffs(), 0.0);
341 
342  for (i = 0; i < nvariables; ++i)
343  {
344  m_fields[i]->FwdTrans(inarray[i], coeffs);
345  m_fields[i]->BwdTrans(coeffs, outarray[i]);
346  }
347  break;
348  }
349  default:
350  ASSERTL0(false, "Unknown projection scheme");
351  break;
352  }
353 }
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble >> &physarray, NekDouble time)
Definition: LinearSWE.cpp:356
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::LinearSWE::DoOdeRhs ( const Array< OneD, const Array< OneD, NekDouble >> &  inarray,
Array< OneD, Array< OneD, NekDouble >> &  outarray,
const NekDouble  time 
)
protected

Definition at line 214 of file LinearSWE.cpp.

217 {
218  int i, j;
219  int ndim = m_spacedim;
220  int nvariables = inarray.size();
221  int nq = GetTotPoints();
222 
223  switch (m_projectionType)
224  {
226  {
227 
228  //-------------------------------------------------------
229  // Compute the DG advection including the numerical flux
230  // by using SolverUtils/Advection
231  // Input and output in physical space
232  Array<OneD, Array<OneD, NekDouble>> advVel;
233 
234  m_advection->Advect(nvariables, m_fields, advVel, inarray, outarray,
235  time);
236  //-------------------------------------------------------
237 
238  //-------------------------------------------------------
239  // negate the outarray since moving terms to the rhs
240  for (i = 0; i < nvariables; ++i)
241  {
242  Vmath::Neg(nq, outarray[i], 1);
243  }
244  //-------------------------------------------------------
245 
246  //-------------------------------------------------
247  // Add "source terms"
248  // Input and output in physical space
249 
250  // Coriolis forcing
251  if (m_coriolis.size() != 0)
252  {
253  AddCoriolis(inarray, outarray);
254  }
255  //-------------------------------------------------
256  }
257  break;
260  {
261 
262  //-------------------------------------------------------
263  // Compute the fluxvector in physical space
264  Array<OneD, Array<OneD, Array<OneD, NekDouble>>> fluxvector(
265  nvariables);
266 
267  for (i = 0; i < nvariables; ++i)
268  {
269  fluxvector[i] = Array<OneD, Array<OneD, NekDouble>>(ndim);
270  for (j = 0; j < ndim; ++j)
271  {
272  fluxvector[i][j] = Array<OneD, NekDouble>(nq);
273  }
274  }
275 
276  LinearSWE::GetFluxVector(inarray, fluxvector);
277  //-------------------------------------------------------
278 
279  //-------------------------------------------------------
280  // Take the derivative of the flux terms
281  // and negate the outarray since moving terms to the rhs
282  Array<OneD, NekDouble> tmp(nq);
283  Array<OneD, NekDouble> tmp1(nq);
284 
285  for (i = 0; i < nvariables; ++i)
286  {
287  m_fields[i]->PhysDeriv(MultiRegions::DirCartesianMap[0],
288  fluxvector[i][0], tmp);
289  m_fields[i]->PhysDeriv(MultiRegions::DirCartesianMap[1],
290  fluxvector[i][1], tmp1);
291  Vmath::Vadd(nq, tmp, 1, tmp1, 1, outarray[i], 1);
292  Vmath::Neg(nq, outarray[i], 1);
293  }
294 
295  //-------------------------------------------------
296  // Add "source terms"
297  // Input and output in physical space
298 
299  // Coriolis forcing
300  if (m_coriolis.size() != 0)
301  {
302  AddCoriolis(inarray, outarray);
303  }
304  //-------------------------------------------------
305  }
306  break;
307  default:
308  ASSERTL0(false, "Unknown projection scheme for the NonlinearSWE");
309  break;
310  }
311 }
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble >> &physarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
Definition: LinearSWE.cpp:164
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble >>> &flux)
Definition: LinearSWE.cpp:542
SolverUtils::AdvectionSharedPtr m_advection
int m_spacedim
Spatial dimension (>= expansion dim).
MultiRegions::Direction const DirCartesianMap[]
Definition: ExpList.h:89

References AddCoriolis(), ASSERTL0, Nektar::MultiRegions::DirCartesianMap, Nektar::MultiRegions::eDiscontinuous, Nektar::MultiRegions::eGalerkin, Nektar::MultiRegions::eMixed_CG_Discontinuous, GetFluxVector(), Nektar::SolverUtils::EquationSystem::GetTotPoints(), Nektar::ShallowWaterSystem::m_advection, Nektar::ShallowWaterSystem::m_coriolis, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Neg(), and Vmath::Vadd().

Referenced by v_InitObject().

◆ GetDepthBwd()

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

Definition at line 100 of file LinearSWE.h.

101  {
102  return m_dBwd;
103  }
Array< OneD, NekDouble > m_dBwd
Definition: LinearSWE.h:76

References m_dBwd.

Referenced by v_InitObject().

◆ GetDepthFwd()

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

Definition at line 96 of file LinearSWE.h.

97  {
98  return m_dFwd;
99  }
Array< OneD, NekDouble > m_dFwd
Still water depth traces.
Definition: LinearSWE.h:75

References m_dFwd.

Referenced by v_InitObject().

◆ GetFluxVector()

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

Definition at line 542 of file LinearSWE.cpp.

545 {
546  int i, j;
547  int nq = m_fields[0]->GetTotPoints();
548 
549  NekDouble g = m_g;
550 
551  // Flux vector for the mass equation
552  for (i = 0; i < m_spacedim; ++i)
553  {
554  Vmath::Vmul(nq, m_depth, 1, physfield[i + 1], 1, flux[0][i], 1);
555  }
556 
557  // Put (g eta) in tmp
558  Array<OneD, NekDouble> tmp(nq);
559  Vmath::Smul(nq, g, physfield[0], 1, tmp, 1);
560 
561  // Flux vector for the momentum equations
562  for (i = 0; i < m_spacedim; ++i)
563  {
564  for (j = 0; j < m_spacedim; ++j)
565  {
566  // must zero fluxes as not initialised to zero in AdvectionWeakDG
567  // ...
568  Vmath::Zero(nq, flux[i + 1][j], 1);
569  }
570 
571  // Add (g eta) to appropriate field
572  Vmath::Vadd(nq, flux[i + 1][i], 1, tmp, 1, flux[i + 1][i], 1);
573  }
574 }
NekDouble m_g
Acceleration of gravity.
double NekDouble
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:248
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:492

References Nektar::ShallowWaterSystem::m_depth, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::ShallowWaterSystem::m_g, Nektar::SolverUtils::EquationSystem::m_spacedim, Vmath::Smul(), Vmath::Vadd(), Vmath::Vmul(), and Vmath::Zero().

Referenced by DoOdeRhs(), and v_InitObject().

◆ GetVelocityVector()

void Nektar::LinearSWE::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
physfieldVelocity field.
velocityVelocity field.

Definition at line 696 of file LinearSWE.cpp.

699 {
700  const int npts = physfield[0].size();
701 
702  for (int i = 0; i < m_spacedim; ++i)
703  {
704  Vmath::Vcopy(npts, physfield[1 + i], 1, velocity[i], 1);
705  }
706 }

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

◆ NumericalFlux1D()

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

◆ NumericalFlux2D()

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

◆ PrimitiveToConservative()

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

Definition at line 632 of file LinearSWE.cpp.

635 {
636 
637  int nq = GetTotPoints();
638 
639  if (physin.get() == physout.get())
640  {
641  // copy indata and work with tmp array
642  Array<OneD, Array<OneD, NekDouble>> tmp(3);
643  for (int i = 0; i < 3; ++i)
644  {
645  // deep copy
646  tmp[i] = Array<OneD, NekDouble>(nq);
647  Vmath::Vcopy(nq, physin[i], 1, tmp[i], 1);
648  }
649 
650  // h = \eta + d
651  Vmath::Vadd(nq, tmp[0], 1, m_depth, 1, physout[0], 1);
652 
653  // hu = h * u
654  Vmath::Vmul(nq, physout[0], 1, tmp[1], 1, physout[1], 1);
655 
656  // hv = h * v
657  Vmath::Vmul(nq, physout[0], 1, tmp[2], 1, physout[2], 1);
658  }
659  else
660  {
661  // h = \eta + d
662  Vmath::Vadd(nq, physin[0], 1, m_depth, 1, physout[0], 1);
663 
664  // hu = h * u
665  Vmath::Vmul(nq, physout[0], 1, physin[1], 1, physout[1], 1);
666 
667  // hv = h * v
668  Vmath::Vmul(nq, physout[0], 1, physin[2], 1, physout[2], 1);
669  }
670 }

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

◆ SetBoundaryConditions()

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

Definition at line 356 of file LinearSWE.cpp.

358 {
359  std::string varName;
360  int nvariables = m_fields.size();
361  int cnt = 0;
362  int nTracePts = GetTraceTotPoints();
363 
364  // Extract trace for boundaries. Needs to be done on all processors to avoid
365  // deadlock.
366  Array<OneD, Array<OneD, NekDouble>> Fwd(nvariables);
367  for (int i = 0; i < nvariables; ++i)
368  {
369  Fwd[i] = Array<OneD, NekDouble>(nTracePts);
370  m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
371  }
372 
373  // loop over Boundary Regions
374  for (int n = 0; n < m_fields[0]->GetBndConditions().size(); ++n)
375  {
376  if (m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType() ==
378  {
379  continue;
380  }
381 
382  // Wall Boundary Condition
383  if (boost::iequals(m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
384  "Wall"))
385  {
386  WallBoundary2D(n, cnt, Fwd, inarray);
387  }
388 
389  // Time Dependent Boundary Condition (specified in meshfile)
390  if (m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
391  {
392  for (int i = 0; i < nvariables; ++i)
393  {
394  varName = m_session->GetVariable(i);
395  m_fields[i]->EvaluateBoundaryConditions(time, varName);
396  }
397  }
398  cnt += m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
399  }
400 }
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble >> &Fwd, Array< OneD, Array< OneD, NekDouble >> &physarray)
Definition: LinearSWE.cpp:460
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
LibUtilities::SessionReaderSharedPtr m_session
The session reader.

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

Referenced by DoOdeProjection().

◆ v_ConservativeToPrimitive()

void Nektar::LinearSWE::v_ConservativeToPrimitive ( )
protectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 615 of file LinearSWE.cpp.

616 {
617  int nq = GetTotPoints();
618 
619  // u = hu/h
620  Vmath::Vdiv(nq, m_fields[1]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
621  m_fields[1]->UpdatePhys(), 1);
622 
623  // v = hv/ v
624  Vmath::Vdiv(nq, m_fields[2]->GetPhys(), 1, m_fields[0]->GetPhys(), 1,
625  m_fields[2]->UpdatePhys(), 1);
626 
627  // \eta = h - d
628  Vmath::Vsub(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
629  m_fields[0]->UpdatePhys(), 1);
630 }

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

◆ v_GenerateSummary()

void Nektar::LinearSWE::v_GenerateSummary ( SolverUtils::SummaryList s)
protectedvirtual

Print a summary of time stepping parameters.

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 708 of file LinearSWE.cpp.

709 {
711  if (m_session->DefinesSolverInfo("UpwindType"))
712  {
713  std::string UpwindType;
714  UpwindType = m_session->GetSolverInfo("UpwindType");
715  if (UpwindType == "LinearAverage")
716  {
717  SolverUtils::AddSummaryItem(s, "Riemann Solver", "Linear Average");
718  }
719  if (UpwindType == "LinearHLL")
720  {
721  SolverUtils::AddSummaryItem(s, "Riemann Solver", "Linear HLL");
722  }
723  }
724  SolverUtils::AddSummaryItem(s, "Variables", "eta should be in field[0]");
725  SolverUtils::AddSummaryItem(s, "", "u should be in field[1]");
726  SolverUtils::AddSummaryItem(s, "", "v should be in field[2]");
727 }
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:49

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

◆ v_InitObject()

void Nektar::LinearSWE::v_InitObject ( bool  DeclareField = true)
protectedvirtual

Init object for UnsteadySystem class.

Initialization object for UnsteadySystem class.

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 57 of file LinearSWE.cpp.

58 {
59  ShallowWaterSystem::v_InitObject(DeclareFields);
60 
62  {
65  }
66  else
67  {
68  ASSERTL0(false, "Implicit SWE not set up.");
69  }
70 
71  // Type of advection class to be used
72  switch (m_projectionType)
73  {
74  // Continuous field
76  {
77  // Do nothing
78  break;
79  }
80  // Discontinuous field
82  {
83  string advName;
84  string diffName;
85  string riemName;
86 
87  //---------------------------------------------------------------
88  // Setting up advection and diffusion operators
89  // NB: diffusion not set up for SWE at the moment
90  // but kept here for future use ...
91  m_session->LoadSolverInfo("AdvectionType", advName, "WeakDG");
92  // m_session->LoadSolverInfo("DiffusionType", diffName, "LDGEddy");
94  advName, advName);
95  // m_diffusion = SolverUtils::GetDiffusionFactory()
96  // .CreateInstance(diffName, diffName);
97 
98  m_advection->SetFluxVector(&LinearSWE::GetFluxVector, this);
99  // m_diffusion->SetFluxVectorNS(&ShallowWaterSystem::
100  // GetEddyViscosityFluxVector,
101  // this);
102 
103  // Setting up Riemann solver for advection operator
104  m_session->LoadSolverInfo("UpwindType", riemName, "NoSolver");
105  if ((riemName == "LinearHLL") && (m_constantDepth != true))
106  {
107  ASSERTL0(false, "LinearHLL only valid for constant depth");
108  }
111  riemName, m_session);
112 
113  // Setting up upwind solver for diffusion operator
114  // m_riemannSolverLDG = SolverUtils::GetRiemannSolverFactory()
115  // .CreateInstance("UpwindLDG");
116 
117  // Setting up parameters for advection operator Riemann solver
118  m_riemannSolver->SetParam("gravity", &LinearSWE::GetGravity, this);
119  m_riemannSolver->SetAuxVec("vecLocs", &LinearSWE::GetVecLocs, this);
120  m_riemannSolver->SetVector("N", &LinearSWE::GetNormals, this);
121 
122  // The numerical flux for linear SWE requires depth information
123  int nTracePointsTot = m_fields[0]->GetTrace()->GetTotPoints();
124  m_dFwd = Array<OneD, NekDouble>(nTracePointsTot);
125  m_dBwd = Array<OneD, NekDouble>(nTracePointsTot);
126  m_fields[0]->GetFwdBwdTracePhys(m_depth, m_dFwd, m_dBwd);
128  m_riemannSolver->SetScalar("depthFwd", &LinearSWE::GetDepthFwd,
129  this);
130  m_riemannSolver->SetScalar("depthBwd", &LinearSWE::GetDepthBwd,
131  this);
132 
133  // Setting up parameters for diffusion operator Riemann solver
134  // m_riemannSolverLDG->AddParam (
135  // "gravity",
136  // &NonlinearSWE::GetGravity, this);
137  // m_riemannSolverLDG->SetAuxVec(
138  // "vecLocs",
139  // &NonlinearSWE::GetVecLocs, this);
140  // m_riemannSolverLDG->AddVector(
141  // "N",
142  // &NonlinearSWE::GetNormals, this);
143 
144  // Concluding initialisation of advection / diffusion operators
145  m_advection->SetRiemannSolver(m_riemannSolver);
146  // m_diffusion->SetRiemannSolver (m_riemannSolverLDG);
147  m_advection->InitObject(m_session, m_fields);
148  // m_diffusion->InitObject (m_session, m_fields);
149  break;
150  }
151  default:
152  {
153  ASSERTL0(false, "Unsupported projection type.");
154  break;
155  }
156  }
157 }
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
Definition: NekFactory.hpp:144
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Definition: LinearSWE.cpp:313
const Array< OneD, NekDouble > & GetDepthFwd()
Definition: LinearSWE.h:96
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Definition: LinearSWE.cpp:214
const Array< OneD, NekDouble > & GetDepthBwd()
Definition: LinearSWE.h:100
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
virtual void v_InitObject(bool DeclareFields=true)
Init object for UnsteadySystem class.
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
bool m_constantDepth
Indicates if constant depth case.
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
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()

References ASSERTL0, Nektar::ShallowWaterSystem::CopyBoundaryTrace(), 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(), GetDepthBwd(), GetDepthFwd(), GetFluxVector(), Nektar::ShallowWaterSystem::GetGravity(), Nektar::ShallowWaterSystem::GetNormals(), Nektar::SolverUtils::GetRiemannSolverFactory(), Nektar::ShallowWaterSystem::GetVecLocs(), Nektar::ShallowWaterSystem::m_advection, Nektar::ShallowWaterSystem::m_constantDepth, m_dBwd, Nektar::ShallowWaterSystem::m_depth, m_dFwd, Nektar::SolverUtils::UnsteadySystem::m_explicitAdvection, Nektar::SolverUtils::EquationSystem::m_fields, Nektar::SolverUtils::UnsteadySystem::m_ode, Nektar::SolverUtils::EquationSystem::m_projectionType, Nektar::ShallowWaterSystem::m_riemannSolver, Nektar::SolverUtils::EquationSystem::m_session, and Nektar::ShallowWaterSystem::v_InitObject().

◆ v_PrimitiveToConservative()

void Nektar::LinearSWE::v_PrimitiveToConservative ( )
protectedvirtual

Reimplemented from Nektar::ShallowWaterSystem.

Definition at line 672 of file LinearSWE.cpp.

673 {
674  int nq = GetTotPoints();
675 
676  // h = \eta + d
677  Vmath::Vadd(nq, m_fields[0]->GetPhys(), 1, m_depth, 1,
678  m_fields[0]->UpdatePhys(), 1);
679 
680  // hu = h * u
681  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[1]->GetPhys(), 1,
682  m_fields[1]->UpdatePhys(), 1);
683 
684  // hv = h * v
685  Vmath::Vmul(nq, m_fields[0]->GetPhys(), 1, m_fields[2]->GetPhys(), 1,
686  m_fields[2]->UpdatePhys(), 1);
687 }

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

◆ WallBoundary()

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

Wall boundary condition.

Definition at line 406 of file LinearSWE.cpp.

409 {
410  int i;
411  int nvariables = physarray.size();
412 
413  // Adjust the physical values of the trace to take
414  // user defined boundaries into account
415  int e, id1, id2, npts;
416 
417  for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
418  ++e)
419  {
420  npts = m_fields[0]
421  ->GetBndCondExpansions()[bcRegion]
422  ->GetExp(e)
423  ->GetTotPoints();
424  id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
425  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
426  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
427 
428  // For 2D/3D, define: v* = v - 2(v.n)n
429  Array<OneD, NekDouble> tmp(npts, 0.0);
430 
431  // Calculate (v.n)
432  for (i = 0; i < m_spacedim; ++i)
433  {
434  Vmath::Vvtvp(npts, &Fwd[1 + i][id2], 1, &m_traceNormals[i][id2], 1,
435  &tmp[0], 1, &tmp[0], 1);
436  }
437 
438  // Calculate 2.0(v.n)
439  Vmath::Smul(npts, -2.0, &tmp[0], 1, &tmp[0], 1);
440 
441  // Calculate v* = v - 2.0(v.n)n
442  for (i = 0; i < m_spacedim; ++i)
443  {
444  Vmath::Vvtvp(npts, &tmp[0], 1, &m_traceNormals[i][id2], 1,
445  &Fwd[1 + i][id2], 1, &Fwd[1 + i][id2], 1);
446  }
447 
448  // copy boundary adjusted values into the boundary expansion
449  for (i = 0; i < nvariables; ++i)
450  {
451  Vmath::Vcopy(npts, &Fwd[i][id2], 1,
452  &(m_fields[i]
453  ->GetBndCondExpansions()[bcRegion]
454  ->UpdatePhys())[id1],
455  1);
456  }
457  }
458 }
SOLVER_UTILS_EXPORT int GetExpSize()
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
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:574

References Nektar::SolverUtils::EquationSystem::GetExpSize(), 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::LinearSWE::WallBoundary2D ( int  bcRegion,
int  cnt,
Array< OneD, Array< OneD, NekDouble >> &  Fwd,
Array< OneD, Array< OneD, NekDouble >> &  physarray 
)
private

Definition at line 460 of file LinearSWE.cpp.

463 {
464 
465  int i;
466  int nvariables = physarray.size();
467 
468  // Adjust the physical values of the trace to take
469  // user defined boundaries into account
470  int e, id1, id2, npts;
471 
472  for (e = 0; e < m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize();
473  ++e)
474  {
475  npts = m_fields[0]
476  ->GetBndCondExpansions()[bcRegion]
477  ->GetExp(e)
478  ->GetNumPoints(0);
479  id1 = m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e);
480  id2 = m_fields[0]->GetTrace()->GetPhys_Offset(
481  m_fields[0]->GetTraceMap()->GetBndCondIDToGlobalTraceID(cnt + e));
482 
483  switch (m_expdim)
484  {
485  case 1:
486  {
487  // negate the forward flux
488  Vmath::Neg(npts, &Fwd[1][id2], 1);
489  }
490  break;
491  case 2:
492  {
493  Array<OneD, NekDouble> tmp_n(npts);
494  Array<OneD, NekDouble> tmp_t(npts);
495 
496  Vmath::Vmul(npts, &Fwd[1][id2], 1, &m_traceNormals[0][id2], 1,
497  &tmp_n[0], 1);
498  Vmath::Vvtvp(npts, &Fwd[2][id2], 1, &m_traceNormals[1][id2], 1,
499  &tmp_n[0], 1, &tmp_n[0], 1);
500 
501  Vmath::Vmul(npts, &Fwd[1][id2], 1, &m_traceNormals[1][id2], 1,
502  &tmp_t[0], 1);
503  Vmath::Vvtvm(npts, &Fwd[2][id2], 1, &m_traceNormals[0][id2], 1,
504  &tmp_t[0], 1, &tmp_t[0], 1);
505 
506  // negate the normal flux
507  Vmath::Neg(npts, tmp_n, 1);
508 
509  // rotate back to Cartesian
510  Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[1][id2], 1,
511  &Fwd[1][id2], 1);
512  Vmath::Vvtvm(npts, &tmp_n[0], 1, &m_traceNormals[0][id2], 1,
513  &Fwd[1][id2], 1, &Fwd[1][id2], 1);
514 
515  Vmath::Vmul(npts, &tmp_t[0], 1, &m_traceNormals[0][id2], 1,
516  &Fwd[2][id2], 1);
517  Vmath::Vvtvp(npts, &tmp_n[0], 1, &m_traceNormals[1][id2], 1,
518  &Fwd[2][id2], 1, &Fwd[2][id2], 1);
519  }
520  break;
521  case 3:
522  ASSERTL0(false,
523  "3D not implemented for Shallow Water Equations");
524  break;
525  default:
526  ASSERTL0(false, "Illegal expansion dimension");
527  }
528 
529  // copy boundary adjusted values into the boundary expansion
530  for (i = 0; i < nvariables; ++i)
531  {
532  Vmath::Vcopy(npts, &Fwd[i][id2], 1,
533  &(m_fields[i]
534  ->GetBndCondExpansions()[bcRegion]
535  ->UpdatePhys())[id1],
536  1);
537  }
538  }
539 }
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:598

References ASSERTL0, Nektar::SolverUtils::EquationSystem::GetExpSize(), 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().

Friends And Related Function Documentation

◆ MemoryManager< LinearSWE >

friend class MemoryManager< LinearSWE >
friend

Definition at line 1 of file LinearSWE.h.

Member Data Documentation

◆ className

string Nektar::LinearSWE::className
static
Initial value:
=
"LinearSWE", LinearSWE::create,
"Linear shallow water equation in primitive variables.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
Definition: LinearSWE.h:54
EquationSystemFactory & GetEquationSystemFactory()

Name of class.

Definition at line 64 of file LinearSWE.h.

◆ m_dBwd

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

Definition at line 76 of file LinearSWE.h.

Referenced by GetDepthBwd(), and v_InitObject().

◆ m_dFwd

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

Still water depth traces.

Definition at line 75 of file LinearSWE.h.

Referenced by GetDepthFwd(), and v_InitObject().