mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Adds a constructor to BlackoilPropsAdFromDeck that allows copy the grid independant part.
In the parallel simulator we will have to be able adress only poperties on some part of the global grid. To create thos properties we need to be able to copy the grid independant data of the properties object and resize the rest. This commit adds a construct taking a properties object for reading and a new number of cells to accomplish this.
This commit is contained in:
parent
15aa7ec2ab
commit
fc137afcd5
@ -1,5 +1,7 @@
|
||||
/*
|
||||
Copyright 2013 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2015 Dr. Blatt - HPC-Simulation-Software & Services.
|
||||
Copyright 2015 NTNU.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@ -65,6 +67,29 @@ namespace Opm
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Constructor for properties on a subgrid
|
||||
BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& props,
|
||||
const int number_of_cells)
|
||||
{
|
||||
if(number_of_cells>props.cellPvtRegionIdx_.size())
|
||||
OPM_THROW(std::runtime_error, "The number of cells is larger than the one of the original grid!");
|
||||
if(number_of_cells<0)
|
||||
OPM_THROW(std::runtime_error, "The number of cells is has to be larger than 0.");
|
||||
// Copy properties that do not depend on the postion within the grid.
|
||||
rock_ = props.rock_;
|
||||
phase_usage_ = props.phase_usage_;
|
||||
props_ = props.props_;
|
||||
densities_ = props.densities_;
|
||||
vap1_ = props.vap1_;
|
||||
vap2_ = props.vap2_;
|
||||
vap_satmax_guard_ = props.vap_satmax_guard_;
|
||||
// For data that is dependant on the subgrid we simply allocate space
|
||||
// and initialize with obviously bogus numbers.
|
||||
cellPvtRegionIdx_.resize(number_of_cells, std::numeric_limits<int>::min());
|
||||
pvtTableIdx_.resize(number_of_cells, std::numeric_limits<int>::min());
|
||||
satOilMax_.resize(number_of_cells, -std::numeric_limits<double>::max());
|
||||
}
|
||||
|
||||
/// Initializes the properties.
|
||||
template <class CentroidIterator>
|
||||
void BlackoilPropsAdFromDeck::init(Opm::DeckConstPtr deck,
|
||||
|
@ -1,5 +1,7 @@
|
||||
/*
|
||||
Copyright 2013 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2015 Dr. Blatt - HPC-Simulation-Software & Services.
|
||||
Copyright 2015 NTNU.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@ -70,6 +72,19 @@ namespace Opm
|
||||
const bool init_rock = true );
|
||||
#endif
|
||||
|
||||
/// \brief Constructor to create properties for a subgrid
|
||||
///
|
||||
/// This copies all properties that are not dependant on the
|
||||
/// grid size from an existing properties object
|
||||
/// and the number of cells. All properties that do not depend
|
||||
/// on the grid dimension will be copied. For the rest will have
|
||||
/// the correct size but the values will be undefined.
|
||||
///
|
||||
/// \param props The property object to copy from.
|
||||
/// \paramm number_of_cells The number of cells of the subgrid.
|
||||
BlackoilPropsAdFromDeck(const BlackoilPropsAdFromDeck& props,
|
||||
const int number_of_cells);
|
||||
|
||||
|
||||
////////////////////////////
|
||||
// Rock interface //
|
||||
@ -433,7 +448,9 @@ namespace Opm
|
||||
const double vap) const;
|
||||
|
||||
RockFromDeck rock_;
|
||||
std::unique_ptr<SaturationPropsInterface> satprops_;
|
||||
// This has to be a shared pointer as we must
|
||||
// be able to make a copy of *this in the parallel case.
|
||||
std::shared_ptr<SaturationPropsInterface> satprops_;
|
||||
|
||||
PhaseUsage phase_usage_;
|
||||
// bool has_vapoil_;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#define BOOST_TEST_MODULE FluidPropertiesTest
|
||||
|
||||
#include <opm/autodiff/BlackoilPropsAd.hpp>
|
||||
#include <opm/autodiff/BlackoilPropsAdFromDeck.hpp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@ -82,13 +83,35 @@ struct TestFixture : public Setup
|
||||
Opm::BlackoilPropertiesFromDeck props;
|
||||
};
|
||||
|
||||
template <class Setup>
|
||||
struct TestFixtureAd : public Setup
|
||||
{
|
||||
TestFixtureAd()
|
||||
: Setup()
|
||||
, grid (deck)
|
||||
, props(deck, eclState, *grid.c_grid(),
|
||||
param.getDefault("init_rock", false))
|
||||
{
|
||||
}
|
||||
|
||||
using Setup::param;
|
||||
using Setup::deck;
|
||||
using Setup::eclState;
|
||||
|
||||
Opm::GridManager grid;
|
||||
Opm::BlackoilPropsAdFromDeck props;
|
||||
};
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(Construction, TestFixture<SetupSimple>)
|
||||
{
|
||||
Opm::BlackoilPropsAd boprops_ad(props);
|
||||
}
|
||||
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(SubgridConstruction, TestFixtureAd<SetupSimple>)
|
||||
{
|
||||
Opm::BlackoilPropsAdFromDeck subgrid_props(props);
|
||||
}
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(SurfaceDensity, TestFixture<SetupSimple>)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user