Skip to content
Snippets Groups Projects
Commit d1a63450 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

use MonotoneMGStep instead of ContactMMGStep

[[Imported from SVN: r2385]]
parent 6e06f530
No related branches found
No related tags found
No related merge requests found
......@@ -8,16 +8,15 @@
#include <dune/istl/io.hh>
#include <dune/ag-common/boundarypatch.hh>
#include "src/planarrodassembler.hh"
#include <dune/ag-common/projectedblockgsstep.hh>
#include "../contact/src/contactmmgstep.hh"
#include <dune/ag-common/mmgstep.hh>
#include <dune/ag-common/iterativesolver.hh>
#include <dune/ag-common/geomestimator.hh>
#include <dune/ag-common/energynorm.hh>
#include <dune/ag-common/contactobsrestrict.hh>
#include "src/rodwriter.hh"
#include "src/planarrodassembler.hh"
// Number of degrees of freedom:
......@@ -189,27 +188,28 @@ int main (int argc, char *argv[]) try
ProjectedBlockGSStep<MatrixType, VectorType> presmoother;
ProjectedBlockGSStep<MatrixType, VectorType> postsmoother;
ContactMMGStep<MatrixType, VectorType> contactMMGStep(maxlevel+1);
MonotoneMGStep<MatrixType, VectorType> multigridStep(maxlevel+1);
contactMMGStep.setMGType(mu, nu1, nu2);
contactMMGStep.dirichletNodes_ = &dirichletNodes;
contactMMGStep.basesolver_ = &baseSolver;
contactMMGStep.presmoother_ = &presmoother;
contactMMGStep.postsmoother_ = &postsmoother;
contactMMGStep.hasObstacle_ = &hasObstacle;
contactMMGStep.obstacles_ = &trustRegionObstacles;
multigridStep.setMGType(mu, nu1, nu2);
multigridStep.dirichletNodes_ = &dirichletNodes;
multigridStep.basesolver_ = &baseSolver;
multigridStep.presmoother_ = &presmoother;
multigridStep.postsmoother_ = &postsmoother;
multigridStep.hasObstacle_ = &hasObstacle;
multigridStep.obstacles_ = &trustRegionObstacles;
multigridStep.obstacleRestrictor_ = new ContactObsRestriction<VectorType>;
// Create the transfer operators
contactMMGStep.mgTransfer_.resize(maxlevel);
for (int i=0; i<contactMMGStep.mgTransfer_.size(); i++){
multigridStep.mgTransfer_.resize(maxlevel);
for (int i=0; i<multigridStep.mgTransfer_.size(); i++){
TruncatedMGTransfer<VectorType>* newTransferOp = new TruncatedMGTransfer<VectorType>;
newTransferOp->setup(rod,i,i+1);
contactMMGStep.mgTransfer_[i] = newTransferOp;
multigridStep.mgTransfer_[i] = newTransferOp;
}
EnergyNorm<MatrixType, VectorType> energyNorm(contactMMGStep);
EnergyNorm<MatrixType, VectorType> energyNorm(multigridStep);
IterativeSolver<VectorType> solver(&contactMMGStep,
IterativeSolver<VectorType> solver(&multigridStep,
numIt,
tolerance,
&energyNorm,
......@@ -263,20 +263,20 @@ int main (int argc, char *argv[]) try
//std::cout << "rhs: " << std::endl << rhs << std::endl;
//std::cout << "Trust Region obstacles:" << std::endl;
//std::cout << (*contactMMGStep.obstacles_)[maxlevel] << std::endl;
//std::cout << (*multigridStep.obstacles_)[maxlevel] << std::endl;
//solver.iterationStep_->setProblem(hessianMatrix, corr, rhs);
DUNE_THROW(NotImplemented,"IterationStep::setProblem, Matrix uebergeben");
solver.preprocess();
contactMMGStep.preprocess();
multigridStep.preprocess();
// /////////////////////////////
// Solve !
// /////////////////////////////
solver.solve();
corr = contactMMGStep.getSol();
corr = multigridStep.getSol();
//std::cout << "Correction: \n" << corr << std::endl;
......
......@@ -11,11 +11,11 @@
#include <dune/ag-common/boundarypatch.hh>
#include <dune/ag-common/projectedblockgsstep.hh>
#include "../contact/src/contactmmgstep.hh"
#include <dune/ag-common/mmgstep.hh>
#include <dune/ag-common/iterativesolver.hh>
#include <dune/ag-common/geomestimator.hh>
#include <dune/ag-common/energynorm.hh>
#include <dune/ag-common/contactobsrestrict.hh>
#include "src/rodwriter.hh"
#include "src/planarrodassembler.hh"
......@@ -121,22 +121,22 @@ int main (int argc, char *argv[]) try
ProjectedBlockGSStep<MatrixType, VectorType> presmoother;
ProjectedBlockGSStep<MatrixType, VectorType> postsmoother;
ContactMMGStep<MatrixType, VectorType> contactMMGStep(1);
contactMMGStep.setMGType(mu, nu1, nu2);
contactMMGStep.dirichletNodes_ = &dirichletNodes;
contactMMGStep.basesolver_ = &baseSolver;
contactMMGStep.presmoother_ = &presmoother;
contactMMGStep.postsmoother_ = &postsmoother;
contactMMGStep.hasObstacle_ = &hasObstacle;
contactMMGStep.obstacles_ = &trustRegionObstacles;
contactMMGStep.verbosity_ = Solver::QUIET;
MonotoneMGStep<MatrixType, VectorType> multigridStep(1);
multigridStep.setMGType(mu, nu1, nu2);
multigridStep.dirichletNodes_ = &dirichletNodes;
multigridStep.basesolver_ = &baseSolver;
multigridStep.presmoother_ = &presmoother;
multigridStep.postsmoother_ = &postsmoother;
multigridStep.hasObstacle_ = &hasObstacle;
multigridStep.obstacles_ = &trustRegionObstacles;
multigridStep.verbosity_ = Solver::QUIET;
multigridStep.obstacleRestrictor_ = new ContactObsRestriction<VectorType>;
EnergyNorm<MatrixType, VectorType> energyNorm(contactMMGStep);
EnergyNorm<MatrixType, VectorType> energyNorm(multigridStep);
IterativeSolver<VectorType> solver(&contactMMGStep,
IterativeSolver<VectorType> solver(&multigridStep,
numIt,
tolerance,
&energyNorm,
......@@ -226,15 +226,15 @@ int main (int argc, char *argv[]) try
// ////////////////////////////////////
// Create the transfer operators
// ////////////////////////////////////
for (int k=0; k<contactMMGStep.mgTransfer_.size(); k++)
delete(contactMMGStep.mgTransfer_[k]);
for (int k=0; k<multigridStep.mgTransfer_.size(); k++)
delete(multigridStep.mgTransfer_[k]);
contactMMGStep.mgTransfer_.resize(toplevel);
multigridStep.mgTransfer_.resize(toplevel);
for (int i=0; i<contactMMGStep.mgTransfer_.size(); i++){
for (int i=0; i<multigridStep.mgTransfer_.size(); i++){
TruncatedMGTransfer<VectorType>* newTransferOp = new TruncatedMGTransfer<VectorType>;
newTransferOp->setup(grid,i,i+1);
contactMMGStep.mgTransfer_[i] = newTransferOp;
multigridStep.mgTransfer_[i] = newTransferOp;
}
// /////////////////////////////////////////////////////
......@@ -265,7 +265,7 @@ int main (int argc, char *argv[]) try
solver.preprocess();
contactMMGStep.preprocess();
multigridStep.preprocess();
// /////////////////////////////
......@@ -273,7 +273,7 @@ int main (int argc, char *argv[]) try
// /////////////////////////////
solver.solve();
corr = contactMMGStep.getSol();
corr = multigridStep.getSol();
printf("infinity norm of the correction: %g\n", corr.infinity_norm());
if (corr.infinity_norm() < 1e-5) {
......
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