MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
CouplingDgApe< nDim, CouplingDonor > Class Template Referenceabstract

Intermediate class for coupling DG solver with APE sysEqn. More...

#include <couplingdgape.h>

Inheritance diagram for CouplingDgApe< nDim, CouplingDonor >:
[legend]
Collaboration diagram for CouplingDgApe< nDim, CouplingDonor >:
[legend]

Classes

struct  ST
 
struct  Timers
 

Public Types

using Base = Coupling
 
using BaseDonor = CouplingDonor
 
using DonorSolverType = typename BaseDonor::solverType
 
using SysEqn = DgSysEqnAcousticPerturb< nDim >
 
using ProjectionType = DgGalerkinProjection< nDim >
 
using BaseDg = CouplingDg< nDim, DgSysEqnAcousticPerturb< nDim > >
 
using DgCartesianSolverType = typename BaseDg::solverType
 
using MV = MeanVariables< nDim >
 Hold indices for mean variables. More...
 
- Public Types inherited from CouplingDg< nDim, DgSysEqnAcousticPerturb< nDim > >
using solverType = DgCartesianSolver< nDim, DgSysEqnAcousticPerturb< nDim > >
 
using CV = typename SysEqn::CV
 

Public Member Functions

 CouplingDgApe (const MInt couplingId, DgCartesianSolverType *dg, DonorSolverType *ds)
 Initialize timers and read properties in c'tor. More...
 
virtual ~CouplingDgApe ()=default
 
void init () override
 
void finalizeSubCoupleInit (MInt) override final
 
void preCouple (MInt) final
 Calculate source terms and add to the external source terms of the DG solver. More...
 
void subCouple (MInt, MInt, std::vector< MBool > &) override final
 
void postCouple (MInt) override final
 
void cleanUp () override final
 
void getCouplingTimings (std::vector< std::pair< MString, MFloat > > &timings, const MBool allTimings) override
 
void getDomainDecompositionInformation (std::vector< std::pair< MString, MInt > > &domainInfo) override final
 
MInt noCouplingTimers (const MBool allTimings) const override
 
MInt noMeanVars () const
 Return number of mean variables. More...
 
void startLoadTimer (const MString &name) const
 Start the load timer of the coupler. More...
 
void stopLoadTimer (const MString &name) const
 Stop the load timer of the coupler. More...
 
- Public Member Functions inherited from CouplingDg< nDim, DgSysEqnAcousticPerturb< nDim > >
 CouplingDg (const MInt couplingId, solverType *b)
 
virtual ~CouplingDg ()=default
 
solverTypedgSolver () const
 Return MPI communicator. More...
 
MInt solverId () const
 Return solver id. More...
 
DgSysEqnAcousticPerturb< nDim > & sysEqn ()
 Return reference to SysEqn object. More...
 
ElementCollectorelements ()
 Return reference to elements. More...
 
MInt noElements () const
 Return number of elements. More...
 
MFloatexternalSource () const
 Return pointer to external source memory. More...
 
MInt getElementByCellId (const MInt cellId)
 Return element id for cell id. More...
 
MInt minPolyDeg () const
 Return the minimum polynomial degree. More...
 
MInt maxPolyDeg () const
 Return the maximum polynomial degree. More...
 
MString outputDir () const
 Return output directory. More...
 
void saveNodalData (const MString &fileNameBase, const MInt noVars, const std::vector< MString > &varNames, const MFloat *const data) const
 Save nodal data to file. More...
 
- Public Member Functions inherited from Coupling
 Coupling (const MInt couplingId)
 
virtual ~Coupling ()=default
 
 Coupling (const Coupling &)=delete
 
Couplingoperator= (const Coupling &)=delete
 
MInt couplerId () const
 
virtual void init ()=0
 
virtual void finalizeSubCoupleInit (MInt solverId)=0
 
virtual void finalizeCouplerInit ()=0
 
virtual void preCouple (MInt recipeStep)=0
 
virtual void subCouple (MInt recipeStep, MInt solverId, std::vector< MBool > &solverCompleted)=0
 
virtual void postCouple (MInt recipeStep)=0
 
virtual void cleanUp ()=0
 
virtual void balancePre ()
 Load balancing. More...
 
virtual void balancePost ()
 
virtual void reinitAfterBalance ()
 
virtual void prepareAdaptation ()
 
virtual void postAdaptation ()
 
virtual void finalizeAdaptation (const MInt)
 
virtual void writeRestartFile (const MInt)
 
virtual MInt noCellDataDlb () const
 Methods to inquire coupler data during balancing. More...
 
virtual MInt cellDataTypeDlb (const MInt NotUsed(dataId)) const
 
virtual MInt cellDataSizeDlb (const MInt NotUsed(dataId), const MInt NotUsed(cellId))
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), const MInt NotUsed(oldNoCells), const MInt *const NotUsed(bufferIdToCellId), MInt *const NotUsed(data))
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), const MInt NotUsed(oldNoCells), const MInt *const NotUsed(bufferIdToCellId), MLong *const NotUsed(data))
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), const MInt NotUsed(oldNoCells), const MInt *const NotUsed(bufferIdToCellId), MFloat *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MInt *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MLong *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MFloat *const NotUsed(data))
 
virtual void finalizeBalance (const MInt)
 
virtual MInt noCouplingTimers (const MBool NotUsed(allTimings)) const
 Number of coupling timers. More...
 
virtual void getCouplingTimings (std::vector< std::pair< MString, MFloat > > &NotUsed(timings), const MBool NotUsed(allTimings))
 Return coupling timings. More...
 
virtual void getDomainDecompositionInformation (std::vector< std::pair< MString, MInt > > &NotUsed(domainInfo))
 Return information on current domain decomposition (e.g. number of coupled cells/elements/...) More...
 
void setDlbTimer (const MInt timerId)
 
void startLoadTimer (const MString &name) const
 Start the load timer of the coupler. More...
 
void stopLoadTimer (const MString &name) const
 Stop the load timer of the coupler. More...
 

Static Public Member Functions

static constexpr MInt noVelocities ()
 Return number of velocity variables. More...
 
static constexpr MInt noVorticities ()
 Return number of vorticity variables. More...
 

Protected Member Functions

void calcInitialCondition (const MFloat time)
 Apply initial conditions for this coupling condition. More...
 
void initCoupler ()
 Initialize the coupling condition (data structures). More...
 
void initData ()
 Initialize the data (initial conditions or for a restart) of the coupling condition. More...
 
void initProjection ()
 Initialize the projection information for spatial coupling. More...
 
void initRestart (const MFloat time, const MFloat dt)
 Perform initializations for a restart. More...
 
void initSourceFilter ()
 Calculate source filter values for all elements and store element ids on which source terms need to be computed. More...
 
void initTimers ()
 Create timers. More...
 
MBool loadCouplingData (const MString &filename, const MString &name_, const MInt stride, MFloat *data)
 Auxiliary method to load coupling data (i.e. anything coming from the LES) from a file. More...
 
void loadMeanQuantities (const MBool skipNodeVars=false)
 Load mean velocities from file and store them to the node variables. More...
 
void projectToElement (const MInt elementId, const MInt noVars, const MFloat *data, const MFloat *defaultValues, MFloat *target)
 Project the given data fields onto a single element. More...
 
void saveFilterValues ()
 Save filter values to file. More...
 
void saveFilterValuesDonor ()
 Save the filter values on the donor cells. More...
 
void applyStoredSources (const MFloat time)
 Apply the stored source terms to the time derivative. More...
 
void storeSources (const MFloat time, const MInt timeStep)
 Load coupling data from LES, then calculate, accumulate, project and store coupling source terms. More...
 
virtual void performUnitConversion (const MString &, const MInt, const MInt, MFloat *)
 
virtual void calcSourceLambLinearized (const MFloat *const velocity, const MFloat *const vorticity, MFloat *sourceTerms)=0
 
virtual void calcSourceLambNonlinear (const MFloat *const velocity, const MFloat *const vorticity, MFloat *const sourceTerms)=0
 
virtual void calcSourceQmII (const MFloat *const velocity, MFloat *const sourceTerms)=0
 
virtual void calcSourceQmIII (const MFloat *const velocity, MFloat *sourceTerms)=0
 
virtual void calcSourceQe (const MFloat *const velocity, const MFloat time, MFloat *const sourceTerms)=0
 
virtual void calcSourceQc (const MFloat *const velocity, MFloat *const sourceTerms, const MFloat time, const MInt timeStep)=0
 
void saveSourceTermsDonorGrid (const MInt timeStep, const MFloat *const data)
 Store the source terms on the donor grid. More...
 
void saveSourceTermsTargetGrid (const MInt timeStep)
 Store the source terms on the target grid, i.e. after interpolation. More...
 
void readProperties () override final
 Read properties and store in member variables. More...
 
void checkProperties () override final
 
virtual DonorSolverTypedonorSolver (const MInt solverId=0) const =0
 
virtual void getDonorVelocityAndVorticity (const std::vector< MInt > &donorCellIds, MFloatScratchSpace &p_velocity, MFloatScratchSpace &p_vorticity)=0
 
- Protected Member Functions inherited from Coupling
MFloat returnLoadRecord () const
 
MFloat returnIdleRecord () const
 

Protected Attributes

MBool m_isRestart = false
 Store whether this is a restart (in case special treatment is necessary) More...
 
MBool m_hasDgCartesianSolver = false
 Store whether this domain has DG cells/elements. More...
 
MBool m_hasDonorCartesianSolver = false
 Store whether this domain has Cartesian donor solver cells. More...
 
MInt m_maxNoNodesXD = -1
 Maximum number of nodes of an element (corresponding to maxPolyDeg) More...
 
MFloat m_fixedTimeStep = -1.0
 Fixed time step to use. More...
 
MFloat m_previousTime
 Previous time for the calculation of time derivatives. More...
 
MInt m_previousTimeStep = -1
 Previous time step (to determine whether new sources need to be calculated) More...
 
std::vector< MIntm_activeMeanVars {}
 List of active mean variables for all active source terms. More...
 
MString m_meanDataFileName {}
 File name for mean quantities. More...
 
std::vector< MIntm_activeSourceTerms {}
 List of active source terms. More...
 
MBool m_saveSourceTermsDonorGrid = false
 Store whether the sources on the donor grid should be saved as well. More...
 
MInt m_saveSourceTermsInterval = -1
 Interval at which source term data should be saved to disk. More...
 
MBool m_calcProjectionError = false
 Calculate the L2 error of the Galerkin projection. More...
 
MInt m_noActiveDonorCells = -1
 
MInt m_noDonorCells = -1
 Total number of donor cells on this domain. More...
 
std::vector< std::vector< MInt > > m_elementDonorLevels = {}
 Donor cell levels relative to element. More...
 
std::vector< std::vector< MInt > > m_elementDonorMap = {}
 Mapping from donor cells to elements. More...
 
std::vector< std::vector< MInt > > m_elementDonorPos = {}
 Donor cell positions on the corresponding cell level. More...
 
std::vector< ProjectionTypem_projection {}
 Galerkin projection (access by polynomial degree) More...
 
MBool m_isFirstSourceCalculation = true
 Store whether this is the first calculation of the source terms. More...
 
std::vector< MFloatm_sourceTerms {}
 Local storage for source terms. More...
 
std::vector< MIntm_calcSourceDonorCells {}
 List of all donor cell ids for which source terms need to be computed. More...
 
std::vector< MIntm_calcSourceElements {}
 List of all element ids for which source terms need to be computed. More...
 
MFloat m_sourceFactor = 1.0
 Factor by which the source terms are multiplied. More...
 
MBool m_checkConservation = false
 Check if each Galerkin projection is conservative. More...
 
MFloat m_maxConservationError = -1.0
 Maximum conservation error. More...
 
MFloat m_maxL2Error = -1.0
 Maximum computed L2 error of the Galerkin projection. More...
 
std::vector< MFloatm_meanVars {}
 Local storage for mean variables of the donor cells. More...
 
std::vector< MIntm_elementInsideBody {}
 Marker if elements are inside a geometric object. More...
 
Filter< nDim > m_sourceTermFilter
 Auxiliary object that handles source filtering. More...
 
std::vector< MFloatm_filter {}
 Local storage for source filter values. More...
 
std::vector< MFloatm_filterDonor {}
 Local storage for source filter values on donor cells. More...
 
MInt m_noCutModesLowPass = 0
 Number of modes to cut using the low-pass source term. More...
 
MBool m_useLowPassFilter = false
 Switch low pass on and off to allow disabling e.g. for node vars. More...
 
std::vector< MFloatTensorm_vdmLowPass {}
 Vandermonde matrix/matrices for the low-pass filter. More...
 
MBool m_applySourceFilterDonor = false
 Apply source filter on donor cells or on DG elements after projection. More...
 
MBool m_saveSourceTermFilter = false
 Store whether filter values should be written to a file at initialization. More...
 
MBool m_projectionFilter = false
 Use spatial projection filter (i.e. exclude elements from the projection) More...
 
std::vector< MFloatm_projectionFilterBox {}
 Spatial projection filter box (excluding) More...
 
std::array< MInt, s_totalNoMeanVarsm_meanVarsIndex {}
 
std::array< MInt, Timers::_countm_timers
 
- Protected Attributes inherited from CouplingDg< nDim, DgSysEqnAcousticPerturb< nDim > >
solverTypem_dgSolver
 

Static Protected Attributes

static const MInt s_totalNoMeanVars = MV::totalNoMeanVars
 
static const std::array< MString, ST::totalNoSourceTermss_sourceTermNames
 Hold indices for source terms. More...
 

Private Member Functions

void neededMeanVarsForSourceTerm (const MInt sourceTerm, std::vector< MInt > &meanVars) const
 Return the needed mean variables for a given source term. More...
 

Additional Inherited Members

- Protected Types inherited from CouplingDg< nDim, DgSysEqnAcousticPerturb< nDim > >
using ElementCollector = maia::dg::collector::ElementCollector< nDim, DgSysEqnAcousticPerturb< nDim > >
 

Detailed Description

template<MInt nDim, class CouplingDonor>
class CouplingDgApe< nDim, CouplingDonor >
Author
Miro Gondrum (refactored stuff of Ansgar Niemoeller)
Date
22.02.2021

Definition at line 214 of file couplingdgape.h.

Member Typedef Documentation

◆ Base

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::Base = Coupling

Definition at line 217 of file couplingdgape.h.

◆ BaseDg

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::BaseDg = CouplingDg<nDim, DgSysEqnAcousticPerturb<nDim> >

Definition at line 226 of file couplingdgape.h.

◆ BaseDonor

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::BaseDonor = CouplingDonor

Definition at line 221 of file couplingdgape.h.

◆ DgCartesianSolverType

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::DgCartesianSolverType = typename BaseDg::solverType

Definition at line 227 of file couplingdgape.h.

◆ DonorSolverType

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::DonorSolverType = typename BaseDonor::solverType

Definition at line 222 of file couplingdgape.h.

◆ MV

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::MV = MeanVariables<nDim>

Definition at line 241 of file couplingdgape.h.

◆ ProjectionType

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::ProjectionType = DgGalerkinProjection<nDim>

Definition at line 225 of file couplingdgape.h.

◆ SysEqn

template<MInt nDim, class CouplingDonor >
using CouplingDgApe< nDim, CouplingDonor >::SysEqn = DgSysEqnAcousticPerturb<nDim>

Definition at line 224 of file couplingdgape.h.

Constructor & Destructor Documentation

◆ CouplingDgApe()

template<MInt nDim, class CouplingDonor >
CouplingDgApe< nDim, CouplingDonor >::CouplingDgApe ( const MInt  couplingId,
DgCartesianSolverType dg,
DonorSolverType ds 
)
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01
Parameters
[in]solver_A reference to the DG solver in which this coupling class is used.

Definition at line 500 of file couplingdgape.h.

501 : Coupling(couplingId),
502 BaseDonor(couplingId, ds),
503 CouplingDg<nDim, SysEqn>(couplingId, dg),
504 m_sourceTermFilter(dg->solverId()) {
505 TRACE();
506
507 // Ensure consistency in arguments
508 static_assert(MV::totalNoMeanVars == s_totalNoMeanVars, "Total number of mean vars is inconsistent");
509
510 initTimers();
511
512 RECORD_TIMER_STOP(m_timers[Timers::Constructor]);
513}
Filter< nDim > m_sourceTermFilter
Auxiliary object that handles source filtering.
std::array< MInt, Timers::_count > m_timers
CouplingDonor BaseDonor
void initTimers()
Create timers.
static const MInt s_totalNoMeanVars

◆ ~CouplingDgApe()

template<MInt nDim, class CouplingDonor >
virtual CouplingDgApe< nDim, CouplingDonor >::~CouplingDgApe ( )
virtualdefault

Member Function Documentation

◆ applyStoredSources()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::applyStoredSources ( const MFloat  time)
protected
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01

Definition at line 1439 of file couplingdgape.h.

1439 {
1440 TRACE();
1441 RECORD_TIMER_START(m_timers[Timers::ApplyStoredSources]);
1442
1443 const MInt dataSize = m_maxNoNodesXD * SysEqn::noVars();
1444
1445 // Note: moved this into the DG solver applyExternalSource to remove the dependency
1446 // on the simulation time in this function, this way the external sources can be computed once in
1447 // the preCouple step before starting the first RK stage!
1448 // Source term ramp up factor (linear in time)
1449 /* const MFloat rampUpFactor */
1450 /* = (m_useSourceRampUp) */
1451 /* ? maia::filter::slope::linear(startTime(), */
1452 /* startTime() + m_sourceRampUpTime, time) */
1453 /* : 1.0; */
1454
1455 const MInt noSourceElements = m_calcSourceElements.size();
1456 // Add source terms from persistent storage to right-hand side of all
1457 // elements with both nonzero filter values and donor cells.
1458 maia::parallelFor(0, noSourceElements, [&](MInt elementIndex) {
1459 const MInt elementId = m_calcSourceElements[elementIndex];
1460 const MInt noNodes1D = elements().polyDeg(elementId) + 1;
1461 const MInt noNodes1D3 = (nDim == 3) ? noNodes1D : 1;
1462 MFloatTensor r(externalSource() + elementId * dataSize, noNodes1D, noNodes1D, noNodes1D3, SysEqn::noVars());
1463 MFloatTensor s(&m_sourceTerms[0] + elementIndex * dataSize, noNodes1D, noNodes1D, noNodes1D3, SysEqn::noVars());
1464
1465 // Add source terms to all equations
1466 for(MInt i = 0; i < noNodes1D; i++) {
1467 for(MInt j = 0; j < noNodes1D; j++) {
1468 for(MInt k = 0; k < noNodes1D3; k++) {
1469 for(MInt l = 0; l < SysEqn::noVars(); l++) {
1470 r(i, j, k, l) += m_sourceFactor * s(i, j, k, l);
1471 }
1472 }
1473 }
1474 }
1475 });
1476
1477 RECORD_TIMER_STOP(m_timers[Timers::ApplyStoredSources]);
1478}
MFloat m_sourceFactor
Factor by which the source terms are multiplied.
std::vector< MFloat > m_sourceTerms
Local storage for source terms.
std::vector< MInt > m_calcSourceElements
List of all element ids for which source terms need to be computed.
MInt m_maxNoNodesXD
Maximum number of nodes of an element (corresponding to maxPolyDeg)
MFloat * externalSource() const
Return pointer to external source memory.
Definition: coupling.h:327
ElementCollector & elements()
Return reference to elements.
Definition: coupling.h:321
MInt & polyDeg(const MInt id)
Accessor for polynomial degree.
int32_t MInt
Definition: maiatypes.h:62
void parallelFor(MInt begin, MInt end, UnaryFunction &&f)
Wrapper function for parallel for loop.
Definition: parallelfor.h:147

◆ calcInitialCondition()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::calcInitialCondition ( const MFloat  time)
protected
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01
Parameters
[in]timeCurrent simulation time for time-dependent ICs

Definition at line 549 of file couplingdgape.h.

549 {
550 TRACE();
551 RECORD_TIMER_START(m_timers[Timers::InitialCondition]);
552
553 // Load mean quantities from disk into node variables
555
556 RECORD_TIMER_STOP(m_timers[Timers::InitialCondition]);
557}
void loadMeanQuantities(const MBool skipNodeVars=false)
Load mean velocities from file and store them to the node variables.

◆ calcSourceLambLinearized()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::calcSourceLambLinearized ( const MFloat *const  velocity,
const MFloat *const  vorticity,
MFloat sourceTerms 
)
protectedpure virtual

◆ calcSourceLambNonlinear()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::calcSourceLambNonlinear ( const MFloat *const  velocity,
const MFloat *const  vorticity,
MFloat *const  sourceTerms 
)
protectedpure virtual

◆ calcSourceQc()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::calcSourceQc ( const MFloat *const  velocity,
MFloat *const  sourceTerms,
const MFloat  time,
const MInt  timeStep 
)
protectedpure virtual

◆ calcSourceQe()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::calcSourceQe ( const MFloat *const  velocity,
const MFloat  time,
MFloat *const  sourceTerms 
)
protectedpure virtual

◆ calcSourceQmII()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::calcSourceQmII ( const MFloat *const  velocity,
MFloat *const  sourceTerms 
)
protectedpure virtual

◆ calcSourceQmIII()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::calcSourceQmIII ( const MFloat *const  velocity,
MFloat sourceTerms 
)
protectedpure virtual

◆ checkProperties()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::checkProperties ( )
inlinefinaloverrideprotectedvirtual

Implements Coupling.

Definition at line 348 of file couplingdgape.h.

348{};

◆ cleanUp()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::cleanUp ( )
inlinefinaloverridevirtual

Implements Coupling.

Definition at line 259 of file couplingdgape.h.

259{};

◆ donorSolver()

template<MInt nDim, class CouplingDonor >
virtual DonorSolverType & CouplingDgApe< nDim, CouplingDonor >::donorSolver ( const MInt  solverId = 0) const
protectedpure virtual

◆ finalizeSubCoupleInit()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::finalizeSubCoupleInit ( MInt  )
inlinefinaloverridevirtual

Implements Coupling.

Definition at line 254 of file couplingdgape.h.

254{};

◆ getCouplingTimings()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::getCouplingTimings ( std::vector< std::pair< MString, MFloat > > &  timings,
const MBool  allTimings 
)
inlineoverride

Definition at line 261 of file couplingdgape.h.

261 {
262 const MString namePrefix = "c" + std::to_string(this->couplerId()) + "_";
263
264 timings.emplace_back(namePrefix + "loadCouplerApe", returnLoadRecord());
265 timings.emplace_back(namePrefix + "idleCouplerApe", returnIdleRecord());
266
267#ifdef MAIA_TIMER_FUNCTION
268 timings.emplace_back(namePrefix + "preCouple", RETURN_TIMER_TIME(m_timers[Timers::PreCouple]));
269
270 if(allTimings) {
271 // Full set of timings
272 timings.emplace_back(namePrefix + "storeSources", RETURN_TIMER_TIME(m_timers[Timers::StoreSources]));
273 timings.emplace_back(namePrefix + "calcSources", RETURN_TIMER_TIME(m_timers[Timers::CalcSources]));
274 timings.emplace_back(namePrefix + "projectSourceTerms", RETURN_TIMER_TIME(m_timers[Timers::ProjectSourceTerms]));
275
276 timings.emplace_back(namePrefix + "applyStoredSources", RETURN_TIMER_TIME(m_timers[Timers::ApplyStoredSources]));
277 } else {
278 // Reduced/essential set of timings
279 timings.emplace_back(namePrefix + "projectSourceTerms", RETURN_TIMER_TIME(m_timers[Timers::ProjectSourceTerms]));
280 }
281#endif
282 };
MFloat returnIdleRecord() const
Definition: coupling.h:159
MFloat returnLoadRecord() const
Definition: coupling.h:158
MInt couplerId() const
Definition: coupling.h:67
std::basic_string< char > MString
Definition: maiatypes.h:55

◆ getDomainDecompositionInformation()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::getDomainDecompositionInformation ( std::vector< std::pair< MString, MInt > > &  domainInfo)
inlinefinaloverride

Definition at line 284 of file couplingdgape.h.

284 {
285 const MString namePrefix = "c" + std::to_string(this->couplerId()) + "_";
286
287 const MInt noCoupledDgElements = m_calcSourceElements.size();
288 const MInt noCoupledDonorCells = m_calcSourceDonorCells.size();
289
290 domainInfo.emplace_back(namePrefix + "noCoupledDgElements", noCoupledDgElements);
291 domainInfo.emplace_back(namePrefix + "noCoupledDonorCells", noCoupledDonorCells);
292 };
std::vector< MInt > m_calcSourceDonorCells
List of all donor cell ids for which source terms need to be computed.

