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

Container for sponge elements. More...

#include <dgcartesiansponge.h>

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

Public Member Functions

MPI_Comm mpiComm () const
 Return the MPI communicator used by the corresponding solver. More...
 
MInt domainId () const
 Return the domain id of the corresponding solver. More...
 
MInt noDomains () const
 Return the number of domains of the corresponding solver. More...
 
 DgSponge (const MInt solverId, const MPI_Comm comm)
 Constructor accepts solver id and MPI communicator. More...
 
void init (const MInt maxPolyDeg, Grid *grid_, ElementCollector *elements_, SurfaceCollector *surfaces_, std::vector< BC > *boundaryConditions, SysEqn *sysEqn, const MPI_Comm comm)
 Sets attributes so that sponge can access necessary components in solver. Checks sponge boundary condition ids. Creates sponge elements. More...
 
void calcSourceTerms ()
 Calculates the sponge terms, that can be considered as an addition source terms for each node and adds them to the time derivative of the conservative variables. More...
 
MInt noSpongeElements () const
 
MInt elementId (const MInt seId) const
 
MInt spongeElementId (const MInt eId) const
 Return sponge element id for given element id. If none exists, return -1. More...
 
MFloat spongeEta (const MInt seId, const MInt pos)
 

Private Types

using BC = typename DgBoundaryConditionFactory< nDim, SysEqn >::ReturnType
 
using Grid = typename maia::grid::Proxy< nDim >
 
using SpongeElementCollector = maia::dg::collector::SpongeElementCollector< nDim, SysEqn >
 
using SpongeLayerType = DgSpongeLayer< nDim >
 
using ElementCollector = maia::dg::collector::ElementCollector< nDim, SysEqn >
 
using SurfaceCollector = maia::dg::collector::SurfaceCollector< nDim, SysEqn >
 

Private Member Functions

void checkSpongeBoundaryConditions () const
 Check whether boundary conditions specified to have a sponge exist. More...
 
void initSpongeElements ()
 Initialisation of SpongeLayer. Calculation of spongeEta. Sponge is an additional Sourceoperator: DelL: du/dt + L(u) = DelL(u) More...
 
void initSpongeLayer (SpongeLayerType &spongeLayer, const BC &boundaryCondition)
 Determines boundary plane. More...
 
void exchangeSpongeLayers (std::vector< SpongeLayerType > &spongeLayers)
 Exchange sponge layers between all domains. More...
 
void calcSpongeEtaForAllNodes (const MInt seId, const std::vector< SpongeLayerType > &spongeLayers)
 Calculation of SpongeEta for all nodes of one DG-Element. More...
 
MFloat distance (const SpongeLayerType &spongeLayer, const MFloat *otherPoint) const
 Calculates the distance between a point and a boundary plane. The distance is signed, i.e., it is positive if the point is inside. More...
 
MBool pointInsideSpongeLayer (const SpongeLayerType &spongeLayer, const MFloat *otherPoint, MFloat &diff) const
 Returns true if point is inside sponge layer. Calculates difference between thickness of sponge layer and distance of point to boundary plane. More...
 

Private Attributes

const MInt m_solverId = -1
 
MPI_Comm m_mpiComm = MPI_COMM_NULL
 
MInt m_domainId = -1
 
MInt m_noDomains = -1
 
Gridm_grid = nullptr
 
MInt m_maxPolyDeg = -1
 
ElementCollectorm_elements = nullptr
 
std::vector< BC > * m_boundaryConditions = nullptr
 
SurfaceCollectorm_surfaces = nullptr
 
SysEqn * m_sysEqn = nullptr
 
SpongeElementCollector m_spongeElements
 

Detailed Description

template<MInt nDim, class SysEqn>
class DgSponge< nDim, SysEqn >
Author
Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 8th, 2015

Definition at line 59 of file dgcartesiansponge.h.

Member Typedef Documentation

◆ BC

template<MInt nDim, class SysEqn >
using DgSponge< nDim, SysEqn >::BC = typename DgBoundaryConditionFactory<nDim, SysEqn>::ReturnType
private

Definition at line 60 of file dgcartesiansponge.h.

◆ ElementCollector

template<MInt nDim, class SysEqn >
using DgSponge< nDim, SysEqn >::ElementCollector = maia::dg::collector::ElementCollector<nDim, SysEqn>
private

Definition at line 64 of file dgcartesiansponge.h.

◆ Grid

template<MInt nDim, class SysEqn >
using DgSponge< nDim, SysEqn >::Grid = typename maia::grid::Proxy<nDim>
private

Definition at line 61 of file dgcartesiansponge.h.

◆ SpongeElementCollector

template<MInt nDim, class SysEqn >
using DgSponge< nDim, SysEqn >::SpongeElementCollector = maia::dg::collector::SpongeElementCollector<nDim, SysEqn>
private

Definition at line 62 of file dgcartesiansponge.h.

◆ SpongeLayerType

template<MInt nDim, class SysEqn >
using DgSponge< nDim, SysEqn >::SpongeLayerType = DgSpongeLayer<nDim>
private

Definition at line 63 of file dgcartesiansponge.h.

◆ SurfaceCollector

template<MInt nDim, class SysEqn >
using DgSponge< nDim, SysEqn >::SurfaceCollector = maia::dg::collector::SurfaceCollector<nDim, SysEqn>
private

Definition at line 65 of file dgcartesiansponge.h.

Constructor & Destructor Documentation

◆ DgSponge()

template<MInt nDim, class SysEqn >
DgSponge< nDim, SysEqn >::DgSponge ( const MInt  solverId,
const MPI_Comm  comm 
)
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-08-31
Parameters
[in]solverIdThe id of the corresponding solver.
[in]commThe MPI communicator to use.

Definition at line 133 of file dgcartesiansponge.h.

133 : m_solverId(solverId), m_mpiComm(comm) {
134 TRACE();
135}
MPI_Comm m_mpiComm
const MInt m_solverId

Member Function Documentation

◆ calcSourceTerms()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::calcSourceTerms
Author
Vitali Pauz v.pau.nosp@m.z@ai.nosp@m.a.rwt.nosp@m.h-aa.nosp@m.chen..nosp@m.de
Date
April 4th, 2014

Definition at line 593 of file dgcartesiansponge.h.

593 {
594 TRACE();
595
596 // const MInt* polyDeg = &m_elements->polyDeg(0);
597 const MInt* noNodes1D = &m_elements->noNodes1D(0);
598 const MInt maxDataBlockSize = m_elements->maxNoNodesXD() * SysEqn::noVars();
599
600 std::vector<MFloat> spongeSources(maxDataBlockSize);
601
602#ifdef _OPENMP
603#pragma omp parallel for firstprivate(spongeSources)
604#endif
605 for(MInt seId = 0; seId < noSpongeElements(); seId++) {
606 const MInt eId = m_spongeElements.elementId(seId);
607 const MInt dataBlockSize = m_elements->noNodesXD(eId) * SysEqn::noVars();
608 m_sysEqn->calcSpongeSource(&m_elements->nodeVars(eId),
609 &m_elements->variables(eId),
610 noNodes1D[eId],
612 &spongeSources[0]);
613 MFloat* const rhs = &m_elements->rightHandSide(eId);
614 for(MInt dataId = 0; dataId < dataBlockSize; dataId++) {
615 rhs[dataId] += spongeSources[dataId];
616 }
617 }
618}
SpongeElementCollector m_spongeElements
ElementCollector * m_elements
SysEqn * m_sysEqn
MInt noSpongeElements() const
MInt noNodesXD(const MInt id) const
Accessor for number of nodes XD (const version).
MInt maxNoNodesXD() const
Return maximum number of nodes XD.
MFloat & nodeVars(const MInt id)
Accessor for node variables.
MFloat & variables(const MInt id, const MInt pos)
Accessor for variables.
MFloat & rightHandSide(const MInt id)
Accessor for right hand side.
MInt noNodes1D(const MInt id) const
Accessor for number of nodes 1D (const version).
MFloat & spongeEta(const MInt id)
Accessor for sponge eta.
MInt & elementId(const MInt id)
Accessor for element id.
int32_t MInt
Definition: maiatypes.h:62
double MFloat
Definition: maiatypes.h:52

◆ calcSpongeEtaForAllNodes()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::calcSpongeEtaForAllNodes ( const MInt  seId,
const std::vector< SpongeLayerType > &  spongeLayers 
)
private
Author
Vitali Pauz v.pau.nosp@m.z@ai.nosp@m.a.rwt.nosp@m.h-aa.nosp@m.chen..nosp@m.de
Date
April 4th, 2014

Definition at line 628 of file dgcartesiansponge.h.

629 {
630 TRACE();
631
632 const MInt eId = m_spongeElements.elementId(seId);
633 const MInt noNodes1D = m_elements->noNodes1D(eId);
634 const MInt noNodes1D3 = (nDim == 3) ? noNodes1D : 1;
635
636 MFloatTensor nodeCoordinates(&m_elements->nodeCoordinates(eId), noNodes1D, noNodes1D, noNodes1D3, nDim);
637
638 MFloatTensor sEta(&m_spongeElements.spongeEta(seId), noNodes1D, noNodes1D, noNodes1D3);
639 std::fill_n(&sEta(0, 0, 0), sEta.size(), 0.0);
640
641 for(MInt i = 0; i < noNodes1D; i++) {
642 for(MInt j = 0; j < noNodes1D; j++) {
643 for(MInt k = 0; k < noNodes1D3; k++) {
644 for(size_t s = 0; s < spongeLayers.size(); s++) {
645 MFloat diff = 0.0;
646 if(pointInsideSpongeLayer(spongeLayers[s], &nodeCoordinates(i, j, k, 0), diff)) {
647 const MFloat eta = POW2(diff / spongeLayers[s].m_thickness);
648 sEta(i, j, k) = std::max(sEta(i, j, k), eta);
649 }
650 }
651 }
652 }
653 }
654}
MBool pointInsideSpongeLayer(const SpongeLayerType &spongeLayer, const MFloat *otherPoint, MFloat &diff) const
Returns true if point is inside sponge layer. Calculates difference between thickness of sponge layer...
MFloat & nodeCoordinates(const MInt id)
Accessor for node coordinates.
constexpr Real POW2(const Real x)
Definition: functions.h:119

◆ checkSpongeBoundaryConditions()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::checkSpongeBoundaryConditions
private
Author
Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 20th, 2015

Definition at line 233 of file dgcartesiansponge.h.

◆ distance()

template<MInt nDim, class SysEqn >
MFloat DgSponge< nDim, SysEqn >::distance ( const SpongeLayerType spongeLayer,
const MFloat point 
) const
private
Author
Sven Berger, Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 21st, 2015

Definition at line 665 of file dgcartesiansponge.h.

665 {
666 // 0=x, 1=y, 2=z
667 const MInt orientation = (spongeLayer.m_orientation - spongeLayer.m_orientation % 2) / 2;
668 // 1=inside in positive direction, -1=inside in negative direction
669 const MInt direction = 2 * (spongeLayer.m_orientation % 2) - 1;
670
671 return direction * (point[orientation] - spongeLayer.m_offset);
672}

◆ domainId()

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::domainId ( ) const
inline

Definition at line 72 of file dgcartesiansponge.h.

72{ return m_domainId; }

◆ elementId()

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::elementId ( const MInt  seId) const
inline

Definition at line 82 of file dgcartesiansponge.h.

82{ return m_spongeElements.elementId(seId); }

◆ exchangeSpongeLayers()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::exchangeSpongeLayers ( std::vector< SpongeLayerType > &  spongeLayers)
private
Author
Sven Berger, Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 21st, 2015

Definition at line 495 of file dgcartesiansponge.h.

495 {
496 TRACE();
497
499 // Exchange sponge layer ids
501
502 // Set up communication buffer
503 const MInt noSpongeBcs = spongeLayers.size();
504 ScratchSpace<MChar> whichSpongeLayers(noDomains(), noSpongeBcs, AT_, "whichSpongeLayers");
505
506 // For each sponge BC id, store if it has surfaces on current domain
507 for(MInt i = 0; i < noSpongeBcs; i++) {
508 const MInt spongeBcId = spongeLayers[i].m_bcId;
509 whichSpongeLayers(domainId(), i) =
510 std::find_if(m_boundaryConditions->begin(),
512 [spongeBcId](const BC& bc) { return bc->id() == spongeBcId && bc->count() > 0; })
513 != m_boundaryConditions->end();
514 }
515
516 // Exchange with all domains
517 MPI_Allgather(MPI_IN_PLACE, noSpongeBcs, maia::type_traits<MChar>::mpiType(), &whichSpongeLayers(0, 0), noSpongeBcs,
518 maia::type_traits<MChar>::mpiType(), mpiComm(), AT_, "MPI_IN_PLACE", "whichSpongeLayers(0");
519
521 // Exchange boundary planes and thicknesses
523
524 // One broadcast per sponge BC:
525 // 1.) If whichSpongeLayerRecv is false, nothing has to be done.
526 // 2.) If whichSpongeLayerRecv is true, make sure that domains with higher id
527 // do not broadcast.
528 // 3.) Prepare and perform broadcast.
529 // Iterating through whichSpongeLayer is equivalent to iterating through
530 // all domains and sponge BCs
531 for(MInt i = 0; i < noDomains(); i++) {
532 for(MInt j = 0; j < noSpongeBcs; j++) {
533 // Step 1
534 if(!whichSpongeLayers(i, j)) {
535 continue;
536 }
537
538 // Step 2
539 for(MInt k = i + 1; k < noDomains(); k++) {
540 whichSpongeLayers(k, j) = false;
541 }
542
543 // Step 3
544 const MInt spongeBcId = spongeLayers[j].m_bcId;
545 SpongeLayerType& spongeLayer =
546 *std::find_if(spongeLayers.begin(), spongeLayers.end(),
547 [spongeBcId](const SpongeLayerType& sl) { return sl.m_bcId == spongeBcId; });
548 MPI_Bcast(&spongeLayer.m_orientation, 1, maia::type_traits<MInt>::mpiType(), i, mpiComm(), AT_,
549 "spongeLayer.m_orientation");
550 MPI_Bcast(&spongeLayer.m_offset, 1, maia::type_traits<MFloat>::mpiType(), i, mpiComm(), AT_,
551 "spongeLayer.m_offset");
552 MPI_Allreduce(MPI_IN_PLACE, &spongeLayer.m_minCoord[0], nDim, maia::type_traits<MFloat>::mpiType(), MPI_MIN,
553 mpiComm(), AT_, "MPI_IN_PLACE", "spongeLayer.m_minCoord[0]");
554 MPI_Allreduce(MPI_IN_PLACE, &spongeLayer.m_maxCoord[0], nDim, maia::type_traits<MFloat>::mpiType(), MPI_MAX,
555 mpiComm(), AT_, "MPI_IN_PLACE", "spongeLayer.m_maxCoord[0]");
556 }
557 }
558}
MPI_Comm mpiComm() const
Return the MPI communicator used by the corresponding solver.
std::vector< BC > * m_boundaryConditions
MInt domainId() const
Return the domain id of the corresponding solver.
DgSpongeLayer< nDim > SpongeLayerType
MInt noDomains() const
Return the number of domains of the corresponding solver.
typename DgBoundaryConditionFactory< nDim, SysEqn >::ReturnType BC
This class is a ScratchSpace.
Definition: scratch.h:758
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, const MString &name, const MString &varname)
same as MPI_Bcast
int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allgather

◆ init()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::init ( const MInt  maxPolyDeg,
Grid grid_,
ElementCollector elements_,
SurfaceCollector surfaces_,
std::vector< BC > *  boundaryConditions,
SysEqn *  sysEqn,
const MPI_Comm  comm 
)
Author
Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 8th, 2015
Parameters
[in]solverId
[in]maxPolyDeg
[in]grid
[in]elements
[in]surfaces
[in]boundaryConditions
[in]sysEqn

Definition at line 154 of file dgcartesiansponge.h.

156 {
157 TRACE();
158
159 m_mpiComm = comm;
160 // Determine domain id and number of domains
161 MPI_Comm_rank(mpiComm(), &m_domainId);
162 MPI_Comm_size(mpiComm(), &m_noDomains);
163
164 m_maxPolyDeg = maxPolyDeg;
165 m_grid = grid_;
166 m_elements = elements_;
167 m_surfaces = surfaces_;
168 m_boundaryConditions = boundaryConditions;
169 m_sysEqn = sysEqn;
170
171 // Make sure that all BCs marked as spongeBCs are actually present in
172 // simulation setup (sanity check)
174
175 // Intialize a sponge element for each DG element affected by a sponge layer
177}
void checkSpongeBoundaryConditions() const
Check whether boundary conditions specified to have a sponge exist.
SurfaceCollector * m_surfaces
void initSpongeElements()
Initialisation of SpongeLayer. Calculation of spongeEta. Sponge is an additional Sourceoperator: DelL...

◆ initSpongeElements()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::initSpongeElements
private

DelL = spongeSigma * spongeEta * DeltaStates spongeSigma = heuristical value (approx 0.5) spongeEta = (x_sp / L_sp)^2 L_sp = spongeLayerThickness x_sp = distance of a point to the inner spongeLayer DeltaStages = state_infinity - state_current

Literature: Hartmann Diss. eq. 3.58

Author
Vitali Pauz v.pau.nosp@m.z@ai.nosp@m.a.rwt.nosp@m.h-aa.nosp@m.chen..nosp@m.de, Sven Berger, Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 20th, 2015

Definition at line 287 of file dgcartesiansponge.h.

