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

adapted the solver to recent changes in the other moduls and removed all dune-disc functions

[[Imported from SVN: r10477]]
parent 048f7106
......@@ -9,23 +9,28 @@
#include <dune/istl/io.hh>
#include <dune/disc/elasticity/linearelasticityassembler.hh>
#include <dune/disc/operators/p1operator.hh>
#include <dune/ag-common/functiontools/gridfunctionadaptor.hh>
#include <dune/ag-common/functionspacebases/p1nodalbasis.hh>
#include <dune/ag-common/functionspacebases/p2nodalbasis.hh>
#include <dune/ag-common/assemblers/operatorassembler.hh>
#include <dune/ag-common/assemblers/localassemblers/stvenantkirchhoffassembler.hh>
#include <dune/ag-common/sampleonbitfield.hh>
#include <dune/ag-common/prolongboundarypatch.hh>
#include <dune/ag-common/readbitfield.hh>
#include <dune/ag-common/estimators/fractionalmarking.hh>
#include <dune/ag-common/estimators/hierarchicalestimator.hh>
#ifdef HAVE_IPOPT
#include <dune-solvers/solvers/quadraticipopt.hh>
#include <dune/solvers/solvers/quadraticipopt.hh>
#endif
#include <dune-solvers/iterationsteps/blockgsstep.hh>
#include <dune-solvers/iterationsteps/multigridstep.hh>
#include <dune-solvers/transferoperators/compressedmultigridtransfer.hh>
#include <dune-solvers/solvers/loopsolver.hh>
#include <dune/solvers/iterationsteps/blockgsstep.hh>
#include <dune/solvers/iterationsteps/multigridstep.hh>
#include <dune/solvers/transferoperators/compressedmultigridtransfer.hh>
#include <dune/solvers/solvers/loopsolver.hh>
#include <dune/solvers/norms/energynorm.hh>
#include <dune-solvers/norms/energynorm.hh>
#include <dune/ag-common/estimators/hierarchicestimator.hh>
#define IPOPT_BASE
......@@ -128,12 +133,17 @@ int main (int argc, char *argv[]) try
x[i][j] = dirichletValues[grid.maxLevel()][i][j];
}
// Assemble elasticity problem
LeafP1Function<GridType,double,dim> u(grid),f(grid);
LinearElasticityLocalStiffness<GridType::LeafGridView,double> lstiff(2.5e5, 0.3);
LeafP1OperatorAssembler<GridType,double,dim> bilinearForm(grid);
bilinearForm.assemble(lstiff,u,f);
// Assemble elasticity problem#
typedef P1NodalBasis<GridType::LeafGridView,double> P1Basis;
P1Basis p1NodalBasis(grid.leafView());
OperatorAssembler<P1Basis,P1Basis> p1Assembler(p1NodalBasis, p1NodalBasis);
StVenantKirchhoffAssembler<GridType, P1Basis::LocalFiniteElement, P1Basis::LocalFiniteElement> p1LocalAssembler(2.5e5, 0.3);
OperatorType stiffnessMatrix;
p1Assembler.assemble(p1LocalAssembler, stiffnessMatrix);
// ///////////////////////////
// Create a solver
......@@ -164,13 +174,12 @@ int main (int argc, char *argv[]) try
BlockGSStep<OperatorType, VectorType> postsmoother;
MultigridStep<OperatorType, VectorType> multigridStep(*bilinearForm, x, rhs, grid.maxLevel()+1);
MultigridStep<OperatorType, VectorType> multigridStep(stiffnessMatrix, x, rhs, grid.maxLevel()+1);
multigridStep.setMGType(1, nu1, nu2);
multigridStep.ignoreNodes_ = &dirichletNodes.back();
multigridStep.basesolver_ = &baseSolver;
multigridStep.presmoother_ = &presmoother;
multigridStep.postsmoother_ = &postsmoother;
multigridStep.setSmoother(&presmoother,&postsmoother);
multigridStep.mgTransfer_.resize(grid.maxLevel());
for (int i=0; i<multigridStep.mgTransfer_.size(); i++) {
......@@ -207,29 +216,40 @@ int main (int argc, char *argv[]) try
// /////////////////////////////////////////////////////////////
// Estimate error and refine grid
// /////////////////////////////////////////////////////////////
HierarchicEstimator<GridType> estimator(grid);
HierarchicalEstimator<P2NodalBasis<GridType::LeafGridView>,dim> estimator(grid);
VectorType hierarchicError;
estimator.estimate(x, leafDirichletBoundary, hierarchicError, lstiff);
//estimator.markForRefinement(grid, hierarchicError, threshold);
estimator.markFractionForRefinement(hierarchicError, 0.2);
GenericGridFunction<P1Basis,dim>* volumeTermDummy=NULL;
GenericGridFunction<P1Basis,dim>* neumannTermDummy=NULL;
RefinementIndicator<GridType> indicator(grid);
typedef P2NodalBasis<GridType::LeafGridView>::LocalFiniteElement P2FiniteElement;
StVenantKirchhoffAssembler<GridType,P2FiniteElement,P2FiniteElement>* localStiffness = new StVenantKirchhoffAssembler<GridType,P2FiniteElement,P2FiniteElement>(2.5e5,0.3);
estimator.estimate(x,
volumeTermDummy,
neumannTermDummy,
leafDirichletBoundary,
indicator,
localStiffness);
//estimator.markForRefinement(grid, hierarchicError, threshold);
FractionalMarkingStrategy<GridType>::mark(indicator, grid, 0.2);
// ////////////////////////////////////////////////////
// Refine grid
// ////////////////////////////////////////////////////
P1FunctionManager<GridType,double> functionManager(grid);
LeafP1Function<GridType,double,dim> sol(grid);
*sol = x;
GridFunctionAdaptor<P1Basis> adaptorP1(p1NodalBasis,true,true);
grid.preAdapt();
sol.preAdapt();
grid.adapt();
sol.postAdapt(functionManager);
grid.postAdapt();
x = *sol;
p1NodalBasis.update();
adaptorP1.adapt(x);
// if (paramBoundaries)
// improveGrid(grid,10);
......
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