MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
Application Class Reference

Manages the initialisation of the solvers, the methods depending to the solvers and the start of the solving steps. More...

#include <application.h>

Collaboration diagram for Application:
[legend]

Public Member Functions

 Application ()
 Gets initial data from the property file and creates the solvers and methods. More...
 
 ~Application ()
 
template<MInt nDim>
void run ()
 
 Application (const Application &)=delete
 
 Application (Application &&)=delete
 
Applicationoperator= (const Application &)=delete
 
Applicationoperator= (Application &&)=delete
 

Private Member Functions

MInt gridType (const MString solverType)
 Return the type of grid for a given solver type. More...
 
MInt getInitialTimeStep (const MBool restartFile, const MPI_Comm comm)
 Return the initial global time step. More...
 
void initTimings ()
 Initialize the collection of solver/coupler timings for performance evaluations. More...
 
void collectTimingsAndSolverInformation (const MBool finalTimeStep)
 Collect the timings of all solvers and domain decomposition information. More...
 
void storeTimingsAndSolverInformation (const MBool finalTimeStep)
 Store timings for all solvers and domain decomposition information on all domains. More...
 
void cleanUp ()
 call cleanup functions in all solvers and couplers before returning from the application More...
 
template<MInt nDim>
void createSolver (CartesianGrid< nDim > *grid, const MInt solverId, Geometry< nDim > *geometry, MBool *propertiesGroup, MBool &isActive)
 This function handels the creation of new solvers. More...
 
template<MInt nDim>
void createSolver (StructuredGrid< nDim > *grid, const MInt solverId, MBool *propertiesGroups, const MPI_Comm comm)
 This function handles the creation of new structured solvers. More...
 
template<MInt nDim>
void createSolver (const MInt solverId, const MPI_Comm comm)
 Handles the creation of gridless solvers. More...
 
template<MInt nDim>
void createCoupler (MInt)
 This function handels the creation of new couplers. More...
 
template<MInt nDim>
PostProcessingInterfacecreatePostProcessing (MInt)
 This function handels the creation of the Postprocessing classes. More...
 
ExecutionRecipecreateRecipe ()
 This function handels the creation of the execution recipe. More...
 

Static Private Member Functions

static MBoolreadPropertiesGroups ()
 Reads in the properties groups. More...
 

Private Attributes

MBool m_dualTimeStepping
 
MInt m_maxIterations
 Maximum number of iterations. More...
 
MInt m_restartBackupInterval
 The number of timesteps before executing a restart-backup. More...
 
MInt m_noSolvers = -1
 The number of solvers. More...
 
std::vector< std::unique_ptr< Solver > > m_solvers
 The list of solvers. More...
 
MBool m_initialAdaptation = true
 Initial adaptation. More...
 
MInt m_noCouplers = 0
 The number of couplers. More...
 
std::vector< std::unique_ptr< Coupling > > m_couplers
 The list of couplers. More...
 
MInt m_noPostProcessing
 The number of postprocessing solvers. More...
 
MBool m_postProcessing
 
MInt m_postDataSolverId = -1
 
MBool m_displayMemoryStatistics = false
 Memory statistics controller. More...
 
MBool m_ppAfterTS = false
 post-processing in-solve position More...
 
MBool m_writeSolverTimings = false
 Solver/coupler timings for performance evaluations. More...
 
MBool m_writeAllSolverTimings = true
 Switch timings mode between ALL timings (default) and a reduced/essential timings mode. More...
 
MInt m_solverTimingsWriteInterval = -1
 Write interval for timings. More...
 
MInt m_solverTimingsSampleInterval = 1
 Sampling interval for timings. More...
 
MInt m_noGlobalSolverTimers = -1
 
const MInt m_maxNoSolverTimings = 100000
 
std::vector< std::vector< MFloat > > m_solverTimings {}
 
std::vector< MFloatm_solverTimingsPrevTime {}
 
std::vector< MIntm_solverTimingsTimeStep {}
 
std::vector< MStringm_solverTimingsNames {}
 
std::vector< std::pair< MString, MInt > > m_domainInfo {}
 

Detailed Description

Definition at line 37 of file application.h.

Constructor & Destructor Documentation

◆ Application() [1/3]

Application::Application ( )

This constructor creates a list of solvers and corresponding methods. The list entries are created according to the definitions in the property file. While the solver type is already specified here, the method type will be specified in the Methods constructor (see also methods.h). Basic application properties are also read here.

◆ ~Application()

Application::~Application ( )

Definition at line 511 of file application.cpp.

511 {
512 for(auto& coupler : m_couplers) {
513 coupler.reset();
514 }
515 m_couplers.clear();
516
517 for(auto& solver : m_solvers) {
518 solver.reset();
519 }
520 m_solvers.clear();
521}
std::vector< std::unique_ptr< Solver > > m_solvers
The list of solvers.
Definition: application.h:84
std::vector< std::unique_ptr< Coupling > > m_couplers
The list of couplers.
Definition: application.h:90

◆ Application() [2/3]

Application::Application ( const Application )
delete

◆ Application() [3/3]

Application::Application ( Application &&  )
delete

Member Function Documentation

◆ cleanUp()

void Application::cleanUp ( )
private

Definition at line 2534 of file application.cpp.

2534 {
2535 TRACE();
2536
2537 // Clean up
2538 for(MInt i = 0; i < m_noSolvers; i++) {
2539 m_solvers[i]->cleanUp();
2540 }
2541 for(auto&& coupler : m_couplers) {
2542 coupler->cleanUp();
2543 }
2544}
MInt m_noSolvers
The number of solvers.
Definition: application.h:82
int32_t MInt
Definition: maiatypes.h:62

◆ collectTimingsAndSolverInformation()

void Application::collectTimingsAndSolverInformation ( const MBool  finalTimeStep)
private

Definition at line 2346 of file application.cpp.

2346 {
2347 // Return if not enabled
2349 return;
2350 }
2351
2352 const MBool isSamplingStep = (globalTimeStep % m_solverTimingsSampleInterval == 0);
2353 const MInt noSolversAndCouplers = m_noSolvers + m_noCouplers;
2354 const MBool allTimings = m_writeAllSolverTimings;
2355
2356 if(isSamplingStep) {
2357 // Store time step
2359
2360 // TODO labels:TIMERS store domainInfo for each sampling time step/for each changed domain decomposition?
2361 // Determine domain decomposition information of each solver
2362 m_domainInfo.clear();
2363 for(MInt solverId = 0; solverId < m_noSolvers; solverId++) {
2364 m_solvers[solverId]->getDomainDecompositionInformation(m_domainInfo);
2365 }
2366 for(MInt i = 0; i < m_noCouplers; i++) {
2367 m_couplers[i]->getDomainDecompositionInformation(m_domainInfo);
2368 }
2369 }
2370
2371 // TODO labels:TIMERS if a sample interval N > 1 is given, just sample every N-th step (current status ) or
2372 // compute an average? Note: for computing an average the number of timings might not correspond
2373 // to the sample-interval
2374 MInt timerIndex = 0;
2375 for(MInt j = 0; j < noSolversAndCouplers; j++) {
2376 const MBool isSolver = (j < m_noSolvers);
2377 const MInt noTimers = (isSolver) ? m_solvers[j]->noSolverTimers(allTimings)
2378 : m_couplers[j - m_noSolvers]->noCouplingTimers(allTimings);
2379
2380 // Get timing records of solver/coupler
2381 std::vector<std::pair<MString, MFloat>> timings{};
2382 (isSolver) ? m_solvers[j]->getSolverTimings(timings, allTimings)
2383 : m_couplers[j - m_noSolvers]->getCouplingTimings(timings, allTimings);
2384
2385 if((MInt)timings.size() != noTimers) {
2386 TERMM(1, "Wrong number of solver timings returned by getSolverTimings(): is " + std::to_string(timings.size())
2387 + ", should be " + std::to_string(noTimers));
2388 }
2389
2390 for(MInt i = 0; i < noTimers; i++) {
2391 const MFloat timing = timings[i].second;
2392 const MString name = timings[i].first;
2393 // Compute time difference
2394 MFloat diff = timing - m_solverTimingsPrevTime[timerIndex];
2395
2396 if(name != m_solverTimingsNames[timerIndex]) {
2397 TERMM(1, "Timer name does not match.");
2398 }
2399
2400 // This happens if the DLB timers were reset from the gridcontroller
2401 if(diff < 0.0) {
2402 diff = timing;
2403 }
2404
2405 // Only store timing if it should be written to the timings file
2406 if(isSamplingStep) {
2407 m_solverTimings[timerIndex].push_back(diff);
2408 }
2409
2410 m_solverTimingsPrevTime[timerIndex] = timing;
2411 timerIndex++;
2412 }
2413 }
2414
2415 // Store timings if this is the final time step or a timings write time step
2416 storeTimingsAndSolverInformation(finalTimeStep);
2417}
std::vector< MInt > m_solverTimingsTimeStep
Definition: application.h:117
std::vector< MString > m_solverTimingsNames
Definition: application.h:118
MBool m_writeAllSolverTimings
Switch timings mode between ALL timings (default) and a reduced/essential timings mode.
Definition: application.h:108
std::vector< MFloat > m_solverTimingsPrevTime
Definition: application.h:116
MInt m_solverTimingsSampleInterval
Sampling interval for timings.
Definition: application.h:112
std::vector< std::vector< MFloat > > m_solverTimings
Definition: application.h:115
MInt m_noCouplers
The number of couplers.
Definition: application.h:88
void storeTimingsAndSolverInformation(const MBool finalTimeStep)
Store timings for all solvers and domain decomposition information on all domains.
std::vector< std::pair< MString, MInt > > m_domainInfo
Definition: application.h:119
MBool m_writeSolverTimings
Solver/coupler timings for performance evaluations.
Definition: application.h:106
MInt globalTimeStep
std::basic_string< char > MString
Definition: maiatypes.h:55
double MFloat
Definition: maiatypes.h:52
bool MBool
Definition: maiatypes.h:58

