MAIA bb96820c
Multiphysics at AIA
|
Intermediate class for coupling DG solver with APE sysEqn. More...
#include <couplingdgape.h>
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 |
solverType & | dgSolver () const |
Return MPI communicator. More... | |
MInt | solverId () const |
Return solver id. More... | |
DgSysEqnAcousticPerturb< nDim > & | sysEqn () |
Return reference to SysEqn object. More... | |
ElementCollector & | elements () |
Return reference to elements. More... | |
MInt | noElements () const |
Return number of elements. More... | |
MFloat * | externalSource () 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 | |
Coupling & | operator= (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 DonorSolverType & | donorSolver (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< MInt > | m_activeMeanVars {} |
List of active mean variables for all active source terms. More... | |
MString | m_meanDataFileName {} |
File name for mean quantities. More... | |
std::vector< MInt > | m_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< ProjectionType > | m_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< MFloat > | m_sourceTerms {} |
Local storage for source terms. More... | |
std::vector< MInt > | m_calcSourceDonorCells {} |
List of all donor cell ids for which source terms need to be computed. More... | |
std::vector< MInt > | m_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< MFloat > | m_meanVars {} |
Local storage for mean variables of the donor cells. More... | |
std::vector< MInt > | m_elementInsideBody {} |
Marker if elements are inside a geometric object. More... | |
Filter< nDim > | m_sourceTermFilter |
Auxiliary object that handles source filtering. More... | |
std::vector< MFloat > | m_filter {} |
Local storage for source filter values. More... | |
std::vector< MFloat > | m_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< MFloatTensor > | m_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< MFloat > | m_projectionFilterBox {} |
Spatial projection filter box (excluding) More... | |
std::array< MInt, s_totalNoMeanVars > | m_meanVarsIndex {} |
std::array< MInt, Timers::_count > | m_timers |
Protected Attributes inherited from CouplingDg< nDim, DgSysEqnAcousticPerturb< nDim > > | |
solverType * | m_dgSolver |
Static Protected Attributes | |
static const MInt | s_totalNoMeanVars = MV::totalNoMeanVars |
static const std::array< MString, ST::totalNoSourceTerms > | s_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 > > |
Definition at line 214 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::Base = Coupling |
Definition at line 217 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::BaseDg = CouplingDg<nDim, DgSysEqnAcousticPerturb<nDim> > |
Definition at line 226 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::BaseDonor = CouplingDonor |
Definition at line 221 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::DgCartesianSolverType = typename BaseDg::solverType |
Definition at line 227 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::DonorSolverType = typename BaseDonor::solverType |
Definition at line 222 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::MV = MeanVariables<nDim> |
Definition at line 241 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::ProjectionType = DgGalerkinProjection<nDim> |
Definition at line 225 of file couplingdgape.h.
using CouplingDgApe< nDim, CouplingDonor >::SysEqn = DgSysEqnAcousticPerturb<nDim> |
Definition at line 224 of file couplingdgape.h.
CouplingDgApe< nDim, CouplingDonor >::CouplingDgApe | ( | const MInt | couplingId, |
DgCartesianSolverType * | dg, | ||
DonorSolverType * | ds | ||
) |
[in] | solver_ | A reference to the DG solver in which this coupling class is used. |
Definition at line 500 of file couplingdgape.h.
|
virtualdefault |
|
protected |
Definition at line 1439 of file couplingdgape.h.
|
protected |
[in] | time | Current simulation time for time-dependent ICs |
Definition at line 549 of file couplingdgape.h.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
inlinefinaloverrideprotectedvirtual |
|
inlinefinaloverridevirtual |
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
inlinefinaloverridevirtual |
|
inlineoverride |
Definition at line 261 of file couplingdgape.h.
|
inlinefinaloverride |
Definition at line 284 of file couplingdgape.h.
|
protectedpure virtual |
Implemented in DgCcAcousticPerturb< nDim, FvSysEqn >, and LbDgApe< nDim, nDist, SysEqn >.
|
inlineoverridevirtual |
Implements Coupling.
Definition at line 249 of file couplingdgape.h.
|
protected |
This also allocates memory for local storage of mean variables and source terms.
Definition at line 566 of file couplingdgape.h.
|
protected |
Note: not included anymore in initCoupler() since not required, e.g., during balancing.
Definition at line 710 of file couplingdgape.h.
|
protected |
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.
|
protected |
[in] | time | Simulation time at time of restart. |
[in] | dt | Previous time step size before restart. |
Definition at line 918 of file couplingdgape.h.
|
protected |
Definition at line 940 of file couplingdgape.h.
|
protected |
Definition at line 1063 of file couplingdgape.h.
|
protected |
[in] | filename | File name to open. |
[in] | name_ | Attribute 'name' of variable to read. |
[in] | stride | Store data with given stride. |
[out] | data | Pointer to memory where read data should be stored. |
Definition at line 1113 of file couplingdgape.h.
|
protected |
Definition at line 1167 of file couplingdgape.h.
|
private |
[in] | sourceTerm | The id of the requestest source term. |
[out] | meanVars | Vector of needed mean variable ids. |
Definition at line 1978 of file couplingdgape.h.
|
inlineoverride |
Definition at line 293 of file couplingdgape.h.
|
inline |
Definition at line 308 of file couplingdgape.h.
|
inlinestaticconstexpr |
Definition at line 306 of file couplingdgape.h.
|
inlinestaticconstexpr |
Definition at line 307 of file couplingdgape.h.
|
inlineprotectedvirtual |
Reimplemented in LbDgApe< nDim, nDist, SysEqn >.
Definition at line 331 of file couplingdgape.h.
|
inlinefinaloverridevirtual |
|
finalvirtual |
Implements Coupling.
Definition at line 519 of file couplingdgape.h.
|
protected |
[in] | elementId | The id of the element to perform the projection onto. |
[in] | noVar | Number of variables to project. |
[in] | data | Donor field(s). |
[in] | defaultValues | Default values to use if there is no donor cell. |
[out] | target | Target 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.
|
finaloverrideprotectedvirtual |
Implements Coupling.
|
protected |
Definition at line 1384 of file couplingdgape.h.
|
protected |
Definition at line 1401 of file couplingdgape.h.
|
protected |
[in] | timeStep | Current time step. |
[in] | data | Pointer to source term data on donor grid. |
Definition at line 1634 of file couplingdgape.h.
|
protected |
[in] | timeStep | Current time step. |
Definition at line 1694 of file couplingdgape.h.
|
inline |
Definition at line 148 of file coupling.h.
|
inline |
Definition at line 152 of file coupling.h.
|
protected |
[in] | time | Current simulation time. |
[in] | timeStep | Current 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.
|
inlinefinaloverridevirtual |
|
protected |
Definition at line 369 of file couplingdgape.h.
|
protected |
Definition at line 371 of file couplingdgape.h.
|
protected |
Definition at line 413 of file couplingdgape.h.
|
protected |
Definition at line 374 of file couplingdgape.h.
|
protected |
Definition at line 390 of file couplingdgape.h.
|
protected |
Definition at line 391 of file couplingdgape.h.
|
protected |
Definition at line 395 of file couplingdgape.h.
|
protected |
Definition at line 380 of file couplingdgape.h.
|
protected |
Definition at line 381 of file couplingdgape.h.
|
protected |
Definition at line 382 of file couplingdgape.h.
|
protected |
Definition at line 403 of file couplingdgape.h.
|
protected |
Definition at line 408 of file couplingdgape.h.
|
protected |
Definition at line 409 of file couplingdgape.h.
|
protected |
Definition at line 364 of file couplingdgape.h.
|
protected |
Definition at line 357 of file couplingdgape.h.
|
protected |
Definition at line 358 of file couplingdgape.h.
|
protected |
Definition at line 388 of file couplingdgape.h.
|
protected |
Definition at line 356 of file couplingdgape.h.
|
protected |
Definition at line 396 of file couplingdgape.h.
|
protected |
Definition at line 397 of file couplingdgape.h.
|
protected |
Definition at line 360 of file couplingdgape.h.
|
protected |
Definition at line 370 of file couplingdgape.h.
|
protected |
Definition at line 400 of file couplingdgape.h.
|
protected |
Definition at line 426 of file couplingdgape.h.
|
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.
|
protected |
Definition at line 410 of file couplingdgape.h.
|
protected |
Definition at line 379 of file couplingdgape.h.
|
protected |
Definition at line 365 of file couplingdgape.h.
|
protected |
Definition at line 367 of file couplingdgape.h.
|
protected |
Definition at line 385 of file couplingdgape.h.
|
protected |
Definition at line 416 of file couplingdgape.h.
|
protected |
Definition at line 417 of file couplingdgape.h.
|
protected |
Definition at line 414 of file couplingdgape.h.
|
protected |
Definition at line 372 of file couplingdgape.h.
|
protected |
Definition at line 373 of file couplingdgape.h.
|
protected |
Definition at line 392 of file couplingdgape.h.
|
protected |
Definition at line 407 of file couplingdgape.h.
|
protected |
Definition at line 389 of file couplingdgape.h.
|
protected |
Definition at line 464 of file couplingdgape.h.
|
protected |
Definition at line 411 of file couplingdgape.h.
|
protected |
Definition at line 412 of file couplingdgape.h.
|
staticprotected |
Source term names corresponding to ST
Definition at line 430 of file couplingdgape.h.
|
staticprotected |
Definition at line 422 of file couplingdgape.h.