mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Provide way of shadowing only some properties
The current implementations of IncompPropertiesInterface are very all-or-nothing. In some situations, you want to read rock and fluid properties from an Eclipse file, but use analytical functions for the unsaturated properties. Or you want to update properties based on a marching filter. This patch provides a way to mix various property objects, or to "shadow" the properties with a raw array of data, so you don't have to reimplement the entire interface just to make a small change.
This commit is contained in:
32
tests/test_shadow.cpp
Normal file
32
tests/test_shadow.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright (c) 2013 Uni Research AS.
|
||||
This file is licensed under the GNU General Public License v3.0 or later. */
|
||||
#include <config.h>
|
||||
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
#define NVERBOSE // to suppress our messages when throwing
|
||||
|
||||
#define BOOST_TEST_MODULE ShadowTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/props/IncompPropertiesBasic.hpp>
|
||||
#include <opm/core/props/IncompPropertiesShadow.hpp>
|
||||
|
||||
using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(shadowPorosity)
|
||||
{
|
||||
const double defaultPorosity = 1.0;
|
||||
const double newPorosity = 0.5;
|
||||
|
||||
parameter::ParameterGroup param;
|
||||
IncompPropertiesBasic basic (param, 2, 1);
|
||||
IncompPropertiesShadow shadow (basic);
|
||||
BOOST_CHECK_CLOSE (*(shadow.porosity()), defaultPorosity, 0.001);
|
||||
shadow.usePorosity (&newPorosity);
|
||||
BOOST_CHECK_CLOSE (*(shadow.porosity()), newPorosity, 0.001);
|
||||
shadow.usePorosity (basic);
|
||||
BOOST_CHECK_CLOSE (*(shadow.porosity()), defaultPorosity, 0.001);
|
||||
}
|
||||
Reference in New Issue
Block a user