Loading...
Searching...
No Matches
mortar_evaluator.hpp
Go to the documentation of this file.
//==============================================================================
//==============================================================================
#ifndef MORTAR_EVALUATOR_HPP_
#define MORTAR_EVALUATOR_HPP_
#include <dune/istl/matrixmatrix.hh>
#include <dune/istl/solvers.hh>
#include <opm/elasticity/matrixops.hpp>
#include <opm/elasticity/mortar_utils.hpp>
namespace Opm {
namespace Elasticity {
class MortarEvaluator : public Dune::LinearOperator<Vector, Vector> {
public:
MortarEvaluator(const Matrix& A_,
const Matrix& B_) :
A(A_), B(B_)
{
}
void apply(const Vector& x, Vector& y) const override
{
Vector lambda, l2;
MortarUtils::extractBlock(lambda, x, B.M(), A.N());
A.mv(x, y);
B.umv(lambda, y);
l2.resize(lambda.size());
B.mtv(x, l2);
MortarUtils::injectBlock(y, l2, B.M(), A.N());
}
void applyscaleadd(field_type alpha, const Vector& x, Vector& y) const override
{
Vector lambda, l2;
A.usmv(alpha, x, y);
MortarUtils::extractBlock(lambda, x, B.M(), A.N());
B.umv(lambda, y);
l2.resize(lambda.size());
B.mtv(x, l2);
for (size_t i=A.N(); i < y.size(); ++i)
y[i] += alpha*l2[i-A.N()];
}
Dune::SolverCategory::Category category() const override
{
return Dune::SolverCategory::sequential;
}
protected:
const Matrix& A;
const Matrix& B;
};
}
}
#endif
Opm::Elasticity::MortarEvaluator::B
const Matrix & B
Reference to the mortar coupling matrix.
Definition mortar_evaluator.hpp:77
Opm::Elasticity::MortarEvaluator::apply
void apply(const Vector &x, Vector &y) const override
Apply the multiplier block.
Definition mortar_evaluator.hpp:41
Opm::Elasticity::MortarEvaluator::applyscaleadd
void applyscaleadd(field_type alpha, const Vector &x, Vector &y) const override
Apply the multiplier block with an embedded axpy.
Definition mortar_evaluator.hpp:57
Opm::Elasticity::MortarEvaluator::MortarEvaluator
MortarEvaluator(const Matrix &A_, const Matrix &B_)
Constructor.
Definition mortar_evaluator.hpp:32
Opm::Elasticity::MortarEvaluator::A
const Matrix & A
Reference to A matrix.
Definition mortar_evaluator.hpp:76
Opm::Elasticity::MortarUtils::extractBlock
static void extractBlock(Vector &x, const Vector &y, int len, int start=0)
Extract a range of indices from a vector.
Definition mortar_utils.hpp:27
Opm::Elasticity::MortarUtils::injectBlock
static void injectBlock(Vector &x, const Vector &y, int len, int start=0)
Inject a range of indices into a vector.
Definition mortar_utils.hpp:38
matrixops.hpp
Helper class with some matrix operations.
Opm::Elasticity::Matrix
Dune::BCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Matrix
A sparse matrix holding our operator.
Definition matrixops.hpp:27
Opm::Elasticity::Vector
Dune::BlockVector< Dune::FieldVector< double, 1 > > Vector
A vector holding our RHS.
Definition matrixops.hpp:33
mortar_utils.hpp
Mortar helper class.
Opm
Inverting small matrices.
Definition ImplicitAssembly.hpp:43