convert THROW to OPM_THROW
This commit is contained in:
@@ -96,7 +96,7 @@ int main(int argc, char** argv)
|
||||
const int np = props.numPhases();
|
||||
const int max_np = 3;
|
||||
if (np > max_np) {
|
||||
THROW("Max #phases is 3.");
|
||||
OPM_THROW(std::runtime_error, "Max #phases is 3.");
|
||||
}
|
||||
while((inos.good()) && (!inos.eof())){
|
||||
double p[n];
|
||||
|
@@ -68,7 +68,7 @@ int main(int argc, char** argv)
|
||||
const int np = props.numPhases();
|
||||
const int max_np = 3;
|
||||
if (np > max_np) {
|
||||
THROW("Max #phases is 3.");
|
||||
OPM_THROW(std::runtime_error, "Max #phases is 3.");
|
||||
}
|
||||
while((inos.good()) && (!inos.eof())){
|
||||
double s[max_np];
|
||||
|
@@ -210,7 +210,7 @@ main(int argc, char** argv)
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
std::string filename = output_dir + "/epoch_timing.param";
|
||||
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
|
||||
|
@@ -90,7 +90,7 @@ main(int argc, char** argv)
|
||||
std::istream_iterator<double> end;
|
||||
porevol.assign(beg, end); // Now contains poro.
|
||||
if (int(porevol.size()) != grid.number_of_cells) {
|
||||
THROW("Size of porosity field differs from number of cells.");
|
||||
OPM_THROW(std::runtime_error, "Size of porosity field differs from number of cells.");
|
||||
}
|
||||
for (int i = 0; i < grid.number_of_cells; ++i) {
|
||||
porevol[i] *= grid.cell_volumes[i];
|
||||
@@ -105,7 +105,7 @@ main(int argc, char** argv)
|
||||
std::istream_iterator<double> end;
|
||||
flux.assign(beg, end);
|
||||
if (int(flux.size()) != grid.number_of_faces) {
|
||||
THROW("Size of flux field differs from number of faces.");
|
||||
OPM_THROW(std::runtime_error, "Size of flux field differs from number of faces.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ main(int argc, char** argv)
|
||||
std::istream_iterator<double> end;
|
||||
src.assign(beg, end);
|
||||
if (int(src.size()) != grid.number_of_cells) {
|
||||
THROW("Size of source term field differs from number of cells.");
|
||||
OPM_THROW(std::runtime_error, "Size of source term field differs from number of cells.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ main(int argc, char** argv)
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
|
@@ -252,7 +252,7 @@ int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
THROW("Need the name of ECLIPSE file on command line");
|
||||
OPM_THROW(std::runtime_error, "Need the name of ECLIPSE file on command line");
|
||||
{
|
||||
std::string outputFile;
|
||||
parseFile(argv[1] , outputFile);
|
||||
|
@@ -175,7 +175,7 @@ main(int argc, char** argv)
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
std::string filename = output_dir + "/epoch_timing.param";
|
||||
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
|
||||
@@ -228,7 +228,7 @@ main(int argc, char** argv)
|
||||
simtimer.init(*deck);
|
||||
} else {
|
||||
if (epoch != 0) {
|
||||
THROW("No TSTEP in deck for epoch " << epoch);
|
||||
OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch);
|
||||
}
|
||||
simtimer.init(param);
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ main(int argc, char** argv)
|
||||
{
|
||||
const bool use_reorder = param.getDefault("use_reorder", true);
|
||||
if (!use_reorder) {
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
OPM_THROW(std::runtime_error, "Cannot use implicit transport solver without UMFPACK. "
|
||||
"Either reconfigure opm-core with SuiteSparse/UMFPACK support and recompile, "
|
||||
"or use the reordering solver (use_reorder=true).");
|
||||
}
|
||||
@@ -193,7 +193,7 @@ main(int argc, char** argv)
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
std::string filename = output_dir + "/epoch_timing.param";
|
||||
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
|
||||
@@ -246,7 +246,7 @@ main(int argc, char** argv)
|
||||
simtimer.init(*deck);
|
||||
} else {
|
||||
if (epoch != 0) {
|
||||
THROW("No TSTEP in deck for epoch " << epoch);
|
||||
OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch);
|
||||
}
|
||||
simtimer.init(param);
|
||||
}
|
||||
|
@@ -125,10 +125,10 @@ namespace Opm
|
||||
: grid_(grid), cell_(cell), degree_(degree)
|
||||
{
|
||||
if (grid.dimensions > 3) {
|
||||
THROW("CellQuadrature only implemented for up to 3 dimensions.");
|
||||
OPM_THROW(std::runtime_error, "CellQuadrature only implemented for up to 3 dimensions.");
|
||||
}
|
||||
if (degree > 2) {
|
||||
THROW("CellQuadrature exact for polynomial degrees > 1 not implemented.");
|
||||
OPM_THROW(std::runtime_error, "CellQuadrature exact for polynomial degrees > 1 not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Opm
|
||||
}
|
||||
return;
|
||||
}
|
||||
THROW("Should never reach this point.");
|
||||
OPM_THROW(std::runtime_error, "Should never reach this point.");
|
||||
}
|
||||
|
||||
double quadPtWeight(const int index) const
|
||||
@@ -246,7 +246,7 @@ namespace Opm
|
||||
const double* n1c = nc + dim*node1;
|
||||
return 0.25*tetVolume(cc, fc, n0c, n1c);
|
||||
}
|
||||
THROW("Should never reach this point.");
|
||||
OPM_THROW(std::runtime_error, "Should never reach this point.");
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -87,10 +87,10 @@ namespace Opm
|
||||
: grid_(grid), face_(face), degree_(degree)
|
||||
{
|
||||
if (grid_.dimensions > 3) {
|
||||
THROW("FaceQuadrature only implemented for up to 3 dimensions.");
|
||||
OPM_THROW(std::runtime_error, "FaceQuadrature only implemented for up to 3 dimensions.");
|
||||
}
|
||||
if (degree_ > 2) {
|
||||
THROW("FaceQuadrature exact for polynomial degrees > 2 not implemented.");
|
||||
OPM_THROW(std::runtime_error, "FaceQuadrature exact for polynomial degrees > 2 not implemented.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ namespace Opm
|
||||
} else if (deck.hasField("DXV") && deck.hasField("DYV") && deck.hasField("DZV")) {
|
||||
initFromDeckTensorgrid(deck);
|
||||
} else {
|
||||
THROW("Could not initialize grid from deck. "
|
||||
OPM_THROW(std::runtime_error, "Could not initialize grid from deck. "
|
||||
"Need either ZCORN + COORD or DXV + DYV + DZV keywords.");
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Opm
|
||||
{
|
||||
ug_ = create_grid_cart2d(nx, ny, 1.0, 1.0);
|
||||
if (!ug_) {
|
||||
THROW("Failed to construct grid.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Opm
|
||||
{
|
||||
ug_ = create_grid_cart2d(nx, ny, dx, dy);
|
||||
if (!ug_) {
|
||||
THROW("Failed to construct grid.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Opm
|
||||
{
|
||||
ug_ = create_grid_cart3d(nx, ny, nz);
|
||||
if (!ug_) {
|
||||
THROW("Failed to construct grid.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Opm
|
||||
{
|
||||
ug_ = create_grid_hexa3d(nx, ny, nz, dx, dy, dz);
|
||||
if (!ug_) {
|
||||
THROW("Failed to construct grid.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Opm
|
||||
{
|
||||
ug_ = read_grid(input_filename.c_str());
|
||||
if (!ug_) {
|
||||
THROW("Failed to read grid from file " << input_filename);
|
||||
OPM_THROW(std::runtime_error, "Failed to read grid from file " << input_filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Opm
|
||||
// Process grid.
|
||||
ug_ = create_grid_cornerpoint(&grdecl, 0.0);
|
||||
if (!ug_) {
|
||||
THROW("Failed to construct grid.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Opm
|
||||
} else if (deck.hasField("SPECGRID")) {
|
||||
dims = deck.getSPECGRID().dimensions;
|
||||
} else {
|
||||
THROW("Deck must have either DIMENS or SPECGRID.");
|
||||
OPM_THROW(std::runtime_error, "Deck must have either DIMENS or SPECGRID.");
|
||||
}
|
||||
|
||||
// Extract coordinates (or offsets from top, in case of z).
|
||||
@@ -188,13 +188,13 @@ namespace Opm
|
||||
|
||||
// Check that number of cells given are consistent with DIMENS/SPECGRID.
|
||||
if (dims[0] != int(dxv.size())) {
|
||||
THROW("Number of DXV data points do not match DIMENS or SPECGRID.");
|
||||
OPM_THROW(std::runtime_error, "Number of DXV data points do not match DIMENS or SPECGRID.");
|
||||
}
|
||||
if (dims[1] != int(dyv.size())) {
|
||||
THROW("Number of DYV data points do not match DIMENS or SPECGRID.");
|
||||
OPM_THROW(std::runtime_error, "Number of DYV data points do not match DIMENS or SPECGRID.");
|
||||
}
|
||||
if (dims[2] != int(dzv.size())) {
|
||||
THROW("Number of DZV data points do not match DIMENS or SPECGRID.");
|
||||
OPM_THROW(std::runtime_error, "Number of DZV data points do not match DIMENS or SPECGRID.");
|
||||
}
|
||||
|
||||
// Extract top corner depths, if available.
|
||||
@@ -203,7 +203,7 @@ namespace Opm
|
||||
if (deck.hasField("DEPTHZ")) {
|
||||
const std::vector<double>& depthz = deck.getFloatingPointValue("DEPTHZ");
|
||||
if (depthz.size() != x.size()*y.size()) {
|
||||
THROW("Incorrect size of DEPTHZ: " << depthz.size());
|
||||
OPM_THROW(std::runtime_error, "Incorrect size of DEPTHZ: " << depthz.size());
|
||||
}
|
||||
top_depths = &depthz[0];
|
||||
} else if (deck.hasField("TOPS")) {
|
||||
@@ -212,7 +212,7 @@ namespace Opm
|
||||
// varying TOPS (stair-stepping grid, or not).
|
||||
const std::vector<double>& tops = deck.getFloatingPointValue("TOPS");
|
||||
if (std::count(tops.begin(), tops.end(), tops[0]) != int(tops.size())) {
|
||||
THROW("We do not support nonuniform TOPS, please use ZCORN/COORDS instead.");
|
||||
OPM_THROW(std::runtime_error, "We do not support nonuniform TOPS, please use ZCORN/COORDS instead.");
|
||||
}
|
||||
top_depths_vec.resize(x.size()*y.size(), tops[0]);
|
||||
top_depths = &top_depths_vec[0];
|
||||
@@ -222,7 +222,7 @@ namespace Opm
|
||||
ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(),
|
||||
&x[0], &y[0], &z[0], top_depths);
|
||||
if (!ug_) {
|
||||
THROW("Failed to construct grid.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -249,7 +249,7 @@ namespace Opm
|
||||
EclipseGridParser subparser()
|
||||
{
|
||||
if (parser_.hasField("FIELD") || parser_.hasField("LAB") || parser_.hasField("PVT-M")) {
|
||||
THROW("CornerPointChopper::subparser() cannot handle any eclipse unit system other than METRIC.");
|
||||
OPM_THROW(std::runtime_error, "CornerPointChopper::subparser() cannot handle any eclipse unit system other than METRIC.");
|
||||
}
|
||||
|
||||
EclipseGridParser sp;
|
||||
|
@@ -59,7 +59,7 @@ EclipseGridInspector::EclipseGridInspector(const EclipseGridParser& parser)
|
||||
keywords.push_back("ZCORN");
|
||||
|
||||
if (!parser_.hasFields(keywords)) {
|
||||
THROW("Needed field is missing in file");
|
||||
OPM_THROW(std::runtime_error, "Needed field is missing in file");
|
||||
}
|
||||
|
||||
if (parser_.hasField("SPECGRID")) {
|
||||
@@ -73,7 +73,7 @@ EclipseGridInspector::EclipseGridInspector(const EclipseGridParser& parser)
|
||||
logical_gridsize_[1] = dim[1];
|
||||
logical_gridsize_[2] = dim[2];
|
||||
} else {
|
||||
THROW("Found neither SPECGRID nor DIMENS in file. At least one is needed.");
|
||||
OPM_THROW(std::runtime_error, "Found neither SPECGRID nor DIMENS in file. At least one is needed.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -436,7 +436,7 @@ void EclipseGridParser::readImpl(istream& is)
|
||||
current_time_days_ = double(since_start.days());
|
||||
}
|
||||
} else {
|
||||
THROW("Keyword " << keyword << " cannot be handled here.");
|
||||
OPM_THROW(std::runtime_error, "Keyword " << keyword << " cannot be handled here.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ void EclipseGridParser::readImpl(istream& is)
|
||||
if (sb_ptr) {
|
||||
special_field_by_epoch_[current_epoch_][keyword] = sb_ptr;
|
||||
} else {
|
||||
THROW("Could not create field " << keyword);
|
||||
OPM_THROW(std::runtime_error, "Could not create field " << keyword);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -496,7 +496,7 @@ void EclipseGridParser::readImpl(istream& is)
|
||||
}
|
||||
ifstream include_is(include_filename.c_str());
|
||||
if (!include_is) {
|
||||
THROW("Unable to open INCLUDEd file " << include_filename);
|
||||
OPM_THROW(std::runtime_error, "Unable to open INCLUDEd file " << include_filename);
|
||||
}
|
||||
readImpl(include_is);
|
||||
// is >> ignoreSlashLine;
|
||||
@@ -572,7 +572,7 @@ void EclipseGridParser::convertToSI()
|
||||
MESSAGE("Not applying units to MAPAXES yet!");
|
||||
unit = 1.0;
|
||||
} else {
|
||||
THROW("Units for field " << key << " not specified. Cannon convert to SI.");
|
||||
OPM_THROW(std::runtime_error, "Units for field " << key << " not specified. Cannon convert to SI.");
|
||||
}
|
||||
|
||||
if (do_convert) {
|
||||
@@ -690,7 +690,7 @@ const std::vector<int>& EclipseGridParser::getIntegerValue(const std::string& ke
|
||||
map<string, vector<int> >::const_iterator it
|
||||
= integer_field_map_.find(keyword);
|
||||
if (it == integer_field_map_.end()) {
|
||||
THROW("No such field: " << keyword);
|
||||
OPM_THROW(std::runtime_error, "No such field: " << keyword);
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
@@ -703,7 +703,7 @@ const std::vector<double>& EclipseGridParser::getFloatingPointValue(const std::s
|
||||
map<string, vector<double> >::const_iterator it
|
||||
= floating_field_map_.find(keyword);
|
||||
if (it == floating_field_map_.end()) {
|
||||
THROW("No such field: " << keyword);
|
||||
OPM_THROW(std::runtime_error, "No such field: " << keyword);
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
@@ -716,7 +716,7 @@ const std::shared_ptr<SpecialBase> EclipseGridParser::getSpecialValue(const std:
|
||||
{
|
||||
SpecialMap::const_iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
|
||||
if (it == special_field_by_epoch_[current_epoch_].end()) {
|
||||
THROW("No such field: " << keyword);
|
||||
OPM_THROW(std::runtime_error, "No such field: " << keyword);
|
||||
} else {
|
||||
return it->second;
|
||||
}
|
||||
@@ -826,13 +826,13 @@ void EclipseGridParser::computeUnits()
|
||||
units_.transmissibility = centi*Poise * stb / (day * psia);
|
||||
break;
|
||||
case Lab:
|
||||
THROW("Unhandled unit family " << unit_family);
|
||||
OPM_THROW(std::runtime_error, "Unhandled unit family " << unit_family);
|
||||
break;
|
||||
case Pvtm:
|
||||
THROW("Unhandled unit family " << unit_family);
|
||||
OPM_THROW(std::runtime_error, "Unhandled unit family " << unit_family);
|
||||
break;
|
||||
default:
|
||||
THROW("Unknown unit family " << unit_family);
|
||||
OPM_THROW(std::runtime_error, "Unknown unit family " << unit_family);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -854,7 +854,7 @@ struct grdecl EclipseGridParser::get_grdecl() const {
|
||||
} else if (hasField("SPECGRID")) {
|
||||
dims = getSPECGRID().dimensions;
|
||||
} else {
|
||||
THROW("Deck must have either DIMENS or SPECGRID.");
|
||||
OPM_THROW(std::runtime_error, "Deck must have either DIMENS or SPECGRID.");
|
||||
}
|
||||
|
||||
// Collect in input struct for preprocessing.
|
||||
@@ -1110,7 +1110,7 @@ void EclipseGridParser::saveEGRID( const std::string & filename, int num_cells ,
|
||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
||||
static_cast<void>(num_cells); // Suppress "unused variable" warning.
|
||||
static_cast<void>(global_cell); // Suppress "unused variable" warning.
|
||||
THROW("Cannot write EGRID format without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
OPM_THROW(std::runtime_error, "Cannot write EGRID format without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1123,7 +1123,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
|
||||
// Read file
|
||||
ecl_file_type * ecl_file = ecl_file_open(filename.c_str() , 0);
|
||||
if (ecl_file == NULL) {
|
||||
THROW("Could not open IMPORTed file " << filename);
|
||||
OPM_THROW(std::runtime_error, "Could not open IMPORTed file " << filename);
|
||||
}
|
||||
const int num_kw = ecl_file_get_size(ecl_file);
|
||||
std::vector<double> double_vec;
|
||||
@@ -1174,7 +1174,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
|
||||
ecl_file_close(ecl_file);
|
||||
#else
|
||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
||||
THROW("Cannot use IMPORT keyword without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
OPM_THROW(std::runtime_error, "Cannot use IMPORT keyword without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
#endif // HAVE_ERT
|
||||
}
|
||||
|
||||
|
@@ -112,7 +112,7 @@ namespace
|
||||
char buffer[1000];
|
||||
is.getline(buffer, sizeof(buffer));
|
||||
std::cout << buffer<<std::endl;
|
||||
THROW("Encountered format error while reading data values. Value = " << dummy);
|
||||
OPM_THROW(std::runtime_error, "Encountered format error while reading data values. Value = " << dummy);
|
||||
}
|
||||
} else {
|
||||
if (is.peek() == int('*')) {
|
||||
@@ -126,7 +126,7 @@ namespace
|
||||
}
|
||||
}
|
||||
if (!is) {
|
||||
THROW("Encountered error while reading data values.");
|
||||
OPM_THROW(std::runtime_error, "Encountered error while reading data values.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace
|
||||
} else if (dummy[0] == '-') { // "comment test"
|
||||
is >> ignoreLine; // This line is a comment
|
||||
} else {
|
||||
THROW("Encountered format error while reading data values. Value = " << dummy);
|
||||
OPM_THROW(std::runtime_error, "Encountered format error while reading data values. Value = " << dummy);
|
||||
}
|
||||
} else {
|
||||
if (is.peek() == int('*')) {
|
||||
@@ -179,7 +179,7 @@ namespace
|
||||
}
|
||||
}
|
||||
if (!is) {
|
||||
THROW("Encountered error while reading data values.");
|
||||
OPM_THROW(std::runtime_error, "Encountered error while reading data values.");
|
||||
}
|
||||
return num_values;
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace
|
||||
} else if (dummy[0] == '-') { // "comment test"
|
||||
is >> ignoreLine; // This line is a comment
|
||||
} else {
|
||||
THROW("Encountered format error while reading data values. Value = " << dummy);
|
||||
OPM_THROW(std::runtime_error, "Encountered format error while reading data values. Value = " << dummy);
|
||||
}
|
||||
} else {
|
||||
if (is.peek() == int('*')) {
|
||||
@@ -218,7 +218,7 @@ namespace
|
||||
}
|
||||
}
|
||||
if (!is) {
|
||||
THROW("Encountered error while reading data values.");
|
||||
OPM_THROW(std::runtime_error, "Encountered error while reading data values.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace
|
||||
// the last table, and emptied it. If not,
|
||||
// we have an error.
|
||||
if (!table.empty()) {
|
||||
THROW("Reached EOF while still building PVT table. Missing end-of-table (slash)?");
|
||||
OPM_THROW(std::runtime_error, "Reached EOF while still building PVT table. Missing end-of-table (slash)?");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ namespace
|
||||
std::ostringstream oss;
|
||||
oss << "Error reading " << field_name
|
||||
<< ". Next character is " << (char)is.peek();
|
||||
THROW(oss.str());
|
||||
OPM_THROW(std::runtime_error, oss.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,7 @@ namespace
|
||||
std::ostringstream oss;
|
||||
oss << "Error reading " << field_name
|
||||
<< ". Next character is " << (char)is.peek();
|
||||
THROW(oss.str());
|
||||
OPM_THROW(std::runtime_error, oss.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,7 +452,7 @@ namespace
|
||||
std::ostringstream oss;
|
||||
oss << "Error reading " << field_name
|
||||
<< ". Next character is " << (char)is.peek();
|
||||
THROW(oss.str());
|
||||
OPM_THROW(std::runtime_error, oss.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ struct SpecialBase {
|
||||
//virtual void write(std::ostream& os) const = 0; // Writes data
|
||||
virtual void convertToSI(const EclipseUnits&)
|
||||
{
|
||||
THROW("Default conversion not defined.");
|
||||
OPM_THROW(std::runtime_error, "Default conversion not defined.");
|
||||
}
|
||||
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
||||
};
|
||||
@@ -104,7 +104,7 @@ struct SPECGRID : public SpecialBase
|
||||
if (ignoreSlashLine(is)) {
|
||||
return;
|
||||
} else {
|
||||
THROW("End of file reading" << name());
|
||||
OPM_THROW(std::runtime_error, "End of file reading" << name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ struct FAULTS : public SpecialBase
|
||||
fault_segment.fault_name = fltname;
|
||||
int nread = readDefaultedVectorData(is, fault_segment.ijk_coord, 6);
|
||||
if (nread != 6) {
|
||||
THROW("Error reading fault_segment " << fltname);
|
||||
OPM_THROW(std::runtime_error, "Error reading fault_segment " << fltname);
|
||||
}
|
||||
is >> fault_segment.face;
|
||||
faults.push_back(fault_segment);
|
||||
@@ -370,7 +370,7 @@ struct DENSITY : public SpecialBase
|
||||
if (action == 1) {
|
||||
return; // Alphabetic char. Read next keyword.
|
||||
} else if (action == 2) {
|
||||
THROW("Error reading DENSITY. Next character is "
|
||||
OPM_THROW(std::runtime_error, "Error reading DENSITY. Next character is "
|
||||
<< (char)is.peek());
|
||||
}
|
||||
}
|
||||
@@ -594,7 +594,7 @@ struct PVTW : public SpecialBase
|
||||
if (action == 1) {
|
||||
return; // Alphabetic char. Read next keyword.
|
||||
} else if (action == 2) {
|
||||
THROW("Error reading PVTW. Next character is "
|
||||
OPM_THROW(std::runtime_error, "Error reading PVTW. Next character is "
|
||||
<< (char)is.peek());
|
||||
}
|
||||
}
|
||||
@@ -641,7 +641,7 @@ struct ROCK : public SpecialBase
|
||||
if (action == 1) {
|
||||
return; // Alphabetic char. Read next keyword.
|
||||
} else if (action == 2) {
|
||||
THROW("Error reading ROCK. Next character is "
|
||||
OPM_THROW(std::runtime_error, "Error reading ROCK. Next character is "
|
||||
<< (char)is.peek());
|
||||
}
|
||||
}
|
||||
@@ -1655,7 +1655,7 @@ struct WELTARG : public SpecialBase
|
||||
weltarg[i].control_change_[0] == 'T') {
|
||||
weltarg[i].new_value_ *= units.pressure;
|
||||
} else {
|
||||
THROW("WELTARG. Unknown control or constraint "
|
||||
OPM_THROW(std::runtime_error, "WELTARG. Unknown control or constraint "
|
||||
<< weltarg[i].control_change_[0]);
|
||||
}
|
||||
}
|
||||
@@ -1843,7 +1843,7 @@ struct PVCDO : public SpecialBase
|
||||
if (action == 1) {
|
||||
return; // Alphabetic char. Read next keyword.
|
||||
} else if (action == 2) {
|
||||
THROW("Error reading PVCDO. Next character is "
|
||||
OPM_THROW(std::runtime_error, "Error reading PVCDO. Next character is "
|
||||
<< (char)is.peek());
|
||||
}
|
||||
}
|
||||
@@ -2321,19 +2321,19 @@ struct ENPTVD : public SpecialBase {
|
||||
is >> ignoreLine;
|
||||
break;
|
||||
} else {
|
||||
THROW("Error reading ENPTVD data - none or incomplete table.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENPTVD data - none or incomplete table.");
|
||||
}
|
||||
}
|
||||
std::vector<double> data(9,-1.0);
|
||||
int nread = readDefaultedVectorData(is, data, 9);
|
||||
if (nread != 9) {
|
||||
THROW("Error reading ENPTVD data - depth and 8 saturations pr line.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENPTVD data - depth and 8 saturations pr line.");
|
||||
}
|
||||
if (data[0] == -1.0) {
|
||||
THROW("Error reading ENPTVD data - depth can not be defaulted.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENPTVD data - depth can not be defaulted.");
|
||||
}
|
||||
if ((data[4] != -1.0) || (data[5] != -1.0) || (data[6] != -1.0) || (data[8] != -1.0)) {
|
||||
THROW("Error reading ENPTVD data - non-default values in column 5-7,9 not supported.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENPTVD data - non-default values in column 5-7,9 not supported.");
|
||||
}
|
||||
sub_table[0].push_back(data[0]); //depth
|
||||
sub_table[1].push_back(data[1]); //swl
|
||||
@@ -2352,7 +2352,7 @@ struct ENPTVD : public SpecialBase {
|
||||
++it_sub;
|
||||
}
|
||||
} else {
|
||||
THROW("Error reading ENPTVD data - minimum 2 lines pr sub-table.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENPTVD data - minimum 2 lines pr sub-table.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2408,19 +2408,19 @@ struct ENKRVD : public SpecialBase {
|
||||
is >> ignoreLine;
|
||||
break;
|
||||
} else {
|
||||
THROW("Error reading ENKRVD data - none or incomplete table.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENKRVD data - none or incomplete table.");
|
||||
}
|
||||
}
|
||||
std::vector<double> data(8,-1.0);
|
||||
int nread = readDefaultedVectorData(is, data, 8);
|
||||
if (nread != 8) {
|
||||
THROW("Error reading ENKRVD data - depth and 7 relperms pr line.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENKRVD data - depth and 7 relperms pr line.");
|
||||
}
|
||||
if (data[0] == -1.0) {
|
||||
THROW("Error reading ENKRVD data - depth can not be defaulted.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENKRVD data - depth can not be defaulted.");
|
||||
}
|
||||
if ((data[2] != -1.0) || (data[5] != -1.0) || (data[6] != -1.0)) {
|
||||
THROW("Error reading ENKRVD data - non-default values in column 3,6-7 not supported.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENKRVD data - non-default values in column 3,6-7 not supported.");
|
||||
}
|
||||
sub_table[0].push_back(data[0]); //depth
|
||||
sub_table[1].push_back(data[1]); //krw
|
||||
@@ -2439,7 +2439,7 @@ struct ENKRVD : public SpecialBase {
|
||||
++it_sub;
|
||||
}
|
||||
} else {
|
||||
THROW("Error reading ENKRVD data - minimum 2 lines pr sub-table.");
|
||||
OPM_THROW(std::runtime_error, "Error reading ENKRVD data - minimum 2 lines pr sub-table.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -46,9 +46,9 @@ namespace Opm
|
||||
int stride ) {
|
||||
|
||||
if (stride <= 0)
|
||||
THROW("Vector strides must be positive. Got stride = " << stride);
|
||||
OPM_THROW(std::runtime_error, "Vector strides must be positive. Got stride = " << stride);
|
||||
if ((stride * std::vector<double>::size_type(grid.number_of_cells)) != data->size())
|
||||
THROW("Internal mismatch grid.number_of_cells: " << grid.number_of_cells << " data size: " << data->size() / stride);
|
||||
OPM_THROW(std::runtime_error, "Internal mismatch grid.number_of_cells: " << grid.number_of_cells << " data size: " << data->size() / stride);
|
||||
{
|
||||
ecl_kw_type * ecl_kw = ecl_kw_alloc( kw_name.c_str() , grid.number_of_cells , ECL_FLOAT_TYPE );
|
||||
for (int i=0; i < grid.number_of_cells; i++)
|
||||
@@ -135,7 +135,7 @@ namespace Opm
|
||||
DataMap::const_iterator i = data.find("saturation");
|
||||
if (i != data.end()) {
|
||||
if (int(i->second->size()) != 2 * grid.number_of_cells) {
|
||||
THROW("writeECLData() requires saturation field to have two phases.");
|
||||
OPM_THROW(std::runtime_error, "writeECLData() requires saturation field to have two phases.");
|
||||
}
|
||||
ecl_kw_type * swat_kw = ecl_kw_wrapper( grid , "SWAT" , i->second , 0 , 2);
|
||||
ecl_rst_file_add_kw( rst_file , swat_kw );
|
||||
@@ -162,7 +162,7 @@ namespace Opm
|
||||
const std::string&,
|
||||
const std::string&)
|
||||
{
|
||||
THROW("Cannot call writeECLData() without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
OPM_THROW(std::runtime_error, "Cannot call writeECLData() without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -144,7 +144,7 @@ namespace Opm
|
||||
std::ostream& os)
|
||||
{
|
||||
if (grid.dimensions != 3) {
|
||||
THROW("Vtk output for 3d grids only");
|
||||
OPM_THROW(std::runtime_error, "Vtk output for 3d grids only");
|
||||
}
|
||||
os.precision(12);
|
||||
os << "<?xml version=\"1.0\"?>\n";
|
||||
|
@@ -46,7 +46,7 @@ namespace Opm
|
||||
#elif HAVE_DUNE_ISTL
|
||||
solver_.reset(new LinearSolverIstl);
|
||||
#else
|
||||
THROW("No linear solver available, you must have UMFPACK or dune-istl installed to use LinearSolverFactory.");
|
||||
OPM_THROW(std::runtime_error, "No linear solver available, you must have UMFPACK or dune-istl installed to use LinearSolverFactory.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ namespace Opm
|
||||
}
|
||||
|
||||
else {
|
||||
THROW("Linear solver " << ls << " is unknown.");
|
||||
OPM_THROW(std::runtime_error, "Linear solver " << ls << " is unknown.");
|
||||
}
|
||||
|
||||
if (! solver_) {
|
||||
THROW("Linear solver " << ls << " is not enabled in "
|
||||
OPM_THROW(std::runtime_error, "Linear solver " << ls << " is not enabled in "
|
||||
"this configuration.");
|
||||
}
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ namespace Opm
|
||||
singular_(false)
|
||||
{
|
||||
if (wells_ && (wells_->number_of_phases != props.numPhases())) {
|
||||
THROW("Inconsistent number of phases specified (wells vs. props): "
|
||||
OPM_THROW(std::runtime_error, "Inconsistent number of phases specified (wells vs. props): "
|
||||
<< wells_->number_of_phases << " != " << props.numPhases());
|
||||
}
|
||||
const int num_dofs = grid.number_of_cells + (wells ? wells->number_of_wells : 0);
|
||||
@@ -179,7 +179,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
if ((iter == maxiter_) && (res_norm > residual_tol_) && (inc_norm > change_tol_)) {
|
||||
THROW("CompressibleTpfa::solve() failed to converge in " << maxiter_ << " iterations.");
|
||||
OPM_THROW(std::runtime_error, "CompressibleTpfa::solve() failed to converge in " << maxiter_ << " iterations.");
|
||||
}
|
||||
|
||||
std::cout << "Solved pressure in " << iter << " iterations." << std::endl;
|
||||
|
@@ -43,7 +43,7 @@ namespace Opm
|
||||
{
|
||||
bc_ = flow_conditions_construct(0);
|
||||
if (!bc_) {
|
||||
THROW("Failed to construct FlowBoundaryConditions struct.");
|
||||
OPM_THROW(std::runtime_error, "Failed to construct FlowBoundaryConditions struct.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Opm
|
||||
{
|
||||
int ok = flow_conditions_append(type, face, value, bc_);
|
||||
if (!ok) {
|
||||
THROW("Failed to append boundary condition for face " << face);
|
||||
OPM_THROW(std::runtime_error, "Failed to append boundary condition for face " << face);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Opm
|
||||
findSideFaces(grid, side, faces);
|
||||
int ok = flow_conditions_append_multi(BC_PRESSURE, faces.size(), &faces[0], pressure, bc_);
|
||||
if (!ok) {
|
||||
THROW("Failed to append pressure boundary conditions for side " << sideString(side));
|
||||
OPM_THROW(std::runtime_error, "Failed to append pressure boundary conditions for side " << sideString(side));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Opm
|
||||
const double face_flux = flux * grid.face_areas[faces[fi]] / tot_area;
|
||||
int ok = flow_conditions_append(BC_FLUX_TOTVOL, faces[fi], face_flux, bc_);
|
||||
if (!ok) {
|
||||
THROW("Failed to append flux boundary conditions for face " << faces[fi] << " on side " << sideString(side));
|
||||
OPM_THROW(std::runtime_error, "Failed to append flux boundary conditions for face " << faces[fi] << " on side " << sideString(side));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ namespace Opm
|
||||
case FlowBCManager::Ymax: return "Ymax";
|
||||
case FlowBCManager::Zmin: return "Zmin";
|
||||
case FlowBCManager::Zmax: return "Zmax";
|
||||
default: THROW("Unknown side tag " << s);
|
||||
default: OPM_THROW(std::runtime_error, "Unknown side tag " << s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Opm
|
||||
std::vector<int>& faces)
|
||||
{
|
||||
if (grid.cell_facetag == 0) {
|
||||
THROW("Faces not tagged - cannot extract " << sideString(side) << " faces.");
|
||||
OPM_THROW(std::runtime_error, "Faces not tagged - cannot extract " << sideString(side) << " faces.");
|
||||
}
|
||||
|
||||
ASSERT2 (grid.dimensions <= 3,
|
||||
@@ -227,7 +227,7 @@ namespace Opm
|
||||
// Face is on boundary.
|
||||
faces.push_back(f);
|
||||
} else {
|
||||
THROW("Face not on boundary, even with correct tag and boundary cell. This should not occur.");
|
||||
OPM_THROW(std::runtime_error, "Face not on boundary, even with correct tag and boundary cell. This should not occur.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ namespace Opm
|
||||
UnstructuredGrid* gg = const_cast<UnstructuredGrid*>(&grid_);
|
||||
int ok = ifs_tpfa_assemble(gg, &forces_, &trans_[0], &gpress_omegaweighted_[0], h_);
|
||||
if (!ok) {
|
||||
THROW("Failed assembling pressure system.");
|
||||
OPM_THROW(std::runtime_error, "Failed assembling pressure system.");
|
||||
}
|
||||
|
||||
// Solve.
|
||||
@@ -269,7 +269,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
if ((iter == maxiter_) && (res_norm > residual_tol_) && (inc_norm > change_tol_)) {
|
||||
THROW("IncompTpfa::solve() failed to converge in " << maxiter_ << " iterations.");
|
||||
OPM_THROW(std::runtime_error, "IncompTpfa::solve() failed to converge in " << maxiter_ << " iterations.");
|
||||
}
|
||||
|
||||
std::cout << "Solved pressure in " << iter << " iterations." << std::endl;
|
||||
@@ -287,7 +287,7 @@ namespace Opm
|
||||
void IncompTpfa::computeStaticData()
|
||||
{
|
||||
if (wells_ && (wells_->number_of_phases != props_.numPhases())) {
|
||||
THROW("Inconsistent number of phases specified (wells vs. props): "
|
||||
OPM_THROW(std::runtime_error, "Inconsistent number of phases specified (wells vs. props): "
|
||||
<< wells_->number_of_phases << " != " << props_.numPhases());
|
||||
}
|
||||
const int num_dofs = grid_.number_of_cells + (wells_ ? wells_->number_of_wells : 0);
|
||||
@@ -406,7 +406,7 @@ namespace Opm
|
||||
&porevol_[0], &rock_comp_[0], dt, pressures,
|
||||
&initial_porevol_[0], h_);
|
||||
if (!ok) {
|
||||
THROW("Failed assembling pressure system.");
|
||||
OPM_THROW(std::runtime_error, "Failed assembling pressure system.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ namespace Opm
|
||||
pvt_.init(param);
|
||||
satprops_.init(param);
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("BlackoilPropertiesBasic::BlackoilPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropertiesBasic::BlackoilPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace Opm
|
||||
double* dmudp) const
|
||||
{
|
||||
if (dmudp) {
|
||||
THROW("BlackoilPropertiesBasic::viscosity() -- derivatives of viscosity not yet implemented.");
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropertiesBasic::viscosity() -- derivatives of viscosity not yet implemented.");
|
||||
} else {
|
||||
pvt_.mu(n, p, z, mu);
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ namespace Opm
|
||||
ptr->init(deck, grid, 200);
|
||||
|
||||
if (pvt_.numPhases() != satprops_->numPhases()) {
|
||||
THROW("BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace Opm
|
||||
const int sat_samples = param.getDefault("sat_tab_size", 200);
|
||||
std::string threephase_model = param.getDefault<std::string>("threephase_model", "simple");
|
||||
if (deck.hasField("ENDSCALE") && threephase_model != "simple") {
|
||||
THROW("Sorry, end point scaling currently available for the 'simple' model only.");
|
||||
OPM_THROW(std::runtime_error, "Sorry, end point scaling currently available for the 'simple' model only.");
|
||||
}
|
||||
if (sat_samples > 1) {
|
||||
if (threephase_model == "stone2") {
|
||||
@@ -78,7 +78,7 @@ namespace Opm
|
||||
satprops_.reset(ptr);
|
||||
ptr->init(deck, grid, sat_samples);
|
||||
} else {
|
||||
THROW("Unknown threephase_model: " << threephase_model);
|
||||
OPM_THROW(std::runtime_error, "Unknown threephase_model: " << threephase_model);
|
||||
}
|
||||
} else {
|
||||
if (threephase_model == "stone2") {
|
||||
@@ -97,12 +97,12 @@ namespace Opm
|
||||
satprops_.reset(ptr);
|
||||
ptr->init(deck, grid, sat_samples);
|
||||
} else {
|
||||
THROW("Unknown threephase_model: " << threephase_model);
|
||||
OPM_THROW(std::runtime_error, "Unknown threephase_model: " << threephase_model);
|
||||
}
|
||||
}
|
||||
|
||||
if (pvt_.numPhases() != satprops_->numPhases()) {
|
||||
THROW("BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ namespace Opm
|
||||
double* dmudp) const
|
||||
{
|
||||
if (dmudp) {
|
||||
THROW("BlackoilPropertiesFromDeck::viscosity() -- derivatives of viscosity not yet implemented.");
|
||||
OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::viscosity() -- derivatives of viscosity not yet implemented.");
|
||||
} else {
|
||||
pvt_.mu(n, p, z, mu);
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ namespace Opm
|
||||
pvt_.init(param);
|
||||
satprops_.init(param);
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("IncompPropertiesBasic::IncompPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
OPM_THROW(std::runtime_error, "IncompPropertiesBasic::IncompPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
}
|
||||
viscosity_.resize(pvt_.numPhases());
|
||||
@@ -60,7 +60,7 @@ namespace Opm
|
||||
pvt_.init(num_phases, rho, mu);
|
||||
satprops_.init(num_phases, relpermfunc);
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("IncompPropertiesBasic::IncompPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
OPM_THROW(std::runtime_error, "IncompPropertiesBasic::IncompPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
}
|
||||
viscosity_.resize(pvt_.numPhases());
|
||||
|
@@ -34,7 +34,7 @@ namespace Opm
|
||||
pvt_.init(deck);
|
||||
satprops_.init(deck, grid, 200);
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
OPM_THROW(std::runtime_error, "IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
}
|
||||
}
|
||||
|
@@ -54,13 +54,13 @@ namespace Opm
|
||||
|
||||
// Only 2 or 3 phase systems handled.
|
||||
if (pu.num_phases < 2 || pu.num_phases > 3) {
|
||||
THROW("Cannot handle cases with " << pu.num_phases << " phases.");
|
||||
OPM_THROW(std::runtime_error, "Cannot handle cases with " << pu.num_phases << " phases.");
|
||||
}
|
||||
|
||||
// We need oil systems, since we do not support the keywords needed for
|
||||
// water-gas systems.
|
||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
||||
THROW("Cannot handle cases with no OIL, i.e. water-gas systems.");
|
||||
OPM_THROW(std::runtime_error, "Cannot handle cases with no OIL, i.e. water-gas systems.");
|
||||
}
|
||||
|
||||
return pu;
|
||||
|
@@ -63,7 +63,7 @@ namespace Opm
|
||||
densities_[phase_usage_.phase_pos[Liquid]] = d[ECL_oil];
|
||||
}
|
||||
} else {
|
||||
THROW("Input is missing DENSITY\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
|
||||
}
|
||||
|
||||
// Set the properties.
|
||||
@@ -90,7 +90,7 @@ namespace Opm
|
||||
} else if (deck.hasField("PVCDO")) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_));
|
||||
} else {
|
||||
THROW("Input is missing PVDO or PVTO\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO or PVTO\n");
|
||||
}
|
||||
}
|
||||
// Gas PVT
|
||||
@@ -104,7 +104,7 @@ namespace Opm
|
||||
} else if (deck.hasField("PVTG")) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_));
|
||||
} else {
|
||||
THROW("Input is missing PVDG or PVTG\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Opm
|
||||
{
|
||||
int num_phases = param.getDefault("num_phases", 2);
|
||||
if (num_phases > 3 || num_phases < 1) {
|
||||
THROW("PvtPropertiesBasic::init() illegal num_phases: " << num_phases);
|
||||
OPM_THROW(std::runtime_error, "PvtPropertiesBasic::init() illegal num_phases: " << num_phases);
|
||||
}
|
||||
density_.resize(num_phases);
|
||||
viscosity_.resize(num_phases);
|
||||
@@ -65,7 +65,7 @@ namespace Opm
|
||||
const std::vector<double>& visc)
|
||||
{
|
||||
if (num_phases > 3 || num_phases < 1) {
|
||||
THROW("PvtPropertiesBasic::init() illegal num_phases: " << num_phases);
|
||||
OPM_THROW(std::runtime_error, "PvtPropertiesBasic::init() illegal num_phases: " << num_phases);
|
||||
}
|
||||
// We currently do not allow the user to set B.
|
||||
formation_volume_factor_.clear();
|
||||
|
@@ -45,7 +45,7 @@ namespace Opm
|
||||
if (phase_usage.phase_used[PhaseUsage::Vapour] ||
|
||||
!phase_usage.phase_used[PhaseUsage::Aqua] ||
|
||||
!phase_usage.phase_used[PhaseUsage::Liquid]) {
|
||||
THROW("PvtPropertiesIncompFromDeck::init() -- must have gas and oil phases (only) in deck input.\n");
|
||||
OPM_THROW(std::runtime_error, "PvtPropertiesIncompFromDeck::init() -- must have gas and oil phases (only) in deck input.\n");
|
||||
}
|
||||
|
||||
// Surface densities. Accounting for different orders in eclipse and our code.
|
||||
@@ -55,7 +55,7 @@ namespace Opm
|
||||
surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] = d[ECL_water];
|
||||
surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = d[ECL_oil];
|
||||
} else {
|
||||
THROW("Input is missing DENSITY\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
|
||||
}
|
||||
|
||||
// Make reservoir densities the same as surface densities initially.
|
||||
@@ -73,7 +73,7 @@ namespace Opm
|
||||
} else {
|
||||
// Eclipse 100 default.
|
||||
// viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = 0.5*Opm::prefix::centi*Opm::unit::Poise;
|
||||
THROW("Input is missing PVTW\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVTW\n");
|
||||
}
|
||||
|
||||
// Oil viscosity.
|
||||
@@ -85,7 +85,7 @@ namespace Opm
|
||||
reservoir_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] /= pvcdo[1];
|
||||
viscosity_[phase_usage.phase_pos[PhaseUsage::Liquid]] = pvcdo[3];
|
||||
} else {
|
||||
THROW("Input is missing PVCDO\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVCDO\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ namespace Opm
|
||||
{
|
||||
const int region_number = 0;
|
||||
if (pvtw.size() != 1) {
|
||||
THROW("More than one PVD-region");
|
||||
OPM_THROW(std::runtime_error, "More than one PVD-region");
|
||||
}
|
||||
ref_press_ = pvtw[region_number][0];
|
||||
ref_B_ = pvtw[region_number][1];
|
||||
|
@@ -38,7 +38,7 @@ namespace Opm
|
||||
{
|
||||
const int region_number = 0;
|
||||
if (pvd_table.size() != 1) {
|
||||
THROW("More than one PVT-region");
|
||||
OPM_THROW(std::runtime_error, "More than one PVT-region");
|
||||
}
|
||||
|
||||
// Copy data
|
||||
|
@@ -39,7 +39,7 @@ namespace Opm
|
||||
{
|
||||
const int region_number = 0;
|
||||
if (pvd_table.size() != 1) {
|
||||
THROW("More than one PVT-region");
|
||||
OPM_THROW(std::runtime_error, "More than one PVT-region");
|
||||
}
|
||||
|
||||
// Copy data
|
||||
|
@@ -51,7 +51,7 @@ namespace Opm
|
||||
// GAS, PVTG
|
||||
const int region_number = 0;
|
||||
if (pvtg.size() != 1) {
|
||||
THROW("More than one PVD-region");
|
||||
OPM_THROW(std::runtime_error, "More than one PVD-region");
|
||||
}
|
||||
saturated_gas_table_.resize(4);
|
||||
const int sz = pvtg[region_number].size();
|
||||
@@ -106,7 +106,7 @@ namespace Opm
|
||||
double* output_dmudp,
|
||||
double* output_dmudr) const
|
||||
{
|
||||
THROW("The new fluid interface not yet implemented");
|
||||
OPM_THROW(std::runtime_error, "The new fluid interface not yet implemented");
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace Opm
|
||||
double* output_dbdr) const
|
||||
|
||||
{
|
||||
THROW("The new fluid interface not yet implemented");
|
||||
OPM_THROW(std::runtime_error, "The new fluid interface not yet implemented");
|
||||
}
|
||||
|
||||
/// Gas resolution and its derivatives at bublepoint as a function of p.
|
||||
@@ -155,7 +155,7 @@ namespace Opm
|
||||
double* output_rbub,
|
||||
double* output_drbubdp) const
|
||||
{
|
||||
THROW("The new fluid interface not yet implemented");
|
||||
OPM_THROW(std::runtime_error, "The new fluid interface not yet implemented");
|
||||
}
|
||||
|
||||
/// Solution factor as a function of p and z.
|
||||
|
@@ -42,7 +42,7 @@ namespace Opm
|
||||
// OIL, PVTO
|
||||
const int region_number = 0;
|
||||
if (pvto.size() != 1) {
|
||||
THROW("More than one PVD-region");
|
||||
OPM_THROW(std::runtime_error, "More than one PVD-region");
|
||||
}
|
||||
saturated_oil_table_.resize(4);
|
||||
const int sz = pvto[region_number].size();
|
||||
|
@@ -45,7 +45,7 @@ namespace Opm
|
||||
if (deck.hasField("ROCKTAB")) {
|
||||
const table_t& rt = deck.getROCKTAB().rocktab_;
|
||||
if (rt.size() != 1) {
|
||||
THROW("Can only handle a single region in ROCKTAB.");
|
||||
OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB.");
|
||||
}
|
||||
const int n = rt[0][0].size();
|
||||
p_.resize(n);
|
||||
|
@@ -102,7 +102,7 @@ namespace Opm
|
||||
std::array<int,9> kmap;
|
||||
PermeabilityKind pkind = fillTensor(parser, tensor, kmap);
|
||||
if (pkind == Invalid) {
|
||||
THROW("Invalid permeability field.");
|
||||
OPM_THROW(std::runtime_error, "Invalid permeability field.");
|
||||
}
|
||||
|
||||
// Assign permeability values only if such values are
|
||||
@@ -271,7 +271,7 @@ namespace Opm
|
||||
{
|
||||
PermeabilityKind kind = classifyPermeability(parser);
|
||||
if (kind == Invalid) {
|
||||
THROW("Invalid set of permeability fields given.");
|
||||
OPM_THROW(std::runtime_error, "Invalid set of permeability fields given.");
|
||||
}
|
||||
ASSERT (tensor.size() == 1);
|
||||
for (int i = 0; i < 9; ++i) { kmap[i] = 0; }
|
||||
|
@@ -67,7 +67,7 @@ namespace Opm
|
||||
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
||||
THROW("Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
OPM_THROW(std::runtime_error, "Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||
}
|
||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||
@@ -272,7 +272,7 @@ namespace Opm
|
||||
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
||||
THROW("Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
OPM_THROW(std::runtime_error, "Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||
}
|
||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||
|
@@ -48,7 +48,7 @@ namespace Opm
|
||||
const std::vector<double>& krow = swof_table[table_num][2];
|
||||
const std::vector<double>& pcow = swof_table[table_num][3];
|
||||
if (krw.front() != 0.0 || krow.back() != 0.0) {
|
||||
THROW("Error SWOF data - non-zero krw(swco) and/or krow(1-sor)");
|
||||
OPM_THROW(std::runtime_error, "Error SWOF data - non-zero krw(swco) and/or krow(1-sor)");
|
||||
}
|
||||
buildUniformMonotoneTable(sw, krw, samples, krw_);
|
||||
buildUniformMonotoneTable(sw, krow, samples, krow_);
|
||||
@@ -91,7 +91,7 @@ namespace Opm
|
||||
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
||||
THROW("Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
OPM_THROW(std::runtime_error, "Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||
}
|
||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||
@@ -273,7 +273,7 @@ namespace Opm
|
||||
const std::vector<double>& krow = swof_table[table_num][2];
|
||||
const std::vector<double>& pcow = swof_table[table_num][3];
|
||||
if (krw.front() != 0.0 || krow.back() != 0.0) {
|
||||
THROW("Error SWOF data - non-zero krw(swco) and/or krow(1-sor)");
|
||||
OPM_THROW(std::runtime_error, "Error SWOF data - non-zero krw(swco) and/or krow(1-sor)");
|
||||
}
|
||||
krw_ = NonuniformTableLinear<double>(sw, krw);
|
||||
krow_ = NonuniformTableLinear<double>(sw, krow);
|
||||
@@ -317,7 +317,7 @@ namespace Opm
|
||||
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
||||
THROW("Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
OPM_THROW(std::runtime_error, "Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||
}
|
||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||
|
@@ -67,7 +67,7 @@ namespace Opm
|
||||
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
||||
THROW("Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
OPM_THROW(std::runtime_error, "Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||
}
|
||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||
@@ -261,7 +261,7 @@ namespace Opm
|
||||
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
||||
THROW("Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
OPM_THROW(std::runtime_error, "Gas maximum saturation in SGOF table = " << sg.back() <<
|
||||
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||
}
|
||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||
|
@@ -112,7 +112,7 @@ namespace Opm
|
||||
{
|
||||
int num_phases = param.getDefault("num_phases", 2);
|
||||
if (num_phases > 2 || num_phases < 1) {
|
||||
THROW("SaturationPropsBasic::init() illegal num_phases: " << num_phases);
|
||||
OPM_THROW(std::runtime_error, "SaturationPropsBasic::init() illegal num_phases: " << num_phases);
|
||||
}
|
||||
num_phases_ = num_phases;
|
||||
//std::string rpf = param.getDefault("relperm_func", std::string("Unset"));
|
||||
@@ -120,14 +120,14 @@ namespace Opm
|
||||
if (rpf == "Constant") {
|
||||
relperm_func_ = Constant;
|
||||
if(num_phases!=1){
|
||||
THROW("Constant relperm with more than one phase???");
|
||||
OPM_THROW(std::runtime_error, "Constant relperm with more than one phase???");
|
||||
}
|
||||
} else if (rpf == "Linear") {
|
||||
relperm_func_ = Linear;
|
||||
} else if (rpf == "Quadratic") {
|
||||
relperm_func_ = Quadratic;
|
||||
} else {
|
||||
THROW("SaturationPropsBasic::init() illegal relperm_func: " << rpf);
|
||||
OPM_THROW(std::runtime_error, "SaturationPropsBasic::init() illegal relperm_func: " << rpf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Opm
|
||||
break;
|
||||
}
|
||||
default:
|
||||
THROW("SaturationPropsBasic::relperm() unhandled relperm func type: " << relperm_func_);
|
||||
OPM_THROW(std::runtime_error, "SaturationPropsBasic::relperm() unhandled relperm func type: " << relperm_func_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ namespace Opm
|
||||
// Extract input data.
|
||||
// Oil phase should be active.
|
||||
if (!phase_usage_.phase_used[Liquid]) {
|
||||
THROW("SaturationPropsFromDeck::init() -- oil phase must be active.");
|
||||
OPM_THROW(std::runtime_error, "SaturationPropsFromDeck::init() -- oil phase must be active.");
|
||||
}
|
||||
|
||||
// Obtain SATNUM, if it exists, and create cell_to_func_.
|
||||
@@ -77,19 +77,19 @@ namespace Opm
|
||||
const SWOF::table_t& swof_table = deck.getSWOF().swof_;
|
||||
num_tables = swof_table.size();
|
||||
if (num_tables < satfuncs_expected) {
|
||||
THROW("Found " << num_tables << " SWOF tables, SATNUM specifies at least " << satfuncs_expected);
|
||||
OPM_THROW(std::runtime_error, "Found " << num_tables << " SWOF tables, SATNUM specifies at least " << satfuncs_expected);
|
||||
}
|
||||
}
|
||||
if (phase_usage_.phase_used[Vapour]) {
|
||||
const SGOF::table_t& sgof_table = deck.getSGOF().sgof_;
|
||||
int num_sgof_tables = sgof_table.size();
|
||||
if (num_sgof_tables < satfuncs_expected) {
|
||||
THROW("Found " << num_tables << " SGOF tables, SATNUM specifies at least " << satfuncs_expected);
|
||||
OPM_THROW(std::runtime_error, "Found " << num_tables << " SGOF tables, SATNUM specifies at least " << satfuncs_expected);
|
||||
}
|
||||
if (num_tables == Uninitialized) {
|
||||
num_tables = num_sgof_tables;
|
||||
} else if (num_tables != num_sgof_tables) {
|
||||
THROW("Inconsistent number of tables in SWOF and SGOF.");
|
||||
OPM_THROW(std::runtime_error, "Inconsistent number of tables in SWOF and SGOF.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,13 +104,13 @@ namespace Opm
|
||||
do_3pt_ = false;
|
||||
if (deck.hasField("ENDSCALE")) {
|
||||
if (!phase_usage_.phase_used[Aqua] || !phase_usage_.phase_used[Liquid] || phase_usage_.phase_used[Vapour]) {
|
||||
THROW("Currently endpoint-scaling limited to oil-water systems without gas.");
|
||||
OPM_THROW(std::runtime_error, "Currently endpoint-scaling limited to oil-water systems without gas.");
|
||||
}
|
||||
if (deck.getENDSCALE().dir_switch_ != std::string("NODIR")) {
|
||||
THROW("SaturationPropsFromDeck::init() -- ENDSCALE: Currently only 'NODIR' accepted.");
|
||||
OPM_THROW(std::runtime_error, "SaturationPropsFromDeck::init() -- ENDSCALE: Currently only 'NODIR' accepted.");
|
||||
}
|
||||
if (deck.getENDSCALE().revers_switch_ != std::string("REVERS")) {
|
||||
THROW("SaturationPropsFromDeck::init() -- ENDSCALE: Currently only 'REVERS' accepted.");
|
||||
OPM_THROW(std::runtime_error, "SaturationPropsFromDeck::init() -- ENDSCALE: Currently only 'REVERS' accepted.");
|
||||
}
|
||||
if (deck.hasField("SCALECRS")) {
|
||||
if (deck.getSCALECRS().scalecrs_ == std::string("YES")) {
|
||||
@@ -299,7 +299,7 @@ namespace Opm
|
||||
scaleparam[i] = funcForCell(i).sowcr_;
|
||||
}
|
||||
}else {
|
||||
THROW(" -- unknown keyword: '" << keyword << "'");
|
||||
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
|
||||
}
|
||||
if (!useKeyword && itab > 0) {
|
||||
table = deck.getENPTVD().table_;
|
||||
@@ -334,7 +334,7 @@ namespace Opm
|
||||
scaleparam[i] = funcForCell(i).krorw_;
|
||||
}
|
||||
} else {
|
||||
THROW(" -- unknown keyword: '" << keyword << "'");
|
||||
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
|
||||
}
|
||||
if (!useKeyword && itab > 0) {
|
||||
table = deck.getENKRVD().table_;
|
||||
@@ -449,7 +449,7 @@ namespace Opm
|
||||
|
||||
// Evaluation of relperms
|
||||
if (dkrds) {
|
||||
THROW("Relperm derivatives not yet available in combination with end point scaling ...");
|
||||
OPM_THROW(std::runtime_error, "Relperm derivatives not yet available in combination with end point scaling ...");
|
||||
funcForCell(cell).evalKrDeriv(ss, kr, dkrds);
|
||||
} else {
|
||||
// Assume: sw_cr -> krw=0 sw_max -> krw=<max water relperm>
|
||||
|
@@ -151,12 +151,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
|
||||
std::ofstream vtkfile(vtkfilename.str().c_str());
|
||||
if (!vtkfile) {
|
||||
THROW("Failed to open " << vtkfilename.str());
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
|
||||
}
|
||||
Opm::DataMap dm;
|
||||
dm["saturation"] = &state.saturation();
|
||||
@@ -190,12 +190,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
|
||||
std::ofstream file(fname.str().c_str());
|
||||
if (!file) {
|
||||
THROW("Failed to open " << fname.str());
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
|
||||
}
|
||||
file.precision(15);
|
||||
const std::vector<double>& d = *(it->second);
|
||||
@@ -211,7 +211,7 @@ namespace Opm
|
||||
std::string fname = output_dir + "/watercut.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname);
|
||||
}
|
||||
watercut.write(os);
|
||||
}
|
||||
@@ -224,7 +224,7 @@ namespace Opm
|
||||
std::string fname = output_dir + "/wellreport.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname);
|
||||
}
|
||||
wellreport.write(os);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
output_interval_ = param.getDefault("output_interval", 1);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ namespace Opm
|
||||
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
||||
++well_control_iteration;
|
||||
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) {
|
||||
THROW("Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
||||
OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
||||
}
|
||||
if (!well_control_passed) {
|
||||
std::cout << "Well controls not passed, solving again." << std::endl;
|
||||
|
@@ -188,12 +188,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
|
||||
std::ofstream vtkfile(vtkfilename.str().c_str());
|
||||
if (!vtkfile) {
|
||||
THROW("Failed to open " << vtkfilename.str());
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
|
||||
}
|
||||
Opm::DataMap dm;
|
||||
dm["saturation"] = &state.saturation();
|
||||
@@ -216,12 +216,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
|
||||
std::ofstream file(fname.str().c_str());
|
||||
if (!file) {
|
||||
THROW("Failed to open " << fname.str());
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
|
||||
}
|
||||
std::copy(vec.begin(), vec.end(), std::ostream_iterator<double>(file, "\n"));
|
||||
}
|
||||
@@ -247,12 +247,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
|
||||
std::ofstream file(fname.str().c_str());
|
||||
if (!file) {
|
||||
THROW("Failed to open " << fname.str());
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
|
||||
}
|
||||
file.precision(15);
|
||||
const std::vector<double>& d = *(it->second);
|
||||
@@ -268,7 +268,7 @@ namespace Opm
|
||||
std::string fname = output_dir + "/watercut.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname);
|
||||
}
|
||||
watercut.write(os);
|
||||
}
|
||||
@@ -281,7 +281,7 @@ namespace Opm
|
||||
std::string fname = output_dir + "/wellreport.txt";
|
||||
std::ofstream os(fname.c_str());
|
||||
if (!os) {
|
||||
THROW("Failed to open " << fname);
|
||||
OPM_THROW(std::runtime_error, "Failed to open " << fname);
|
||||
}
|
||||
wellreport.write(os);
|
||||
}
|
||||
@@ -353,10 +353,10 @@ namespace Opm
|
||||
|
||||
} else {
|
||||
if (rock_comp_props && rock_comp_props->isActive()) {
|
||||
THROW("The implicit pressure solver cannot handle rock compressibility.");
|
||||
OPM_THROW(std::runtime_error, "The implicit pressure solver cannot handle rock compressibility.");
|
||||
}
|
||||
if (use_segregation_split_) {
|
||||
THROW("The implicit pressure solver is not set up to use segregation splitting.");
|
||||
OPM_THROW(std::runtime_error, "The implicit pressure solver is not set up to use segregation splitting.");
|
||||
}
|
||||
std::vector<double> porevol;
|
||||
computePorevolume(grid, props.porosity(), porevol);
|
||||
@@ -379,7 +379,7 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
output_interval_ = param.getDefault("output_interval", 1);
|
||||
}
|
||||
@@ -527,7 +527,7 @@ namespace Opm
|
||||
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
|
||||
++well_control_iteration;
|
||||
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) {
|
||||
THROW("Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
||||
OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries.");
|
||||
}
|
||||
if (!well_control_passed) {
|
||||
std::cout << "Well controls not passed, solving again." << std::endl;
|
||||
|
@@ -75,7 +75,7 @@ namespace Opm
|
||||
if (current_step_ < 0 || current_step_ > int(timesteps_.size())) {
|
||||
// Note that we do allow current_step_ == timesteps_.size(),
|
||||
// that is the done() state.
|
||||
THROW("Trying to set invalid step number: " << step);
|
||||
OPM_THROW(std::runtime_error, "Trying to set invalid step number: " << step);
|
||||
}
|
||||
current_step_ = step;
|
||||
current_time_ = std::accumulate(timesteps_.begin(), timesteps_.begin() + step, 0.0);
|
||||
|
@@ -313,7 +313,7 @@ namespace Opm
|
||||
{
|
||||
const int num_phases = props.numPhases();
|
||||
if (num_phases != 2) {
|
||||
THROW("initStateTwophaseBasic(): currently handling only two-phase scenarios.");
|
||||
OPM_THROW(std::runtime_error, "initStateTwophaseBasic(): currently handling only two-phase scenarios.");
|
||||
}
|
||||
state.init(grid, num_phases);
|
||||
const int num_cells = props.numCells();
|
||||
@@ -409,7 +409,7 @@ namespace Opm
|
||||
// TODO: Refactor to exploit similarity with IncompProp* case.
|
||||
const int num_phases = props.numPhases();
|
||||
if (num_phases != 2) {
|
||||
THROW("initStateTwophaseBasic(): currently handling only two-phase scenarios.");
|
||||
OPM_THROW(std::runtime_error, "initStateTwophaseBasic(): currently handling only two-phase scenarios.");
|
||||
}
|
||||
state.init(grid, num_phases);
|
||||
const int num_cells = props.numCells();
|
||||
@@ -475,21 +475,21 @@ namespace Opm
|
||||
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, "
|
||||
OPM_THROW(std::runtime_error, "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.");
|
||||
OPM_THROW(std::runtime_error, "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).");
|
||||
OPM_THROW(std::runtime_error, "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("initStateFromDeck(): No region support yet.");
|
||||
OPM_THROW(std::runtime_error, "initStateFromDeck(): No region support yet.");
|
||||
}
|
||||
const double woc = equil.equil[0].water_oil_contact_depth_;
|
||||
initWaterOilContact(grid, props, woc, WaterBelow, state);
|
||||
@@ -507,7 +507,7 @@ namespace Opm
|
||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
||||
// oil-gas: we require SGAS
|
||||
if (!deck.hasField("SGAS")) {
|
||||
THROW("initStateFromDeck(): missing SGAS keyword in 2-phase init");
|
||||
OPM_THROW(std::runtime_error, "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];
|
||||
@@ -521,7 +521,7 @@ namespace Opm
|
||||
} else {
|
||||
// water-oil or water-gas: we require SWAT
|
||||
if (!deck.hasField("SWAT")) {
|
||||
THROW("initStateFromDeck(): missing SWAT keyword in 2-phase init");
|
||||
OPM_THROW(std::runtime_error, "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];
|
||||
@@ -536,7 +536,7 @@ namespace Opm
|
||||
} else if (num_phases == 3) {
|
||||
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.");
|
||||
OPM_THROW(std::runtime_error, "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];
|
||||
@@ -551,10 +551,10 @@ namespace Opm
|
||||
p[c] = p_deck[c_deck];
|
||||
}
|
||||
} else {
|
||||
THROW("initStateFromDeck(): init with SWAT etc. only available with 2 or 3 phases.");
|
||||
OPM_THROW(std::runtime_error, "initStateFromDeck(): init with SWAT etc. only available with 2 or 3 phases.");
|
||||
}
|
||||
} else {
|
||||
THROW("initStateFromDeck(): we must either have EQUIL, or PRESSURE and SWAT/SOIL/SGAS.");
|
||||
OPM_THROW(std::runtime_error, "initStateFromDeck(): we must either have EQUIL, or PRESSURE and SWAT/SOIL/SGAS.");
|
||||
}
|
||||
|
||||
// Finally, init face pressures.
|
||||
@@ -619,7 +619,7 @@ namespace Opm
|
||||
state.gasoilratio()[c] = rs_deck[c_deck];
|
||||
}
|
||||
} else {
|
||||
THROW("Temporarily, we require the RS field.");
|
||||
OPM_THROW(std::runtime_error, "Temporarily, we require the RS field.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -63,10 +63,10 @@ namespace Opm
|
||||
degree_(degree_arg)
|
||||
{
|
||||
if (grid_.dimensions > 3) {
|
||||
THROW("Grid dimension must be 1, 2 or 3.");
|
||||
OPM_THROW(std::runtime_error, "Grid dimension must be 1, 2 or 3.");
|
||||
}
|
||||
if (degree_ > 1 || degree_ < 0) {
|
||||
THROW("Degree must be 0 or 1.");
|
||||
OPM_THROW(std::runtime_error, "Degree must be 0 or 1.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Opm
|
||||
case 3:
|
||||
return (degree_ + 3)*(degree_ + 2)*(degree_ + 1)/6;
|
||||
default:
|
||||
THROW("Dimensions must be 1, 2 or 3.");
|
||||
OPM_THROW(std::runtime_error, "Dimensions must be 1, 2 or 3.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Opm
|
||||
f_x[0] = 1;
|
||||
break;
|
||||
default:
|
||||
THROW("Maximum degree is 1 for now.");
|
||||
OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,10 +194,10 @@ namespace Opm
|
||||
degree_(degree_arg)
|
||||
{
|
||||
if (grid_.dimensions > 3) {
|
||||
THROW("Grid dimension must be 1, 2 or 3.");
|
||||
OPM_THROW(std::runtime_error, "Grid dimension must be 1, 2 or 3.");
|
||||
}
|
||||
if (degree_ > 1 || degree_ < 0) {
|
||||
THROW("Degree must be 0 or 1.");
|
||||
OPM_THROW(std::runtime_error, "Degree must be 0 or 1.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace Opm
|
||||
case 3:
|
||||
return (degree_ + 1)*(degree_ + 1)*(degree_ + 1);
|
||||
default:
|
||||
THROW("Dimensions must be 1, 2 or 3.");
|
||||
OPM_THROW(std::runtime_error, "Dimensions must be 1, 2 or 3.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace Opm
|
||||
}
|
||||
break;
|
||||
default:
|
||||
THROW("Maximum degree is 1 for now.");
|
||||
OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ namespace Opm
|
||||
}
|
||||
break;
|
||||
default:
|
||||
THROW("Maximum degree is 1 for now.");
|
||||
OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -70,7 +70,7 @@ namespace Opm
|
||||
} else if (limiter_method_str == "MinUpwindAverage") {
|
||||
limiter_method_ = MinUpwindAverage;
|
||||
} else {
|
||||
THROW("Unknown limiter method: " << limiter_method_str);
|
||||
OPM_THROW(std::runtime_error, "Unknown limiter method: " << limiter_method_str);
|
||||
}
|
||||
const std::string limiter_usage_str = param.getDefault<std::string>("limiter_usage", "DuringComputations");
|
||||
if (limiter_usage_str == "DuringComputations") {
|
||||
@@ -80,7 +80,7 @@ namespace Opm
|
||||
} else if (limiter_usage_str == "AsSimultaneousPostProcess") {
|
||||
limiter_usage_ = AsSimultaneousPostProcess;
|
||||
} else {
|
||||
THROW("Unknown limiter usage spec: " << limiter_usage_str);
|
||||
OPM_THROW(std::runtime_error, "Unknown limiter usage spec: " << limiter_usage_str);
|
||||
}
|
||||
}
|
||||
// A note about the use_cvi_ member variable:
|
||||
@@ -112,7 +112,7 @@ namespace Opm
|
||||
// Sanity check for sources.
|
||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
||||
if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
|
||||
// THROW("Sources do not sum to zero: " << cum_src);
|
||||
// OPM_THROW(std::runtime_error, "Sources do not sum to zero: " << cum_src);
|
||||
MESSAGE("Warning: sources do not sum to zero: " << cum_src);
|
||||
}
|
||||
#endif
|
||||
@@ -144,7 +144,7 @@ namespace Opm
|
||||
// Do nothing.
|
||||
break;
|
||||
default:
|
||||
THROW("Unknown limiter usage choice: " << limiter_usage_);
|
||||
OPM_THROW(std::runtime_error, "Unknown limiter usage choice: " << limiter_usage_);
|
||||
}
|
||||
if (num_multicell_ > 0) {
|
||||
std::cout << num_multicell_ << " multicell blocks with max size "
|
||||
@@ -190,7 +190,7 @@ namespace Opm
|
||||
// Sanity check for sources.
|
||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
||||
if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
|
||||
// THROW("Sources do not sum to zero: " << cum_src);
|
||||
// OPM_THROW(std::runtime_error, "Sources do not sum to zero: " << cum_src);
|
||||
MESSAGE("Warning: sources do not sum to zero: " << cum_src);
|
||||
}
|
||||
#endif
|
||||
@@ -240,7 +240,7 @@ namespace Opm
|
||||
// Do nothing.
|
||||
break;
|
||||
default:
|
||||
THROW("Unknown limiter usage choice: " << limiter_usage_);
|
||||
OPM_THROW(std::runtime_error, "Unknown limiter usage choice: " << limiter_usage_);
|
||||
}
|
||||
if (num_multicell_ > 0) {
|
||||
std::cout << num_multicell_ << " multicell blocks with max size "
|
||||
@@ -467,7 +467,7 @@ namespace Opm
|
||||
for (int row = 0; row < n; ++row) {
|
||||
std::cerr << " " << orig_rhs_[row] << '\n';
|
||||
}
|
||||
THROW("Lapack error: " << info << " encountered in cell " << cell);
|
||||
OPM_THROW(std::runtime_error, "Lapack error: " << info << " encountered in cell " << cell);
|
||||
}
|
||||
|
||||
// The solution ends up in rhs_, so we must copy it.
|
||||
@@ -571,7 +571,7 @@ namespace Opm
|
||||
applyMinUpwindLimiter(cell, false, tof);
|
||||
break;
|
||||
default:
|
||||
THROW("Limiter type not implemented: " << limiter_method_);
|
||||
OPM_THROW(std::runtime_error, "Limiter type not implemented: " << limiter_method_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ namespace Opm
|
||||
void TofDiscGalReorder::applyMinUpwindLimiter(const int cell, const bool face_min, double* tof)
|
||||
{
|
||||
if (basis_func_->degree() != 1) {
|
||||
THROW("This limiter only makes sense for our DG1 implementation.");
|
||||
OPM_THROW(std::runtime_error, "This limiter only makes sense for our DG1 implementation.");
|
||||
}
|
||||
|
||||
// Limiter principles:
|
||||
|
@@ -71,7 +71,7 @@ namespace Opm
|
||||
// Sanity check for sources.
|
||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
||||
if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
|
||||
THROW("Sources do not sum to zero: " << cum_src);
|
||||
OPM_THROW(std::runtime_error, "Sources do not sum to zero: " << cum_src);
|
||||
}
|
||||
#endif
|
||||
tof.resize(grid_.number_of_cells);
|
||||
@@ -121,7 +121,7 @@ namespace Opm
|
||||
// Sanity check for sources.
|
||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
||||
if (std::fabs(cum_src) > *std::max_element(source, source + grid_.number_of_cells)*1e-2) {
|
||||
THROW("Sources do not sum to zero: " << cum_src);
|
||||
OPM_THROW(std::runtime_error, "Sources do not sum to zero: " << cum_src);
|
||||
}
|
||||
#endif
|
||||
tof.resize(grid_.number_of_cells);
|
||||
@@ -148,7 +148,7 @@ namespace Opm
|
||||
if (use_multidim_upwind_) {
|
||||
face_tof_.resize(grid_.number_of_faces);
|
||||
std::fill(face_tof_.begin(), face_tof_.end(), 0.0);
|
||||
THROW("Multidimensional upwind not yet implemented for tracer.");
|
||||
OPM_THROW(std::runtime_error, "Multidimensional upwind not yet implemented for tracer.");
|
||||
}
|
||||
num_multicell_ = 0;
|
||||
max_size_multicell_ = 0;
|
||||
|
@@ -58,7 +58,7 @@ namespace Opm
|
||||
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||
call_UMFPACK(const_cast<CSRMatrix*>(A), b, x);
|
||||
#else
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
OPM_THROW(std::runtime_error, "Cannot use implicit transport solver without UMFPACK. "
|
||||
"Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
|
||||
#endif
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace Opm
|
||||
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||
call_UMFPACK(const_cast<CSRMatrix*>(&A), &b[0], &x[0]);
|
||||
#else
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
OPM_THROW(std::runtime_error, "Cannot use implicit transport solver without UMFPACK. "
|
||||
"Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
|
||||
#endif
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ namespace Opm
|
||||
++iter;
|
||||
}
|
||||
if (max_delta >= tol_) {
|
||||
THROW("Failed to converge!");
|
||||
OPM_THROW(std::runtime_error, "Failed to converge!");
|
||||
}
|
||||
// Finalize.
|
||||
// model_.finishIteration(); // Doesn't do anything in th 2p model.
|
||||
@@ -184,7 +184,7 @@ namespace Opm
|
||||
// Solution will be written to rhs.
|
||||
dgtsv_(&colSize, &num_rhs, DL, D, DU, &rhs[0], &colSize, &info);
|
||||
if (info != 0) {
|
||||
THROW("Lapack reported error in dgtsv: " << info);
|
||||
OPM_THROW(std::runtime_error, "Lapack reported error in dgtsv: " << info);
|
||||
}
|
||||
for (int ci = 0; ci < col_size; ++ci) {
|
||||
sol_vec[column_cells[ci]] = -rhs[ci];
|
||||
|
@@ -39,7 +39,7 @@ namespace Opm{
|
||||
smax_(props.numCells()*props.numPhases())
|
||||
{
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("SimpleFluid2pWrapper requires 2 phases.");
|
||||
OPM_THROW(std::runtime_error, "SimpleFluid2pWrapper requires 2 phases.");
|
||||
}
|
||||
const int num_cells = props.numCells();
|
||||
std::vector<int> cells(num_cells);
|
||||
|
@@ -78,7 +78,7 @@ namespace Opm
|
||||
{
|
||||
// A very crude check for constant porosity (i.e. no rock-compressibility).
|
||||
if (porevolume[0] != initial_porevolume_cell0_) {
|
||||
THROW("Detected changed pore volumes, but solver cannot handle rock compressibility.");
|
||||
OPM_THROW(std::runtime_error, "Detected changed pore volumes, but solver cannot handle rock compressibility.");
|
||||
}
|
||||
double ssrc[] = { 1.0, 0.0 };
|
||||
double dummy[] = { 0.0, 0.0 };
|
||||
@@ -92,7 +92,7 @@ namespace Opm
|
||||
success = append_transport_source(cell, num_phases, state.pressure()[cell], source[cell], dummy, dummy, tsrc_);
|
||||
}
|
||||
if (!success) {
|
||||
THROW("Failed building TransportSource struct.");
|
||||
OPM_THROW(std::runtime_error, "Failed building TransportSource struct.");
|
||||
}
|
||||
}
|
||||
Opm::ImplicitTransportDetails::NRReport rpt;
|
||||
|
@@ -63,7 +63,7 @@ namespace Opm
|
||||
ja_downw_(grid.number_of_faces, -1)
|
||||
{
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("Property object must have 2 phases");
|
||||
OPM_THROW(std::runtime_error, "Property object must have 2 phases");
|
||||
}
|
||||
int np = props.numPhases();
|
||||
int num_cells = props.numCells();
|
||||
@@ -100,7 +100,7 @@ namespace Opm
|
||||
|
||||
// Check immiscibility requirement (only done for first cell).
|
||||
if (A_[1] != 0.0 || A_[2] != 0.0) {
|
||||
THROW("TransportModelCompressibleTwophase requires a property object without miscibility.");
|
||||
OPM_THROW(std::runtime_error, "TransportModelCompressibleTwophase requires a property object without miscibility.");
|
||||
}
|
||||
|
||||
std::vector<int> seq(grid_.number_of_cells);
|
||||
@@ -296,7 +296,7 @@ namespace Opm
|
||||
|
||||
// Done with iterations, check if we succeeded.
|
||||
if (update_count > 0) {
|
||||
THROW("In solveMultiCell(), we did not converge after "
|
||||
OPM_THROW(std::runtime_error, "In solveMultiCell(), we did not converge after "
|
||||
<< num_iters << " iterations. Remaining update count = " << update_count);
|
||||
}
|
||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||
@@ -498,7 +498,7 @@ namespace Opm
|
||||
} while (max_s_change > tol_ && ++num_iters < maxit_);
|
||||
|
||||
if (max_s_change > tol_) {
|
||||
THROW("In solveGravityColumn(), we did not converge after "
|
||||
OPM_THROW(std::runtime_error, "In solveGravityColumn(), we did not converge after "
|
||||
<< num_iters << " iterations. Delta s = " << max_s_change);
|
||||
}
|
||||
return num_iters + 1;
|
||||
|
@@ -67,7 +67,7 @@ namespace Opm
|
||||
#endif
|
||||
{
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("Property object must have 2 phases");
|
||||
OPM_THROW(std::runtime_error, "Property object must have 2 phases");
|
||||
}
|
||||
visc_ = props.viscosity();
|
||||
int num_cells = props.numCells();
|
||||
@@ -409,7 +409,7 @@ namespace Opm
|
||||
|
||||
// Done with iterations, check if we succeeded.
|
||||
if (update_count > 0) {
|
||||
THROW("In solveMultiCell(), we did not converge after "
|
||||
OPM_THROW(std::runtime_error, "In solveMultiCell(), we did not converge after "
|
||||
<< num_iters << " iterations. Remaining update count = " << update_count);
|
||||
}
|
||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||
@@ -445,7 +445,7 @@ namespace Opm
|
||||
// << " in cell " << max_change_cell << std::endl;
|
||||
} while (max_s_change > tol && ++num_iters < max_iters);
|
||||
if (max_s_change > tol) {
|
||||
THROW("In solveMultiCell(), we did not converge after "
|
||||
OPM_THROW(std::runtime_error, "In solveMultiCell(), we did not converge after "
|
||||
<< num_iters << " iterations. Delta s = " << max_s_change);
|
||||
}
|
||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||
@@ -629,7 +629,7 @@ namespace Opm
|
||||
} while (max_s_change > tol_ && ++num_iters < maxit_);
|
||||
|
||||
if (max_s_change > tol_) {
|
||||
THROW("In solveGravityColumn(), we did not converge after "
|
||||
OPM_THROW(std::runtime_error, "In solveGravityColumn(), we did not converge after "
|
||||
<< num_iters << " iterations. Delta s = " << max_s_change);
|
||||
}
|
||||
return num_iters + 1;
|
||||
|
@@ -139,7 +139,7 @@ namespace Opm
|
||||
typename CreatorMap::iterator it;
|
||||
it = string_to_creator_.find(type);
|
||||
if (it == string_to_creator_.end()) {
|
||||
THROW("Creator type " << type
|
||||
OPM_THROW(std::runtime_error, "Creator type " << type
|
||||
<< " is not registered in the factory.");
|
||||
}
|
||||
return it->second->create();
|
||||
@@ -152,7 +152,7 @@ namespace Opm
|
||||
typename CreatorMap::iterator it;
|
||||
it = string_to_creator_.find(type);
|
||||
if (it == string_to_creator_.end()) {
|
||||
THROW("Creator type " << type
|
||||
OPM_THROW(std::runtime_error, "Creator type " << type
|
||||
<< " is not registered in the factory.");
|
||||
}
|
||||
return it->second->clone(original);
|
||||
|
@@ -50,13 +50,13 @@ namespace Opm
|
||||
{
|
||||
static double handleBracketingFailure(const double x0, const double x1, const double f0, const double f1)
|
||||
{
|
||||
THROW("Error in parameters, zero not bracketed: [a, b] = ["
|
||||
OPM_THROW(std::runtime_error, "Error in parameters, zero not bracketed: [a, b] = ["
|
||||
<< x0 << ", " << x1 << "] f(a) = " << f0 << " f(b) = " << f1);
|
||||
return -1e100; // Never reached.
|
||||
}
|
||||
static double handleTooManyIterations(const double x0, const double x1, const int maxiter)
|
||||
{
|
||||
THROW("Maximum number of iterations exceeded: " << maxiter << "\n"
|
||||
OPM_THROW(std::runtime_error, "Maximum number of iterations exceeded: " << maxiter << "\n"
|
||||
<< "Current interval is [" << std::min(x0, x1) << ", "
|
||||
<< std::max(x0, x1) << "]");
|
||||
return -1e100; // Never reached.
|
||||
@@ -315,7 +315,7 @@ namespace Opm
|
||||
cur_dx = -2.0*cur_dx;
|
||||
}
|
||||
if (i == max_iters) {
|
||||
THROW("Could not bracket zero in " << max_iters << "iterations.");
|
||||
OPM_THROW(std::runtime_error, "Could not bracket zero in " << max_iters << "iterations.");
|
||||
}
|
||||
if (cur_dx < 0.0) {
|
||||
a = x0 + cur_dx;
|
||||
|
@@ -218,11 +218,11 @@ namespace Opm
|
||||
// we have to create the cumulative ones.
|
||||
int num_rows = rowsize_end - rowsize_beg;
|
||||
if (num_rows < 1) {
|
||||
THROW("Must have at least one row. Got " << num_rows << " rows.");
|
||||
OPM_THROW(std::runtime_error, "Must have at least one row. Got " << num_rows << " rows.");
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
if (*std::min_element(rowsize_beg, rowsize_end) < 0) {
|
||||
THROW("All row sizes must be at least 0.");
|
||||
OPM_THROW(std::runtime_error, "All row sizes must be at least 0.");
|
||||
}
|
||||
#endif
|
||||
row_start_.resize(num_rows + 1);
|
||||
@@ -230,7 +230,7 @@ namespace Opm
|
||||
std::partial_sum(rowsize_beg, rowsize_end, row_start_.begin() + 1);
|
||||
// Check that data_ and row_start_ match.
|
||||
if (int(data_.size()) != row_start_.back()) {
|
||||
THROW("End of row start indices different from data size.");
|
||||
OPM_THROW(std::runtime_error, "End of row start indices different from data size.");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ namespace Opm
|
||||
for (int i = 0; i < num_ind; ++i) {
|
||||
int index = indices_[i];
|
||||
if (index <= last_index || index >= sz) {
|
||||
THROW("Error in SparseVector construction, index is nonincreasing or out of range.");
|
||||
OPM_THROW(std::runtime_error, "Error in SparseVector construction, index is nonincreasing or out of range.");
|
||||
}
|
||||
last_index = index;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ namespace Opm
|
||||
void StopWatch::stop()
|
||||
{
|
||||
if (state_ != Running) {
|
||||
THROW("Called stop() on a StopWatch that was not running.");
|
||||
OPM_THROW(std::runtime_error, "Called stop() on a StopWatch that was not running.");
|
||||
}
|
||||
stop_time_ = boost::posix_time::microsec_clock::local_time();
|
||||
state_ = Stopped;
|
||||
@@ -76,7 +76,7 @@ namespace Opm
|
||||
run_time = stop_time_;
|
||||
} else {
|
||||
ASSERT(state_ == UnStarted);
|
||||
THROW("Called secsSinceLast() on a StopWatch that had not been started.");
|
||||
OPM_THROW(std::runtime_error, "Called secsSinceLast() on a StopWatch that had not been started.");
|
||||
}
|
||||
boost::posix_time::time_duration dur = run_time - last_time_;
|
||||
last_time_ = run_time;
|
||||
@@ -92,7 +92,7 @@ namespace Opm
|
||||
run_time = stop_time_;
|
||||
} else {
|
||||
ASSERT(state_ == UnStarted);
|
||||
THROW("Called secsSinceStart() on a StopWatch that had not been started.");
|
||||
OPM_THROW(std::runtime_error, "Called secsSinceStart() on a StopWatch that had not been started.");
|
||||
}
|
||||
boost::posix_time::time_duration dur = run_time - start_time_;
|
||||
return double(dur.total_microseconds())/1000000.0;
|
||||
|
@@ -228,7 +228,7 @@ namespace Opm {
|
||||
::setLeftPolicy(RangePolicy rp)
|
||||
{
|
||||
if (rp != ClosestValue) {
|
||||
THROW("Only ClosestValue RangePolicy implemented.");
|
||||
OPM_THROW(std::runtime_error, "Only ClosestValue RangePolicy implemented.");
|
||||
}
|
||||
left_ = rp;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ namespace Opm {
|
||||
::setRightPolicy(RangePolicy rp)
|
||||
{
|
||||
if (rp != ClosestValue) {
|
||||
THROW("Only ClosestValue RangePolicy implemented.");
|
||||
OPM_THROW(std::runtime_error, "Only ClosestValue RangePolicy implemented.");
|
||||
}
|
||||
right_ = rp;
|
||||
}
|
||||
|
@@ -149,7 +149,7 @@ namespace Opm
|
||||
for (int row = 0; row < n; ++row) {
|
||||
std::cerr << " " << orig_f[row] << '\n';
|
||||
}
|
||||
THROW("Lapack error: " << info << " encountered in cell " << cell);
|
||||
OPM_THROW(std::runtime_error, "Lapack error: " << info << " encountered in cell " << cell);
|
||||
}
|
||||
// The solution ends up in f, so we must copy it.
|
||||
std::copy(f.begin(), f.end(), corner_velocity_.begin() + dim*cid);
|
||||
|
@@ -100,7 +100,7 @@ namespace Opm
|
||||
enum { Maxdim = 3 };
|
||||
const int dim = grid.dimensions;
|
||||
if (dim > Maxdim) {
|
||||
THROW("Grid has more than " << Maxdim << " dimensions.");
|
||||
OPM_THROW(std::runtime_error, "Grid has more than " << Maxdim << " dimensions.");
|
||||
}
|
||||
// Compute static data for each corner.
|
||||
const int num_cells = grid.number_of_cells;
|
||||
@@ -134,7 +134,7 @@ namespace Opm
|
||||
std::vector<int> vert_adj_faces(dim);
|
||||
for (MMIt face_it = frange.first; face_it != frange.second; ++face_it, ++fi) {
|
||||
if (fi >= dim) {
|
||||
THROW("In cell " << cell << ", vertex " << ci.vertex << " has "
|
||||
OPM_THROW(std::runtime_error, "In cell " << cell << ", vertex " << ci.vertex << " has "
|
||||
<< " more than " << dim << " adjacent faces.");
|
||||
}
|
||||
fnorm[fi] = grid_.face_normals + dim*(face_it->second);
|
||||
|
@@ -106,7 +106,7 @@ namespace Opm
|
||||
const int num_cells = pv.size();
|
||||
const int np = s.size()/pv.size();
|
||||
if (int(s.size()) != num_cells*np) {
|
||||
THROW("Sizes of s and pv vectors do not match.");
|
||||
OPM_THROW(std::runtime_error, "Sizes of s and pv vectors do not match.");
|
||||
}
|
||||
std::fill(sat_vol, sat_vol + np, 0.0);
|
||||
for (int c = 0; c < num_cells; ++c) {
|
||||
@@ -131,7 +131,7 @@ namespace Opm
|
||||
const int num_cells = pv.size();
|
||||
const int np = s.size()/pv.size();
|
||||
if (int(s.size()) != num_cells*np) {
|
||||
THROW("Sizes of s and pv vectors do not match.");
|
||||
OPM_THROW(std::runtime_error, "Sizes of s and pv vectors do not match.");
|
||||
}
|
||||
double tot_pv = 0.0;
|
||||
// Note that we abuse the output array to accumulate the
|
||||
@@ -172,7 +172,7 @@ namespace Opm
|
||||
const int num_cells = src.size();
|
||||
const int np = s.size()/src.size();
|
||||
if (int(s.size()) != num_cells*np) {
|
||||
THROW("Sizes of s and src vectors do not match.");
|
||||
OPM_THROW(std::runtime_error, "Sizes of s and src vectors do not match.");
|
||||
}
|
||||
std::fill(injected, injected + np, 0.0);
|
||||
std::fill(produced, produced + np, 0.0);
|
||||
@@ -366,7 +366,7 @@ namespace Opm
|
||||
const int nw = wells->number_of_wells;
|
||||
const int np = wells->number_of_phases;
|
||||
if (np != 2) {
|
||||
THROW("computeTransportSource() requires a 2 phase case.");
|
||||
OPM_THROW(std::runtime_error, "computeTransportSource() requires a 2 phase case.");
|
||||
}
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
const double* comp_frac = wells->comp_frac + np*w;
|
||||
@@ -453,7 +453,7 @@ namespace Opm
|
||||
{
|
||||
const int np = wells.number_of_phases;
|
||||
if (np != 2) {
|
||||
THROW("wellsToSrc() requires a 2 phase case.");
|
||||
OPM_THROW(std::runtime_error, "wellsToSrc() requires a 2 phase case.");
|
||||
}
|
||||
src.resize(num_cells);
|
||||
for (int w = 0; w < wells.number_of_wells; ++w) {
|
||||
@@ -462,14 +462,14 @@ namespace Opm
|
||||
MESSAGE("In wellsToSrc(): well has more than one control, all but current control will be ignored.");
|
||||
}
|
||||
if (wells.ctrls[w]->type[cur] != RESERVOIR_RATE) {
|
||||
THROW("In wellsToSrc(): well is something other than RESERVOIR_RATE.");
|
||||
OPM_THROW(std::runtime_error, "In wellsToSrc(): well is something other than RESERVOIR_RATE.");
|
||||
}
|
||||
if (wells.well_connpos[w+1] - wells.well_connpos[w] != 1) {
|
||||
THROW("In wellsToSrc(): well has multiple perforations.");
|
||||
OPM_THROW(std::runtime_error, "In wellsToSrc(): well has multiple perforations.");
|
||||
}
|
||||
for (int p = 0; p < np; ++p) {
|
||||
if (wells.ctrls[w]->distr[np*cur + p] != 1.0) {
|
||||
THROW("In wellsToSrc(): well not controlled on total rate.");
|
||||
OPM_THROW(std::runtime_error, "In wellsToSrc(): well not controlled on total rate.");
|
||||
}
|
||||
}
|
||||
double flow = wells.ctrls[w]->target[cur];
|
||||
@@ -602,7 +602,7 @@ namespace Opm
|
||||
int np = props.numPhases();
|
||||
const int max_np = 3;
|
||||
if (np > max_np) {
|
||||
THROW("WellReport for now assumes #phases <= " << max_np);
|
||||
OPM_THROW(std::runtime_error, "WellReport for now assumes #phases <= " << max_np);
|
||||
}
|
||||
const double* visc = props.viscosity();
|
||||
std::vector<double> data_now;
|
||||
@@ -661,7 +661,7 @@ namespace Opm
|
||||
int np = props.numPhases();
|
||||
const int max_np = 3;
|
||||
if (np > max_np) {
|
||||
THROW("WellReport for now assumes #phases <= " << max_np);
|
||||
OPM_THROW(std::runtime_error, "WellReport for now assumes #phases <= " << max_np);
|
||||
}
|
||||
std::vector<double> data_now;
|
||||
data_now.reserve(1 + 3*nw);
|
||||
|
@@ -61,11 +61,11 @@ namespace Opm
|
||||
{
|
||||
const int num_cells = transport_src.size();
|
||||
if (props.numCells() != num_cells) {
|
||||
THROW("Size of transport_src vector does not match number of cells in props.");
|
||||
OPM_THROW(std::runtime_error, "Size of transport_src vector does not match number of cells in props.");
|
||||
}
|
||||
const int np = props.numPhases();
|
||||
if (int(state.saturation().size()) != num_cells*np) {
|
||||
THROW("Sizes of state vectors do not match number of cells.");
|
||||
OPM_THROW(std::runtime_error, "Sizes of state vectors do not match number of cells.");
|
||||
}
|
||||
const std::vector<double>& press = state.pressure();
|
||||
const std::vector<double>& s = state.saturation();
|
||||
@@ -301,7 +301,7 @@ namespace Opm
|
||||
const int nw = wells->number_of_wells;
|
||||
const int np = wells->number_of_phases;
|
||||
if (np != 2) {
|
||||
THROW("computeTransportSource() requires a 2 phase case.");
|
||||
OPM_THROW(std::runtime_error, "computeTransportSource() requires a 2 phase case.");
|
||||
}
|
||||
std::vector<double> A(np*np);
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
|
@@ -53,7 +53,7 @@ namespace Opm
|
||||
|
||||
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
|
||||
if (!parent_as_group) {
|
||||
THROW("Trying to add child to group named " << parent_name << ", but it's not a group.");
|
||||
OPM_THROW(std::runtime_error, "Trying to add child to group named " << parent_name << ", but it's not a group.");
|
||||
}
|
||||
parent_as_group->addChild(child);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Opm
|
||||
{
|
||||
WellsGroupInterface* parent = findNode(parent_name);
|
||||
if (parent == NULL) {
|
||||
THROW("Parent with name = " << parent_name << " not found.");
|
||||
OPM_THROW(std::runtime_error, "Parent with name = " << parent_name << " not found.");
|
||||
}
|
||||
ASSERT(!parent->isLeafNode());
|
||||
static_cast<WellsGroup*>(parent)->addChild(child_node);
|
||||
|
@@ -144,7 +144,7 @@ namespace Opm
|
||||
return tot_rate;
|
||||
}
|
||||
default:
|
||||
THROW("No rate associated with production control mode" << mode);
|
||||
OPM_THROW(std::runtime_error, "No rate associated with production control mode" << mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace Opm
|
||||
rates = res_rates;
|
||||
break;
|
||||
default:
|
||||
THROW("No rate associated with injection control mode" << mode);
|
||||
OPM_THROW(std::runtime_error, "No rate associated with injection control mode" << mode);
|
||||
}
|
||||
double tot_rate = 0.0;
|
||||
for (int phase = 0; phase < phaseUsage().num_phases; ++phase) {
|
||||
@@ -191,10 +191,10 @@ namespace Opm
|
||||
target = prodSpec().liquid_max_rate_;
|
||||
break;
|
||||
case ProductionSpecification::GRUP:
|
||||
THROW("Can't query target production rate for GRUP control keyword");
|
||||
OPM_THROW(std::runtime_error, "Can't query target production rate for GRUP control keyword");
|
||||
break;
|
||||
default:
|
||||
THROW("Unsupported control mode to query target " << mode);
|
||||
OPM_THROW(std::runtime_error, "Unsupported control mode to query target " << mode);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -212,10 +212,10 @@ namespace Opm
|
||||
target = injSpec().reservoir_flow_max_rate_;
|
||||
break;
|
||||
case InjectionSpecification::GRUP:
|
||||
THROW("Can't query target production rate for GRUP control keyword");
|
||||
OPM_THROW(std::runtime_error, "Can't query target production rate for GRUP control keyword");
|
||||
break;
|
||||
default:
|
||||
THROW("Unsupported control mode to query target " << mode);
|
||||
OPM_THROW(std::runtime_error, "Unsupported control mode to query target " << mode);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ namespace Opm
|
||||
{
|
||||
const double my_guide_rate = productionGuideRate(true);
|
||||
if (my_guide_rate == 0) {
|
||||
THROW("Can't apply group control for group " << name() << " as the sum of guide rates for all group controlled wells is zero.");
|
||||
OPM_THROW(std::runtime_error, "Can't apply group control for group " << name() << " as the sum of guide rates for all group controlled wells is zero.");
|
||||
}
|
||||
for (size_t i = 0; i < children_.size(); ++i ) {
|
||||
// Apply for all children.
|
||||
@@ -470,7 +470,7 @@ namespace Opm
|
||||
}
|
||||
break;
|
||||
default:
|
||||
THROW("Unhandled group production control type " << prod_mode);
|
||||
OPM_THROW(std::runtime_error, "Unhandled group production control type " << prod_mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ namespace Opm
|
||||
}
|
||||
return;
|
||||
default:
|
||||
THROW("Unhandled group injection control mode " << inj_mode);
|
||||
OPM_THROW(std::runtime_error, "Unhandled group injection control mode " << inj_mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -802,7 +802,7 @@ namespace Opm
|
||||
wct = RESERVOIR_RATE;
|
||||
break;
|
||||
default:
|
||||
THROW("Group injection control mode not handled: " << control_mode);
|
||||
OPM_THROW(std::runtime_error, "Group injection control mode not handled: " << control_mode);
|
||||
}
|
||||
|
||||
if (group_control_index_ < 0) {
|
||||
@@ -879,21 +879,21 @@ namespace Opm
|
||||
case ProductionSpecification::ORAT:
|
||||
wct = SURFACE_RATE;
|
||||
if (!phase_used[BlackoilPhases::Liquid]) {
|
||||
THROW("Oil phase not active and ORAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Oil phase not active and ORAT control specified.");
|
||||
}
|
||||
distr[phase_pos[BlackoilPhases::Liquid]] = 1.0;
|
||||
break;
|
||||
case ProductionSpecification::WRAT:
|
||||
wct = SURFACE_RATE;
|
||||
if (!phase_used[BlackoilPhases::Aqua]) {
|
||||
THROW("Water phase not active and WRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Water phase not active and WRAT control specified.");
|
||||
}
|
||||
distr[phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
||||
break;
|
||||
case ProductionSpecification::GRAT:
|
||||
wct = SURFACE_RATE;
|
||||
if (!phase_used[BlackoilPhases::Vapour]) {
|
||||
THROW("Gas phase not active and GRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Gas phase not active and GRAT control specified.");
|
||||
}
|
||||
distr[phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||
break;
|
||||
@@ -901,10 +901,10 @@ namespace Opm
|
||||
std::cout << "applying rate" << std::endl;
|
||||
wct = SURFACE_RATE;
|
||||
if (!phase_used[BlackoilPhases::Liquid]) {
|
||||
THROW("Oil phase not active and LRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Oil phase not active and LRAT control specified.");
|
||||
}
|
||||
if (!phase_used[BlackoilPhases::Aqua]) {
|
||||
THROW("Water phase not active and LRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Water phase not active and LRAT control specified.");
|
||||
}
|
||||
distr[phase_pos[BlackoilPhases::Liquid]] = 1.0;
|
||||
distr[phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
||||
@@ -914,7 +914,7 @@ namespace Opm
|
||||
wct = RESERVOIR_RATE;
|
||||
break;
|
||||
default:
|
||||
THROW("Group production control mode not handled: " << control_mode);
|
||||
OPM_THROW(std::runtime_error, "Group production control mode not handled: " << control_mode);
|
||||
}
|
||||
|
||||
if (group_control_index_ < 0) {
|
||||
@@ -980,7 +980,7 @@ namespace Opm
|
||||
if (type[0] == 'G') {
|
||||
return InjectionSpecification::GAS;
|
||||
}
|
||||
THROW("Unknown type " << type << ", could not convert to SurfaceComponent");
|
||||
OPM_THROW(std::runtime_error, "Unknown type " << type << ", could not convert to SurfaceComponent");
|
||||
}
|
||||
|
||||
|
||||
@@ -1000,7 +1000,7 @@ namespace Opm
|
||||
HANDLE_ICM(VREP);
|
||||
HANDLE_ICM(GRUP);
|
||||
HANDLE_ICM(FLD);
|
||||
THROW("Unknown type " << type << ", could not convert to InjectionSpecification::ControlMode.");
|
||||
OPM_THROW(std::runtime_error, "Unknown type " << type << ", could not convert to InjectionSpecification::ControlMode.");
|
||||
}
|
||||
#undef HANDLE_ICM
|
||||
|
||||
@@ -1023,7 +1023,7 @@ namespace Opm
|
||||
HANDLE_PCM(THP);
|
||||
HANDLE_PCM(GRUP);
|
||||
HANDLE_PCM(FLD);
|
||||
THROW("Unknown type " << type << ", could not convert to ProductionSpecification::ControlMode.");
|
||||
OPM_THROW(std::runtime_error, "Unknown type " << type << ", could not convert to ProductionSpecification::ControlMode.");
|
||||
}
|
||||
#undef HANDLE_PCM
|
||||
|
||||
@@ -1040,7 +1040,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
|
||||
THROW("Unknown type " << type << ", could not convert to ControlMode.");
|
||||
OPM_THROW(std::runtime_error, "Unknown type " << type << ", could not convert to ControlMode.");
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
|
@@ -96,7 +96,7 @@ namespace
|
||||
return p->second;
|
||||
}
|
||||
else {
|
||||
THROW("Unknown well control mode = "
|
||||
OPM_THROW(std::runtime_error, "Unknown well control mode = "
|
||||
<< control << " in input file");
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ namespace
|
||||
return p->second;
|
||||
}
|
||||
else {
|
||||
THROW("Unknown well control mode = "
|
||||
OPM_THROW(std::runtime_error, "Unknown well control mode = "
|
||||
<< control << " in input file");
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ namespace Opm
|
||||
: w_(0)
|
||||
{
|
||||
if (grid.dimensions != 3) {
|
||||
THROW("We cannot initialize wells from a deck unless the corresponding grid is 3-dimensional.");
|
||||
OPM_THROW(std::runtime_error, "We cannot initialize wells from a deck unless the corresponding grid is 3-dimensional.");
|
||||
}
|
||||
// NOTE: Implementation copied and modified from dune-porsol's class BlackoilWells.
|
||||
std::vector<std::string> keywords;
|
||||
@@ -253,7 +253,7 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
if (!(deck.hasField("WCONINJE") || deck.hasField("WCONPROD")) ) {
|
||||
THROW("Needed field is missing in file");
|
||||
OPM_THROW(std::runtime_error, "Needed field is missing in file");
|
||||
}
|
||||
|
||||
// Obtain phase usage data.
|
||||
@@ -373,7 +373,7 @@ namespace Opm
|
||||
std::map<int, int>::const_iterator cgit =
|
||||
cartesian_to_compressed.find(cart_grid_indx);
|
||||
if (cgit == cartesian_to_compressed.end()) {
|
||||
THROW("Cell with i,j,k indices " << ix << ' ' << jy << ' '
|
||||
OPM_THROW(std::runtime_error, "Cell with i,j,k indices " << ix << ' ' << jy << ' '
|
||||
<< kz << " not found in grid (well = " << name << ')');
|
||||
}
|
||||
int cell = cgit->second;
|
||||
@@ -399,7 +399,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
THROW("Undefined well name: " << compdat.compdat[kw].well_
|
||||
OPM_THROW(std::runtime_error, "Undefined well name: " << compdat.compdat[kw].well_
|
||||
<< " in COMPDAT");
|
||||
}
|
||||
}
|
||||
@@ -424,7 +424,7 @@ namespace Opm
|
||||
// Create the well data structures.
|
||||
w_ = create_wells(pu.num_phases, num_wells, num_perfs);
|
||||
if (!w_) {
|
||||
THROW("Failed creating Wells struct.");
|
||||
OPM_THROW(std::runtime_error, "Failed creating Wells struct.");
|
||||
}
|
||||
|
||||
// Classify wells
|
||||
@@ -436,7 +436,7 @@ namespace Opm
|
||||
const int well_index = it->second;
|
||||
well_data[well_index].type = INJECTOR;
|
||||
} else {
|
||||
THROW("Unseen well name: " << lines[i].well_ << " first seen in WCONINJE");
|
||||
OPM_THROW(std::runtime_error, "Unseen well name: " << lines[i].well_ << " first seen in WCONINJE");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,7 +448,7 @@ namespace Opm
|
||||
const int well_index = it->second;
|
||||
well_data[well_index].type = PRODUCER;
|
||||
} else {
|
||||
THROW("Unseen well name: " << lines[i].well_ << " first seen in WCONPROD");
|
||||
OPM_THROW(std::runtime_error, "Unseen well name: " << lines[i].well_ << " first seen in WCONPROD");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -469,7 +469,7 @@ namespace Opm
|
||||
int ok = add_well(well_data[w].type, well_data[w].reference_bhp_depth, w_num_perf,
|
||||
comp_frac, &perf_cells[0], &perf_prodind[0], well_names[w].c_str(), w_);
|
||||
if (!ok) {
|
||||
THROW("Failed adding well " << well_names[w] << " to Wells data structure.");
|
||||
OPM_THROW(std::runtime_error, "Failed adding well " << well_names[w] << " to Wells data structure.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ namespace Opm
|
||||
well_found = true;
|
||||
ASSERT(well_data[wix].type == w_->type[wix]);
|
||||
if (well_data[wix].type != INJECTOR) {
|
||||
THROW("Found WCONINJE entry for a non-injector well: " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "Found WCONINJE entry for a non-injector well: " << well_names[wix]);
|
||||
}
|
||||
|
||||
// Add all controls that are present in well.
|
||||
@@ -514,7 +514,7 @@ namespace Opm
|
||||
} else if (wci_line.injector_type_ == "GAS") {
|
||||
distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||
} else {
|
||||
THROW("Injector type " << wci_line.injector_type_ << " not supported."
|
||||
OPM_THROW(std::runtime_error, "Injector type " << wci_line.injector_type_ << " not supported."
|
||||
"WellsManager only supports WATER, OIL and GAS injector types.");
|
||||
}
|
||||
ok = append_well_controls(SURFACE_RATE, wci_line.surface_flow_max_rate_,
|
||||
@@ -530,7 +530,7 @@ namespace Opm
|
||||
} else if (wci_line.injector_type_ == "GAS") {
|
||||
distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||
} else {
|
||||
THROW("Injector type " << wci_line.injector_type_ << " not supported."
|
||||
OPM_THROW(std::runtime_error, "Injector type " << wci_line.injector_type_ << " not supported."
|
||||
"WellsManager only supports WATER, OIL and GAS injector types.");
|
||||
}
|
||||
ok = append_well_controls(RESERVOIR_RATE, wci_line.reservoir_flow_max_rate_,
|
||||
@@ -542,15 +542,15 @@ namespace Opm
|
||||
NULL, wix, w_);
|
||||
}
|
||||
if (ok && wci_line.THP_limit_ > 0.0) {
|
||||
THROW("We cannot handle THP limit for well " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "We cannot handle THP limit for well " << well_names[wix]);
|
||||
}
|
||||
if (!ok) {
|
||||
THROW("Failure occured appending controls for well " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "Failure occured appending controls for well " << well_names[wix]);
|
||||
}
|
||||
InjectionControl::Mode mode = InjectionControl::mode(wci_line.control_mode_);
|
||||
int cpos = control_pos[mode];
|
||||
if (cpos == -1 && mode != InjectionControl::GRUP) {
|
||||
THROW("Control for " << wci_line.control_mode_ << " not specified in well " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "Control for " << wci_line.control_mode_ << " not specified in well " << well_names[wix]);
|
||||
}
|
||||
// We need to check if the well is shut or not
|
||||
if (wci_line.open_shut_flag_ == "SHUT") {
|
||||
@@ -562,17 +562,17 @@ namespace Opm
|
||||
double cf[3] = { 0.0, 0.0, 0.0 };
|
||||
if (wci_line.injector_type_[0] == 'W') {
|
||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
||||
THROW("Water phase not used, yet found water-injecting well.");
|
||||
OPM_THROW(std::runtime_error, "Water phase not used, yet found water-injecting well.");
|
||||
}
|
||||
cf[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
||||
} else if (wci_line.injector_type_[0] == 'O') {
|
||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
||||
THROW("Oil phase not used, yet found oil-injecting well.");
|
||||
OPM_THROW(std::runtime_error, "Oil phase not used, yet found oil-injecting well.");
|
||||
}
|
||||
cf[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0;
|
||||
} else if (wci_line.injector_type_[0] == 'G') {
|
||||
if (!pu.phase_used[BlackoilPhases::Vapour]) {
|
||||
THROW("Gas phase not used, yet found gas-injecting well.");
|
||||
OPM_THROW(std::runtime_error, "Gas phase not used, yet found gas-injecting well.");
|
||||
}
|
||||
cf[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||
}
|
||||
@@ -580,7 +580,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
if (!well_found) {
|
||||
THROW("Undefined well name: " << wci_line.well_
|
||||
OPM_THROW(std::runtime_error, "Undefined well name: " << wci_line.well_
|
||||
<< " in WCONINJE");
|
||||
}
|
||||
}
|
||||
@@ -606,7 +606,7 @@ namespace Opm
|
||||
well_found = true;
|
||||
ASSERT(well_data[wix].type == w_->type[wix]);
|
||||
if (well_data[wix].type != PRODUCER) {
|
||||
THROW("Found WCONPROD entry for a non-producer well: " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "Found WCONPROD entry for a non-producer well: " << well_names[wix]);
|
||||
}
|
||||
// Add all controls that are present in well.
|
||||
// First we must clear existing controls, in case the
|
||||
@@ -616,7 +616,7 @@ namespace Opm
|
||||
int ok = 1;
|
||||
if (ok && wcp_line.oil_max_rate_ >= 0.0) {
|
||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
||||
THROW("Oil phase not active and ORAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Oil phase not active and ORAT control specified.");
|
||||
}
|
||||
control_pos[ProductionControl::ORAT] = w_->ctrls[wix]->num;
|
||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||
@@ -626,7 +626,7 @@ namespace Opm
|
||||
}
|
||||
if (ok && wcp_line.water_max_rate_ >= 0.0) {
|
||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
||||
THROW("Water phase not active and WRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Water phase not active and WRAT control specified.");
|
||||
}
|
||||
control_pos[ProductionControl::WRAT] = w_->ctrls[wix]->num;
|
||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||
@@ -636,7 +636,7 @@ namespace Opm
|
||||
}
|
||||
if (ok && wcp_line.gas_max_rate_ >= 0.0) {
|
||||
if (!pu.phase_used[BlackoilPhases::Vapour]) {
|
||||
THROW("Gas phase not active and GRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Gas phase not active and GRAT control specified.");
|
||||
}
|
||||
control_pos[ProductionControl::GRAT] = w_->ctrls[wix]->num;
|
||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||
@@ -646,10 +646,10 @@ namespace Opm
|
||||
}
|
||||
if (ok && wcp_line.liquid_max_rate_ >= 0.0) {
|
||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
||||
THROW("Water phase not active and LRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Water phase not active and LRAT control specified.");
|
||||
}
|
||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
||||
THROW("Oil phase not active and LRAT control specified.");
|
||||
OPM_THROW(std::runtime_error, "Oil phase not active and LRAT control specified.");
|
||||
}
|
||||
control_pos[ProductionControl::LRAT] = w_->ctrls[wix]->num;
|
||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||
@@ -670,15 +670,15 @@ namespace Opm
|
||||
NULL, wix, w_);
|
||||
}
|
||||
if (ok && wcp_line.THP_limit_ > 0.0) {
|
||||
THROW("We cannot handle THP limit for well " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "We cannot handle THP limit for well " << well_names[wix]);
|
||||
}
|
||||
if (!ok) {
|
||||
THROW("Failure occured appending controls for well " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "Failure occured appending controls for well " << well_names[wix]);
|
||||
}
|
||||
ProductionControl::Mode mode = ProductionControl::mode(wcp_line.control_mode_);
|
||||
int cpos = control_pos[mode];
|
||||
if (cpos == -1 && mode != ProductionControl::GRUP) {
|
||||
THROW("Control mode type " << mode << " not present in well " << well_names[wix]);
|
||||
OPM_THROW(std::runtime_error, "Control mode type " << mode << " not present in well " << well_names[wix]);
|
||||
}
|
||||
// If it's shut, we complement the cpos
|
||||
if (wcp_line.open_shut_flag_ == "SHUT") {
|
||||
@@ -688,7 +688,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
if (!well_found) {
|
||||
THROW("Undefined well name: " << wcp_line.well_
|
||||
OPM_THROW(std::runtime_error, "Undefined well name: " << wcp_line.well_
|
||||
<< " in WCONPROD");
|
||||
}
|
||||
}
|
||||
@@ -696,7 +696,7 @@ namespace Opm
|
||||
|
||||
// Get WELTARG data
|
||||
if (deck.hasField("WELTARG")) {
|
||||
THROW("We currently do not handle WELTARG.");
|
||||
OPM_THROW(std::runtime_error, "We currently do not handle WELTARG.");
|
||||
/*
|
||||
const WELTARG& weltargs = deck.getWELTARG();
|
||||
const int num_weltargs = weltargs.weltarg.size();
|
||||
@@ -715,7 +715,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
if (!well_found) {
|
||||
THROW("Undefined well name: " << weltargs.weltarg[kw].well_
|
||||
OPM_THROW(std::runtime_error, "Undefined well name: " << weltargs.weltarg[kw].well_
|
||||
<< " in WELTARG");
|
||||
}
|
||||
}
|
||||
@@ -750,7 +750,7 @@ namespace Opm
|
||||
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.");
|
||||
OPM_THROW(std::runtime_error, "Trying to open/shut well with name: \"" << wellname<<"\" but it's not registered under WELSPECS.");
|
||||
}
|
||||
const int index = it->second;
|
||||
if (line.openshutflag_ == "SHUT") {
|
||||
@@ -766,7 +766,7 @@ namespace Opm
|
||||
}
|
||||
ASSERT(w_->ctrls[index]->current >= 0);
|
||||
} else {
|
||||
THROW("Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
|
||||
OPM_THROW(std::runtime_error, "Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,7 +803,7 @@ namespace Opm
|
||||
if (lines[i].phase_ == "OIL") {
|
||||
wellnode.prodSpec().guide_rate_type_ = ProductionSpecification::OIL;
|
||||
} else {
|
||||
THROW("Guide rate type " << lines[i].phase_ << " specified for producer "
|
||||
OPM_THROW(std::runtime_error, "Guide rate type " << lines[i].phase_ << " specified for producer "
|
||||
<< name << " in WGRUPCON, cannot handle.");
|
||||
}
|
||||
} else if (well_data[wix].type == INJECTOR) {
|
||||
@@ -811,11 +811,11 @@ namespace Opm
|
||||
if (lines[i].phase_ == "RAT") {
|
||||
wellnode.injSpec().guide_rate_type_ = InjectionSpecification::RAT;
|
||||
} else {
|
||||
THROW("Guide rate type " << lines[i].phase_ << " specified for injector "
|
||||
OPM_THROW(std::runtime_error, "Guide rate type " << lines[i].phase_ << " specified for injector "
|
||||
<< name << " in WGRUPCON, cannot handle.");
|
||||
}
|
||||
} else {
|
||||
THROW("Unknown well type " << well_data[wix].type << " for well " << name);
|
||||
OPM_THROW(std::runtime_error, "Unknown well type " << well_data[wix].type << " for well " << name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
} else if (deck.hasField("PVCDO")) {
|
||||
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_));
|
||||
} else {
|
||||
THROW("Input is missing PVDO or PVTO\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDO or PVTO\n");
|
||||
}
|
||||
}
|
||||
// Gas PVT
|
||||
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
||||
} else if (deck.hasField("PVTG")) {
|
||||
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_));
|
||||
} else {
|
||||
THROW("Input is missing PVDG or PVTG\n");
|
||||
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -406,7 +406,7 @@ int main ()
|
||||
well_conditions_met = well_collection.conditionsMet(well_state.bhp(), well_resflowrates_phase, well_surflowrates_phase);
|
||||
++well_iter;
|
||||
if (!well_conditions_met && well_iter == max_well_iterations) {
|
||||
THROW("Conditions not met within " << max_well_iterations<< " iterations.");
|
||||
OPM_THROW(std::runtime_error, "Conditions not met within " << max_well_iterations<< " iterations.");
|
||||
}
|
||||
}
|
||||
/// \internal[check well conditions]
|
||||
|
Reference in New Issue
Block a user