Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iwr
amdis
Commits
af8397b1
Commit
af8397b1
authored
16 years ago
by
Thomas Witkowski
Browse files
Options
Downloads
Patches
Plain Diff
* Changed heat example
parent
6f1b3275
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demo/src/heat.cc
+21
-50
21 additions, 50 deletions
demo/src/heat.cc
with
21 additions
and
50 deletions
demo/src/heat.cc
+
21
−
50
View file @
af8397b1
...
@@ -21,7 +21,7 @@ public:
...
@@ -21,7 +21,7 @@ public:
*/
*/
double
operator
()(
const
WorldVector
<
double
>&
x
)
const
{
double
operator
()(
const
WorldVector
<
double
>&
x
)
const
{
return
sin
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
(
x
*
x
));
return
sin
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
(
x
*
x
));
}
;
}
};
};
/** \brief
/** \brief
...
@@ -44,7 +44,7 @@ public:
...
@@ -44,7 +44,7 @@ public:
double
ux
=
sin
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
r2
);
double
ux
=
sin
(
M_PI
*
(
*
timePtr
))
*
exp
(
-
10.0
*
r2
);
double
ut
=
M_PI
*
cos
(
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
;
return
ut
-
(
400.0
*
r2
-
20.0
*
dim
)
*
ux
;
}
;
}
};
};
// ===========================================================================
// ===========================================================================
...
@@ -75,7 +75,7 @@ public:
...
@@ -75,7 +75,7 @@ public:
}
}
MSG
(
"theta = %f
\n
"
,
theta
);
MSG
(
"theta = %f
\n
"
,
theta
);
theta1
=
theta
-
1
;
theta1
=
theta
-
1
;
}
;
}
// ===== ProblemInstatBase methods ===================================
// ===== ProblemInstatBase methods ===================================
...
@@ -84,54 +84,45 @@ public:
...
@@ -84,54 +84,45 @@ public:
* set the time in all needed functions!
* set the time in all needed functions!
*/
*/
void
setTime
(
AdaptInfo
*
adaptInfo
)
{
void
setTime
(
AdaptInfo
*
adaptInfo
)
{
rhsTime
=
rhsTime
=
adaptInfo
->
getTime
()
-
(
1
-
theta
)
*
adaptInfo
->
getTimestep
();
adaptInfo
->
getTime
()
-
(
1
-
theta
)
*
adaptInfo
->
getTimestep
();
boundaryTime
=
adaptInfo
->
getTime
();
boundaryTime
=
adaptInfo
->
getTime
();
tau1
=
1.0
/
adaptInfo
->
getTimestep
();
tau1
=
1.0
/
adaptInfo
->
getTimestep
();
}
;
}
void
closeTimestep
(
AdaptInfo
*
adaptInfo
)
{
void
closeTimestep
(
AdaptInfo
*
adaptInfo
)
{
ProblemInstatScal
::
closeTimestep
(
adaptInfo
);
ProblemInstatScal
::
closeTimestep
(
adaptInfo
);
WAIT
;
WAIT
;
}
;
}
// ===== initial problem methods =====================================
// ===== initial problem methods =====================================
/** \brief
/** \brief
* Used by \ref problemInitial to solve the system of the initial problem
* Used by \ref problemInitial to solve the system of the initial problem
*/
*/
void
solve
(
AdaptInfo
*
adaptInfo
)
void
solve
(
AdaptInfo
*
adaptInfo
,
bool
)
{
{
//problemStat->getMesh()->dofCompress();
//boundaryTime = rhsTime = 0.0;
problemStat
->
getSolution
()
->
interpol
(
exactSolution
);
problemStat
->
getSolution
()
->
interpol
(
exactSolution
);
}
;
}
/** \brief
/** \brief
* Used by \ref problemInitial to do error estimation for the initial
* Used by \ref problemInitial to do error estimation for the initial
* problem.
* problem.
*/
*/
void
estimate
(
AdaptInfo
*
adaptInfo
)
void
estimate
(
AdaptInfo
*
adaptInfo
)
{
{
double
errMax
,
errSum
;
double
errMax
,
errSum
;
//boundaryTime = 0.0;
errSum
=
Error
<
double
>::
L2Err
(
*
exactSolution
,
errSum
=
Error
<
double
>::
L2Err
(
*
exactSolution
,
*
(
problemStat
->
getSolution
()),
0
,
&
errMax
,
false
);
*
(
problemStat
->
getSolution
()),
0
,
&
errMax
,
false
);
adaptInfo
->
setEstSum
(
errSum
,
0
);
adaptInfo
->
setEstSum
(
errSum
,
0
);
adaptInfo
->
setEstMax
(
errMax
,
0
);
adaptInfo
->
setEstMax
(
errMax
,
0
);
}
;
}
// ===== setting methods ===============================================
// ===== setting methods ===============================================
/** \brief
/** \brief
* Sets \ref exactSolution;
* Sets \ref exactSolution;
*/
*/
void
setExactSolution
(
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
fct
)
void
setExactSolution
(
AbstractFunction
<
double
,
WorldVector
<
double
>
>
*
fct
)
{
{
exactSolution
=
fct
;
exactSolution
=
fct
;
}
}
...
@@ -140,42 +131,37 @@ public:
...
@@ -140,42 +131,37 @@ public:
/** \brief
/** \brief
* Returns pointer to \ref theta.
* Returns pointer to \ref theta.
*/
*/
double
*
getThetaPtr
()
double
*
getThetaPtr
()
{
{
return
&
theta
;
return
&
theta
;
}
;
}
/** \brief
/** \brief
* Returns pointer to \ref theta1.
* Returns pointer to \ref theta1.
*/
*/
double
*
getTheta1Ptr
()
double
*
getTheta1Ptr
()
{
{
return
&
theta1
;
return
&
theta1
;
}
;
}
/** \brief
/** \brief
* Returns pointer to \ref tau1
* Returns pointer to \ref tau1
*/
*/
double
*
getTau1Ptr
()
double
*
getTau1Ptr
()
{
{
return
&
tau1
;
return
&
tau1
;
}
;
}
/** \brief
/** \brief
* Returns pointer to \ref rhsTime.
* Returns pointer to \ref rhsTime.
*/
*/
double
*
getRHSTimePtr
()
double
*
getRHSTimePtr
()
{
{
return
&
rhsTime
;
return
&
rhsTime
;
}
;
}
/** \brief
/** \brief
* Returns pointer to \ref theta1.
* Returns pointer to \ref theta1.
*/
*/
double
*
getBoundaryTimePtr
()
double
*
getBoundaryTimePtr
()
{
{
return
&
boundaryTime
;
return
&
boundaryTime
;
}
;
}
private
:
private
:
/** \brief
/** \brief
...
@@ -244,21 +230,6 @@ int main(int argc, char** argv)
...
@@ -244,21 +230,6 @@ int main(int argc, char** argv)
heat
,
heat
,
adaptInfoInitial
);
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 =====
// ===== create boundary functions =====
G
*
boundaryFct
=
NEW
G
;
G
*
boundaryFct
=
NEW
G
;
boundaryFct
->
setTimePtr
(
heat
->
getBoundaryTimePtr
());
boundaryFct
->
setTimePtr
(
heat
->
getBoundaryTimePtr
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment