2013-05-23 11:28:50 -05:00
|
|
|
/*
|
|
|
|
Copyright 2013 SINTEF ICT, Applied Mathematics.
|
|
|
|
Copyright 2013 Statoil ASA.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media Project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2013-05-24 03:49:59 -05:00
|
|
|
#include <opm/autodiff/FullyImplicitBlackoilSolver.hpp>
|
2013-05-23 11:28:50 -05:00
|
|
|
#include <opm/autodiff/GeoProps.hpp>
|
|
|
|
#include <opm/autodiff/BlackoilPropsAd.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/grid.h>
|
2013-05-24 08:27:19 -05:00
|
|
|
#include <opm/core/wells.h>
|
|
|
|
|
2013-05-23 11:28:50 -05:00
|
|
|
#include <opm/core/grid/GridManager.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/linalg/LinearSolverFactory.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/props/BlackoilPropertiesBasic.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
|
|
|
#include <opm/core/utility/Units.hpp>
|
|
|
|
|
|
|
|
#include <opm/core/simulator/BlackoilState.hpp>
|
2013-05-24 08:27:19 -05:00
|
|
|
#include <opm/core/simulator/WellState.hpp>
|
2013-05-23 11:28:50 -05:00
|
|
|
#include <opm/core/simulator/initState.hpp>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
2013-05-24 08:27:19 -05:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
boost::shared_ptr<Wells>
|
|
|
|
createWellConfig()
|
|
|
|
{
|
|
|
|
boost::shared_ptr<Wells> wells(create_wells(2, 2, 2),
|
|
|
|
destroy_wells);
|
|
|
|
|
|
|
|
const double inj_frac[] = { 1.0, 0.0 };
|
|
|
|
const double prod_frac[] = { 0.0, 0.0 };
|
|
|
|
const int num_inj = 1;
|
|
|
|
const int inj_cells[num_inj] = { 0 };
|
|
|
|
const int num_prod = 1;
|
|
|
|
const int prod_cells[num_prod] = { 19 };
|
|
|
|
const double WI[3] = { 1e-12, 1e-12, 1e-12 };
|
|
|
|
bool ok = add_well(INJECTOR, 0.0, num_inj, inj_frac, inj_cells, WI, "Inj", wells.get());
|
|
|
|
ok = ok && add_well(PRODUCER, 0.0, num_prod, prod_frac, prod_cells, WI, "Prod", wells.get());
|
|
|
|
ok = ok && append_well_controls(BHP, 500.0*Opm::unit::barsa, 0, 0, wells.get());
|
|
|
|
// 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, 1e-3, oildistr, 1, wells.get());
|
|
|
|
if (!ok) {
|
|
|
|
THROW("Something went wrong with well init.");
|
|
|
|
}
|
|
|
|
set_current_control(0, 0, wells.get());
|
|
|
|
set_current_control(1, 0, wells.get());
|
|
|
|
|
|
|
|
return wells;
|
|
|
|
}
|
2013-05-24 12:15:14 -05:00
|
|
|
|
|
|
|
template <class Ostream, typename T, class A>
|
|
|
|
Ostream&
|
|
|
|
operator<<(Ostream& os, const std::vector<T,A>& v)
|
|
|
|
{
|
|
|
|
std::copy(v.begin(), v.end(), std::ostream_iterator<T>(os, " "));
|
|
|
|
|
|
|
|
return os;
|
|
|
|
}
|
2013-05-24 08:27:19 -05:00
|
|
|
}
|
|
|
|
|
2013-05-23 11:28:50 -05:00
|
|
|
int
|
|
|
|
main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
const Opm::parameter::ParameterGroup param(argc, argv, false);
|
|
|
|
const Opm::GridManager gm(20, 1);
|
|
|
|
|
|
|
|
const UnstructuredGrid* g = gm.c_grid();
|
|
|
|
const int nc = g->number_of_cells;
|
|
|
|
const Opm::BlackoilPropertiesBasic props0(param, 2, nc);
|
|
|
|
const Opm::BlackoilPropsAd props(props0);
|
|
|
|
|
2013-05-24 08:27:19 -05:00
|
|
|
boost::shared_ptr<Wells> wells = createWellConfig();
|
|
|
|
|
|
|
|
double grav[] = { 0.0, 0.0 };
|
2013-05-23 11:28:50 -05:00
|
|
|
Opm::DerivedGeology geo(*g, props, grav);
|
|
|
|
|
2013-05-26 04:49:44 -05:00
|
|
|
Opm::LinearSolverFactory linsolver(param);
|
|
|
|
|
2013-06-03 07:14:48 -05:00
|
|
|
Opm::FullyImplicitBlackoilSolver solver(*g, props, geo, 0, *wells, linsolver);
|
2013-05-23 11:28:50 -05:00
|
|
|
|
|
|
|
Opm::BlackoilState state;
|
|
|
|
initStateBasic(*g, props0, param, 0.0, state);
|
|
|
|
initBlackoilSurfvol(*g, props0, state);
|
|
|
|
|
2013-05-24 08:27:19 -05:00
|
|
|
Opm::WellState well_state;
|
|
|
|
well_state.init(wells.get(), state);
|
|
|
|
|
|
|
|
solver.step(1.0, state, well_state);
|
2013-05-23 11:28:50 -05:00
|
|
|
|
2013-05-24 12:15:14 -05:00
|
|
|
std::cout << state.pressure() << '\n'
|
|
|
|
<< well_state.bhp() << '\n';
|
2013-05-23 11:28:50 -05:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|