Skip to content
Snippets Groups Projects
Commit 9df9d4af authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Added debug information output to AdaptInstationary

parent 9fbc0f9b
No related branches found
No related tags found
No related merge requests found
...@@ -84,7 +84,7 @@ namespace AMDiS { ...@@ -84,7 +84,7 @@ namespace AMDiS {
spaceTolerance = totalTol * relSpaceErr; spaceTolerance = totalTol * relSpaceErr;
timeTolerance = totalTol * relTimeErr * timeTheta1; timeTolerance = totalTol * relTimeErr * timeTheta1;
timeErrLow = totalTol * relTimeErr * timeTheta2; timeErrLow = totalTol * relTimeErr * timeTheta2;
}; }
/** \brief /** \brief
* Sum of all error estimates * Sum of all error estimates
...@@ -192,7 +192,7 @@ namespace AMDiS { ...@@ -192,7 +192,7 @@ namespace AMDiS {
scalContents[i] = new ScalContent(name + std::string(number)); scalContents[i] = new ScalContent(name + std::string(number));
} }
} }
}; }
/** \brief /** \brief
* Destructor. * Destructor.
...@@ -201,7 +201,7 @@ namespace AMDiS { ...@@ -201,7 +201,7 @@ namespace AMDiS {
for (int i = 0; i < scalContents.getSize(); i++) { for (int i = 0; i < scalContents.getSize(); i++) {
delete scalContents[i]; delete scalContents[i];
} }
}; }
inline void reset() inline void reset()
{ {
...@@ -215,7 +215,7 @@ namespace AMDiS { ...@@ -215,7 +215,7 @@ namespace AMDiS {
solverResidual = 0.0; solverResidual = 0.0;
GET_PARAMETER(0, name + "->timestep", "%f", &timestep); GET_PARAMETER(0, name + "->timestep", "%f", &timestep);
}; }
/** \brief /** \brief
* Returns whether space tolerance is reached. * Returns whether space tolerance is reached.
...@@ -228,7 +228,7 @@ namespace AMDiS { ...@@ -228,7 +228,7 @@ namespace AMDiS {
} }
} }
return true; return true;
}; }
/** \brief /** \brief
* Returns whether space tolerance of component i is reached. * Returns whether space tolerance of component i is reached.
...@@ -239,7 +239,7 @@ namespace AMDiS { ...@@ -239,7 +239,7 @@ namespace AMDiS {
} else { } else {
return true; return true;
} }
}; }
/** \brief /** \brief
* Returns whether time tolerance is reached. * Returns whether time tolerance is reached.
...@@ -252,7 +252,7 @@ namespace AMDiS { ...@@ -252,7 +252,7 @@ namespace AMDiS {
} }
} }
return true; return true;
}; }
/** \brief /** \brief
* Returns whether time tolerance of component i is reached. * Returns whether time tolerance of component i is reached.
...@@ -263,7 +263,7 @@ namespace AMDiS { ...@@ -263,7 +263,7 @@ namespace AMDiS {
} else { } else {
return true; return true;
} }
}; }
/** \brief /** \brief
* Returns whether time error is under its lower bound. * Returns whether time error is under its lower bound.
...@@ -276,210 +276,220 @@ namespace AMDiS { ...@@ -276,210 +276,220 @@ namespace AMDiS {
} }
} }
return true; return true;
}; }
/** \brief
* Print debug information about time error and its bound.
*/
void printTimeErrorLowInfo() {
for (int i = 0; i < scalContents.getSize(); i++) {
std::cout << " Time error estimate = " << scalContents[i]->est_t_sum
<< " Time error bound = " << scalContents[i]->timeErrLow << "\n";
}
}
/** \brief /** \brief
* Returns \ref spaceIteration. * Returns \ref spaceIteration.
*/ */
inline int getSpaceIteration() { inline int getSpaceIteration() {
return spaceIteration; return spaceIteration;
}; }
/** \brief /** \brief
* Sets \ref spaceIteration. * Sets \ref spaceIteration.
*/ */
inline void setSpaceIteration(int it) { inline void setSpaceIteration(int it) {
spaceIteration = it; spaceIteration = it;
}; }
/** \brief /** \brief
* Returns \ref maxSpaceIteration. * Returns \ref maxSpaceIteration.
*/ */
inline int getMaxSpaceIteration() { inline int getMaxSpaceIteration() {
return maxSpaceIteration; return maxSpaceIteration;
}; }
/** \brief /** \brief
* Sets \ref maxSpaceIteration. * Sets \ref maxSpaceIteration.
*/ */
inline void setMaxSpaceIteration(int it) { inline void setMaxSpaceIteration(int it) {
maxSpaceIteration = it; maxSpaceIteration = it;
}; }
/** \brief /** \brief
* Increments \ref spaceIteration by 1; * Increments \ref spaceIteration by 1;
*/ */
inline void incSpaceIteration() { inline void incSpaceIteration() {
spaceIteration++; spaceIteration++;
}; }
/** \brief /** \brief
* Sets \ref timestepIteration. * Sets \ref timestepIteration.
*/ */
inline void setTimestepIteration(int it) { inline void setTimestepIteration(int it) {
timestepIteration = it; timestepIteration = it;
}; }
/** \brief /** \brief
* Returns \ref timestepIteration. * Returns \ref timestepIteration.
*/ */
inline int getTimestepIteration() { inline int getTimestepIteration() {
return timestepIteration; return timestepIteration;
}; }
/** \brief /** \brief
* Increments \ref timestepIteration by 1; * Increments \ref timestepIteration by 1;
*/ */
inline void incTimestepIteration() { inline void incTimestepIteration() {
timestepIteration++; timestepIteration++;
}; }
/** \brief /** \brief
* Returns \ref maxTimestepIteration. * Returns \ref maxTimestepIteration.
*/ */
inline int getMaxTimestepIteration() { inline int getMaxTimestepIteration() {
return maxTimestepIteration; return maxTimestepIteration;
}; }
/** \brief /** \brief
* Sets \ref maxTimestepIteration. * Sets \ref maxTimestepIteration.
*/ */
inline void setMaxTimestepIteration(int it) { inline void setMaxTimestepIteration(int it) {
maxTimestepIteration = it; maxTimestepIteration = it;
}; }
/** \brief /** \brief
* Sets \ref timeIteration. * Sets \ref timeIteration.
*/ */
inline void setTimeIteration(int it) { inline void setTimeIteration(int it) {
timeIteration = it; timeIteration = it;
}; }
/** \brief /** \brief
* Returns \ref timeIteration. * Returns \ref timeIteration.
*/ */
inline int getTimeIteration() { inline int getTimeIteration() {
return timeIteration; return timeIteration;
}; }
/** \brief /** \brief
* Increments \ref timesIteration by 1; * Increments \ref timesIteration by 1;
*/ */
inline void incTimeIteration() { inline void incTimeIteration() {
timeIteration++; timeIteration++;
}; }
/** \brief /** \brief
* Returns \ref maxTimeIteration. * Returns \ref maxTimeIteration.
*/ */
inline int getMaxTimeIteration() { inline int getMaxTimeIteration() {
return maxTimeIteration; return maxTimeIteration;
}; }
/** \brief /** \brief
* Sets \ref maxTimeIteration. * Sets \ref maxTimeIteration.
*/ */
inline void setMaxTimeIteration(int it) { inline void setMaxTimeIteration(int it) {
maxTimeIteration = it; maxTimeIteration = it;
}; }
/** \brief /** \brief
* Returns \ref timestepNumber. * Returns \ref timestepNumber.
*/ */
inline int getTimestepNumber() { inline int getTimestepNumber() {
return timestepNumber; return timestepNumber;
}; }
/** \brief /** \brief
* Increments \ref timestepNumber by 1; * Increments \ref timestepNumber by 1;
*/ */
inline void incTimestepNumber() { inline void incTimestepNumber() {
timestepNumber++; timestepNumber++;
}; }
/** \brief /** \brief
* Sets \ref est_sum. * Sets \ref est_sum.
*/ */
inline void setEstSum(double e, int index) { inline void setEstSum(double e, int index) {
scalContents[index]->est_sum = e; scalContents[index]->est_sum = e;
}; }
/** \brief /** \brief
* Sets \ref est_max. * Sets \ref est_max.
*/ */
inline void setEstMax(double e, int index) { inline void setEstMax(double e, int index) {
scalContents[index]->est_max = e; scalContents[index]->est_max = e;
}; }
/** \brief /** \brief
* Sets \ref est_max. * Sets \ref est_max.
*/ */
inline void setTimeEstMax(double e, int index) { inline void setTimeEstMax(double e, int index) {
scalContents[index]->est_t_max = e; scalContents[index]->est_t_max = e;
}; }
/** \brief /** \brief
* Sets \ref est_t_sum. * Sets \ref est_t_sum.
*/ */
inline void setTimeEstSum(double e, int index) { inline void setTimeEstSum(double e, int index) {
scalContents[index]->est_t_sum = e; scalContents[index]->est_t_sum = e;
}; }
/** \brief /** \brief
* Returns \ref est_sum. * Returns \ref est_sum.
*/ */
inline double getEstSum(int index) { inline double getEstSum(int index) {
return scalContents[index]->est_sum; return scalContents[index]->est_sum;
}; }
/** \brief /** \brief
* Returns \ref est_t_sum. * Returns \ref est_t_sum.
*/ */
inline double getEstTSum(int index) { inline double getEstTSum(int index) {
return scalContents[index]->est_t_sum; return scalContents[index]->est_t_sum;
}; }
/** \brief /** \brief
* Returns \ref est_max. * Returns \ref est_max.
*/ */
inline double getEstMax(int index) { inline double getEstMax(int index) {
return scalContents[index]->est_max; return scalContents[index]->est_max;
}; }
/** \brief /** \brief
* Returns \ref est_max. * Returns \ref est_max.
*/ */
inline double getTimeEstMax(int index) { inline double getTimeEstMax(int index) {
return scalContents[index]->est_t_max; return scalContents[index]->est_t_max;
}; }
/** \brief /** \brief
* Returns \ref est_t_sum. * Returns \ref est_t_sum.
*/ */
inline double getTimeEstSum(int index) { inline double getTimeEstSum(int index) {
return scalContents[index]->est_t_sum; return scalContents[index]->est_t_sum;
}; }
/** \brief /** \brief
* Returns \ref spaceTolerance. * Returns \ref spaceTolerance.
*/ */
inline double getSpaceTolerance(int index) { inline double getSpaceTolerance(int index) {
return scalContents[index]->spaceTolerance; return scalContents[index]->spaceTolerance;
}; }
/** \brief /** \brief
* Sets \ref spaceTolerance. * Sets \ref spaceTolerance.
*/ */
inline void setSpaceTolerance(int index, double tol) { inline void setSpaceTolerance(int index, double tol) {
scalContents[index]->spaceTolerance = tol; scalContents[index]->spaceTolerance = tol;
}; }
/** \brief /** \brief
* Returns \ref timeTolerance. * Returns \ref timeTolerance.
*/ */
inline double getTimeTolerance(int index) { inline double getTimeTolerance(int index) {
return scalContents[index]->timeTolerance; return scalContents[index]->timeTolerance;
}; }
/** \brief /** \brief
* Sets \ref time * Sets \ref time
...@@ -492,21 +502,21 @@ namespace AMDiS { ...@@ -492,21 +502,21 @@ namespace AMDiS {
time = startTime; time = startTime;
return time; return time;
}; }
/** \brief /** \brief
* Gets \ref time * Gets \ref time
*/ */
inline double getTime() { inline double getTime() {
return time; return time;
}; }
/** \brief /** \brief
* Gets \ref &time * Gets \ref &time
*/ */
inline double *getTimePtr() { inline double *getTimePtr() {
return &time; return &time;
}; }
/** \brief /** \brief
* Sets \ref timestep * Sets \ref timestep
...@@ -524,162 +534,162 @@ namespace AMDiS { ...@@ -524,162 +534,162 @@ namespace AMDiS {
} }
return timestep; return timestep;
}; }
/** \brief /** \brief
* Gets \ref timestep * Gets \ref timestep
*/ */
inline double getTimestep() { inline double getTimestep() {
return timestep; return timestep;
}; }
/** \brief /** \brief
* Sets \ref minTimestep * Sets \ref minTimestep
*/ */
inline void setMinTimestep(double t) { inline void setMinTimestep(double t) {
minTimestep = t; minTimestep = t;
}; }
/** \brief /** \brief
* Gets \ref minTimestep * Gets \ref minTimestep
*/ */
inline double getMinTimestep() { inline double getMinTimestep() {
return minTimestep; return minTimestep;
}; }
/** \brief /** \brief
* Sets \ref maxTimestep * Sets \ref maxTimestep
*/ */
inline void setMaxTimestep(double t) { inline void setMaxTimestep(double t) {
maxTimestep = t; maxTimestep = t;
}; }
/** \brief /** \brief
* Gets \ref maxTimestep * Gets \ref maxTimestep
*/ */
inline double getMaxTimestep() { inline double getMaxTimestep() {
return maxTimestep; return maxTimestep;
}; }
/** \brief /** \brief
* Gets \ref &timestep * Gets \ref &timestep
*/ */
inline double *getTimestepPtr() { inline double *getTimestepPtr() {
return &timestep; return &timestep;
}; }
/** \brief /** \brief
* Sets \ref startTime = time * Sets \ref startTime = time
*/ */
inline void setStartTime(double time) { inline void setStartTime(double time) {
startTime = time; startTime = time;
}; }
/** \brief /** \brief
* Sets \ref endTime = time * Sets \ref endTime = time
*/ */
inline void setEndTime(double time) { inline void setEndTime(double time) {
endTime = time; endTime = time;
}; }
/** \brief /** \brief
* Returns \ref startTime * Returns \ref startTime
*/ */
inline double getStartTime() { inline double getStartTime() {
return startTime; return startTime;
}; }
/** \brief /** \brief
* Returns \ref endTime * Returns \ref endTime
*/ */
inline double getEndTime() { inline double getEndTime() {
return endTime; return endTime;
}; }
/** \brief /** \brief
* Returns \ref timeErrLow. * Returns \ref timeErrLow.
*/ */
inline double getTimeErrLow(int index) { inline double getTimeErrLow(int index) {
return scalContents[index]->timeErrLow; return scalContents[index]->timeErrLow;
}; }
/** \brief /** \brief
* Returns whether coarsening is allowed or not. * Returns whether coarsening is allowed or not.
*/ */
inline bool isCoarseningAllowed(int index) { inline bool isCoarseningAllowed(int index) {
return (scalContents[index]->coarsenAllowed == 1); return (scalContents[index]->coarsenAllowed == 1);
}; }
/** \brief /** \brief
* Returns whether coarsening is allowed or not. * Returns whether coarsening is allowed or not.
*/ */
inline bool isRefinementAllowed(int index) { inline bool isRefinementAllowed(int index) {
return (scalContents[index]->refinementAllowed == 1); return (scalContents[index]->refinementAllowed == 1);
}; }
/** \brief /** \brief
* *
*/ */
inline void allowRefinement(bool allow, int index) { inline void allowRefinement(bool allow, int index) {
scalContents[index]->refinementAllowed = allow; scalContents[index]->refinementAllowed = allow;
}; }
/** \brief /** \brief
* *
*/ */
inline void allowCoarsening(bool allow, int index) { inline void allowCoarsening(bool allow, int index) {
scalContents[index]->coarsenAllowed = allow; scalContents[index]->coarsenAllowed = allow;
}; }
/** \brief /** \brief
* Returns \ref refineBisections * Returns \ref refineBisections
*/ */
inline const int getRefineBisections(int index) const { inline const int getRefineBisections(int index) const {
return scalContents[index]->refineBisections; return scalContents[index]->refineBisections;
}; }
/** \brief /** \brief
* Returns \ref coarseBisections * Returns \ref coarseBisections
*/ */
inline const int getCoarseBisections(int index) const { inline const int getCoarseBisections(int index) const {
return scalContents[index]->coarseBisections; return scalContents[index]->coarseBisections;
}; }
inline int getSize() { inline int getSize() {
return scalContents.getSize(); return scalContents.getSize();
}; }
inline void setSolverIterations(int it) { inline void setSolverIterations(int it) {
solverIterations = it; solverIterations = it;
}; }
inline int getSolverIterations() { inline int getSolverIterations() {
return solverIterations; return solverIterations;
}; }
inline void setMaxSolverIterations(int it) { inline void setMaxSolverIterations(int it) {
maxSolverIterations = it; maxSolverIterations = it;
}; }
inline int getMaxSolverIterations() { inline int getMaxSolverIterations() {
return maxSolverIterations; return maxSolverIterations;
}; }
inline void setSolverTolerance(double tol) { inline void setSolverTolerance(double tol) {
solverTolerance = tol; solverTolerance = tol;
}; }
inline double getSolverTolerance() { inline double getSolverTolerance() {
return solverTolerance; return solverTolerance;
}; }
inline void setSolverResidual(double res) { inline void setSolverResidual(double res) {
solverResidual = res; solverResidual = res;
}; }
inline double getSolverResidual() { inline double getSolverResidual() {
return solverResidual; return solverResidual;
}; }
/** \brief /** \brief
* Returns true, if the adaptive procedure was deserialized from a file. * Returns true, if the adaptive procedure was deserialized from a file.
......
...@@ -15,7 +15,8 @@ namespace AMDiS { ...@@ -15,7 +15,8 @@ namespace AMDiS {
AdaptInfo *initialInfo, AdaptInfo *initialInfo,
time_t initialTimestamp) time_t initialTimestamp)
: AdaptBase(name, problemStat, info, problemInstat, initialInfo), : AdaptBase(name, problemStat, info, problemInstat, initialInfo),
breakWhenStable(0) breakWhenStable(0),
dbgMode(false)
{ {
FUNCNAME("AdaptInstationary::AdaptInstationary()"); FUNCNAME("AdaptInstationary::AdaptInstationary()");
...@@ -162,27 +163,40 @@ namespace AMDiS { ...@@ -162,27 +163,40 @@ namespace AMDiS {
if (!fixedTimestep_ && adaptInfo_->timeErrorLow()) { if (!fixedTimestep_ && adaptInfo_->timeErrorLow()) {
adaptInfo_->setTimestep(adaptInfo_->getTimestep() *time_delta_2); adaptInfo_->setTimestep(adaptInfo_->getTimestep() *time_delta_2);
if (dbgMode) {
// print information about timestep increase
}
} else {
if (dbgMode) {
std::cout << "=== ADAPT INFO DEBUG MODE ===\n";
std::cout << " Do not increase timestep: \n";
if (fixedTimestep_) {
std::cout << " fixedTimestep = true\n";
}
if (!adaptInfo_->timeErrorLow()) {
adaptInfo_->printTimeErrorLowInfo();
}
}
} }
} }
void AdaptInstationary::oneTimestep() void AdaptInstationary::oneTimestep()
{ {
FUNCNAME("AdaptInstationary::oneTimestep"); FUNCNAME("AdaptInstationary::oneTimestep()");
adaptInfo_->setTimestepIteration(0); adaptInfo_->setTimestepIteration(0);
switch(strategy) switch (strategy) {
{ case 0:
case 0: explicitTimeStrategy();
explicitTimeStrategy(); break;
break; case 1:
case 1: implicitTimeStrategy();
implicitTimeStrategy(); break;
break; default:
default: MSG("unknown strategy = %d; use explicit strategy\n", strategy);
MSG("unknown strategy = %d; use explicit strategy\n", strategy); explicitTimeStrategy();
explicitTimeStrategy(); }
}
adaptInfo_->incTimestepNumber(); adaptInfo_->incTimestepNumber();
} }
......
...@@ -71,7 +71,7 @@ namespace AMDiS { ...@@ -71,7 +71,7 @@ namespace AMDiS {
*/ */
inline void setStrategy(int aStrategy) { inline void setStrategy(int aStrategy) {
strategy = aStrategy; strategy = aStrategy;
}; }
/** \brief /** \brief
* Returns \ref strategy * Returns \ref strategy
...@@ -187,6 +187,12 @@ namespace AMDiS { ...@@ -187,6 +187,12 @@ namespace AMDiS {
* Stores the runtime (in seconds) of some last timestep iterations. * Stores the runtime (in seconds) of some last timestep iterations.
*/ */
std::queue<int> lastIterationsDuration_; std::queue<int> lastIterationsDuration_;
/** \brief
* In debug mode, the adapt loop will print information about timestep
* decreasing and increasing.
*/
bool dbgMode;
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment