My Project
Loading...
Searching...
No Matches
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
33#include "ecfvproperties.hh"
34#include "ecfvstencil.hh"
37
40
41#if HAVE_DUNE_FEM
43#include <dune/fem/space/common/functionspace.hh>
44#include <dune/fem/space/finitevolume.hh>
45#endif
46
47namespace Opm {
48template <class TypeTag>
49class EcfvDiscretization;
50}
51
52namespace Opm::Properties {
53
55template<class TypeTag>
56struct Stencil<TypeTag, TTag::EcfvDiscretization>
57{
58private:
61
62public:
64};
65
67template<class TypeTag>
69
71template<class TypeTag>
73
76template<class TypeTag>
79
81template<class TypeTag>
84
85#if HAVE_DUNE_FEM
87template<class TypeTag>
88struct DiscreteFunctionSpace<TypeTag, TTag::EcfvDiscretization>
89{
90private:
94 using FunctionSpace = Dune::Fem::FunctionSpace<typename GridPart::GridType::ctype,
95 Scalar,
96 GridPart::GridType::dimensionworld,
97 numEq>;
98public:
99 using type = Dune::Fem::FiniteVolumeSpace< FunctionSpace, GridPart, 0 >;
100};
101#else
102template <class TypeTag>
105 DummySpaceEcfv(const DiscreteFunctionSpace&) {};
106 DummySpaceEcfv(const int&) {};
107};
108
109template <class TypeTag>
112};
113#endif
114
117template<class TypeTag>
125
129template<class TypeTag>
130struct LinearizeNonLocalElements<TypeTag, TTag::EcfvDiscretization> { static constexpr bool value = true; };
131
134template<class TypeTag>
135struct UseLinearizationLock<TypeTag, TTag::EcfvDiscretization> { static constexpr bool value = false; };
136
137} // namespace Opm::Properties
138
139namespace Opm {
145template<class TypeTag>
146class EcfvDiscretization : public GetPropType<TypeTag, Properties::BaseDiscretizationType>
147{
149 using Implementation = GetPropType<TypeTag, Properties::Model>;
155
156public:
157 EcfvDiscretization(Simulator& simulator)
158 : ParentType(simulator)
159 { }
160
164 static std::string discretizationName()
165 { return "ecfv"; }
166
170 size_t numGridDof() const
171 { return static_cast<size_t>(this->gridView_.size(/*codim=*/0)); }
172
177 const DofMapper& dofMapper() const
178 { return this->elementMapper(); }
179
190 {
191 // syncronize the solution on the ghost and overlap elements
192 using GhostSyncHandle = GridCommHandleGhostSync<PrimaryVariables,
193 SolutionVector,
194 DofMapper,
195 /*commCodim=*/0>;
196
197 auto ghostSync = GhostSyncHandle(this->solution(/*timeIdx=*/0),
198 asImp_().dofMapper());
199 this->gridView().communicate(ghostSync,
200 Dune::InteriorBorder_All_Interface,
201 Dune::ForwardCommunication);
202 }
203
211 template <class Restarter>
212 void serialize(Restarter& res)
213 { res.template serializeEntities</*codim=*/0>(asImp_(), this->gridView_); }
214
222 template <class Restarter>
223 void deserialize(Restarter& res)
224 {
225 res.template deserializeEntities</*codim=*/0>(asImp_(), this->gridView_);
226 this->solution(/*timeIdx=*/1) = this->solution(/*timeIdx=*/0);
227 }
228
229private:
230 Implementation& asImp_()
231 { return *static_cast<Implementation*>(this); }
232 const Implementation& asImp_() const
233 { return *static_cast<const Implementation*>(this); }
234};
235} // namespace Opm
236
237#endif
Implements the discretization specific parts of writing files.
Definition ecfvbaseoutputmodule.hh:43
The base class for the element-centered finite-volume discretization scheme.
Definition OutputBlackoilModule.hpp:80
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition ecfvdiscretization.hh:164
void serialize(Restarter &res)
Serializes the current state of the model.
Definition ecfvdiscretization.hh:212
size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition ecfvdiscretization.hh:170
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition ecfvdiscretization.hh:223
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices.
Definition ecfvdiscretization.hh:177
void syncOverlap()
Syncronize the values of the primary variables on the degrees of freedom that overlap with the neighb...
Definition ecfvdiscretization.hh:189
A class which provides types for DUNE grid handles for communication.
Definition ecfvgridcommhandlefactory.hh:46
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization.
Definition ecfvstencil.hh:61
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
Manages the initializing and running of time dependent problems.
Definition simulator.hh:92
Implements the discretization specific parts of writing files.
A class which provides types for DUNE grid handles for communication.
Declare the basic properties used by the common infrastructure of the element-centered finite volume ...
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization.
Uses communication on the grid to find the initial seed list of indices for methods which use element...
The base class for the finite volume discretization schemes.
The base class for the finite volume discretization schemes.
This file contains a set of helper functions used by VFPProd / VFPInj.
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:235
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
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
The type of the spatial discretization used by the model.
Definition fvbaseproperties.hh:88
The mapper to find the global index of a degree of freedom.
Definition fvbaseproperties.hh:219
Definition ecfvdiscretization.hh:103
The class to create grid communication handles.
Definition fvbaseproperties.hh:168
Specify if elements that do not belong to the local process' grid partition should be skipped.
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
use locking to prevent race conditions when linearizing the global system of equations in multi-threa...
Definition fvbaseproperties.hh:181