◆ createCoupler()

template<MInt nDim>
void Application::createCoupler ( MInt  couplerId)
private
Author
Thomas Hoesgen
Date
10/2019

Definition at line 1588 of file application.cpp.

1588 {
1589 TRACE();
1590
1591 const MString couplerType = Context::getBasicProperty<MString>("couplerType_" + std::to_string(couplerId), AT_);
1592
1593 cerr0 << "=== Create coupler #" << couplerId << " " << couplerType << std::endl;
1594
1595 // Determine which solvers the coupler is supposed to couple
1596 // TODO labels:COUPLER allow more than 2 solvers to be coupled, e.g. for multilevel
1597 MInt solverToCoupleLength = Context::propertyLength("solversToCouple_" + std::to_string(couplerId));
1598 std::vector<MInt> solversToCouple;
1599 for(MInt solver = 0; solver < solverToCoupleLength; solver++) {
1600 solversToCouple.push_back(-1);
1601 if(Context::propertyExists("solversToCouple_" + std::to_string(couplerId))) {
1602 solversToCouple[solver] =
1603 Context::getBasicProperty<MInt>("solversToCouple_" + std::to_string(couplerId), AT_, nullptr, solver);
1604 if(solversToCouple[solver] < 0 || solversToCouple[solver] >= m_noSolvers) {
1605 TERMM(1, "Invalid solver id: " + std::to_string(solversToCouple[solver]));
1606 }
1607 } else {
1608 TERMM(1, "solversToCouple_" + std::to_string(couplerId) + " has to be specified!");
1609 }
1610 }
1611
1612 // Create the coupler
1613 //
1614 switch(string2enum(couplerType)) {
1615 case COUPLER_LB_DG_APE: {
1616 const MInt nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_);
1617 switch(nDist) {
1618 case 19: {
1619 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
1620 const auto lbSolver = static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1621 const auto dgSolver =
1622 static_cast<DgCartesianSolver<3, DgSysEqnAcousticPerturb<3>>*>(m_solvers[solversToCouple[1]].get());
1623 m_couplers[couplerId] = make_unique<LbDgApe<3, 19, SysEqnLb>>(couplerId, lbSolver, dgSolver);
1624 break;
1625 }
1626 case 27: {
1627 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
1628 const auto lbSolver = static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1629 const auto dgSolver =
1630 static_cast<DgCartesianSolver<3, DgSysEqnAcousticPerturb<3>>*>(m_solvers[solversToCouple[1]].get());
1631 m_couplers[couplerId] = make_unique<LbDgApe<3, 27, SysEqnLb>>(couplerId, lbSolver, dgSolver);
1632 break;
1633 }
1634 default: {
1635 mTerm(1, "Unknown number of distributions! Only working for q19 and q27, yet.");
1636 }
1637 }
1638 break;
1639 }
1640 case COUPLER_LS_FV_MB: {
1641 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
1642 if(Context::propertyExists("fvSystemEquations", solversToCouple[1])) {
1643 fvSystemEquations =
1644 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solversToCouple[1], AT_));
1645 }
1646 switch(fvSystemEquations) {
1647 case FV_SYSEQN_RANS: {
1648 m_couplers[couplerId] =
1649 make_unique<typename LsFvMbXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>::type>(
1650 couplerId,
1651 static_cast<typename LsCartesianSolverXD<nDim>::type*>(m_solvers[solversToCouple[0]].get()),
1653 m_solvers[solversToCouple[1]].get()));
1654 break;
1655 }
1656 case FV_SYSEQN_NS:
1657 default: {
1658 m_couplers[couplerId] = make_unique<typename LsFvMbXD<nDim, FvSysEqnNS<nDim>>::type>(
1659 couplerId,
1660 static_cast<typename LsCartesianSolverXD<nDim>::type*>(m_solvers[solversToCouple[0]].get()),
1661 static_cast<FvMbCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1662 break;
1663 }
1664 }
1665
1666 break;
1667 }
1668 case COUPLER_FV_ZONAL_RTV: {
1669 MString ransMethod = "";
1670 if(Context::propertyExists("ransMethod", solversToCouple[0])) {
1671 ransMethod = Context::getSolverProperty<MString>("ransMethod", solversToCouple[0], AT_);
1672 }
1673 switch(string2enum(ransMethod)) {
1674 case RANS_SA:
1675 case RANS_SA_DV: {
1676 m_couplers[couplerId] = make_unique<FvZonalRTV<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1677 couplerId,
1679 m_solvers[solversToCouple[0]].get()),
1680 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1681 break;
1682 }
1683 case RANS_FS: {
1684 m_couplers[couplerId] = make_unique<FvZonalRTV<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>>(
1685 couplerId,
1687 m_solvers[solversToCouple[0]].get()),
1688 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1689 break;
1690 }
1691 default: {
1692 TERMM(1, "Unknown RANS model for solver " + to_string(solversToCouple[0]));
1693 }
1694 }
1695 break;
1696 }
1697 case COUPLER_FV_ZONAL_STG: {
1698 MString ransMethod = "";
1699 if(Context::propertyExists("ransMethod", solversToCouple[0])) {
1700 ransMethod = Context::getSolverProperty<MString>("ransMethod", solversToCouple[0], AT_);
1701 }
1702 switch(string2enum(ransMethod)) {
1703 case RANS_SA:
1704 case RANS_SA_DV: {
1705 m_couplers[couplerId] = make_unique<FvZonalSTG<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1706 couplerId,
1708 m_solvers[solversToCouple[0]].get()),
1709 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1710 break;
1711 }
1712 case RANS_FS: {
1713 m_couplers[couplerId] = make_unique<FvZonalSTG<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>>(
1714 couplerId,
1716 m_solvers[solversToCouple[0]].get()),
1717 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1718 break;
1719 }
1720 default: {
1721 TERMM(1, "Unknown RANS model for solver " + to_string(solversToCouple[0]));
1722 }
1723 }
1724 break;
1725 }
1726 case COUPLER_FV_MB_ZONAL: {
1727 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
1728 if(Context::propertyExists("fvSystemEquations", solversToCouple[1])) {
1729 fvSystemEquations =
1730 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solversToCouple[1], AT_));
1731 }
1732 switch(fvSystemEquations) {
1733 case FV_SYSEQN_RANS: {
1734 m_couplers[couplerId] =
1735 make_unique<CouplerFvMbZonal<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1736 couplerId,
1738 m_solvers[solversToCouple[0]].get()),
1740 m_solvers[solversToCouple[1]].get()));
1741 break;
1742 }
1743 case FV_SYSEQN_NS:
1744 default: {
1745 m_couplers[couplerId] = make_unique<CouplerFvMbZonal<nDim, FvSysEqnNS<nDim>>>(
1746 couplerId,
1747 static_cast<FvMbCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[0]].get()),
1748 static_cast<FvMbCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1749 break;
1750 }
1751 }
1752 break;
1753 }
1754
1756 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
1757 if(Context::propertyExists("fvSystemEquations", solversToCouple[1])) {
1758 fvSystemEquations =
1759 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solversToCouple[1], AT_));
1760 }
1761 switch(fvSystemEquations) {
1762 case FV_SYSEQN_RANS: {
1763 m_couplers[couplerId] =
1764 make_unique<FvCartesianInterpolation<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>,
1766 couplerId,
1768 m_solvers[solversToCouple[0]].get()),
1770 m_solvers[solversToCouple[1]].get()));
1771 break;
1772 }
1773 case FV_SYSEQN_NS:
1774 default: {
1775 m_couplers[couplerId] = make_unique<
1777 couplerId,
1779 m_solvers[solversToCouple[0]].get()),
1780 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1781 break;
1782 }
1783 }
1784 break;
1785 }
1786
1787 case COUPLER_FV_MULTILEVEL: {
1788 // Note: couple all solvers (FV) in a multilevel computation
1789 auto fvSolvers = std::vector<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>{};
1790 for(MInt s = 0; s < (MInt)solversToCouple.size(); s++) {
1791 fvSolvers.push_back(
1792 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[s]].get()));
1793 }
1794 m_couplers[couplerId] = make_unique<CouplerFvMultilevel<nDim, FvSysEqnNS<nDim>>>(couplerId, fvSolvers);
1795
1796 break;
1797 }
1798
1800 // Multilevel interpolation: use coarse grid restart and interpolate it onto the finer grid(s)/solver(s)
1801 auto fvSolvers = std::vector<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>{};
1802 for(MInt s = 0; s < (MInt)solversToCouple.size(); s++) {
1803 fvSolvers.push_back(
1804 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[s]].get()));
1805 }
1806 m_couplers[couplerId] =
1807 make_unique<CouplerFvMultilevelInterpolation<nDim, FvSysEqnNS<nDim>>>(couplerId, fvSolvers);
1808 break;
1809 }
1810
1811 case COUPLER_FV_DG_APE: {
1812 m_couplers[couplerId] = make_unique<DgCcAcousticPerturb<nDim, FvSysEqnNS<nDim>>>(
1813 couplerId,
1814 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[0]].get()),
1815 static_cast<DgCartesianSolver<nDim, DgSysEqnAcousticPerturb<nDim>>*>(m_solvers[solversToCouple[1]].get()));
1816 break;
1817 }
1818 case COUPLER_LS_LB: {
1819 MInt nDist = 27;
1820 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
1821
1822 switch(nDist) {
1823 case 9: {
1824 auto lsSolver = static_cast<typename LsCartesianSolverXD<2>::type*>(m_solvers[solversToCouple[0]].get());
1825 using SysEqnLb = lb::LbSysEqnIncompressible<2, 9>;
1826 auto lbSolver = static_cast<LbSolverDxQy<2, 9, SysEqnLb>*>(m_solvers[solversToCouple[1]].get());
1827 m_couplers[couplerId] = make_unique<LsLb<2, 9, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1828
1829 break;
1830 }
1831 case 19: {
1832 auto lsSolver = static_cast<typename LsCartesianSolverXD<3>::type*>(m_solvers[solversToCouple[0]].get());
1833 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
1834 auto lbSolver = static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[1]].get());
1835 m_couplers[couplerId] = make_unique<LsLb<3, 19, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1836
1837 break;
1838 }
1839 case 27: {
1840 auto lsSolver = static_cast<typename LsCartesianSolverXD<3>::type*>(m_solvers[solversToCouple[0]].get());
1841 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
1842 auto lbSolver = static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[1]].get());
1843 m_couplers[couplerId] = make_unique<LsLb<3, 27, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1844
1845 break;
1846 }
1847 default: {
1848 mTerm(1, "Unknown number of distributions!");
1849 }
1850 }
1851
1852 break;
1853 }
1854
1855 case COUPLER_LB_RB: {
1856 MInt nDist = 27;
1857 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_, &nDist);
1858
1859 switch(nDist) {
1860 case 9: {
1861 using SysEqnLb = lb::LbSysEqnIncompressible<2, 9>;
1862 auto lbSolver = static_cast<LbSolverDxQy<2, 9, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1863 auto rigidBodies = static_cast<RigidBodies<2>*>(m_solvers[solversToCouple[1]].get());
1864 m_couplers[couplerId] = make_unique<LbRb<2, 9, SysEqnLb>>(couplerId, lbSolver, rigidBodies);
1865
1866 break;
1867 }
1868 case 19: {
1869 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
1870 auto lbSolver = static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1871 auto rigidBodies = static_cast<RigidBodies<3>*>(m_solvers[solversToCouple[1]].get());
1872 m_couplers[couplerId] = make_unique<LbRb<3, 19, SysEqnLb>>(couplerId, lbSolver, rigidBodies);
1873
1874 break;
1875 }
1876 case 27: {
1877 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
1878 auto lbSolver = static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1879 auto rigidBodies = static_cast<RigidBodies<3>*>(m_solvers[solversToCouple[1]].get());
1880 m_couplers[couplerId] = make_unique<LbRb<3, 27, SysEqnLb>>(couplerId, lbSolver, rigidBodies);
1881
1882 break;
1883 }
1884 default: {
1885 mTerm(1, "Unknown number of distributions!");
1886 }
1887 }
1888 break;
1889 }
1890
1891 case COUPLER_LB_LPT: {
1892 MInt nDist = 27;
1893 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
1894
1895 switch(nDist) {
1896 case 9: {
1897 IF_CONSTEXPR(nDim == 3) { mTerm(1, "LPT not supported in 2D!"); }
1898 break;
1899 }
1900 case 19: {
1901 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
1902 auto lbSolver = static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1903 auto particleSolver = static_cast<LPT<3>*>(m_solvers[solversToCouple[1]].get());
1904 m_couplers[couplerId] = make_unique<LbLpt<3, 19, SysEqnLb>>(couplerId, particleSolver, lbSolver);
1905
1906 break;
1907 }
1908 case 27: {
1909 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
1910 auto lbSolver = static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
1911 auto particleSolver = static_cast<LPT<3>*>(m_solvers[solversToCouple[1]].get());
1912 m_couplers[couplerId] = make_unique<LbLpt<3, 27, SysEqnLb>>(couplerId, particleSolver, lbSolver);
1913
1914 break;
1915 }
1916 default: {
1917 mTerm(1, "Unknown number of distributions!");
1918 }
1919 }
1920 break;
1921 }
1922
1923 case COUPLER_LS_LB_SURFACE: {
1924 MInt nDist = 27;
1925 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
1926
1927 switch(nDist) {
1928 case 9: {
1929 auto lsSolver = static_cast<typename LsCartesianSolverXD<2>::type*>(m_solvers[solversToCouple[0]].get());
1930 using SysEqnLb = lb::LbSysEqnIncompressible<2, 9>;
1931 auto lbSolver = static_cast<LbSolverDxQy<2, 9, SysEqnLb>*>(m_solvers[solversToCouple[1]].get());
1932 m_couplers[couplerId] = make_unique<LsLbSurface<2, 9, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1933
1934 break;
1935 }
1936 case 19: {
1937 auto lsSolver = static_cast<typename LsCartesianSolverXD<3>::type*>(m_solvers[solversToCouple[0]].get());
1938 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
1939 auto lbSolver = static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[1]].get());
1940 m_couplers[couplerId] = make_unique<LsLbSurface<3, 19, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1941
1942 break;
1943 }
1944 case 27: {
1945 auto lsSolver = static_cast<typename LsCartesianSolverXD<3>::type*>(m_solvers[solversToCouple[0]].get());
1946 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
1947 auto lbSolver = static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[1]].get());
1948 m_couplers[couplerId] = make_unique<LsLbSurface<3, 27, SysEqnLb>>(couplerId, lsSolver, lbSolver);
1949
1950 break;
1951 }
1952 default: {
1953 mTerm(1, "Unknown number of distributions!");
1954 }
1955 }
1956
1957 break;
1958 }
1959
1960 case COUPLER_LS_FV: {
1961 auto lsSolver = static_cast<typename LsCartesianSolverXD<nDim>::type*>(m_solvers[solversToCouple[0]].get());
1962 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
1963 if(Context::propertyExists("fvSystemEquations", solversToCouple[1])) {
1964 fvSystemEquations =
1965 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solversToCouple[1], AT_));
1966 }
1967 switch(fvSystemEquations) {
1968 case FV_SYSEQN_RANS: {
1970 m_solvers[solversToCouple[1]]
1971 .get();
1972 m_couplers[couplerId] =
1973 make_unique<typename CouplingLsFvXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>::type>(
1974 couplerId, lsSolver, fvSolvers);
1975 break;
1976 }
1977 default: {
1978 auto fvSolvers = (FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*)m_solvers[solversToCouple[1]].get();
1979 m_couplers[couplerId] =
1980 make_unique<typename CouplingLsFvXD<nDim, FvSysEqnNS<nDim>>::type>(couplerId, lsSolver, fvSolvers);
1981 }
1982 }
1983
1984 break;
1985 }
1986
1988 auto lsSolverId = solversToCouple[0];
1989 auto fvSolverId = solversToCouple[1];
1990
1991 m_couplers[couplerId] = make_unique<typename LsFvCombustionXD<nDim, FvSysEqnNS<nDim>>::type>(
1992 couplerId,
1993 static_cast<typename LsCartesianSolverXD<nDim>::type*>(m_solvers[lsSolverId].get()),
1994 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[fvSolverId].get()));
1995 break;
1996 }
1997
1999 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
2000 if(Context::propertyExists("fvSystemEquations", solversToCouple[1])) {
2001 fvSystemEquations =
2002 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solversToCouple[1], AT_));
2003 }
2004 if(nDim != 3) mTerm(1, AT_, "LB-FV-Euler-Euler-Multiphase only implemented for nDim = 3");
2005
2006 switch(fvSystemEquations) {
2007 case FV_SYSEQN_RANS: {
2008 mTerm(1, AT_, "RANS not supported in combination with LB-FV-EE-Multiphase!");
2009 break;
2010 }
2011 case FV_SYSEQN_EEGAS: {
2012 MInt nDist = 27;
2013 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_, &nDist);
2014
2015 switch(nDist) {
2016 case 9: {
2017 mTerm(1, "nDist = 9 not supported with EE Multiphase!");
2018
2019 break;
2020 }
2021 case 19: {
2022 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
2023 auto lbSolver = static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
2024 auto fvSolver =
2025 static_cast<FvCartesianSolverXD<3, FvSysEqnEEGas<3>>*>(m_solvers[solversToCouple[1]].get());
2026
2027 m_couplers[couplerId] = make_unique<CouplerLbFvEEMultiphase<3, 19, SysEqnLb, FvSysEqnEEGas<3>>>(
2028 couplerId, lbSolver, fvSolver);
2029
2030 break;
2031 }
2032 case 27: {
2033 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
2034 auto lbSolver = static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[0]].get());
2035 auto fvSolver =
2036 static_cast<FvCartesianSolverXD<3, FvSysEqnEEGas<3>>*>(m_solvers[solversToCouple[1]].get());
2037
2038 m_couplers[couplerId] = make_unique<CouplerLbFvEEMultiphase<3, 27, SysEqnLb, FvSysEqnEEGas<3>>>(
2039 couplerId, lbSolver, fvSolver);
2040
2041 break;
2042 }
2043 default: {
2044 mTerm(1, "Unknown number of distributions!");
2045 }
2046 }
2047 break;
2048 }
2049 case FV_SYSEQN_NS:
2050 default: {
2051 mTerm(1, AT_, "This SysEqn is not supported in combination with LB-FV-EE-Multiphase!");
2052 break;
2053 }
2054 }
2055 break;
2056 }
2057
2058 case COUPLER_LB_LB: {
2059 MInt nDist = 27;
2060 nDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[0], AT_, &nDist);
2061 {
2062 const MInt tempNDist = Context::getSolverProperty<MInt>("noDistributions", solversToCouple[1], AT_, &nDist);
2063 if(nDist != tempNDist) mTerm(1, AT_, "Can't couple LB solvers with different noDistributions!");
2064 }
2065 switch(nDist) {
2066 case 9: {
2067 using SysEqnLb = lb::LbSysEqnIncompressible<2, 9>;
2068 std::vector<LbSolverDxQy<2, 9, SysEqnLb>*> lbSolvers;
2069 lbSolvers.push_back(static_cast<LbSolverDxQy<2, 9, SysEqnLb>*>(m_solvers[solversToCouple[0]].get()));
2070 lbSolvers.push_back(static_cast<LbSolverDxQy<2, 9, SysEqnLb>*>(m_solvers[solversToCouple[1]].get()));
2071 m_couplers[couplerId] = make_unique<CouplerLbLb<2, 9, SysEqnLb>>(couplerId, lbSolvers);
2072 break;
2073 }
2074 case 19: {
2075 using SysEqnLb = lb::LbSysEqnIncompressible<3, 19>;
2076 std::vector<LbSolverDxQy<3, 19, SysEqnLb>*> lbSolvers;
2077 lbSolvers.push_back(static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[0]].get()));
2078 lbSolvers.push_back(static_cast<LbSolverDxQy<3, 19, SysEqnLb>*>(m_solvers[solversToCouple[1]].get()));
2079 m_couplers[couplerId] = make_unique<CouplerLbLb<3, 19, SysEqnLb>>(couplerId, lbSolvers);
2080 break;
2081 }
2082 case 27: {
2083 using SysEqnLb = lb::LbSysEqnIncompressible<3, 27>;
2084 std::vector<LbSolverDxQy<3, 27, SysEqnLb>*> lbSolvers;
2085 lbSolvers.push_back(static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[0]].get()));
2086 lbSolvers.push_back(static_cast<LbSolverDxQy<3, 27, SysEqnLb>*>(m_solvers[solversToCouple[1]].get()));
2087 m_couplers[couplerId] = make_unique<CouplerLbLb<3, 27, SysEqnLb>>(couplerId, lbSolvers);
2088 break;
2089 }
2090 default: {
2091 mTerm(1, "Unknown number of distributions!");
2092 }
2093 }
2094 break;
2095 }
2096
2097 case COUPLER_FV_PARTICLE: {
2098 auto particleSolver = static_cast<LPT<nDim>*>(m_solvers[solversToCouple[1]].get());
2099 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
2100 if(Context::propertyExists("fvSystemEquations", solversToCouple[1])) {
2101 fvSystemEquations =
2102 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solversToCouple[1], AT_));
2103 }
2104 switch(fvSystemEquations) {
2105 case FV_SYSEQN_RANS: {
2107 m_solvers[solversToCouple[0]].get());
2108 if(nDim == 3) {
2109 m_couplers[couplerId] =
2110 make_unique<CouplerFvParticle<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
2111 couplerId, particleSolver, fvSolver);
2112 } else {
2113 mTerm(1, AT_, "FV Particle not supported in 2D!");
2114 }
2115 break;
2116 }
2117 case FV_SYSEQN_NS:
2118 default: {
2119 auto fvSolver =
2120 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[solversToCouple[0]].get());
2121 if(nDim == 3) {
2122 m_couplers[couplerId] =
2123 make_unique<CouplerFvParticle<nDim, FvSysEqnNS<nDim>>>(couplerId, particleSolver, fvSolver);
2124 } else {
2125 mTerm(1, AT_, "FV Particle not supported in 2D!");
2126 }
2127
2128 break;
2129 }
2130 }
2131 break;
2132 }
2133
2134 default: {
2135 TERMM(1, "Unknown coupler type '" + couplerType + "', exiting ... ");
2136 }
2137 }
2138
2139 m_log << "Created coupler #" << std::to_string(couplerId) << ": " << couplerType << " for solvers";
2140 for(MInt solver = 0; solver < 2; solver++) {
2141 m_log << " " << solversToCouple[solver];
2142 }
2143 m_log << std::endl;
2144}
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
Definition: context.cpp:538
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
Definition: context.cpp:494
Definition: lpt.h:82
This class represents all LB models.
Definition: lbsolverdxqy.h:29
MInt string2enum(MString theString)
This global function translates strings in their corresponding enum values (integer values)....
Definition: enums.cpp:20
@ COUPLER_LB_DG_APE
Definition: enums.h:407
@ COUPLER_FV_ZONAL_STG
Definition: enums.h:396
@ COUPLER_FV_ZONAL_RTV
Definition: enums.h:395
@ COUPLER_FV_MULTILEVEL_INTERPOLATION
Definition: enums.h:394
@ COUPLER_LS_FV_COMBUSTION
Definition: enums.h:392
@ COUPLER_LB_FV_EE_MULTIPHASE
Definition: enums.h:405
@ COUPLER_LS_FV
Definition: enums.h:391
@ COUPLER_LS_LB_SURFACE
Definition: enums.h:401
@ COUPLER_CARTESIAN_INTERPOLATION
Definition: enums.h:397
@ COUPLER_LB_RB
Definition: enums.h:408
@ COUPLER_LB_LB
Definition: enums.h:406
@ COUPLER_FV_DG_APE
Definition: enums.h:398
@ COUPLER_FV_PARTICLE
Definition: enums.h:399
@ COUPLER_FV_MB_ZONAL
Definition: enums.h:403
@ COUPLER_LS_FV_MB
Definition: enums.h:390
@ COUPLER_LB_LPT
Definition: enums.h:404
@ COUPLER_FV_MULTILEVEL
Definition: enums.h:393
@ COUPLER_LS_LB
Definition: enums.h:400
@ FV_SYSEQN_NS
Definition: enums.h:332
@ FV_SYSEQN_EEGAS
Definition: enums.h:332
@ FV_SYSEQN_RANS
Definition: enums.h:332
@ RANS_SA_DV
Definition: enums.h:54
@ RANS_SA
Definition: enums.h:53
@ RANS_FS
Definition: enums.h:55
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29
InfoOutFile m_log
std::ostream cerr0

◆ createPostProcessing()

template<MInt nDim>
PostProcessingInterface * Application::createPostProcessing ( MInt  postprocessingId)
private
Author
Jannik Borgelt
Date
07/2020

Definition at line 2186 of file application.cpp.

2186 {
2187 TRACE();
2188
2189 PostProcessingInterface* pp = nullptr;
2190
2191 const MString postprocessingType =
2192 Context::getBasicProperty<MString>("postProcessingType_" + std::to_string(postprocessingId), AT_);
2193
2194 // FIXME labels:PP,DOC read with _$postprocessingId and allow for multiple postProcessingSolverIds
2195 // to specify the second/third solver Ids in coupled cases!
2196 const MInt postprocessingSolverId =
2197 Context::getBasicProperty<MInt>("postProcessingSolverIds", AT_, nullptr, postprocessingId);
2198
2199 PostData<nDim>* postDataPointer = nullptr;
2200 // postprocessing for special output that does not need a PostData Solver
2201 if(m_postDataSolverId == -1) {
2202 if(globalDomainId() == 0)
2203 cerr << "\033[0;31m#### WARNING:\033[0m You are using a postprocessing routine without a PostData Solver!"
2204 << endl;
2205 m_postDataSolverId = postprocessingSolverId;
2206 } else {
2207 postDataPointer = static_cast<PostData<nDim>*>(m_solvers[m_postDataSolverId].get());
2208 }
2209
2210 // Create the PostProcessing
2211 //
2212 switch(string2enum(postprocessingType)) {
2213 case POSTPROCESSING_FV: {
2214 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
2215 if(Context::propertyExists("fvSystemEquations", postprocessingSolverId)) {
2216 fvSystemEquations =
2217 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", postprocessingSolverId, AT_));
2218 }
2219 switch(fvSystemEquations) {
2220 case FV_SYSEQN_RANS: {
2222 postprocessingId,
2223 postDataPointer,
2225 m_solvers[postprocessingSolverId].get()));
2226 break;
2227 }
2228 case FV_SYSEQN_EEGAS: {
2229 IF_CONSTEXPR(nDim == 2)
2230 mTerm(1, AT_, "FVSysEqnEEGas is not tested for 2D at all and probably does not make much sense!");
2231 else pp = new PostProcessingFv<nDim, FvSysEqnEEGas<nDim>>(
2232 postprocessingId,
2233 postDataPointer,
2234 static_cast<FvCartesianSolverXD<nDim, FvSysEqnEEGas<nDim>>*>(m_solvers[postprocessingSolverId].get()));
2235 break;
2236 }
2237 case FV_SYSEQN_NS: {
2239 postprocessingId,
2240 postDataPointer,
2241 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[postprocessingSolverId].get()));
2242 break;
2243 }
2244 case FV_SYSEQN_DETCHEM: {
2246 postprocessingId,
2247 static_cast<PostData<nDim>*>(m_solvers[m_postDataSolverId].get()),
2248 static_cast<FvCartesianSolverXD<nDim, FvSysEqnDetChem<nDim>>*>(m_solvers[postprocessingSolverId].get()));
2249 break;
2250 }
2251 default:
2252 TERMM(1, "Unsupported system of equations.");
2253 }
2254 break;
2255 }
2256 case POSTPROCESSING_DG: {
2257 const MInt dgSystemEquations =
2258 string2enum(Context::getSolverProperty<MString>("dgSystemEquations", postprocessingSolverId, AT_));
2259 switch(dgSystemEquations) {
2262 postprocessingId,
2263 postDataPointer,
2265 m_solvers[postprocessingSolverId].get()));
2266 break;
2267 }
2270 postprocessingId,
2271 postDataPointer,
2273 m_solvers[postprocessingSolverId].get()));
2274 break;
2275 }
2276 default:
2277 TERMM(1, "Unsupported system of equations.");
2278 }
2279 break;
2280 }
2281 case POSTPROCESSING_LB: {
2282 pp = new PostProcessingLb<nDim>(postprocessingId, postDataPointer,
2283 static_cast<LbSolver<nDim>*>(m_solvers[postprocessingSolverId].get()));
2284 break;
2285 }
2286 case POSTPROCESSING_FVLPT: {
2287 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
2288 if(Context::propertyExists("fvSystemEquations", postprocessingSolverId)) {
2289 fvSystemEquations =
2290 string2enum(Context::getSolverProperty<MString>("fvSystemEquations", postprocessingSolverId, AT_));
2291 }
2292 switch(fvSystemEquations) {
2293 case FV_SYSEQN_RANS: {
2294 if(nDim == 3) {
2296 postprocessingId,
2297 postDataPointer,
2299 m_solvers[postprocessingSolverId].get()),
2300 static_cast<LPT<nDim>*>(m_solvers[postprocessingSolverId + 1].get()));
2301 } else {
2302 mTerm(1, AT_, "LPT not supported in 2D!");
2303 }
2304 break;
2305 }
2306 case FV_SYSEQN_NS: {
2307 if(nDim == 3) {
2309 postprocessingId,
2310 postDataPointer,
2311 static_cast<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>*>(m_solvers[postprocessingSolverId].get()),
2312 static_cast<LPT<nDim>*>(m_solvers[postprocessingSolverId + 1].get()));
2313 } else {
2314 mTerm(1, AT_, "LPT not supported in 2D!");
2315 }
2316 break;
2317 }
2318 default:
2319 TERMM(1, "Unsupported system of equations.");
2320 }
2321 break;
2322 }
2323 case POSTPROCESSING_LBLPT: {
2324 if(nDim == 3) {
2325 pp = new PostProcessingLbLPT<nDim>(postprocessingId,
2326 postDataPointer,
2327 static_cast<LbSolver<nDim>*>(m_solvers[postprocessingSolverId].get()),
2328 static_cast<LPT<nDim>*>(m_solvers[postprocessingSolverId + 1].get()));
2329 } else {
2330 mTerm(1, AT_, "LPT not supported in 2D!");
2331 }
2332 break;
2333 }
2334 default: {
2335 TERMM(1, "Unknown postprocessing type '" + postprocessingType + "', exiting ... ");
2336 }
2337 }
2338
2339 m_log << "Created postprocessing #" << std::to_string(postprocessingId) << ": " << postprocessingType << " for solver"
2340 << " " << postprocessingSolverId << std::endl;
2341
2342 return pp;
2343}
MInt m_postDataSolverId
Definition: application.h:96
Definition: postdata.h:23
@ POSTPROCESSING_FVLPT
Definition: enums.h:417
@ POSTPROCESSING_FV
Definition: enums.h:413
@ POSTPROCESSING_LBLPT
Definition: enums.h:418
@ POSTPROCESSING_DG
Definition: enums.h:416
@ POSTPROCESSING_LB
Definition: enums.h:415
@ FV_SYSEQN_DETCHEM
Definition: enums.h:332
@ DG_SYSEQN_ACOUSTICPERTURB
Definition: enums.h:330
@ DG_SYSEQN_LINEARSCALARADV
Definition: enums.h:330
MInt globalDomainId()
Return global domain id.