◆ getDonorVelocityAndVorticity()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::getDonorVelocityAndVorticity ( const std::vector< MInt > &  donorCellIds,
MFloatScratchSpace p_velocity,
MFloatScratchSpace p_vorticity 
)
protectedpure virtual

◆ init()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::init ( )
inlineoverridevirtual

Implements Coupling.

Definition at line 249 of file couplingdgape.h.

249 {
251 initCoupler();
252 initData();
253 };
void initData()
Initialize the data (initial conditions or for a restart) of the coupling condition.
void initCoupler()
Initialize the coupling condition (data structures).
void readProperties() override final
Read properties and store in member variables.

◆ initCoupler()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::initCoupler
protected
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01

This also allocates memory for local storage of mean variables and source terms.

Definition at line 566 of file couplingdgape.h.

566 {
567 TRACE();
568 RECORD_TIMER_START(m_timers[Timers::Init]);
569
572 TERMM_IF_NOT_COND(noElements() == 0, "inactive DG solver should have no elements");
573 }
574
575 // Determine the total number of donor cells on this domain, i.e., total number of donor cells on
576 // this domain
577 m_noDonorCells = donorSolver().noInternalCells();
578 if(m_noDonorCells < 0) { // Reset if donorSolver is inactive
579 m_noDonorCells = 0;
580 }
582 TERMM_IF_NOT_COND(m_hasDonorCartesianSolver == donorSolver().isActive(), "Donor solver status error");
583
584 // Calculate maximum number of nodes
586
587 // Initialize the Galerkin projection(s) and determine the information needed
588 // to perform the Galerkin projection for all elements that have donor cells
590
591 // Allocate persistent storage for the source filter values. The maximum
592 // polynomial degree is used here to be consisent with the memory allocation
593 // in the solver.
594 m_filter.resize(std::max(noElements() * m_maxNoNodesXD, 0));
595 // Storage for donor cell filter
597
598 // Allocate storage for element ids for which coupling source terms need to be
599 // computed
601
602 // Calculate source filter values and store element ids on which source terms
603 // need to be computed, i.e. elements that have nonzero filter value(s) AND
604 // also have donor cell(s)
606
607 // Save filter values to file
611 }
612
613 // Allocate persistent storage for the source terms of all elements for which
614 // coupling source terms need to be computed. The maximum polynomial degree is
615 // used here to be consistent with the memory allocation in the solver.
616 m_sourceTerms.resize(std::max(static_cast<MInt>(m_calcSourceElements.size()) * m_maxNoNodesXD * SysEqn::noVars(), 0));
617
618 // Determine the set of donor cells on which source terms need to be computed
619 std::set<MInt> calcSourceDonorCells;
620 for(MInt elementId : m_calcSourceElements) {
621 calcSourceDonorCells.insert(m_elementDonorMap[elementId].begin(), m_elementDonorMap[elementId].end());
622 }
623 // Number of 'active' donor cells
624 m_noActiveDonorCells = calcSourceDonorCells.size();
626 TERMM_IF_COND(m_noActiveDonorCells > 0, "Inactive DG solver cannot have active donor cells.");
627 }
628
629 // Store 'active' donor cell ids in m_calcSourceDonorCells
631 m_calcSourceDonorCells.assign(calcSourceDonorCells.begin(), calcSourceDonorCells.end());
632
633 // Allocate persistent storage for the mean variables of the donor cells
635
638 // Temporarily create interpolation objects
640
641 // Check for SBP Mode
642 const MInt defaultSbpMode = 0;
643 const MInt sbpMode = Context::getSolverProperty("sbpMode", solverId(), AT_, &defaultSbpMode);
644
645 // Determine SBP Operator
646 const MString defaultSbpOperator = "";
647 const MString sbpOperator =
648 Context::getSolverProperty<MString>("sbpOperator", solverId(), AT_, &defaultSbpOperator);
649
650 // Determine initial number of nodes
651 MInt initNoNodes1D = -1;
652 initNoNodes1D = Context::getSolverProperty<MInt>("initNoNodes", solverId(), AT_, &initNoNodes1D);
653
654 // Determine DG integration method (same as in dgsolver.cpp)
655 const MString defaultDgIntegrationMethod = "DG_INTEGRATE_GAUSS";
656 const MInt dgIntegrationMethod = string2enum(
657 Context::getSolverProperty<MString>("dgIntegrationMethod", solverId(), AT_, &defaultDgIntegrationMethod));
658
659 // Determine DG polynomial type (same as in dgsolver.cpp)
660 const MString defaultDgPolynomialType = "DG_POLY_LEGENDRE";
661 const MInt dgPolynomialType =
662 string2enum(Context::getSolverProperty<MString>("dgPolynomialType", solverId(), AT_, &defaultDgPolynomialType));
663
664 // Convert integers to enums
665 auto polyType = static_cast<DgPolynomialType>(dgPolynomialType);
666 auto intMethod = static_cast<DgIntegrationMethod>(dgIntegrationMethod);
667
668 // Create & init interpolation objects
669 std::vector<DgInterpolation> interpolation(maxPolyDeg() + 1);
670 for(MInt i = std::max(0, minPolyDeg() - m_noCutModesLowPass); i < maxPolyDeg() + 1; i++) {
671 const MInt noNodes1D = sbpMode ? initNoNodes1D : (i + 1);
672 interpolation[i].init(i, polyType, noNodes1D, intMethod, sbpMode, sbpOperator);
673 }
674
676 // Create & store Vandermonde matrices
678
679 // Create
680 m_vdmLowPass.clear();
682
683 // Create matrices
684 for(MInt polyDeg = std::max(0, minPolyDeg() - m_noCutModesLowPass);
685 polyDeg < maxPolyDeg() + 1 - m_noCutModesLowPass;
686 polyDeg++) {
687 const MInt noNodesIn = polyDeg + 1;
688 const MInt noNodesOut = polyDeg + 1 + m_noCutModesLowPass;
689 m_vdmLowPass[polyDeg].resize(noNodesOut, noNodesIn);
690 const DgInterpolation& interpIn = interpolation[polyDeg];
691 const DgInterpolation& interpOut = interpolation[polyDeg + m_noCutModesLowPass];
693 &interpIn.m_nodes[0],
694 noNodesOut,
695 &interpOut.m_nodes[0],
696 &interpIn.m_wBary[0],
697 &m_vdmLowPass[polyDeg][0]);
698 }
699 } else {
700 m_vdmLowPass.clear();
701 }
702
703 RECORD_TIMER_STOP(m_timers[Timers::Init]);
704}
static T getSolverProperty(const MString name, const MInt solverId, const MString &nameOfCallingFunction, const T *default_value, MInt pos=0)
Definition: context.h:168
std::vector< std::vector< MInt > > m_elementDonorMap
Mapping from donor cells to elements.
std::vector< MFloat > m_filter
Local storage for source filter values.
std::vector< MFloatTensor > m_vdmLowPass
Vandermonde matrix/matrices for the low-pass filter.
void initSourceFilter()
Calculate source filter values for all elements and store element ids on which source terms need to b...
MInt noMeanVars() const
Return number of mean variables.
std::vector< MFloat > m_filterDonor
Local storage for source filter values on donor cells.
void saveFilterValues()
Save filter values to file.
void initProjection()
Initialize the projection information for spatial coupling.
void saveFilterValuesDonor()
Save the filter values on the donor cells.
virtual DonorSolverType & donorSolver(const MInt solverId=0) const =0
MBool m_saveSourceTermFilter
Store whether filter values should be written to a file at initialization.
MInt m_noDonorCells
Total number of donor cells on this domain.
MInt m_noCutModesLowPass
Number of modes to cut using the low-pass source term.
MInt m_noActiveDonorCells
MBool m_hasDonorCartesianSolver
Store whether this domain has Cartesian donor solver cells.
MBool m_hasDgCartesianSolver
Store whether this domain has DG cells/elements.
std::vector< MFloat > m_meanVars
Local storage for mean variables of the donor cells.
MInt noElements() const
Return number of elements.
Definition: coupling.h:324
MInt minPolyDeg() const
Return the minimum polynomial degree.
Definition: coupling.h:333
solverType & dgSolver() const
Return MPI communicator.
Definition: coupling.h:310
MInt solverId() const
Return solver id.
Definition: coupling.h:315
MInt maxPolyDeg() const
Return the maximum polynomial degree.
Definition: coupling.h:336
Class stores precalculated values for interpolation & integration on the reference interval [-1,...
MBool isActive() const override
MInt string2enum(MString theString)
This global function translates strings in their corresponding enum values (integer values)....
Definition: enums.cpp:20
DgPolynomialType
Definition: enums.h:310
DgIntegrationMethod
Definition: enums.h:313
MInt ipow(MInt base, MInt exp)
Integer exponent function for non-negative exponents.
Definition: functions.h:317
void calcPolynomialInterpolationMatrix(MInt noNodesIn, const T nodesIn, MInt noNodesOut, const U nodesOut, const V wBary, W vandermonde)
Calculate the polynomial interpolation matrix (Vandermonde) to interpolate from one set of nodes to a...

◆ initData()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::initData
protected

Note: not included anymore in initCoupler() since not required, e.g., during balancing.

Definition at line 710 of file couplingdgape.h.

710 {
711 TRACE();
712 RECORD_TIMER_START(m_timers[Timers::Init]);
713
714 if(dgSolver().m_restart) {
715 // Load mean vars for source term calculation at a restart
716 const MFloat time = dgSolver().time();
717 // TODO labels:COUPLER,DG,toremove @ansgar_unified is dt already set?
718 // const MFloat dt = dgSolver().m_dt;
719 // initRestart(time, dt);
720 // initRestart(time, -1.0);
721 initRestart(time, m_fixedTimeStep); // NOTE: use prescribed fixed time step
722 } else {
723 // Load DG node variables and mean vars for source term calculation
725 RECORD_TIMER_STOP(m_timers[Timers::Init]);
726
727 // Apply the initial conditions of the solver (again) to allow overwriting node variables set
728 // by the coupling
730 RECORD_TIMER_START(dgSolver().m_timers[maia::dg::Timers_::RunInit]);
731 RECORD_TIMER_START(dgSolver().m_timers[maia::dg::Timers_::InitData]);
733 RECORD_TIMER_STOP(dgSolver().m_timers[maia::dg::Timers_::InitData]);
734 RECORD_TIMER_STOP(dgSolver().m_timers[maia::dg::Timers_::RunInit]);
735 }
736
737 RECORD_TIMER_START(m_timers[Timers::Init]);
738
739 // Update node variables at surfaces in the solver and perform extension
743 }
744 }
745
746 RECORD_TIMER_STOP(m_timers[Timers::Init]);
747}
void initRestart(const MFloat time, const MFloat dt)
Perform initializations for a restart.
MFloat m_fixedTimeStep
Fixed time step to use.
void calcInitialCondition(const MFloat time)
Apply initial conditions for this coupling condition.
void extendNodeVariables()
Extends nodeVars from given planes to given directions.
MFloat time() const override
Return the time.
void updateNodeVariables()
Update all node variables at the surfaces.
virtual void initialCondition()
Set the initial condition in all elements.
double MFloat
Definition: maiatypes.h:52

◆ initProjection()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::initProjection
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-07-16

Initializes the required Galerkin projections for spatial coupling and determines all information needed to perform the Galerkin projection for all elements that have a mapping.

Definition at line 758 of file couplingdgape.h.

