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

Added more support for Rosenbrock method.

parent a1095c6a
No related branches found
No related tags found
No related merge requests found
...@@ -3,3 +3,8 @@ Rev 1210: ...@@ -3,3 +3,8 @@ Rev 1210:
"FeSpace" geändert. Dies betrifft insbesondere "getFESpace()", "FeSpace" geändert. Dies betrifft insbesondere "getFESpace()",
das nun "getFeSpace()" heißt. das nun "getFeSpace()" heißt.
* ProblemVec::getRHS() -> ProblemVec::getRhs() * ProblemVec::getRHS() -> ProblemVec::getRhs()
Rev 1231:
* Im Operator-Konstruktor brauchen die Flags, daher MATRIX_OPERATOR und
VECTOR_OPERATOR nicht mehr angegeben werden. Sollten diese gesetzt sein,
so compiliert das Programm noch, aber es wird eine entsprechende
Fehlermeldung ausgegeben und das Programm bricht ab.
...@@ -32,6 +32,8 @@ namespace AMDiS { ...@@ -32,6 +32,8 @@ namespace AMDiS {
problemStat->setRosenbrockMethod(rosenbrockMethod); problemStat->setRosenbrockMethod(rosenbrockMethod);
adaptInfo->setRosenbrockMode(true); adaptInfo->setRosenbrockMode(true);
problemStat->setTauGamma(&tauGamma);
} }
......
...@@ -31,6 +31,10 @@ namespace AMDiS { ...@@ -31,6 +31,10 @@ namespace AMDiS {
void RosenbrockStationary::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag, void RosenbrockStationary::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool asmMatrix, bool asmVector) bool asmMatrix, bool asmVector)
{ {
FUNCNAME("RosenbrockStationary::buildAfterCoarsen()");
TEST_EXIT(tauPtr)("No tau pointer defined in stationary problem!\n");
if (first) { if (first) {
first = false; first = false;
*unVec = *solution; *unVec = *solution;
...@@ -79,4 +83,44 @@ namespace AMDiS { ...@@ -79,4 +83,44 @@ namespace AMDiS {
void RosenbrockStationary::solve(AdaptInfo *adaptInfo, bool fixedMatrix) void RosenbrockStationary::solve(AdaptInfo *adaptInfo, bool fixedMatrix)
{} {}
void RosenbrockStationary::addOperator(Operator &op, int row, int col,
double *factor, double *estFactor)
{
FUNCNAME("RosenbrockStationary::addOperator()");
TEST_EXIT(op.getUhOld() == NULL)("UhOld is not allowed to be set!\n");
op.setUhOld(stageSolution->getDOFVector(col));
ProblemVec::addVectorOperator(op, row);
}
void RosenbrockStationary::addJacobianOperator(Operator &op, int row, int col,
double *factor, double *estFactor)
{
FUNCNAME("RosenbrockStationary::addJacobianOperator()");
TEST_EXIT(factor == NULL)("Not yet implemented!\n");
TEST_EXIT(estFactor == NULL)("Not yet implemented!\n");
ProblemVec::addMatrixOperator(op, row, col, &minusOne, &minusOne);
}
void RosenbrockStationary::addTimeOperator(int row, int col)
{
FUNCNAME("RosenbrockStationary::addTimeOperator()");
TEST_EXIT(tauGamma)("This should not happen!\n");
Operator *op = new Operator(componentSpaces[row], componentSpaces[col]);
op->addZeroOrderTerm(new Simple_ZOT);
ProblemVec::addMatrixOperator(op, row, col, tauGamma, tauGamma);
Operator *opRhs = new Operator(componentSpaces[row]);
opRhs->addZeroOrderTerm(new VecAtQP_ZOT(phiSum, new IdFunc()));
ProblemVec::addVectorOperator(opRhs, row, &minusOne, &minusOne);
}
} }
...@@ -32,29 +32,36 @@ namespace AMDiS { ...@@ -32,29 +32,36 @@ namespace AMDiS {
class RosenbrockStationary : public ProblemVec class RosenbrockStationary : public ProblemVec
{ {
public: public:
class IdFunc : public AbstractFunction<double, double>
{
public:
IdFunc()
: AbstractFunction<double, double>(1)
{}
double operator()(const double& u) const
{
return u;
}
};
RosenbrockStationary(std::string name) RosenbrockStationary(std::string name)
: ProblemVec(name), : ProblemVec(name),
first(true) first(true),
minusOne(-1.0),
tauPtr(NULL),
tauGamma(NULL)
{} {}
DOFVector<double>* getStageSolution(int i)
{
return stageSolution->getDOFVector(i);
}
DOFVector<double>* getUnVec(int i) DOFVector<double>* getUnVec(int i)
{ {
return unVec->getDOFVector(i); return unVec->getDOFVector(i);
} }
DOFVector<double>* getPhiSum() DOFVector<double>* getStageSolution(int i)
{
return phiSum;
}
void setTauPtr(double *ptr)
{ {
tauPtr = ptr; return stageSolution->getDOFVector(i);
} }
void acceptTimestep(); void acceptTimestep();
...@@ -70,6 +77,24 @@ namespace AMDiS { ...@@ -70,6 +77,24 @@ namespace AMDiS {
init(); init();
} }
void addOperator(Operator &op, int row, int col,
double *factor = NULL, double *estFactor = NULL);
void addJacobianOperator(Operator &op, int row, int col,
double *factor = NULL, double *estFactor = NULL);
void addTimeOperator(int i, int j);
void setTau(double *ptr)
{
tauPtr = ptr;
}
void setTauGamma(double *ptr)
{
tauGamma = ptr;
}
protected: protected:
void init(); void init();
...@@ -82,9 +107,13 @@ namespace AMDiS { ...@@ -82,9 +107,13 @@ namespace AMDiS {
DOFVector<double> *phiSum, *tmpDof; DOFVector<double> *phiSum, *tmpDof;
bool first;
double minusOne;
double *tauPtr; double *tauPtr;
bool first; double *tauGamma;
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment