Replace THROW by OPM_THROW

This commit is contained in:
Andreas Lauser
2013-09-03 15:00:29 +02:00
parent 51cb4f2cb8
commit 8ee63106c5
13 changed files with 88 additions and 88 deletions

View File

@@ -177,7 +177,7 @@ try
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
std::string filename = output_dir + "/epoch_timing.param"; std::string filename = output_dir + "/epoch_timing.param";
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out); epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
@@ -230,7 +230,7 @@ try
simtimer.init(*deck); simtimer.init(*deck);
} else { } else {
if (epoch != 0) { 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); simtimer.init(param);
} }

View File

@@ -87,7 +87,7 @@ try
const std::string transport_solver_type const std::string transport_solver_type
= param.getDefault<std::string>("transport_solver_type", "ad"); = param.getDefault<std::string>("transport_solver_type", "ad");
if (transport_solver_type == "implicit") { if (transport_solver_type == "implicit") {
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, " "Either reconfigure opm-core with SuiteSparse/UMFPACK support and recompile, "
"or use the reordering solver (transport_solver_type=reorder)."); "or use the reordering solver (transport_solver_type=reorder).");
} }
@@ -196,7 +196,7 @@ try
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
std::string filename = output_dir + "/epoch_timing.param"; std::string filename = output_dir + "/epoch_timing.param";
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out); epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
@@ -249,7 +249,7 @@ try
simtimer.init(*deck); simtimer.init(*deck);
} else { } else {
if (epoch != 0) { 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); simtimer.init(param);
} }

View File

@@ -193,7 +193,7 @@ try
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
std::string filename = output_dir + "/epoch_timing.param"; std::string filename = output_dir + "/epoch_timing.param";
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out); epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
@@ -246,7 +246,7 @@ try
simtimer.init(*deck); simtimer.init(*deck);
} else { } else {
if (epoch != 0) { 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); simtimer.init(param);
} }

View File

@@ -74,7 +74,7 @@ try
double oildistr[2] = { 0.0, 1.0 }; double oildistr[2] = { 0.0, 1.0 };
ok = ok && append_well_controls(SURFACE_RATE, 1e-3, oildistr, 1, wells); ok = ok && append_well_controls(SURFACE_RATE, 1e-3, oildistr, 1, wells);
if (!ok) { if (!ok) {
THROW("Something went wrong with well init."); OPM_THROW(std::runtime_error, "Something went wrong with well init.");
} }
set_current_control(0, 0, wells); set_current_control(0, 0, wells);
set_current_control(1, 0, wells); set_current_control(1, 0, wells);

View File

