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
39
41
42#if HAVE_DUNE_FEM
43#include <dune/fem/space/common/functionspace.hh>
44#include <dune/fem/space/lagrange.hh>
46#endif
47
48#include <cstddef>
49#include <string>
50
51namespace Opm {
52
53template <class TypeTag>
54class VcfvDiscretization;
55
56} // namespace Opm
57
58namespace Opm::Properties {
59
61template<class TypeTag>
62struct Stencil<TypeTag, TTag::VcfvDiscretization>
63{
64private:
66 using CoordScalar = typename GridView::ctype;
67
68public:
70};
71
73template<class TypeTag>
74struct DofMapper<TypeTag, TTag::VcfvDiscretization>
76
78template<class TypeTag>
79struct Discretization<TypeTag, TTag::VcfvDiscretization>
81
84template<class TypeTag>
87
89template<class TypeTag>
92
94template<class TypeTag>
97
99template<class TypeTag>
101{ static constexpr bool value = false; };
102
103#if HAVE_DUNE_FEM
105template<class TypeTag>
106struct DiscreteFunctionSpace<TypeTag, TTag::VcfvDiscretization>
107{
108private:
111 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
112 using FunctionSpace = Dune::Fem::FunctionSpace<typename GridPart::GridType::ctype,
113 Scalar,
114 GridPart::GridType::dimensionworld,
115 numEq>;
116
117public:
118 // Lagrange discrete function space with unknowns at the cell vertices
119 using type = Dune::Fem::LagrangeDiscreteFunctionSpace< FunctionSpace, GridPart, 1 >;
120};
121#else
122template <class TypeTag>
124{
127 explicit DummySpaceVcfv(const int&) {}
128};
129
130template <class TypeTag>
133#endif
134
136template<class TypeTag>
138{
139private:
142
143public:
145};
146
150template<class TypeTag>
152{ static constexpr bool value = false; };
153
154} // namespace Opm::Properties
155
156namespace Opm {
157
163template<class TypeTag>
164class VcfvDiscretization : public GetPropType<TypeTag, Properties::BaseDiscretizationType>
165{
167 using Implementation = GetPropType<TypeTag, Properties::Model>;
171
172 enum { dim = GridView::dimension };
173
174public:
175 explicit VcfvDiscretization(Simulator& simulator)
176 : ParentType(simulator)
177 {}
178
182 static std::string discretizationName()
183 { return "vcfv"; }
184
188 std::size_t numGridDof() const
189 { return static_cast<std::size_t>(this->gridView_.size(/*codim=*/dim)); }
190
195 const DofMapper& dofMapper() const
196 { return this->vertexMapper(); }
197
205 template <class Restarter>
206 void serialize(Restarter& res)
207 { res.template serializeEntities</*codim=*/dim>(asImp_(), this->gridView_); }
208
216 template <class Restarter>
217 void deserialize(Restarter& res)
218 {
219 res.template deserializeEntities</*codim=*/dim>(asImp_(), this->gridView_);
220 this->solution(/*timeIdx=*/1) = this->solution(/*timeIdx=*/0);
221 }
222
223private:
224 Implementation& asImp_()
225 { return *static_cast<Implementation*>(this); }
226
227 const Implementation& asImp_() const
228 { return *static_cast<const Implementation*>(this); }
229};
230
231} // namespace Opm
232
233#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:62
Implements the discretization specific parts of writing files.
Definition: vcfvbaseoutputmodule.hh:44
The base class for the vertex centered finite volume discretization scheme.
Definition: vcfvdiscretization.hh:165
void serialize(Restarter &res)
Serializes the current state of the model.
Definition: vcfvdiscretization.hh:206
VcfvDiscretization(Simulator &simulator)
Definition: vcfvdiscretization.hh:175
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition: vcfvdiscretization.hh:182
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices.
Definition: vcfvdiscretization.hh:195
std::size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition: vcfvdiscretization.hh:188
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition: vcfvdiscretization.hh:217
A class which provides types for DUNE grid handles for communication.
Definition: vcfvgridcommhandlefactory.hh:48
Represents the finite volume geometry of a single element in the VCFV discretization.
Definition: vcfvstencil.hh:451
Definition: blackoilmodel.hh:79
Definition: blackoilboundaryratevector.hh:39
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
The class which marks the border indices associated with the degrees of freedom on a process boundary...
Definition: basicproperties.hh:125
The part of the VTK ouput modules which is specific to the spatial discretization.
Definition: fvbaseproperties.hh:164
The class describing the discrete function space when dune-fem is used, otherwise it points to the st...
Definition: fvbaseproperties.hh:74
UndefinedProperty type
Definition: fvbaseproperties.hh:74
The type of the spatial discretization used by the model.
Definition: fvbaseproperties.hh:88
GetPropType< TypeTag, Properties::VertexMapper > type
Definition: vcfvdiscretization.hh:75
The mapper to find the global index of a degree of freedom.
Definition: fvbaseproperties.hh:219
Definition: vcfvdiscretization.hh:124
DummySpaceVcfv(const DiscreteFunctionSpace &)
Definition: vcfvdiscretization.hh:126
GetPropType< TypeTag, Properties::DiscreteFunctionSpace > DiscreteFunctionSpace
Definition: vcfvdiscretization.hh:125
DummySpaceVcfv(const int &)
Definition: vcfvdiscretization.hh:127
Calculates gradients of arbitrary quantities at flux integration points.
Definition: fvbaseproperties.hh:152
The class to create grid communication handles.
Definition: fvbaseproperties.hh:168
Definition: fvbaseproperties.hh:101
Property to specify the type of scalar values.
Definition: basicproperties.hh:76
The class describing the stencil of the spatial discretization.
Definition: fvbaseproperties.hh:70
Definition: vcfvproperties.hh:47
Declares the basic properties used by the common infrastructure of the vertex-centered finite volume ...