Loading...
Searching...
No Matches
baseauxiliarymodule.hh
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef EWOMS_BASE_AUXILIARY_MODULE_HH
#define EWOMS_BASE_AUXILIARY_MODULE_HH
#include <opm/models/utils/propertysystem.hh>
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/simulators/linalg/linalgproperties.hh>
#include <set>
#include <vector>
namespace Opm::Properties::Tag {
struct AuxModule {};
} // namespace Opm::Properties::TTag
namespace Opm {
template <class TypeTag>
class BaseAuxiliaryModule
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using GlobalEqVector = GetPropType<TypeTag, Properties::GlobalEqVector>;
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>;
protected:
using NeighborSet = std::set<unsigned>;
public:
virtual ~BaseAuxiliaryModule() = default;
virtual unsigned numDofs() const = 0;
void setDofOffset(int value)
{ dofOffset_ = value; }
int dofOffset()
{ return dofOffset_; }
int localToGlobalDof(unsigned localDofIdx) const
{
assert(localDofIdx < numDofs());
return dofOffset_ + localDofIdx;
}
virtual void addNeighbors(std::vector<NeighborSet>& neighbors) const = 0;
virtual void applyInitial() = 0;
virtual void linearize(SparseMatrixAdapter& matrix, GlobalEqVector& residual) = 0;
virtual void postSolve(GlobalEqVector&)
{}
private:
int dofOffset_{};
};
} // namespace Opm
#endif
Opm::BaseAuxiliaryModule
Base class for specifying auxiliary equations.
Definition baseauxiliarymodule.hh:56
Opm::BaseAuxiliaryModule::dofOffset
int dofOffset()
Return the offset in the global system of equations for the first degree of freedom of this auxiliary...
Definition baseauxiliarymodule.hh:85
Opm::BaseAuxiliaryModule::linearize
virtual void linearize(SparseMatrixAdapter &matrix, GlobalEqVector &residual)=0
Linearize the auxiliary equation.
Opm::BaseAuxiliaryModule::applyInitial
virtual void applyInitial()=0
Set the initial condition of the auxiliary module in the solution vector.
Opm::BaseAuxiliaryModule::addNeighbors
virtual void addNeighbors(std::vector< NeighborSet > &neighbors) const =0
Specify the additional neighboring correlations caused by the auxiliary module.
Opm::BaseAuxiliaryModule::numDofs
virtual unsigned numDofs() const =0
Returns the number of additional degrees of freedom required for the auxiliary module.
Opm::BaseAuxiliaryModule::postSolve
virtual void postSolve(GlobalEqVector &)
This method is called after the linear solver has been called but before the solution is updated for ...
Definition baseauxiliarymodule.hh:120
Opm::BaseAuxiliaryModule::setDofOffset
void setDofOffset(int value)
Set the offset in the global system of equations for the first degree of freedom of this auxiliary mo...
Definition baseauxiliarymodule.hh:78
Opm::BaseAuxiliaryModule::localToGlobalDof
int localToGlobalDof(unsigned localDofIdx) const
Given a degree of freedom relative to the current auxiliary equation, return the corresponding index ...
Definition baseauxiliarymodule.hh:92
fvbaseproperties.hh
Declare the properties used by the infrastructure code of the finite volume discretizations.
linalgproperties.hh
Declares the properties required by the black oil model.
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
Opm::GetPropType
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:233
propertysystem.hh
The Opm property system, traits with inheritance.
Opm::Properties::Tag::AuxModule
Definition baseauxiliarymodule.hh:40