Skip to content
Snippets Groups Projects
Commit 87726175 authored by Markus Wolff's avatar Markus Wolff
Browse files

added output control via time interval to decoupled base problem

   - if a time interval is set by the function setOuputTimeInterval(Scalar
     interval) there will be an output at the end of each of these time
     intervals
   - if the output interval (control by output number) is set to 0 (setOutputInterval(int interval)) the
     ouput will only be written after each output time interval



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8032 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 01020c73
No related branches found
No related tags found
No related merge requests found
......@@ -108,7 +108,8 @@ public:
timeManager_(&timeManager),
deleteTimeManager_(false),
variables_(gridView),
outputInterval_(1)
outputInterval_(1),
outputTimeInterval_(0.0)
{
// calculate the bounding box of the grid view
VertexIterator vIt = gridView.template begin<dim>();
......@@ -471,13 +472,26 @@ public:
(timeManager().timeStepIndex() % int(100*outputInterval_) == 0);
}
/*!
* \brief Sets a time interval for Output
*
* The default is 0.0 -> Output determined by output number interval (<tt>setOutputInterval(int)</tt>)
*/
void setOutputTimeInterval(Scalar timeInterval)
{
outputTimeInterval_ = timeInterval;
timeManager().startNextEpisode(outputTimeInterval_);
}
/*!
* \brief Sets the interval for Output
*
* The default is 1 -> Output every time step
*/
void setOutputInterval(int interval)
{ outputInterval_ = std::max(interval, 1); }
{
outputInterval_ = std::max(interval, 0);
}
/*!
* \brief Returns true if the current solution should be written to
......@@ -489,7 +503,17 @@ public:
*/
bool shouldWriteOutput() const
{
if (timeManager().timeStepIndex() % outputInterval_ == 0 || timeManager().willBeFinished() || timeManager().episodeWillBeOver())
if (outputInterval_ > 0)
{
if (timeManager().timeStepIndex() % outputInterval_ == 0
|| timeManager().willBeFinished()
|| timeManager().episodeWillBeOver())
{
return true;
}
}
else if (timeManager().willBeFinished()
|| timeManager().episodeWillBeOver() || timeManager().timeStepIndex() == 0)
{
return true;
}
......@@ -501,9 +525,16 @@ public:
*/
void episodeEnd()
{
std::cerr << "The end of an episode is reached, but the problem "
<< "does not override the episodeEnd() method. "
<< "Doing nothing!\n";
if (outputTimeInterval_ > 0.0 && !timeManager().willBeFinished())
{
timeManager().startNextEpisode(outputTimeInterval_);
}
else if (!timeManager().willBeFinished())
{
std::cerr << "The end of an episode is reached, but the problem "
<< "does not override the episodeEnd() method. "
<< "Doing nothing!\n";
}
};
// \}
......@@ -795,6 +826,7 @@ private:
VtkMultiWriter *resultWriter_;
int outputInterval_;
Scalar outputTimeInterval_;
GridAdaptModel* gridAdapt_;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment