mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 04:23:48 -06:00
Replace THROW by OPM_THROW
This commit is contained in:
parent
6a6d0c9b28
commit
7e8d941a6f
@ -226,7 +226,7 @@ try
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
@ -287,7 +287,7 @@ try
|
||||
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);
|
||||
}
|
||||
@ -304,7 +304,7 @@ try
|
||||
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
|
||||
if (use_wpolymer) {
|
||||
if (wells.c_wells() == 0) {
|
||||
THROW("Cannot control polymer injection via WPOLYMER without wells.");
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow.reset(new PolymerInflowFromDeck(*deck, *wells.c_wells(), props->numCells()));
|
||||
} else {
|
||||
|
@ -230,7 +230,7 @@ try
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
param.writeParam(output_dir + "/simulation.param");
|
||||
}
|
||||
@ -291,7 +291,7 @@ try
|
||||
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);
|
||||
}
|
||||
@ -308,7 +308,7 @@ try
|
||||
boost::scoped_ptr<PolymerInflowInterface> polymer_inflow;
|
||||
if (use_wpolymer) {
|
||||
if (wells.c_wells() == 0) {
|
||||
THROW("Cannot control polymer injection via WPOLYMER without wells.");
|
||||
OPM_THROW(std::runtime_error, "Cannot control polymer injection via WPOLYMER without wells.");
|
||||
}
|
||||
polymer_inflow.reset(new PolymerInflowFromDeck(*deck, *wells.c_wells(), props->numCells()));
|
||||
} else {
|
||||
|
@ -168,7 +168,7 @@ try
|
||||
} else if (method_string == "NewtonSimpleC") {
|
||||
method = Opm::TransportSolverTwophasePolymer::NewtonSimpleC;
|
||||
} else {
|
||||
THROW("Unknown method: " << method_string);
|
||||
OPM_THROW(std::runtime_error, "Unknown method: " << method_string);
|
||||
}
|
||||
Opm::TransportSolverTwophasePolymer reorder_model(*grid->c_grid(), *props, poly_props,
|
||||
method, nl_tolerance, nl_maxiter);
|
||||
@ -204,7 +204,7 @@ try
|
||||
}
|
||||
}
|
||||
if (face01 == -1) {
|
||||
THROW("Could not find face adjacent to cells [0 1]");
|
||||
OPM_THROW(std::runtime_error, "Could not find face adjacent to cells [0 1]");
|
||||
}
|
||||
state.faceflux()[face01] = src[0];
|
||||
for (int sats = 0; sats < num_sats; ++sats) {
|
||||
|
@ -217,7 +217,7 @@ namespace Opm
|
||||
++iter;
|
||||
}
|
||||
if (max_delta >= tol_) {
|
||||
THROW("Failed to converge!");
|
||||
OPM_THROW(std::runtime_error, "Failed to converge!");
|
||||
}
|
||||
// Finalize.
|
||||
// fmodel_.finishIteration(); //
|
||||
@ -328,7 +328,7 @@ namespace Opm
|
||||
std::cerr << "Failed column cells: ";
|
||||
std::copy(column_cells.begin(), column_cells.end(), std::ostream_iterator<int>(std::cerr, " "));
|
||||
std::cerr << "\n";
|
||||
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[2*column_cells[ci] + 0] = -rhs[2*ci + 0];
|
||||
|
@ -85,7 +85,7 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
if (wix == wells.number_of_wells) {
|
||||
THROW("Could not find a match for well " << wpl[i].well_ << " from WPOLYMER.");
|
||||
OPM_THROW(std::runtime_error, "Could not find a match for well " << wpl[i].well_ << " from WPOLYMER.");
|
||||
}
|
||||
for (int j = wells.well_connpos[wix]; j < wells.well_connpos[wix+1]; ++j) {
|
||||
const int perf_cell = wells.well_cells[j];
|
||||
|
@ -119,7 +119,7 @@ namespace Opm
|
||||
simpleAdsorptionBoth(c, c_ads, dc_ads_dc, if_with_der);
|
||||
}
|
||||
} else {
|
||||
THROW("Invalid Adsoption index");
|
||||
OPM_THROW(std::runtime_error, "Invalid Adsoption index");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,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);
|
||||
}
|
||||
@ -230,7 +230,7 @@ namespace Opm
|
||||
} else if (method_string == "Newton") {
|
||||
method = Opm::TransportSolverTwophaseCompressiblePolymer::Newton;
|
||||
} else {
|
||||
THROW("Unknown method: " << method_string);
|
||||
OPM_THROW(std::runtime_error, "Unknown method: " << method_string);
|
||||
}
|
||||
tsolver_.setPreferredMethod(method);
|
||||
num_transport_substeps_ = param.getDefault("num_transport_substeps", 1);
|
||||
@ -367,7 +367,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;
|
||||
@ -539,12 +539,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(5) << 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();
|
||||
@ -582,12 +582,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
fname << "/" << std::setw(5) << 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());
|
||||
}
|
||||
const std::vector<double>& d = *(it->second);
|
||||
std::copy(d.begin(), d.end(), std::ostream_iterator<double>(file, "\n"));
|
||||
@ -601,7 +601,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);
|
||||
}
|
||||
@ -614,7 +614,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);
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ namespace Opm
|
||||
output_binary_ = param.getDefault("output_binary", false);
|
||||
#ifndef HAVE_ERT
|
||||
if (output_binary_) {
|
||||
THROW("Cannot make binary output without ert library support. Reconfigure opm-core and opm-polymer with --with-ert and recompile.");
|
||||
OPM_THROW(std::runtime_error, "Cannot make binary output without ert library support. Reconfigure opm-core and opm-polymer with --with-ert and recompile.");
|
||||
}
|
||||
#endif
|
||||
output_dir_ = param.getDefault("output_dir", std::string("output"));
|
||||
@ -229,7 +229,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);
|
||||
}
|
||||
@ -246,7 +246,7 @@ namespace Opm
|
||||
} else if (method_string == "Newton") {
|
||||
method = Opm::TransportSolverTwophasePolymer::Newton;
|
||||
} else {
|
||||
THROW("Unknown method: " << method_string);
|
||||
OPM_THROW(std::runtime_error, "Unknown method: " << method_string);
|
||||
}
|
||||
tsolver_.setPreferredMethod(method);
|
||||
num_transport_substeps_ = param.getDefault("num_transport_substeps", 1);
|
||||
@ -388,7 +388,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;
|
||||
@ -551,12 +551,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(5) << 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();
|
||||
@ -592,12 +592,12 @@ namespace Opm
|
||||
create_directories(fpath);
|
||||
}
|
||||
catch (...) {
|
||||
THROW("Creating directories failed: " << fpath);
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
fname << "/" << std::setw(5) << 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());
|
||||
}
|
||||
const std::vector<double>& d = *(it->second);
|
||||
std::copy(d.begin(), d.end(), std::ostream_iterator<double>(file, "\n"));
|
||||
@ -622,7 +622,7 @@ namespace Opm
|
||||
writeECLData(grid, dm, simtimer.currentStepNum(), simtimer.currentTime(), simtimer.currentDateTime(),
|
||||
output_dir, "polymer_ecl");
|
||||
#else
|
||||
THROW("Cannot call outputStateBinary() without ert library support. Reconfigure with --with-ert and recompile.");
|
||||
OPM_THROW(std::runtime_error, "Cannot call outputStateBinary() without ert library support. Reconfigure with --with-ert and recompile.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -633,7 +633,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);
|
||||
}
|
||||
@ -646,7 +646,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);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ namespace Opm
|
||||
const int np = props.numPhases();
|
||||
const int num_cells = grid.number_of_cells;
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("Property object must have 2 phases");
|
||||
OPM_THROW(std::runtime_error, "Property object must have 2 phases");
|
||||
}
|
||||
visc_.resize(np*num_cells);
|
||||
A_.resize(np*np*num_cells);
|
||||
@ -243,7 +243,7 @@ namespace Opm
|
||||
|
||||
// Check immiscibility requirement (only done for first cell).
|
||||
if (A_[1] != 0.0 || A_[2] != 0.0) {
|
||||
THROW("TransportCompressibleSolverTwophaseCompressibleTwophase requires a property object without miscibility.");
|
||||
OPM_THROW(std::runtime_error, "TransportCompressibleSolverTwophaseCompressibleTwophase requires a property object without miscibility.");
|
||||
}
|
||||
std::vector<int> seq(grid_.number_of_cells);
|
||||
std::vector<int> comp(grid_.number_of_cells + 1);
|
||||
@ -635,7 +635,7 @@ namespace Opm
|
||||
solveSingleCellGradient(cell);
|
||||
break;
|
||||
default:
|
||||
THROW("Unknown method " << method_);
|
||||
OPM_THROW(std::runtime_error, "Unknown method " << method_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1021,11 +1021,11 @@ namespace Opm
|
||||
// << " in cell " << max_change_cell << std::endl;
|
||||
} while (((max_s_change > tol_) || (max_c_change > tol_)) && ++num_iters < maxit_);
|
||||
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);
|
||||
}
|
||||
if (max_c_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 c = " << max_c_change);
|
||||
}
|
||||
// std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||
@ -1356,7 +1356,7 @@ namespace Opm
|
||||
} while (max_sc_change > tol_ && ++num_iters < maxit_);
|
||||
|
||||
if (max_sc_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_sc_change);
|
||||
}
|
||||
return num_iters + 1;
|
||||
@ -1501,7 +1501,7 @@ namespace
|
||||
} else if (t1_exists) {
|
||||
t_out_ = t1;
|
||||
} else {
|
||||
THROW("Direction illegal: is a zero vector.");
|
||||
OPM_THROW(std::runtime_error, "Direction illegal: is a zero vector.");
|
||||
}
|
||||
x_out_[0] = x_[0] + t_out_*direction_[0];
|
||||
x_out_[1] = x_[1] + t_out_*direction_[1];
|
||||
|
@ -199,7 +199,7 @@ namespace Opm
|
||||
adhoc_safety_(1.1)
|
||||
{
|
||||
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();
|
||||
|
||||
@ -569,7 +569,7 @@ namespace Opm
|
||||
solveSingleCellNewtonSimple(cell,false);
|
||||
break;
|
||||
default:
|
||||
THROW("Unknown method " << method_);
|
||||
OPM_THROW(std::runtime_error, "Unknown method " << method_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -943,7 +943,7 @@ namespace Opm
|
||||
}
|
||||
det = dFx_dx*dFy_dy - dFy_dx*dFx_dy;
|
||||
if(det==0){
|
||||
THROW("det is zero");
|
||||
OPM_THROW(std::runtime_error, "det is zero");
|
||||
}
|
||||
|
||||
double alpha=1;
|
||||
@ -1056,11 +1056,11 @@ namespace Opm
|
||||
// << " in cell " << max_change_cell << std::endl;
|
||||
} while (((max_s_change > tol_) || (max_c_change > tol_)) && ++num_iters < maxit_);
|
||||
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);
|
||||
}
|
||||
if (max_c_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 c = " << max_c_change);
|
||||
}
|
||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||
@ -1365,7 +1365,7 @@ namespace Opm
|
||||
} while (max_sc_change > tol_ && ++num_iters < maxit_);
|
||||
|
||||
if (max_sc_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_sc_change);
|
||||
}
|
||||
return num_iters + 1;
|
||||
@ -1501,7 +1501,7 @@ namespace
|
||||
} else if (t1_exists) {
|
||||
t_out_ = t1;
|
||||
} else {
|
||||
THROW("Direction illegal: is a zero vector.");
|
||||
OPM_THROW(std::runtime_error, "Direction illegal: is a zero vector.");
|
||||
}
|
||||
x_out_[0] = x_[0] + t_out_*direction_[0];
|
||||
x_out_[1] = x_[1] + t_out_*direction_[1];
|
||||
|
@ -110,7 +110,7 @@ namespace Opm
|
||||
int num_cells = cells.size();
|
||||
int num_phases = props.numPhases();
|
||||
if (num_phases != 2) {
|
||||
THROW("computeFractionalFlow() assumes 2 phases.");
|
||||
OPM_THROW(std::runtime_error, "computeFractionalFlow() assumes 2 phases.");
|
||||
}
|
||||
fractional_flows.resize(num_cells*num_phases);
|
||||
assert(int(s.size()) == num_cells*num_phases);
|
||||
@ -150,7 +150,7 @@ namespace Opm
|
||||
int num_cells = cells.size();
|
||||
int num_phases = props.numPhases();
|
||||
if (num_phases != 2) {
|
||||
THROW("computeFractionalFlow() assumes 2 phases.");
|
||||
OPM_THROW(std::runtime_error, "computeFractionalFlow() assumes 2 phases.");
|
||||
}
|
||||
fractional_flows.resize(num_cells*num_phases);
|
||||
assert(int(s.size()) == num_cells*num_phases);
|
||||
@ -201,11 +201,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>& s = state.saturation();
|
||||
const std::vector<double>& c = state.concentration();
|
||||
@ -269,11 +269,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();
|
||||
@ -344,7 +344,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 polymass = 0.0;
|
||||
for (int cell = 0; cell < num_cells; ++cell) {
|
||||
|
Loading…
Reference in New Issue
Block a user