mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 18:21:00 -06:00
Add test cases for density and water viscosity.
Currently, ViscosityAD fails due to missing pressure derivatives in the viscosity primitives.
This commit is contained in:
parent
cebb6fd5fa
commit
b85c0dce88
@ -31,6 +31,7 @@
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
#include <fstream>
|
||||
@ -78,3 +79,78 @@ BOOST_FIXTURE_TEST_CASE(Construction, TestFixture<SetupSimple>)
|
||||
{
|
||||
Opm::BlackoilPropsAd boprops_ad(props);
|
||||
}
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(SurfaceDensity, TestFixture<SetupSimple>)
|
||||
{
|
||||
Opm::BlackoilPropsAd boprops_ad(props);
|
||||
|
||||
const double* rho0 = props .surfaceDensity();
|
||||
const double* rho0AD = boprops_ad.surfaceDensity();
|
||||
|
||||
enum { Water = Opm::BlackoilPropsAd::Water };
|
||||
BOOST_CHECK_EQUAL(rho0AD[ Water ], rho0[ Water ]);
|
||||
|
||||
enum { Oil = Opm::BlackoilPropsAd::Oil };
|
||||
BOOST_CHECK_EQUAL(rho0AD[ Oil ], rho0[ Oil ]);
|
||||
|
||||
enum { Gas = Opm::BlackoilPropsAd::Gas };
|
||||
BOOST_CHECK_EQUAL(rho0AD[ Gas ], rho0[ Gas ]);
|
||||
}
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(ViscosityValue, TestFixture<SetupSimple>)
|
||||
{
|
||||
Opm::BlackoilPropsAd boprops_ad(props);
|
||||
|
||||
const Opm::BlackoilPropsAd::Cells cells(5, 0);
|
||||
|
||||
typedef Opm::BlackoilPropsAd::V V;
|
||||
|
||||
V Vpw;
|
||||
Vpw.resize(cells.size());
|
||||
Vpw[0] = 1*Opm::unit::barsa;
|
||||
Vpw[1] = 2*Opm::unit::barsa;
|
||||
Vpw[2] = 4*Opm::unit::barsa;
|
||||
Vpw[3] = 8*Opm::unit::barsa;
|
||||
Vpw[4] = 16*Opm::unit::barsa;
|
||||
|
||||
const Opm::BlackoilPropsAd::V VmuWat = boprops_ad.muWat(Vpw, cells);
|
||||
|
||||
// Zero pressure dependence in water viscosity
|
||||
for (V::Index i = 0, n = VmuWat.size(); i < n; ++i) {
|
||||
BOOST_CHECK_EQUAL(VmuWat[i], VmuWat[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(ViscosityAD, TestFixture<SetupSimple>)
|
||||
{
|
||||
Opm::BlackoilPropsAd boprops_ad(props);
|
||||
|
||||
const Opm::BlackoilPropsAd::Cells cells(5, 0);
|
||||
|
||||
typedef Opm::BlackoilPropsAd::V V;
|
||||
|
||||
V Vpw;
|
||||
Vpw.resize(cells.size());
|
||||
Vpw[0] = 1*Opm::unit::barsa;
|
||||
Vpw[1] = 2*Opm::unit::barsa;
|
||||
Vpw[2] = 4*Opm::unit::barsa;
|
||||
Vpw[3] = 8*Opm::unit::barsa;
|
||||
Vpw[4] = 16*Opm::unit::barsa;
|
||||
|
||||
typedef Opm::BlackoilPropsAd::ADB ADB;
|
||||
|
||||
const V VmuWat = boprops_ad.muWat(Vpw, cells);
|
||||
for (V::Index i = 0, n = Vpw.size(); i < n; ++i) {
|
||||
const std::vector<int> bp(1, grid.c_grid()->number_of_cells);
|
||||
|
||||
const Opm::BlackoilPropsAd::Cells c(1, 0);
|
||||
const V pw = V(1, 1) * Vpw[i];
|
||||
const ADB Apw = ADB::variable(0, pw, bp);
|
||||
const ADB AmuWat = boprops_ad.muWat(Apw, c);
|
||||
|
||||
BOOST_CHECK_EQUAL(AmuWat.value()[0], VmuWat[i]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user