Merge remote-tracking branch 'upstream/master' into fix-impedance-mismatch
This commit is contained in:
51
README
51
README
@@ -46,11 +46,17 @@ sudo apt-get install -y build-essential gfortran pkg-config libtool \
|
||||
sudo apt-get install -y doxygen ghostscript texlive-latex-recommended pgf
|
||||
|
||||
# packages necessary for version control
|
||||
sudo apt-get install -y git-core git-svn subversion
|
||||
sudo apt-get install -y git-core
|
||||
|
||||
# libraries necessary for DUNE
|
||||
# basic libraries necessary for both DUNE and OPM
|
||||
sudo apt-get install -y libboost-all-dev libsuperlu3-dev libsuitesparse-dev
|
||||
|
||||
# add this repository for necessary backports (required for Ubuntu Precise)
|
||||
sudo add-apt-repository -y ppa:opm/ppa
|
||||
|
||||
# parts of DUNE needed
|
||||
sudo apt-get install -y libdune-common-dev libdune-istl-dev
|
||||
|
||||
# libraries necessary for OPM
|
||||
sudo apt-get install -y libxml0-dev
|
||||
|
||||
@@ -59,33 +65,14 @@ DEPENDENCIES FOR SUSE BASED DISTRIBUTIONS
|
||||
-----------------------------------------
|
||||
|
||||
# libraries
|
||||
sudo zypper install blas libblas3 lapack liblapack3 libboost libxml2 umfpack
|
||||
sudo zypper in blas libblas3 lapack liblapack3 libboost libxml2 umfpack
|
||||
|
||||
# tools
|
||||
sudo zypper install gcc automake autoconf git doxygen
|
||||
sudo zypper in gcc automake autoconf git doxygen
|
||||
|
||||
|
||||
RETRIEVING AND BUILDING DUNE PREREQUISITES
|
||||
------------------------------------------
|
||||
|
||||
(only necessary if you want to use opm-core as a dune module)
|
||||
|
||||
# trust DUNE certificate (sic)
|
||||
echo p | svn list https://svn.dune-project.org/svn/dune-common
|
||||
|
||||
# checkout DUNE libraries
|
||||
for module in common istl geometry grid localfunctions; do
|
||||
git svn clone -s \
|
||||
https://svn.dune-project.org/svn/dune-$module/branches/release-2.2/ \
|
||||
dune-$module
|
||||
done
|
||||
|
||||
# building DUNE libraries
|
||||
for module in common istl geometry grid localfunctions; do
|
||||
env CCACHE_DISABLE=1 dune-common/bin/dunecontrol --only=dune-$module \
|
||||
--configure-opts="--enable-fieldvector-size-is-method" \
|
||||
--make-opts="-j -l 0.8" autogen : configure : make
|
||||
done
|
||||
# DUNE libraries
|
||||
sudo zypper ar http://download.opensuse.org/repositories/science/openSUSE_12.2/science.repo
|
||||
sudo zypper in dune-common dune-istl
|
||||
|
||||
|
||||
DOWNLOADING
|
||||
@@ -100,20 +87,10 @@ If you want to contribute, fork OPM/opm-core on github.
|
||||
BUILDING
|
||||
--------
|
||||
|
||||
(standalone opm-core:)
|
||||
|
||||
cd ../opm-core
|
||||
cd opm-core
|
||||
autoreconf -i
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
(using opm-core as a dune module:)
|
||||
|
||||
# note: this is done from the parent directory of opm-core
|
||||
env CCACHE_DISABLE=1 dune-common/bin/dunecontrol --only=opm-core \
|
||||
--configure-opts="" --make-opts="-j -l 0.8" autogen : configure : make
|
||||
|
||||
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
@@ -743,6 +743,29 @@ assemble_completion_to_cell(int c, int wdof, int np, double dt,
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
static void
|
||||
welleq_coeff_shut(int np, struct cfs_tpfa_res_data *h,
|
||||
double *res, double *w2c, double *w2w)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
int p;
|
||||
double fwi;
|
||||
const double *dpflux_w;
|
||||
|
||||
/* Sum reservoir phase flux derivatives set by
|
||||
* compute_darcyflux_and_deriv(). */
|
||||
dpflux_w = h->pimpl->flux_work + (1 * np);
|
||||
for (p = 0, fwi = 0.0; p < np; p++) {
|
||||
fwi += dpflux_w[ p ];
|
||||
}
|
||||
|
||||
*res = 0.0;
|
||||
*w2c = 0.0;
|
||||
*w2w = fwi;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
static void
|
||||
welleq_coeff_bhp(int np, double dp, struct cfs_tpfa_res_data *h,
|
||||
@@ -817,23 +840,25 @@ assemble_completion_to_well(int w, int c, int nc, int np,
|
||||
ctrl = W->ctrls[ w ];
|
||||
|
||||
if (ctrl->current < 0) {
|
||||
assert (0); /* Shut wells currently not supported */
|
||||
/* Interpreting a negative current control index to mean a shut well */
|
||||
welleq_coeff_shut(np, h, &res, &w2c, &w2w);
|
||||
}
|
||||
else {
|
||||
switch (ctrl->type[ ctrl->current ]) {
|
||||
case BHP :
|
||||
welleq_coeff_bhp(np, pw - ctrl->target[ ctrl->current ],
|
||||
h, &res, &w2c, &w2w);
|
||||
break;
|
||||
|
||||
switch (ctrl->type[ ctrl->current ]) {
|
||||
case BHP :
|
||||
welleq_coeff_bhp(np, pw - ctrl->target[ ctrl->current ],
|
||||
h, &res, &w2c, &w2w);
|
||||
break;
|
||||
case RESERVOIR_RATE:
|
||||
assert (W->number_of_phases == np);
|
||||
welleq_coeff_resv(np, h, ctrl, &res, &w2c, &w2w);
|
||||
break;
|
||||
|
||||
case RESERVOIR_RATE:
|
||||
assert (W->number_of_phases == np);
|
||||
welleq_coeff_resv(np, h, ctrl, &res, &w2c, &w2w);
|
||||
break;
|
||||
|
||||
case SURFACE_RATE:
|
||||
assert (0); /* Surface rate currently not supported */
|
||||
break;
|
||||
case SURFACE_RATE:
|
||||
assert (0); /* Surface rate currently not supported */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Assemble completion contributions */
|
||||
@@ -856,7 +881,7 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *wells ,
|
||||
struct cfs_tpfa_res_data *h )
|
||||
{
|
||||
int w, i, c, np, np2, nc;
|
||||
int is_neumann;
|
||||
int is_neumann, is_open;
|
||||
double pw, dp;
|
||||
double *WI, *gpot, *pmobp;
|
||||
const double *Ac, *dAc;
|
||||
@@ -878,6 +903,7 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *wells ,
|
||||
|
||||
for (w = i = 0; w < W->number_of_wells; w++) {
|
||||
pw = wpress[ w ];
|
||||
is_open = W->ctrls[w]->current >= 0;
|
||||
|
||||
for (; i < W->well_connpos[w + 1];
|
||||
i++, gpot += np, pmobp += np) {
|
||||
@@ -890,7 +916,9 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *wells ,
|
||||
|
||||
init_completion_contrib(i, np, Ac, dAc, h->pimpl);
|
||||
|
||||
assemble_completion_to_cell(c, nc + w, np, dt, h);
|
||||
if (is_open) {
|
||||
assemble_completion_to_cell(c, nc + w, np, dt, h);
|
||||
}
|
||||
|
||||
/* Prepare for RESV controls */
|
||||
compute_darcyflux_and_deriv(np, WI[i], dp, pmobp, gpot,
|
||||
|
||||
@@ -101,6 +101,7 @@ namespace Opm
|
||||
/// @{
|
||||
const double gallon = 231 * cubic(inch);
|
||||
const double stb = 42 * gallon;
|
||||
const double liter = 1 * cubic(prefix::deci*meter);
|
||||
/// @}
|
||||
|
||||
/// \name Mass
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <opm/core/utility/Units.hpp>
|
||||
#include <opm/core/fluid/IncompPropertiesInterface.hpp>
|
||||
#include <opm/core/fluid/BlackoilPropertiesInterface.hpp>
|
||||
#include <opm/core/fluid/blackoil/phaseUsageFromDeck.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace Opm
|
||||
@@ -512,15 +513,23 @@ namespace Opm
|
||||
State& state)
|
||||
{
|
||||
const int num_phases = props.numPhases();
|
||||
const PhaseUsage pu = phaseUsageFromDeck(deck);
|
||||
if (num_phases != pu.num_phases) {
|
||||
THROW("initStateFromDeck(): user specified property object with " << num_phases << " phases, "
|
||||
"found " << pu.num_phases << " phases in deck.");
|
||||
}
|
||||
state.init(grid, num_phases);
|
||||
if (deck.hasField("EQUIL")) {
|
||||
if (num_phases != 2) {
|
||||
THROW("initStateFromDeck(): EQUIL-based init currently handling only two-phase scenarios.");
|
||||
}
|
||||
if (pu.phase_used[BlackoilPhases::Vapour]) {
|
||||
THROW("initStateFromDeck(): EQUIL-based init currently handling only oil-water scenario (no gas).");
|
||||
}
|
||||
// Set saturations depending on oil-water contact.
|
||||
const EQUIL& equil= deck.getEQUIL();
|
||||
if (equil.equil.size() != 1) {
|
||||
THROW("No region support yet.");
|
||||
THROW("initStateFromDeck(): No region support yet.");
|
||||
}
|
||||
const double woc = equil.equil[0].water_oil_contact_depth_;
|
||||
initWaterOilContact(grid, props, woc, WaterBelow, state);
|
||||
@@ -528,37 +537,64 @@ namespace Opm
|
||||
const double datum_z = equil.equil[0].datum_depth_;
|
||||
const double datum_p = equil.equil[0].datum_depth_pressure_;
|
||||
initHydrostaticPressure(grid, props, woc, gravity, datum_z, datum_p, state);
|
||||
} else if (deck.hasField("SWAT") && deck.hasField("PRESSURE")) {
|
||||
// Set saturations from SWAT, pressure from PRESSURE.
|
||||
} else if (deck.hasField("PRESSURE")) {
|
||||
// Set saturations from SWAT/SGAS, pressure from PRESSURE.
|
||||
std::vector<double>& s = state.saturation();
|
||||
std::vector<double>& p = state.pressure();
|
||||
const std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
||||
const std::vector<double>& p_deck = deck.getFloatingPointValue("PRESSURE");
|
||||
const int num_cells = grid.number_of_cells;
|
||||
if (num_phases == 2) {
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
||||
s[2*c] = sw_deck[c_deck];
|
||||
s[2*c + 1] = 1.0 - s[2*c];
|
||||
p[c] = p_deck[c_deck];
|
||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
||||
// oil-gas: we require SGAS
|
||||
if (!deck.hasField("SGAS")) {
|
||||
THROW("initStateFromDeck(): missing SGAS keyword in 2-phase init");
|
||||
}
|
||||
const std::vector<double>& sg_deck = deck.getFloatingPointValue("SGAS");
|
||||
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
||||
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
||||
s[2*c + gpos] = sg_deck[c_deck];
|
||||
s[2*c + opos] = 1.0 - sg_deck[c_deck];
|
||||
p[c] = p_deck[c_deck];
|
||||
}
|
||||
} else {
|
||||
// water-oil or water-gas: we require SWAT
|
||||
if (!deck.hasField("SWAT")) {
|
||||
THROW("initStateFromDeck(): missing SWAT keyword in 2-phase init");
|
||||
}
|
||||
const std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
||||
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
||||
const int nwpos = (wpos + 1) % 2;
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
||||
s[2*c + wpos] = sw_deck[c_deck];
|
||||
s[2*c + nwpos] = 1.0 - sw_deck[c_deck];
|
||||
p[c] = p_deck[c_deck];
|
||||
}
|
||||
}
|
||||
} else if (num_phases == 3) {
|
||||
if (!deck.hasField("SGAS")) {
|
||||
THROW("initStateFromDeck(): missing SGAS keyword in 3-phase init (only SWAT and PRESSURE found).");
|
||||
const bool has_swat_sgas = deck.hasField("SWAT") && deck.hasField("SGAS");
|
||||
if (!has_swat_sgas) {
|
||||
THROW("initStateFromDeck(): missing SGAS or SWAT keyword in 3-phase init.");
|
||||
}
|
||||
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
||||
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
||||
const int opos = pu.phase_pos[BlackoilPhases::Liquid];
|
||||
const std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
||||
const std::vector<double>& sg_deck = deck.getFloatingPointValue("SGAS");
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
||||
s[3*c] = sw_deck[c_deck];
|
||||
s[3*c + 1] = 1.0 - (sw_deck[c_deck] + sg_deck[c_deck]);
|
||||
s[3*c + 2] = sg_deck[c_deck];
|
||||
s[3*c + wpos] = sw_deck[c_deck];
|
||||
s[3*c + opos] = 1.0 - (sw_deck[c_deck] + sg_deck[c_deck]);
|
||||
s[3*c + gpos] = sg_deck[c_deck];
|
||||
p[c] = p_deck[c_deck];
|
||||
}
|
||||
} else {
|
||||
THROW("initStateFromDeck(): init with SWAT etc. only available with 2 or 3 phases.");
|
||||
}
|
||||
} else {
|
||||
THROW("initStateFromDeck(): we must either have EQUIL, or both SWAT and PRESSURE.");
|
||||
THROW("initStateFromDeck(): we must either have EQUIL, or PRESSURE and SWAT/SOIL/SGAS.");
|
||||
}
|
||||
|
||||
// Finally, init face pressures.
|
||||
|
||||
@@ -374,7 +374,10 @@ namespace Opm
|
||||
if (perf_rate > 0.0) {
|
||||
// perf_rate is a total inflow rate, we want a water rate.
|
||||
if (wells->type[w] != INJECTOR) {
|
||||
std::cout << "**** Warning: crossflow in well with index " << w << " ignored." << std::endl;
|
||||
std::cout << "**** Warning: crossflow in well "
|
||||
<< w << " perf " << perf - wells->well_connpos[w]
|
||||
<< " ignored. Rate was "
|
||||
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
|
||||
perf_rate = 0.0;
|
||||
} else {
|
||||
ASSERT(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
|
||||
|
||||
@@ -716,32 +716,31 @@ namespace Opm
|
||||
#endif
|
||||
|
||||
if (deck.hasField("WELOPEN")) {
|
||||
const WELOPEN& welopen = deck.getWELOPEN();
|
||||
|
||||
for (size_t i = 0; i < welopen.welopen.size(); ++i) {
|
||||
WelopenLine line = welopen.welopen[i];
|
||||
std::string wellname = line.well_;
|
||||
std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname);
|
||||
if (it == well_names_to_index.end()) {
|
||||
THROW("Trying to open/shut well with name: \"" << wellname<<"\" but it's not registered under WELSPECS.");
|
||||
}
|
||||
int index = it->second;
|
||||
if (line.openshutflag_ == "SHUT") {
|
||||
// We currently don't care if the well is open or not.
|
||||
/// \TODO Should this perhaps be allowed? I.e. should it be if(well_shut) { shutwell(); } else { /* do nothing*/ }?
|
||||
//ASSERT(w_->ctrls[index]->current < 0);
|
||||
} else if (line.openshutflag_ == "OPEN") {
|
||||
//ASSERT(w_->ctrls[index]->current >= 0);
|
||||
} else {
|
||||
THROW("Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
|
||||
}
|
||||
|
||||
// We revert back to it's original control.
|
||||
// Note that this is OK as ~~ = id.
|
||||
w_->ctrls[index]->current = ~w_->ctrls[index]->current;
|
||||
|
||||
|
||||
}
|
||||
const WELOPEN& welopen = deck.getWELOPEN();
|
||||
for (size_t i = 0; i < welopen.welopen.size(); ++i) {
|
||||
WelopenLine line = welopen.welopen[i];
|
||||
std::string wellname = line.well_;
|
||||
std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname);
|
||||
if (it == well_names_to_index.end()) {
|
||||
THROW("Trying to open/shut well with name: \"" << wellname<<"\" but it's not registered under WELSPECS.");
|
||||
}
|
||||
const int index = it->second;
|
||||
if (line.openshutflag_ == "SHUT") {
|
||||
int& cur_ctrl = w_->ctrls[index]->current;
|
||||
if (cur_ctrl >= 0) {
|
||||
cur_ctrl = ~cur_ctrl;
|
||||
}
|
||||
ASSERT(w_->ctrls[index]->current < 0);
|
||||
} else if (line.openshutflag_ == "OPEN") {
|
||||
int& cur_ctrl = w_->ctrls[index]->current;
|
||||
if (cur_ctrl < 0) {
|
||||
cur_ctrl = ~cur_ctrl;
|
||||
}
|
||||
ASSERT(w_->ctrls[index]->current >= 0);
|
||||
} else {
|
||||
THROW("Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build the well_collection_ well group hierarchy.
|
||||
|
||||
Reference in New Issue
Block a user