758 {
759 TRACE();
760
762 // Clear member variables if DG solver is not active
763 m_projection.clear();
764 m_elementDonorMap.clear();
765 m_elementDonorLevels.clear();
766 m_elementDonorPos.clear();
767 return;
768 }
769
770 // Create map from donor-cells to dg-elements
771 std::vector<std::vector<MInt>> elementGridMap(noElements());
772
773 for(MInt elementId = 0; elementId < noElements(); elementId++) {
774 const MInt cellId = elements().cellId(elementId);
775 const MInt gridCellId = dgSolver().grid().tree().solver2grid(cellId);
776
777 elementGridMap[elementId].clear();
778 // Get all leaf-cells of the donor-solver that are mapped to the global cell of the current
779 // dg-element
780 dgSolver().grid().raw().createLeafCellMapping(donorSolver().solverId(), gridCellId, elementGridMap[elementId]);
781 }
782
783 // Initialize the required Galerkin projections needed for spatial coupling
784 {
785 m_projection.clear();
786 m_projection.reserve(maxPolyDeg() + 1);
787
788 // Determine the number of refinement levels of the donor grid
789 MInt noLevels = 1;
791 noLevels = donorSolver().grid().maxLevel() - donorSolver().grid().minLevel() + 1;
792 }
793
794 m_log << "Initialize Galerkin projections for " << noLevels << " levels." << std::endl;
795
796 // Dummy projections such that m_projection can be accessed by polyDeg
797 for(MInt i = 0; i < std::max(0, minPolyDeg() - m_noCutModesLowPass); i++) {
798 m_projection.push_back(ProjectionType());
799 }
800
801 // Initialize projection for each used polynomial degree
802 for(MInt i = std::max(0, minPolyDeg() - m_noCutModesLowPass); i <= maxPolyDeg(); i++) {
803 m_log << "Initialize Galerkin projection (p = " << i << ")... ";
804 m_projection.push_back(ProjectionType(i, noLevels, dgSolver().grid().lengthLevel0(), dgSolver().solverId()));
805 m_log << "done" << std::endl;
806 }
807 }
808
812
813 // Determine information needed to apply the Galerkin projection
814 for(MInt elementId = 0; elementId < noElements(); elementId++) {
815 const MInt polyDeg = elements().polyDeg(elementId);
816
817 // Clear any previous projection information for this element
818 m_elementDonorMap[elementId].clear();
819 m_elementDonorLevels[elementId].clear();
820 m_elementDonorPos[elementId].clear();
821
822 // Check if element has mapped donor cells and skip iteration otherwise
823 if(elementGridMap[elementId].empty()) {
824 continue;
825 }
826
827 const MInt noMappedLeafCells = elementGridMap[elementId].size();
828 MIntScratchSpace donorCellLevels(noMappedLeafCells, AT_, "donorCellLevels");
829 MFloatScratchSpace donorCellCoordinates(noMappedLeafCells, nDim, AT_, "donorCellCoordinates");
830
831 // Information on target element
832 const MInt targetCellId = elements().cellId(elementId);
833 const MInt targetLevel = dgSolver().grid().tree().level(targetCellId);
834 const MFloat halfCellLength = 0.5 * dgSolver().grid().cellLengthAtLevel(targetLevel);
835 const MFloat* targetElementCenter = &dgSolver().grid().tree().coordinate(targetCellId, 0);
836
837 // Check if element is inside projection filter box (excluding filter)
839 MBool hasProjection = false;
840 for(MInt dimId = 0; dimId < nDim; dimId++) {
841 const MFloat coord = targetElementCenter[dimId];
842 if(coord + halfCellLength < m_projectionFilterBox[dimId]
843 || coord - halfCellLength > m_projectionFilterBox[nDim + dimId]) {
844 hasProjection = true;
845 break;
846 }
847 }
848 if(!hasProjection) {
849 continue;
850 }
851 }
852
853 MInt noDonorCells = 0;
854 // Loop over all mapped donor leaf-cells
855 for(MInt i = 0; i < noMappedLeafCells; i++) {
856 const MInt donorGridCellId = elementGridMap[elementId][i];
857 const MInt donorCellId = donorSolver().grid().tree().grid2solver(donorGridCellId);
858
859 if(donorCellId < 0) {
860 TERMM(1, "Error in mapped donor leaf cells.");
861 }
862
863 // Store donor cell id in element donor map
864 m_elementDonorMap[elementId].push_back(donorCellId);
865 // Store the corresponding refinement level of the donor cell
866 donorCellLevels[noDonorCells] = donorSolver().grid().tree().level(donorCellId);
867
868 // Get original cell center coordinates
869 // NOTE: For all donor cells (i.e. also for boundary and cut cells) the
870 // original cell position is needed to establish the projection
871 // information. There is no special treatment of cut cells at the
872 // moment, for now they are treated as if they were normal cells.
873 for(MInt d = 0; d < nDim; d++) {
874 donorCellCoordinates(noDonorCells, d) = donorSolver().grid().tree().coordinate(donorCellId, d);
875 }
876
877 noDonorCells++;
878 }
879
880 if(noDonorCells == 0) {
881 TERMM(1, "Donor cells for element (elementId=" + std::to_string(elementId)
882 + ") not found, but elementGridMap[elementId] "
883 "with elementGridMap[elementId].size()="
884 + std::to_string(elementGridMap[elementId].size()) + " contains mapped donor cells.");
885 }
886
887 // Allocate storage for the projection information of this element
888 m_elementDonorLevels[elementId].resize(noDonorCells);
889 m_elementDonorPos[elementId].resize(noDonorCells);
890
891 // Check for one-to-multiple mapping and continue if so (there is no projection information to
892 // compute)
893 if(noDonorCells == 1) {
894 const MInt donorCellId = m_elementDonorMap[elementId][0];
895 const MInt donorLevel = donorSolver().grid().tree().level(donorCellId);
896 if(targetLevel > donorLevel) {
897 m_elementDonorLevels[elementId][0] = donorLevel - targetLevel;
898 m_elementDonorPos[elementId][0] = -1;
899 continue;
900 }
901 }
902
903 // Compute and store the projection information for this element (this includes non-mapped
904 // volumes)
905 m_projection[polyDeg].calcProjectionInformation(noDonorCells, &donorCellLevels[0], &donorCellCoordinates[0],
906 targetLevel, targetElementCenter, m_elementDonorPos[elementId],
907 m_elementDonorLevels[elementId]);
908 }
909}
std::vector< std::vector< MInt > > m_elementDonorPos
Donor cell positions on the corresponding cell level.
DgGalerkinProjection< nDim > ProjectionType
MBool m_projectionFilter
Use spatial projection filter (i.e. exclude elements from the projection)
std::vector< std::vector< MInt > > m_elementDonorLevels
Donor cell levels relative to element.
std::vector< ProjectionType > m_projection
Galerkin projection (access by polynomial degree)
std::vector< MFloat > m_projectionFilterBox
Spatial projection filter box (excluding)
This class is a ScratchSpace.
Definition: scratch.h:758
constexpr GridProxy & grid() const
MInt & cellId(const MInt id)
Accessor for cell id.
InfoOutFile m_log
bool MBool
Definition: maiatypes.h:58
void const MInt cellId
Definition: collector.h:239

◆ initRestart()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::initRestart ( const MFloat  time,
const MFloat  dt 
)
protected
Author
Michael Schlottke-Lakemper (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Parameters
[in]timeSimulation time at time of restart.
[in]dtPrevious time step size before restart.

Definition at line 918 of file couplingdgape.h.

918 {
919 TRACE();
920
921 // Store that this is a restart
922 m_isRestart = true;
923
924 // Calculate previous time for use in Qe source term
925 m_previousTime = time - dt;
926
927 RECORD_TIMER_START(m_timers[Timers::InitialCondition]);
928 // Only load mean data for source term calculation since node variables are already read from the
929 // nodevars-file
930 loadMeanQuantities(true);
931 RECORD_TIMER_STOP(m_timers[Timers::InitialCondition]);
932}
MBool m_isRestart
Store whether this is a restart (in case special treatment is necessary)
MFloat m_previousTime
Previous time for the calculation of time derivatives.

◆ initSourceFilter()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::initSourceFilter
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-07-04

Definition at line 940 of file couplingdgape.h.

940 {
941 TRACE();
942
943 // Make sure that the element list is empty
944 m_calcSourceElements.clear();
945
947 m_filter.clear();
948 m_elementInsideBody.clear();
949 return;
950 }
951
952 const MInt filterOffset = m_maxNoNodesXD;
953
954 // Temporary storage before permanent allocation with exact size
955 MBoolScratchSpace hasNonZeroFilter(noElements(), AT_, "hasNonZeroFilter");
956 std::fill(hasNonZeroFilter.begin(), hasNonZeroFilter.end(), false);
957
958 // Reset inside body marker for all elements
960 std::fill(m_elementInsideBody.begin(), m_elementInsideBody.end(), 0);
961
962 MInt noInsideElements = 0;
963
964 for(MInt elementId = 0; elementId < noElements(); elementId++) {
965 const MInt noNodes1D = elements().polyDeg(elementId) + 1;
966 const MInt noNodesXD = ipow(noNodes1D, nDim);
967
968 // Pointer to coordinates of source term
969 const MFloat* const coordinates = &elements().nodeCoordinates(elementId);
970
971 // Pointer to filter values of current element
972 MFloat* const elementFilter = &m_filter[elementId * filterOffset];
973
974 // Calculate filter values for all node coordinates of the element
975 m_sourceTermFilter.filter(coordinates, noNodesXD, elementFilter);
976
977 // Set filter values to zero if element is excluded via projection filter box
978 // @ansgar_mb TODO labels:COUPLER,DG make this a function?
980 MBool hasProjection = false;
981 for(MInt dimId = 0; dimId < nDim; dimId++) {
982 const MFloat coord = coordinates[dimId];
983 if(coord < m_projectionFilterBox[dimId] || coord > m_projectionFilterBox[nDim + dimId]) {
984 hasProjection = true;
985 break;
986 }
987 }
988 if(!hasProjection) {
989 std::fill_n(elementFilter, noNodesXD, 0.0);
990 }
991 }
992
993 // Check if any filter value is nonzero (above epsilon), i.e. source terms need to be
994 // computed for this element
995 hasNonZeroFilter[elementId] =
996 std::any_of(elementFilter, elementFilter + noNodesXD, [](MFloat filter) { return filter > MFloatEps; });
997
998 // @ansgar TODO labels:COUPLER fix this, what about geometries that are not inside the source region -> mean
999 // vars (see loadMeanQuantities)?
1000 if(hasNonZeroFilter[elementId] && m_elementDonorMap[elementId].empty()) {
1001 m_elementInsideBody[elementId] = 1;
1002
1003 // Reset filter
1004 hasNonZeroFilter[elementId] = false;
1005 std::fill_n(elementFilter, noNodesXD, 0.0);
1006
1007 noInsideElements++;
1008 std::cerr << "Element " << std::to_string(elementId)
1009 << " has nonzero filter value(s), but there are no donor "
1010 "cells mapped to this element. It will be considered to be inside the geometry."
1011 << std::endl;
1012 TERMM(1, "TODO check! (element has nonzero filter but no donor cells)");
1013 }
1014 }
1015
1016 MPI_Allreduce(MPI_IN_PLACE, &noInsideElements, 1, maia::type_traits<MInt>::mpiType(), MPI_SUM, dgSolver().mpiComm(),
1017 AT_, "MPI_IN_PLACE", "noInsideElements");
1018 if(noInsideElements > 0) {
1019 m_log << "WARNING: Number of DG elements considered to be inside the geometry: " << noInsideElements << std::endl;
1020 if(dgSolver().domainId() == 0) {
1021 std::cerr << "WARNING: Number of DG elements considered to be inside the geometry: " << noInsideElements
1022 << std::endl;
1023 }
1024 }
1025
1026 // Permanently store elements with non-zero filter
1027 const MInt noNonZeroElements = std::count(hasNonZeroFilter.begin(), hasNonZeroFilter.end(), true);
1028 m_calcSourceElements.resize(noNonZeroElements);
1029
1030 // Store element id if source terms need to be computed, i.e. there is at
1031 // least one nonzero filter value AND there are donor cells mapped to this
1032 // element.
1033 for(MInt elementId = 0, nonZeroElementId = 0; elementId < noElements(); elementId++) {
1034 if(hasNonZeroFilter[elementId]) {
1035 if(!m_elementDonorMap[elementId].empty()) {
1036 m_calcSourceElements[nonZeroElementId] = elementId;
1037 nonZeroElementId++;
1038 } else {
1039 TERMM(1, "Element " + std::to_string(elementId)
1040 + " has nonzero filter value(s), but there are no donor "
1041 "cells mapped to this element. Go fix the source term "
1042 "filter in your property file.");
1043 }
1044 }
1045 }
1046
1047 // Compute spatial filter values on donor cells
1049 for(MInt i = 0; i < m_noDonorCells; i++) {
1050 const MFloat* const coordinates = &donorSolver().a_coordinate(i, 0);
1051 MFloat* const cellFilter = &m_filterDonor[i];
1052
1053 m_sourceTermFilter.filter(coordinates, 1, cellFilter);
1054 }
1055 }
1056}
std::vector< MInt > m_elementInsideBody
Marker if elements are inside a geometric object.
MFloat & nodeCoordinates(const MInt id)
Accessor for node coordinates.
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

◆ initTimers()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::initTimers
protected
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01

Definition at line 1063 of file couplingdgape.h.

