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

* Changed heat example

parent 6f1b3275
No related branches found
No related tags found
No related merge requests found
...@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment