mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
90 lines
2.9 KiB
C++
90 lines
2.9 KiB
C++
// $Id: boxspatialparameters.hh 3783 2010-06-24 11:33:53Z bernd $
|
|
/*****************************************************************************
|
|
* Copyright (C) 2010 by Andreas Lauser *
|
|
* Institute of Hydraulic Engineering *
|
|
* University of Stuttgart, Germany *
|
|
* email: <givenname>.<name>@iws.uni-stuttgart.de *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version, as long as this copyright notice *
|
|
* is included in its original form. *
|
|
* *
|
|
* This program is distributed WITHOUT ANY WARRANTY. *
|
|
*****************************************************************************/
|
|
/*!
|
|
* \file
|
|
*
|
|
* \brief The base class for spatial parameters of problems using the
|
|
* box method.
|
|
*/
|
|
#ifndef DUMUX_BOX_SPATIAL_PARAMETERS_HH
|
|
#define DUMUX_BOX_SPATIAL_PARAMETERS_HH
|
|
|
|
#include <dumux/common/propertysystem.hh>
|
|
#include <dumux/common/math.hh>
|
|
|
|
#include <dune/common/fmatrix.hh>
|
|
|
|
namespace Dumux
|
|
{
|
|
|
|
/**
|
|
* \brief The base class for spatial parameters of problems using the
|
|
* box method.
|
|
*/
|
|
template<class TypeTag>
|
|
class BoxSpatialParameters
|
|
{
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
|
|
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
|
|
|
|
enum {
|
|
dimWorld = GridView::dimensionworld
|
|
};
|
|
|
|
typedef typename GridView::ctype CoordScalar;
|
|
typedef Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld> Tensor;
|
|
|
|
public:
|
|
BoxSpatialParameters(const GridView &gv)
|
|
{ }
|
|
|
|
~BoxSpatialParameters()
|
|
{}
|
|
|
|
/*!
|
|
* \brief Averages the intrinsic permeability.
|
|
*/
|
|
const void meanK(Tensor &result,
|
|
Scalar K1,
|
|
Scalar K2) const
|
|
{
|
|
const Scalar K = Dumux::harmonicMean(K1, K2);
|
|
for (int i = 0; i < dimWorld; ++i) {
|
|
for (int j = 0; j < dimWorld; ++j)
|
|
result[i][j] = 0;
|
|
result[i][i] = K;
|
|
}
|
|
}
|
|
|
|
/*!
|
|
* \brief Averages the intrinsic permeability.
|
|
*/
|
|
const void meanK(Tensor &result,
|
|
const Tensor &K1,
|
|
const Tensor &K2) const
|
|
{
|
|
// entry-wise harmonic mean. this is almost certainly wrong if
|
|
// you have off-main diagonal entries in your permeabilities!
|
|
for (int i = 0; i < dimWorld; ++i)
|
|
for (int j = 0; j < dimWorld; ++j)
|
|
result[i][j] = harmonicMean(K1[i][j], K2[i][j]);
|
|
}
|
|
};
|
|
|
|
} // namespace Dumux
|
|
|
|
#endif
|