1063 {
1064 TRACE();
1065
1066 // Create timer group & timer for solver, and start the timer
1067 NEW_TIMER_GROUP_NOCREATE(m_timers[Timers::TimerGroup],
1068 "CouplingDgApe (solverId = " + std::to_string(solverId()) + ")");
1069 NEW_TIMER_NOCREATE(m_timers[Timers::Class], "total object lifetime", m_timers[Timers::TimerGroup]);
1070 RECORD_TIMER_START(m_timers[Timers::Class]);
1071
1072 // Create & start constructor timer
1073 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::Constructor], "Constructor", m_timers[Timers::Class]);
1074 RECORD_TIMER_START(m_timers[Timers::Constructor]);
1075
1076 // Create regular solver-wide timers
1077 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::Init], "init", m_timers[Timers::Class]);
1078 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::InitialCondition], "calcInitialCondition", m_timers[Timers::Class]);
1079 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::LoadMeanQuantities], "loadMeanQuantities",
1081
1082 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::PreCouple], "PreCouple", m_timers[Timers::Class]);
1083 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::StoreSources], "storeSources", m_timers[Timers::PreCouple]);
1084 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::LoadInstantaneous], "loadInstantaneousQuantities",
1086
1087 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::CalcSources], "calcSources", m_timers[Timers::StoreSources]);
1088 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::CalcSourceLamb], "calcSourceLamb", m_timers[Timers::CalcSources]);
1089 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::CalcSourceQmII], "calcSourceQmII", m_timers[Timers::CalcSources]);
1090 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::CalcSourceQmIII], "calcSourceQmIII", m_timers[Timers::CalcSources]);
1091 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::CalcSourceQe], "calcSourceQe", m_timers[Timers::CalcSources]);
1092 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::CalcSourceQc], "calcSourceQc", m_timers[Timers::CalcSources]);
1093
1094 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::ProjectSourceTerms], "projectSourceTerms", m_timers[Timers::StoreSources]);
1095 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::ApplyStoredSources], "applyStoredSources", m_timers[Timers::PreCouple]);
1096
1097 // Create accumulated timers that monitor selected subsystems
1098 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::Accumulated], "selected accumulated timers", m_timers[Timers::Class]);
1099 NEW_SUB_TIMER_NOCREATE(m_timers[Timers::LoadCouplingData], "loadCouplingData", m_timers[Timers::Accumulated]);
1100}

◆ loadCouplingData()

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::loadCouplingData ( const MString filename,
const MString name_,
const MInt  stride,
MFloat data 
)
protected
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01
Parameters
[in]filenameFile name to open.
[in]name_Attribute 'name' of variable to read.
[in]strideStore data with given stride.
[out]dataPointer to memory where read data should be stored.

Definition at line 1113 of file couplingdgape.h.

1116 {
1117 TRACE();
1118 RECORD_TIMER_START(m_timers[Timers::Accumulated]);
1119 RECORD_TIMER_START(m_timers[Timers::LoadCouplingData]);
1120
1121 using namespace maia::parallel_io;
1122 ParallelIo file(filename, PIO_READ, dgSolver().grid().raw().mpiComm());
1123
1124 MString datasetName;
1125 MString variableName;
1126 MBool foundVariable = false;
1127 // Get the names of all datasets in the file
1128 std::vector<MString> datasets = file.getDatasetNames();
1129 // Loop over all datasets and check if it has the right 'name' attribute
1130 for(auto&& dataset : datasets) {
1131 if(file.hasAttribute("name", dataset)) {
1132 file.getAttribute(&variableName, "name", dataset);
1133 if(variableName == name_) {
1134 datasetName = dataset;
1135 foundVariable = true;
1136 break;
1137 }
1138 }
1139 }
1140 // Read if variable was found in file
1141 if(foundVariable) {
1142 ParallelIo::size_type count = 0;
1143 ParallelIo::size_type start = 0;
1144
1146 count = donorSolver().noInternalCells();
1147 start = donorSolver().domainOffset(donorSolver().domainId());
1148 }
1149
1150 file.setOffset(count, start);
1151 file.readArray(data, datasetName, stride);
1152
1153 const MInt noInternalCells = donorSolver().noInternalCells();
1154 performUnitConversion(variableName, noInternalCells, stride, data);
1155 }
1156
1157 RECORD_TIMER_STOP(m_timers[Timers::LoadCouplingData]);
1158 RECORD_TIMER_STOP(m_timers[Timers::Accumulated]);
1159 return foundVariable;
1160}
virtual void performUnitConversion(const MString &, const MInt, const MInt, MFloat *)
PARALLELIO_DEFAULT_BACKEND ParallelIo
Definition: parallelio.h:292

◆ loadMeanQuantities()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::loadMeanQuantities ( const MBool  skipNodeVars = false)
protected
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-01

Definition at line 1167 of file couplingdgape.h.

1167 {
1168 TRACE();
1169 RECORD_TIMER_START(m_timers[Timers::LoadMeanQuantities]);
1170
1171 // Get the default node variables for regions without LES
1172 std::array<MFloat, SysEqn::noNodeVars()> defaultNodeVars;
1173 sysEqn().getDefaultNodeVars(&defaultNodeVars[0]);
1174
1175 // Get the default node variables for regions inside a LES geometry
1176 std::array<MFloat, SysEqn::noNodeVars()> defaultNodeVarsBody;
1177 sysEqn().getDefaultNodeVarsBody(&defaultNodeVarsBody[0]);
1178
1179 // Skip loading of the mean file (e.g. when doing a scaling and there is no useful mean file to be loaded)
1180 MBool skipLoadMeanFile = false;
1181 skipLoadMeanFile = Context::getSolverProperty<MBool>("skipLoadMeanFile", solverId(), AT_, &skipLoadMeanFile);
1182
1183 // Load mean data for node variables, apply the projection and store results
1184 // in nodeVars
1185 if(!skipNodeVars && !skipLoadMeanFile) {
1186 m_log << "Coupling condition: loading node vars from mean file." << std::endl;
1187 MFloatScratchSpace data(std::max(m_noDonorCells, 1), SysEqn::noNodeVars(), AT_, "data");
1188 // Load mean velocity data (data is stored with stride SysEqn::noNodeVars())
1189 std::vector<MInt> undefinedNodeVarIds; // nodeVarNames that are not available in mean file
1190 for(MInt varId = 0; varId < SysEqn::noNodeVars(); varId++) {
1191 if(!loadCouplingData(m_meanDataFileName, MV::nodeVarNames[varId], SysEqn::noNodeVars(), &data(0, varId))) {
1192 // Variable name was not found in mean file
1193 undefinedNodeVarIds.push_back(varId);
1194 }
1195 }
1196
1197 // Sanity check whether all data is available
1198 if(!undefinedNodeVarIds.empty()) {
1199 std::stringstream ss;
1200 ss << "Warning: Following dataset/s with attribute 'name' have not been found in file '" << m_meanDataFileName
1201 << "': ";
1202 for(MInt i : undefinedNodeVarIds) {
1203 ss << MV::nodeVarNames[i] << ", ";
1204 }
1205 ss << std::endl << "Those dataset/s have to be specified by the initial condition.";
1206 // Note: Here is only a warning called, since it might make sense not
1207 // providing some of the data through the mean file. For example the speed
1208 // of sound is not provided by the LB solver but set by the initial
1209 // condition as constant.
1210 // TERMM(1, ss.str());
1211 m_log << ss.str() << std::endl;
1212 }
1213
1214 // Disable low-pass filter for node vars
1215 const MBool previousLowPassFilterState = m_useLowPassFilter;
1216 m_useLowPassFilter = false;
1217
1218#ifdef _OPENMP
1219#pragma omp parallel for
1220#endif
1221 // Project data to elements and store in nodeVars
1222 for(MInt elementId = 0; elementId < noElements(); elementId++) {
1223 const MInt noDonorCells = m_elementDonorMap[elementId].size();
1224 const MInt noNonMappedCells = m_elementDonorPos[elementId].size() - noDonorCells;
1225
1226 // FIXME labels:COUPLER @ansgar this is not correct for a general case where there are bodies
1227 // in the donor-solver that are located outside the source region as DG-elements inside these
1228 // objects are not identified to be inside a body!
1229 if((m_elementInsideBody[elementId] == 0) && noNonMappedCells == 0) {
1230 projectToElement(elementId, SysEqn::noNodeVars(), &data[0], &defaultNodeVars[0],
1231 &elements().nodeVars(elementId));
1232 } else {
1233 projectToElement(elementId, SysEqn::noNodeVars(), &data[0], &defaultNodeVarsBody[0],
1234 &elements().nodeVars(elementId));
1235 }
1236 }
1237
1238 // Enable low-pass filter again after interpolation of node vars
1239 m_useLowPassFilter = previousLowPassFilterState;
1240 } else {
1241 m_log << "Coupling condition: skipped loading node vars from mean file." << std::endl;
1242 }
1243
1244 // Load mean data for source term calculation on donor grid
1245 if(!skipLoadMeanFile) {
1246 MFloatScratchSpace meanVars(std::max(m_noDonorCells, 1), noMeanVars(), AT_, "meanVars");
1247 m_log << "Coupling condition noMeanVars: " << noMeanVars() << std::endl;
1248 // Load mean variables data (stored with stride noMeanVars() in meanVars)
1249 std::vector<MInt> undefinedMeanVarIds; // meanVarNames that are not available in mean file
1250 for(MInt varId = 0; varId < noMeanVars(); varId++) {
1251 m_log << "Load coupling data: " << varId << " " << MV::names[m_activeMeanVars[varId]] << std::endl;
1252 if(!loadCouplingData(m_meanDataFileName, MV::names[m_activeMeanVars[varId]], noMeanVars(), &meanVars[varId])) {
1253 // Variable name was not found in mean file
1254 undefinedMeanVarIds.push_back(varId);
1255 }
1256 }
1257
1258 // Sanity check whether all data is available
1259 if(!undefinedMeanVarIds.empty()) {
1260 std::stringstream ss;
1261 ss << "Warning: Following dataset/s with attribute 'name' have not been found in file '" << m_meanDataFileName
1262 << "': ";
1263 for(MInt i : undefinedMeanVarIds) {
1264 ss << MV::names[m_activeMeanVars[i]] << ", ";
1265 }
1266 ss << std::endl;
1267 TERMM(1, ss.str());
1268 }
1269
1270 // Store the mean variables data of all donor leaf cells that are mapped to
1271 // elements that need to calculate coupling source terms in m_meanVars
1272 for(MInt donorIndex = 0; donorIndex < m_noActiveDonorCells; donorIndex++) {
1273 const MInt donorId = m_calcSourceDonorCells[donorIndex];
1274 std::copy_n(&meanVars(donorId, 0), noMeanVars(), &m_meanVars[donorIndex * noMeanVars()]);
1275 }
1276 } else {
1277 m_log << "Coupling condition: skip loading mean vars, set to zero instead." << std::endl;
1278 std::fill(m_meanVars.begin(), m_meanVars.end(), 0.0);
1279 }
1280
1281 RECORD_TIMER_STOP(m_timers[Timers::LoadMeanQuantities]);
1282}
void projectToElement(const MInt elementId, const MInt noVars, const MFloat *data, const MFloat *defaultValues, MFloat *target)
Project the given data fields onto a single element.
std::vector< MInt > m_activeMeanVars
List of active mean variables for all active source terms.
MBool loadCouplingData(const MString &filename, const MString &name_, const MInt stride, MFloat *data)
Auxiliary method to load coupling data (i.e. anything coming from the LES) from a file.
MString m_meanDataFileName
File name for mean quantities.
MBool m_useLowPassFilter
Switch low pass on and off to allow disabling e.g. for node vars.
DgSysEqnAcousticPerturb< nDim > & sysEqn()
Return reference to SysEqn object.
Definition: coupling.h:318

◆ neededMeanVarsForSourceTerm()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::neededMeanVarsForSourceTerm ( const MInt  sourceTerm,
std::vector< MInt > &  meanVars 
) const
private
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-07-30
Parameters
[in]sourceTermThe id of the requestest source term.
[out]meanVarsVector of needed mean variable ids.

Definition at line 1978 of file couplingdgape.h.