◆ createRecipe()

ExecutionRecipe * Application::createRecipe ( )
private
Author
Thomas Hoesgen
Date
10/2019

Definition at line 2151 of file application.cpp.

2151 {
2152 TRACE();
2153
2154 ExecutionRecipe* recipe = nullptr;
2155
2156 const MString recipeType = Context::getBasicProperty<MString>("executionRecipe", AT_);
2157
2158 switch(string2enum(recipeType)) {
2159 case RECIPE_BASE: {
2160 recipe = new ExecutionRecipe(&m_solvers, &m_couplers);
2161 break;
2162 }
2163 case RECIPE_INTRASTEP: {
2165 break;
2166 }
2167 case RECIPE_ITERATION: {
2169 break;
2170 }
2171 default: {
2172 TERMM(1, "Unknown execution recipe '" + recipeType + "', exiting ... ");
2173 }
2174 }
2175
2176 m_log << "Created execution recipe: " << recipeType << " for " << m_noSolvers << " solvers" << std::endl;
2177
2178 return recipe;
2179}
Base recipe provides public interface to Application.
@ RECIPE_INTRASTEP
Definition: enums.h:422
@ RECIPE_BASE
Definition: enums.h:422
@ RECIPE_ITERATION
Definition: enums.h:422

◆ createSolver() [1/3]

