Loading...
Searching...
No Matches
vcfvdiscretization.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_VCFV_DISCRETIZATION_HH
#define EWOMS_VCFV_DISCRETIZATION_HH
#include <opm/material/densead/Math.hpp>
#include <opm/models/discretization/common/fvbasediscretization.hh>
#include <opm/models/discretization/vcfv/p1fegradientcalculator.hh>
#include <opm/models/discretization/vcfv/vcfvbaseoutputmodule.hh>
#include <opm/models/discretization/vcfv/vcfvgridcommhandlefactory.hh>
#include <opm/models/discretization/vcfv/vcfvproperties.hh>
#include <opm/models/discretization/vcfv/vcfvstencil.hh>
#include <opm/simulators/linalg/vertexborderlistfromgrid.hh>
#if HAVE_DUNE_FEM
#include <dune/fem/space/common/functionspace.hh>
#include <dune/fem/space/lagrange.hh>
#include <opm/models/discretization/common/fvbasediscretizationfemadapt.hh>
#endif
#include <cstddef>
#include <string>
namespace Opm {
template <class TypeTag>
class VcfvDiscretization;
} // namespace Opm
namespace Opm::Properties {
template<class TypeTag>
struct Stencil<TypeTag, TTag::VcfvDiscretization>
{
private:
using GridView = GetPropType<TypeTag, Properties::GridView>;
using CoordScalar = typename GridView::ctype;
public:
using type = VcfvStencil<CoordScalar, GridView>;
};
template<class TypeTag>
struct DofMapper<TypeTag, TTag::VcfvDiscretization>
{ using type = GetPropType<TypeTag, Properties::VertexMapper>; };
template<class TypeTag>
struct Discretization<TypeTag, TTag::VcfvDiscretization>
{ using type = VcfvDiscretization<TypeTag>; };
template<class TypeTag>
struct DiscBaseOutputModule<TypeTag, TTag::VcfvDiscretization>
{ using type = VcfvBaseOutputModule<TypeTag>; };
template<class TypeTag>
struct GradientCalculator<TypeTag, TTag::VcfvDiscretization>
{ using type = P1FeGradientCalculator<TypeTag>; };
template<class TypeTag>
struct GridCommHandleFactory<TypeTag, TTag::VcfvDiscretization>
{ using type = VcfvGridCommHandleFactory<TypeTag>; };
template<class TypeTag>
struct UseP1FiniteElementGradients<TypeTag, TTag::VcfvDiscretization>
{ static constexpr bool value = false; };
#if HAVE_DUNE_FEM
template<class TypeTag>
struct DiscreteFunctionSpace<TypeTag, TTag::VcfvDiscretization>
{
private:
using Scalar = GetPropType<TypeTag, Properties::Scalar> ;
using GridPart = GetPropType<TypeTag, Properties::GridPart>;
enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
using FunctionSpace = Dune::Fem::FunctionSpace<typename GridPart::GridType::ctype,
Scalar,
GridPart::GridType::dimensionworld,
numEq>;
public:
// Lagrange discrete function space with unknowns at the cell vertices
using type = Dune::Fem::LagrangeDiscreteFunctionSpace< FunctionSpace, GridPart, 1 >;
};
#else
template <class TypeTag>
struct DummySpaceVcfv
{
using DiscreteFunctionSpace = GetPropType<TypeTag, Properties::DiscreteFunctionSpace>;
explicit DummySpaceVcfv(const DiscreteFunctionSpace&) {}
explicit DummySpaceVcfv(const int&) {}
};
template <class TypeTag>
struct DiscreteFunctionSpace<TypeTag, TTag::VcfvDiscretization>
{ using type = DummySpaceVcfv<TypeTag>; };
#endif
template<class TypeTag>
struct BorderListCreator<TypeTag, TTag::VcfvDiscretization>
{
private:
using VertexMapper = GetPropType<TypeTag, Properties::VertexMapper>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
public:
using type = Linear::VertexBorderListFromGrid<GridView, VertexMapper>;
};
template<class TypeTag>
struct LinearizeNonLocalElements<TypeTag, TTag::VcfvDiscretization>
{ static constexpr bool value = false; };
} // namespace Opm::Properties
namespace Opm {
template<class TypeTag>
class VcfvDiscretization : public GetPropType<TypeTag, Properties::BaseDiscretizationType>
{
using ParentType = GetPropType<TypeTag, Properties::BaseDiscretizationType>;
using Implementation = GetPropType<TypeTag, Properties::Model>;
using DofMapper = GetPropType<TypeTag, Properties::DofMapper>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
enum { dim = GridView::dimension };
public:
explicit VcfvDiscretization(Simulator& simulator)
: ParentType(simulator)
{}
static std::string discretizationName()
{ return "vcfv"; }
std::size_t numGridDof() const
{ return static_cast<std::size_t>(this->gridView_.size(/*codim=*/dim)); }
const DofMapper& dofMapper() const
{ return this->vertexMapper(); }
template <class Restarter>
void serialize(Restarter& res)
{ res.template serializeEntities</*codim=*/dim>(asImp_(), this->gridView_); }
template <class Restarter>
void deserialize(Restarter& res)
{
res.template deserializeEntities</*codim=*/dim>(asImp_(), this->gridView_);
this->solution(/*timeIdx=*/1) = this->solution(/*timeIdx=*/0);
}
private:
Implementation& asImp_()
{ return *static_cast<Implementation*>(this); }
const Implementation& asImp_() const
{ return *static_cast<const Implementation*>(this); }
};
} // namespace Opm
#endif
Opm::Linear::VertexBorderListFromGrid
Uses communication on the grid to find the initial seed list of indices.
Definition vertexborderlistfromgrid.hh:52
Opm::P1FeGradientCalculator
This class calculates gradients of arbitrary quantities at flux integration points using first order ...
Definition p1fegradientcalculator.hh:62
Opm::VcfvBaseOutputModule
Implements the discretization specific parts of writing files.
Definition vcfvbaseoutputmodule.hh:44
Opm::VcfvDiscretization
The base class for the vertex centered finite volume discretization scheme.
Definition vcfvdiscretization.hh:165
Opm::VcfvDiscretization::serialize
void serialize(Restarter &res)
Serializes the current state of the model.
Definition vcfvdiscretization.hh:206
Opm::VcfvDiscretization::discretizationName
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition vcfvdiscretization.hh:182
Opm::VcfvDiscretization::dofMapper
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices.
Definition vcfvdiscretization.hh:195
Opm::VcfvDiscretization::numGridDof
std::size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition vcfvdiscretization.hh:188
Opm::VcfvDiscretization::deserialize
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition vcfvdiscretization.hh:217
Opm::VcfvGridCommHandleFactory
A class which provides types for DUNE grid handles for communication.
Definition vcfvgridcommhandlefactory.hh:48
Opm::VcfvStencil
Represents the finite volume geometry of a single element in the VCFV discretization.
Definition vcfvstencil.hh:451
fvbasediscretization.hh
The base class for the finite volume discretization schemes.
fvbasediscretizationfemadapt.hh
The base class for the finite volume discretization schemes.
Opm::Properties::TTag
The generic type tag for problems using the immiscible multi-phase model.
Definition blackoilmodel.hh:81
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
Opm::getPropValue
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
p1fegradientcalculator.hh
This class calculates gradients of arbitrary quantities at flux integration points using first order ...
Opm::Properties::BorderListCreator
The class which marks the border indices associated with the degrees of freedom on a process boundary...
Definition basicproperties.hh:125
Opm::Properties::DiscBaseOutputModule
The part of the VTK ouput modules which is specific to the spatial discretization.
Definition fvbaseproperties.hh:164
Opm::Properties::DiscreteFunctionSpace
The class describing the discrete function space when dune-fem is used, otherwise it points to the st...
Definition fvbaseproperties.hh:74
Opm::Properties::Discretization
The type of the spatial discretization used by the model.
Definition fvbaseproperties.hh:88
Opm::Properties::DofMapper
The mapper to find the global index of a degree of freedom.
Definition fvbaseproperties.hh:219
Opm::Properties::DummySpaceVcfv
Definition vcfvdiscretization.hh:124
Opm::Properties::GradientCalculator
Calculates gradients of arbitrary quantities at flux integration points.
Definition fvbaseproperties.hh:152
Opm::Properties::GridCommHandleFactory
The class to create grid communication handles.
Definition fvbaseproperties.hh:168
Opm::Properties::LinearizeNonLocalElements
Specify if elements that do not belong to the local process' grid partition should be skipped.
Definition fvbaseproperties.hh:101
Opm::Properties::Scalar
Property to specify the type of scalar values.
Definition basicproperties.hh:76
Opm::Properties::Stencil
The class describing the stencil of the spatial discretization.
Definition fvbaseproperties.hh:70
Opm::Properties::UseP1FiniteElementGradients
Use P1 finite-elements gradients instead of two-point gradients.
Definition vcfvproperties.hh:47
vcfvbaseoutputmodule.hh
Implements the discretization specific parts of writing files.
vcfvgridcommhandlefactory.hh
A class which provides types for DUNE grid handles for communication.
vcfvproperties.hh
Declares the basic properties used by the common infrastructure of the vertex-centered finite volume ...
vcfvstencil.hh
Represents the finite volume geometry of a single element in the VCFV discretization.
vertexborderlistfromgrid.hh
Uses communication on the grid to find the initial seed list of indices.