◆ initSpongeLayer()

template<MInt nDim, class SysEqn >
void DgSponge< nDim, SysEqn >::initSpongeLayer ( SpongeLayerType spongeLayer,
const BC boundaryCondition 
)
private
Author
Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 20th, 2015

Definition at line 422 of file dgcartesiansponge.h.

422 {
423 TRACE();
424
425 const MInt firstSrfcId = boundaryCondition->begin();
426 const MFloat* srfcCoord = &m_surfaces->coords(firstSrfcId, 0);
427
428 // Store orientation
429 MInt orientation = m_surfaces->orientation(firstSrfcId);
430 MInt direction = m_surfaces->internalSideId(firstSrfcId);
431 spongeLayer.m_orientation = 2 * orientation + direction;
432
433 // Correct orientation of the boundary condition manually
434 // used for the direct-hybrid testcase of a acoustically
435 // exicted flame
436 if(spongeLayer.m_bcId == 200) {
437 orientation = 0;
438 direction = 0;
439 spongeLayer.m_orientation = 0;
440 }
441 if(spongeLayer.m_bcId == 201) {
442 orientation = 1;
443 direction = 1;
444 spongeLayer.m_orientation = 3;
445 }
446 if(spongeLayer.m_bcId == 202) {
447 orientation = 1;
448 direction = 1;
449 spongeLayer.m_orientation = 3;
450 }
451 if(spongeLayer.m_bcId == 203) {
452 orientation = 0;
453 direction = 1;
454 spongeLayer.m_orientation = 1;
455 }
456
457 // Store offset (distance to origin)
458 spongeLayer.m_offset = srfcCoord[orientation];
459
460 // Determine minimum and maximum coordinates
461 std::fill_n(&spongeLayer.m_minCoord[0], nDim, std::numeric_limits<MFloat>::max());
462 spongeLayer.m_minCoord[orientation] = srfcCoord[orientation];
463 std::fill_n(&spongeLayer.m_maxCoord[0], nDim, -std::numeric_limits<MFloat>::max());
464 spongeLayer.m_maxCoord[orientation] = srfcCoord[orientation];
465
466 // Determine minimum and maximum extent of boundary by checking each surface
467 for(MInt i = boundaryCondition->begin(); i < boundaryCondition->end(); i++) {
468 const MFloat* srfcCenter = &m_surfaces->coords(i, 0);
469 const MInt internalSideId = m_surfaces->internalSideId(i);
470 // FIXME labels:DG,toenhance Boundary surfaces with two neighbor elements should not exist. For
471 // now, they are simply skipped.
472 if(internalSideId == -1) {
473 continue;
474 }
475 const MInt eId = m_surfaces->nghbrElementIds(i, internalSideId);
476 const MInt cellId = m_elements->cellId(eId);
477 const MFloat halfCellLength = m_grid->halfCellLength(cellId);
478 for(MInt j = 0; j < nDim; j++) {
479 if(j != orientation) {
480 spongeLayer.m_minCoord[j] = std::min(spongeLayer.m_minCoord[j], srfcCenter[j] - halfCellLength);
481 spongeLayer.m_maxCoord[j] = std::max(spongeLayer.m_maxCoord[j], srfcCenter[j] + halfCellLength);
482 }
483 }
484 }
485}
MInt & cellId(const MInt id)
Accessor for cell id.
MInt & internalSideId(const MInt srfcId)
Accessor for internal side id.
MInt & nghbrElementIds(const MInt srfcId, const MInt side)
Accessor for neighbor element ids.
MInt & orientation(const MInt srfcId)
Accessor for orientation.
MFloat & coords(const MInt srfcId, const MInt dir)
Accessor for coordinates.
void const MInt cellId
Definition: collector.h:239

◆ mpiComm()

template<MInt nDim, class SysEqn >
MPI_Comm DgSponge< nDim, SysEqn >::mpiComm ( ) const
inline

Definition at line 70 of file dgcartesiansponge.h.

70{ return m_mpiComm; }

◆ noDomains()

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::noDomains ( ) const
inline

Definition at line 74 of file dgcartesiansponge.h.

74{ return m_noDomains; }

◆ noSpongeElements()

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::noSpongeElements ( ) const
inline

Definition at line 81 of file dgcartesiansponge.h.

81{ return m_spongeElements.size(); }
constexpr MInt size() const
Return size (i.e., currently used number of nodes)
Definition: container.h:89

◆ pointInsideSpongeLayer()

