mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Reindent, remove unused function (after refactoring).
This commit is contained in:
parent
5d68a308b5
commit
0e1db0c6bd
@ -35,57 +35,9 @@
|
||||
#include <dune/istl/scalarproducts.hh>
|
||||
#include <dune/common/fvector.hh>
|
||||
#include <dune/common/fmatrix.hh>
|
||||
namespace Dune
|
||||
{
|
||||
namespace Amg
|
||||
{
|
||||
template<class M, class Norm>
|
||||
class UnSymmetricCriterion;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Dune
|
||||
{
|
||||
|
||||
template <class Scalar, int n, int m>
|
||||
class MatrixBlock;
|
||||
|
||||
}
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
namespace Detail
|
||||
{
|
||||
template<class Operator, class Communication,class Vector>
|
||||
std::unique_ptr<typename Operator::matrix_type> scaleMatrixDRSPtr(const Operator& op,
|
||||
const Communication& comm,
|
||||
std::size_t pressureEqnIndex,
|
||||
const Vector& weights,
|
||||
const Opm::CPRParameter& param)
|
||||
{
|
||||
using Matrix = typename Operator::matrix_type;
|
||||
using Block = typename Matrix::block_type;
|
||||
using BlockVector = typename Vector::block_type;
|
||||
std::unique_ptr<Matrix> matrix(new Matrix(op.getmat()));
|
||||
if (param.cpr_use_drs_) {
|
||||
const auto endi = matrix->end();
|
||||
for (auto i = matrix->begin(); i != endi; ++i) {
|
||||
const BlockVector& bw = weights[i.index()];
|
||||
const auto endj = (*i).end();
|
||||
for (auto j = (*i).begin(); j != endj; ++j) {
|
||||
Block& block = *j;
|
||||
BlockVector& bvec = block[pressureEqnIndex];
|
||||
// should introduce limits which also change the weights
|
||||
block.mtv(bw, bvec);
|
||||
}
|
||||
}
|
||||
}
|
||||
return matrix;//, createOperator(op, *matrix, comm));
|
||||
}
|
||||
}
|
||||
|
||||
template<class Operator, class Criterion, class Communication, std::size_t COMPONENT_INDEX, std::size_t VARIABLE_INDEX>
|
||||
class OneComponentAggregationLevelTransferPolicyCpr;
|
||||
|
||||
template<class Operator, class Criterion, class Communication, std::size_t COMPONENT_INDEX, std::size_t VARIABLE_INDEX>
|
||||
class OneComponentAggregationLevelTransferPolicyCpr
|
||||
@ -453,15 +405,17 @@ namespace Opm
|
||||
* \brief An algebraic twolevel or multigrid approach for solving blackoil (supports CPR with and without AMG)
|
||||
*
|
||||
* This preconditioner first decouples the component used for coarsening using a simple scaling
|
||||
* approach (e.g. Scheichl, Masson 2013,\see scaleMatrixDRS). Then it constructs the first
|
||||
* coarse level system, either by simply extracting the coupling between the components at COMPONENT_INDEX
|
||||
* in the matrix blocks or by extracting them and applying aggregation to them directly. This coarse level
|
||||
* approach (e.g. Scheichl, Masson 2013,\see scaleMatrixDRS). Then it constructs the
|
||||
* coarse level system. The coupling is defined by the weights corresponding to the element located at
|
||||
* (COMPONENT_INDEX, VARIABLE_INDEX) in the block matrix. Then the coarse level system is constructed
|
||||
* either by extracting these elements, or by applying aggregation to them directly. This coarse level
|
||||
* can be solved either by AMG or by ILU. The preconditioner is configured using CPRParameter.
|
||||
* \tparam O The type of the operator (encapsulating a BCRSMatrix).
|
||||
* \tparam S The type of the smoother.
|
||||
* \tparam C The type of coarsening criterion to use.
|
||||
* \tparam P The type of the class describing the parallelization.
|
||||
* \tparam COMPONENT_INDEX The index of the component to use for coarsening (usually the pressure).
|
||||
* \tparam COMPONENT_INDEX The index of the component to use for coarsening (usually water).
|
||||
* \tparam VARIABLE_INDEX The index of the variable to use for coarsening (usually pressure).
|
||||
*/
|
||||
template<typename O, typename S, typename SC, typename C,
|
||||
typename P, std::size_t COMPONENT_INDEX, std::size_t VARIABLE_INDEX>
|
||||
@ -483,7 +437,6 @@ namespace Opm
|
||||
protected:
|
||||
using Matrix = typename Operator::matrix_type;
|
||||
using CoarseOperator = typename Detail::ScalarType<Operator>::value;
|
||||
//using CoarseSmoother = typename Detail::ScalarType<Smoother>::value;
|
||||
using CoarseSmoother = typename Detail::ScalarType<SC>::value;
|
||||
using FineCriterion =
|
||||
typename Detail::OneComponentCriterionType<Criterion,COMPONENT_INDEX, VARIABLE_INDEX>::value;
|
||||
@ -532,9 +485,8 @@ namespace Opm
|
||||
const SmootherArgs& smargs, const Communication& comm)
|
||||
: param_(param),
|
||||
weights_(weights),
|
||||
scaledMatrix_(Detail::scaleMatrixDRSPtr(fineOperator, comm,
|
||||
COMPONENT_INDEX, weights_, param)),
|
||||
scaledMatrixOperator_(Detail::createOperatorPtr(fineOperator, *scaledMatrix_, comm)),
|
||||
scaledMatrix_(Detail::scaleMatrixDRS(fineOperator, COMPONENT_INDEX, weights_, param)),
|
||||
scaledMatrixOperator_(Detail::createOperator(fineOperator, *scaledMatrix_, comm)),
|
||||
smoother_(Detail::constructSmoother<Smoother>(*scaledMatrixOperator_,
|
||||
smargs, comm)),
|
||||
levelTransferPolicy_(criterion, comm),
|
||||
@ -545,16 +497,15 @@ namespace Opm
|
||||
coarseSolverPolicy_, 0, 1)
|
||||
{
|
||||
}
|
||||
|
||||
void updatePreconditioner(const typename TwoLevelMethod::FineDomainType& weights,
|
||||
const Operator& fineOperator,
|
||||
const SmootherArgs& smargs,
|
||||
const Communication& comm){
|
||||
const Communication& comm)
|
||||
{
|
||||
weights_ = weights;
|
||||
*scaledMatrix_ = *Detail::scaleMatrixDRSPtr(fineOperator, comm,
|
||||
COMPONENT_INDEX, weights_, param_);
|
||||
//*scaledMatrixOperator_ = *Detail::createOperatorPtr(fineOperator,*scaledMatrix_,comm);
|
||||
smoother_ .reset(Detail::constructSmoother<Smoother>(*scaledMatrixOperator_,
|
||||
smargs, comm));
|
||||
*scaledMatrix_ = *Detail::scaleMatrixDRS(fineOperator, COMPONENT_INDEX, weights_, param_);
|
||||
smoother_.reset(Detail::constructSmoother<Smoother>(*scaledMatrixOperator_, smargs, comm));
|
||||
twoLevelMethod_.updatePreconditioner(*scaledMatrixOperator_,
|
||||
smoother_,
|
||||
coarseSolverPolicy_);
|
||||
@ -578,19 +529,16 @@ namespace Opm
|
||||
Detail::scaleVectorDRS(scaledD, COMPONENT_INDEX, param_, weights_);
|
||||
twoLevelMethod_.apply(v, scaledD);
|
||||
}
|
||||
|
||||
private:
|
||||
const CPRParameter& param_;
|
||||
//const typename TwoLevelMethod::FineDomainType& weights_;
|
||||
typename TwoLevelMethod::FineDomainType weights_; //make copy
|
||||
std::unique_ptr<Matrix> scaledMatrix_;
|
||||
std::unique_ptr<Operator> scaledMatrixOperator_;
|
||||
//Operator scaledMatrixOperator_;
|
||||
//std::tuple<std::unique_ptr<Matrix>, Operator>
|
||||
std::shared_ptr<Smoother> smoother_;
|
||||
LevelTransferPolicy levelTransferPolicy_;
|
||||
CoarseSolverPolicy coarseSolverPolicy_;
|
||||
TwoLevelMethod twoLevelMethod_;
|
||||
//BlockVector weights_;
|
||||
};
|
||||
|
||||
} // end namespace Opm
|
||||
|
Loading…
Reference in New Issue
Block a user