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

#include <executionrecipe.h>

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

Public Member Functions

 ExecutionRecipeSolutionIteration (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

Definition at line 513 of file executionrecipe.h.

Constructor & Destructor Documentation

◆ ExecutionRecipeSolutionIteration()

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

Definition at line 515 of file executionrecipe.h.

517 : ExecutionRecipe(solvers, couplers) {
518 // This function initializes function pointers to the preTimeStep, solutionStep
519 // and postTimeStep functions of each solver
521
522 // Read the callOrder from the propertiesFile
524 }
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 ExecutionRecipeSolutionIteration::timeStep ( )
inlineoverridevirtual
Author
Thomas Hoesgen
Date
01/2020

Reimplemented from ExecutionRecipe.

Definition at line 558 of file executionrecipe.h.

558 {
559 TRACE();
560
561 MInt iteration = 0;
562 while(iteration < m_maxSolutionIteration) {
563 // Intermediate loop over all solvers
564 for(auto&& solver : *a_solvers()) {
565 const MInt solverId = solver->solverId();
566
567 if(iteration > 0) {
568 solver->startLoadTimer(AT_);
569 preSolutionStep(solverId, -1);
570 solver->stopLoadTimer(AT_);
571 }
572
573 // Outer loop over substep iterations
574 MBool timeStepCompleted = false;
575 // Store solver completed status to allow solvers to have different number of RK steps, i.e.,
576 // skip solutionStep of a solver that is already finished
577 std::vector<MBool> solverTimeStepCompleted(noSolvers(), false);
578
579 while(!timeStepCompleted) {
580 timeStepCompleted = true;
581
582 // Solver is active on this domain (has cells) and has not already completed its current
583 // solution step, i.e., all RK stages
584 if(solver->isActive() && !solverTimeStepCompleted[solverId]) {
585 // Call solver specific solutionStep() - solvers might be idle (in this step)
586 solver->startLoadTimer(AT_);
587 solverTimeStepCompleted[solverId] = solutionStep(solver->solverId());
588 timeStepCompleted &= solverTimeStepCompleted[solverId];
589 solver->stopLoadTimer(AT_);
590 }
591 }
592
594 solver->startLoadTimer(AT_);
595 MBool iterationConverged = postSolutionStep(solverId);
596 if(iterationConverged) iteration = m_maxSolutionIteration;
597 solver->stopLoadTimer(AT_);
598 }
599 iteration++;
600 }
601 }
602 };
MBool solutionStep(const MInt solverId)
MInt noSolvers() const
const std::vector< std::unique_ptr< Solver > > * a_solvers() const
void preSolutionStep(const MInt solverId, const MInt mode)
MBool postSolutionStep(const MInt solverId)
int32_t MInt
Definition: maiatypes.h:62
bool MBool
Definition: maiatypes.h:58

◆ updateCallOrder()

MBool ExecutionRecipeSolutionIteration::updateCallOrder ( )
inlineoverridevirtual

Reimplemented from ExecutionRecipe.

Definition at line 531 of file executionrecipe.h.

531 {
532 MBool advanceTimeStep = false;
533
534 nextStep();
535
536 if(a_step() == maxNoSteps()) {
537 a_step() = 0;
538 advanceTimeStep = true;
539 }
540
541
542 for(MInt solver = 0; solver < noSolvers(); solver++) {
543 setSolverStatus(solver, solverOrder(solver));
544 }
545
546 for(MInt cpl = 0; cpl < noCouplers(); cpl++) {
548 }
549
551
552 return advanceTimeStep;
553 }
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
MInt a_step() 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: