Commit ffd0307d authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Added more support for Rosenbrock method.

parent a1095c6a
......@@ -3,3 +3,8 @@ Rev 1210:
"FeSpace" geändert. Dies betrifft insbesondere "getFESpace()",
das nun "getFeSpace()" heißt.
* 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 {
problemStat->setRosenbrockMethod(rosenbrockMethod);
adaptInfo->setRosenbrockMode(true);
problemStat->setTauGamma(&tauGamma);
}
......
......@@ -31,6 +31,10 @@ namespace AMDiS {
void RosenbrockStationary::buildAfterCoarsen(AdaptInfo *adaptInfo, Flag flag,
bool asmMatrix, bool asmVector)
{
FUNCNAME("RosenbrockStationary::buildAfterCoarsen()");
TEST_EXIT(tauPtr)("No tau pointer defined in stationary problem!\n");
if (first) {
first = false;
*unVec = *solution;
......@@ -79,4 +83,44 @@ namespace AMDiS {
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 {
class RosenbrockStationary : public ProblemVec
{
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)
: 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)
{
return unVec->getDOFVector(i);
}
DOFVector<double>* getPhiSum()
{
return phiSum;
}
void setTauPtr(double *ptr)
DOFVector<double>* getStageSolution(int i)
{
tauPtr = ptr;
return stageSolution->getDOFVector(i);
}
void acceptTimestep();
......@@ -70,6 +77,24 @@ namespace AMDiS {
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:
void init();
......@@ -82,9 +107,13 @@ namespace AMDiS {
DOFVector<double> *phiSum, *tmpDof;
bool first;
double minusOne;
double *tauPtr;
bool first;
double *tauGamma;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment