Skip to content

Commit

Permalink
Some comments; method split is probably unnecessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad committed Dec 5, 2017
1 parent c90c22f commit 85c5c23
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 21 deletions.
4 changes: 2 additions & 2 deletions framework/include/base/FEProblemBase.h
Expand Up @@ -825,9 +825,9 @@ class FEProblemBase : public SubProblem, public Restartable
bool execMultiApps(ExecFlagType type, bool auto_advance = true);

/**
* Advance the MultiApps associated with the ExecFlagType
* Advance the MultiApps t_step associated with the ExecFlagType
*/
void advanceMultiApps(ExecFlagType type);
void incrementMultiAppTStep(ExecFlagType type);

/**
* Backup the MultiApps associated with the ExecFlagType
Expand Down
4 changes: 3 additions & 1 deletion framework/include/multiapps/FullSolveMultiApp.h
Expand Up @@ -37,7 +37,9 @@ class FullSolveMultiApp : public MultiApp

virtual bool solveStep(Real dt, Real target_time, bool auto_advance = true) override;

virtual void advanceStep() override {}
virtual void incrementTStep() override {}

virtual void finishStep() override {}

virtual bool isSolved() const override { return _solved; }

Expand Down
12 changes: 5 additions & 7 deletions framework/include/multiapps/MultiApp.h
Expand Up @@ -95,13 +95,11 @@ class MultiApp : public MooseObject, public SetupInterface, public Restartable
*/
virtual bool solveStep(Real dt, Real target_time, bool auto_advance = true) = 0;

/**
* Actually advances time and causes output.
*
* If auto_advance=true was used in solveStep() then this function
* will do nothing.
*/
virtual void advanceStep() = 0;
/// Advances the time step (not the time if you can believe it)
virtual void incrementTStep() = 0;

/// Creates output
virtual void finishStep() = 0;

/**
* Save off the state of every Sub App
Expand Down
4 changes: 3 additions & 1 deletion framework/include/multiapps/TransientMultiApp.h
Expand Up @@ -40,7 +40,9 @@ class TransientMultiApp : public MultiApp

virtual bool solveStep(Real dt, Real target_time, bool auto_advance = true) override;

virtual void advanceStep() override;
virtual void incrementTStep() override;

virtual void finishStep() override;

virtual bool needsRestoration() override;

Expand Down
8 changes: 4 additions & 4 deletions framework/src/base/FEProblemBase.C
Expand Up @@ -3271,21 +3271,21 @@ FEProblemBase::postExecute()
}

void
FEProblemBase::advanceMultiApps(ExecFlagType type)
FEProblemBase::incrementMultiAppTStep(ExecFlagType type)
{
const auto & multi_apps = _multi_apps[type].getActiveObjects();

if (multi_apps.size())
{
_console << COLOR_CYAN << "\nAdvancing MultiApps" << COLOR_DEFAULT << std::endl;
_console << COLOR_CYAN << "\nAdvancing MultiApps t_step" << COLOR_DEFAULT << std::endl;

for (const auto & multi_app : multi_apps)
multi_app->advanceStep();
multi_app->incrementTStep();

_console << "Waiting For Other Processors To Finish" << std::endl;
MooseUtils::parallelBarrierNotify(_communicator, _parallel_barrier_messaging);

_console << COLOR_CYAN << "Finished Advancing MultiApps\n" << COLOR_DEFAULT << std::endl;
_console << COLOR_CYAN << "Finished Advancing MultiApps t_step\n" << COLOR_DEFAULT << std::endl;
}
}

Expand Down
4 changes: 2 additions & 2 deletions framework/src/executioners/Transient.C
Expand Up @@ -369,8 +369,8 @@ Transient::incrementStepOrReject()

_problem.advanceState();

_problem.advanceMultiApps(EXEC_TIMESTEP_BEGIN);
_problem.advanceMultiApps(EXEC_TIMESTEP_END);
_problem.incrementMultiAppTStep(EXEC_TIMESTEP_BEGIN);
_problem.incrementMultiAppTStep(EXEC_TIMESTEP_END);
}
}
else
Expand Down
22 changes: 18 additions & 4 deletions framework/src/multiapps/TransientMultiApp.C
Expand Up @@ -391,8 +391,8 @@ TransientMultiApp::solveStep(Real dt, Real target_time, bool auto_advance)
if (!caught_up)
throw MultiAppSolveFailure(name() + " Failed to catch up!\n");
}
}
}
} // if (!ex->lastSolveConverged())
} // if (auto_advance)
else if (!ex->lastSolveConverged())
throw MultiAppSolveFailure(name() + " failed to converge");
}
Expand All @@ -418,22 +418,36 @@ TransientMultiApp::solveStep(Real dt, Real target_time, bool auto_advance)
}

void
TransientMultiApp::advanceStep()
TransientMultiApp::incrementTStep()
{
if (!_sub_cycling)
{
for (unsigned int i = 0; i < _my_num_apps; i++)
{
/*FEProblemBase * problem =*/appProblemBase(_first_local_app + i);
Transient * ex = _transient_executioners[i];

ex->endStep();
ex->postStep();
ex->incrementStepOrReject();
}
}
}

void
TransientMultiApp::finishStep()
{
if (!_sub_cycling)
{
for (unsigned int i = 0; i < _my_num_apps; i++)
{
/*FEProblemBase * problem =*/appProblemBase(_first_local_app + i);
Transient * ex = _transient_executioners[i];
ex->endStep();
ex->postStep();
}
}
}

bool
TransientMultiApp::needsRestoration()
{
Expand Down

0 comments on commit 85c5c23

Please sign in to comment.