From 9b49b0d0898bfaee29cf112fab158f4b39ac17ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Tue, 17 Jan 2012 09:31:25 +0100 Subject: [PATCH] Added RockBasic class. --- Makefile.am | 2 + opm/core/fluid/RockBasic.cpp | 54 ++++++++++++++++++++++++ opm/core/fluid/RockBasic.hpp | 79 ++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 opm/core/fluid/RockBasic.cpp create mode 100644 opm/core/fluid/RockBasic.hpp diff --git a/Makefile.am b/Makefile.am index 4991ade9..60e5779c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,7 @@ opm/core/fluid/blackoil/SinglePvtLiveGas.cpp \ opm/core/fluid/blackoil/SinglePvtLiveOil.cpp \ opm/core/fluid/blackoil/SinglePvtInterface.cpp \ opm/core/fluid/BlackoilPropertiesFromDeck.cpp \ +opm/core/fluid/RockBasic.cpp \ opm/core/fluid/RockFromDeck.cpp \ opm/core/fluid/SaturationPropsFromDeck.cpp \ opm/core/utility/MonotCubicInterpolator.cpp \ @@ -86,6 +87,7 @@ opm/core/eclipse/SpecialEclipseFields.hpp \ opm/core/fluid/BlackoilFluid.hpp \ opm/core/fluid/BlackoilPropertiesInterface.hpp \ opm/core/fluid/BlackoilPropertiesFromDeck.hpp \ +opm/core/fluid/RockBasic.hpp \ opm/core/fluid/RockFromDeck.hpp \ opm/core/fluid/SaturationPropsFromDeck.hpp \ opm/core/fluid/SimpleFluid2p.hpp \ diff --git a/opm/core/fluid/RockBasic.cpp b/opm/core/fluid/RockBasic.cpp new file mode 100644 index 00000000..4bd2942d --- /dev/null +++ b/opm/core/fluid/RockBasic.cpp @@ -0,0 +1,54 @@ +/* + Copyright 2012 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 . +*/ + +#include + +namespace Opm +{ + + + /// Default constructor. + RockBasic::RockBasic() + : dimensions_(-1) + { + } + + + /// Initialize with homogenous porosity and permeability. + void RockBasic::init(const int dimensions, + const int num_cells, + const double poro, + const double perm) + { + dimensions_ = dimensions; + porosity_.clear(); + porosity_.resize(num_cells, poro); + permeability_.clear(); + const int dsq = dimensions*dimensions; + permeability_.resize(num_cells*dsq, 0.0); +#pragma omp parallel for + for (int i = 0; i < num_cells; ++i) { + for (int d = 0; d < dimensions; ++d) { + permeability_[dsq*i + dimensions*d + d] = perm; + } + } + } + + +} // namespace Opm diff --git a/opm/core/fluid/RockBasic.hpp b/opm/core/fluid/RockBasic.hpp new file mode 100644 index 00000000..96563780 --- /dev/null +++ b/opm/core/fluid/RockBasic.hpp @@ -0,0 +1,79 @@ +/* + Copyright 2012 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 . +*/ + +#ifndef OPM_ROCKBASIC_HEADER_INCLUDED +#define OPM_ROCKBASIC_HEADER_INCLUDED + + +#include + + +namespace Opm +{ + + class RockBasic + { + public: + /// Default constructor. + RockBasic(); + + /// Initialize with homogenous porosity and permeability. + void init(const int dimensions, + const int num_cells, + const double poro, + const double perm); + + /// \return D, the number of spatial dimensions. + int numDimensions() const + { + return dimensions_; + } + + /// \return N, the number of cells. + int numCells() const + { + return porosity_.size(); + } + + /// \return Array of N porosity values. + const double* porosity() const + { + return &porosity_[0]; + } + + /// \return Array of ND^2 permeability values. + /// The D^2 permeability values for a cell are organized as a matrix, + /// which is symmetric (so ordering does not matter). + const double* permeability() const + { + return &permeability_[0]; + } + + private: + int dimensions_; + std::vector porosity_; + std::vector permeability_; + }; + + + +} // namespace Opm + + +#endif // OPM_ROCKBASIC_HEADER_INCLUDED