Commit b5f0bcab authored by akbib's avatar akbib Committed by akbib@FU-BERLIN.DE
Browse files

adapt the solver to the new structure of the OgdenAssembler class

[[Imported from SVN: r10470]]
parent c8f6931f
......@@ -14,10 +14,12 @@
#include <dune/ag-common/prolongboundarypatch.hh>
#include <dune/ag-common/sampleonbitfield.hh>
#include <dune/ag-common/readbitfield.hh>
#include <dune-solvers/solvers/quadraticipopt.hh>
#include <dune-solvers/solvers/loopsolver.hh>
#include <dune-solvers/norms/energynorm.hh>
#include <dune-solvers/iterationsteps/mmgstep.hh>
#include <dune/ag-common/functionspacebases/p1nodalbasis.hh>
#include <dune/solvers/solvers/quadraticipopt.hh>
#include <dune/solvers/solvers/loopsolver.hh>
#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/iterationsteps/mmgstep.hh>
// Choose a solver
#define IPOPT
......@@ -27,7 +29,7 @@
//#define IPOPT_BASE
// The grid dimension
const int dim = 2;
const int dim = 3;
using namespace Dune;
......@@ -139,6 +141,7 @@ int main (int argc, char *argv[]) try
VectorType rhs(grid.size(grid.maxLevel(), dim));
VectorType x(grid.size(grid.maxLevel(), dim));
VectorType corr(grid.size(grid.maxLevel(), dim));
OperatorType problemMatrix;
// Initial solution
x = 0;
......@@ -213,9 +216,11 @@ int main (int argc, char *argv[]) try
#else
#warning You have to specify a solver!
#endif
typedef OgdenAssembler<GridType> Assembler;
Assembler ogdenAssembler(grid);
typedef P1NodalBasis<GridType::LeafGridView,double> P1Basis;
typedef OgdenAssembler<P1Basis,P1Basis> Assembler;
P1Basis p1Basis(grid.leafView());
Assembler ogdenAssembler(p1Basis,p1Basis);
for (int i=0; i<numHomotopySteps; i++) {
......@@ -233,23 +238,23 @@ int main (int argc, char *argv[]) try
for (int j=0; j<numNewtonSteps; j++) {
std::cout << "iteration: " << j << std::endl;
std::cout << "iteration: " << j << std::endl;
// Assemble the Jacobi matrix at the current solution
// Assemble the Jacobi matrix at the current solution
rhs = 0;
ogdenAssembler.assembleMatrix(x, rhs);
ogdenAssembler.assembleProblem(problemMatrix,x, rhs);
corr = 0;
corr = 0;
// Set new Dirichlet values in the right hand side
for (int k=0; k<rhs.size(); k++)
for (int l=0; l<dim; l++)
if (dirichletNodes[maxlevel][k][l])
rhs[k][l] = 0;
// Set new Dirichlet values in the right hand side
for (int k=0; k<rhs.size(); k++)
for (int l=0; l<dim; l++)
if (dirichletNodes[maxlevel][k][l])
rhs[k][l] = 0;
solver.setProblem(*ogdenAssembler.matrix_, corr, rhs);
solver.setProblem(problemMatrix, corr, rhs);
solver.preprocess();
solver.preprocess();
#ifdef MULTIGRID
contactMMGStep.preprocess();
#endif
......
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