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
af8397b1
Commit
af8397b1
authored
Dec 03, 2008
by
Thomas Witkowski
Browse files
* Changed heat example
parent
6f1b3275
Changes
1
Hide whitespace changes
Inline
Side-by-side
demo/src/heat.cc
View file @
af8397b1
...
...
@@ -21,7 +21,7 @@ public:
*/
double
operator
()(
const
WorldVector
<
double
>&
x
)
const
{
return
sin
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
(
x
*
x
));
}
;
}
};
/** \brief
...
...
@@ -44,7 +44,7 @@ public:
double
ux
=
sin
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
r2
);
double
ut
=
M_PI
*
cos
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
r2
);
return
ut
-
(
400.0
*
r2
-
20.0
*
dim
)
*
ux
;
}
;
}
};
// ===========================================================================
...
...
@@ -75,7 +75,7 @@ public:
}
MSG
(
"theta = %f
\n
"
,
theta
);
theta1
=
theta
-
1
;
}
;
}
// ===== ProblemInstatBase methods ===================================
...
...
@@ -84,54 +84,45 @@ public:
* set the time in all needed functions!
*/
void
setTime
(
AdaptInfo
*
adaptInfo
)
{
rhsTime
=
adaptInfo
->
getTime
()
-
(
1
-
theta
)
*
adaptInfo
->
getTimestep
();
rhsTime
=
adaptInfo
->
getTime
()
-
(
1
-
theta
)
*
adaptInfo
->
getTimestep
();
boundaryTime
=
adaptInfo
->
getTime
();
tau1
=
1.0
/
adaptInfo
->
getTimestep
();
}
;
}
void
closeTimestep
(
AdaptInfo
*
adaptInfo
)
{
ProblemInstatScal
::
closeTimestep
(
adaptInfo
);
WAIT
;
}
;
}
// ===== initial problem methods =====================================
/** \brief
* Used by \ref problemInitial to solve the system of the initial problem
*/
void
solve
(
AdaptInfo
*
adaptInfo
)
{
//problemStat->getMesh()->dofCompress();
//boundaryTime = rhsTime = 0.0;
void
solve
(
AdaptInfo
*
adaptInfo
,
bool
)
{
problemStat
->
getSolution
()
->
interpol
(
exactSolution
);
}
;
}
/** \brief
* Used by \ref problemInitial to do error estimation for the initial
* problem.
*/
void
estimate
(
AdaptInfo
*
adaptInfo
)
{
void
estimate
(
AdaptInfo
*
adaptInfo
)
{
double
errMax
,
errSum
;
//boundaryTime = 0.0;
errSum
=
Error
<
double
>::
L2Err
(
*
exactSolution
,
*
(
problemStat
->
getSolution
()),
0
,
&
errMax
,
false
);
adaptInfo
->
setEstSum
(
errSum
,
0
);
adaptInfo
->
setEstMax
(
errMax
,
0
);
}
;
}
// ===== setting methods ===============================================
/** \brief
* Sets \ref exactSolution;
*/
void
setExactSolution
(
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
fct
)
{
void
setExactSolution
(
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
fct
)
{
exactSolution
=
fct
;
}
...
...
@@ -140,42 +131,37 @@ public:
/** \brief
* Returns pointer to \ref theta.
*/
double
*
getThetaPtr
()
{
double
*
getThetaPtr
()
{
return
&
theta
;
}
;
}
/** \brief
* Returns pointer to \ref theta1.
*/
double
*
getTheta1Ptr
()
{
double
*
getTheta1Ptr
()
{
return
&
theta1
;
}
;
}
/** \brief
* Returns pointer to \ref tau1
*/
double
*
getTau1Ptr
()
{
double
*
getTau1Ptr
()
{
return
&
tau1
;
}
;
}
/** \brief
* Returns pointer to \ref rhsTime.
*/
double
*
getRHSTimePtr
()
{
double
*
getRHSTimePtr
()
{
return
&
rhsTime
;
}
;
}
/** \brief
* Returns pointer to \ref theta1.
*/
double
*
getBoundaryTimePtr
()
{
double
*
getBoundaryTimePtr
()
{
return
&
boundaryTime
;
}
;
}
private:
/** \brief
...
...
@@ -244,21 +230,6 @@ int main(int argc, char** argv)
heat
,
adaptInfoInitial
);
// double fac = (*(heat->getThetaPtr())) != 0 ? 1.0 : 1.0e-3;
// int nRefine = 0, dim = heatSpace->getMesh()->getDim();;
//
// GET_PARAMETER(0, heatSpace->getMesh()->getName()
// + "->global refinements", "%d", &nRefine);
// if((*(heat->getThetaPtr())) == 0.5) {
// (*(adaptInfo->getTimestepPtr())) *=
// fac * std::pow(2.0, ((double) -nRefine)/dim);
// } else {
// (*(adaptInfo->getTimestepPtr())) *=
// fac * std::pow(2.0, -nRefine);
// }
// ===== create boundary functions =====
G
*
boundaryFct
=
NEW
G
;
boundaryFct
->
setTimePtr
(
heat
->
getBoundaryTimePtr
());
...
...
Write
Preview
Markdown
is supported
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