Make ImpesTPFAAD use abstract fluid interface instead of template.

Follow-up changes to test program. Also while there, input correct
number of perforations to add_well() calls.
This commit is contained in:
Atgeirr Flø Rasmussen 2013-05-22 11:13:14 +02:00
parent 27cd7cf19e
commit 8cc16466a9
2 changed files with 17 additions and 16 deletions

View File

@ -119,20 +119,22 @@ main(int argc, char* argv[])
typedef Opm::BlackoilPropertiesInterface Geology;
typedef DerivedGeology<Geology, ADB::V> GeoProps;
typedef Opm::BlackoilPropsAd BOFluid;
typedef Opm::ImpesTPFAAD<BOFluid, GeoProps> PSolver;
typedef Opm::ImpesTPFAAD<GeoProps> PSolver;
Wells* wells = create_wells(2, 2, 5);
const double inj_frac[] = { 1.0, 0.0 };
const double prod_frac[] = { 0.0, 0.0 };
const int inj_cells[] = { 0, 1, 2 };
const int prod_cells[] = { 20, 21 };
const double WI[3] = { 1e-14 };
bool ok = add_well(INJECTOR, 0.0, 1, inj_frac, inj_cells, WI, "Inj", wells);
ok = ok && add_well(PRODUCER, 0.0, 1, prod_frac, prod_cells, WI, "Prod", wells);
const int num_inj = 3;
const int inj_cells[num_inj] = { 0, 1, 2 };
const int num_prod = 2;
const int prod_cells[num_prod] = { 20, 21 };
const double WI[3] = { 1e-12 };
bool ok = add_well(INJECTOR, 0.0, num_inj, inj_frac, inj_cells, WI, "Inj", wells);
ok = ok && add_well(PRODUCER, 0.0, num_prod, prod_frac, prod_cells, WI, "Prod", wells);
ok = ok && append_well_controls(BHP, 500.0*Opm::unit::barsa, 0, 0, wells);
// ok = ok && append_well_controls(BHP, 200.0*Opm::unit::barsa, 0, 1, wells);
ok = ok && append_well_controls(BHP, 200.0*Opm::unit::barsa, 0, 1, wells);
double oildistr[2] = { 0.0, 1.0 };
ok = ok && append_well_controls(SURFACE_RATE, 8.64297e-05, oildistr, 1, wells);
// ok = ok && append_well_controls(SURFACE_RATE, 8.64297e-05, oildistr, 1, wells);
if (!ok) {
THROW("Something went wrong with well init.");
}

View File

@ -23,6 +23,7 @@
#include <opm/autodiff/AutoDiffBlock.hpp>
#include <opm/autodiff/AutoDiffHelpers.hpp>
#include <opm/autodiff/BlackoilPropsAdInterface.hpp>
#include <opm/core/simulator/BlackoilState.hpp>
#include <opm/core/simulator/WellState.hpp>
@ -102,11 +103,11 @@ namespace {
namespace Opm {
template <class BOFluid, class GeoProps>
template <class GeoProps>
class ImpesTPFAAD {
public:
ImpesTPFAAD(const UnstructuredGrid& grid ,
const BOFluid& fluid,
const BlackoilPropsAdInterface& fluid,
const GeoProps& geo ,
const Wells& wells,
const LinearSolverInterface& linsolver)
@ -187,8 +188,6 @@ namespace Opm {
ImpesTPFAAD(const ImpesTPFAAD& rhs);
ImpesTPFAAD& operator=(const ImpesTPFAAD& rhs);
// typedef PressureDependentFluidData<double, BOFluid> PDepFData;
// typedef typename PDepFData::ADB ADB;
typedef AutoDiff::ForwardBlock<double> ADB;
typedef ADB::V V;
typedef ADB::M M;
@ -198,7 +197,7 @@ namespace Opm {
Eigen::RowMajor> DataBlock;
const UnstructuredGrid& grid_;
const BOFluid& fluid_;
const BlackoilPropsAdInterface& fluid_;
const GeoProps& geo_ ;
const Wells& wells_;
const LinearSolverInterface& linsolver_;
@ -211,9 +210,9 @@ namespace Opm {
std::vector<V> kr_;
std::vector<V> well_kr_;
enum { Water = BOFluid::Water,
Oil = BOFluid::Oil,
Gas = BOFluid::Gas };
enum { Water = BlackoilPropsAdInterface::Water,
Oil = BlackoilPropsAdInterface::Oil,
Gas = BlackoilPropsAdInterface::Gas };
void