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  Copyright (C) 2008-2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
26 #ifndef EWOMS_ECFV_DISCRETIZATION_HH
27 #define EWOMS_ECFV_DISCRETIZATION_HH
28 
29 #include <opm/material/localad/Math.hpp>
30 
31 #include "ecfvproperties.hh"
32 #include "ecfvstencil.hh"
34 #include "ecfvbaseoutputmodule.hh"
35 
38 
39 namespace Ewoms {
40 template <class TypeTag>
41 class EcfvDiscretization;
42 }
43 
44 namespace Ewoms {
45 namespace Properties {
48 {
49 private:
50  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
51  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
52 
53 public:
55 };
56 
58 SET_TYPE_PROP(EcfvDiscretization, DofMapper, typename GET_PROP_TYPE(TypeTag, ElementMapper));
59 
62 
65 SET_TYPE_PROP(EcfvDiscretization, DiscBaseOutputModule,
67 
69 SET_TYPE_PROP(EcfvDiscretization, GridCommHandleFactory,
71 
74 SET_PROP(EcfvDiscretization, BorderListCreator)
75 { private:
76  typedef typename GET_PROP_TYPE(TypeTag, ElementMapper) ElementMapper;
77  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
78 public:
80 };
81 
85 SET_BOOL_PROP(EcfvDiscretization, LinearizeNonLocalElements, true);
86 
87 } // namespace Properties
88 } // namespace Ewoms
89 
90 namespace Ewoms {
96 template<class TypeTag>
97 class EcfvDiscretization : public FvBaseDiscretization<TypeTag>
98 {
99  typedef FvBaseDiscretization<TypeTag> ParentType;
100 
101  typedef typename GET_PROP_TYPE(TypeTag, Model) Implementation;
102  typedef typename GET_PROP_TYPE(TypeTag, DofMapper) DofMapper;
103  typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
104  typedef typename GET_PROP_TYPE(TypeTag, SolutionVector) SolutionVector;
105  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
106  typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
107 
108 
109 
110 public:
111  EcfvDiscretization(Simulator &simulator)
112  : ParentType(simulator)
113  { }
114 
118  static std::string discretizationName()
119  { return "ecfv"; }
120 
124  size_t numGridDof() const
125  { return this->gridView_.size(/*codim=*/0); }
126 
131  const DofMapper &dofMapper() const
132  { return this->simulator_.problem().elementMapper(); }
133 
143  void syncOverlap()
144  {
145  // syncronize the solution on the ghost and overlap elements
146  typedef GridCommHandleGhostSync<PrimaryVariables,
147  SolutionVector,
148  DofMapper,
149  /*commCodim=*/0> GhostSyncHandle;
150 
151  auto ghostSync = GhostSyncHandle(this->solution_[/*timeIdx=*/0],
152  asImp_().dofMapper());
153  this->gridView().communicate(ghostSync,
154  Dune::InteriorBorder_All_Interface,
155  Dune::ForwardCommunication);
156  }
157 
165  template <class Restarter>
166  void serialize(Restarter &res)
167  { res.template serializeEntities</*codim=*/0>(asImp_(), this->gridView_); }
168 
176  template <class Restarter>
177  void deserialize(Restarter &res)
178  {
179  res.template deserializeEntities</*codim=*/0>(asImp_(), this->gridView_);
180  this->solution_[/*timeIdx=*/1] = this->solution_[/*timeIdx=*/0];
181  }
182 
183 private:
184  Implementation &asImp_()
185  { return *static_cast<Implementation*>(this); }
186  const Implementation &asImp_() const
187  { return *static_cast<const Implementation*>(this); }
188 };
189 } // namespace Ewoms
190 
191 #endif
SolutionVector solution_[historySize]
Definition: fvbasediscretization.hh:1546
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization.
Definition: ecfvstencil.hh:51
const GridView & gridView() const
Reference to the grid view of the spatial domain.
Definition: fvbasediscretization.hh:1399
Problem & problem()
Return the object which specifies the pysical setup of the simulation.
Definition: simulator.hh:189
Data handle for parallel communication which can be used to set the values values of ghost and overla...
Definition: gridcommhandles.hh:107
GridView gridView_
Definition: fvbasediscretization.hh:1531
const DofMapper & dofMapper() const
Mapper to convert the Dune entities of the discretization's degrees of freedoms are to indices...
Definition: ecfvdiscretization.hh:131
Implements the discretization specific parts of writing files.
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
void serialize(Restarter &res)
Serializes the current state of the model.
Definition: ecfvdiscretization.hh:166
SET_PROP(NumericModel, ParameterTree)
Set the ParameterTree property.
Definition: basicproperties.hh:117
Represents the stencil (finite volume geometry) of a single element in the ECFV discretization.
Implements the discretization specific parts of writing files.
Definition: ecfvbaseoutputmodule.hh:40
void deserialize(Restarter &res)
Deserializes the state of the model.
Definition: ecfvdiscretization.hh:177
size_t numGridDof() const
Returns the number of global degrees of freedom (DOFs) due to the grid.
Definition: ecfvdiscretization.hh:124
The base class for the finite volume discretization schemes.
SET_TYPE_PROP(NumericModel, Scalar, double)
Set the default type of scalar values to double.
The base class for the element-centered finite-volume discretization scheme.
Definition: fvbasegradientcalculator.hh:35
Uses communication on the grid to find the initial seed list of indices for methods which use element...
Definition: elementborderlistfromgrid.hh:48
Definition: baseauxiliarymodule.hh:35
static std::string discretizationName()
Returns a string of discretization's human-readable name.
Definition: ecfvdiscretization.hh:118
Simulator & simulator_
Definition: fvbasediscretization.hh:1528
A class which provides types for DUNE grid handles for communication.
Definition: ecfvgridcommhandlefactory.hh:43
Declare the basic properties used by the common infrastructure of the element-centered finite volume ...
A class which provides types for DUNE grid handles for communication.
Uses communication on the grid to find the initial seed list of indices for methods which use element...
void syncOverlap()
Syncronize the values of the primary variables on the degrees of freedom that overlap with the neighb...
Definition: ecfvdiscretization.hh:143
SET_BOOL_PROP(FvBaseDiscretization, EnableVtkOutput, true)
Enable the VTK output by default.