multiphasebaseproblem.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) 2009-2013 by Andreas Lauser
5  Copyright (C) 2010 by Felix Bode
6 
7  This file is part of the Open Porous Media project (OPM).
8 
9  OPM is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 2 of the License, or
12  (at your option) any later version.
13 
14  OPM is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OPM. If not, see <http://www.gnu.org/licenses/>.
21 */
27 #ifndef EWOMS_MULTI_PHASE_BASE_PROBLEM_HH
28 #define EWOMS_MULTI_PHASE_BASE_PROBLEM_HH
29 
31 
34 
35 #include <opm/material/fluidmatrixinteractions/NullMaterial.hpp>
36 #include <opm/material/common/Means.hpp>
37 
38 #include <dune/common/fvector.hh>
39 #include <dune/common/fmatrix.hh>
40 
41 namespace Ewoms {
42 namespace Properties {
43 NEW_PROP_TAG(HeatConductionLawParams);
44 NEW_PROP_TAG(EnableGravity);
45 NEW_PROP_TAG(FluxModule);
46 }
47 
54 template<class TypeTag>
56  : public FvBaseProblem<TypeTag>
57  , public GET_PROP_TYPE(TypeTag, FluxModule)::FluxBaseProblem
58 {
60  typedef Ewoms::FvBaseProblem<TypeTag> ParentType;
61 
62  typedef typename GET_PROP_TYPE(TypeTag, Problem) Implementation;
63  typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
64  typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
65  typedef typename GET_PROP_TYPE(TypeTag, Simulator) Simulator;
66  typedef typename GET_PROP_TYPE(TypeTag, HeatConductionLawParams) HeatConductionLawParams;
67  typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw)::Params MaterialLawParams;
68 
69  enum { dimWorld = GridView::dimensionworld };
70  typedef Dune::FieldVector<Scalar, dimWorld> DimVector;
71  typedef Dune::FieldMatrix<Scalar, dimWorld, dimWorld> DimMatrix;
73 
74 public:
79  : ParentType(simulator)
80  { init_(); }
81 
85  static void registerParameters()
86  {
87  ParentType::registerParameters();
88 
89  EWOMS_REGISTER_PARAM(TypeTag, bool, EnableGravity,
90  "Use the gravity correction for the pressure gradients.");
91  }
92 
102  template <class Context>
103  void intersectionIntrinsicPermeability(DimMatrix &result,
104  const Context &context,
105  int intersectionIdx, int timeIdx) const
106  {
107  const auto &scvf = context.stencil(timeIdx).interiorFace(intersectionIdx);
108 
109  const DimMatrix &K1 = asImp_().intrinsicPermeability(context, scvf.interiorIndex(), timeIdx);
110  const DimMatrix &K2 = asImp_().intrinsicPermeability(context, scvf.exteriorIndex(), timeIdx);
111 
112  // entry-wise harmonic mean. this is almost certainly wrong if
113  // you have off-main diagonal entries in your permeabilities!
114  for (int i = 0; i < dimWorld; ++i)
115  for (int j = 0; j < dimWorld; ++j)
116  result[i][j] = Opm::harmonicMean(K1[i][j], K2[i][j]);
117  }
118 
122  // \{
123 
132  template <class Context>
133  const DimMatrix &intrinsicPermeability(const Context &context,
134  int spaceIdx, int timeIdx) const
135  {
136  OPM_THROW(std::logic_error,
137  "Not implemented: Problem::intrinsicPermeability()");
138  }
139 
149  template <class Context>
150  Scalar porosity(const Context &context,
151  int spaceIdx, int timeIdx) const
152  {
153  OPM_THROW(std::logic_error,
154  "Not implemented: Problem::porosity()");
155  }
156 
166  template <class Context>
167  Scalar heatCapacitySolid(const Context &context,
168  int spaceIdx, int timeIdx) const
169  {
170  OPM_THROW(std::logic_error,
171  "Not implemented: Problem::heatCapacitySolid()");
172  }
173 
183  template <class Context>
184  const HeatConductionLawParams&
185  heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
186  {
187  OPM_THROW(std::logic_error,
188  "Not implemented: Problem::heatConductionParams()");
189  }
190 
199  template <class Context>
200  Scalar tortuosity(const Context &context, int spaceIdx, int timeIdx) const
201  {
202  OPM_THROW(std::logic_error,
203  "Not implemented: Problem::tortuosity()");
204  }
205 
214  template <class Context>
215  Scalar dispersivity(const Context &context,
216  int spaceIdx, int timeIdx) const
217  {
218  OPM_THROW(std::logic_error,
219  "Not implemented: Problem::dispersivity()");
220  }
221 
235  template <class Context>
236  const MaterialLawParams &
237  materialLawParams(const Context &context, int spaceIdx, int timeIdx) const
238  {
239  static MaterialLawParams dummy;
240  return dummy;
241  }
242 
251  template <class Context>
252  Scalar temperature(const Context &context,
253  int spaceIdx, int timeIdx) const
254  { return asImp_().temperature(); }
255 
263  Scalar temperature() const
264  { OPM_THROW(std::logic_error,
265  "Not implemented:temperature() method not implemented by the actual problem"); }
266 
267 
276  template <class Context>
277  const DimVector &gravity(const Context &context,
278  int spaceIdx, int timeIdx) const
279  { return asImp_().gravity(); }
280 
290  const DimVector &gravity() const
291  { return gravity_; }
292 
293  // \}
294 
295 protected:
306  DimMatrix toDimMatrix_(Scalar val) const
307  {
308  DimMatrix ret(0.0);
309  for (int i = 0; i < DimMatrix::rows; ++i)
310  ret[i][i] = val;
311  return ret;
312  }
313 
314  DimVector gravity_;
315 
316 private:
318  Implementation &asImp_()
319  { return *static_cast<Implementation *>(this); }
321  const Implementation &asImp_() const
322  { return *static_cast<const Implementation *>(this); }
323 
324  void init_()
325  {
326  gravity_ = 0.0;
327  if (EWOMS_GET_PARAM(TypeTag, bool, EnableGravity))
328  gravity_[dimWorld-1] = -9.81;
329  }
330 };
331 
332 } // namespace Ewoms
333 
334 #endif
const DimVector & gravity() const
Returns the acceleration due to gravity .
Definition: multiphasebaseproblem.hh:290
Scalar temperature(const Context &context, int spaceIdx, int timeIdx) const
Returns the temperature within a control volume.
Definition: multiphasebaseproblem.hh:252
DimMatrix toDimMatrix_(Scalar val) const
Converts a Scalar value to an isotropic Tensor.
Definition: multiphasebaseproblem.hh:306
Declare the properties used by the infrastructure code of the finite volume discretizations.
Scalar temperature() const
Returns the temperature for an isothermal problem.
Definition: multiphasebaseproblem.hh:263
Base class for all problems which use a finite volume spatial discretization.
#define GET_PROP_TYPE(TypeTag, PropTagName)
Access the type attribute of a property for a type tag.
Definition: propertysystem.hh:485
Simulator & simulator()
Returns Simulator object used by the simulation.
Definition: fvbaseproblem.hh:504
MultiPhaseBaseProblem(Simulator &simulator)
Definition: multiphasebaseproblem.hh:78
Base class for all problems which use a finite volume spatial discretization.
Definition: fvbaseproblem.hh:52
NEW_PROP_TAG(Grid)
The type of the DUNE grid.
const HeatConductionLawParams & heatConductionParams(const Context &context, int spaceIdx, int timeIdx) const
Returns the parameter object for the heat conductivity law in a sub-control volume.
Definition: multiphasebaseproblem.hh:185
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:73
DimVector gravity_
Definition: multiphasebaseproblem.hh:314
const MaterialLawParams & materialLawParams(const Context &context, int spaceIdx, int timeIdx) const
Returns the material law parameters within a control volume.
Definition: multiphasebaseproblem.hh:237
Definition: baseauxiliarymodule.hh:35
Scalar porosity(const Context &context, int spaceIdx, int timeIdx) const
Returns the porosity [] of the porous medium for a given control volume.
Definition: multiphasebaseproblem.hh:150
#define EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description)
Register a run-time parameter.
Definition: parametersystem.hh:64
Scalar tortuosity(const Context &context, int spaceIdx, int timeIdx) const
Define the tortuosity.
Definition: multiphasebaseproblem.hh:200
Scalar heatCapacitySolid(const Context &context, int spaceIdx, int timeIdx) const
Returns the heat capacity [J/(K m^3)] of the solid phase with no pores in the sub-control volume...
Definition: multiphasebaseproblem.hh:167
The base class for the problems of ECFV discretizations which deal with a multi-phase flow through a ...
Definition: multiphasebaseproblem.hh:55
const DimVector & gravity(const Context &context, int spaceIdx, int timeIdx) const
Returns the acceleration due to gravity .
Definition: multiphasebaseproblem.hh:277
void intersectionIntrinsicPermeability(DimMatrix &result, const Context &context, int intersectionIdx, int timeIdx) const
Returns the intrinsic permeability of an intersection.
Definition: multiphasebaseproblem.hh:103
Defines the common properties required by the porous medium multi-phase models.
const DimMatrix & intrinsicPermeability(const Context &context, int spaceIdx, int timeIdx) const
Returns the intrinsic permeability tensor at a given position.
Definition: multiphasebaseproblem.hh:133
Scalar dispersivity(const Context &context, int spaceIdx, int timeIdx) const
Define the dispersivity.
Definition: multiphasebaseproblem.hh:215
static void registerParameters()
Register all run-time parameters for the problem and the model.
Definition: multiphasebaseproblem.hh:85
#define EWOMS_GET_PARAM(TypeTag, ParamType, ParamName)
Retrieve a runtime parameter.
Definition: parametersystem.hh:95