1979 {
1980 TRACE();
1981
1982 meanVars.clear();
1983 switch(sourceTerm) {
1984 case ST::Q_mI:
1985 // Mean Lamb vector
1986 for(MInt i = 0; i < nDim; i++) {
1987 meanVars.push_back(MV::LAMB0[i]);
1988 }
1989 break;
1990 case ST::Q_mI_linear:
1991 // Mean velocities
1992 for(MInt i = 0; i < nDim; i++) {
1993 meanVars.push_back(MV::UU0[i]);
1994 }
1995 // Mean vorticities
1996 for(MInt i = 0; i < noVorticities(); i++) {
1997 meanVars.push_back(MV::VORT0[i]);
1998 }
1999 break;
2000 case ST::Q_mII:
2001 // Mean density and pressure
2002 meanVars.push_back(MV::RHO0);
2003 meanVars.push_back(MV::P0);
2004 // Mean gradient of rho
2005 for(MInt i = 0; i < nDim; i++) {
2006 meanVars.push_back(MV::DRHO[i]);
2007 }
2008 // Mean gradient of p
2009 for(MInt i = 0; i < nDim; i++) {
2010 meanVars.push_back(MV::DP[i]);
2011 }
2012 // Mean of (gradient of p divided by rho)
2013 for(MInt i = 0; i < nDim; i++) {
2014 meanVars.push_back(MV::GRADPRHO[i]);
2015 }
2016 break;
2017 case ST::Q_mIII:
2018 // Mean velocities
2019 for(MInt i = 0; i < nDim; i++) {
2020 meanVars.push_back(MV::UU0[i]);
2021 }
2022 // Mean velocity gradients
2023 for(MInt i = 0; i < nDim * nDim; i++) {
2024 meanVars.push_back(MV::GRADU[i]);
2025 }
2026 // Sum of products of velocity components with corresponding velocity gradients
2027 for(MInt i = 0; i < nDim; i++) {
2028 meanVars.push_back(MV::UGRADU[i]);
2029 }
2030 break;
2031 case ST::Q_e:
2032 meanVars.push_back(MV::RHO0);
2033 meanVars.push_back(MV::P0);
2034 meanVars.push_back(MV::C0);
2035 // Mean velocities
2036 for(MInt i = 0; i < nDim; i++) {
2037 meanVars.push_back(MV::UU0[i]);
2038 }
2039 // Mean gradient of c
2040 for(MInt i = 0; i < nDim; i++) {
2041 meanVars.push_back(MV::DC0[i]);
2042 }
2043 // Components of divergence of u
2044 for(MInt i = 0; i < nDim; i++) {
2045 meanVars.push_back(MV::DU[i]);
2046 }
2047 // Mean gradient of rho
2048 for(MInt i = 0; i < nDim; i++) {
2049 meanVars.push_back(MV::DRHO[i]);
2050 }
2051 // Mean gradient of p
2052 for(MInt i = 0; i < nDim; i++) {
2053 meanVars.push_back(MV::DP[i]);
2054 }
2055 break;
2056 case ST::Q_c:
2057 // Mean density, pressure, and speed of sound
2058 meanVars.push_back(MV::RHO0);
2059 meanVars.push_back(MV::P0);
2060 meanVars.push_back(MV::C0);
2061 // Mean velocities
2062 for(MInt i = 0; i < nDim; i++) {
2063 meanVars.push_back(MV::UU0[i]);
2064 }
2065 // Components of divergence of u
2066 for(MInt i = 0; i < nDim; i++) {
2067 meanVars.push_back(MV::DU[i]);
2068 }
2069 // Mean gradient of rho
2070 for(MInt i = 0; i < nDim; i++) {
2071 meanVars.push_back(MV::DRHO[i]);
2072 }
2073 // Mean gradient of rho*div(u)
2074 for(MInt i = 0; i < nDim; i++) {
2075 meanVars.push_back(MV::RHODIVU[i]);
2076 }
2077 // Mean gradient of u*grad(rho)
2078 for(MInt i = 0; i < nDim; i++) {
2079 meanVars.push_back(MV::UGRADRHO[i]);
2080 }
2081 break;
2082 default:
2083 TERMM(1, "Source term '" + s_sourceTermNames[sourceTerm] + "' not implemented yet.");
2084 break;
2085 }
2086}
static const std::array< MString, ST::totalNoSourceTerms > s_sourceTermNames
Hold indices for source terms.
static constexpr MInt noVorticities()
Return number of vorticity variables.
static constexpr const MInt Q_mII
static constexpr const MInt Q_mI
static constexpr const MInt Q_e
static constexpr const MInt Q_c
static constexpr const MInt Q_mI_linear
static constexpr const MInt Q_mIII

◆ noCouplingTimers()

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::noCouplingTimers ( const MBool  allTimings) const
inlineoverride

Definition at line 293 of file couplingdgape.h.

293 {
294#ifdef MAIA_TIMER_FUNCTION
295 if(allTimings) {
296 return 7;
297 } else {
298 return 4;
299 }
300#else
301 return 2;
302#endif
303 };

◆ noMeanVars()

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::noMeanVars ( ) const
inline

Definition at line 308 of file couplingdgape.h.

◆ noVelocities()

template<MInt nDim, class CouplingDonor >
static constexpr MInt CouplingDgApe< nDim, CouplingDonor >::noVelocities ( )
inlinestaticconstexpr

Definition at line 306 of file couplingdgape.h.

◆ noVorticities()

template<MInt nDim, class CouplingDonor >
static constexpr MInt CouplingDgApe< nDim, CouplingDonor >::noVorticities ( )
inlinestaticconstexpr

Definition at line 307 of file couplingdgape.h.

◆ performUnitConversion()

template<MInt nDim, class CouplingDonor >
virtual void CouplingDgApe< nDim, CouplingDonor >::performUnitConversion ( const MString ,
const  MInt,
const  MInt,
MFloat  
)
inlineprotectedvirtual

Reimplemented in LbDgApe< nDim, nDist, SysEqn >.

Definition at line 331 of file couplingdgape.h.

332 {};

◆ postCouple()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::postCouple ( MInt  )
inlinefinaloverridevirtual

Implements Coupling.

Definition at line 258 of file couplingdgape.h.

258{};

◆ preCouple()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::preCouple ( MInt  )
finalvirtual

Implements Coupling.

Definition at line 519 of file couplingdgape.h.

519 {
520 TRACE();
521 RECORD_TIMER_START(m_timers[Timers::PreCouple]);
522
523 const MInt timeStep = (m_hasDgCartesianSolver) ? dgSolver().getCurrentTimeStep() : -1;
524 const MFloat time = (m_hasDgCartesianSolver) ? dgSolver().time() : -1.0;
525
526 if(m_hasDgCartesianSolver && timeStep == m_previousTimeStep) {
527 TERMM(1, "Error: preCouple already called for this time step.");
528 }
529
530 // Calculate source terms
531 storeSources(time, timeStep);
532 // Add stored source terms to the external source buffer of the DG solver
533 applyStoredSources(time);
534 // Update time step
535 m_previousTimeStep = timeStep;
536
537 RECORD_TIMER_STOP(m_timers[Timers::PreCouple]);
538}
MInt m_previousTimeStep
Previous time step (to determine whether new sources need to be calculated)
void applyStoredSources(const MFloat time)
Apply the stored source terms to the time derivative.
void storeSources(const MFloat time, const MInt timeStep)
Load coupling data from LES, then calculate, accumulate, project and store coupling source terms.
MInt getCurrentTimeStep() const override

◆ projectToElement()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::projectToElement ( const MInt  elementId,
const MInt  noVars,
const MFloat data,
const MFloat defaultValues,
MFloat target 
)
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-07-16
Parameters
[in]elementIdThe id of the element to perform the projection onto.
[in]noVarNumber of variables to project.
[in]dataDonor field(s).
[in]defaultValuesDefault values to use if there is no donor cell.
[out]targetTarget field containing the projected variables.

The variables in data need to be stored as: [u1, v1, w1, u2, v2, w2, ...]

Definition at line 1297 of file couplingdgape.h.

1298 {
1299 TRACE();
1300 const MInt polyDeg = elements().polyDeg(elementId);
1301 const MInt noNodesXD = ipow(polyDeg + 1, nDim);
1302 const MInt noDonorCells = m_elementDonorMap[elementId].size();
1303 // Number of non-mapped cells/volumes
1304 const MInt noNonMappedCells = m_elementDonorPos[elementId].size() - noDonorCells;
1305
1306 // Check if more than one donor cell
1307 if(noDonorCells > 1) {
1308 // Apply the Galerkin projection
1310 m_projection[polyDeg].apply(noDonorCells, noNonMappedCells, &m_elementDonorMap[elementId][0],
1311 &m_elementDonorLevels[elementId][0], &m_elementDonorPos[elementId][0], &data[0],
1312 defaultValues, noVars, target);
1313 } else {
1314 MFloatScratchSpace tmp(noNodesXD * noVars, AT_, "tmp");
1315 m_projection[polyDeg - m_noCutModesLowPass].apply(
1316 noDonorCells, noNonMappedCells, &m_elementDonorMap[elementId][0], &m_elementDonorLevels[elementId][0],
1317 &m_elementDonorPos[elementId][0], &data[0], defaultValues, noVars, &tmp[0]);
1318 maia::dg::interpolation::interpolateNodes<nDim>(&tmp[0],
1319 &m_vdmLowPass[polyDeg - m_noCutModesLowPass][0],
1320 polyDeg + 1 - m_noCutModesLowPass,
1321 polyDeg + 1,
1322 noVars,
1323 target);
1324 }
1325
1327 if(noNonMappedCells > 0) {
1328 TERMM(1, "Fix conservation/projection error comp. for the case with non-mapped cells");
1329 }
1330
1331 const MInt cellId = elements().cellId(elementId);
1332 const MFloat targetLength = dgSolver().grid().cellLengthAtCell(cellId);
1333 MFloatScratchSpace errors(noVars, AT_, "errors");
1334
1335 // Check if the projection is conservative
1337 m_projection[polyDeg].calcConservationError(noDonorCells, &m_elementDonorMap[elementId][0],
1338 &m_elementDonorLevels[elementId][0], &data[0], noVars, targetLength,
1339 target, &errors[0]);
1340
1341 const MFloat maxError = *(std::max_element(errors.begin(), errors.end()));
1342 m_maxConservationError = std::max(m_maxConservationError, maxError);
1343 }
1344
1345 // Calculate the projection error
1347 m_projection[polyDeg].calcL2Error(noDonorCells, &m_elementDonorMap[elementId][0],
1348 &m_elementDonorLevels[elementId][0], &m_elementDonorPos[elementId][0],
1349 &data[0], noVars, targetLength, target, &errors[0]);
1350
1351 // Calculate maximum error
1352 const MFloat maxError = *(std::max_element(errors.begin(), errors.end()));
1353 m_maxL2Error = std::max(m_maxL2Error, maxError);
1354 }
1355 }
1356 } else if(noDonorCells == 1) {
1357 // One-to-one mapping
1358 MFloatTensor targetF(target, noNodesXD, noVars);
1359
1360 // Store donor cell variables in all element nodes
1361 const MInt donorCellId = m_elementDonorMap[elementId][0];
1362 const MInt offset = donorCellId * noVars;
1363 for(MInt i = 0; i < noNodesXD; i++) {
1364 for(MInt v = 0; v < noVars; v++) {
1365 targetF(i, v) = data[offset + v];
1366 }
1367 }
1368 } else {
1369 // No mapped cell: use default value(s)
1370 MFloatTensor targetF(target, noNodesXD, noVars);
1371 for(MInt i = 0; i < noNodesXD; i++) {
1372 for(MInt v = 0; v < noVars; v++) {
1373 targetF(i, v) = defaultValues[v];
1374 }
1375 }
1376 }
1377}
MBool m_checkConservation
Check if each Galerkin projection is conservative.
MBool m_calcProjectionError
Calculate the L2 error of the Galerkin projection.
MFloat m_maxL2Error
Maximum computed L2 error of the Galerkin projection.
MFloat m_maxConservationError
Maximum conservation error.

◆ readProperties()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::readProperties ( )
finaloverrideprotectedvirtual
Author
Michael Schlottke (mic) mic@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2015-10-02

Implements Coupling.

◆ saveFilterValues()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::saveFilterValues
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-12-03

Definition at line 1384 of file couplingdgape.h.

1384 {
1385 TRACE();
1386
1387 m_log << "Saving file with filter values ... ";
1388
1390 return;
1391 }
1392
1393 const std::vector<MString> filterVarName{"sourcefilter:" + m_sourceTermFilter.name()};
1394 saveNodalData("sourcefilter", 1, filterVarName, &m_filter[0]);
1395
1396 m_log << "done" << std::endl;
1397}
void saveNodalData(const MString &fileNameBase, const MInt noVars, const std::vector< MString > &varNames, const MFloat *const data) const
Save nodal data to file.
Definition: coupling.h:342

◆ saveFilterValuesDonor()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::saveFilterValuesDonor
protected

Definition at line 1401 of file couplingdgape.h.

