MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
DgBcExact< nDim, SysEqn > Class Template Referencefinal

Boundary condition which imposes initial condition ("exact" boundary conditions) at the domain boundaries. More...

#include <dgcartesianbcexact.h>

Inheritance diagram for DgBcExact< nDim, SysEqn >:
[legend]
Collaboration diagram for DgBcExact< nDim, SysEqn >:
[legend]

Public Types

using Base = DgBoundaryCondition< nDim, SysEqn >
 
- Public Types inherited from DgBoundaryCondition< nDim, SysEqn >
using SysEqn = SysEqn
 
using SolverType = DgCartesianSolver< nDim, SysEqn >
 
using ElementCollector = maia::dg::collector::ElementCollector< nDim, SysEqn >
 
using HElementCollector = maia::dg::collector::HElementCollector< nDim, SysEqn >
 
using SurfaceCollector = maia::dg::collector::SurfaceCollector< nDim, SysEqn >
 

Public Member Functions

 DgBcExact (SolverType &solver_, MInt bcId)
 
MString name () const override
 Returns name of boundary condition. More...
 
void apply (const MFloat time) override
 Apply method to apply boundary condition. More...
 
void applyAtSurface (const MInt surfaceId, const MFloat NotUsed(time))
 
- Public Member Functions inherited from DgBoundaryCondition< nDim, SysEqn >
virtual ~DgBoundaryCondition ()
 Destructor must be virtual. More...
 
void init (const MInt begin_, const MInt end_)
 Init method to initialize boundary condition for range of surfaces. More...
 
virtual void apply (const MFloat time)=0
 Apply method to apply boundary condition. More...
 
virtual MString name () const=0
 Returns name of boundary condition. More...
 
 DgBoundaryCondition (SolverType &solver_, MInt bcId)
 Constructor saves arguments to member variables. More...
 
MInt id () const
 Return boundary condition if of this boundary condition. More...
 
MInt begin () const
 Return index of first surface. More...
 
MInt end () const
 Return index of one-past-last surface. More...
 
MInt count () const
 Return number of boundary surfaces. More...
 
virtual MInt noRestartVars () const
 
virtual MInt getLocalNoNodes () const
 Return local number of nodes. More...
 
virtual MString restartVarName (const MInt NotUsed(id)) const
 Return name of restart variable. More...
 
virtual void setRestartVariable (const MInt NotUsed(id), const MFloat *const NotUsed(data))
 Copy restart variable data from pointer to boundary condition class. More...
 
virtual void getRestartVariable (const MInt NotUsed(id), MFloat *const NotUsed(data)) const
 Copy restart variable data from boundary condition class to pointer. More...
 
virtual MInt noBcElements () const
 
virtual MBool hasBcElement (const MInt NotUsed(elementId)) const
 
virtual MInt noCellDataDlb () const
 
virtual MInt cellDataTypeDlb (const MInt NotUsed(dataId)) const
 
virtual MInt cellDataSizeDlb (const MInt NotUsed(dataId), const MInt NotUsed(cellId)) const
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), MFloat *const NotUsed(data)) const
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), MInt *const NotUsed(data)) const
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MFloat *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MInt *const NotUsed(data))
 

Additional Inherited Members

- Protected Member Functions inherited from DgBoundaryCondition< nDim, SysEqn >
SolverTypesolver ()
 Return reference to solver. More...
 
SysEqnsysEqn ()
 Return reference to SysEqn object. More...
 
MFloatflux (const MInt i)
 Return pointer to surface flux. More...
 
ElementCollectorelements ()
 Return reference to elements. More...
 
MInt getElementByCellId (const MInt cellId) const
 Return element id corresponding to given cell id. More...
 
HElementCollectorhelements ()
 Return reference to h-elements. More...
 
SurfaceCollectorsurfaces ()
 Return reference to surfaces. More...
 
MBool isMpiSurface (const MInt id_) const
 Return true if surface is a MPI surface. More...
 
MBool needHElementForCell (const MInt cellId)
 Return if h-element is needed for given cell. More...
 
MInt getHElementId (const MInt elementId)
 Return h-element id for an element. More...
 
const DgInterpolationinterpolation (const MInt polyDeg, const MInt noNodes1D) const
 Return interpolation. More...
 
MInt integrationMethod () const
 Return integration method. More...
 
MInt timeIntegrationScheme () const
 Return time integration scheme. More...
 
MInt maxPolyDeg () const
 Return maximum polynomial degree. More...
 
MInt maxNoNodes1D () const
 Return maximum number of nodes. More...
 
MFloat dt () const
 Return current time step size. More...
 
MBool isRestart () const
 Return if a restart is performed. More...
 
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. More...
 
void calcVolumeIntegral (const MInt noElements, ElementCollector &elem, F &fluxFct)
 
void resetBuffer (const MInt totalSize, MFloat *const buffer)
 
void applyJacobian (const MInt noElements, ElementCollector &elem)
 
void calcSourceTerms (const MFloat t, const MInt noElements, ElementCollector &elem, F &sourceFct)
 
void calcSurfaceIntegral (const MInt begin_, const MInt end_, ElementCollector &elem, SurfaceCollector &surf, HElementCollector &helem, const MInt noHElements)
 
void calcRegularSurfaceFlux (const MInt begin_, const MInt end_, SurfaceCollector &surf, F &riemannFct)
 

