Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Backofen, Rainer
amdis
Commits
9df9d4af
Commit
9df9d4af
authored
Dec 03, 2008
by
Thomas Witkowski
Browse files
* Added debug information output to AdaptInstationary
parent
9fbc0f9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/AdaptInfo.h
View file @
9df9d4af
...
...
@@ -84,7 +84,7 @@ namespace AMDiS {
spaceTolerance
=
totalTol
*
relSpaceErr
;
timeTolerance
=
totalTol
*
relTimeErr
*
timeTheta1
;
timeErrLow
=
totalTol
*
relTimeErr
*
timeTheta2
;
}
;
}
/** \brief
* Sum of all error estimates
...
...
@@ -192,7 +192,7 @@ namespace AMDiS {
scalContents
[
i
]
=
new
ScalContent
(
name
+
std
::
string
(
number
));
}
}
}
;
}
/** \brief
* Destructor.
...
...
@@ -201,7 +201,7 @@ namespace AMDiS {
for
(
int
i
=
0
;
i
<
scalContents
.
getSize
();
i
++
)
{
delete
scalContents
[
i
];
}
}
;
}
inline
void
reset
()
{
...
...
@@ -215,7 +215,7 @@ namespace AMDiS {
solverResidual
=
0.0
;
GET_PARAMETER
(
0
,
name
+
"->timestep"
,
"%f"
,
&
timestep
);
}
;
}
/** \brief
* Returns whether space tolerance is reached.
...
...
@@ -228,7 +228,7 @@ namespace AMDiS {
}
}
return
true
;
}
;
}
/** \brief
* Returns whether space tolerance of component i is reached.
...
...
@@ -239,7 +239,7 @@ namespace AMDiS {
}
else
{
return
true
;
}
}
;
}
/** \brief
* Returns whether time tolerance is reached.
...
...
@@ -252,7 +252,7 @@ namespace AMDiS {
}
}
return
true
;
}
;
}
/** \brief
* Returns whether time tolerance of component i is reached.
...
...
@@ -263,7 +263,7 @@ namespace AMDiS {
}
else
{
return
true
;
}
}
;
}
/** \brief
* Returns whether time error is under its lower bound.
...
...
@@ -276,210 +276,220 @@ namespace AMDiS {
}
}
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
* Returns \ref spaceIteration.
*/
inline
int
getSpaceIteration
()
{
return
spaceIteration
;
}
;
}
/** \brief
* Sets \ref spaceIteration.
*/
inline
void
setSpaceIteration
(
int
it
)
{
spaceIteration
=
it
;
}
;
}
/** \brief
* Returns \ref maxSpaceIteration.
*/
inline
int
getMaxSpaceIteration
()
{
return
maxSpaceIteration
;
}
;
}
/** \brief
* Sets \ref maxSpaceIteration.
*/
inline
void
setMaxSpaceIteration
(
int
it
)
{
maxSpaceIteration
=
it
;
}
;
}
/** \brief
* Increments \ref spaceIteration by 1;
*/
inline
void
incSpaceIteration
()
{
spaceIteration
++
;
}
;
}
/** \brief
* Sets \ref timestepIteration.
*/
inline
void
setTimestepIteration
(
int
it
)
{
timestepIteration
=
it
;
}
;
}
/** \brief
* Returns \ref timestepIteration.
*/
inline
int
getTimestepIteration
()
{
return
timestepIteration
;
}
;
}
/** \brief
* Increments \ref timestepIteration by 1;
*/
inline
void
incTimestepIteration
()
{
timestepIteration
++
;
}
;
}
/** \brief
* Returns \ref maxTimestepIteration.
*/
inline
int
getMaxTimestepIteration
()
{
return
maxTimestepIteration
;
}
;
}
/** \brief
* Sets \ref maxTimestepIteration.
*/
inline
void
setMaxTimestepIteration
(
int
it
)
{
maxTimestepIteration
=
it
;
}
;
}
/** \brief
* Sets \ref timeIteration.
*/
inline
void
setTimeIteration
(
int
it
)
{
timeIteration
=
it
;
}
;
}
/** \brief
* Returns \ref timeIteration.
*/
inline
int
getTimeIteration
()
{
return
timeIteration
;
}
;
}
/** \brief
* Increments \ref timesIteration by 1;
*/
inline
void
incTimeIteration
()
{
timeIteration
++
;
}
;
}
/** \brief
* Returns \ref maxTimeIteration.
*/
inline
int
getMaxTimeIteration
()
{
return
maxTimeIteration
;
}
;
}
/** \brief
* Sets \ref maxTimeIteration.
*/
inline
void
setMaxTimeIteration
(
int
it
)
{
maxTimeIteration
=
it
;
}
;
}
/** \brief
* Returns \ref timestepNumber.
*/
inline
int
getTimestepNumber
()
{
return
timestepNumber
;
}
;
}
/** \brief
* Increments \ref timestepNumber by 1;
*/
inline
void
incTimestepNumber
()
{
timestepNumber
++
;
}
;
}
/** \brief
* Sets \ref est_sum.
*/
inline
void
setEstSum
(
double
e
,
int
index
)
{
scalContents
[
index
]
->
est_sum
=
e
;
}
;
}
/** \brief
* Sets \ref est_max.
*/
inline
void
setEstMax
(
double
e
,
int
index
)
{
scalContents
[
index
]
->
est_max
=
e
;
}
;
}
/** \brief
* Sets \ref est_max.
*/
inline
void
setTimeEstMax
(
double
e
,
int
index
)
{
scalContents
[
index
]
->
est_t_max
=
e
;
}
;
}
/** \brief
* Sets \ref est_t_sum.
*/
inline
void
setTimeEstSum
(
double
e
,
int
index
)
{
scalContents
[
index
]
->
est_t_sum
=
e
;
}
;
}
/** \brief
* Returns \ref est_sum.
*/
inline
double
getEstSum
(
int
index
)
{
return
scalContents
[
index
]
->
est_sum
;
}
;
}
/** \brief
* Returns \ref est_t_sum.
*/
inline
double
getEstTSum
(
int
index
)
{
return
scalContents
[
index
]
->
est_t_sum
;
}
;
}
/** \brief
* Returns \ref est_max.
*/
inline
double
getEstMax
(
int
index
)
{
return
scalContents
[
index
]
->
est_max
;
}
;
}
/** \brief
* Returns \ref est_max.
*/
inline
double
getTimeEstMax
(
int
index
)
{
return
scalContents
[
index
]
->
est_t_max
;
}
;
}
/** \brief
* Returns \ref est_t_sum.
*/
inline
double
getTimeEstSum
(
int
index
)
{
return
scalContents
[
index
]
->
est_t_sum
;
}
;
}
/** \brief
* Returns \ref spaceTolerance.
*/
inline
double
getSpaceTolerance
(
int
index
)
{
return
scalContents
[
index
]
->
spaceTolerance
;
}
;
}
/** \brief
* Sets \ref spaceTolerance.
*/
inline
void
setSpaceTolerance
(
int
index
,
double
tol
)
{
scalContents
[
index
]
->
spaceTolerance
=
tol
;
}
;
}
/** \brief
* Returns \ref timeTolerance.
*/
inline
double
getTimeTolerance
(
int
index
)
{
return
scalContents
[
index
]
->
timeTolerance
;
}
;
}
/** \brief
* Sets \ref time
...
...
@@ -492,21 +502,21 @@ namespace AMDiS {
time
=
startTime
;
return
time
;
}
;
}
/** \brief
* Gets \ref time
*/
inline
double
getTime
()
{
return
time
;
}
;
}
/** \brief
* Gets \ref &time
*/
inline
double
*
getTimePtr
()
{
return
&
time
;
}
;
}
/** \brief
* Sets \ref timestep
...
...
@@ -524,162 +534,162 @@ namespace AMDiS {
}
return
timestep
;
}
;
}
/** \brief
* Gets \ref timestep
*/
inline
double
getTimestep
()
{
return
timestep
;
}
;
}
/** \brief
* Sets \ref minTimestep
*/
inline
void
setMinTimestep
(
double
t
)
{
minTimestep
=
t
;
}
;
}
/** \brief
* Gets \ref minTimestep
*/
inline
double
getMinTimestep
()
{
return
minTimestep
;
}
;
}
/** \brief
* Sets \ref maxTimestep
*/
inline
void
setMaxTimestep
(
double
t
)
{
maxTimestep
=
t
;
}
;
}
/** \brief
* Gets \ref maxTimestep
*/
inline
double
getMaxTimestep
()
{
return
maxTimestep
;
}
;
}
/** \brief
* Gets \ref ×tep
*/
inline
double
*
getTimestepPtr
()
{
return
&
timestep
;
}
;
}
/** \brief
* Sets \ref startTime = time
*/
inline
void
setStartTime
(
double
time
)
{
startTime
=
time
;
}
;
}
/** \brief
* Sets \ref endTime = time
*/
inline
void
setEndTime
(
double
time
)
{
endTime
=
time
;
}
;
}
/** \brief
* Returns \ref startTime
*/
inline
double
getStartTime
()
{
return
startTime
;
}
;
}
/** \brief
* Returns \ref endTime
*/
inline
double
getEndTime
()
{
return
endTime
;
}
;
}
/** \brief
* Returns \ref timeErrLow.
*/
inline
double
getTimeErrLow
(
int
index
)
{
return
scalContents
[
index
]
->
timeErrLow
;
}
;
}
/** \brief
* Returns whether coarsening is allowed or not.
*/
inline
bool
isCoarseningAllowed
(
int
index
)
{
return
(
scalContents
[
index
]
->
coarsenAllowed
==
1
);
}
;
}
/** \brief
* Returns whether coarsening is allowed or not.
*/
inline
bool
isRefinementAllowed
(
int
index
)
{
return
(
scalContents
[
index
]
->
refinementAllowed
==
1
);
}
;
}
/** \brief
*
*/
inline
void
allowRefinement
(
bool
allow
,
int
index
)
{
scalContents
[
index
]
->
refinementAllowed
=
allow
;
}
;
}
/** \brief
*
*/
inline
void
allowCoarsening
(
bool
allow
,
int
index
)
{
scalContents
[
index
]
->
coarsenAllowed
=
allow
;
}
;
}
/** \brief
* Returns \ref refineBisections
*/
inline
const
int
getRefineBisections
(
int
index
)
const
{
return
scalContents
[
index
]
->
refineBisections
;
}
;
}
/** \brief
* Returns \ref coarseBisections
*/
inline
const
int
getCoarseBisections
(
int
index
)
const
{
return
scalContents
[
index
]
->
coarseBisections
;
}
;
}
inline
int
getSize
()
{
return
scalContents
.
getSize
();
}
;
}
inline
void
setSolverIterations
(
int
it
)
{
solverIterations
=
it
;
}
;
}
inline
int
getSolverIterations
()
{
return
solverIterations
;
}
;
}
inline
void
setMaxSolverIterations
(
int
it
)
{
maxSolverIterations
=
it
;
}
;
}
inline
int
getMaxSolverIterations
()
{
return
maxSolverIterations
;
}
;
}
inline
void
setSolverTolerance
(
double
tol
)
{
solverTolerance
=
tol
;
}
;
}
inline
double
getSolverTolerance
()
{
return
solverTolerance
;
}
;
}
inline
void
setSolverResidual
(
double
res
)
{
solverResidual
=
res
;
}
;
}
inline
double
getSolverResidual
()
{
return
solverResidual
;
}
;
}
/** \brief
* Returns true, if the adaptive procedure was deserialized from a file.
...
...
AMDiS/src/AdaptInstationary.cc
View file @
9df9d4af
...
...
@@ -15,7 +15,8 @@ namespace AMDiS {
AdaptInfo
*
initialInfo
,
time_t
initialTimestamp
)
:
AdaptBase
(
name
,
problemStat
,
info
,
problemInstat
,
initialInfo
),
breakWhenStable
(
0
)
breakWhenStable
(
0
),
dbgMode
(
false
)
{
FUNCNAME
(
"AdaptInstationary::AdaptInstationary()"
);
...
...
@@ -162,27 +163,40 @@ namespace AMDiS {
if
(
!
fixedTimestep_
&&
adaptInfo_
->
timeErrorLow
())
{
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
()
{
FUNCNAME
(
"AdaptInstationary::oneTimestep"
);
FUNCNAME
(
"AdaptInstationary::oneTimestep
()
"
);
adaptInfo_
->
setTimestepIteration
(
0
);
switch
(
strategy
)
{
case
0
:
explicitTimeStrategy
();
break
;
case
1
:
implicitTimeStrategy
();
break
;
default:
MSG
(
"unknown strategy = %d; use explicit strategy
\n
"
,
strategy
);
explicitTimeStrategy
();
}
switch
(
strategy
)
{
case
0
:
explicitTimeStrategy
();
break
;
case
1
:
implicitTimeStrategy
();
break
;
default:
MSG
(
"unknown strategy = %d; use explicit strategy
\n
"
,
strategy
);
explicitTimeStrategy
();
}
adaptInfo_
->
incTimestepNumber
();
}
...
...
AMDiS/src/AdaptInstationary.h
View file @
9df9d4af
...
...
@@ -71,7 +71,7 @@ namespace AMDiS {
*/
inline
void
setStrategy
(
int
aStrategy
)
{
strategy
=
aStrategy
;
}
;
}
/** \brief
* Returns \ref strategy
...
...
@@ -187,6 +187,12 @@ namespace AMDiS {
* Stores the runtime (in seconds) of some last timestep iterations.
*/
std
::
queue
<
int
>
lastIterationsDuration_
;
/** \brief
* In debug mode, the adapt loop will print information about timestep
* decreasing and increasing.
*/
bool
dbgMode
;
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment