mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-15 11:23:24 -06:00
Moved DerivedGeology class to GeoProps.hpp.
Also, it is no longer a template (but its constructor is).
This commit is contained in:
parent
511ab37dc4
commit
e86aa3324c
@ -67,6 +67,7 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/autodiff/AutoDiff.hpp
|
||||
opm/autodiff/BlackoilPropsAd.hpp
|
||||
opm/autodiff/BlackoilPropsAdInterface.hpp
|
||||
opm/autodiff/GeoProps.hpp
|
||||
opm/autodiff/ImpesTPFAAD.hpp
|
||||
opm/autodiff/SimulatorIncompTwophaseAdfi.hpp
|
||||
opm/autodiff/TransportSolverTwophaseAd.hpp
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#define HACK_INCOMPRESSIBLE_GRAVITY 0
|
||||
|
||||
#include <opm/autodiff/GeoProps.hpp>
|
||||
#include <opm/autodiff/ImpesTPFAAD.hpp>
|
||||
#include <opm/autodiff/BlackoilPropsAd.hpp>
|
||||
|
||||
@ -32,8 +33,6 @@
|
||||
|
||||
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
||||
|
||||
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
|
||||
@ -44,63 +43,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
template <class Geology, class Vector>
|
||||
class DerivedGeology {
|
||||
public:
|
||||
typedef Vector V;
|
||||
|
||||
DerivedGeology(const UnstructuredGrid& grid,
|
||||
const Geology& geo ,
|
||||
const double* grav = 0)
|
||||
: pvol_ (grid.number_of_cells)
|
||||
, trans_(grid.number_of_faces)
|
||||
, gpot_ (grid.cell_facepos[ grid.number_of_cells ])
|
||||
{
|
||||
// Pore volume
|
||||
const typename Vector::Index nc = grid.number_of_cells;
|
||||
std::transform(grid.cell_volumes, grid.cell_volumes + nc,
|
||||
geo.porosity(), pvol_.data(),
|
||||
std::multiplies<double>());
|
||||
|
||||
// Transmissibility
|
||||
Vector htrans(grid.cell_facepos[nc]);
|
||||
UnstructuredGrid* ug = const_cast<UnstructuredGrid*>(& grid);
|
||||
tpfa_htrans_compute(ug, geo.permeability(), htrans.data());
|
||||
tpfa_trans_compute (ug, htrans.data() , trans_.data());
|
||||
|
||||
if (grav != 0) {
|
||||
const typename Vector::Index nd = grid.dimensions;
|
||||
|
||||
for (typename Vector::Index c = 0; c < nc; ++c) {
|
||||
const double* const cc = & grid.cell_centroids[c*nd + 0];
|
||||
|
||||
const int* const p = grid.cell_facepos;
|
||||
for (int i = p[c]; i < p[c + 1]; ++i) {
|
||||
const int f = grid.cell_faces[i];
|
||||
|
||||
const double* const fc = & grid.face_centroids[f*nd + 0];
|
||||
|
||||
for (typename Vector::Index d = 0; d < nd; ++d) {
|
||||
gpot_[i] += grav[d] * (fc[d] - cc[d]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Vector& poreVolume() const { return pvol_ ; }
|
||||
const Vector& transmissibility() const { return trans_; }
|
||||
const Vector& gravityPotential() const { return gpot_ ; }
|
||||
|
||||
private:
|
||||
Vector pvol_ ;
|
||||
Vector trans_;
|
||||
Vector gpot_ ;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -117,7 +59,7 @@ main(int argc, char* argv[])
|
||||
|
||||
typedef AutoDiff::ForwardBlock<double> ADB;
|
||||
typedef Opm::BlackoilPropertiesInterface Geology;
|
||||
typedef DerivedGeology<Geology, ADB::V> GeoProps;
|
||||
typedef Opm::DerivedGeology GeoProps;
|
||||
typedef Opm::BlackoilPropsAd BOFluid;
|
||||
typedef Opm::ImpesTPFAAD<GeoProps> PSolver;
|
||||
|
||||
|
91
opm/autodiff/GeoProps.hpp
Normal file
91
opm/autodiff/GeoProps.hpp
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright 2013 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef OPM_GEOPROPS_HEADER_INCLUDED
|
||||
#define OPM_GEOPROPS_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
||||
#include <Eigen/Eigen>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
class DerivedGeology
|
||||
{
|
||||
public:
|
||||
typedef Eigen::ArrayXd Vector;
|
||||
|
||||
/// Construct contained derived geological properties
|
||||
/// from grid and property information.
|
||||
template <class Props>
|
||||
DerivedGeology(const UnstructuredGrid& grid,
|
||||
const Props& props ,
|
||||
const double* grav = 0)
|
||||
: pvol_ (grid.number_of_cells)
|
||||
, trans_(grid.number_of_faces)
|
||||
, gpot_ (grid.cell_facepos[ grid.number_of_cells ])
|
||||
{
|
||||
// Pore volume
|
||||
const typename Vector::Index nc = grid.number_of_cells;
|
||||
std::transform(grid.cell_volumes, grid.cell_volumes + nc,
|
||||
props.porosity(), pvol_.data(),
|
||||
std::multiplies<double>());
|
||||
|
||||
// Transmissibility
|
||||
Vector htrans(grid.cell_facepos[nc]);
|
||||
UnstructuredGrid* ug = const_cast<UnstructuredGrid*>(& grid);
|
||||
tpfa_htrans_compute(ug, props.permeability(), htrans.data());
|
||||
tpfa_trans_compute (ug, htrans.data() , trans_.data());
|
||||
|
||||
if (grav != 0) {
|
||||
const typename Vector::Index nd = grid.dimensions;
|
||||
|
||||
for (typename Vector::Index c = 0; c < nc; ++c) {
|
||||
const double* const cc = & grid.cell_centroids[c*nd + 0];
|
||||
|
||||
const int* const p = grid.cell_facepos;
|
||||
for (int i = p[c]; i < p[c + 1]; ++i) {
|
||||
const int f = grid.cell_faces[i];
|
||||
|
||||
const double* const fc = & grid.face_centroids[f*nd + 0];
|
||||
|
||||
for (typename Vector::Index d = 0; d < nd; ++d) {
|
||||
gpot_[i] += grav[d] * (fc[d] - cc[d]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Vector& poreVolume() const { return pvol_ ; }
|
||||
const Vector& transmissibility() const { return trans_; }
|
||||
const Vector& gravityPotential() const { return gpot_ ; }
|
||||
|
||||
private:
|
||||
Vector pvol_ ;
|
||||
Vector trans_;
|
||||
Vector gpot_ ;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // OPM_GEOPROPS_HEADER_INCLUDED
|
Loading…
Reference in New Issue
Block a user