28 #ifndef EWOMS_ECFV_DISCRETIZATION_HH
29 #define EWOMS_ECFV_DISCRETIZATION_HH
31 #include <opm/material/densead/Math.hpp>
42 #include <dune/fem/space/common/functionspace.hh>
43 #include <dune/fem/space/finitevolume.hh>
47 template <
class TypeTag>
48 class EcfvDiscretization;
52 namespace Properties {
54 SET_PROP(EcfvDiscretization, Stencil)
61 typedef Ewoms::EcfvStencil<Scalar, GridView> type;
68 SET_TYPE_PROP(EcfvDiscretization, Discretization, Ewoms::EcfvDiscretization<TypeTag>);
73 Ewoms::EcfvBaseOutputModule<TypeTag>);
77 Ewoms::EcfvGridCommHandleFactory<TypeTag>);
80 SET_PROP(EcfvDiscretization, DiscreteFunctionSpace)
87 typedef Dune::Fem::FunctionSpace<
typename GridPart::GridType::ctype,
89 GridPart::GridType::dimensionworld,
92 typedef Dune::Fem::FiniteVolumeSpace< FunctionSpace, GridPart, 0 > type;
98 SET_PROP(EcfvDiscretization, BorderListCreator)
100 typedef typename GET_PROP_TYPE(TypeTag, ElementMapper) ElementMapper;
103 typedef Ewoms::Linear::ElementBorderListFromGrid<GridView, ElementMapper> type;
109 SET_BOOL_PROP(EcfvDiscretization, LinearizeNonLocalElements, true);
113 SET_BOOL_PROP(EcfvDiscretization, UseLinearizationLock, false);
124 template<
class TypeTag>
125 class EcfvDiscretization :
public FvBaseDiscretization<TypeTag>
127 typedef FvBaseDiscretization<TypeTag> ParentType;
129 typedef typename GET_PROP_TYPE(TypeTag, Model) Implementation;
130 typedef typename
GET_PROP_TYPE(TypeTag, DofMapper) DofMapper;
131 typedef typename
GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
132 typedef typename
GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
134 typedef typename
GET_PROP_TYPE(TypeTag, Simulator) Simulator;
137 EcfvDiscretization(Simulator& simulator)
138 : ParentType(simulator)
151 {
return static_cast<size_t>(this->gridView_.size(0)); }
158 {
return this->elementMapper(); }
177 auto ghostSync = GhostSyncHandle(this->solution(0),
178 asImp_().dofMapper());
179 this->gridView().communicate(ghostSync,
180 Dune::InteriorBorder_All_Interface,
181 Dune::ForwardCommunication);
191 template <
class Restarter>
193 { res.template serializeEntities<0>(asImp_(), this->gridView_); }
202 template <
class Restarter>
205 res.template deserializeEntities<0>(asImp_(), this->gridView_);
206 this->solution(1) = this->solution(0);
210 Implementation& asImp_()
211 {
return *
static_cast<Implementation*
>(
this); }
212 const Implementation& asImp_()
const
213 {
return *
static_cast<const Implementation*
>(
this); }
void serialize(Restarter &res)
Serializes the current state of the model.
Definition: ecfvdiscretization.hh:192
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition: ecfvdiscretization.hh:203
#define SET_BOOL_PROP(EffTypeTagName, PropTagName,...)
Set a property to a simple constant boolean value.
Definition: propertysystem.hh:361
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization.
void syncOverlap()
Syncronize the values of the primary variables on the degrees of freedom that overlap with the neighb...
Definition: ecfvdiscretization.hh:169
#define GET_PROP_VALUE(TypeTag, PropTagName)
Access the value attribute of a property for a type tag.
Definition: propertysystem.hh:469
size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition: ecfvdiscretization.hh:150
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:486
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition: ecfvdiscretization.hh:144
The base class for the finite volume discretization schemes.
A class which provides types for DUNE grid handles for communication.
#define SET_PROP(EffTypeTagName, PropTagName)
Set a property for a specific type tag.
Definition: propertysystem.hh:297
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices...
Definition: ecfvdiscretization.hh:157
Uses communication on the grid to find the initial seed list of indices for methods which use element...
Implements the discretization specific parts of writing files.
Data handle for parallel communication which can be used to set the values values of ghost and overla...
Definition: gridcommhandles.hh:103
#define SET_TYPE_PROP(EffTypeTagName, PropTagName,...)
Set a property which defines a type.
Definition: propertysystem.hh:377
Declare the basic properties used by the common infrastructure of the element-centered finite volume ...