Detailed Description

template<MInt nDim, class SysEqn>
class DgBcExact< nDim, SysEqn >
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2014

Note: The exact BC uses the internal nodeVars for both the external as well as the internal state. This is due to the fact that for direct-hybrid simulations, i.e., where the nodeVars are not initialized by analytical initial conditions but from a file, the external nodeVars are not set. If this causes problems, another solution (probably more complex) has to be found.

Definition at line 26 of file dgcartesianbcexact.h.

Member Typedef Documentation

◆ Base

template<MInt nDim, class SysEqn >
using DgBcExact< nDim, SysEqn >::Base = DgBoundaryCondition<nDim, SysEqn>

Definition at line 29 of file dgcartesianbcexact.h.

Constructor & Destructor Documentation

◆ DgBcExact()

template<MInt nDim, class SysEqn >
DgBcExact< nDim, SysEqn >::DgBcExact ( SolverType solver_,
MInt  bcId 
)
inline

Definition at line 39 of file dgcartesianbcexact.h.

39: Base(solver_, bcId) {}
DgBoundaryCondition< nDim, SysEqn > Base

Member Function Documentation

◆ apply()

template<MInt nDim, class SysEqn >
void DgBcExact< nDim, SysEqn >::apply ( const MFloat  time)
inlineoverridevirtual

Implements DgBoundaryCondition< nDim, SysEqn >.

Definition at line 42 of file dgcartesianbcexact.h.

void applyAtSurface(const MInt surfaceId, const MFloat NotUsed(time))
MInt begin() const
Return index of first surface.
MInt end() const
Return index of one-past-last surface.
void loop(Functor &&fun, Class *object, const IdType begin, const IdType end, Args... args)

◆ applyAtSurface()

template<MInt nDim, class SysEqn >
void DgBcExact< nDim, SysEqn >::applyAtSurface ( const MInt  surfaceId,
const MFloat   NotUsedtime 
)

Definition at line 49 of file dgcartesianbcexact.h.

49 {
50 MFloat* nodeVarsL = &surfaces().nodeVars(surfaceId, 0);
51 MFloat* nodeVarsR = &surfaces().nodeVars(surfaceId, 1);
52 MFloat* stateL = &surfaces().variables(surfaceId, 0);
53 MFloat* stateR = &surfaces().variables(surfaceId, 1);
54
55 // Calculate boundary state from initial condition
56 // The boundary side is marked by an elment id of '-1'
57 MFloat* boundaryState = (surfaces().internalSideId(surfaceId) == 1) ? stateL : stateR;
58 MFloat* boundaryNodeVars = (surfaces().internalSideId(surfaceId) == 1) ? nodeVarsL : nodeVarsR;
59 MFloat* innerNodeVars = (surfaces().internalSideId(surfaceId) == 1) ? nodeVarsR : nodeVarsL;
60
61 // Iterate over all nodes and apply the initial condition at the boundary
62 const MInt noNodes1D = surfaces().noNodes1D(surfaceId);
63 const MInt noNodes1D3 = (nDim == 3) ? noNodes1D : 1;
64 const MInt dirId = surfaces().orientation(surfaceId);
65 MFloatTensor u(boundaryState, noNodes1D, noNodes1D3, SysEqn::noVars());
66 // Set node vars to minimum 1 to avoid errors in Tensor
67 // TODO labels:DG Check if this is really sensible
68 MFloatTensor nodeVars(boundaryNodeVars, noNodes1D, noNodes1D3, std::max(SysEqn::noNodeVars(), 1));
69 MFloatTensor x(&surfaces().nodeCoords(surfaceId), noNodes1D, noNodes1D3, nDim);
70
71 for(MInt i = 0; i < noNodes1D; i++) {
72 for(MInt j = 0; j < noNodes1D3; j++) {
73 sysEqn().calcInitialCondition(time, &x(i, j, 0), &nodeVars(i, j, 0), &u(i, j, 0));
74 }
75 }
76
77 // Calculate Riemann flux
78 // Use inner nodeVars for both sides (depending on the initial condition the
79 // nodeVars are not set in calcInitialCondition)
80 MFloat* f = flux(surfaceId);
81 sysEqn().calcRiemann(innerNodeVars, innerNodeVars, stateL, stateR, noNodes1D, dirId, f);
82}
SurfaceCollector & surfaces()
Return reference to surfaces.
SysEqn & sysEqn()
Return reference to SysEqn object.
MFloat * flux(const MInt i)
Return pointer to surface flux.
MInt & internalSideId(const MInt srfcId)
Accessor for internal side id.
MInt & noNodes1D(const MInt srfcId)
Accessor for number of nodes 1D.
MFloat & nodeVars(const MInt srfcId, const MInt side)
Accessor for node variables.
MFloat & variables(const MInt srfcId, const MInt side)
Accessor for variables.
MInt & orientation(const MInt srfcId)
Accessor for orientation.
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52

◆ name()

template<MInt nDim, class SysEqn >
MString DgBcExact< nDim, SysEqn >::name ( ) const
inlineoverridevirtual

Implements DgBoundaryCondition< nDim, SysEqn >.

Definition at line 40 of file dgcartesianbcexact.h.

40{ return "exact"; }

The documentation for this class was generated from the following file: