38 #include <boost/algorithm/string.hpp>
48 "Nonlinear shallow water equation in conservative variables.");
67 ASSERTL0(
false,
"Implicit SWE not set up.");
90 m_session->LoadSolverInfo(
"AdvectionType", advName,
"WeakDG");
102 m_session->LoadSolverInfo(
"UpwindType", riemName,
"Average");
144 ASSERTL0(
false,
"Unsupported projection type.");
174 m_fields[0]->IProductWRTBase(tmp,mod);
175 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
182 m_fields[0]->IProductWRTBase(tmp,mod);
183 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
202 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
229 m_fields[0]->IProductWRTBase(tmp,mod);
230 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
232 Vmath::Vadd(nq,tmp,1,outarray[i+1],1,outarray[i+1],1);
243 Vmath::Vadd(nq,tmp,1,outarray[i+1],1,outarray[i+1],1);
248 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
261 int nvariables = inarray.num_elements();
283 for(i = 0; i < nvariables; ++i)
316 fluxvector(nvariables);
318 for (i = 0; i < nvariables; ++i)
321 for(j = 0; j < ndim; ++j)
338 for(i = 0; i < nvariables; ++i)
366 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
377 int nvariables = inarray.num_elements();
388 for(i = 0; i < nvariables; ++i)
399 EquationSystem::SetBoundaryConditions(time);
402 for(i = 0; i < nvariables; ++i)
404 m_fields[i]->FwdTrans(inarray[i],coeffs);
405 m_fields[i]->BwdTrans_IterPerExp(coeffs,outarray[i]);
410 ASSERTL0(
false,
"Unknown projection scheme");
422 int nvariables =
m_fields.num_elements();
426 for (
int n = 0; n <
m_fields[0]->GetBndConditions().num_elements(); ++n)
430 if (boost::iequals(
m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
"Wall"))
436 if (
m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
438 for (
int i = 0; i < nvariables; ++i)
441 m_fields[i]->EvaluateBoundaryConditions(time, varName);
444 cnt +=
m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
459 int nvariables = physarray.num_elements();
463 for (i = 0; i < nvariables; ++i)
466 m_fields[i]->ExtractTracePhys(physarray[i], Fwd[i]);
471 int e, id1, id2,
npts;
473 for (e = 0; e <
m_fields[0]->GetBndCondExpansions()[bcRegion]
476 npts =
m_fields[0]->GetBndCondExpansions()[bcRegion]->
477 GetExp(e)->GetTotPoints();
478 id1 =
m_fields[0]->GetBndCondExpansions()[bcRegion]->
480 id2 =
m_fields[0]->GetTrace()->GetPhys_Offset(
482 GetBndCondCoeffsToGlobalCoeffsMap(cnt+e));
511 for (i = 0; i < nvariables; ++i)
514 &(
m_fields[i]->GetBndCondExpansions()[bcRegion]->
515 UpdatePhys())[id1], 1);
526 int nvariables = physarray.num_elements();
530 for (i = 0; i < nvariables; ++i)
533 m_fields[i]->ExtractTracePhys(physarray[i],Fwd[i]);
538 int e, id1, id2,
npts;
540 for(e = 0; e <
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExpSize(); ++e)
542 npts =
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExp(e)->GetNumPoints(0);
543 id1 =
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e) ;
544 id2 =
m_fields[0]->GetTrace()->GetPhys_Offset(
m_fields[0]->GetTraceMap()->GetBndCondCoeffsToGlobalCoeffsMap(cnt+e));
577 ASSERTL0(
false,
"3D not implemented for Shallow Water Equations");
580 ASSERTL0(
false,
"Illegal expansion dimension");
586 for (i = 0; i < nvariables; ++i)
588 Vmath::Vcopy(npts,&Fwd[i][id2], 1,&(
m_fields[i]->GetBndCondExpansions()[bcRegion]->UpdatePhys())[id1],1);
600 int nq =
m_fields[0]->GetTotPoints();
616 Vmath::Vmul(nq, physfield[0], 1, physfield[0], 1, tmp, 1);
629 Vmath::Vadd(nq, flux[i+1][i], 1, tmp, 1, flux[i+1][i], 1);
639 if(physin.get() == physout.get())
643 for (
int i = 0; i < 3; ++i)
665 Vmath::Vdiv(nq,physin[1],1,physin[0],1,physout[1],1);
668 Vmath::Vdiv(nq,physin[2],1,physin[0],1,physout[2],1);
693 if(physin.get() == physout.get())
697 for (
int i = 0; i < 3; ++i)
708 Vmath::Vmul(nq,physout[0],1,tmp[1],1,physout[1],1);
711 Vmath::Vmul(nq,physout[0],1,tmp[2],1,physout[2],1);
720 Vmath::Vmul(nq,physout[0],1,physin[1],1,physout[1],1);
723 Vmath::Vmul(nq,physout[0],1,physin[2],1,physout[2],1);
755 const int npts = physfield[0].num_elements();
759 Vmath::Vdiv(npts, physfield[1+i], 1, physfield[0], 1,
Array< OneD, NekDouble > m_coriolis
Coriolis force.
#define ASSERTL0(condition, msg)
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
void PrimitiveToConservative()
virtual void v_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.
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
std::vector< std::pair< std::string, std::string > > SummaryList
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
int m_expdim
Expansion dimension.
static std::string className
Name of class.
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()
SolverUtils::AdvectionSharedPtr m_advection
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
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
void AddVariableDepth(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
const Array< OneD, NekDouble > & GetDepth()
virtual void v_InitObject()
Init object for UnsteadySystem class.
SOLVER_UTILS_EXPORT int GetTotPoints()
void ConservativeToPrimitive()
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 WallBoundary(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary condition.
Array< OneD, Array< OneD, NekDouble > > m_bottomSlope
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &physarray)
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.
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
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).
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.
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()
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
MultiRegions::Direction const DirCartesianMap[]
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
virtual void v_ConservativeToPrimitive()
SOLVER_UTILS_EXPORT int GetNcoeffs()
NonlinearSWE(const LibUtilities::SessionReaderSharedPtr &pSession)
bool m_constantDepth
Indicates if constant depth case.
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
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.
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.