1401 {
1402 TRACE();
1403 m_log << "Saving file with filter values on donor cells... ";
1404
1406 return;
1407 }
1408
1409 std::stringstream fileName;
1410 fileName << donorSolver().outputDir() << "sourcefilterDonor" << ParallelIo::fileExt();
1411
1412 using namespace maia::parallel_io;
1413 ParallelIo parallelIo(fileName.str(), PIO_REPLACE, donorSolver().mpiComm());
1414
1415 const MInt localNoCells = m_noDonorCells;
1416 // Determine offset and global number of cells
1417 ParallelIo::size_type offset = 0;
1418 ParallelIo::size_type globalNoCells = 0;
1419 parallelIo.calcOffset(localNoCells, &offset, &globalNoCells, donorSolver().mpiComm());
1420
1421 // Set attributes
1422 parallelIo.setAttribute(globalNoCells, "noCells");
1423 parallelIo.setAttribute(donorSolver().grid().gridInputFileName(), "gridFile");
1424 parallelIo.setAttribute(donorSolver().solverId(), "solverId");
1425
1426 const MString name_ = "sourcefilter:" + m_sourceTermFilter.name();
1427 parallelIo.defineArray(PIO_FLOAT, name_, globalNoCells);
1428 parallelIo.setOffset(localNoCells, offset);
1429 parallelIo.writeArray(&m_filterDonor[0], name_);
1430
1431 m_log << "done" << std::endl;
1432}

◆ saveSourceTermsDonorGrid()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::saveSourceTermsDonorGrid ( const MInt  timeStep,
const MFloat *const  data 
)
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-12-03
Parameters
[in]timeStepCurrent time step.
[in]dataPointer to source term data on donor grid.

Definition at line 1634 of file couplingdgape.h.

1634 {
1635 TRACE();
1636 CHECK_TIMERS_IO();
1637
1639 return;
1640 }
1641
1642 const MInt noVariables = SysEqn::noVars();
1643
1644 std::stringstream fileName;
1645 fileName << donorSolver().outputDir() << "sourceTermsDonorGrid_" << std::setw(8) << std::setfill('0') << timeStep
1646 << ParallelIo::fileExt();
1647
1648 // Define source term names
1649 std::vector<MString> sourceTermNames(noVariables);
1650 if constexpr(nDim == 2) {
1651 sourceTermNames = std::vector<MString>{"source_u", "source_v", "source_p"};
1652 } else {
1653 sourceTermNames = std::vector<MString>{"source_u", "source_v", "source_w", "source_p"};
1654 }
1655
1656 // Create data out object to save data to disk
1657 using namespace maia::parallel_io;
1658 ParallelIo parallelIo(fileName.str(), PIO_REPLACE, donorSolver().mpiComm());
1659
1660 const MInt localNoCells = m_noDonorCells;
1661 // Determine offset and global number of cells
1662 ParallelIo::size_type offset = 0;
1663 ParallelIo::size_type globalNoCells = 0;
1664 parallelIo.calcOffset(localNoCells, &offset, &globalNoCells, donorSolver().mpiComm());
1665
1666 // Set attributes
1667 parallelIo.setAttribute(globalNoCells, "noCells");
1668 parallelIo.setAttribute(donorSolver().grid().gridInputFileName(), "gridFile");
1669 parallelIo.setAttribute(donorSolver().solverId(), "solverId");
1670
1671 // Define arrays in file
1672 for(MInt i = 0; i < noVariables; i++) {
1673 const MString name_ = "variables" + std::to_string(i);
1674 parallelIo.defineArray(PIO_FLOAT, name_, globalNoCells);
1675 parallelIo.setAttribute(sourceTermNames[i], "name", name_);
1676 }
1677
1678 parallelIo.setOffset(localNoCells, offset);
1679
1680 // Write source term data to file
1681 for(MInt i = 0; i < noVariables; i++) {
1682 const MString name_ = "variables" + std::to_string(i);
1683 parallelIo.writeArray(&data[i], name_, noVariables);
1684 }
1685}

◆ saveSourceTermsTargetGrid()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::saveSourceTermsTargetGrid ( const MInt  timeStep)
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-12-03
Parameters
[in]timeStepCurrent time step.

Definition at line 1694 of file couplingdgape.h.

1694 {
1695 TRACE();
1696 CHECK_TIMERS_IO();
1697
1698 const MInt noVariables = SysEqn::noVars();
1699 const MInt dataSize = m_maxNoNodesXD * noVariables;
1700
1701 // Buffer for source terms on all elements to write to file
1702 ScratchSpace<MFloat> sourceTerms(noElements(), dataSize, AT_, "sourceTerms");
1703
1704 // Copy source terms to buffer
1705 const MInt noSourceElements = m_calcSourceElements.size();
1706 for(MInt eId = 0; eId < noSourceElements; eId++) {
1707 const MInt elementId = m_calcSourceElements[eId];
1708 const MInt noNodesXD = ipow(elements().polyDeg(elementId) + 1, nDim);
1709
1710 // Set source and destination pointers
1711 MFloat* const dest = &sourceTerms[elementId * dataSize];
1712 const MFloat* const src = &m_sourceTerms[eId * dataSize];
1713
1714 // Copy all source terms of this element
1715 std::copy_n(src, noNodesXD * noVariables, dest);
1716 }
1717
1718 std::stringstream fileNameBase;
1719 fileNameBase << "sourceTerms_" << std::setw(8) << std::setfill('0') << timeStep;
1720
1721 // Define source term names
1722 std::vector<MString> sourceTermNames(noVariables);
1723 if constexpr(nDim == 2) {
1724 sourceTermNames = std::vector<MString>{"source_u", "source_v", "source_p"};
1725 } else {
1726 sourceTermNames = std::vector<MString>{"source_u", "source_v", "source_w", "source_p"};
1727 }
1728
1729 // Save source terms to file
1730 saveNodalData(fileNameBase.str(), noVariables, sourceTermNames, &sourceTerms[0]);
1731}

◆ startLoadTimer()

template<MInt nDim, class CouplingDonor >
void Coupling::startLoadTimer ( const MString name) const
inline

Definition at line 148 of file coupling.h.

148 {
150 }
MInt m_dlbTimerId
Definition: coupling.h:166
void startLoadTimer(const MInt dlbTimerId, const MString &name)
Start the load timer for the given DLB timer id.
Definition: dlbtimer.h:334
DlbTimerController g_dlbTimerController

◆ stopLoadTimer()

template<MInt nDim, class CouplingDonor >
void Coupling::stopLoadTimer ( const MString name) const
inline

Definition at line 152 of file coupling.h.

152 {
154 }
void stopLoadTimer(const MInt dlbTimerId, const MString &name)
Stop the load timer for the given DLB timer id.
Definition: dlbtimer.h:355

◆ storeSources()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::storeSources ( const MFloat  time,
const MInt  timeStep 
)
protected
Author
Ansgar Niemoeller (ansgar) a.nie.nosp@m.moel.nosp@m.ler@a.nosp@m.ia.r.nosp@m.wth-a.nosp@m.ache.nosp@m.n.de
Date
2016-08-18
Parameters
[in]timeCurrent simulation time.
[in]timeStepCurrent simulation time step.

The purpose of this method is to calculate the sources only once per time step, and not once per Runge-Kutta step.

Definition at line 1492 of file couplingdgape.h.

1492 {
1493 TRACE();
1494 RECORD_TIMER_START(m_timers[Timers::StoreSources]);
1495
1496 // Storage for velocities and vorticities of the donor cells
1497 MFloatScratchSpace velocity(std::max(m_noDonorCells, 1), noVelocities(), AT_, "velocity");
1498 MFloatScratchSpace vorticity(std::max(m_noDonorCells, 1), noVorticities(), AT_, "vorticity");
1499
1500 // Load all needed coupling data here
1501 // NOTE: for now (Q_mI and Q_mI_linear) the velocities and the vorticities are
1502 // needed for both source terms so there is no check yet which variables are
1503 // actually needed, but this will change in the future.
1504 RECORD_TIMER_START(m_timers[Timers::LoadInstantaneous]);
1506 RECORD_TIMER_STOP(m_timers[Timers::LoadInstantaneous]);
1507
1508 // Source terms on donor cells (i.e. all source terms summed up)
1509 MFloatScratchSpace sourceTerms(std::max(m_noDonorCells, 1), SysEqn::noVars(), AT_, "sourceTerms");
1510 std::fill(sourceTerms.begin(), sourceTerms.end(), 0.0);
1511
1512 RECORD_TIMER_START(m_timers[Timers::CalcSources]);
1513 // Compute all source terms and accumulate to get the total source terms
1514 for(auto&& sourceTerm : m_activeSourceTerms) {
1515 switch(sourceTerm) {
1516 case ST::Q_mI:
1517 // Perturbed Lamb vector
1518 calcSourceLambNonlinear(&velocity[0], &vorticity[0], &sourceTerms(0, 0));
1519 break;
1520 case ST::Q_mI_linear:
1521 // Linearized Lamb vector
1522 calcSourceLambLinearized(&velocity[0], &vorticity[0], &sourceTerms(0, 0));
1523 break;
1524 case ST::Q_mII:
1525 // Pressure linearization
1526 calcSourceQmII(&velocity[0], &sourceTerms(0, 0));
1527 break;
1528 case ST::Q_mIII:
1529 calcSourceQmIII(&velocity[0], &sourceTerms(0, 0));
1530 break;
1531 case ST::Q_e:
1532 // Perturbed energy
1533 calcSourceQe(&velocity[0], time, &sourceTerms(0, 0));
1534 break;
1535 case ST::Q_c:
1536 calcSourceQc(&velocity[0], &sourceTerms(0, 0), time, timeStep);
1537 break;
1538 default:
1539 TERMM(1, "Source term '" + s_sourceTermNames[sourceTerm] + "' not implemented.");
1540 break;
1541 }
1542 }
1543 RECORD_TIMER_STOP(m_timers[Timers::CalcSources]);
1544
1545 // Set flag to indicate that the source terms have already been calculated at least once
1547
1548 // Store source terms on donor grid
1550 stopLoadTimer(AT_);
1552
1553 saveSourceTermsDonorGrid(timeStep, &sourceTerms[0]);
1554
1556 startLoadTimer(AT_);
1557 }
1558
1559 // TODO labels:COUPLER save filtered or unfiltered sources on donor grid?
1561 // Apply spatial filter to source terms on donor cells
1562 const MInt noVars = SysEqn::noVars();
1563 for(MInt i = 0; i < m_noDonorCells; i++) {
1564 const MFloat filter = m_filterDonor[i];
1565 for(MInt j = 0; j < noVars; j++) {
1566 sourceTerms[i * noVars + j] *= filter;
1567 }
1568 }
1569 }
1570
1571 // Default source terms (NaN): only needed for the call to projectToElement()
1572 // but this should never be used/needed as an element without mapped LES cells
1573 // should not do anything here.
1574 /* const MFloat nan_value = std::numeric_limits<MFloat>::quiet_NaN(); */
1575 /* const std::array<MFloat, MAX_SPACE_DIMENSIONS + 1> defaultSourceTerms = { */
1576 /* {nan_value, nan_value, nan_value, nan_value}}; */
1577 // Note: changed to 0 since non-mapped cells can now appear in the projection information that
1578 // will use these values
1579 const std::array<MFloat, MAX_SPACE_DIMENSIONS + 1> defaultSourceTerms = {{0.0, 0.0, 0.0, 0.0}};
1580
1581 // Project accumulated source terms on elements and apply the spatial filter
1582 RECORD_TIMER_START(m_timers[Timers::ProjectSourceTerms]);
1583 const MInt noSourceElements = m_calcSourceElements.size();
1584 const MInt sourceOffset = m_maxNoNodesXD * SysEqn::noVars();
1585
1586 maia::parallelFor(0, noSourceElements, [&](MInt elementIndex) {
1587 const MInt elementId = m_calcSourceElements[elementIndex];
1588 const MInt noNodes1D = elements().polyDeg(elementId) + 1;
1589 const MInt noNodesXD = ipow(noNodes1D, nDim);
1590 const MInt elementOffset = elementIndex * sourceOffset;
1591
1592 MFloatTensor elementSourceTerms(&m_sourceTerms[elementOffset], noNodesXD, SysEqn::noVars());
1593 MFloatTensor filter(&m_filter[elementId * m_maxNoNodesXD], noNodesXD);
1594
1595 // Project source terms on element
1596 projectToElement(elementId, SysEqn::noVars(), &sourceTerms[0], &defaultSourceTerms[0], &elementSourceTerms[0]);
1597
1598 // Apply spatial filter on element (if not already applied on donor cells)
1600 for(MInt i = 0; i < noNodesXD; i++) {
1601 for(MInt v = 0; v < SysEqn::noVars(); v++) {
1602 elementSourceTerms(i, v) *= filter(i);
1603 }
1604 }
1605 }
1606 });
1607 RECORD_TIMER_STOP(m_timers[Timers::ProjectSourceTerms]);
1608
1609 // Store previous time for calculating dp/dt in the Qe source term
1610 m_previousTime = time;
1611
1612 // Store source terms on target grid
1613 if(m_saveSourceTermsInterval > 0 && timeStep % m_saveSourceTermsInterval == 0) {
1614 stopLoadTimer(AT_);
1616
1617 saveSourceTermsTargetGrid(timeStep);
1618
1620 startLoadTimer(AT_);
1621 }
1622
1623 RECORD_TIMER_STOP(m_timers[Timers::StoreSources]);
1624}
static constexpr MInt noVelocities()
Return number of velocity variables.
virtual void calcSourceLambLinearized(const MFloat *const velocity, const MFloat *const vorticity, MFloat *sourceTerms)=0
void saveSourceTermsDonorGrid(const MInt timeStep, const MFloat *const data)
Store the source terms on the donor grid.
MBool m_isFirstSourceCalculation
Store whether this is the first calculation of the source terms.
void saveSourceTermsTargetGrid(const MInt timeStep)
Store the source terms on the target grid, i.e. after interpolation.
virtual void calcSourceQmIII(const MFloat *const velocity, MFloat *sourceTerms)=0
virtual void calcSourceQe(const MFloat *const velocity, const MFloat time, MFloat *const sourceTerms)=0
virtual void calcSourceQc(const MFloat *const velocity, MFloat *const sourceTerms, const MFloat time, const MInt timeStep)=0
MBool m_applySourceFilterDonor
Apply source filter on donor cells or on DG elements after projection.
MInt m_saveSourceTermsInterval
Interval at which source term data should be saved to disk.
virtual void getDonorVelocityAndVorticity(const std::vector< MInt > &donorCellIds, MFloatScratchSpace &p_velocity, MFloatScratchSpace &p_vorticity)=0
virtual void calcSourceQmII(const MFloat *const velocity, MFloat *const sourceTerms)=0
void stopLoadTimer(const MString &name) const
Stop the load timer of the coupler.
Definition: coupling.h:152
void startLoadTimer(const MString &name) const
Start the load timer of the coupler.
Definition: coupling.h:148
std::vector< MInt > m_activeSourceTerms
List of active source terms.
MBool m_saveSourceTermsDonorGrid
Store whether the sources on the donor grid should be saved as well.
virtual void calcSourceLambNonlinear(const MFloat *const velocity, const MFloat *const vorticity, MFloat *const sourceTerms)=0
void enableAllDlbTimers(const MBool *const wasEnabled=nullptr)
Enable all DLB timers (or those given by the array wasEnabled)
Definition: dlbtimer.h:265
void disableAllDlbTimers(MBool *const wasEnabled=nullptr)
Disable all (enabled) DLB timers.
Definition: dlbtimer.h:300