template<MInt nDim>
void Application::createSolver ( CartesianGrid< nDim > *  grid,
const MInt  solverId,
Geometry< nDim > *  geometry,
MBool propertiesGroups,
MBool isActive 
)
private
Author
Thomas Hoesgen
Date
10/2019

Definition at line 1361 of file application.cpp.

1362 {
1363 TRACE();
1364
1365
1366 // Determine solver type from property file
1367 const MString solverType = Context::getSolverProperty<MString>("solvertype", solverId, AT_);
1368
1369 grid::Proxy<nDim>* gridProxy = nullptr;
1370 gridProxy = new grid::Proxy<nDim>(solverId, *grid, *geometry);
1371 isActive = gridProxy->isActive();
1372
1373 // Now create the specified solver
1374 switch(string2enum(solverType)) {
1375 case MAIA_LEVELSET_SOLVER: {
1376 m_solvers[solverId] = LsCartesianSolverFactory<nDim>::create(solverId, propertiesGroups, *gridProxy, *geometry,
1377 gridProxy->mpiComm());
1378 break;
1379 }
1380 case MAIA_FINITE_VOLUME: {
1381 MInt noSpecies = 0;
1382 noSpecies = Context::getSolverProperty<MInt>("noSpecies", solverId, AT_, &noSpecies);
1383 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
1384 if(Context::propertyExists("fvSystemEquations", solverId)) {
1385 fvSystemEquations = string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solverId, AT_));
1386 }
1387 MString ransMethod = "";
1388 if(Context::propertyExists("ransMethod", solverId)) {
1389 ransMethod = Context::getSolverProperty<MString>("ransMethod", solverId, AT_);
1390 }
1391 // cerr << ransMethod << endl;
1392 switch(fvSystemEquations) {
1393 case FV_SYSEQN_RANS: {
1394 switch(string2enum(ransMethod)) {
1395 case RANS_SA:
1396 case RANS_SA_DV: {
1397 m_solvers[solverId] =
1398 make_unique<FvCartesianSolverXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1399 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1400 break;
1401 }
1402 case RANS_FS: {
1403 m_solvers[solverId] =
1404 make_unique<FvCartesianSolverXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_FS>>>>(
1405 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1406 break;
1407 }
1408 case RANS_KOMEGA: {
1409 m_solvers[solverId] =
1410 make_unique<FvCartesianSolverXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_KOMEGA>>>>(
1411 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1412 break;
1413 }
1414 default: {
1415 TERMM(1, "Unknown RANS model for solver " + to_string(solverId));
1416 }
1417 }
1418 break;
1419 }
1420 case FV_SYSEQN_EEGAS: {
1421 IF_CONSTEXPR(nDim == 2)
1422 mTerm(1, AT_, "FVSysEqnEEGas is not tested for 2D at all and probably does not make much sense!");
1423 else m_solvers[solverId] = make_unique<FvCartesianSolverXD<nDim, FvSysEqnEEGas<nDim>>>(
1424 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1425 break;
1426 }
1427 case FV_SYSEQN_NS: {
1428 m_solvers[solverId] = make_unique<FvCartesianSolverXD<nDim, FvSysEqnNS<nDim>>>(
1429 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1430 break;
1431 }
1432 case FV_SYSEQN_DETCHEM: {
1433 m_solvers[solverId] = make_unique<FvCartesianSolverXD<nDim, FvSysEqnDetChem<nDim>>>(
1434 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1435 break;
1436 }
1437 default:
1438 TERMM(1, "Unsupported system of equations.");
1439 }
1440 break;
1441 }
1442 case MAIA_FV_APE: {
1443 // TODO labels:FV switch to FV-solver with fvSystemEquations=APE?
1444 m_solvers[solverId] = make_unique<typename FvApeSolverXD<nDim>::type>(solverId, 0, propertiesGroups, *gridProxy,
1445 *geometry, gridProxy->mpiComm());
1446 break;
1447 }
1448 case MAIA_FV_MB: {
1449 MInt noSpecies = 0;
1450 noSpecies = Context::getSolverProperty<MInt>("noSpecies", solverId, AT_, &noSpecies);
1451 MInt fvSystemEquations = string2enum("FV_SYSEQN_NS");
1452 if(Context::propertyExists("fvSystemEquations", solverId)) {
1453 fvSystemEquations = string2enum(Context::getSolverProperty<MString>("fvSystemEquations", solverId, AT_));
1454 }
1455 switch(fvSystemEquations) {
1456 case FV_SYSEQN_RANS: {
1457 m_solvers[solverId] =
1458 make_unique<FvMbCartesianSolverXD<nDim, FvSysEqnRANS<nDim, RANSModelConstants<RANS_SA_DV>>>>(
1459 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1460 break;
1461 }
1462 case FV_SYSEQN_NS: {
1463 m_solvers[solverId] = make_unique<FvMbCartesianSolverXD<nDim, FvSysEqnNS<nDim>>>(
1464 solverId, noSpecies, propertiesGroups, *gridProxy, *geometry, gridProxy->mpiComm());
1465 break;
1466 }
1467 default:
1468 TERMM(1, "Unsupported system of equations.");
1469 }
1470 break;
1471 }
1473 const MInt dgSystemEquations =
1474 string2enum(Context::getSolverProperty<MString>("dgSystemEquations", solverId, AT_));
1475 switch(dgSystemEquations) {
1477 m_solvers[solverId] = make_unique<DgCartesianSolver<nDim, DgSysEqnAcousticPerturb<nDim>>>(
1478 solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1479 break;
1480 }
1482 m_solvers[solverId] = make_unique<DgCartesianSolver<nDim, DgSysEqnLinearScalarAdv<nDim>>>(
1483 solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1484 break;
1485 }
1486 default:
1487 TERMM(1, "Unsupported system of equations.");
1488 }
1489 break;
1490 }
1492 m_solvers[solverId] =
1493 maia::lb::LbSolverFactory<nDim>::create(solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1494 break;
1495 }
1496 case MAIA_FINITE_CELL: {
1497 m_solvers[solverId] = make_unique<FcSolver<nDim>>(solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1498 break;
1499 }
1500 case MAIA_PARTICLE: {
1501 IF_CONSTEXPR(nDim == 3) {
1502 m_solvers[solverId] = make_unique<LPT<nDim>>(solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1503 }
1504 else {
1505 TERMM(-1, "LPT not currently supported in 2D");
1506 }
1507 break;
1508 }
1509 case MAIA_RIGID_BODIES: {
1510 m_solvers[solverId] = make_unique<RigidBodies<nDim>>(solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1511 break;
1512 }
1513 case MAIA_POST_DATA: {
1514 m_solvers[solverId] = make_unique<PostData<nDim>>(solverId, *gridProxy, *geometry, gridProxy->mpiComm());
1515 if(m_postDataSolverId != -1) TERMM(1, "Currently not more than 1 PostData possible!");
1516 m_postDataSolverId = solverId;
1517 break;
1518 }
1519 default: {
1520 TERMM(1, "Unknown solver type '" + solverType + "', exiting ... ");
1521 }
1522 }
1523
1524 m_log << "Created solver #" << std::to_string(solverId) << ": " << solverType
1525 << m_solvers[solverId]->getIdentifier(false, " with alias: ", "") << std::endl;
1526}
MPI_Comm mpiComm() const
Definition: geometry.h:45
static std::unique_ptr< LsCartesianSolver< nDim > > create(MInt solverId_, const MBool *propertiesGroups, GridProxy &gridProxy_, Geometry< nDim > &geometry_, const MPI_Comm comm)
Factory method for LsCartesianSolver.
MPI_Comm mpiComm() const
MBool isActive() const
Return whether the solver is active on the current domain.
static std::unique_ptr< Solver > create(const MInt solverId, maia::grid::Proxy< nDim > &gridProxy, Geometry< nDim > &geometry, const MPI_Comm comm)
@ RANS_KOMEGA
Definition: enums.h:56
@ MAIA_FINITE_VOLUME
Definition: enums.h:23
@ MAIA_FINITE_CELL
Definition: enums.h:36
@ MAIA_DISCONTINUOUS_GALERKIN
Definition: enums.h:37
@ MAIA_RIGID_BODIES
Definition: enums.h:44
@ MAIA_FV_APE
Definition: enums.h:24
@ MAIA_FV_MB
Definition: enums.h:27
@ MAIA_LATTICE_BOLTZMANN
Definition: enums.h:35
@ MAIA_LEVELSET_SOLVER
Definition: enums.h:31
@ MAIA_POST_DATA
Definition: enums.h:45
@ MAIA_PARTICLE
Definition: enums.h:42

◆ createSolver() [2/3]

template<MInt nDim>
void Application::createSolver ( const MInt  solverId,
const MPI_Comm  comm 
)
private

Definition at line 1562 of file application.cpp.

1562 {
1563 TRACE();
1564
1565 // Determine solver type from property file
1566 const MString solverType = Context::getSolverProperty<MString>("solvertype", solverId, AT_);
1567
1568 switch(string2enum(solverType)) {
1569 case MAIA_ACOUSTIC_ANALOGY: {
1570 m_solvers[solverId] = make_unique<AcaSolver<nDim>>(solverId, comm);
1571 break;
1572 }
1573 default: {
1574 TERMM(1, "Unknown solver type '" + solverType + "', exiting ... ");
1575 }
1576 }
1577
1578 m_log << "Created solver #" << std::to_string(solverId) << ": " << solverType
1579 << m_solvers[solverId]->getIdentifier(false, " with alias: ", "") << std::endl;
1580}
@ MAIA_ACOUSTIC_ANALOGY
Definition: enums.h:43

◆ createSolver() [3/3]

template<MInt nDim>
void Application::createSolver ( StructuredGrid< nDim > *  grid,
const MInt  solverId,
MBool propertiesGroups,
const MPI_Comm  comm 
)
private
Author
Julian Stemmermann
Date
05/2020

Definition at line 1534 of file application.cpp.

1535 {
1536 TRACE();
1537
1538
1539 // Determine solver type from property file
1540 const MString solverType = Context::getSolverProperty<MString>("solvertype", solverId, AT_);
1541
1542 // Now create the specified solver
1543 switch(string2enum(solverType)) {
1544 case MAIA_STRUCTURED: {
1545 m_solvers[solverId] =
1546 make_unique<typename FvStructuredSolverXD<nDim>::type>(solverId, grid, propertiesGroups, comm);
1547 break;
1548 }
1549 default: {
1550 TERMM(1, "Unknown solver type '" + solverType + "', exiting ... ");
1551 }
1552 }
1553
1554 m_log << "Created solver #" << std::to_string(solverId) << ": " << solverType
1555 << m_solvers[solverId]->getIdentifier(false, " with alias: ", "") << std::endl;
1556}
@ MAIA_STRUCTURED
Definition: enums.h:40

◆ getInitialTimeStep()

MInt Application::getInitialTimeStep ( const MBool  restartFile,
const MPI_Comm  comm 
)
private

Definition at line 1266 of file application.cpp.

1266 {
1267 TRACE();
1268 if(!restartFile) {
1269 return 0;
1270 } else {
1271 MBool useNonSpecifiedRestartFile = false;
1272 useNonSpecifiedRestartFile =
1273 Context::getBasicProperty<MBool>("useNonSpecifiedRestartFile", AT_, &useNonSpecifiedRestartFile);
1274
1275 if(!useNonSpecifiedRestartFile) {
1276 // Use given restart time step from properties
1277 return Context::getBasicProperty<MInt>("restartTimeStep", AT_);
1278 } else {
1279 // Restart time step not specified in properties, use the first suitable solver on rank 0 to
1280 // load time step from restart file and broadcast result
1281 MInt timeStep = -1;
1282 // TODO labels:totest,noissue this will not work if rank 0 does not have a solver with restart time step
1283 // information!
1284 if(globalDomainId() == 0) {
1285 for(MInt solver = 0; solver < m_noSolvers; solver++) {
1286 if(m_solvers[solver]->hasRestartTimeStep()) {
1287 timeStep = m_solvers[solver]->determineRestartTimeStep();
1288 break;
1289 }
1290 }
1291 }
1292 MPI_Bcast(&timeStep, 1, maia::type_traits<MInt>::mpiType(), 0, comm, AT_, "timeStep");
1293 m_log << "Determined global time step from restart file: " << timeStep << std::endl;
1294 return timeStep;
1295 }
1296 }
1297}
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, const MString &name, const MString &varname)
same as MPI_Bcast

◆ gridType()

MInt Application::gridType ( const MString  solverType)
private

Definition at line 1341 of file application.cpp.

1341 {
1342 switch(string2enum(solverType)) {
1343 case MAIA_STRUCTURED: {
1344 return MAIA_GRID_STRUCTURED;
1345 }
1346 case MAIA_ACOUSTIC_ANALOGY: {
1347 return MAIA_GRID_NONE; // No grid required for acoustic extrapolation (e.g. FWH)
1348 }
1349 default: { // Default Cartesian grid
1350 return MAIA_GRID_CARTESIAN;
1351 }
1352 }
1353}
@ MAIA_GRID_NONE
Definition: enums.h:48
@ MAIA_GRID_STRUCTURED
Definition: enums.h:48
@ MAIA_GRID_CARTESIAN
Definition: enums.h:48

◆ initTimings()

void Application::initTimings ( )
private

Definition at line 524 of file application.cpp.

524 {
525 TRACE();
526
527 // Return if not enabled
529 return;
530 }
531
532 const MInt noSolversAndCouplers = m_noSolvers + m_noCouplers;
533 const MBool allTimings = m_writeAllSolverTimings;
534 // Determine total number of timers and domain decomposition information of each solver/coupler
536
537 for(MInt i = 0; i < noSolversAndCouplers; i++) {
538 const MInt noTimers = (i < m_noSolvers) ? m_solvers[i]->noSolverTimers(allTimings)
539 : m_couplers[i - m_noSolvers]->noCouplingTimers(allTimings);
540 m_noGlobalSolverTimers += noTimers;
541 }
542
543 MInt maxNoGlobalSolverTimers = -1;
544 MPI_Allreduce(&m_noGlobalSolverTimers, &maxNoGlobalSolverTimers, 1, maia::type_traits<MInt>::mpiType(), MPI_MAX,
545 MPI_COMM_WORLD, AT_, "m_noGlobalSolverTimers", "maxNoGlobalSolverTimers");
546 if(maxNoGlobalSolverTimers != m_noGlobalSolverTimers) {
547 TERMM(1, "Error: number of global solver timings does not match on all domains.");
548 }
549
550 m_solverTimings.clear();
552
555
558
559 // Reserve memory for timings (should be enough to avoid reallocation during solver run)
560 for(MInt timerId = 0; timerId < m_noGlobalSolverTimers; timerId++) {
561 m_solverTimings[timerId].clear();
562 m_solverTimings[timerId].reserve(m_maxNoSolverTimings);
563
564 m_solverTimingsPrevTime[timerId] = 0.0;
565 }
566
567 for(MInt i = 0; i < noSolversAndCouplers; i++) {
568 const MInt noTimers = (i < m_noSolvers) ? m_solvers[i]->noSolverTimers(allTimings)
569 : m_couplers[i - m_noSolvers]->noCouplingTimers(allTimings);
570 // Get solver timer names
571 std::vector<std::pair<MString, MFloat>> timings{};
572 (i < m_noSolvers) ? m_solvers[i]->getSolverTimings(timings, allTimings)
573 : m_couplers[i - m_noSolvers]->getCouplingTimings(timings, allTimings);
574 ASSERT((MInt)timings.size() == noTimers, "number of timings mismatch #" + std::to_string(i) + ": "
575 + std::to_string(timings.size()) + " != " + std::to_string(noTimers));
576
577 for(MInt j = 0; j < noTimers; j++) {
578 m_solverTimingsNames.push_back(timings[j].first);
579 }
580 }
581
582 m_log << "Initialized collection of solver timings: " << m_noGlobalSolverTimers << std::endl;
583}
MInt m_noGlobalSolverTimers
Definition: application.h:113
const MInt m_maxNoSolverTimings
Definition: application.h:114
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

◆ operator=() [1/2]

Application & Application::operator= ( Application &&  )
delete

◆ operator=() [2/2]

Application & Application::operator= ( const Application )
delete

◆ readPropertiesGroups()

MBool * Application::readPropertiesGroups ( )
staticprivate
Author
Thomas Hoesgen
Date
10/2019

Definition at line 1304 of file application.cpp.

1304 {
1305 TRACE();
1306
1307 MBool tmpFalse = false;
1308
1309 auto* propertiesGroups = new MBool[PROPERTIESGROUPS_COUNT];
1310
1311 fill(propertiesGroups, propertiesGroups + PROPERTIESGROUPS_COUNT, tmpFalse);
1312
1313 propertiesGroups[LEVELSETMB] = Context::getBasicProperty<MBool>("levelSetMb", AT_, &tmpFalse);
1314 propertiesGroups[LEVELSET] = Context::getBasicProperty<MBool>("levelSet", AT_, &tmpFalse);
1315 propertiesGroups[LB] = Context::getBasicProperty<MBool>("lb", AT_, &tmpFalse);
1316 propertiesGroups[LS_SOLVER] = Context::getBasicProperty<MBool>("lsSolver", AT_, &tmpFalse);
1317 propertiesGroups[COMBUSTION] = Context::getBasicProperty<MBool>("combustion", AT_, &tmpFalse);
1318 propertiesGroups[DG] = Context::getBasicProperty<MBool>("DG", AT_, &tmpFalse);
1319 propertiesGroups[LS_RANS] = Context::getBasicProperty<MBool>("levelSetRans", AT_, &tmpFalse);
1320
1321 MString couplerTypeDefault = "";
1322 MString couplerType = Context::getBasicProperty<MString>("couplerType_0", AT_, &couplerTypeDefault);
1323 propertiesGroups[LEVELSET_LB] = couplerType == "COUPLER_LS_LB";
1324
1325 if(globalDomainId() == 0) {
1326 cerr << "FV-MB is " << ((propertiesGroups[LEVELSETMB]) ? "on" : "off") << endl;
1327 cerr << "FV-LS is " << ((propertiesGroups[LEVELSET]) ? "on" : "off") << endl;
1328 cerr << "LB is " << ((propertiesGroups[LB]) ? "on" : "off") << endl;
1329 cerr << "LB LS is " << ((propertiesGroups[LEVELSET_LB]) ? "on" : "off") << endl;
1330 cerr << "LS SOLVER is " << ((propertiesGroups[LS_SOLVER]) ? "on" : "off") << endl;
1331 cerr << "COMBUSTION is " << ((propertiesGroups[COMBUSTION]) ? "on" : "off") << endl;
1332 cerr << "DG is " << ((propertiesGroups[DG]) ? "on" : "off") << endl;
1333 cerr << "LS-RANS is " << ((propertiesGroups[LS_RANS]) ? "on" : "off") << endl;
1334 }
1335
1336 return propertiesGroups;
1337}
@ PROPERTIESGROUPS_COUNT
Definition: enums.h:282
@ COMBUSTION
Definition: enums.h:276
@ LS_SOLVER
Definition: enums.h:280
@ LEVELSETMB
Definition: enums.h:275
@ LEVELSET
Definition: enums.h:274
@ DG
Definition: enums.h:279
@ LS_RANS
Definition: enums.h:277
@ LEVELSET_LB
Definition: enums.h:281
@ LB
Definition: enums.h:278

◆ run()

template<MInt nDim>
template void Application::run< 3 > ( )

◆ storeTimingsAndSolverInformation()

void Application::storeTimingsAndSolverInformation ( const MBool  finalTimeStep)
private

Definition at line 2421 of file application.cpp.

2421 {
2422 TRACE();
2423 using namespace maia::parallel_io;
2424
2425 // Return if not enabled
2427 return;
2428 }
2429
2430 // Check if timings should be written at this step
2431 const MBool writeStep = (m_solverTimingsWriteInterval > 0)
2432 ? (globalTimeStep % m_solverTimingsWriteInterval == 0 || finalTimeStep)
2433 : finalTimeStep;
2434 if(!writeStep) {
2435 return;
2436 }
2437
2438 const MInt noValues = m_solverTimings.size();
2439 if(noValues == 0) {
2440 return;
2441 }
2442 const MInt noTimings = m_solverTimings[0].size();
2443 if(noTimings == 0) {
2444 return;
2445 }
2446
2447 // Timings output file name
2448 stringstream fileName;
2449 fileName << "solverTimings_n" << globalNoDomains() << "_" << globalTimeStep << ParallelIo::fileExt();
2450
2451 // check for existing file
2452 if(globalDomainId() == 0) {
2453 ifstream readFile;
2454 readFile.open(fileName.str());
2455 if(readFile) {
2456 stringstream fileNameNew;
2457 fileNameNew << "solverTimings_n" << globalNoDomains() << "_" << globalTimeStep << "_bu" << ParallelIo::fileExt();
2458 std::rename(fileName.str().c_str(), fileNameNew.str().c_str());
2459 }
2460 }
2461
2462 ParallelIo file(fileName.str(), PIO_REPLACE, MPI_COMM_WORLD);
2463 file.defineArray(PIO_INT, "timeStep", noTimings);
2464
2465 const MInt noInfo = m_domainInfo.size();
2466
2467 // TODO labels:TIMERS store domainInfo for each changed configuration when using DLB?
2468 // Domain information
2469 ParallelIo::size_type dimSizesInfo[] = {globalNoDomains(), noInfo};
2470 file.defineArray(PIO_INT, "domainInfo", 2, &dimSizesInfo[0]);
2471 file.setAttribute("domain index", "dim_0", "domainInfo");
2472 file.setAttribute("information index", "dim_1", "domainInfo");
2473
2474 for(MInt i = 0; i < noInfo; i++) {
2475 std::stringstream var;
2476 var << "var_" << i;
2477 file.setAttribute(m_domainInfo[i].first, var.str(), "domainInfo");
2478 }
2479
2480 // Dimensions of timings: noDomains x noTimings x noValues
2481 ParallelIo::size_type dimSizesTimings[] = {globalNoDomains(), noTimings, noValues};
2482
2483 file.defineArray(PIO_FLOAT, "timings", 3, &dimSizesTimings[0]);
2484
2485 file.setAttribute("domain index", "dim_0", "timings");
2486 file.setAttribute("time step index", "dim_1", "timings");
2487 file.setAttribute("timings index", "dim_2", "timings");
2488
2489 for(MInt i = 0; i < noValues; i++) {
2490 std::stringstream var;
2491 var << "var_" << i;
2492 file.setAttribute(m_solverTimingsNames[i], var.str(), "timings");
2493 }
2494
2495 // Assemble domain information
2496 MFloatScratchSpace info(noInfo, AT_, "data");
2497 for(MInt i = 0; i < noInfo; i++) {
2498 info[i] = m_domainInfo[i].second;
2499 }
2500
2501 // Assemble timings
2502 MFloatScratchSpace data(noTimings, noValues, AT_, "data");
2503 for(MInt i = 0; i < noTimings; i++) {
2504 for(MInt j = 0; j < noValues; j++) {
2505 data(i, j) = m_solverTimings[j][i];
2506 }
2507 }
2508
2509 // root writes timestep data
2510 if(globalDomainId() == 0) {
2511 file.setOffset(noTimings, 0);
2512 } else {
2513 file.setOffset(0, 0);
2514 }
2515 file.writeArray(&m_solverTimingsTimeStep[0], "timeStep");
2516
2517 // Write domain information
2518 file.setOffset(1, globalDomainId(), 2);
2519 file.writeArray(&info[0], "domainInfo");
2520
2521 // Write timings of all domains
2522 file.setOffset(1, globalDomainId(), 3);
2523 file.writeArray(&data[0], "timings");
2524
2525
2526 // Clear collected timings
2527 for(MInt timerId = 0; timerId < m_noGlobalSolverTimers; timerId++) {
2528 m_solverTimings[timerId].clear();
2530 }
2531}
MInt m_solverTimingsWriteInterval
Write interval for timings.
Definition: application.h:110
This class is a ScratchSpace.
Definition: scratch.h:758
MInt globalNoDomains()
Return global number of domains.
PARALLELIO_DEFAULT_BACKEND ParallelIo
Definition: parallelio.h:292

Member Data Documentation

◆ m_couplers

std::vector<std::unique_ptr<Coupling> > Application::m_couplers
private

Definition at line 90 of file application.h.

◆ m_displayMemoryStatistics

MBool Application::m_displayMemoryStatistics = false
private

Definition at line 98 of file application.h.

◆ m_domainInfo

std::vector<std::pair<MString, MInt> > Application::m_domainInfo {}
private

Definition at line 119 of file application.h.

◆ m_dualTimeStepping

MBool Application::m_dualTimeStepping
private

Definition at line 76 of file application.h.

◆ m_initialAdaptation

MBool Application::m_initialAdaptation = true
private

Definition at line 86 of file application.h.

◆ m_maxIterations

MInt Application::m_maxIterations
private

Definition at line 78 of file application.h.

◆ m_maxNoSolverTimings

const MInt Application::m_maxNoSolverTimings = 100000
private

Definition at line 114 of file application.h.

◆ m_noCouplers

MInt Application::m_noCouplers = 0
private

Definition at line 88 of file application.h.

◆ m_noGlobalSolverTimers

MInt Application::m_noGlobalSolverTimers = -1
private

Definition at line 113 of file application.h.

◆ m_noPostProcessing

MInt Application::m_noPostProcessing
private

Definition at line 92 of file application.h.

◆ m_noSolvers

MInt Application::m_noSolvers = -1
private

Definition at line 82 of file application.h.

◆ m_postDataSolverId

MInt Application::m_postDataSolverId = -1
private

Definition at line 96 of file application.h.

◆ m_postProcessing

MBool Application::m_postProcessing
private

Definition at line 94 of file application.h.

◆ m_ppAfterTS

MBool Application::m_ppAfterTS = false
private

Definition at line 100 of file application.h.

◆ m_restartBackupInterval

MInt Application::m_restartBackupInterval
private

Definition at line 80 of file application.h.

◆ m_solvers

std::vector<std::unique_ptr<Solver> > Application::m_solvers
private

Definition at line 84 of file application.h.

◆ m_solverTimings

std::vector<std::vector<MFloat> > Application::m_solverTimings {}
private

Definition at line 115 of file application.h.

◆ m_solverTimingsNames

std::vector<MString> Application::m_solverTimingsNames {}
private

Definition at line 118 of file application.h.

◆ m_solverTimingsPrevTime

std::vector<MFloat> Application::m_solverTimingsPrevTime {}
private

Definition at line 116 of file application.h.

◆ m_solverTimingsSampleInterval

MInt Application::m_solverTimingsSampleInterval = 1
private

Definition at line 112 of file application.h.

◆ m_solverTimingsTimeStep

std::vector<MInt> Application::m_solverTimingsTimeStep {}
private

Definition at line 117 of file application.h.

◆ m_solverTimingsWriteInterval

MInt Application::m_solverTimingsWriteInterval = -1
private

Definition at line 110 of file application.h.

◆ m_writeAllSolverTimings

MBool Application::m_writeAllSolverTimings = true
private

Definition at line 108 of file application.h.

◆ m_writeSolverTimings

MBool Application::m_writeSolverTimings = false
private

Definition at line 106 of file application.h.


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