Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
/*
|
|
|
|
Copyright 2014 SINTEF ICT, Applied Mathematics.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
/* --- Boost.Test boilerplate --- */
|
|
|
|
#if HAVE_DYNAMIC_BOOST_TEST
|
|
|
|
#define BOOST_TEST_DYN_LINK
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NVERBOSE // Suppress own messages when throw()ing
|
|
|
|
|
|
|
|
#define BOOST_TEST_MODULE UnitsTest
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <boost/test/floating_point_comparison.hpp>
|
|
|
|
|
|
|
|
/* --- our own headers --- */
|
|
|
|
|
|
|
|
#include <opm/core/simulator/initStateEquil.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/grid.h>
|
|
|
|
#include <opm/core/grid/cart_grid.h>
|
|
|
|
|
|
|
|
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
|
|
|
#include <opm/core/props/BlackoilPhases.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
|
|
|
#include <opm/core/utility/Units.hpp>
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <iostream>
|
|
|
|
#include <limits>
|
|
|
|
#include <memory>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE ()
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE (PhasePressure)
|
|
|
|
{
|
|
|
|
typedef std::vector<double> PVal;
|
|
|
|
typedef std::vector<PVal> PPress;
|
|
|
|
|
|
|
|
std::shared_ptr<UnstructuredGrid>
|
|
|
|
G(create_grid_cart3d(10, 1, 10), destroy_grid);
|
|
|
|
|
|
|
|
Opm::parameter::ParameterGroup param;
|
|
|
|
{
|
|
|
|
using Opm::unit::kilogram;
|
|
|
|
using Opm::unit::meter;
|
|
|
|
using Opm::unit::cubic;
|
|
|
|
|
|
|
|
std::stringstream dens; dens << 700*kilogram/cubic(meter);
|
|
|
|
param.insertParameter("rho2", dens.str());
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef Opm::BlackoilPropertiesBasic Props;
|
|
|
|
Props props(param, G->dimensions, G->number_of_cells);
|
|
|
|
|
|
|
|
typedef Opm::equil::DensityCalculator<Opm::BlackoilPropertiesInterface> RhoCalc;
|
|
|
|
RhoCalc calc(props, 0);
|
|
|
|
|
|
|
|
Opm::equil::EquilRecord record =
|
|
|
|
{
|
|
|
|
{ 0 , 1e5 } , // Datum depth, pressure
|
|
|
|
{ 5 , 0 } , // Zwoc , Pcow_woc
|
|
|
|
{ 0 , 0 } // Zgoc , Pcgo_goc
|
|
|
|
};
|
|
|
|
|
|
|
|
Opm::equil::EquilReg<RhoCalc>
|
|
|
|
region(record, calc,
|
|
|
|
Opm::equil::miscibility::NoMixing(),
|
|
|
|
Opm::equil::miscibility::NoMixing(),
|
|
|
|
props.phaseUsage());
|
|
|
|
|
2014-01-17 10:43:27 -06:00
|
|
|
std::vector<int> cells(G->number_of_cells);
|
|
|
|
std::iota(cells.begin(), cells.end(), 0);
|
|
|
|
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
const double grav = 10;
|
2014-01-17 10:43:27 -06:00
|
|
|
const PPress ppress = Opm::equil::phasePressures(*G, region, cells, grav);
|
Add basic equilibration facility
This commit adds a simple facility for calculating initial phase
pressures assuming stationary conditions, a known reference pressure
in the oil zone as well as the depth and capillary pressures at the
water-oil and gas-oil contacts.
Function 'Opm::equil::phasePressures()' uses a simple ODE/IVP-based
approach, solved using the traditional RK4 method with constant step
sizes, to derive the required pressure values. Specifically, we
solve the ODE
dp/dz = rho(z,p) * g
with 'z' represening depth, 'p' being a phase pressure and 'rho' the
associate phase density. Finally, 'g' is the acceleration of
gravity. We assume that we can calculate phase densities, e.g.,
from table look-up. This assumption holds in the case of an ECLIPSE
input deck.
Using RK4 with constant step sizes is a limitation of this
implementation. This, basically, assumes that the phase densities
varies only smoothly with depth and pressure (at reservoir
conditions).
2014-01-14 13:37:28 -06:00
|
|
|
|
|
|
|
const int first = 0, last = G->number_of_cells - 1;
|
|
|
|
const double reltol = 1.0e-8;
|
|
|
|
BOOST_CHECK_CLOSE(ppress[0][first] , 90e3 , reltol);
|
|
|
|
BOOST_CHECK_CLOSE(ppress[0][last ] , 180e3 , reltol);
|
|
|
|
BOOST_CHECK_CLOSE(ppress[1][first] , 103.5e3 , reltol);
|
|
|
|
BOOST_CHECK_CLOSE(ppress[1][last ] , 166.5e3 , reltol);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|