◆ subCouple()

template<MInt nDim, class CouplingDonor >
void CouplingDgApe< nDim, CouplingDonor >::subCouple ( MInt  ,
MInt  ,
std::vector< MBool > &   
)
inlinefinaloverridevirtual

Implements Coupling.

Definition at line 257 of file couplingdgape.h.

257{};

Member Data Documentation

◆ m_activeMeanVars

template<MInt nDim, class CouplingDonor >
std::vector<MInt> CouplingDgApe< nDim, CouplingDonor >::m_activeMeanVars {}
protected

Definition at line 369 of file couplingdgape.h.

◆ m_activeSourceTerms

template<MInt nDim, class CouplingDonor >
std::vector<MInt> CouplingDgApe< nDim, CouplingDonor >::m_activeSourceTerms {}
protected

Definition at line 371 of file couplingdgape.h.

◆ m_applySourceFilterDonor

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_applySourceFilterDonor = false
protected

Definition at line 413 of file couplingdgape.h.

◆ m_calcProjectionError

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_calcProjectionError = false
protected

Definition at line 374 of file couplingdgape.h.

◆ m_calcSourceDonorCells

template<MInt nDim, class CouplingDonor >
std::vector<MInt> CouplingDgApe< nDim, CouplingDonor >::m_calcSourceDonorCells {}
protected

Definition at line 390 of file couplingdgape.h.

◆ m_calcSourceElements

template<MInt nDim, class CouplingDonor >
std::vector<MInt> CouplingDgApe< nDim, CouplingDonor >::m_calcSourceElements {}
protected

Definition at line 391 of file couplingdgape.h.

◆ m_checkConservation

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_checkConservation = false
protected

Definition at line 395 of file couplingdgape.h.

◆ m_elementDonorLevels

template<MInt nDim, class CouplingDonor >
std::vector<std::vector<MInt> > CouplingDgApe< nDim, CouplingDonor >::m_elementDonorLevels = {}
protected

Definition at line 380 of file couplingdgape.h.

◆ m_elementDonorMap

template<MInt nDim, class CouplingDonor >
std::vector<std::vector<MInt> > CouplingDgApe< nDim, CouplingDonor >::m_elementDonorMap = {}
protected

Definition at line 381 of file couplingdgape.h.

◆ m_elementDonorPos

template<MInt nDim, class CouplingDonor >
std::vector<std::vector<MInt> > CouplingDgApe< nDim, CouplingDonor >::m_elementDonorPos = {}
protected

Definition at line 382 of file couplingdgape.h.

◆ m_elementInsideBody

template<MInt nDim, class CouplingDonor >
std::vector<MInt> CouplingDgApe< nDim, CouplingDonor >::m_elementInsideBody {}
protected

Definition at line 403 of file couplingdgape.h.

◆ m_filter

template<MInt nDim, class CouplingDonor >
std::vector<MFloat> CouplingDgApe< nDim, CouplingDonor >::m_filter {}
protected

Definition at line 408 of file couplingdgape.h.

◆ m_filterDonor

template<MInt nDim, class CouplingDonor >
std::vector<MFloat> CouplingDgApe< nDim, CouplingDonor >::m_filterDonor {}
protected

Definition at line 409 of file couplingdgape.h.

◆ m_fixedTimeStep

template<MInt nDim, class CouplingDonor >
MFloat CouplingDgApe< nDim, CouplingDonor >::m_fixedTimeStep = -1.0
protected

Definition at line 364 of file couplingdgape.h.

◆ m_hasDgCartesianSolver

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_hasDgCartesianSolver = false
protected

Definition at line 357 of file couplingdgape.h.

◆ m_hasDonorCartesianSolver

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_hasDonorCartesianSolver = false
protected

Definition at line 358 of file couplingdgape.h.

◆ m_isFirstSourceCalculation

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_isFirstSourceCalculation = true
protected

Definition at line 388 of file couplingdgape.h.

◆ m_isRestart

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_isRestart = false
protected

Definition at line 356 of file couplingdgape.h.

◆ m_maxConservationError

template<MInt nDim, class CouplingDonor >
MFloat CouplingDgApe< nDim, CouplingDonor >::m_maxConservationError = -1.0
protected

Definition at line 396 of file couplingdgape.h.

◆ m_maxL2Error

template<MInt nDim, class CouplingDonor >
MFloat CouplingDgApe< nDim, CouplingDonor >::m_maxL2Error = -1.0
protected

Definition at line 397 of file couplingdgape.h.

◆ m_maxNoNodesXD

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::m_maxNoNodesXD = -1
protected

Definition at line 360 of file couplingdgape.h.

◆ m_meanDataFileName

template<MInt nDim, class CouplingDonor >
MString CouplingDgApe< nDim, CouplingDonor >::m_meanDataFileName {}
protected

Definition at line 370 of file couplingdgape.h.

◆ m_meanVars

template<MInt nDim, class CouplingDonor >
std::vector<MFloat> CouplingDgApe< nDim, CouplingDonor >::m_meanVars {}
protected

Definition at line 400 of file couplingdgape.h.

◆ m_meanVarsIndex

template<MInt nDim, class CouplingDonor >
std::array<MInt, s_totalNoMeanVars> CouplingDgApe< nDim, CouplingDonor >::m_meanVarsIndex {}
protected

Definition at line 426 of file couplingdgape.h.

◆ m_noActiveDonorCells

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::m_noActiveDonorCells = -1
protected

Number of 'active' donor cells, i.e. those donor leaf cells on which source terms need to be computed

Definition at line 377 of file couplingdgape.h.

◆ m_noCutModesLowPass

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::m_noCutModesLowPass = 0
protected

Definition at line 410 of file couplingdgape.h.

◆ m_noDonorCells

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::m_noDonorCells = -1
protected

Definition at line 379 of file couplingdgape.h.

◆ m_previousTime

template<MInt nDim, class CouplingDonor >
MFloat CouplingDgApe< nDim, CouplingDonor >::m_previousTime
protected
Initial value:
=
std::numeric_limits<MFloat>::quiet_NaN()

Definition at line 365 of file couplingdgape.h.

◆ m_previousTimeStep

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::m_previousTimeStep = -1
protected

Definition at line 367 of file couplingdgape.h.

◆ m_projection

template<MInt nDim, class CouplingDonor >
std::vector<ProjectionType> CouplingDgApe< nDim, CouplingDonor >::m_projection {}
protected

Definition at line 385 of file couplingdgape.h.

◆ m_projectionFilter

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_projectionFilter = false
protected

Definition at line 416 of file couplingdgape.h.

◆ m_projectionFilterBox

template<MInt nDim, class CouplingDonor >
std::vector<MFloat> CouplingDgApe< nDim, CouplingDonor >::m_projectionFilterBox {}
protected

Definition at line 417 of file couplingdgape.h.

◆ m_saveSourceTermFilter

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_saveSourceTermFilter = false
protected

Definition at line 414 of file couplingdgape.h.

◆ m_saveSourceTermsDonorGrid

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_saveSourceTermsDonorGrid = false
protected

Definition at line 372 of file couplingdgape.h.

◆ m_saveSourceTermsInterval

template<MInt nDim, class CouplingDonor >
MInt CouplingDgApe< nDim, CouplingDonor >::m_saveSourceTermsInterval = -1
protected

Definition at line 373 of file couplingdgape.h.

◆ m_sourceFactor

template<MInt nDim, class CouplingDonor >
MFloat CouplingDgApe< nDim, CouplingDonor >::m_sourceFactor = 1.0
protected

Definition at line 392 of file couplingdgape.h.

◆ m_sourceTermFilter

template<MInt nDim, class CouplingDonor >
Filter<nDim> CouplingDgApe< nDim, CouplingDonor >::m_sourceTermFilter
protected

Definition at line 407 of file couplingdgape.h.

◆ m_sourceTerms

template<MInt nDim, class CouplingDonor >
std::vector<MFloat> CouplingDgApe< nDim, CouplingDonor >::m_sourceTerms {}
protected

Definition at line 389 of file couplingdgape.h.

◆ m_timers

template<MInt nDim, class CouplingDonor >
std::array<MInt, Timers::_count> CouplingDgApe< nDim, CouplingDonor >::m_timers
protected

Definition at line 464 of file couplingdgape.h.

◆ m_useLowPassFilter

template<MInt nDim, class CouplingDonor >
MBool CouplingDgApe< nDim, CouplingDonor >::m_useLowPassFilter = false
protected

Definition at line 411 of file couplingdgape.h.

◆ m_vdmLowPass

template<MInt nDim, class CouplingDonor >
std::vector<MFloatTensor> CouplingDgApe< nDim, CouplingDonor >::m_vdmLowPass {}
protected

Definition at line 412 of file couplingdgape.h.

◆ s_sourceTermNames

template<MInt nDim, class CouplingDonor >
const std::array< MString, CouplingDgApe< nDim, CouplingDonor >::ST::totalNoSourceTerms > CouplingDgApe< nDim, CouplingDonor >::s_sourceTermNames
staticprotected
Initial value:
= {
{"q_mI", "q_mI_linear", "q_mII", "q_mIII", "q_mIV", "q_c", "q_e"}}

Source term names corresponding to ST

Definition at line 430 of file couplingdgape.h.

◆ s_totalNoMeanVars

template<MInt nDim, class CouplingDonor >
const MInt CouplingDgApe< nDim, CouplingDonor >::s_totalNoMeanVars = MV::totalNoMeanVars
staticprotected

Definition at line 422 of file couplingdgape.h.


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