template<MInt nDim, class SysEqn >
MBool DgSponge< nDim, SysEqn >::pointInsideSpongeLayer ( const SpongeLayerType spongeLayer,
const MFloat point,
MFloat diff 
) const
private
Author
Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 21st, 2015

Definition at line 684 of file dgcartesiansponge.h.

685 {
686 // distance to boundary plane
687 MFloat dist = distance(spongeLayer, point);
688 if(dist < 0.0) {
689 return false;
690 }
691 diff = spongeLayer.m_thickness - dist;
692 if(diff < 0.0) {
693 return false;
694 }
695
696 // within min and max coordinates
697 for(MInt i = 0; i < nDim; i++) {
698 const MInt orientation = (spongeLayer.m_orientation - spongeLayer.m_orientation % 2) / 2;
699 if(orientation == i) {
700 continue;
701 }
702
703 if(point[i] < spongeLayer.m_minCoord[i] || point[i] > spongeLayer.m_maxCoord[i]) {
704 return false;
705 }
706 }
707
708 return true;
709}
MFloat distance(const SpongeLayerType &spongeLayer, const MFloat *otherPoint) const
Calculates the distance between a point and a boundary plane. The distance is signed,...
MFloat dist(const Point< DIM > &p, const Point< DIM > &q)
Definition: pointbox.h:54

◆ spongeElementId()

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::spongeElementId ( const MInt  eId) const
Author
Hans Yu hans..nosp@m.yu@r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
April 2nd, 2015

Definition at line 569 of file dgcartesiansponge.h.

569 {
570 const MInt* const begin = &m_spongeElements.elementId(0);
571 const MInt* const end = &m_spongeElements.elementId(0) + noSpongeElements();
572 const MInt* const low = std::lower_bound(begin, end, eId);
573
574 // Return not found if std::lower_bound does not find anything
575 if(low == end || *low != eId) {
576 return -1;
577 }
578
579 // Otherwise return found sponge element id
580 return std::distance(begin, low);
581}

◆ spongeEta()

template<MInt nDim, class SysEqn >
MFloat DgSponge< nDim, SysEqn >::spongeEta ( const MInt  seId,
const MInt  pos 
)
inline

Definition at line 84 of file dgcartesiansponge.h.

84{ return m_spongeElements.spongeEta(seId, pos); }

Member Data Documentation

◆ m_boundaryConditions

template<MInt nDim, class SysEqn >
std::vector<BC>* DgSponge< nDim, SysEqn >::m_boundaryConditions = nullptr
private

Definition at line 112 of file dgcartesiansponge.h.

◆ m_domainId

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::m_domainId = -1
private

Definition at line 99 of file dgcartesiansponge.h.

◆ m_elements

template<MInt nDim, class SysEqn >
ElementCollector* DgSponge< nDim, SysEqn >::m_elements = nullptr
private

Definition at line 109 of file dgcartesiansponge.h.

◆ m_grid

template<MInt nDim, class SysEqn >
Grid* DgSponge< nDim, SysEqn >::m_grid = nullptr
private

Definition at line 103 of file dgcartesiansponge.h.

◆ m_maxPolyDeg

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::m_maxPolyDeg = -1
private

Definition at line 106 of file dgcartesiansponge.h.

◆ m_mpiComm

template<MInt nDim, class SysEqn >
MPI_Comm DgSponge< nDim, SysEqn >::m_mpiComm = MPI_COMM_NULL
private

Definition at line 98 of file dgcartesiansponge.h.

◆ m_noDomains

template<MInt nDim, class SysEqn >
MInt DgSponge< nDim, SysEqn >::m_noDomains = -1
private

Definition at line 100 of file dgcartesiansponge.h.

◆ m_solverId

template<MInt nDim, class SysEqn >
const MInt DgSponge< nDim, SysEqn >::m_solverId = -1
private

Definition at line 97 of file dgcartesiansponge.h.

◆ m_spongeElements

template<MInt nDim, class SysEqn >
SpongeElementCollector DgSponge< nDim, SysEqn >::m_spongeElements
private

Definition at line 121 of file dgcartesiansponge.h.

◆ m_surfaces

template<MInt nDim, class SysEqn >
SurfaceCollector* DgSponge< nDim, SysEqn >::m_surfaces = nullptr
private

Definition at line 115 of file dgcartesiansponge.h.

◆ m_sysEqn

template<MInt nDim, class SysEqn >
SysEqn* DgSponge< nDim, SysEqn >::m_sysEqn = nullptr
private

Definition at line 118 of file dgcartesiansponge.h.


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