mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Minor formatting and removing unused code.
This commit is contained in:
parent
28dfef1ecf
commit
b39815edb5
@ -167,34 +167,36 @@ namespace Dune
|
|||||||
matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
|
matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update the coarse solver and the hierarchies.
|
||||||
|
*/
|
||||||
template<class C>
|
template<class C>
|
||||||
void updateSolver(C& criterion, Operator& matrix, const PI& pinfo)
|
void updateSolver(C& criterion, Operator& /* matrix */, const PI& pinfo)
|
||||||
{
|
{
|
||||||
Timer watch;
|
Timer watch;
|
||||||
//this->createHierarchies(criterion, const_cast<Operator&>(matrix), pinfo);
|
|
||||||
smoothers_.reset(new Hierarchy<Smoother,A>);
|
smoothers_.reset(new Hierarchy<Smoother,A>);
|
||||||
solver_.reset();
|
solver_.reset();
|
||||||
coarseSmoother_.reset();
|
coarseSmoother_.reset();
|
||||||
scalarProduct_.reset();
|
scalarProduct_.reset();
|
||||||
buildHierarchy_= true;
|
buildHierarchy_= true;
|
||||||
coarsesolverconverged = true;
|
coarsesolverconverged = true;
|
||||||
//this->createHierarchies(criterion, matrix, pinfo);
|
|
||||||
//matrices_.reset(new OperatorHierarchy(matrix, pinfo));
|
|
||||||
//matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
|
|
||||||
smoothers_.reset(new Hierarchy<Smoother,A>);
|
smoothers_.reset(new Hierarchy<Smoother,A>);
|
||||||
matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
|
matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
|
||||||
matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
|
matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
|
||||||
setupCoarseSolver();
|
setupCoarseSolver();
|
||||||
if(verbosity_>0 &&
|
if (verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0) {
|
||||||
matrices_->parallelInformation().finest()->communicator().rank()==0){
|
std::cout << "Recalculating galerkin and coarse somothers "<< matrices_->maxlevels() << " levels "
|
||||||
std::cout<<"Recalculating galerkin and coarse somothers "<<matrices_->maxlevels()<<" levels "
|
<< watch.elapsed() << " seconds." << std::endl;
|
||||||
<<watch.elapsed()<<" seconds."<<std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setupCoarseSolver(){
|
|
||||||
|
void setupCoarseSolver()
|
||||||
|
{
|
||||||
setupCoarseSolverSerial();
|
setupCoarseSolverSerial();
|
||||||
}
|
}
|
||||||
void setupCoarseSolverSerial(){
|
|
||||||
|
void setupCoarseSolverSerial()
|
||||||
|
{
|
||||||
if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels())
|
if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels())
|
||||||
{
|
{
|
||||||
// We have the carsest level. Create the coarse Solver
|
// We have the carsest level. Create the coarse Solver
|
||||||
@ -229,16 +231,10 @@ namespace Dune
|
|||||||
*coarseSmoother_, 1E-2, 1, 0));
|
*coarseSmoother_, 1E-2, 1, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(verbosity_>0 &&
|
|
||||||
// matrices_->parallelInformation().finest()->communicator().rank()==0){
|
|
||||||
// std::cout<<"Recalculating galerkin and coarse somothers "<<matrices_->maxlevels()<<" levels "
|
|
||||||
// <<watch.elapsed()<<" seconds."<<std::endl;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupCoarseSolverPar()
|
||||||
void setupCoarseSolverPar(){
|
{
|
||||||
if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
|
if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
|
||||||
&& ( ! matrices_->redistributeInformation().back().isSetup() ||
|
&& ( ! matrices_->redistributeInformation().back().isSetup() ||
|
||||||
matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
|
matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
|
||||||
@ -312,13 +308,8 @@ namespace Dune
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(verbosity_>0 &&
|
|
||||||
// matrices_->parallelInformation().finest()->communicator().rank()==0){
|
|
||||||
// std::cout<<"Recalculating galerkin and coarse somothers "<<matrices_->maxlevels()<<" levels "
|
|
||||||
// <<watch.elapsed()<<" seconds."<<std::endl;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check whether the coarse solver used is a direct solver.
|
* @brief Check whether the coarse solver used is a direct solver.
|
||||||
* @return True if the coarse level solver is a direct solver.
|
* @return True if the coarse level solver is a direct solver.
|
||||||
@ -546,105 +537,9 @@ namespace Dune
|
|||||||
matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
|
matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
|
||||||
setupCoarseSolver();
|
setupCoarseSolver();
|
||||||
if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
|
if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
|
||||||
std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
|
std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
|
||||||
<<"(inclusive coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
|
<<"(inclusive coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
|
||||||
}
|
}
|
||||||
// void setupSolverCoarse(){
|
|
||||||
// // test whether we should solve on the coarse level. That is the case if we
|
|
||||||
// // have that level and if there was a redistribution on this level then our
|
|
||||||
// // communicator has to be valid (size()>0) as the smoother might try to communicate
|
|
||||||
// // in the constructor.
|
|
||||||
// if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
|
|
||||||
// && ( ! matrices_->redistributeInformation().back().isSetup() ||
|
|
||||||
// matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
|
|
||||||
// {
|
|
||||||
// // We have the carsest level. Create the coarse Solver
|
|
||||||
// SmootherArgs sargs(smootherArgs_);
|
|
||||||
// sargs.iterations = 1;
|
|
||||||
|
|
||||||
// typename ConstructionTraits<Smoother>::Arguments cargs;
|
|
||||||
// cargs.setArgs(sargs);
|
|
||||||
// if(matrices_->redistributeInformation().back().isSetup()) {
|
|
||||||
// // Solve on the redistributed partitioning
|
|
||||||
// cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
|
|
||||||
// cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
|
|
||||||
// }else{
|
|
||||||
// cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
|
|
||||||
// cargs.setComm(*matrices_->parallelInformation().coarsest());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// coarseSmoother_.reset(ConstructionTraits<Smoother>::construct(cargs));
|
|
||||||
// scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
|
|
||||||
|
|
||||||
// typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector;
|
|
||||||
|
|
||||||
// // Use superlu if we are purely sequential or with only one processor on the coarsest level.
|
|
||||||
// if( SolverSelector::isDirectSolver &&
|
|
||||||
// (std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
|
|
||||||
// || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
|
|
||||||
// || (matrices_->parallelInformation().coarsest().isRedistributed()
|
|
||||||
// && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
|
|
||||||
// && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0) )
|
|
||||||
// )
|
|
||||||
// { // redistribute and 1 proc
|
|
||||||
// if(matrices_->parallelInformation().coarsest().isRedistributed())
|
|
||||||
// {
|
|
||||||
// if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
|
|
||||||
// {
|
|
||||||
// // We are still participating on this level
|
|
||||||
// solver_.reset(SolverSelector::create(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// solver_.reset();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()->getmat(), false, false));
|
|
||||||
// }
|
|
||||||
// if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
|
|
||||||
// std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << ")" << std::endl;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// if(matrices_->parallelInformation().coarsest().isRedistributed())
|
|
||||||
// {
|
|
||||||
// if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
|
|
||||||
// // We are still participating on this level
|
|
||||||
|
|
||||||
// // we have to allocate these types using the rebound allocator
|
|
||||||
// // in order to ensure that we fulfill the alignement requirements
|
|
||||||
// solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
|
|
||||||
// *scalarProduct_,
|
|
||||||
// *coarseSmoother_, 1E-2, 1000, 0));
|
|
||||||
// else
|
|
||||||
// solver_.reset();
|
|
||||||
// }else
|
|
||||||
// {
|
|
||||||
// solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
|
|
||||||
// *scalarProduct_,
|
|
||||||
// *coarseSmoother_, 1E-2, 1000, 0));
|
|
||||||
// // // we have to allocate these types using the rebound allocator
|
|
||||||
// // // in order to ensure that we fulfill the alignement requirements
|
|
||||||
// // using Alloc = typename A::template rebind<BiCGSTABSolver<X>>::other;
|
|
||||||
// // Alloc alloc;
|
|
||||||
// // auto p = alloc.allocate(1);
|
|
||||||
// // alloc.construct(p,
|
|
||||||
// // const_cast<M&>(*matrices_->matrices().coarsest()),
|
|
||||||
// // *scalarProduct_,
|
|
||||||
// // *coarseSmoother_, 1E-2, 1000, 0);
|
|
||||||
// // solver_.reset(p,[](BiCGSTABSolver<X>* p){
|
|
||||||
// // Alloc alloc;
|
|
||||||
// // alloc.destroy(p);
|
|
||||||
// // alloc.deallocate(p,1);
|
|
||||||
// // });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
|
|
||||||
// std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
|
|
||||||
// <<"(inclusive coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
template<class M, class X, class S, class PI, class A>
|
template<class M, class X, class S, class PI, class A>
|
||||||
|
Loading…
Reference in New Issue
Block a user