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

#include <executionrecipe.h>

Inheritance diagram for ExecutionRecipeIntraStepCoupling:
[legend]
Collaboration diagram for ExecutionRecipeIntraStepCoupling:
[legend]

Public Member Functions

 ExecutionRecipeIntraStepCoupling (std::vector< std::unique_ptr< Solver > > *const solvers, std::vector< std::unique_ptr< Coupling > > *const couplers)
 
MBool updateCallOrder () override
 
void timeStep () override
 : Single solver time step function. Calls solutionStep() of the specific solver More...
 
- Public Member Functions inherited from ExecutionRecipe
 ExecutionRecipe (std::vector< std::unique_ptr< Solver > > *const solvers, std::vector< std::unique_ptr< Coupling > > *const couplers)
 
virtual void preTimeStep () final
 : Calls each solvers preTimeStep - might be empty More...
 
virtual void timeStep ()
 : Single solver time step function. Calls solutionStep() of the specific solver More...
 
virtual void postTimeStep () final
 : Calls each solvers postTimeStep - might be empty More...
 
virtual void preCouple () final
 : Calls each couplers preCouple - might be empty More...
 
virtual void postCouple () final
 : Calls each couplers postCouple - might be empty More...
 
virtual MBool updateCallOrder ()
 
MInt a_step () const
 
MInta_step ()
 
MBool callAdaptation () const
 

Additional Inherited Members

- Protected Member Functions inherited from ExecutionRecipe
void readCallOrder ()
 : Reads the call order of solvers, couplers and adaptation More...
 
void initFunctionPointers ()
 : Initialize the vector containing function pointers to preTimeStep, solutionStep and postTimestep as well as preCouple, subCouple and postCouple. All are set active. More...
 
void setSolverStatus (MInt, MBool)
 : Wrapper function to set solvers active or idle More...
 
void setCouplerStatus (const MInt couplerId, const MBool active)
 : Wrapper function to set couplers active or empty More...
 
MInt noSolvers () const
 
MInt noCouplers () const
 
void nextStep ()
 
MBool solverOrder (const MInt solverId) const
 
MBool couplerOrder (const MInt couplerId) const
 
void setAdaptation ()
 
MInt maxNoSteps () const
 
MBool solutionStep (const MInt solverId)
 
void preSolutionStep (const MInt solverId, const MInt mode)
 
MBool postSolutionStep (const MInt solverId)
 
void subCouple (const MInt couplerId, const MInt step, const MInt solverId, std::vector< MBool > &solverCompleted)
 
const std::vector< std::unique_ptr< Solver > > * a_solvers () const
 
const std::vector< std::unique_ptr< Coupling > > * a_couplers () const
 
MInt swapedSolverId (const MInt oldSolverId)
 
void startLoadTimer (const MInt solverId)
 
void stopLoadTimer (const MInt solverId)
 
MBool solverIsActive (const MInt solverId)
 
- Protected Attributes inherited from ExecutionRecipe
MInt m_maxSolutionIteration = 1
 
std::map< MInt, MIntm_swapSolverIds {}
 

Detailed Description

Recipe for any number of solvers/couplers, where the couplers (if any) are executed once after each solver's substep.

Definition at line 424 of file executionrecipe.h.

Constructor & Destructor Documentation

◆ ExecutionRecipeIntraStepCoupling()

ExecutionRecipeIntraStepCoupling::ExecutionRecipeIntraStepCoupling ( std::vector< std::unique_ptr< Solver > > *const  solvers,
std::vector< std::unique_ptr< Coupling > > *const  couplers 
)
inline

Definition at line 426 of file executionrecipe.h.

428 : ExecutionRecipe(solvers, couplers) {
429 // This function initializes function pointers to the preTimeStep, solutionStep
430 // and postTimeStep functions of each solver
432
433 // Read the callOrder from the propertiesFile
435 }
Base recipe provides public interface to Application.
void readCallOrder()
: Reads the call order of solvers, couplers and adaptation
void initFunctionPointers()
: Initialize the vector containing function pointers to preTimeStep, solutionStep and postTimestep as...
MInt * solvers
Definition: maiatypes.h:72

Member Function Documentation

◆ timeStep()

void ExecutionRecipeIntraStepCoupling::timeStep ( )
inlineoverridevirtual
Author
Thomas Hoesgen
Date
01/2020

Reimplemented from ExecutionRecipe.

Definition at line 467 of file executionrecipe.h.

467 {
468 TRACE();
469
470 MBool completed = false;
471 // Store solver completed status to allow solvers to have different number of RK steps, i.e.,
472 // skip solutionStep of a solver that is already finished
473 std::vector<MBool> solverCompleted(noSolvers(), false);
474
475 while(!completed) {
476 // Exit once all solvers are completed.
477 completed = true;
478
479 // Intermediate loop over all solvers
480 for(auto&& solver : *a_solvers()) {
481 const MInt solverId = m_swapSolverIds.empty() ? solver->solverId() : swapedSolverId(solver->solverId());
482
483 // Solver is active on this domain (has cells) and has not already completed its current
484 // solution step, i.e., all RK stages
485 if(solverIsActive(solverId) && !solverCompleted[solverId]) {
486 // Call solver specific solutionStep() - solvers might be idle (in this step)
487 startLoadTimer(solverId);
488 solverCompleted[solverId] = solutionStep(solverId);
489 stopLoadTimer(solverId);
490 }
491
492 // Inner-most loop over all couplers
493 // Each couplers subCouple() is executed after each solvers solutionStep()
494 // Couplers can, however, be disabled via the callOrder
495 for(auto&& coupler : *a_couplers()) {
496 coupler->startLoadTimer(AT_);
497 subCouple(coupler->couplerId(), a_step(), solverId, solverCompleted);
498 coupler->stopLoadTimer(AT_);
499 }
500 if(solverIsActive(solverId) && !solverCompleted[solverId]) {
501 completed &= solverCompleted[solverId];
502 }
503 }
504 }
505 };
void stopLoadTimer(const MInt solverId)
MBool solutionStep(const MInt solverId)
MBool solverIsActive(const MInt solverId)
void startLoadTimer(const MInt solverId)
std::map< MInt, MInt > m_swapSolverIds
MInt swapedSolverId(const MInt oldSolverId)
MInt noSolvers() const
const std::vector< std::unique_ptr< Solver > > * a_solvers() const
void subCouple(const MInt couplerId, const MInt step, const MInt solverId, std::vector< MBool > &solverCompleted)
const std::vector< std::unique_ptr< Coupling > > * a_couplers() const
MInt a_step() const
int32_t MInt
Definition: maiatypes.h:62
bool MBool
Definition: maiatypes.h:58

◆ updateCallOrder()

MBool ExecutionRecipeIntraStepCoupling::updateCallOrder ( )
inlineoverridevirtual

Reimplemented from ExecutionRecipe.

Definition at line 442 of file executionrecipe.h.

442 {
443 MBool advanceTimeStep = false;
444
445 nextStep();
446
447 if(a_step() == maxNoSteps()) {
448 a_step() = 0;
449 advanceTimeStep = true;
450 }
451
452
453 for(MInt solver = 0; solver < noSolvers(); solver++) {
454 setSolverStatus(solver, solverOrder(solver));
455 }
456
457 for(MInt cpl = 0; cpl < noCouplers(); cpl++) {
459 }
460
462
463 return advanceTimeStep;
464 }
void setSolverStatus(MInt, MBool)
: Wrapper function to set solvers active or idle
MBool couplerOrder(const MInt couplerId) const
MInt noCouplers() const
MBool solverOrder(const MInt solverId) const
MInt maxNoSteps() const
void setCouplerStatus(const MInt couplerId, const MBool active)
: Wrapper function to set couplers active or empty

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