Commit 59ec2774 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Word-around for a bug in solving Rosenbrock system using UMFPACK.

parent 377e20dc
......@@ -241,6 +241,7 @@ namespace AMDiS {
} else {
for (int j = 0; j < nCol; j++) {
DegreeOfFreedom col = colIndices[j];
if (fabs(elMat[i][j]) > 1e-10)
ins[row][col] += elMat[i][j];
}
}
......
......@@ -437,6 +437,7 @@ namespace AMDiS {
std::ofstream out;
out.open(filename.c_str());
out.precision(20);
for (cursor_type cursor = begin<major>(mat.getBaseMatrix()),
cend = end<major>(mat.getBaseMatrix()); cursor != cend; ++cursor)
......
......@@ -25,11 +25,10 @@
#include <iostream>
namespace AMDiS {
template< typename MTLMatrix, typename MTLVector, typename Worker >
class MTL4Solver : public OEMSolver {
protected:
Worker worker;
template< typename Matrix, typename Vector, typename Mapper >
......@@ -60,10 +59,7 @@ namespace AMDiS {
MTL4Solver(std::string n):
OEMSolver(n),
worker(this)
{
FUNCNAME("MTL4Solver()");
}
{}
virtual int solveSystem(const SolverMatrix<Matrix<DOFMatrix*> >& A,
SystemVector& x,
......
......@@ -73,9 +73,7 @@ namespace AMDiS {
print_cycle(100),
iterations(-1),
error(-1),
multipleRhs(false)/*,
leftPrecon(NULL),
rightPrecon(NULL)*/
multipleRhs(false)
{}
///
......@@ -99,40 +97,6 @@ namespace AMDiS {
SystemVector& x,
SystemVector& b,
VectorialMapper&) = 0;
#if 0
{
int ns = x.getSize(), // Number of systems.
size = x.getUsedSize(); // Size of all DOFVectors
// Copy vectors
mtl::dense_vector<value_type> xx(size), bb(size);
xx << x;
bb << b
/* for (int i = 0, counter = 0; i < ns; i++) {
DOFVector<double>::Iterator it_b(b.getDOFVector(i), USED_DOFS);
DOFVector<double>::Iterator it_x(x.getDOFVector(i), USED_DOFS);
for (it_b.reset(), it_x.reset(); !it_b.end(); ++it_b, ++it_x) {
bb[counter] = *it_b;
xx[counter] = *it_x;
counter++;
}
}
*/
// Solver on DOFVector for single system
DOFMatrix::base_matrix_type baseA;
baseA << A;
int r = solveSystem(baseA, xx, bb);
for (int i = 0, counter = 0; i < ns; i++) {
DOFVector<double>::Iterator it(x.getDOFVector(i), USED_DOFS);
for (it.reset(); !it.end(); ++it)
*it = xx[counter++];
}
return r;
}
#endif
inline int solveSystem(const SolverMatrix< Matrix< DOFMatrix* > >& A,
SystemVector& x,
......@@ -306,13 +270,6 @@ namespace AMDiS {
* as they can do the factorization of the matrix only once.
*/
bool multipleRhs;
#if 0
/// Left preconditioner (ignored by some iterative solvers and by UmfPack)
PreconCreator *leftPrecon;
/// Right preconditioner (ignored by some iterative solvers and by UmfPack)
PreconCreator *rightPrecon;
#endif
};
/**
......
......@@ -634,6 +634,8 @@ namespace AMDiS {
{
FUNCNAME("ProblemStat::buildAfterCoarsen()");
VtkWriter::writeFile(rhs->getDOFVector(0), "test.vtu");
// buildAfterCoarsen_sebastianMode(adaptInfo, flag);
// return;
......
......@@ -52,6 +52,8 @@ namespace AMDiS {
store_symbolic(0),
symmetric_strategy(0)
{
FUNCNAME("Umfpack_runner::Umfpack_runner()");
TEST_EXIT_DBG(oem_ != NULL)("Need real OEMSolver\n");
Parameters::get(oem.getName() + "->store symbolic", store_symbolic);
Parameters::get(oem.getName() + "->symmetric strategy", symmetric_strategy);
......@@ -60,7 +62,7 @@ namespace AMDiS {
template< typename Vector>
int solve(const Matrix& A, Vector& x, Vector& b)
{
FUNCNAME("(UmfPackSolver.h)::solve()");
FUNCNAME("Umfpack_runner::solve()");
if (!solver) {
if (!symmetric_strategy)
solver = new mtl::matrix::umfpack::solver<matrix_type>(A);
......@@ -68,7 +70,6 @@ namespace AMDiS {
solver = new mtl::matrix::umfpack::solver<matrix_type>(A, UMFPACK_STRATEGY_SYMMETRIC);
} else {
if (!oem.getMultipleRhs()) {
if (store_symbolic)
solver->update_numeric();
else
......@@ -77,16 +78,14 @@ namespace AMDiS {
}
int code = (*solver)(x, b);
if( oem.getInfo() > 0) {
if (oem.getInfo() > 0) {
mtl::dense_vector<typename matrix_type::value_type> r(b);
r -= A * x;
double residual = two_norm(r);
oem.setResidual(residual);
oem.setErrorCode(code);
std::cout << "UmfPackSolver: ||b-Ax|| = " << residual << "\n";
if (residual > oem.getTolerance()) {
ERROR_EXIT("Tolerance tol=%e could not be reached!\n Set tolerance by '->solver->tolerance:' \n", oem.getTolerance());
}
TEST_EXIT(residual <= oem.getTolerance())("Tolerance tol = %e could not be reached!\n Set tolerance by '->solver->tolerance:' \n", oem.getTolerance());
}
return code;
......@@ -94,7 +93,7 @@ namespace AMDiS {
~Umfpack_runner()
{
if(!solver)
if (!solver)
delete solver;
}
......
......@@ -14,6 +14,7 @@
#include "ProblemStat.h"
#include "SystemVector.h"
#include "OEMSolver.h"
#include "Debug.h"
namespace AMDiS {
......@@ -79,7 +80,7 @@ namespace AMDiS {
}
ProblemStatSeq::buildAfterCoarsen(adaptInfo, flag, (i == 0), asmVector);
solver->setMultipleRhs(i != 0);
// solver->setMultipleRhs(i != 0);
ProblemStatSeq::solve(adaptInfo);
*(stageSolutions[i]) = *solution;
......
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