ecfvdiscretization.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_ECFV_DISCRETIZATION_HH
29#define EWOMS_ECFV_DISCRETIZATION_HH
30
31#include <opm/material/densead/Math.hpp>
32
38
40
41#if HAVE_DUNE_FEM
43#include <dune/fem/space/common/functionspace.hh>
44#include <dune/fem/space/finitevolume.hh>
45#endif
46
47#include <cstddef>
48#include <string>
49
50namespace Opm {
51
52template <class TypeTag>
53class EcfvDiscretization;
54
55}
56
57namespace Opm::Properties {
58
60template<class TypeTag>
61struct Stencil<TypeTag, TTag::EcfvDiscretization>
62{
63private:
66
67public:
69};
70
72template<class TypeTag>
73struct DofMapper<TypeTag, TTag::EcfvDiscretization>
75
77template<class TypeTag>
78struct Discretization<TypeTag, TTag::EcfvDiscretization>
80
83template<class TypeTag>
86
88template<class TypeTag>
91
92#if HAVE_DUNE_FEM
94template<class TypeTag>
95struct DiscreteFunctionSpace<TypeTag, TTag::EcfvDiscretization>
96{
97private:
100 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
101 using FunctionSpace = Dune::Fem::FunctionSpace<typename GridPart::GridType::ctype,
102 Scalar,
103 GridPart::GridType::dimensionworld,
104 numEq>;
105
106public:
107 using type = Dune::Fem::FiniteVolumeSpace< FunctionSpace, GridPart, 0 >;
108};
109#else
110template <class TypeTag>
112{
115 explicit DummySpaceEcfv(const int&) {}
116};
117
118template <class TypeTag>
121#endif
122
125template<class TypeTag>
127{
128private:
131
132public:
134};
135
139template<class TypeTag>
141{ static constexpr bool value = true; };
142
145template<class TypeTag>
147{ static constexpr bool value = false; };
148
149} // namespace Opm::Properties
150
151namespace Opm {
152
158template<class TypeTag>
159class EcfvDiscretization : public GetPropType<TypeTag, Properties::BaseDiscretizationType>
160{
162 using Implementation = GetPropType<TypeTag, Properties::Model>;
168
169public:
170 explicit EcfvDiscretization(Simulator& simulator)
171 : ParentType(simulator)
172 {}
173
177 static std::string discretizationName()
178 { return "ecfv"; }
179
183 std::size_t numGridDof() const
184 { return static_cast<std::size_t>(this->gridView_.size(/*codim=*/0)); }
185
190 const DofMapper& dofMapper() const
191 { return this->elementMapper(); }
192
203 {
204 // syncronize the solution on the ghost and overlap elements
205 using GhostSyncHandle = GridCommHandleGhostSync<PrimaryVariables,
206 SolutionVector,
207 DofMapper,
208 /*commCodim=*/0>;
209
210 auto ghostSync = GhostSyncHandle(this->solution(/*timeIdx=*/0),
211 asImp_().dofMapper());
212 this->gridView().communicate(ghostSync,
213 Dune::InteriorBorder_All_Interface,
214 Dune::ForwardCommunication);
215 }
216
224 template <class Restarter>
225 void serialize(Restarter& res)
226 { res.template serializeEntities</*codim=*/0>(asImp_(), this->gridView_); }
227
235 template <class Restarter>
236 void deserialize(Restarter& res)
237 {
238 res.template deserializeEntities</*codim=*/0>(asImp_(), this->gridView_);
239 this->solution(/*timeIdx=*/1) = this->solution(/*timeIdx=*/0);
240 }
241
242private:
243 Implementation& asImp_()
244 { return *static_cast<Implementation*>(this); }
245
246 const Implementation& asImp_() const
247 { return *static_cast<const Implementation*>(this); }
248};
249
250} // namespace Opm
251
252#endif
Implements the discretization specific parts of writing files.
Definition: ecfvbaseoutputmodule.hh:41
The base class for the element-centered finite-volume discretization scheme.
Definition: ecfvdiscretization.hh:160
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition: ecfvdiscretization.hh:177
void serialize(Restarter &res)
Serializes the current state of the model.
Definition: ecfvdiscretization.hh:225
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition: ecfvdiscretization.hh:236
std::size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition: ecfvdiscretization.hh:183
EcfvDiscretization(Simulator &simulator)
Definition: ecfvdiscretization.hh:170
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices.
Definition: ecfvdiscretization.hh:190
void syncOverlap()
Syncronize the values of the primary variables on the degrees of freedom that overlap with the neighb...
Definition: ecfvdiscretization.hh:202
A class which provides types for DUNE grid handles for communication.
Definition: ecfvgridcommhandlefactory.hh:48
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization.
Definition: ecfvstencil.hh:69
Data handle for parallel communication which can be used to set the values values of ghost and overla...
Definition: gridcommhandles.hh:109
Uses communication on the grid to find the initial seed list of indices for methods which use element...
Definition: elementborderlistfromgrid.hh:49
Declare the basic properties used by the common infrastructure of the element-centered finite volume ...
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::ElementMapper > type
Definition: ecfvdiscretization.hh:74
The mapper to find the global index of a degree of freedom.
Definition: fvbaseproperties.hh:219
Definition: ecfvdiscretization.hh:112
DummySpaceEcfv(const int &)
Definition: ecfvdiscretization.hh:115
GetPropType< TypeTag, Properties::DiscreteFunctionSpace > DiscreteFunctionSpace
Definition: ecfvdiscretization.hh:113
DummySpaceEcfv(const DiscreteFunctionSpace &)
Definition: ecfvdiscretization.hh:114
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: fvbaseproperties.hh:181