Commit 660a5876 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Bugfix for usage of rhs operators with different basis function degrees.

parent 5d5e8dbb
...@@ -292,9 +292,9 @@ namespace AMDiS { ...@@ -292,9 +292,9 @@ namespace AMDiS {
FUNCNAME("Assembler::matVecAssemble()"); FUNCNAME("Assembler::matVecAssemble()");
Element *el = elInfo->getElement(); Element *el = elInfo->getElement();
double *uhOldLoc = new double[nRow]; std::vector<double> uhOldLoc(operat->uhOld->getFeSpace() == rowFeSpace ? nRow : nCol);
operat->uhOld->getLocalVector(el, uhOldLoc); operat->uhOld->getLocalVector(el, &(uhOldLoc[0]));
if (el != lastMatEl) { if (el != lastMatEl) {
set_to_zero(elementMatrix); set_to_zero(elementMatrix);
...@@ -303,13 +303,11 @@ namespace AMDiS { ...@@ -303,13 +303,11 @@ namespace AMDiS {
for (int i = 0; i < nRow; i++) { for (int i = 0; i < nRow; i++) {
double val = 0.0; double val = 0.0;
for (int j = 0; j < nRow; j++) for (int j = 0; j < nCol; j++)
val += elementMatrix[i][j] * uhOldLoc[j]; val += elementMatrix[i][j] * uhOldLoc[j];
vec[i] += val; vec[i] += val;
} }
delete [] uhOldLoc;
} }
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
/** \file MeshStructure.h */ /** \file MeshStructure.h */
#ifndef AMDIS_MESHSTRUCTURE_H #ifndef AMDIS_MESH_STRUCTURE_H
#define AMDIS_MESHSTRUCTURE_H #define AMDIS_MESH_STRUCTURE_H
#include <vector> #include <vector>
#include "AMDiS_fwd.h" #include "AMDiS_fwd.h"
...@@ -166,6 +166,7 @@ namespace AMDiS { ...@@ -166,6 +166,7 @@ namespace AMDiS {
MeshStructure *result); MeshStructure *result);
protected: protected:
/// Mesh structure code.
std::vector<unsigned long int> code; std::vector<unsigned long int> code;
int currentIndex; int currentIndex;
...@@ -178,6 +179,7 @@ namespace AMDiS { ...@@ -178,6 +179,7 @@ namespace AMDiS {
int nElements; int nElements;
/// If true, some output is printed to screen during mesh structure code generation.
bool debugMode; bool debugMode;
static const int unsignedLongSize; static const int unsignedLongSize;
......
...@@ -15,16 +15,14 @@ namespace AMDiS { ...@@ -15,16 +15,14 @@ namespace AMDiS {
{ {
stageSolution = new SystemVector(*solution); stageSolution = new SystemVector(*solution);
unVec = new SystemVector(*solution); unVec = new SystemVector(*solution);
timeRhsVec = new SystemVector(*solution);
newUn = new SystemVector(*solution); newUn = new SystemVector(*solution);
tmp = new SystemVector(*solution); tmp = new SystemVector(*solution);
lowSol = new SystemVector(*solution); lowSol = new SystemVector(*solution);
stageSolutions.resize(rm->getStages()); stageSolutions.resize(rm->getStages());
for (int i = 0; i < rm->getStages(); i++) for (int i = 0; i < rm->getStages(); i++)
stageSolutions[i] = new SystemVector(*solution); stageSolutions[i] = new SystemVector(*solution);
phiSum = new DOFVector<double>(feSpaces[0], "phiSum");
tmpDof = new DOFVector<double>(feSpaces[0], "phiSum");
} }
...@@ -51,11 +49,11 @@ namespace AMDiS { ...@@ -51,11 +49,11 @@ namespace AMDiS {
*stageSolution += *tmp; *stageSolution += *tmp;
} }
phiSum->set(0.0); timeRhsVec->set(0.0);
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
*tmpDof = *(stageSolutions[j]->getDOFVector(0)); *tmp = *(stageSolutions[j]);
*tmpDof *= (rm->getC(i, j) / *tauPtr); *tmp *= (rm->getC(i, j) / *tauPtr);
*phiSum += *tmpDof; *timeRhsVec += *tmp;
} }
ProblemVec::buildAfterCoarsen(adaptInfo, flag, (i == 0), asmVector); ProblemVec::buildAfterCoarsen(adaptInfo, flag, (i == 0), asmVector);
...@@ -119,7 +117,7 @@ namespace AMDiS { ...@@ -119,7 +117,7 @@ namespace AMDiS {
ProblemVec::addMatrixOperator(op, row, col, tauGamma, tauGamma); ProblemVec::addMatrixOperator(op, row, col, tauGamma, tauGamma);
Operator *opRhs = new Operator(componentSpaces[row]); Operator *opRhs = new Operator(componentSpaces[row]);
opRhs->addZeroOrderTerm(new VecAtQP_ZOT(phiSum, new IdFunc())); opRhs->addZeroOrderTerm(new VecAtQP_ZOT(timeRhsVec->getDOFVector(col), new IdFunc()));
ProblemVec::addVectorOperator(opRhs, row, &minusOne, &minusOne); ProblemVec::addVectorOperator(opRhs, row, &minusOne, &minusOne);
} }
......
...@@ -101,12 +101,10 @@ namespace AMDiS { ...@@ -101,12 +101,10 @@ namespace AMDiS {
protected: protected:
RosenbrockMethod *rm; RosenbrockMethod *rm;
SystemVector *stageSolution, *unVec, *newUn, *tmp, *lowSol; SystemVector *stageSolution, *unVec, *timeRhsVec, *newUn, *tmp, *lowSol;
std::vector<SystemVector*> stageSolutions; std::vector<SystemVector*> stageSolutions;
DOFVector<double> *phiSum, *tmpDof;
bool first; bool first;
double minusOne; double minusOne;
......
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