47 "Unsteady Advection equation.");
68 m_session->MatchSolverInfo(
"GJPStabilisation",
"False",
78 std::vector<std::string> vel;
115 std::string riemName;
116 m_session->LoadSolverInfo(
"AdvectionType", advName,
"WeakDG");
129 m_session->LoadSolverInfo(
"UpwindType", riemName,
"Upwind");
144 m_session->LoadSolverInfo(
"AdvectionType", advName,
162 ASSERTL0(
false,
"Unsupported projection type.");
182 "Implicit UnsteadyAdvection is not implemented for a "
183 "Discontinuous Galerkin discretisation.")
199 int nVariables = inarray.size();
208 auto advWeakDGObject =
209 std::dynamic_pointer_cast<SolverUtils::AdvectionWeakDG>(
227 for (
int i = 0; i < nVariables; ++i)
229 Vmath::Neg(outarray[i].size(), outarray[i], 1);
236 x->Apply(
m_fields, inarray, outarray, time);
252 int nVariables = inarray.size();
270 if (inarray != outarray)
274 for (
int i = 0; i < nVariables; ++i)
285 int ncoeffs =
m_fields[0]->GetNcoeffs();
294 for (
int i = 0; i < nVariables; ++i)
297 std::dynamic_pointer_cast<MultiRegions::ContField>(
300 m_fields[i]->IProductWRTBase(inarray[i], wsp);
302 cfield->InitGJPData();
305 cfield->GetGJPData();
313 if (GJPData->IsSemiImplicit())
318 GJPData->GetTraceWeightVarFactors();
321 if (GJPData->IsSemiImplicit() || GJPData->IsExplicit())
331 if (GJPData->IsImplicit())
334 GJPData->GetTraceWeightVarFactors();
339 mtype, cfield->GetLocalToGlobalMap(), factors,
340 varcoeffs, varfactors);
344 m_fields[i]->BwdTrans(coeffs, outarray[i]);
349 for (
int i = 0; i < nVariables; ++i)
351 m_fields[i]->FwdTrans(inarray[i], coeffs);
352 m_fields[i]->BwdTrans(coeffs, outarray[i]);
358 ASSERTL0(
false,
"Unknown projection scheme");
373 int nvariables = inarray.size();
374 int npoints =
m_fields[0]->GetNpoints();
377 for (
int i = 0; i < nvariables; ++i)
384 m_fields[i]->LinearAdvectionReactionSolve(
415 for (
int i = 0; i < velfield.size(); ++i)
420 m_fields[0]->ExtractTracePhys(tmp, tmp2);
440 "Dimension of flux array and velocity array do not match");
442 const int nq =
m_fields[0]->GetNpoints();
444 for (
int i = 0; i < flux.size(); ++i)
446 for (
int j = 0; j < flux[0].size(); ++j)
448 for (
int k = 0; k < nq; ++k)
470 "Dimension of flux array and velocity array do not match");
472 int nq = physfield[0].size();
473 int nVariables = physfield.size();
481 nq =
m_fields[0]->Get1DScaledTotPoints(OneDptscale);
489 for (
int i = 0; i < nVariables; ++i)
498 m_fields[0]->PhysInterp1DScaled(OneDptscale, physfield[i],
512 for (
int i = 0; i < flux.size(); ++i)
514 for (
int j = 0; j < flux[0].size(); ++j)
516 Vmath::Vmul(nq, physfieldInterp[i], 1, velocityInterp[j], 1,
517 fluxInterp[i][j], 1);
522 for (
int i = 0; i < nVariables; ++i)
526 m_fields[0]->PhysGalerkinProjection1DScaled(
527 OneDptscale, fluxInterp[i][j], flux[i][j]);
534 AdvectionSystem::v_GenerateSummary(s);
538 s,
"GJP Stab. Impl. ",
539 m_session->GetSolverInfo(
"GJPStabilisation"));
551 std::vector<std::string> &variables)
554 m_session->MatchSolverInfo(
"OutputExtraFields",
"True", extraFields,
true);
573 for (
int i = 0; i < spaceDim; ++i)
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
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)
void DefineImplicitSolve(FuncPointerT func, ObjectPointerT obj)
void AccumulateRegion(std::string, int iolevel=0)
Accumulate elapsed time for a region.
Describe a linear system.
Array< OneD, MultiRegions::ExpListSharedPtr > m_fieldsALE
SOLVER_UTILS_EXPORT void InitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields)
Array< OneD, Array< OneD, NekDouble > > m_gridVelocityTrace
SOLVER_UTILS_EXPORT void ALEDoElmtInvMassBwdTrans(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
SOLVER_UTILS_EXPORT void ExtraFldOutputGridVelocity(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables)
SOLVER_UTILS_EXPORT void MoveMesh(const NekDouble &time, Array< OneD, Array< OneD, NekDouble > > &traceNormals)
Array< OneD, Array< OneD, NekDouble > > m_gridVelocity
A base class for PDEs which include an advection component.
SolverUtils::AdvectionSharedPtr m_advObject
Advection term.
SOLVER_UTILS_EXPORT void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
int m_spacedim
Spatial dimension (>= expansion dim).
int m_expdim
Expansion dimension.
NekDouble m_timestep
Time step size.
SOLVER_UTILS_EXPORT int GetTraceNpoints()
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Array holding all dependent variables.
SOLVER_UTILS_EXPORT int GetNpoints()
bool m_specHP_dealiasing
Flag to determine if dealisising is usde for the Spectral/hp element discretisation.
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 GetTotPoints()
enum MultiRegions::ProjectionType m_projectionType
Type of projection; e.g continuous or discontinuous.
SOLVER_UTILS_EXPORT void SetBoundaryConditions(NekDouble time)
Evaluates the boundary conditions at the given time.
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(std::string name, const MultiRegions::ExpListSharedPtr &field=MultiRegions::NullExpListSharedPtr, bool cache=false)
Get a SessionFunction by name.
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
Base class for unsteady solvers.
LibUtilities::TimeIntegrationSchemeOperators m_ode
The time integration scheme operators to use.
bool m_explicitAdvection
Indicates if explicit or implicit treatment of advection is used.
bool m_homoInitialFwd
Flag to determine if simulation should start in homogeneous forward transformed state.
void v_ALEInitObject(int spaceDim, Array< OneD, MultiRegions::ExpListSharedPtr > &fields) override
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Forcing terms.
void v_ExtraFldOutput(std::vector< Array< OneD, NekDouble > > &fieldcoeffs, std::vector< std::string > &variables) override
Array< OneD, NekDouble > m_traceVn
Array< OneD, NekDouble > & GetNormalVel(const Array< OneD, const Array< OneD, NekDouble > > &velfield)
Get the normal velocity based on input velfield.
void DoImplicitSolve(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble lambda)
Implicit solution of the unsteady advection problem.
StdRegions::VarCoeffMap m_varcoeffs
static std::string className
Name of class.
Array< OneD, NekDouble > & GetNormalVelocity()
Get the normal velocity.
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print Summary.
Array< OneD, Array< OneD, NekDouble > > m_velocity
Advection velocity.
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
void DoOdeRhs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the RHS.
void DoOdeProjection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Compute the projection.
void GetFluxVectorDeAlias(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
Evaluate the flux at each solution point using dealiasing.
UnsteadyAdvection(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
void v_InitObject(bool DeclareFields=true) override
Initialise the object.
bool m_useGJPStabilisation
void GetFluxVector(const Array< OneD, Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &flux)
Evaluate the flux at each solution point.
SolverUtils::RiemannSolverSharedPtr m_riemannSolver
bool v_PreIntegrate(int step) override
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ eMixed_CG_Discontinuous
std::shared_ptr< GJPStabilisation > GJPStabilisationSharedPtr
std::shared_ptr< ContField > ContFieldSharedPtr
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
std::map< StdRegions::ConstFactorType, Array< OneD, NekDouble > > VarFactorsMap
std::map< ConstFactorType, NekDouble > ConstFactorMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
static Array< OneD, NekDouble > NullNekDouble1DArray
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 Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*x.
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.