37 #include <boost/algorithm/string.hpp>
46 string LinearSWE::className =
48 "LinearSWE", LinearSWE::create,
49 "Linear shallow water equation in primitive variables.");
69 ASSERTL0(
false,
"Implicit SWE not set up.");
92 m_session->LoadSolverInfo(
"AdvectionType", advName,
"WeakDG");
104 m_session->LoadSolverInfo(
"UpwindType", riemName,
"NoSolver");
107 ASSERTL0(
false,
"LinearHLL only valid for constant depth");
128 int nTracePointsTot =
m_fields[0]->GetTrace()->GetTotPoints();
160 ASSERTL0(
false,
"Unsupported projection type.");
190 m_fields[0]->IProductWRTBase(tmp,mod);
191 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
198 m_fields[0]->IProductWRTBase(tmp,mod);
199 m_fields[0]->MultiplyByElmtInvMass(mod,mod);
218 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
231 int nvariables = inarray.size();
253 for(i = 0; i < nvariables; ++i)
280 fluxvector(nvariables);
282 for (i = 0; i < nvariables; ++i)
285 for(j = 0; j < ndim; ++j)
301 for(i = 0; i < nvariables; ++i)
322 ASSERTL0(
false,
"Unknown projection scheme for the NonlinearSWE");
333 int nvariables = inarray.size();
344 for(i = 0; i < nvariables; ++i)
358 for(i = 0; i < nvariables; ++i)
360 m_fields[i]->FwdTrans(inarray[i],coeffs);
361 m_fields[i]->BwdTrans_IterPerExp(coeffs,outarray[i]);
366 ASSERTL0(
false,
"Unknown projection scheme");
385 for (
int i = 0; i < nvariables; ++i)
388 m_fields[i]->ExtractTracePhys(inarray[i], Fwd[i]);
392 for(
int n = 0; n <
m_fields[0]->GetBndConditions().size(); ++n)
394 if (
m_fields[0]->GetBndConditions()[n]->GetBoundaryConditionType()
401 if (boost::iequals(
m_fields[0]->GetBndConditions()[n]->GetUserDefined(),
"Wall"))
407 if (
m_fields[0]->GetBndConditions()[n]->IsTimeDependent())
409 for (
int i = 0; i < nvariables; ++i)
412 m_fields[i]->EvaluateBoundaryConditions(time, varName);
415 cnt +=
m_fields[0]->GetBndCondExpansions()[n]->GetExpSize();
430 int nvariables = physarray.size();
434 int e, id1, id2, npts;
436 for (e = 0; e <
m_fields[0]->GetBndCondExpansions()[bcRegion]
439 npts =
m_fields[0]->GetBndCondExpansions()[bcRegion]->
440 GetExp(e)->GetTotPoints();
441 id1 =
m_fields[0]->GetBndCondExpansions()[bcRegion]->
443 id2 =
m_fields[0]->GetTrace()->GetPhys_Offset(
445 GetBndCondIDToGlobalTraceID(cnt+e));
474 for (i = 0; i < nvariables; ++i)
477 &(
m_fields[i]->GetBndCondExpansions()[bcRegion]->
478 UpdatePhys())[id1], 1);
488 int nvariables = physarray.size();
492 int e, id1, id2, npts;
496 npts =
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetExp(e)->
498 id1 =
m_fields[0]->GetBndCondExpansions()[bcRegion]->GetPhys_Offset(e) ;
500 GetBndCondIDToGlobalTraceID(cnt+e));
533 ASSERTL0(
false,
"3D not implemented for Shallow Water Equations");
536 ASSERTL0(
false,
"Illegal expansion dimension");
542 for (i = 0; i < nvariables; ++i)
544 Vmath::Vcopy(npts,&Fwd[i][id2], 1,&(
m_fields[i]->GetBndCondExpansions()[bcRegion]->UpdatePhys())[id1],1);
556 int nq =
m_fields[0]->GetTotPoints();
580 Vmath::Vadd(nq, flux[i+1][i], 1, tmp, 1, flux[i+1][i], 1);
590 if(physin.get() == physout.get())
594 for (
int i = 0; i < 3; ++i)
616 Vmath::Vdiv(nq,physin[1],1,physin[0],1,physout[1],1);
619 Vmath::Vdiv(nq,physin[2],1,physin[0],1,physout[2],1);
644 if(physin.get() == physout.get())
648 for (
int i = 0; i < 3; ++i)
659 Vmath::Vmul(nq,physout[0],1,tmp[1],1,physout[1],1);
662 Vmath::Vmul(nq,physout[0],1,tmp[2],1,physout[2],1);
671 Vmath::Vmul(nq,physout[0],1,physin[1],1,physout[1],1);
674 Vmath::Vmul(nq,physout[0],1,physin[2],1,physout[2],1);
706 const int npts = physfield[0].size();
718 if (
m_session->DefinesSolverInfo(
"UpwindType"))
#define ASSERTL0(condition, msg)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
void DefineProjection(FuncPointerT func, ObjectPointerT obj)
void DefineOdeRhs(FuncPointerT func, ObjectPointerT obj)
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
void GetVelocityVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity)
Compute the velocity field given the momentum .
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
virtual void v_ConservativeToPrimitive()
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void SetBoundaryConditions(Array< OneD, Array< OneD, NekDouble > > &physarray, NekDouble time)
const Array< OneD, NekDouble > & GetDepthFwd()
void WallBoundary2D(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
virtual void v_InitObject()
Init object for UnsteadySystem class.
void GetFluxVector(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
virtual void v_PrimitiveToConservative()
Array< OneD, NekDouble > m_dFwd
Still water depth traces.
Array< OneD, NekDouble > m_dBwd
const Array< OneD, NekDouble > & GetDepthBwd()
void WallBoundary(int bcRegion, int cnt, Array< OneD, Array< OneD, NekDouble > > &Fwd, Array< OneD, Array< OneD, NekDouble > > &physarray)
Wall boundary condition.
void AddCoriolis(const Array< OneD, const Array< OneD, NekDouble > > &physarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Base class for unsteady solvers.
virtual void v_InitObject()
Init object for UnsteadySystem class.
NekDouble m_g
Acceleration of gravity.
void CopyBoundaryTrace(const Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
const Array< OneD, const Array< OneD, NekDouble > > & GetNormals()
SolverUtils::AdvectionSharedPtr m_advection
void PrimitiveToConservative()
bool m_constantDepth
Indicates if constant depth case.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
Array< OneD, NekDouble > m_coriolis
Coriolis force
Array< OneD, NekDouble > m_depth
Still water depth.
void ConservativeToPrimitive()
const Array< OneD, const Array< OneD, NekDouble > > & GetVecLocs()
int m_spacedim
Spatial dimension (>= expansion dim).
int m_expdim
Expansion dimension.
SOLVER_UTILS_EXPORT int GetTraceTotPoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetExpSize()
LibUtilities::SessionReaderSharedPtr m_session
The session reader.
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Array holding trace normals for DG simulations in the forwards direction.
SOLVER_UTILS_EXPORT int GetNpoints()
SOLVER_UTILS_EXPORT int GetNcoeffs()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT int GetPhys_Offset(int n)
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
SOLVER_UTILS_EXPORT int GetTotPoints()
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
MultiRegions::Direction const DirCartesianMap[]
@ eMixed_CG_Discontinuous
AdvectionFactory & GetAdvectionFactory()
Gets the factory for initialising advection objects.
std::vector< std::pair< std::string, std::string > > SummaryList
EquationSystemFactory & GetEquationSystemFactory()
void AddSummaryItem(SummaryList &l, const std::string &name, const std::string &value)
Adds a summary item to the summary info list.
RiemannSolverFactory & GetRiemannSolverFactory()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
The above copyright notice and this permission notice shall be included.
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 Neg(int n, T *x, const int incx)
Negate x = -x.
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
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 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
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
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.
void Zero(int n, T *x, const int incx)
Zero vector.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.