@@ -65,7 +65,7 @@ namespace {
double oildistr[2] = { 0.0, 1.0 }; double oildistr[2] = { 0.0, 1.0 };
ok = ok && append_well_controls(SURFACE_RATE, 1e-3, oildistr, 1, wells.get()); ok = ok && append_well_controls(SURFACE_RATE, 1e-3, oildistr, 1, wells.get());
if (!ok) { if (!ok) {
THROW("Something went wrong with well init."); OPM_THROW(std::runtime_error, "Something went wrong with well init.");
} }
set_current_control(0, 0, wells.get()); set_current_control(0, 0, wells.get());
set_current_control(1, 0, wells.get()); set_current_control(1, 0, wells.get());

View File

@@ -107,7 +107,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Water]) { if (!pu_.phase_used[Water]) {
THROW("Cannot call muWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call muWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.size() == n); assert(pw.size() == n);
@@ -128,7 +128,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Oil]) { if (!pu_.phase_used[Oil]) {
THROW("Cannot call muOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -153,7 +153,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Gas]) { if (!pu_.phase_used[Gas]) {
THROW("Cannot call muGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call muGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.size() == n); assert(pg.size() == n);
@@ -175,7 +175,7 @@ namespace Opm
return ADB::constant(muWat(pw.value(), cells), pw.blockPattern()); return ADB::constant(muWat(pw.value(), cells), pw.blockPattern());
#else #else
if (!pu_.phase_used[Water]) { if (!pu_.phase_used[Water]) {
THROW("Cannot call muWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call muWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.value().size() == n); assert(pw.value().size() == n);
@@ -207,7 +207,7 @@ namespace Opm
return ADB::constant(muOil(po.value(), rs.value(), cells), po.blockPattern()); return ADB::constant(muOil(po.value(), rs.value(), cells), po.blockPattern());
#else #else
if (!pu_.phase_used[Oil]) { if (!pu_.phase_used[Oil]) {
THROW("Cannot call muOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.value().size() == n); assert(po.value().size() == n);
@@ -246,7 +246,7 @@ namespace Opm
return ADB::constant(muGas(pg.value(), cells), pg.blockPattern()); return ADB::constant(muGas(pg.value(), cells), pg.blockPattern());
#else #else
if (!pu_.phase_used[Gas]) { if (!pu_.phase_used[Gas]) {
THROW("Cannot call muGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call muGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.value().size() == n); assert(pg.value().size() == n);
@@ -291,7 +291,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Water]) { if (!pu_.phase_used[Water]) {
THROW("Cannot call bWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call bWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.size() == n); assert(pw.size() == n);
@@ -313,7 +313,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Oil]) { if (!pu_.phase_used[Oil]) {
THROW("Cannot call bOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call bOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -339,7 +339,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Gas]) { if (!pu_.phase_used[Gas]) {
THROW("Cannot call bGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call bGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.size() == n); assert(pg.size() == n);
@@ -359,7 +359,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Water]) { if (!pu_.phase_used[Water]) {
THROW("Cannot call muWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call muWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.value().size() == n); assert(pw.value().size() == n);
@@ -389,7 +389,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Oil]) { if (!pu_.phase_used[Oil]) {
THROW("Cannot call muOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.value().size() == n); assert(po.value().size() == n);
@@ -426,7 +426,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!pu_.phase_used[Gas]) { if (!pu_.phase_used[Gas]) {
THROW("Cannot call muGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call muGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.value().size() == n); assert(pg.value().size() == n);
@@ -456,7 +456,7 @@ namespace Opm
V BlackoilPropsAd::rsMax(const V& po, V BlackoilPropsAd::rsMax(const V& po,
const Cells& cells) const const Cells& cells) const
{ {
THROW("Method rsMax() not implemented."); OPM_THROW(std::runtime_error, "Method rsMax() not implemented.");
} }
/// Bubble point curve for Rs as function of oil pressure. /// Bubble point curve for Rs as function of oil pressure.
@@ -466,7 +466,7 @@ namespace Opm
ADB BlackoilPropsAd::rsMax(const ADB& po, ADB BlackoilPropsAd::rsMax(const ADB& po,
const Cells& cells) const const Cells& cells) const
{ {
THROW("Method rsMax() not implemented."); OPM_THROW(std::runtime_error, "Method rsMax() not implemented.");
} }
// ------ Relative permeability ------ // ------ Relative permeability ------
@@ -535,7 +535,7 @@ namespace Opm
assert(so.value().size() == n); assert(so.value().size() == n);
s_all.col(pu_.phase_pos[Oil]) = so.value(); s_all.col(pu_.phase_pos[Oil]) = so.value();
} else { } else {
THROW("BlackoilPropsAd::relperm() assumes oil phase is active."); OPM_THROW(std::runtime_error, "BlackoilPropsAd::relperm() assumes oil phase is active.");
} }
if (pu_.phase_used[Gas]) { if (pu_.phase_used[Gas]) {
assert(sg.value().size() == n); assert(sg.value().size() == n);

View File

@@ -69,7 +69,7 @@ namespace Opm
densities_[phase_usage_.phase_pos[Liquid]] = d[ECL_oil]; densities_[phase_usage_.phase_pos[Liquid]] = d[ECL_oil];
} }
} else { } else {
THROW("Input is missing DENSITY\n"); OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
} }
// Set the properties. // Set the properties.
@@ -97,7 +97,7 @@ namespace Opm
} else if (deck.hasField("PVCDO")) { } else if (deck.hasField("PVCDO")) {
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_)); props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(deck.getPVCDO().pvcdo_));
} else { } else {
THROW("Input is missing PVDO or PVTO\n"); OPM_THROW(std::runtime_error, "Input is missing PVDO or PVTO\n");
} }
} }
// Gas PVT // Gas PVT
@@ -111,7 +111,7 @@ namespace Opm
// } else if (deck.hasField("PVTG")) { // } else if (deck.hasField("PVTG")) {
// props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_)); // props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(deck.getPVTG().pvtg_));
} else { } else {
THROW("Input is missing PVDG or PVTG\n"); OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
} }
} }
@@ -121,7 +121,7 @@ namespace Opm
ptr->init(deck, grid, -1); ptr->init(deck, grid, -1);
if (phase_usage_.num_phases != satprops_->numPhases()) { if (phase_usage_.num_phases != satprops_->numPhases()) {
THROW("BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck() - " OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::BlackoilPropsAdFromDeck() - "
"Inconsistent number of phases in pvt data (" << phase_usage_.num_phases "Inconsistent number of phases in pvt data (" << phase_usage_.num_phases
<< ") and saturation-dependent function data (" << satprops_->numPhases() << ")."); << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
} }
@@ -195,7 +195,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Water]) { if (!phase_usage_.phase_used[Water]) {
THROW("Cannot call muWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call muWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.size() == n); assert(pw.size() == n);
@@ -219,7 +219,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Oil]) { if (!phase_usage_.phase_used[Oil]) {
THROW("Cannot call muOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -240,7 +240,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Gas]) { if (!phase_usage_.phase_used[Gas]) {
THROW("Cannot call muGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call muGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.size() == n); assert(pg.size() == n);
@@ -262,7 +262,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Water]) { if (!phase_usage_.phase_used[Water]) {
THROW("Cannot call muWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call muWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.size() == n); assert(pw.size() == n);
@@ -292,7 +292,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Oil]) { if (!phase_usage_.phase_used[Oil]) {
THROW("Cannot call muOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -321,7 +321,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Gas]) { if (!phase_usage_.phase_used[Gas]) {
THROW("Cannot call muGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call muGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.value().size() == n); assert(pg.value().size() == n);
@@ -368,7 +368,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Water]) { if (!phase_usage_.phase_used[Water]) {
THROW("Cannot call bWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call bWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.size() == n); assert(pw.size() == n);
@@ -394,7 +394,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Oil]) { if (!phase_usage_.phase_used[Oil]) {
THROW("Cannot call bOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call bOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -417,7 +417,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Gas]) { if (!phase_usage_.phase_used[Gas]) {
THROW("Cannot call bGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call bGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.size() == n); assert(pg.size() == n);
@@ -441,7 +441,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Water]) { if (!phase_usage_.phase_used[Water]) {
THROW("Cannot call muWat(): water phase not present."); OPM_THROW(std::runtime_error, "Cannot call muWat(): water phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pw.size() == n); assert(pw.size() == n);
@@ -473,7 +473,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Oil]) { if (!phase_usage_.phase_used[Oil]) {
THROW("Cannot call muOil(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call muOil(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -503,7 +503,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Gas]) { if (!phase_usage_.phase_used[Gas]) {
THROW("Cannot call muGas(): gas phase not present."); OPM_THROW(std::runtime_error, "Cannot call muGas(): gas phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(pg.size() == n); assert(pg.size() == n);
@@ -537,7 +537,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Oil]) { if (!phase_usage_.phase_used[Oil]) {
THROW("Cannot call rsMax(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call rsMax(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -555,7 +555,7 @@ namespace Opm
const Cells& cells) const const Cells& cells) const
{ {
if (!phase_usage_.phase_used[Oil]) { if (!phase_usage_.phase_used[Oil]) {
THROW("Cannot call rsMax(): oil phase not present."); OPM_THROW(std::runtime_error, "Cannot call rsMax(): oil phase not present.");
} }
const int n = cells.size(); const int n = cells.size();
assert(po.size() == n); assert(po.size() == n);
@@ -637,7 +637,7 @@ namespace Opm
assert(so.value().size() == n); assert(so.value().size() == n);
s_all.col(phase_usage_.phase_pos[Oil]) = so.value(); s_all.col(phase_usage_.phase_pos[Oil]) = so.value();
} else { } else {
THROW("BlackoilPropsAdFromDeck::relperm() assumes oil phase is active."); OPM_THROW(std::runtime_error, "BlackoilPropsAdFromDeck::relperm() assumes oil phase is active.");
} }
if (phase_usage_.phase_used[Gas]) { if (phase_usage_.phase_used[Gas]) {
assert(sg.value().size() == n); assert(sg.value().size() == n);

View File

@@ -258,7 +258,7 @@ namespace Opm {
if (resTooLarge) { if (resTooLarge) {
std::cerr << "Failed to compute converged solution in " << it << " iterations. Ignoring!\n"; std::cerr << "Failed to compute converged solution in " << it << " iterations. Ignoring!\n";
// THROW("Failed to compute converged solution in " << it << " iterations."); // OPM_THROW(std::runtime_error, "Failed to compute converged solution in " << it << " iterations.");
} }
} }
@@ -737,7 +737,7 @@ namespace Opm {
rate_distr.insert(w, phase*nw + w) = wc->distr[phase]; rate_distr.insert(w, phase*nw + w) = wc->distr[phase];
} }
} else { } else {
THROW("Can only handle BHP and SURFACE_RATE type controls."); OPM_THROW(std::runtime_error, "Can only handle BHP and SURFACE_RATE type controls.");
} }
} }
const ADB bhp_residual = bhp - bhp_targets; const ADB bhp_residual = bhp - bhp_targets;
@@ -774,7 +774,7 @@ namespace Opm {
matr.outerIndexPtr(), matr.innerIndexPtr(), matr.valuePtr(), matr.outerIndexPtr(), matr.innerIndexPtr(), matr.valuePtr(),
total_residual.value().data(), dx.data()); total_residual.value().data(), dx.data());
if (!rep.converged) { if (!rep.converged) {
THROW("ImpesTPFAAD::solve(): Linear solver convergence failure."); OPM_THROW(std::runtime_error, "ImpesTPFAAD::solve(): Linear solver convergence failure.");
} }
return dx; return dx;
} }
@@ -1059,7 +1059,7 @@ namespace Opm {
case Gas: case Gas:
return fluid_.muGas(p, cells); return fluid_.muGas(p, cells);
default: default:
THROW("Unknown phase index " << phase); OPM_THROW(std::runtime_error, "Unknown phase index " << phase);
} }
} }
@@ -1082,7 +1082,7 @@ namespace Opm {
case Gas: case Gas:
return fluid_.bGas(p, cells); return fluid_.bGas(p, cells);
default: default:
THROW("Unknown phase index " << phase); OPM_THROW(std::runtime_error, "Unknown phase index " << phase);
} }
} }

View File

@@ -209,7 +209,7 @@ namespace Opm {
} }
if (resTooLarge) { if (resTooLarge) {
THROW("Failed to compute converged pressure solution"); OPM_THROW(std::runtime_error, "Failed to compute converged pressure solution");
} }
else { else {
computeFluxes(state, well_state); computeFluxes(state, well_state);
@@ -382,7 +382,7 @@ namespace Opm {
rate_distr.insert(w, phase*nw + w) = wc->distr[phase]; rate_distr.insert(w, phase*nw + w) = wc->distr[phase];
} }
} else { } else {
THROW("Can only handle BHP and SURFACE_RATE type controls."); OPM_THROW(std::runtime_error, "Can only handle BHP and SURFACE_RATE type controls.");
} }
} }
const ADB bhp_residual = bhp - bhp_targets; const ADB bhp_residual = bhp - bhp_targets;
@@ -419,7 +419,7 @@ namespace Opm {
matr.outerIndexPtr(), matr.innerIndexPtr(), matr.valuePtr(), matr.outerIndexPtr(), matr.innerIndexPtr(), matr.valuePtr(),
total_residual_.value().data(), dx.data()); total_residual_.value().data(), dx.data());
if (!rep.converged) { if (!rep.converged) {
THROW("ImpesTPFAAD::solve(): Linear solver convergence failure."); OPM_THROW(std::runtime_error, "ImpesTPFAAD::solve(): Linear solver convergence failure.");
} }
const V p0 = Eigen::Map<const V>(&state.pressure()[0], nc, 1); const V p0 = Eigen::Map<const V>(&state.pressure()[0], nc, 1);
const V dp = subset(dx, Span(nc)); const V dp = subset(dx, Span(nc));
@@ -533,7 +533,7 @@ namespace Opm {
case Gas: case Gas:
return fluid_.muGas(p, cells); return fluid_.muGas(p, cells);
default: default:
THROW("Unknown phase index " << phase); OPM_THROW(std::runtime_error, "Unknown phase index " << phase);
} }
} }
@@ -553,7 +553,7 @@ namespace Opm {
case Gas: case Gas:
return fluid_.muGas(p, cells); return fluid_.muGas(p, cells);
default: default:
THROW("Unknown phase index " << phase); OPM_THROW(std::runtime_error, "Unknown phase index " << phase);
} }
} }
@@ -573,7 +573,7 @@ namespace Opm {
case Gas: case Gas:
return fluid_.bGas(p, cells); return fluid_.bGas(p, cells);
default: default:
THROW("Unknown phase index " << phase); OPM_THROW(std::runtime_error, "Unknown phase index " << phase);
} }
} }
@@ -593,7 +593,7 @@ namespace Opm {
case Gas: case Gas:
return fluid_.bGas(p, cells); return fluid_.bGas(p, cells);
default: default:
THROW("Unknown phase index " << phase); OPM_THROW(std::runtime_error, "Unknown phase index " << phase);
} }
} }

View File

@@ -154,12 +154,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { 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"; vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
std::ofstream vtkfile(vtkfilename.str().c_str()); std::ofstream vtkfile(vtkfilename.str().c_str());
if (!vtkfile) { if (!vtkfile) {
THROW("Failed to open " << vtkfilename.str()); OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
} }
Opm::DataMap dm; Opm::DataMap dm;
dm["saturation"] = &state.saturation(); dm["saturation"] = &state.saturation();
@@ -193,12 +193,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { if (!file) {
THROW("Failed to open " << fname.str()); OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
} }
file.precision(15); file.precision(15);
const std::vector<double>& d = *(it->second); const std::vector<double>& d = *(it->second);
@@ -214,7 +214,7 @@ namespace Opm
std::string fname = output_dir + "/watercut.txt"; std::string fname = output_dir + "/watercut.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
watercut.write(os); watercut.write(os);
} }
@@ -227,7 +227,7 @@ namespace Opm
std::string fname = output_dir + "/wellreport.txt"; std::string fname = output_dir + "/wellreport.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
wellreport.write(os); wellreport.write(os);
} }
@@ -274,7 +274,7 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
output_interval_ = param.getDefault("output_interval", 1); output_interval_ = param.getDefault("output_interval", 1);
} }
@@ -423,7 +423,7 @@ namespace Opm
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase); well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
++well_control_iteration; ++well_control_iteration;
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { 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) { if (!well_control_passed) {
std::cout << "Well controls not passed, solving again." << std::endl; std::cout << "Well controls not passed, solving again." << std::endl;

View File

@@ -150,12 +150,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { 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"; vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
std::ofstream vtkfile(vtkfilename.str().c_str()); std::ofstream vtkfile(vtkfilename.str().c_str());
if (!vtkfile) { if (!vtkfile) {
THROW("Failed to open " << vtkfilename.str()); OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
} }
Opm::DataMap dm; Opm::DataMap dm;
dm["saturation"] = &state.saturation(); dm["saturation"] = &state.saturation();
@@ -189,12 +189,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { if (!file) {
THROW("Failed to open " << fname.str()); OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
} }
file.precision(15); file.precision(15);
const std::vector<double>& d = *(it->second); const std::vector<double>& d = *(it->second);
@@ -211,7 +211,7 @@ namespace Opm
std::string fname = output_dir + "/watercut.txt"; std::string fname = output_dir + "/watercut.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
watercut.write(os); watercut.write(os);
} }
@@ -223,7 +223,7 @@ namespace Opm
std::string fname = output_dir + "/wellreport.txt"; std::string fname = output_dir + "/wellreport.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
wellreport.write(os); wellreport.write(os);
} }
@@ -266,7 +266,7 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
output_interval_ = param.getDefault("output_interval", 1); output_interval_ = param.getDefault("output_interval", 1);
} }
@@ -378,7 +378,7 @@ namespace Opm
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase); well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
++well_control_iteration; ++well_control_iteration;
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { 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) { if (!well_control_passed) {
std::cout << "Well controls not passed, solving again." << std::endl; std::cout << "Well controls not passed, solving again." << std::endl;

View File

@@ -178,12 +178,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { 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"; vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
std::ofstream vtkfile(vtkfilename.str().c_str()); std::ofstream vtkfile(vtkfilename.str().c_str());
if (!vtkfile) { if (!vtkfile) {
THROW("Failed to open " << vtkfilename.str()); OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
} }
Opm::DataMap dm; Opm::DataMap dm;
dm["saturation"] = &state.saturation(); dm["saturation"] = &state.saturation();
@@ -206,12 +206,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { 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")); std::copy(vec.begin(), vec.end(), std::ostream_iterator<double>(file, "\n"));
} }
@@ -237,12 +237,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { if (!file) {
THROW("Failed to open " << fname.str()); OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
} }
file.precision(15); file.precision(15);
const std::vector<double>& d = *(it->second); const std::vector<double>& d = *(it->second);
@@ -258,7 +258,7 @@ namespace Opm
std::string fname = output_dir + "/watercut.txt"; std::string fname = output_dir + "/watercut.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
watercut.write(os); watercut.write(os);
} }
@@ -271,7 +271,7 @@ namespace Opm
std::string fname = output_dir + "/wellreport.txt"; std::string fname = output_dir + "/wellreport.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
wellreport.write(os); wellreport.write(os);
} }
@@ -343,10 +343,10 @@ namespace Opm
} else if (transport_solver_type_ == "implicit") { } else if (transport_solver_type_ == "implicit") {
if (rock_comp_props && rock_comp_props->isActive()) { if (rock_comp_props && rock_comp_props->isActive()) {
THROW("The implicit transport solver cannot handle rock compressibility."); OPM_THROW(std::runtime_error, "The implicit transport solver cannot handle rock compressibility.");
} }
if (use_segregation_split_) { if (use_segregation_split_) {
THROW("The implicit transport solver is not set up to use segregation splitting."); OPM_THROW(std::runtime_error, "The implicit transport solver is not set up to use segregation splitting.");
} }
std::vector<double> porevol; std::vector<double> porevol;
computePorevolume(grid, props.porosity(), porevol); computePorevolume(grid, props.porosity(), porevol);
@@ -358,10 +358,10 @@ namespace Opm
param)); param));
} else if (transport_solver_type_ == "ad") { } else if (transport_solver_type_ == "ad") {
if (rock_comp_props && rock_comp_props->isActive()) { if (rock_comp_props && rock_comp_props->isActive()) {
THROW("The implicit ad transport solver cannot handle rock compressibility."); OPM_THROW(std::runtime_error, "The implicit ad transport solver cannot handle rock compressibility.");
} }
if (use_segregation_split_) { if (use_segregation_split_) {
THROW("The implicit ad transport solver is not set up to use segregation splitting."); OPM_THROW(std::runtime_error, "The implicit ad transport solver is not set up to use segregation splitting.");
} }
std::vector<double> porevol; std::vector<double> porevol;
computePorevolume(grid, props.porosity(), porevol); computePorevolume(grid, props.porosity(), porevol);
@@ -371,7 +371,7 @@ namespace Opm
gravity, gravity,
param)); param));
} else { } else {
THROW("Unknown transport solver type: " << transport_solver_type_); OPM_THROW(std::runtime_error, "Unknown transport solver type: " << transport_solver_type_);
} }
// For output. // For output.
@@ -385,7 +385,7 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
output_interval_ = param.getDefault("output_interval", 1); output_interval_ = param.getDefault("output_interval", 1);
} }
@@ -531,7 +531,7 @@ namespace Opm
well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase); well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
++well_control_iteration; ++well_control_iteration;
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { 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) { if (!well_control_passed) {
std::cout << "Well controls not passed, solving again." << std::endl; std::cout << "Well controls not passed, solving again." << std::endl;

View File

@@ -60,7 +60,7 @@ namespace Opm
gravity_ = gravity[grid_.dimensions - 1]; gravity_ = gravity[grid_.dimensions - 1];
for (int dd = 0; dd < grid_.dimensions - 1; ++dd) { for (int dd = 0; dd < grid_.dimensions - 1; ++dd) {
if (gravity[dd] != 0.0) { if (gravity[dd] != 0.0) {
THROW("TransportSolverTwophaseAd: can only handle gravity aligned with last dimension"); OPM_THROW(std::runtime_error, "TransportSolverTwophaseAd: can only handle gravity aligned with last dimension");
} }
} }
V htrans(grid.cell_facepos[grid.number_of_cells]); V htrans(grid.cell_facepos[grid.number_of_cells]);
@@ -235,7 +235,7 @@ namespace Opm
smatr.outerIndexPtr(), smatr.innerIndexPtr(), smatr.valuePtr(), smatr.outerIndexPtr(), smatr.innerIndexPtr(), smatr.valuePtr(),
transport_residual.value().data(), ds.data()); transport_residual.value().data(), ds.data());
if (!rep.converged) { if (!rep.converged) {
THROW("Linear solver convergence error in TransportSolverTwophaseAd::solve()"); OPM_THROW(std::runtime_error, "Linear solver convergence error in TransportSolverTwophaseAd::solve()");
} }
// Update (possible clamp) sw1. // Update (possible clamp) sw1.