38 #include <boost/algorithm/string.hpp>
48 "Linear shallow water equation in primitive variables.");
67 ASSERTL0(
false,
"Implicit SWE not set up.");
90 m_session->LoadSolverInfo(
"AdvectionType", advName,
"WeakDG");
102 m_session->LoadSolverInfo(
"UpwindType", riemName,
"NoSolver");
105 ASSERTL0(
false,
"LinearHLL only valid for constant depth");
126 int nTracePointsTot =
m_fields[0]->GetTrace()->GetTotPoints();
158 ASSERTL0(
false,
"Unsupported projection type.");
188 m_fields[0]->IProductWRTBase(tmp,mod);
189 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
196 m_fields[0]->IProductWRTBase(tmp,mod);
197 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
216 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
229 int nvariables = inarray.num_elements();
251 for(i = 0; i < nvariables; ++i)
278 fluxvector(nvariables);
280 for (i = 0; i < nvariables; ++i)
283 for(j = 0; j < ndim; ++j)
299 for(i = 0; i < nvariables; ++i)
320 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
331 int nvariables = inarray.num_elements();
342 for(i = 0; i < nvariables; ++i)
353 EquationSystem::SetBoundaryConditions(time);
356 for(i = 0; i < nvariables; ++i)
358 m_fields[i]->FwdTrans(inarray[i],coeffs);
359 m_fields[i]->BwdTrans_IterPerExp(coeffs,outarray[i]);
364 ASSERTL0(
false,
"Unknown projection scheme");
376 int nvariables =
m_fields.num_elements();
380 for(
int n = 0; n <
m_fields[0]->GetBndConditions().num_elements(); ++n)
383 if (boost::iequals(
m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
"Wall"))
389 if (
m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
391 for (
int i = 0; i < nvariables; ++i)
394 m_fields[i]->EvaluateBoundaryConditions(time, varName);
397 cnt +=
m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
412 int nvariables = physarray.num_elements();
416 for (i = 0; i < nvariables; ++i)
419 m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
424 int e, id1, id2,
npts;
426 for (e = 0; e <
m_fields[0]->GetBndCondExpansions()[bcRegion]
429 npts =
m_fields[0]->GetBndCondExpansions()[bcRegion]->
430 GetExp(e)->GetTotPoints();
431 id1 =
m_fields[0]->GetBndCondExpansions()[bcRegion]->
433 id2 =
m_fields[0]->GetTrace()->GetPhys_Offset(
435 GetBndCondCoeffsToGlobalCoeffsMap(cnt+e));
464 for (i = 0; i < nvariables; ++i)
467 &(
m_fields[i]->GetBndCondExpansions()[bcRegion]->
468 UpdatePhys())[id1], 1);
479 int nvariables = physarray.num_elements();
483 for (i = 0; i < nvariables; ++i)
486 m_fields[i]->ExtractTracePhys(physarray[i],Fwd[i]);
491 int e, id1, id2,
npts;
493 for(e = 0; e <
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); ++e)
495 npts =
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExp(e)->GetNumPoints(0);
496 id1 =
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e) ;
497 id2 =
m_fields[0]->GetTrace()->GetPhys_Offset(
m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(cnt+e));
530 ASSERTL0(
false,
"3D not implemented for Shallow Water Equations");
533 ASSERTL0(
false,
"Illegal expansion dimension");
539 for (i = 0; i < nvariables; ++i)
541 Vmath::Vcopy(npts,&Fwd[i][id2], 1,&(
m_fields[i]->GetBndCondExpansions()[bcRegion]->UpdatePhys())[id1],1);
553 int nq =
m_fields[0]->GetTotPoints();
577 Vmath::Vadd(nq, flux[i+1][i], 1, tmp, 1, flux[i+1][i], 1);
587 if(physin.get() == physout.get())
591 for (
int i = 0; i < 3; ++i)
613 Vmath::Vdiv(nq,physin[1],1,physin[0],1,physout[1],1);
616 Vmath::Vdiv(nq,physin[2],1,physin[0],1,physout[2],1);
641 if(physin.get() == physout.get())
645 for (
int i = 0; i < 3; ++i)
656 Vmath::Vmul(nq,physout[0],1,tmp[1],1,physout[1],1);
659 Vmath::Vmul(nq,physout[0],1,tmp[2],1,physout[2],1);
668 Vmath::Vmul(nq,physout[0],1,physin[1],1,physout[1],1);
671 Vmath::Vmul(nq,physout[0],1,physin[2],1,physout[2],1);
703 const int npts = physfield[0].num_elements();
715 if (
m_session->DefinesSolverInfo(
"UpwindType"))
717 std::string UpwindType;
718 UpwindType =
m_session->GetSolverInfo(
"UpwindType");
719 if (UpwindType ==
"LinearAverage")
723 if (UpwindType ==
"LinearHLL")
Array< OneD, NekDouble > m_coriolis
Coriolis force.
const Array< OneD, NekDouble > & GetDepthFwd()
void WallBoundary(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary condition.
virtual void v_InitObject()
Init object for UnsteadySystem class.
#define ASSERTL0(condition, msg)
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
void PrimitiveToConservative()
Base class for unsteady solvers.
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.
Array< OneD, NekDouble > m_depth
Still water depth.
Array< OneD, NekDouble > m_dFwd
Still water depth traces.
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &physarray)
virtual void v_PrimitiveToConservative()
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
std::vector< std::pair< std::string, std::string > > SummaryList
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
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
SolverUtils::AdvectionSharedPtr m_advection
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession)
Creates an instance of this class.
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.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
SOLVER_UTILS_EXPORT int GetTotPoints()
virtual void v_ConservativeToPrimitive()
void ConservativeToPrimitive()
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
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.
static std::string className
Name of class.
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
RiemannSolverFactory & GetRiemannSolverFactory()
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
int m_spacedim
Spatial dimension (>= expansion dim).
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
void Neg(int n, T *x, const int incx)
Negate x = -x.
Array< OneD, NekDouble > m_dBwd
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
EquationSystemFactory & GetEquationSystemFactory()
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.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
LinearSWE(const LibUtilities::SessionReaderSharedPtr &pSession)
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
MultiRegions::Direction const DirCartesianMap[]
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
SOLVER_UTILS_EXPORT int GetNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
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
SOLVER_UTILS_EXPORT int GetNcoeffs()
bool m_constantDepth
Indicates if constant depth case.
const Array< OneD, NekDouble > & GetDepthBwd()
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void Zero(int n, T *x, const int incx)
Zero vector.
NekDouble m_g
Acceleration of gravity.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.
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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.