opm-simulators/opm/core/utility/miscUtilities.hpp
Atgeirr Flø Rasmussen b058678235 Moved simulator utility functions to opm/core/utility/miscUtilities.hpp.
We want to avoid having hundreds of files with a single function, therefore
these functions have been lumped together. With time, a more sophisticated
organization of such free functions may be in order.
2012-02-26 21:05:19 +01:00

85 lines
3.2 KiB
C++

/*
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 <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_MISCUTILITIES_HEADER_INCLUDED
#define OPM_MISCUTILITIES_HEADER_INCLUDED
#include <opm/core/grid.h>
#include <opm/core/fluid/IncompPropertiesInterface.hpp>
#include <vector>
namespace Opm
{
/// @brief Computes pore volume of all cells in a grid.
/// @param[in] grid a grid
/// @param[in] props rock and fluid properties
/// @param[out] porevol the pore volume by cell.
void computePorevolume(const UnstructuredGrid& grid,
const Opm::IncompPropertiesInterface& props,
std::vector<double>& porevol);
/// @brief Computes total mobility for a set of saturation values.
/// @param[in] props rock and fluid properties
/// @param[int] cells cells with which the saturation values are associated
/// @param[in] s saturation values (for all phases)
/// @param[out] totmob total mobilities.
void computeTotalMobility(const Opm::IncompPropertiesInterface& props,
const std::vector<int>& cells,
const std::vector<double>& s,
std::vector<double>& totmob);
/// @brief Computes total mobility and omega for a set of saturation values.
/// @param[in] props rock and fluid properties
/// @param[int] cells cells with which the saturation values are associated
/// @param[in] s saturation values (for all phases)
/// @param[out] totmob total mobility
/// @param[out] omega mobility-weighted (or fractional-flow weighted)
/// fluid densities.
void computeTotalMobilityOmega(const Opm::IncompPropertiesInterface& props,
const std::vector<int>& cells,
const std::vector<double>& s,
std::vector<double>& totmob,
std::vector<double>& omega);
/// @brief Estimates a scalar cell velocity from face fluxes.
/// @param[in] grid a grid
/// @param[in] face_flux signed per-face fluxes
/// @param[out] cell_velocity the estimated velocities.
void estimateCellVelocity(const UnstructuredGrid& grid,
const std::vector<double>& face_flux,
std::vector<double>& cell_velocity);
/// Extract a vector of water saturations from a vector of
/// interleaved water and oil saturations.
void toWaterSat(const std::vector<double>& sboth,
std::vector<double>& sw);
/// Make a a vector of interleaved water and oil saturations from
/// a vector of water saturations.
void toBothSat(const std::vector<double>& sw,
std::vector<double>& sboth);
} // namespace Opm
#endif // OPM_MISCUTILITIES_HEADER_INCLUDED