vcfvdiscretization.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef EWOMS_VCFV_DISCRETIZATION_HH
29#define EWOMS_VCFV_DISCRETIZATION_HH
30
31#include <opm/material/densead/Math.hpp>
32
33#include "vcfvproperties.hh"
34#include "vcfvstencil.hh"
38
41
42#if HAVE_DUNE_FEM
44#include <dune/fem/space/common/functionspace.hh>
45#include <dune/fem/space/lagrange.hh>
46#endif
47
48namespace Opm {
49template <class TypeTag>
50class VcfvDiscretization;
51
52} // namespace Opm
53
54namespace Opm::Properties {
55
57template<class TypeTag>
58struct Stencil<TypeTag, TTag::VcfvDiscretization>
59{
60private:
62 using CoordScalar = typename GridView::ctype;
63
64public:
66};
67
69template<class TypeTag>
71
73template<class TypeTag>
75
78template<class TypeTag>
81
83template<class TypeTag>
86
88template<class TypeTag>
91
93template<class TypeTag>
94struct UseP1FiniteElementGradients<TypeTag, TTag::VcfvDiscretization> { static constexpr bool value = false; };
95
96#if HAVE_DUNE_FEM
98template<class TypeTag>
99struct DiscreteFunctionSpace<TypeTag, TTag::VcfvDiscretization>
100{
101private:
104 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
105 using FunctionSpace = Dune::Fem::FunctionSpace<typename GridPart::GridType::ctype,
106 Scalar,
107 GridPart::GridType::dimensionworld,
108 numEq>;
109public:
110 // Lagrange discrete function space with unknowns at the cell vertices
111 using type = Dune::Fem::LagrangeDiscreteFunctionSpace< FunctionSpace, GridPart, 1 >;
112};
113#else
114template <class TypeTag>
118 DummySpaceVcfv(const int&) {};
119};
120
121template <class TypeTag>
124};
125#endif
126
128template<class TypeTag>
130{ private:
133public:
135};
136
140template<class TypeTag>
141struct LinearizeNonLocalElements<TypeTag, TTag::VcfvDiscretization> { static constexpr bool value = false; };
142
143
144} // namespace Opm::Properties
145
146namespace Opm {
147
153template<class TypeTag>
154class VcfvDiscretization : public GetPropType<TypeTag, Properties::BaseDiscretizationType>
155{
157 using Implementation = GetPropType<TypeTag, Properties::Model>;
161
162 enum { dim = GridView::dimension };
163
164public:
165 VcfvDiscretization(Simulator& simulator)
166 : ParentType(simulator)
167 { }
168
172 static std::string discretizationName()
173 { return "vcfv"; }
174
178 size_t numGridDof() const
179 { return static_cast<size_t>(this->gridView_.size(/*codim=*/dim)); }
180
185 const DofMapper& dofMapper() const
186 { return this->vertexMapper(); }
187
195 template <class Restarter>
196 void serialize(Restarter& res)
197 { res.template serializeEntities</*codim=*/dim>(asImp_(), this->gridView_); }
198
206 template <class Restarter>
207 void deserialize(Restarter& res)
208 {
209 res.template deserializeEntities</*codim=*/dim>(asImp_(), this->gridView_);
210 this->solution(/*timeIdx=*/1) = this->solution(/*timeIdx=*/0);
211 }
212
213private:
214 Implementation& asImp_()
215 { return *static_cast<Implementation*>(this); }
216 const Implementation& asImp_() const
217 { return *static_cast<const Implementation*>(this); }
218};
219} // namespace Opm
220
221#endif
Uses communication on the grid to find the initial seed list of indices.
Definition: vertexborderlistfromgrid.hh:52
This class calculates gradients of arbitrary quantities at flux integration points using first order ...
Definition: p1fegradientcalculator.hh:60
Implements the discretization specific parts of writing files.
Definition: vcfvbaseoutputmodule.hh:46
The base class for the vertex centered finite volume discretization scheme.
Definition: vcfvdiscretization.hh:155
void serialize(Restarter &res)
Serializes the current state of the model.
Definition: vcfvdiscretization.hh:196
size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition: vcfvdiscretization.hh:178
VcfvDiscretization(Simulator &simulator)
Definition: vcfvdiscretization.hh:165
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition: vcfvdiscretization.hh:172
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices.
Definition: vcfvdiscretization.hh:185
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition: vcfvdiscretization.hh:207
A class which provides types for DUNE grid handles for communication.
Definition: vcfvgridcommhandlefactory.hh:46
Represents the finite volume geometry of a single element in the VCFV discretization.
Definition: vcfvstencil.hh:467
Definition: blackoilmodel.hh:72
Definition: blackoilboundaryratevector.hh:37
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:242
The class which marks the border indices associated with the degrees of freedom on a process boundary...
Definition: basicproperties.hh:182
The part of the VTK ouput modules which is specific to the spatial discretization.
Definition: fvbaseproperties.hh:181
The class describing the discrete function space when dune-fem is used, otherwise it points to the st...
Definition: fvbaseproperties.hh:91
UndefinedProperty type
Definition: fvbaseproperties.hh:91
The type of the spatial discretization used by the model.
Definition: fvbaseproperties.hh:105
GetPropType< TypeTag, Properties::VertexMapper > type
Definition: vcfvdiscretization.hh:70
The mapper to find the global index of a degree of freedom.
Definition: fvbaseproperties.hh:337
Definition: vcfvdiscretization.hh:115
DummySpaceVcfv(const DiscreteFunctionSpace &)
Definition: vcfvdiscretization.hh:117
GetPropType< TypeTag, Properties::DiscreteFunctionSpace > DiscreteFunctionSpace
Definition: vcfvdiscretization.hh:116
DummySpaceVcfv(const int &)
Definition: vcfvdiscretization.hh:118
Calculates gradients of arbitrary quantities at flux integration points.
Definition: fvbaseproperties.hh:169
The class to create grid communication handles.
Definition: fvbaseproperties.hh:185
Definition: fvbaseproperties.hh:118
Property to specify the type of scalar values.
Definition: basicproperties.hh:69
The class describing the stencil of the spatial discretization.
Definition: fvbaseproperties.hh:87
Definition: vcfvproperties.hh:47
Declares the basic properties used by the common infrastructure of the vertex-centered finite volume ...