7#ifndef DGBOUNDARYCONDITION_H_
8#define DGBOUNDARYCONDITION_H_
17template <MInt nDim,
class SysEqn>
20template <MInt nDim,
class SysEqn_>
76 TERMM(1,
"Not implemented in derived class!");
81 TERMM(1,
"Not implemented in derived class!");
92 TERMM(1,
"Not implemented in derived class!");
95 TERMM(1,
"Not implemented in derived class!");
98 TERMM(1,
"Not implemented in derived class!");
101 TERMM(1,
"Not implemented in derived class!");
161 MFloat*
const variables,
MFloat*
const timeIntStorage) {
218template <
class Functor,
class Class,
class IdType,
class... Args>
219void loop(Functor&& fun, Class*
object,
const IdType begin,
const IdType end, Args... args) {
221#pragma omp parallel for
223 for(IdType i = begin; i < end; i++) {
224 (
object->*fun)(i, std::forward<Args>(args)...);
const DgInterpolation & interpolation(const MInt polyDeg, const MInt noNodes1D) const
Return interpolation.
virtual void apply(const MFloat time)=0
Apply method to apply boundary condition.
void calcSourceTerms(const MFloat t, const MInt noElements, ElementCollector &elem, F &sourceFct)
MInt id() const
Return boundary condition if of this boundary condition.
MInt m_end
Id of one-past-last surface of this boundary condition.
virtual void setCellDataDlb(const MInt NotUsed(dataId), const MInt *const NotUsed(data))
MInt m_begin
Id of first surface of this boundary condition.
virtual MInt noCellDataDlb() const
virtual void getRestartVariable(const MInt NotUsed(id), MFloat *const NotUsed(data)) const
Copy restart variable data from boundary condition class to pointer.
SurfaceCollector & surfaces()
Return reference to surfaces.
virtual void setCellDataDlb(const MInt NotUsed(dataId), const MFloat *const NotUsed(data))
virtual MInt noBcElements() const
MInt timeIntegrationScheme() const
Return time integration scheme.
MBool needHElementForCell(const MInt cellId)
Return if h-element is needed for given cell.
ElementCollector & elements()
Return reference to elements.
virtual MString name() const =0
Returns name of boundary condition.
virtual void setRestartVariable(const MInt NotUsed(id), const MFloat *const NotUsed(data))
Copy restart variable data from pointer to boundary condition class.
MBool isRestart() const
Return if a restart is performed.
virtual ~DgBoundaryCondition()
Destructor must be virtual.
MInt getElementByCellId(const MInt cellId) const
Return element id corresponding to given cell id.
void calcSurfaceIntegral(const MInt begin_, const MInt end_, ElementCollector &elem, SurfaceCollector &surf, HElementCollector &helem, const MInt noHElements)
virtual void getCellDataDlb(const MInt NotUsed(dataId), MInt *const NotUsed(data)) const
void applyJacobian(const MInt noElements, ElementCollector &elem)
void subTimeStepRk(const MFloat dt_, const MInt stage, const MInt totalSize, const MFloat *const rhs, MFloat *const variables, MFloat *const timeIntStorage)
Access to time integration method.
SysEqn & sysEqn()
Return reference to SysEqn object.
SolverType & solver()
Return reference to solver.
HElementCollector & helements()
Return reference to h-elements.
MInt getHElementId(const MInt elementId)
Return h-element id for an element.
MInt maxPolyDeg() const
Return maximum polynomial degree.
MBool isMpiSurface(const MInt id_) const
Return true if surface is a MPI surface.
MFloat dt() const
Return current time step size.
virtual MInt getLocalNoNodes() const
Return local number of nodes.
void calcVolumeIntegral(const MInt noElements, ElementCollector &elem, F &fluxFct)
virtual MInt cellDataSizeDlb(const MInt NotUsed(dataId), const MInt NotUsed(cellId)) const
virtual void getCellDataDlb(const MInt NotUsed(dataId), MFloat *const NotUsed(data)) const
MInt begin() const
Return index of first surface.
SolverType & m_solver
Store a reference to the solver.
MInt count() const
Return number of boundary surfaces.
void resetBuffer(const MInt totalSize, MFloat *const buffer)
MInt end() const
Return index of one-past-last surface.
virtual MBool hasBcElement(const MInt NotUsed(elementId)) const
void init(const MInt begin_, const MInt end_)
Init method to initialize boundary condition for range of surfaces.
MInt integrationMethod() const
Return integration method.
const MInt m_bcId
The boundary condition id of this boundary condition.
DgBoundaryCondition(SolverType &solver_, MInt bcId)
Constructor saves arguments to member variables.
void calcRegularSurfaceFlux(const MInt begin_, const MInt end_, SurfaceCollector &surf, F &riemannFct)
virtual MString restartVarName(const MInt NotUsed(id)) const
Return name of restart variable.
MInt maxNoNodes1D() const
Return maximum number of nodes.
virtual MInt noRestartVars() const
MFloat * flux(const MInt i)
Return pointer to surface flux.
virtual MInt cellDataTypeDlb(const MInt NotUsed(dataId)) const
MBool needHElementForCell(const MInt cellId)
Return true if h-element is needed for cell, false otherwise.
void calcRegularSurfaceFlux(const MInt begin, const MInt end, SurfaceCollector &surf, F &riemannFct)
Calculate the numerical flux for a regular (i.e. inner or MPI) surface.
void resetBuffer(const MInt totalSize, MFloat *const buffer)
Reset the given buffer to zero.
void calcSurfaceIntegral()
Calculate the surface integral for all faces of element and update dU/dt.
void applyJacobian()
Adds the negative of the inverse Jacobian to the time derivative.
MInt getHElementId(const MInt elementId) const
Return h-element id of a given element (if it exists).
std::vector< std::vector< DgInterpolation > > m_interpolation
MBool isMpiSurface(const MInt id) const
Return true if a surface is a MPI surface.
MInt m_dgIntegrationMethod
void calcSourceTerms(MFloat t)
Calculates the source terms for each node and adds them to the time derivative of the conservative va...
void calcVolumeIntegral()
Calculate the volume integral for all elements and update m_rightHandSide.
SurfaceCollector m_surfaces
MInt m_dgTimeIntegrationScheme
void subTimeStepRk(const MFloat dt, const MInt stage, const MInt totalSize, const MFloat *const rhs, MFloat *const variables, MFloat *const timeIntStorage)
Perform one Runge-Kutta substep on the given elements.
ElementCollector m_elements
HElementCollector m_helements
Class stores precalculated values for interpolation & integration on the reference interval [-1,...
Class that represents DG element collector.
MInt getElementByCellId(const MInt cellId) const
Return element id for a given cell id (or -1 if not found).
Class that represents DG element collector.
Class that represents DG element collector.
MFloat & flux(const MInt srfcId)
Accessor for flux.
std::basic_string< char > MString
void loop(Functor &&fun, Class *object, const IdType begin, const IdType end, Args... args)
Namespace for auxiliary functions/classes.