Merge pull request #352 from andlaus/refactor_exception_classes
Refactor exception handling code
This commit is contained in:
@@ -96,7 +96,7 @@ int main(int argc, char** argv)
|
|||||||
const int np = props.numPhases();
|
const int np = props.numPhases();
|
||||||
const int max_np = 3;
|
const int max_np = 3;
|
||||||
if (np > max_np) {
|
if (np > max_np) {
|
||||||
THROW("Max #phases is 3.");
|
OPM_THROW(std::runtime_error, "Max #phases is 3.");
|
||||||
}
|
}
|
||||||
while((inos.good()) && (!inos.eof())){
|
while((inos.good()) && (!inos.eof())){
|
||||||
double p[n];
|
double p[n];
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ int main(int argc, char** argv)
|
|||||||
const int np = props.numPhases();
|
const int np = props.numPhases();
|
||||||
const int max_np = 3;
|
const int max_np = 3;
|
||||||
if (np > max_np) {
|
if (np > max_np) {
|
||||||
THROW("Max #phases is 3.");
|
OPM_THROW(std::runtime_error, "Max #phases is 3.");
|
||||||
}
|
}
|
||||||
while((inos.good()) && (!inos.eof())){
|
while((inos.good()) && (!inos.eof())){
|
||||||
double s[max_np];
|
double s[max_np];
|
||||||
|
|||||||
@@ -23,14 +23,16 @@
|
|||||||
#include <opm/core/grid/GridManager.hpp>
|
#include <opm/core/grid/GridManager.hpp>
|
||||||
#include <opm/core/grid/cart_grid.h>
|
#include <opm/core/grid/cart_grid.h>
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <cstdio>
|
|
||||||
#include <memory>
|
|
||||||
#include <opm/core/props/IncompPropertiesBasic.hpp>
|
#include <opm/core/props/IncompPropertiesBasic.hpp>
|
||||||
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
#include <opm/core/props/IncompPropertiesFromDeck.hpp>
|
||||||
|
|
||||||
|
|
||||||
#include <ert/ecl/ecl_grid.h>
|
#include <ert/ecl/ecl_grid.h>
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <memory>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
// Test program for reading Eclipse Polymer keywords.
|
// Test program for reading Eclipse Polymer keywords.
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ namespace
|
|||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
@@ -210,7 +211,7 @@ main(int argc, char** argv)
|
|||||||
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);
|
||||||
@@ -297,3 +298,7 @@ main(int argc, char** argv)
|
|||||||
<< "\n Pressure time: " << ptime
|
<< "\n Pressure time: " << ptime
|
||||||
<< "\n Transport time: " << ttime << std::endl;
|
<< "\n Transport time: " << ttime << std::endl;
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ namespace
|
|||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ main(int argc, char** argv)
|
|||||||
std::istream_iterator<double> end;
|
std::istream_iterator<double> end;
|
||||||
porevol.assign(beg, end); // Now contains poro.
|
porevol.assign(beg, end); // Now contains poro.
|
||||||
if (int(porevol.size()) != grid.number_of_cells) {
|
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) {
|
for (int i = 0; i < grid.number_of_cells; ++i) {
|
||||||
porevol[i] *= grid.cell_volumes[i];
|
porevol[i] *= grid.cell_volumes[i];
|
||||||
@@ -105,7 +106,7 @@ main(int argc, char** argv)
|
|||||||
std::istream_iterator<double> end;
|
std::istream_iterator<double> end;
|
||||||
flux.assign(beg, end);
|
flux.assign(beg, end);
|
||||||
if (int(flux.size()) != grid.number_of_faces) {
|
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 +118,7 @@ main(int argc, char** argv)
|
|||||||
std::istream_iterator<double> end;
|
std::istream_iterator<double> end;
|
||||||
src.assign(beg, end);
|
src.assign(beg, end);
|
||||||
if (int(src.size()) != grid.number_of_cells) {
|
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 +162,7 @@ main(int argc, char** argv)
|
|||||||
create_directories(fpath);
|
create_directories(fpath);
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
THROW("Creating directories failed: " << fpath);
|
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||||
}
|
}
|
||||||
param.writeParam(output_dir + "/simulation.param");
|
param.writeParam(output_dir + "/simulation.param");
|
||||||
}
|
}
|
||||||
@@ -209,3 +210,7 @@ main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#include <ert/ecl/fortio.h>
|
#include <ert/ecl/fortio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Small utility to read through an ECLIPSE input deck and replace
|
Small utility to read through an ECLIPSE input deck and replace
|
||||||
occurences of (large) numerical fields like COORD and ZCORN with
|
occurences of (large) numerical fields like COORD and ZCORN with
|
||||||
@@ -248,11 +250,16 @@ static bool parseFile(const std::string& inputFile, std::string& outputFile, con
|
|||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (argc != 2)
|
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;
|
std::string outputFile;
|
||||||
parseFile(argv[1] , outputFile);
|
parseFile(argv[1] , outputFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ namespace
|
|||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
@@ -175,7 +176,7 @@ main(int argc, char** argv)
|
|||||||
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);
|
||||||
@@ -228,7 +229,7 @@ main(int argc, char** argv)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
@@ -282,3 +283,7 @@ main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ namespace
|
|||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
const bool use_reorder = param.getDefault("use_reorder", true);
|
const bool use_reorder = param.getDefault("use_reorder", true);
|
||||||
if (!use_reorder) {
|
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, "
|
"Either reconfigure opm-core with SuiteSparse/UMFPACK support and recompile, "
|
||||||
"or use the reordering solver (use_reorder=true).");
|
"or use the reordering solver (use_reorder=true).");
|
||||||
}
|
}
|
||||||
@@ -193,7 +194,7 @@ main(int argc, char** argv)
|
|||||||
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 +247,7 @@ main(int argc, char** argv)
|
|||||||
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);
|
||||||
}
|
}
|
||||||
@@ -300,3 +301,7 @@ main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace Opm::parameter;
|
using namespace Opm::parameter;
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
ParameterGroup parameters(argc, argv, false);
|
ParameterGroup parameters(argc, argv, false);
|
||||||
@@ -130,4 +130,7 @@ int main(int argc, char** argv)
|
|||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|||||||
@@ -125,10 +125,10 @@ namespace Opm
|
|||||||
: grid_(grid), cell_(cell), degree_(degree)
|
: grid_(grid), cell_(cell), degree_(degree)
|
||||||
{
|
{
|
||||||
if (grid.dimensions > 3) {
|
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) {
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ namespace Opm
|
|||||||
if (grid_.dimensions == 2) {
|
if (grid_.dimensions == 2) {
|
||||||
return 3*(grid_.cell_facepos[cell_ + 1] - grid_.cell_facepos[cell_]);
|
return 3*(grid_.cell_facepos[cell_ + 1] - grid_.cell_facepos[cell_]);
|
||||||
}
|
}
|
||||||
ASSERT(grid_.dimensions == 3);
|
assert(grid_.dimensions == 3);
|
||||||
int sumnodes = 0;
|
int sumnodes = 0;
|
||||||
for (int hf = grid_.cell_facepos[cell_]; hf < grid_.cell_facepos[cell_ + 1]; ++hf) {
|
for (int hf = grid_.cell_facepos[cell_]; hf < grid_.cell_facepos[cell_ + 1]; ++hf) {
|
||||||
const int face = grid_.cell_faces[hf];
|
const int face = grid_.cell_faces[hf];
|
||||||
@@ -181,7 +181,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ASSERT(dim == 3);
|
assert(dim == 3);
|
||||||
int tetindex = index / 4;
|
int tetindex = index / 4;
|
||||||
const int subindex = index % 4;
|
const int subindex = index % 4;
|
||||||
const double* nc = grid_.node_coordinates;
|
const double* nc = grid_.node_coordinates;
|
||||||
@@ -208,7 +208,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
THROW("Should never reach this point.");
|
OPM_THROW(std::runtime_error, "Should never reach this point.");
|
||||||
}
|
}
|
||||||
|
|
||||||
double quadPtWeight(const int index) const
|
double quadPtWeight(const int index) const
|
||||||
@@ -227,7 +227,7 @@ namespace Opm
|
|||||||
const double* nc1 = grid_.node_coordinates + dim*nptr[1];
|
const double* nc1 = grid_.node_coordinates + dim*nptr[1];
|
||||||
return triangleArea2d(nc0, nc1, cc)/3.0;
|
return triangleArea2d(nc0, nc1, cc)/3.0;
|
||||||
}
|
}
|
||||||
ASSERT(dim == 3);
|
assert(dim == 3);
|
||||||
int tetindex = index / 4;
|
int tetindex = index / 4;
|
||||||
const double* nc = grid_.node_coordinates;
|
const double* nc = grid_.node_coordinates;
|
||||||
for (int hf = grid_.cell_facepos[cell_]; hf < grid_.cell_facepos[cell_ + 1]; ++hf) {
|
for (int hf = grid_.cell_facepos[cell_]; hf < grid_.cell_facepos[cell_ + 1]; ++hf) {
|
||||||
@@ -246,7 +246,7 @@ namespace Opm
|
|||||||
const double* n1c = nc + dim*node1;
|
const double* n1c = nc + dim*node1;
|
||||||
return 0.25*tetVolume(cc, fc, n0c, n1c);
|
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:
|
private:
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ namespace Opm
|
|||||||
: grid_(grid), face_(face), degree_(degree)
|
: grid_(grid), face_(face), degree_(degree)
|
||||||
{
|
{
|
||||||
if (grid_.dimensions > 3) {
|
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) {
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,12 +120,12 @@ namespace Opm
|
|||||||
const int* fnodes = grid_.face_nodes + grid_.face_nodepos[face_];
|
const int* fnodes = grid_.face_nodes + grid_.face_nodepos[face_];
|
||||||
const double* nc = grid_.node_coordinates;
|
const double* nc = grid_.node_coordinates;
|
||||||
if (dim == 2) {
|
if (dim == 2) {
|
||||||
ASSERT(nn == 2);
|
assert(nn == 2);
|
||||||
const double* pa[3] = { nc + dim*fnodes[0], fc, nc + dim*fnodes[1] };
|
const double* pa[3] = { nc + dim*fnodes[0], fc, nc + dim*fnodes[1] };
|
||||||
std::copy(pa[index], pa[index] + dim, coord);
|
std::copy(pa[index], pa[index] + dim, coord);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ASSERT(dim == 3);
|
assert(dim == 3);
|
||||||
if (index < nn) {
|
if (index < nn) {
|
||||||
// Boundary edge midpoint.
|
// Boundary edge midpoint.
|
||||||
const int node0 = fnodes[index];
|
const int node0 = fnodes[index];
|
||||||
@@ -154,7 +154,7 @@ namespace Opm
|
|||||||
const double simpsonw[3] = { 1.0/6.0, 4.0/6.0, 1.0/6.0 };
|
const double simpsonw[3] = { 1.0/6.0, 4.0/6.0, 1.0/6.0 };
|
||||||
return grid_.face_areas[face_]*simpsonw[index];
|
return grid_.face_areas[face_]*simpsonw[index];
|
||||||
}
|
}
|
||||||
ASSERT(dim == 3);
|
assert(dim == 3);
|
||||||
const double* fc = grid_.face_centroids + dim*face_;
|
const double* fc = grid_.face_centroids + dim*face_;
|
||||||
const int nn = grid_.face_nodepos[face_ + 1] - grid_.face_nodepos[face_];
|
const int nn = grid_.face_nodepos[face_ + 1] - grid_.face_nodepos[face_];
|
||||||
const int* fnodes = grid_.face_nodes + grid_.face_nodepos[face_];
|
const int* fnodes = grid_.face_nodes + grid_.face_nodepos[face_];
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Opm
|
|||||||
} else if (deck.hasField("DXV") && deck.hasField("DYV") && deck.hasField("DZV")) {
|
} else if (deck.hasField("DXV") && deck.hasField("DYV") && deck.hasField("DZV")) {
|
||||||
initFromDeckTensorgrid(deck);
|
initFromDeckTensorgrid(deck);
|
||||||
} else {
|
} 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.");
|
"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);
|
ug_ = create_grid_cart2d(nx, ny, 1.0, 1.0);
|
||||||
if (!ug_) {
|
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);
|
ug_ = create_grid_cart2d(nx, ny, dx, dy);
|
||||||
if (!ug_) {
|
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);
|
ug_ = create_grid_cart3d(nx, ny, nz);
|
||||||
if (!ug_) {
|
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);
|
ug_ = create_grid_hexa3d(nx, ny, nz, dx, dy, dz);
|
||||||
if (!ug_) {
|
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());
|
ug_ = read_grid(input_filename.c_str());
|
||||||
if (!ug_) {
|
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.
|
// Process grid.
|
||||||
ug_ = create_grid_cornerpoint(&grdecl, 0.0);
|
ug_ = create_grid_cornerpoint(&grdecl, 0.0);
|
||||||
if (!ug_) {
|
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")) {
|
} else if (deck.hasField("SPECGRID")) {
|
||||||
dims = deck.getSPECGRID().dimensions;
|
dims = deck.getSPECGRID().dimensions;
|
||||||
} else {
|
} 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).
|
// 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.
|
// Check that number of cells given are consistent with DIMENS/SPECGRID.
|
||||||
if (dims[0] != int(dxv.size())) {
|
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())) {
|
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())) {
|
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.
|
// Extract top corner depths, if available.
|
||||||
@@ -203,7 +203,7 @@ namespace Opm
|
|||||||
if (deck.hasField("DEPTHZ")) {
|
if (deck.hasField("DEPTHZ")) {
|
||||||
const std::vector<double>& depthz = deck.getFloatingPointValue("DEPTHZ");
|
const std::vector<double>& depthz = deck.getFloatingPointValue("DEPTHZ");
|
||||||
if (depthz.size() != x.size()*y.size()) {
|
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];
|
top_depths = &depthz[0];
|
||||||
} else if (deck.hasField("TOPS")) {
|
} else if (deck.hasField("TOPS")) {
|
||||||
@@ -212,7 +212,7 @@ namespace Opm
|
|||||||
// varying TOPS (stair-stepping grid, or not).
|
// varying TOPS (stair-stepping grid, or not).
|
||||||
const std::vector<double>& tops = deck.getFloatingPointValue("TOPS");
|
const std::vector<double>& tops = deck.getFloatingPointValue("TOPS");
|
||||||
if (std::count(tops.begin(), tops.end(), tops[0]) != int(tops.size())) {
|
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_vec.resize(x.size()*y.size(), tops[0]);
|
||||||
top_depths = &top_depths_vec[0];
|
top_depths = &top_depths_vec[0];
|
||||||
@@ -222,7 +222,7 @@ namespace Opm
|
|||||||
ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(),
|
ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(),
|
||||||
&x[0], &y[0], &z[0], top_depths);
|
&x[0], &y[0], &z[0], top_depths);
|
||||||
if (!ug_) {
|
if (!ug_) {
|
||||||
THROW("Failed to construct grid.");
|
OPM_THROW(std::runtime_error, "Failed to construct grid.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ namespace Opm
|
|||||||
EclipseGridParser subparser()
|
EclipseGridParser subparser()
|
||||||
{
|
{
|
||||||
if (parser_.hasField("FIELD") || parser_.hasField("LAB") || parser_.hasField("PVT-M")) {
|
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;
|
EclipseGridParser sp;
|
||||||
|
|||||||
@@ -37,15 +37,16 @@
|
|||||||
#if HAVE_CONFIG_H
|
#if HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include <opm/core/io/eclipse/EclipseGridInspector.hpp>
|
||||||
|
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||||
|
#include <opm/core/io/eclipse/SpecialEclipseFields.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <opm/core/io/eclipse/EclipseGridInspector.hpp>
|
|
||||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
|
||||||
#include <opm/core/io/eclipse/SpecialEclipseFields.hpp>
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@@ -58,7 +59,7 @@ EclipseGridInspector::EclipseGridInspector(const EclipseGridParser& parser)
|
|||||||
keywords.push_back("ZCORN");
|
keywords.push_back("ZCORN");
|
||||||
|
|
||||||
if (!parser_.hasFields(keywords)) {
|
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")) {
|
if (parser_.hasField("SPECGRID")) {
|
||||||
@@ -72,7 +73,7 @@ EclipseGridInspector::EclipseGridInspector(const EclipseGridParser& parser)
|
|||||||
logical_gridsize_[1] = dim[1];
|
logical_gridsize_[1] = dim[1];
|
||||||
logical_gridsize_[2] = dim[2];
|
logical_gridsize_[2] = dim[2];
|
||||||
} else {
|
} 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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ void EclipseGridParser::readImpl(istream& is)
|
|||||||
tstep = dynamic_cast<TSTEP*>(sb_ptr.get());
|
tstep = dynamic_cast<TSTEP*>(sb_ptr.get());
|
||||||
sm["TSTEP"] = sb_ptr;
|
sm["TSTEP"] = sb_ptr;
|
||||||
}
|
}
|
||||||
ASSERT(tstep != 0);
|
assert(tstep != 0);
|
||||||
// Append new steps to current TSTEP object
|
// Append new steps to current TSTEP object
|
||||||
if (keyword == "TSTEP") {
|
if (keyword == "TSTEP") {
|
||||||
const int num_steps_old = tstep->tstep_.size();
|
const int num_steps_old = tstep->tstep_.size();
|
||||||
@@ -436,7 +436,7 @@ void EclipseGridParser::readImpl(istream& is)
|
|||||||
current_time_days_ = double(since_start.days());
|
current_time_days_ = double(since_start.days());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
THROW("Keyword " << keyword << " cannot be handled here.");
|
OPM_THROW(std::runtime_error, "Keyword " << keyword << " cannot be handled here.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -448,7 +448,7 @@ void EclipseGridParser::readImpl(istream& is)
|
|||||||
current_reading_mode_ = Regular;
|
current_reading_mode_ = Regular;
|
||||||
special_field_by_epoch_.push_back(SpecialMap());
|
special_field_by_epoch_.push_back(SpecialMap());
|
||||||
++current_epoch_;
|
++current_epoch_;
|
||||||
ASSERT(int(special_field_by_epoch_.size()) == current_epoch_ + 1);
|
assert(int(special_field_by_epoch_.size()) == current_epoch_ + 1);
|
||||||
// Add clones of all existing special fields to new map.
|
// Add clones of all existing special fields to new map.
|
||||||
SpecialMap& oldmap = special_field_by_epoch_[current_epoch_ - 1];
|
SpecialMap& oldmap = special_field_by_epoch_[current_epoch_ - 1];
|
||||||
SpecialMap& newmap = special_field_by_epoch_[current_epoch_];
|
SpecialMap& newmap = special_field_by_epoch_[current_epoch_];
|
||||||
@@ -457,7 +457,7 @@ void EclipseGridParser::readImpl(istream& is)
|
|||||||
newmap[it->first] = cloneSpecialField(it->first, it->second);
|
newmap[it->first] = cloneSpecialField(it->first, it->second);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
//ASSERT(newmap.count("TSTEP") == 0);
|
//assert(newmap.count("TSTEP") == 0);
|
||||||
}
|
}
|
||||||
// Check if the keyword already exists. If so, append. Otherwise, create new.
|
// Check if the keyword already exists. If so, append. Otherwise, create new.
|
||||||
SpecialMap::iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
|
SpecialMap::iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
|
||||||
@@ -468,7 +468,7 @@ void EclipseGridParser::readImpl(istream& is)
|
|||||||
if (sb_ptr) {
|
if (sb_ptr) {
|
||||||
special_field_by_epoch_[current_epoch_][keyword] = sb_ptr;
|
special_field_by_epoch_[current_epoch_][keyword] = sb_ptr;
|
||||||
} else {
|
} else {
|
||||||
THROW("Could not create field " << keyword);
|
OPM_THROW(std::runtime_error, "Could not create field " << keyword);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -496,7 +496,7 @@ void EclipseGridParser::readImpl(istream& is)
|
|||||||
}
|
}
|
||||||
ifstream include_is(include_filename.c_str());
|
ifstream include_is(include_filename.c_str());
|
||||||
if (!include_is) {
|
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);
|
readImpl(include_is);
|
||||||
// is >> ignoreSlashLine;
|
// is >> ignoreSlashLine;
|
||||||
@@ -569,10 +569,10 @@ void EclipseGridParser::convertToSI()
|
|||||||
} else if (key == "RS") {
|
} else if (key == "RS") {
|
||||||
unit = units_.gasvol_s / units_.liqvol_s;
|
unit = units_.gasvol_s / units_.liqvol_s;
|
||||||
} else if (key == "MAPAXES") {
|
} else if (key == "MAPAXES") {
|
||||||
MESSAGE("Not applying units to MAPAXES yet!");
|
OPM_MESSAGE("Not applying units to MAPAXES yet!");
|
||||||
unit = 1.0;
|
unit = 1.0;
|
||||||
} else {
|
} 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) {
|
if (do_convert) {
|
||||||
@@ -663,7 +663,7 @@ int EclipseGridParser::numberOfEpochs() const
|
|||||||
void EclipseGridParser::setCurrentEpoch(int epoch)
|
void EclipseGridParser::setCurrentEpoch(int epoch)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
ASSERT(epoch >= 0 && epoch < numberOfEpochs());
|
assert(epoch >= 0 && epoch < numberOfEpochs());
|
||||||
current_epoch_ = epoch;
|
current_epoch_ = epoch;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,7 +690,7 @@ const std::vector<int>& EclipseGridParser::getIntegerValue(const std::string& ke
|
|||||||
map<string, vector<int> >::const_iterator it
|
map<string, vector<int> >::const_iterator it
|
||||||
= integer_field_map_.find(keyword);
|
= integer_field_map_.find(keyword);
|
||||||
if (it == integer_field_map_.end()) {
|
if (it == integer_field_map_.end()) {
|
||||||
THROW("No such field: " << keyword);
|
OPM_THROW(std::runtime_error, "No such field: " << keyword);
|
||||||
} else {
|
} else {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
@@ -703,7 +703,7 @@ const std::vector<double>& EclipseGridParser::getFloatingPointValue(const std::s
|
|||||||
map<string, vector<double> >::const_iterator it
|
map<string, vector<double> >::const_iterator it
|
||||||
= floating_field_map_.find(keyword);
|
= floating_field_map_.find(keyword);
|
||||||
if (it == floating_field_map_.end()) {
|
if (it == floating_field_map_.end()) {
|
||||||
THROW("No such field: " << keyword);
|
OPM_THROW(std::runtime_error, "No such field: " << keyword);
|
||||||
} else {
|
} else {
|
||||||
return it->second;
|
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);
|
SpecialMap::const_iterator it = special_field_by_epoch_[current_epoch_].find(keyword);
|
||||||
if (it == special_field_by_epoch_[current_epoch_].end()) {
|
if (it == special_field_by_epoch_[current_epoch_].end()) {
|
||||||
THROW("No such field: " << keyword);
|
OPM_THROW(std::runtime_error, "No such field: " << keyword);
|
||||||
} else {
|
} else {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
@@ -826,13 +826,13 @@ void EclipseGridParser::computeUnits()
|
|||||||
units_.transmissibility = centi*Poise * stb / (day * psia);
|
units_.transmissibility = centi*Poise * stb / (day * psia);
|
||||||
break;
|
break;
|
||||||
case Lab:
|
case Lab:
|
||||||
THROW("Unhandled unit family " << unit_family);
|
OPM_THROW(std::runtime_error, "Unhandled unit family " << unit_family);
|
||||||
break;
|
break;
|
||||||
case Pvtm:
|
case Pvtm:
|
||||||
THROW("Unhandled unit family " << unit_family);
|
OPM_THROW(std::runtime_error, "Unhandled unit family " << unit_family);
|
||||||
break;
|
break;
|
||||||
default:
|
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")) {
|
} else if (hasField("SPECGRID")) {
|
||||||
dims = getSPECGRID().dimensions;
|
dims = getSPECGRID().dimensions;
|
||||||
} else {
|
} 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.
|
// 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>(filename); // Suppress "unused variable" warning.
|
||||||
static_cast<void>(num_cells); // Suppress "unused variable" warning.
|
static_cast<void>(num_cells); // Suppress "unused variable" warning.
|
||||||
static_cast<void>(global_cell); // 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
|
#endif
|
||||||
@@ -1123,7 +1123,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
|
|||||||
// Read file
|
// Read file
|
||||||
ecl_file_type * ecl_file = ecl_file_open(filename.c_str() , 0);
|
ecl_file_type * ecl_file = ecl_file_open(filename.c_str() , 0);
|
||||||
if (ecl_file == NULL) {
|
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);
|
const int num_kw = ecl_file_get_size(ecl_file);
|
||||||
std::vector<double> double_vec;
|
std::vector<double> double_vec;
|
||||||
@@ -1174,7 +1174,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
|
|||||||
ecl_file_close(ecl_file);
|
ecl_file_close(ecl_file);
|
||||||
#else
|
#else
|
||||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
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
|
#endif // HAVE_ERT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,13 +36,15 @@
|
|||||||
#ifndef OPM_ECLIPSEGRIDPARSERHELPERS_HEADER
|
#ifndef OPM_ECLIPSEGRIDPARSERHELPERS_HEADER
|
||||||
#define OPM_ECLIPSEGRIDPARSERHELPERS_HEADER
|
#define OPM_ECLIPSEGRIDPARSERHELPERS_HEADER
|
||||||
|
|
||||||
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
#include <opm/core/utility/linearInterpolation.hpp>
|
||||||
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <iostream>
|
||||||
#include <opm/core/utility/linearInterpolation.hpp>
|
|
||||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@@ -110,7 +112,7 @@ namespace
|
|||||||
char buffer[1000];
|
char buffer[1000];
|
||||||
is.getline(buffer, sizeof(buffer));
|
is.getline(buffer, sizeof(buffer));
|
||||||
std::cout << buffer<<std::endl;
|
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 {
|
} else {
|
||||||
if (is.peek() == int('*')) {
|
if (is.peek() == int('*')) {
|
||||||
@@ -124,7 +126,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is) {
|
if (!is) {
|
||||||
THROW("Encountered error while reading data values.");
|
OPM_THROW(std::runtime_error, "Encountered error while reading data values.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +138,7 @@ namespace
|
|||||||
template<class Vec>
|
template<class Vec>
|
||||||
inline int readDefaultedVectorData(std::istream& is, Vec& data, int max_values)
|
inline int readDefaultedVectorData(std::istream& is, Vec& data, int max_values)
|
||||||
{
|
{
|
||||||
ASSERT(int(data.size()) >= max_values);
|
assert(int(data.size()) >= max_values);
|
||||||
const std::ctype<char>& ct = std::use_facet< std::ctype<char> >(std::locale::classic());
|
const std::ctype<char>& ct = std::use_facet< std::ctype<char> >(std::locale::classic());
|
||||||
int num_values = 0;
|
int num_values = 0;
|
||||||
while (is) {
|
while (is) {
|
||||||
@@ -152,7 +154,7 @@ namespace
|
|||||||
} else if (dummy[0] == '-') { // "comment test"
|
} else if (dummy[0] == '-') { // "comment test"
|
||||||
is >> ignoreLine; // This line is a comment
|
is >> ignoreLine; // This line is a comment
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
if (is.peek() == int('*')) {
|
if (is.peek() == int('*')) {
|
||||||
@@ -177,7 +179,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is) {
|
if (!is) {
|
||||||
THROW("Encountered error while reading data values.");
|
OPM_THROW(std::runtime_error, "Encountered error while reading data values.");
|
||||||
}
|
}
|
||||||
return num_values;
|
return num_values;
|
||||||
}
|
}
|
||||||
@@ -203,12 +205,12 @@ namespace
|
|||||||
} else if (dummy[0] == '-') { // "comment test"
|
} else if (dummy[0] == '-') { // "comment test"
|
||||||
is >> ignoreLine; // This line is a comment
|
is >> ignoreLine; // This line is a comment
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
if (is.peek() == int('*')) {
|
if (is.peek() == int('*')) {
|
||||||
is.ignore(); // ignore the '*'
|
is.ignore(); // ignore the '*'
|
||||||
ASSERT(int(candidate) == 1);
|
assert(int(candidate) == 1);
|
||||||
data.push_back(-1); // Set new flag for interpolation.
|
data.push_back(-1); // Set new flag for interpolation.
|
||||||
} else {
|
} else {
|
||||||
data.push_back(candidate);
|
data.push_back(candidate);
|
||||||
@@ -216,7 +218,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is) {
|
if (!is) {
|
||||||
THROW("Encountered error while reading data values.");
|
OPM_THROW(std::runtime_error, "Encountered error while reading data values.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +318,7 @@ namespace
|
|||||||
// the last table, and emptied it. If not,
|
// the last table, and emptied it. If not,
|
||||||
// we have an error.
|
// we have an error.
|
||||||
if (!table.empty()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
@@ -339,7 +341,7 @@ namespace
|
|||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Error reading " << field_name
|
oss << "Error reading " << field_name
|
||||||
<< ". Next character is " << (char)is.peek();
|
<< ". Next character is " << (char)is.peek();
|
||||||
THROW(oss.str());
|
OPM_THROW(std::runtime_error, oss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,7 +374,7 @@ namespace
|
|||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Error reading " << field_name
|
oss << "Error reading " << field_name
|
||||||
<< ". Next character is " << (char)is.peek();
|
<< ". Next character is " << (char)is.peek();
|
||||||
THROW(oss.str());
|
OPM_THROW(std::runtime_error, oss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +452,7 @@ namespace
|
|||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Error reading " << field_name
|
oss << "Error reading " << field_name
|
||||||
<< ". Next character is " << (char)is.peek();
|
<< ". Next character is " << (char)is.peek();
|
||||||
THROW(oss.str());
|
OPM_THROW(std::runtime_error, oss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,13 +37,15 @@
|
|||||||
#ifndef OPM_SPECIALECLIPSEFIELDS_HEADER
|
#ifndef OPM_SPECIALECLIPSEFIELDS_HEADER
|
||||||
#define OPM_SPECIALECLIPSEFIELDS_HEADER
|
#define OPM_SPECIALECLIPSEFIELDS_HEADER
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <fstream>
|
|
||||||
#include <limits>
|
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/io/eclipse/EclipseGridParserHelpers.hpp>
|
#include <opm/core/io/eclipse/EclipseGridParserHelpers.hpp>
|
||||||
#include <opm/core/io/eclipse/EclipseUnits.hpp>
|
#include <opm/core/io/eclipse/EclipseUnits.hpp>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -55,7 +57,7 @@ struct SpecialBase {
|
|||||||
//virtual void write(std::ostream& os) const = 0; // Writes data
|
//virtual void write(std::ostream& os) const = 0; // Writes data
|
||||||
virtual void convertToSI(const EclipseUnits&)
|
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;
|
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
||||||
};
|
};
|
||||||
@@ -102,7 +104,7 @@ struct SPECGRID : public SpecialBase
|
|||||||
if (ignoreSlashLine(is)) {
|
if (ignoreSlashLine(is)) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
THROW("End of file reading" << name());
|
OPM_THROW(std::runtime_error, "End of file reading" << name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +164,7 @@ struct FAULTS : public SpecialBase
|
|||||||
fault_segment.fault_name = fltname;
|
fault_segment.fault_name = fltname;
|
||||||
int nread = readDefaultedVectorData(is, fault_segment.ijk_coord, 6);
|
int nread = readDefaultedVectorData(is, fault_segment.ijk_coord, 6);
|
||||||
if (nread != 6) {
|
if (nread != 6) {
|
||||||
THROW("Error reading fault_segment " << fltname);
|
OPM_THROW(std::runtime_error, "Error reading fault_segment " << fltname);
|
||||||
}
|
}
|
||||||
is >> fault_segment.face;
|
is >> fault_segment.face;
|
||||||
faults.push_back(fault_segment);
|
faults.push_back(fault_segment);
|
||||||
@@ -368,7 +370,7 @@ struct DENSITY : public SpecialBase
|
|||||||
if (action == 1) {
|
if (action == 1) {
|
||||||
return; // Alphabetic char. Read next keyword.
|
return; // Alphabetic char. Read next keyword.
|
||||||
} else if (action == 2) {
|
} 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());
|
<< (char)is.peek());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,7 +594,7 @@ struct PVTW : public SpecialBase
|
|||||||
if (action == 1) {
|
if (action == 1) {
|
||||||
return; // Alphabetic char. Read next keyword.
|
return; // Alphabetic char. Read next keyword.
|
||||||
} else if (action == 2) {
|
} 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());
|
<< (char)is.peek());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,7 +641,7 @@ struct ROCK : public SpecialBase
|
|||||||
if (action == 1) {
|
if (action == 1) {
|
||||||
return; // Alphabetic char. Read next keyword.
|
return; // Alphabetic char. Read next keyword.
|
||||||
} else if (action == 2) {
|
} 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());
|
<< (char)is.peek());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1653,7 +1655,7 @@ struct WELTARG : public SpecialBase
|
|||||||
weltarg[i].control_change_[0] == 'T') {
|
weltarg[i].control_change_[0] == 'T') {
|
||||||
weltarg[i].new_value_ *= units.pressure;
|
weltarg[i].new_value_ *= units.pressure;
|
||||||
} else {
|
} else {
|
||||||
THROW("WELTARG. Unknown control or constraint "
|
OPM_THROW(std::runtime_error, "WELTARG. Unknown control or constraint "
|
||||||
<< weltarg[i].control_change_[0]);
|
<< weltarg[i].control_change_[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1841,7 +1843,7 @@ struct PVCDO : public SpecialBase
|
|||||||
if (action == 1) {
|
if (action == 1) {
|
||||||
return; // Alphabetic char. Read next keyword.
|
return; // Alphabetic char. Read next keyword.
|
||||||
} else if (action == 2) {
|
} 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());
|
<< (char)is.peek());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2319,19 +2321,19 @@ struct ENPTVD : public SpecialBase {
|
|||||||
is >> ignoreLine;
|
is >> ignoreLine;
|
||||||
break;
|
break;
|
||||||
} else {
|
} 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);
|
std::vector<double> data(9,-1.0);
|
||||||
int nread = readDefaultedVectorData(is, data, 9);
|
int nread = readDefaultedVectorData(is, data, 9);
|
||||||
if (nread != 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) {
|
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)) {
|
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[0].push_back(data[0]); //depth
|
||||||
sub_table[1].push_back(data[1]); //swl
|
sub_table[1].push_back(data[1]); //swl
|
||||||
@@ -2350,7 +2352,7 @@ struct ENPTVD : public SpecialBase {
|
|||||||
++it_sub;
|
++it_sub;
|
||||||
}
|
}
|
||||||
} else {
|
} 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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2406,19 +2408,19 @@ struct ENKRVD : public SpecialBase {
|
|||||||
is >> ignoreLine;
|
is >> ignoreLine;
|
||||||
break;
|
break;
|
||||||
} else {
|
} 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);
|
std::vector<double> data(8,-1.0);
|
||||||
int nread = readDefaultedVectorData(is, data, 8);
|
int nread = readDefaultedVectorData(is, data, 8);
|
||||||
if (nread != 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) {
|
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)) {
|
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[0].push_back(data[0]); //depth
|
||||||
sub_table[1].push_back(data[1]); //krw
|
sub_table[1].push_back(data[1]); //krw
|
||||||
@@ -2437,7 +2439,7 @@ struct ENKRVD : public SpecialBase {
|
|||||||
++it_sub;
|
++it_sub;
|
||||||
}
|
}
|
||||||
} else {
|
} 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 ) {
|
int stride ) {
|
||||||
|
|
||||||
if (stride <= 0)
|
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())
|
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 );
|
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++)
|
for (int i=0; i < grid.number_of_cells; i++)
|
||||||
@@ -135,7 +135,7 @@ namespace Opm
|
|||||||
DataMap::const_iterator i = data.find("saturation");
|
DataMap::const_iterator i = data.find("saturation");
|
||||||
if (i != data.end()) {
|
if (i != data.end()) {
|
||||||
if (int(i->second->size()) != 2 * grid.number_of_cells) {
|
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_kw_type * swat_kw = ecl_kw_wrapper( grid , "SWAT" , i->second , 0 , 2);
|
||||||
ecl_rst_file_add_kw( rst_file , swat_kw );
|
ecl_rst_file_add_kw( rst_file , swat_kw );
|
||||||
@@ -162,7 +162,7 @@ namespace Opm
|
|||||||
const std::string&,
|
const std::string&,
|
||||||
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ namespace Opm
|
|||||||
int dimension = 3;
|
int dimension = 3;
|
||||||
int num_cells = dims[0]*dims[1]*dims[2];
|
int num_cells = dims[0]*dims[1]*dims[2];
|
||||||
|
|
||||||
ASSERT(dimension == 2 || dimension == 3);
|
assert(dimension == 2 || dimension == 3);
|
||||||
ASSERT(num_cells == dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2]));
|
assert(num_cells == dims[0]*dims[1]* (dimension == 2 ? 1 : dims[2]));
|
||||||
|
|
||||||
os << "# vtk DataFile Version 2.0\n";
|
os << "# vtk DataFile Version 2.0\n";
|
||||||
os << "Structured Grid\n \n";
|
os << "Structured Grid\n \n";
|
||||||
@@ -144,7 +144,7 @@ namespace Opm
|
|||||||
std::ostream& os)
|
std::ostream& os)
|
||||||
{
|
{
|
||||||
if (grid.dimensions != 3) {
|
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.precision(12);
|
||||||
os << "<?xml version=\"1.0\"?>\n";
|
os << "<?xml version=\"1.0\"?>\n";
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Opm
|
|||||||
#elif HAVE_DUNE_ISTL
|
#elif HAVE_DUNE_ISTL
|
||||||
solver_.reset(new LinearSolverIstl);
|
solver_.reset(new LinearSolverIstl);
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,11 +71,11 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
THROW("Linear solver " << ls << " is unknown.");
|
OPM_THROW(std::runtime_error, "Linear solver " << ls << " is unknown.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! solver_) {
|
if (! solver_) {
|
||||||
THROW("Linear solver " << ls << " is not enabled in "
|
OPM_THROW(std::runtime_error, "Linear solver " << ls << " is not enabled in "
|
||||||
"this configuration.");
|
"this configuration.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <dune/istl/paamg/kamg.hh>
|
#include <dune/istl/paamg/kamg.hh>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace Opm
|
|||||||
singular_(false)
|
singular_(false)
|
||||||
{
|
{
|
||||||
if (wells_ && (wells_->number_of_phases != props.numPhases())) {
|
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());
|
<< wells_->number_of_phases << " != " << props.numPhases());
|
||||||
}
|
}
|
||||||
const int num_dofs = grid.number_of_cells + (wells ? wells->number_of_wells : 0);
|
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_)) {
|
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;
|
std::cout << "Solved pressure in " << iter << " iterations." << std::endl;
|
||||||
@@ -488,7 +488,7 @@ namespace Opm
|
|||||||
// only inject pure fluids.
|
// only inject pure fluids.
|
||||||
props_.matrix(1, &perf_p, comp_frac, &c, wpA, NULL);
|
props_.matrix(1, &perf_p, comp_frac, &c, wpA, NULL);
|
||||||
props_.viscosity(1, &perf_p, comp_frac, &c, &mu[0], NULL);
|
props_.viscosity(1, &perf_p, comp_frac, &c, &mu[0], NULL);
|
||||||
ASSERT(std::fabs(std::accumulate(comp_frac, comp_frac + np, 0.0) - 1.0) < 1e-6);
|
assert(std::fabs(std::accumulate(comp_frac, comp_frac + np, 0.0) - 1.0) < 1e-6);
|
||||||
props_.relperm (1, comp_frac, &c, wpM , NULL);
|
props_.relperm (1, comp_frac, &c, wpM , NULL);
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
wpM[phase] /= mu[phase];
|
wpM[phase] /= mu[phase];
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
bc_ = flow_conditions_construct(0);
|
bc_ = flow_conditions_construct(0);
|
||||||
if (!bc_) {
|
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_);
|
int ok = flow_conditions_append(type, face, value, bc_);
|
||||||
if (!ok) {
|
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);
|
findSideFaces(grid, side, faces);
|
||||||
int ok = flow_conditions_append_multi(BC_PRESSURE, faces.size(), &faces[0], pressure, bc_);
|
int ok = flow_conditions_append_multi(BC_PRESSURE, faces.size(), &faces[0], pressure, bc_);
|
||||||
if (!ok) {
|
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;
|
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_);
|
int ok = flow_conditions_append(BC_FLUX_TOTVOL, faces[fi], face_flux, bc_);
|
||||||
if (!ok) {
|
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::Ymax: return "Ymax";
|
||||||
case FlowBCManager::Zmin: return "Zmin";
|
case FlowBCManager::Zmin: return "Zmin";
|
||||||
case FlowBCManager::Zmax: return "Zmax";
|
case FlowBCManager::Zmax: return "Zmax";
|
||||||
default: THROW("Unknown side tag " << s);
|
default: OPM_THROW(std::runtime_error, "Unknown side tag " << s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,9 +182,9 @@ namespace Opm
|
|||||||
ix /= dims[dim];
|
ix /= dims[dim];
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT2 (ix == 0,
|
// Make sure that lexicographic index is consistent with
|
||||||
"Lexicographic index is not consistent "
|
// grid dimensions.
|
||||||
"with grid dimensions.");
|
assert(ix == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -199,15 +199,15 @@ namespace Opm
|
|||||||
std::vector<int>& faces)
|
std::vector<int>& faces)
|
||||||
{
|
{
|
||||||
if (grid.cell_facetag == 0) {
|
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,
|
// make sure that grid has three dimensions or less.
|
||||||
"Grid must have three dimensions or less.");
|
assert(grid.dimensions <= 3);
|
||||||
|
|
||||||
ASSERT2 (side < 2 * grid.dimensions,
|
// Make sure boundary condition side is consistent with
|
||||||
"Boundary condition side not consistent with "
|
// number of physical grid dimensions.
|
||||||
"number of physical grid dimensions.");
|
assert(side < 2 * grid.dimensions);
|
||||||
|
|
||||||
// Get all boundary faces with the correct tag and with
|
// Get all boundary faces with the correct tag and with
|
||||||
// min/max i/j/k (depending on side).
|
// min/max i/j/k (depending on side).
|
||||||
@@ -227,7 +227,7 @@ namespace Opm
|
|||||||
// Face is on boundary.
|
// Face is on boundary.
|
||||||
faces.push_back(f);
|
faces.push_back(f);
|
||||||
} else {
|
} 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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
#include <opm/core/wells.h>
|
#include <opm/core/wells.h>
|
||||||
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -178,21 +179,21 @@ namespace Opm
|
|||||||
UnstructuredGrid* gg = const_cast<UnstructuredGrid*>(&grid_);
|
UnstructuredGrid* gg = const_cast<UnstructuredGrid*>(&grid_);
|
||||||
int ok = ifs_tpfa_assemble(gg, &forces_, &trans_[0], &gpress_omegaweighted_[0], h_);
|
int ok = ifs_tpfa_assemble(gg, &forces_, &trans_[0], &gpress_omegaweighted_[0], h_);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
THROW("Failed assembling pressure system.");
|
OPM_THROW(std::runtime_error, "Failed assembling pressure system.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Solve.
|
// Solve.
|
||||||
linsolver_.solve(h_->A, h_->b, h_->x);
|
linsolver_.solve(h_->A, h_->b, h_->x);
|
||||||
|
|
||||||
// Obtain solution.
|
// Obtain solution.
|
||||||
ASSERT(int(state.pressure().size()) == grid_.number_of_cells);
|
assert(int(state.pressure().size()) == grid_.number_of_cells);
|
||||||
ASSERT(int(state.faceflux().size()) == grid_.number_of_faces);
|
assert(int(state.faceflux().size()) == grid_.number_of_faces);
|
||||||
ifs_tpfa_solution soln = { NULL, NULL, NULL, NULL };
|
ifs_tpfa_solution soln = { NULL, NULL, NULL, NULL };
|
||||||
soln.cell_press = &state.pressure()[0];
|
soln.cell_press = &state.pressure()[0];
|
||||||
soln.face_flux = &state.faceflux()[0];
|
soln.face_flux = &state.faceflux()[0];
|
||||||
if (wells_ != NULL) {
|
if (wells_ != NULL) {
|
||||||
ASSERT(int(well_state.bhp().size()) == wells_->number_of_wells);
|
assert(int(well_state.bhp().size()) == wells_->number_of_wells);
|
||||||
ASSERT(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
|
assert(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
|
||||||
soln.well_flux = &well_state.perfRates()[0];
|
soln.well_flux = &well_state.perfRates()[0];
|
||||||
soln.well_press = &well_state.bhp()[0];
|
soln.well_press = &well_state.bhp()[0];
|
||||||
}
|
}
|
||||||
@@ -268,7 +269,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((iter == maxiter_) && (res_norm > residual_tol_) && (inc_norm > change_tol_)) {
|
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;
|
std::cout << "Solved pressure in " << iter << " iterations." << std::endl;
|
||||||
@@ -286,7 +287,7 @@ namespace Opm
|
|||||||
void IncompTpfa::computeStaticData()
|
void IncompTpfa::computeStaticData()
|
||||||
{
|
{
|
||||||
if (wells_ && (wells_->number_of_phases != props_.numPhases())) {
|
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());
|
<< wells_->number_of_phases << " != " << props_.numPhases());
|
||||||
}
|
}
|
||||||
const int num_dofs = grid_.number_of_cells + (wells_ ? wells_->number_of_wells : 0);
|
const int num_dofs = grid_.number_of_cells + (wells_ ? wells_->number_of_wells : 0);
|
||||||
@@ -405,7 +406,7 @@ namespace Opm
|
|||||||
&porevol_[0], &rock_comp_[0], dt, pressures,
|
&porevol_[0], &rock_comp_[0], dt, pressures,
|
||||||
&initial_porevol_[0], h_);
|
&initial_porevol_[0], h_);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
THROW("Failed assembling pressure system.");
|
OPM_THROW(std::runtime_error, "Failed assembling pressure system.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,8 +473,8 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
// Make sure h_->x contains the direct solution vector.
|
// Make sure h_->x contains the direct solution vector.
|
||||||
ASSERT(int(state.pressure().size()) == grid_.number_of_cells);
|
assert(int(state.pressure().size()) == grid_.number_of_cells);
|
||||||
ASSERT(int(state.faceflux().size()) == grid_.number_of_faces);
|
assert(int(state.faceflux().size()) == grid_.number_of_faces);
|
||||||
std::copy(state.pressure().begin(), state.pressure().end(), h_->x);
|
std::copy(state.pressure().begin(), state.pressure().end(), h_->x);
|
||||||
std::copy(well_state.bhp().begin(), well_state.bhp().end(), h_->x + grid_.number_of_cells);
|
std::copy(well_state.bhp().begin(), well_state.bhp().end(), h_->x + grid_.number_of_cells);
|
||||||
|
|
||||||
@@ -482,8 +483,8 @@ namespace Opm
|
|||||||
soln.cell_press = &state.pressure()[0];
|
soln.cell_press = &state.pressure()[0];
|
||||||
soln.face_flux = &state.faceflux()[0];
|
soln.face_flux = &state.faceflux()[0];
|
||||||
if (wells_ != NULL) {
|
if (wells_ != NULL) {
|
||||||
ASSERT(int(well_state.bhp().size()) == wells_->number_of_wells);
|
assert(int(well_state.bhp().size()) == wells_->number_of_wells);
|
||||||
ASSERT(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
|
assert(int(well_state.perfRates().size()) == wells_->well_connpos[ wells_->number_of_wells ]);
|
||||||
soln.well_flux = &well_state.perfRates()[0];
|
soln.well_flux = &well_state.perfRates()[0];
|
||||||
soln.well_press = &well_state.bhp()[0];
|
soln.well_press = &well_state.bhp()[0];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Opm
|
|||||||
pvt_.init(param);
|
pvt_.init(param);
|
||||||
satprops_.init(param);
|
satprops_.init(param);
|
||||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
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() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ namespace Opm
|
|||||||
double* dmudp) const
|
double* dmudp) const
|
||||||
{
|
{
|
||||||
if (dmudp) {
|
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 {
|
} else {
|
||||||
pvt_.mu(n, p, z, mu);
|
pvt_.mu(n, p, z, mu);
|
||||||
}
|
}
|
||||||
@@ -128,7 +128,7 @@ namespace Opm
|
|||||||
double* dAdp) const
|
double* dAdp) const
|
||||||
{
|
{
|
||||||
const int np = numPhases();
|
const int np = numPhases();
|
||||||
ASSERT(np <= 2);
|
assert(np <= 2);
|
||||||
double B[2]; // Must be enough since component classes do not handle more than 2.
|
double B[2]; // Must be enough since component classes do not handle more than 2.
|
||||||
pvt_.B(1, 0, 0, B);
|
pvt_.B(1, 0, 0, B);
|
||||||
// Compute A matrix
|
// Compute A matrix
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Opm
|
|||||||
ptr->init(deck, grid, 200);
|
ptr->init(deck, grid, 200);
|
||||||
|
|
||||||
if (pvt_.numPhases() != satprops_->numPhases()) {
|
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() << ").");
|
<< 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);
|
const int sat_samples = param.getDefault("sat_tab_size", 200);
|
||||||
std::string threephase_model = param.getDefault<std::string>("threephase_model", "simple");
|
std::string threephase_model = param.getDefault<std::string>("threephase_model", "simple");
|
||||||
if (deck.hasField("ENDSCALE") && 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 (sat_samples > 1) {
|
||||||
if (threephase_model == "stone2") {
|
if (threephase_model == "stone2") {
|
||||||
@@ -78,7 +78,7 @@ namespace Opm
|
|||||||
satprops_.reset(ptr);
|
satprops_.reset(ptr);
|
||||||
ptr->init(deck, grid, sat_samples);
|
ptr->init(deck, grid, sat_samples);
|
||||||
} else {
|
} else {
|
||||||
THROW("Unknown threephase_model: " << threephase_model);
|
OPM_THROW(std::runtime_error, "Unknown threephase_model: " << threephase_model);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (threephase_model == "stone2") {
|
if (threephase_model == "stone2") {
|
||||||
@@ -97,12 +97,12 @@ namespace Opm
|
|||||||
satprops_.reset(ptr);
|
satprops_.reset(ptr);
|
||||||
ptr->init(deck, grid, sat_samples);
|
ptr->init(deck, grid, sat_samples);
|
||||||
} else {
|
} else {
|
||||||
THROW("Unknown threephase_model: " << threephase_model);
|
OPM_THROW(std::runtime_error, "Unknown threephase_model: " << threephase_model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pvt_.numPhases() != satprops_->numPhases()) {
|
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() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +168,7 @@ namespace Opm
|
|||||||
double* dmudp) const
|
double* dmudp) const
|
||||||
{
|
{
|
||||||
if (dmudp) {
|
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 {
|
} else {
|
||||||
pvt_.mu(n, p, z, mu);
|
pvt_.mu(n, p, z, mu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Opm
|
|||||||
pvt_.init(param);
|
pvt_.init(param);
|
||||||
satprops_.init(param);
|
satprops_.init(param);
|
||||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
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() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||||
}
|
}
|
||||||
viscosity_.resize(pvt_.numPhases());
|
viscosity_.resize(pvt_.numPhases());
|
||||||
@@ -60,7 +60,7 @@ namespace Opm
|
|||||||
pvt_.init(num_phases, rho, mu);
|
pvt_.init(num_phases, rho, mu);
|
||||||
satprops_.init(num_phases, relpermfunc);
|
satprops_.init(num_phases, relpermfunc);
|
||||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
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() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||||
}
|
}
|
||||||
viscosity_.resize(pvt_.numPhases());
|
viscosity_.resize(pvt_.numPhases());
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Opm
|
|||||||
pvt_.init(deck);
|
pvt_.init(deck);
|
||||||
satprops_.init(deck, grid, 200);
|
satprops_.init(deck, grid, 200);
|
||||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
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() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ namespace Opm
|
|||||||
|
|
||||||
// Only 2 or 3 phase systems handled.
|
// Only 2 or 3 phase systems handled.
|
||||||
if (pu.num_phases < 2 || pu.num_phases > 3) {
|
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
|
// We need oil systems, since we do not support the keywords needed for
|
||||||
// water-gas systems.
|
// water-gas systems.
|
||||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
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;
|
return pu;
|
||||||
|
|||||||
@@ -63,7 +63,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.
|
||||||
@@ -90,7 +90,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
|
||||||
@@ -104,7 +104,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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
int num_phases = param.getDefault("num_phases", 2);
|
int num_phases = param.getDefault("num_phases", 2);
|
||||||
if (num_phases > 3 || num_phases < 1) {
|
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);
|
density_.resize(num_phases);
|
||||||
viscosity_.resize(num_phases);
|
viscosity_.resize(num_phases);
|
||||||
@@ -65,7 +65,7 @@ namespace Opm
|
|||||||
const std::vector<double>& visc)
|
const std::vector<double>& visc)
|
||||||
{
|
{
|
||||||
if (num_phases > 3 || num_phases < 1) {
|
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.
|
// We currently do not allow the user to set B.
|
||||||
formation_volume_factor_.clear();
|
formation_volume_factor_.clear();
|
||||||
@@ -98,7 +98,7 @@ namespace Opm
|
|||||||
pu.phase_pos[BlackoilPhases::Liquid] = 1;
|
pu.phase_pos[BlackoilPhases::Liquid] = 1;
|
||||||
pu.phase_pos[BlackoilPhases::Vapour] = 1; // Unused.
|
pu.phase_pos[BlackoilPhases::Vapour] = 1; // Unused.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(pu.num_phases == 3);
|
assert(pu.num_phases == 3);
|
||||||
pu.phase_used[BlackoilPhases::Aqua] = true;
|
pu.phase_used[BlackoilPhases::Aqua] = true;
|
||||||
pu.phase_used[BlackoilPhases::Liquid] = true;
|
pu.phase_used[BlackoilPhases::Liquid] = true;
|
||||||
pu.phase_used[BlackoilPhases::Vapour] = true;
|
pu.phase_used[BlackoilPhases::Vapour] = true;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Opm
|
|||||||
if (phase_usage.phase_used[PhaseUsage::Vapour] ||
|
if (phase_usage.phase_used[PhaseUsage::Vapour] ||
|
||||||
!phase_usage.phase_used[PhaseUsage::Aqua] ||
|
!phase_usage.phase_used[PhaseUsage::Aqua] ||
|
||||||
!phase_usage.phase_used[PhaseUsage::Liquid]) {
|
!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.
|
// 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::Aqua]] = d[ECL_water];
|
||||||
surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = d[ECL_oil];
|
surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = d[ECL_oil];
|
||||||
} else {
|
} 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.
|
// Make reservoir densities the same as surface densities initially.
|
||||||
@@ -66,26 +66,26 @@ namespace Opm
|
|||||||
if (deck.hasField("PVTW")) {
|
if (deck.hasField("PVTW")) {
|
||||||
const std::vector<double>& pvtw = deck.getPVTW().pvtw_[region_number];
|
const std::vector<double>& pvtw = deck.getPVTW().pvtw_[region_number];
|
||||||
if (pvtw[2] != 0.0 || pvtw[4] != 0.0) {
|
if (pvtw[2] != 0.0 || pvtw[4] != 0.0) {
|
||||||
MESSAGE("Compressibility effects in PVTW are ignored.");
|
OPM_MESSAGE("Compressibility effects in PVTW are ignored.");
|
||||||
}
|
}
|
||||||
reservoir_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] /= pvtw[1];
|
reservoir_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] /= pvtw[1];
|
||||||
viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = pvtw[3];
|
viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = pvtw[3];
|
||||||
} else {
|
} else {
|
||||||
// Eclipse 100 default.
|
// Eclipse 100 default.
|
||||||
// viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = 0.5*Opm::prefix::centi*Opm::unit::Poise;
|
// 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.
|
// Oil viscosity.
|
||||||
if (deck.hasField("PVCDO")) {
|
if (deck.hasField("PVCDO")) {
|
||||||
const std::vector<double>& pvcdo = deck.getPVCDO().pvcdo_[region_number];
|
const std::vector<double>& pvcdo = deck.getPVCDO().pvcdo_[region_number];
|
||||||
if (pvcdo[2] != 0.0 || pvcdo[4] != 0.0) {
|
if (pvcdo[2] != 0.0 || pvcdo[4] != 0.0) {
|
||||||
MESSAGE("Compressibility effects in PVCDO are ignored.");
|
OPM_MESSAGE("Compressibility effects in PVCDO are ignored.");
|
||||||
}
|
}
|
||||||
reservoir_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] /= pvcdo[1];
|
reservoir_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] /= pvcdo[1];
|
||||||
viscosity_[phase_usage.phase_pos[PhaseUsage::Liquid]] = pvcdo[3];
|
viscosity_[phase_usage.phase_pos[PhaseUsage::Liquid]] = pvcdo[3];
|
||||||
} else {
|
} 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;
|
const int region_number = 0;
|
||||||
if (pvtw.size() != 1) {
|
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_press_ = pvtw[region_number][0];
|
||||||
ref_B_ = pvtw[region_number][1];
|
ref_B_ = pvtw[region_number][1];
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const int region_number = 0;
|
const int region_number = 0;
|
||||||
if (pvd_table.size() != 1) {
|
if (pvd_table.size() != 1) {
|
||||||
THROW("More than one PVT-region");
|
OPM_THROW(std::runtime_error, "More than one PVT-region");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy data
|
// Copy data
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const int region_number = 0;
|
const int region_number = 0;
|
||||||
if (pvd_table.size() != 1) {
|
if (pvd_table.size() != 1) {
|
||||||
THROW("More than one PVT-region");
|
OPM_THROW(std::runtime_error, "More than one PVT-region");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy data
|
// Copy data
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Opm
|
|||||||
// GAS, PVTG
|
// GAS, PVTG
|
||||||
const int region_number = 0;
|
const int region_number = 0;
|
||||||
if (pvtg.size() != 1) {
|
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);
|
saturated_gas_table_.resize(4);
|
||||||
const int sz = pvtg[region_number].size();
|
const int sz = pvtg[region_number].size();
|
||||||
@@ -106,7 +106,7 @@ namespace Opm
|
|||||||
double* output_dmudp,
|
double* output_dmudp,
|
||||||
double* output_dmudr) const
|
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
|
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.
|
/// Gas resolution and its derivatives at bublepoint as a function of p.
|
||||||
@@ -155,7 +155,7 @@ namespace Opm
|
|||||||
double* output_rbub,
|
double* output_rbub,
|
||||||
double* output_drbubdp) const
|
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.
|
/// Solution factor as a function of p and z.
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Opm
|
|||||||
// OIL, PVTO
|
// OIL, PVTO
|
||||||
const int region_number = 0;
|
const int region_number = 0;
|
||||||
if (pvto.size() != 1) {
|
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);
|
saturated_oil_table_.resize(4);
|
||||||
const int sz = pvto[region_number].size();
|
const int sz = pvto[region_number].size();
|
||||||
@@ -77,7 +77,7 @@ namespace Opm
|
|||||||
while (undersat_oil_tables_[iNext][0].size() < 2) {
|
while (undersat_oil_tables_[iNext][0].size() < 2) {
|
||||||
++iNext;
|
++iNext;
|
||||||
}
|
}
|
||||||
ASSERT(iNext < sz);
|
assert(iNext < sz);
|
||||||
for (int i=0; i<sz; ++i) {
|
for (int i=0; i<sz; ++i) {
|
||||||
if (undersat_oil_tables_[i][0].size() > 1) {
|
if (undersat_oil_tables_[i][0].size() > 1) {
|
||||||
iPrev = i;
|
iPrev = i;
|
||||||
@@ -356,8 +356,8 @@ namespace Opm
|
|||||||
int is = tableIndex(saturated_oil_table_[3], maxR);
|
int is = tableIndex(saturated_oil_table_[3], maxR);
|
||||||
double w = (maxR - saturated_oil_table_[3][is]) /
|
double w = (maxR - saturated_oil_table_[3][is]) /
|
||||||
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
||||||
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
|
assert(undersat_oil_tables_[is][0].size() >= 2);
|
||||||
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
|
assert(undersat_oil_tables_[is+1][0].size() >= 2);
|
||||||
double val1 =
|
double val1 =
|
||||||
linearInterpolationDerivative(undersat_oil_tables_[is][0],
|
linearInterpolationDerivative(undersat_oil_tables_[is][0],
|
||||||
undersat_oil_tables_[is][item],
|
undersat_oil_tables_[is][item],
|
||||||
@@ -379,8 +379,8 @@ namespace Opm
|
|||||||
int is = tableIndex(saturated_oil_table_[3], maxR);
|
int is = tableIndex(saturated_oil_table_[3], maxR);
|
||||||
double w = (maxR - saturated_oil_table_[3][is]) /
|
double w = (maxR - saturated_oil_table_[3][is]) /
|
||||||
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
||||||
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
|
assert(undersat_oil_tables_[is][0].size() >= 2);
|
||||||
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
|
assert(undersat_oil_tables_[is+1][0].size() >= 2);
|
||||||
double val1 =
|
double val1 =
|
||||||
linearInterpolation(undersat_oil_tables_[is][0],
|
linearInterpolation(undersat_oil_tables_[is][0],
|
||||||
undersat_oil_tables_[is][item],
|
undersat_oil_tables_[is][item],
|
||||||
@@ -414,8 +414,8 @@ namespace Opm
|
|||||||
int is = tableIndex(saturated_oil_table_[3], r);
|
int is = tableIndex(saturated_oil_table_[3], r);
|
||||||
double w = (r - saturated_oil_table_[3][is]) /
|
double w = (r - saturated_oil_table_[3][is]) /
|
||||||
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
||||||
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
|
assert(undersat_oil_tables_[is][0].size() >= 2);
|
||||||
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
|
assert(undersat_oil_tables_[is+1][0].size() >= 2);
|
||||||
double val1 =
|
double val1 =
|
||||||
linearInterpolationDerivative(undersat_oil_tables_[is][0],
|
linearInterpolationDerivative(undersat_oil_tables_[is][0],
|
||||||
undersat_oil_tables_[is][item],
|
undersat_oil_tables_[is][item],
|
||||||
@@ -433,8 +433,8 @@ namespace Opm
|
|||||||
return 0;
|
return 0;
|
||||||
} else { // Undersaturated case
|
} else { // Undersaturated case
|
||||||
int is = tableIndex(saturated_oil_table_[3], r);
|
int is = tableIndex(saturated_oil_table_[3], r);
|
||||||
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
|
assert(undersat_oil_tables_[is][0].size() >= 2);
|
||||||
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
|
assert(undersat_oil_tables_[is+1][0].size() >= 2);
|
||||||
double val1 =
|
double val1 =
|
||||||
linearInterpolation(undersat_oil_tables_[is][0],
|
linearInterpolation(undersat_oil_tables_[is][0],
|
||||||
undersat_oil_tables_[is][item],
|
undersat_oil_tables_[is][item],
|
||||||
@@ -459,8 +459,8 @@ namespace Opm
|
|||||||
int is = tableIndex(saturated_oil_table_[3], r);
|
int is = tableIndex(saturated_oil_table_[3], r);
|
||||||
double w = (r - saturated_oil_table_[3][is]) /
|
double w = (r - saturated_oil_table_[3][is]) /
|
||||||
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
(saturated_oil_table_[3][is+1] - saturated_oil_table_[3][is]);
|
||||||
ASSERT(undersat_oil_tables_[is][0].size() >= 2);
|
assert(undersat_oil_tables_[is][0].size() >= 2);
|
||||||
ASSERT(undersat_oil_tables_[is+1][0].size() >= 2);
|
assert(undersat_oil_tables_[is+1][0].size() >= 2);
|
||||||
double val1 =
|
double val1 =
|
||||||
linearInterpolation(undersat_oil_tables_[is][0],
|
linearInterpolation(undersat_oil_tables_[is][0],
|
||||||
undersat_oil_tables_[is][item],
|
undersat_oil_tables_[is][item],
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/linearInterpolation.hpp>
|
#include <opm/core/utility/linearInterpolation.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ namespace Opm
|
|||||||
if (deck.hasField("ROCKTAB")) {
|
if (deck.hasField("ROCKTAB")) {
|
||||||
const table_t& rt = deck.getROCKTAB().rocktab_;
|
const table_t& rt = deck.getROCKTAB().rocktab_;
|
||||||
if (rt.size() != 1) {
|
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();
|
const int n = rt[0][0].size();
|
||||||
p_.resize(n);
|
p_.resize(n);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Opm
|
|||||||
const int num_global_cells = grid.cartdims[0]*grid.cartdims[1]*grid.cartdims[2];
|
const int num_global_cells = grid.cartdims[0]*grid.cartdims[1]*grid.cartdims[2];
|
||||||
const int nc = grid.number_of_cells;
|
const int nc = grid.number_of_cells;
|
||||||
|
|
||||||
ASSERT (num_global_cells > 0);
|
assert(num_global_cells > 0);
|
||||||
|
|
||||||
permeability_.assign(dim * dim * nc, 0.0);
|
permeability_.assign(dim * dim * nc, 0.0);
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ namespace Opm
|
|||||||
std::array<int,9> kmap;
|
std::array<int,9> kmap;
|
||||||
PermeabilityKind pkind = fillTensor(parser, tensor, kmap);
|
PermeabilityKind pkind = fillTensor(parser, tensor, kmap);
|
||||||
if (pkind == Invalid) {
|
if (pkind == Invalid) {
|
||||||
THROW("Invalid permeability field.");
|
OPM_THROW(std::runtime_error, "Invalid permeability field.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign permeability values only if such values are
|
// Assign permeability values only if such values are
|
||||||
@@ -271,9 +271,9 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
PermeabilityKind kind = classifyPermeability(parser);
|
PermeabilityKind kind = classifyPermeability(parser);
|
||||||
if (kind == Invalid) {
|
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);
|
assert(tensor.size() == 1);
|
||||||
for (int i = 0; i < 9; ++i) { kmap[i] = 0; }
|
for (int i = 0; i < 9; ++i) { kmap[i] = 0; }
|
||||||
|
|
||||||
enum { xx, xy, xz, // 0, 1, 2
|
enum { xx, xy, xz, // 0, 1, 2
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Opm
|
|||||||
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
||||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
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));
|
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||||
}
|
}
|
||||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||||
@@ -111,7 +111,7 @@ namespace Opm
|
|||||||
kr[wpos] = krw;
|
kr[wpos] = krw;
|
||||||
kr[opos] = krow;
|
kr[opos] = krow;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -176,7 +176,7 @@ namespace Opm
|
|||||||
dkrds[wpos + wpos*np] = dkrww;
|
dkrds[wpos + wpos*np] = dkrww;
|
||||||
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -272,7 +272,7 @@ namespace Opm
|
|||||||
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
||||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
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));
|
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||||
}
|
}
|
||||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||||
@@ -316,7 +316,7 @@ namespace Opm
|
|||||||
kr[wpos] = krw;
|
kr[wpos] = krw;
|
||||||
kr[opos] = krow;
|
kr[opos] = krow;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -381,7 +381,7 @@ namespace Opm
|
|||||||
dkrds[wpos + wpos*np] = dkrww;
|
dkrds[wpos + wpos*np] = dkrww;
|
||||||
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Opm
|
|||||||
const std::vector<double>& krow = swof_table[table_num][2];
|
const std::vector<double>& krow = swof_table[table_num][2];
|
||||||
const std::vector<double>& pcow = swof_table[table_num][3];
|
const std::vector<double>& pcow = swof_table[table_num][3];
|
||||||
if (krw.front() != 0.0 || krow.back() != 0.0) {
|
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, krw, samples, krw_);
|
||||||
buildUniformMonotoneTable(sw, krow, samples, krow_);
|
buildUniformMonotoneTable(sw, krow, samples, krow_);
|
||||||
@@ -91,7 +91,7 @@ namespace Opm
|
|||||||
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
||||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
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));
|
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||||
}
|
}
|
||||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||||
@@ -132,7 +132,7 @@ namespace Opm
|
|||||||
kr[wpos] = krw;
|
kr[wpos] = krw;
|
||||||
kr[opos] = krow;
|
kr[opos] = krow;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -194,7 +194,7 @@ namespace Opm
|
|||||||
dkrds[wpos + wpos*np] = dkrww;
|
dkrds[wpos + wpos*np] = dkrww;
|
||||||
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -273,7 +273,7 @@ namespace Opm
|
|||||||
const std::vector<double>& krow = swof_table[table_num][2];
|
const std::vector<double>& krow = swof_table[table_num][2];
|
||||||
const std::vector<double>& pcow = swof_table[table_num][3];
|
const std::vector<double>& pcow = swof_table[table_num][3];
|
||||||
if (krw.front() != 0.0 || krow.back() != 0.0) {
|
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);
|
krw_ = NonuniformTableLinear<double>(sw, krw);
|
||||||
krow_ = NonuniformTableLinear<double>(sw, krow);
|
krow_ = NonuniformTableLinear<double>(sw, krow);
|
||||||
@@ -317,7 +317,7 @@ namespace Opm
|
|||||||
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
||||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
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));
|
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||||
}
|
}
|
||||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||||
@@ -358,7 +358,7 @@ namespace Opm
|
|||||||
kr[wpos] = krw;
|
kr[wpos] = krw;
|
||||||
kr[opos] = krow;
|
kr[opos] = krow;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -420,7 +420,7 @@ namespace Opm
|
|||||||
dkrds[wpos + wpos*np] = dkrww;
|
dkrds[wpos + wpos*np] = dkrww;
|
||||||
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Opm
|
|||||||
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
buildUniformMonotoneTable(sg, pcog, samples, pcog_);
|
||||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
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));
|
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||||
}
|
}
|
||||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||||
@@ -107,7 +107,7 @@ namespace Opm
|
|||||||
kr[wpos] = krw;
|
kr[wpos] = krw;
|
||||||
kr[opos] = krow;
|
kr[opos] = krow;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -164,7 +164,7 @@ namespace Opm
|
|||||||
dkrds[wpos + wpos*np] = dkrww;
|
dkrds[wpos + wpos*np] = dkrww;
|
||||||
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -261,7 +261,7 @@ namespace Opm
|
|||||||
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
pcog_ = NonuniformTableLinear<double>(sg, pcog);
|
||||||
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
smin_[phase_usage.phase_pos[Vapour]] = sg[0];
|
||||||
if (std::fabs(sg.back() + swco - 1.0) > 1e-3) {
|
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));
|
", should equal (1.0 - connate water sat) = " << (1.0 - swco));
|
||||||
}
|
}
|
||||||
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
smax_[phase_usage.phase_pos[Vapour]] = sg.back();
|
||||||
@@ -301,7 +301,7 @@ namespace Opm
|
|||||||
kr[wpos] = krw;
|
kr[wpos] = krw;
|
||||||
kr[opos] = krow;
|
kr[opos] = krow;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
@@ -358,7 +358,7 @@ namespace Opm
|
|||||||
dkrds[wpos + wpos*np] = dkrww;
|
dkrds[wpos + wpos*np] = dkrww;
|
||||||
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
dkrds[opos + wpos*np] = dkrow; // Row opos, column wpos, fortran order.
|
||||||
} else {
|
} else {
|
||||||
ASSERT(phase_usage.phase_used[Vapour]);
|
assert(phase_usage.phase_used[Vapour]);
|
||||||
int gpos = phase_usage.phase_pos[Vapour];
|
int gpos = phase_usage.phase_pos[Vapour];
|
||||||
int opos = phase_usage.phase_pos[Liquid];
|
int opos = phase_usage.phase_pos[Liquid];
|
||||||
double sg = s[gpos];
|
double sg = s[gpos];
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
int num_phases = param.getDefault("num_phases", 2);
|
int num_phases = param.getDefault("num_phases", 2);
|
||||||
if (num_phases > 2 || num_phases < 1) {
|
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;
|
num_phases_ = num_phases;
|
||||||
//std::string rpf = param.getDefault("relperm_func", std::string("Unset"));
|
//std::string rpf = param.getDefault("relperm_func", std::string("Unset"));
|
||||||
@@ -120,14 +120,14 @@ namespace Opm
|
|||||||
if (rpf == "Constant") {
|
if (rpf == "Constant") {
|
||||||
relperm_func_ = Constant;
|
relperm_func_ = Constant;
|
||||||
if(num_phases!=1){
|
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") {
|
} else if (rpf == "Linear") {
|
||||||
relperm_func_ = Linear;
|
relperm_func_ = Linear;
|
||||||
} else if (rpf == "Quadratic") {
|
} else if (rpf == "Quadratic") {
|
||||||
relperm_func_ = Quadratic;
|
relperm_func_ = Quadratic;
|
||||||
} else {
|
} 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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
THROW("SaturationPropsBasic::relperm() unhandled relperm func type: " << relperm_func_);
|
OPM_THROW(std::runtime_error, "SaturationPropsBasic::relperm() unhandled relperm func type: " << relperm_func_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ namespace Opm
|
|||||||
// Extract input data.
|
// Extract input data.
|
||||||
// Oil phase should be active.
|
// Oil phase should be active.
|
||||||
if (!phase_usage_.phase_used[Liquid]) {
|
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_.
|
// Obtain SATNUM, if it exists, and create cell_to_func_.
|
||||||
@@ -75,19 +77,19 @@ namespace Opm
|
|||||||
const SWOF::table_t& swof_table = deck.getSWOF().swof_;
|
const SWOF::table_t& swof_table = deck.getSWOF().swof_;
|
||||||
num_tables = swof_table.size();
|
num_tables = swof_table.size();
|
||||||
if (num_tables < satfuncs_expected) {
|
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]) {
|
if (phase_usage_.phase_used[Vapour]) {
|
||||||
const SGOF::table_t& sgof_table = deck.getSGOF().sgof_;
|
const SGOF::table_t& sgof_table = deck.getSGOF().sgof_;
|
||||||
int num_sgof_tables = sgof_table.size();
|
int num_sgof_tables = sgof_table.size();
|
||||||
if (num_sgof_tables < satfuncs_expected) {
|
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) {
|
if (num_tables == Uninitialized) {
|
||||||
num_tables = num_sgof_tables;
|
num_tables = num_sgof_tables;
|
||||||
} else if (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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,13 +104,13 @@ namespace Opm
|
|||||||
do_3pt_ = false;
|
do_3pt_ = false;
|
||||||
if (deck.hasField("ENDSCALE")) {
|
if (deck.hasField("ENDSCALE")) {
|
||||||
if (!phase_usage_.phase_used[Aqua] || !phase_usage_.phase_used[Liquid] || phase_usage_.phase_used[Vapour]) {
|
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")) {
|
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")) {
|
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.hasField("SCALECRS")) {
|
||||||
if (deck.getSCALECRS().scalecrs_ == std::string("YES")) {
|
if (deck.getSCALECRS().scalecrs_ == std::string("YES")) {
|
||||||
@@ -157,7 +159,7 @@ namespace Opm
|
|||||||
double* kr,
|
double* kr,
|
||||||
double* dkrds) const
|
double* dkrds) const
|
||||||
{
|
{
|
||||||
ASSERT (cells != 0);
|
assert(cells != 0);
|
||||||
|
|
||||||
const int np = phase_usage_.num_phases;
|
const int np = phase_usage_.num_phases;
|
||||||
if (dkrds) {
|
if (dkrds) {
|
||||||
@@ -201,7 +203,7 @@ namespace Opm
|
|||||||
double* pc,
|
double* pc,
|
||||||
double* dpcds) const
|
double* dpcds) const
|
||||||
{
|
{
|
||||||
ASSERT (cells != 0);
|
assert(cells != 0);
|
||||||
|
|
||||||
const int np = phase_usage_.num_phases;
|
const int np = phase_usage_.num_phases;
|
||||||
if (dpcds) {
|
if (dpcds) {
|
||||||
@@ -231,7 +233,7 @@ namespace Opm
|
|||||||
double* smin,
|
double* smin,
|
||||||
double* smax) const
|
double* smax) const
|
||||||
{
|
{
|
||||||
ASSERT (cells != 0);
|
assert(cells != 0);
|
||||||
|
|
||||||
const int np = phase_usage_.num_phases;
|
const int np = phase_usage_.num_phases;
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
@@ -297,7 +299,7 @@ namespace Opm
|
|||||||
scaleparam[i] = funcForCell(i).sowcr_;
|
scaleparam[i] = funcForCell(i).sowcr_;
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
THROW(" -- unknown keyword: '" << keyword << "'");
|
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
|
||||||
}
|
}
|
||||||
if (!useKeyword && itab > 0) {
|
if (!useKeyword && itab > 0) {
|
||||||
table = deck.getENPTVD().table_;
|
table = deck.getENPTVD().table_;
|
||||||
@@ -332,7 +334,7 @@ namespace Opm
|
|||||||
scaleparam[i] = funcForCell(i).krorw_;
|
scaleparam[i] = funcForCell(i).krorw_;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
THROW(" -- unknown keyword: '" << keyword << "'");
|
OPM_THROW(std::runtime_error, " -- unknown keyword: '" << keyword << "'");
|
||||||
}
|
}
|
||||||
if (!useKeyword && itab > 0) {
|
if (!useKeyword && itab > 0) {
|
||||||
table = deck.getENKRVD().table_;
|
table = deck.getENKRVD().table_;
|
||||||
@@ -447,7 +449,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Evaluation of relperms
|
// Evaluation of relperms
|
||||||
if (dkrds) {
|
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);
|
funcForCell(cell).evalKrDeriv(ss, kr, dkrds);
|
||||||
} else {
|
} else {
|
||||||
// Assume: sw_cr -> krw=0 sw_max -> krw=<max water relperm>
|
// Assume: sw_cr -> krw=0 sw_max -> krw=<max water relperm>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace Opm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int n = cells.size();
|
const int n = cells.size();
|
||||||
ASSERT(n > 0);
|
assert(n > 0);
|
||||||
std::vector<double> smin(num_phases_*n);
|
std::vector<double> smin(num_phases_*n);
|
||||||
std::vector<double> smax(num_phases_*n);
|
std::vector<double> smax(num_phases_*n);
|
||||||
props.satRange(n, &cells[0], &smin[0], &smax[0]);
|
props.satRange(n, &cells[0], &smin[0], &smax[0]);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@@ -150,12 +151,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 +190,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);
|
||||||
@@ -210,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 +224,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);
|
||||||
}
|
}
|
||||||
@@ -268,7 +269,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);
|
||||||
}
|
}
|
||||||
@@ -415,7 +416,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;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
@@ -187,12 +188,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();
|
||||||
@@ -215,12 +216,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"));
|
||||||
}
|
}
|
||||||
@@ -246,12 +247,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);
|
||||||
@@ -267,7 +268,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);
|
||||||
}
|
}
|
||||||
@@ -280,7 +281,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);
|
||||||
}
|
}
|
||||||
@@ -352,10 +353,10 @@ namespace Opm
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (rock_comp_props && rock_comp_props->isActive()) {
|
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_) {
|
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;
|
std::vector<double> porevol;
|
||||||
computePorevolume(grid, props.porosity(), porevol);
|
computePorevolume(grid, props.porosity(), porevol);
|
||||||
@@ -378,7 +379,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);
|
||||||
}
|
}
|
||||||
@@ -526,7 +527,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;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
struct Wells;
|
struct Wells;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Opm
|
|||||||
if (current_step_ < 0 || current_step_ > int(timesteps_.size())) {
|
if (current_step_ < 0 || current_step_ > int(timesteps_.size())) {
|
||||||
// Note that we do allow current_step_ == timesteps_.size(),
|
// Note that we do allow current_step_ == timesteps_.size(),
|
||||||
// that is the done() state.
|
// 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_step_ = step;
|
||||||
current_time_ = std::accumulate(timesteps_.begin(), timesteps_.begin() + step, 0.0);
|
current_time_ = std::accumulate(timesteps_.begin(), timesteps_.begin() + step, 0.0);
|
||||||
@@ -85,7 +85,7 @@ namespace Opm
|
|||||||
/// Current step length.
|
/// Current step length.
|
||||||
double SimulatorTimer::currentStepLength() const
|
double SimulatorTimer::currentStepLength() const
|
||||||
{
|
{
|
||||||
ASSERT(!done());
|
assert(!done());
|
||||||
return timesteps_[current_step_];
|
return timesteps_[current_step_];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ namespace Opm
|
|||||||
/// Next step.
|
/// Next step.
|
||||||
SimulatorTimer& SimulatorTimer::operator++()
|
SimulatorTimer& SimulatorTimer::operator++()
|
||||||
{
|
{
|
||||||
ASSERT(!done());
|
assert(!done());
|
||||||
current_time_ += timesteps_[current_step_];
|
current_time_ += timesteps_[current_step_];
|
||||||
++current_step_;
|
++current_step_;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
#include <opm/core/props/IncompPropertiesInterface.hpp>
|
||||||
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@@ -152,7 +154,7 @@ namespace Opm
|
|||||||
Density(const BlackoilPropertiesInterface& props) : props_(props) {}
|
Density(const BlackoilPropertiesInterface& props) : props_(props) {}
|
||||||
double operator()(const double pressure, const int phase)
|
double operator()(const double pressure, const int phase)
|
||||||
{
|
{
|
||||||
ASSERT(props_.numPhases() == 2);
|
assert(props_.numPhases() == 2);
|
||||||
const double surfvol[2][2] = { { 1.0, 0.0 },
|
const double surfvol[2][2] = { { 1.0, 0.0 },
|
||||||
{ 0.0, 1.0 } };
|
{ 0.0, 1.0 } };
|
||||||
// We do not handle multi-region PVT/EQUIL at this point.
|
// We do not handle multi-region PVT/EQUIL at this point.
|
||||||
@@ -181,7 +183,7 @@ namespace Opm
|
|||||||
const double datum_p,
|
const double datum_p,
|
||||||
State& state)
|
State& state)
|
||||||
{
|
{
|
||||||
ASSERT(props.numPhases() == 2);
|
assert(props.numPhases() == 2);
|
||||||
|
|
||||||
// Obtain max and min z for which we will need to compute p.
|
// Obtain max and min z for which we will need to compute p.
|
||||||
const int num_cells = grid.number_of_cells;
|
const int num_cells = grid.number_of_cells;
|
||||||
@@ -311,7 +313,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const int num_phases = props.numPhases();
|
const int num_phases = props.numPhases();
|
||||||
if (num_phases != 2) {
|
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);
|
state.init(grid, num_phases);
|
||||||
const int num_cells = props.numCells();
|
const int num_cells = props.numCells();
|
||||||
@@ -407,7 +409,7 @@ namespace Opm
|
|||||||
// TODO: Refactor to exploit similarity with IncompProp* case.
|
// TODO: Refactor to exploit similarity with IncompProp* case.
|
||||||
const int num_phases = props.numPhases();
|
const int num_phases = props.numPhases();
|
||||||
if (num_phases != 2) {
|
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);
|
state.init(grid, num_phases);
|
||||||
const int num_cells = props.numCells();
|
const int num_cells = props.numCells();
|
||||||
@@ -473,21 +475,21 @@ namespace Opm
|
|||||||
const int num_phases = props.numPhases();
|
const int num_phases = props.numPhases();
|
||||||
const PhaseUsage pu = phaseUsageFromDeck(deck);
|
const PhaseUsage pu = phaseUsageFromDeck(deck);
|
||||||
if (num_phases != pu.num_phases) {
|
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.");
|
"found " << pu.num_phases << " phases in deck.");
|
||||||
}
|
}
|
||||||
state.init(grid, num_phases);
|
state.init(grid, num_phases);
|
||||||
if (deck.hasField("EQUIL")) {
|
if (deck.hasField("EQUIL")) {
|
||||||
if (num_phases != 2) {
|
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]) {
|
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.
|
// Set saturations depending on oil-water contact.
|
||||||
const EQUIL& equil= deck.getEQUIL();
|
const EQUIL& equil= deck.getEQUIL();
|
||||||
if (equil.equil.size() != 1) {
|
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_;
|
const double woc = equil.equil[0].water_oil_contact_depth_;
|
||||||
initWaterOilContact(grid, props, woc, WaterBelow, state);
|
initWaterOilContact(grid, props, woc, WaterBelow, state);
|
||||||
@@ -505,7 +507,7 @@ namespace Opm
|
|||||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
||||||
// oil-gas: we require SGAS
|
// oil-gas: we require SGAS
|
||||||
if (!deck.hasField("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 std::vector<double>& sg_deck = deck.getFloatingPointValue("SGAS");
|
||||||
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
||||||
@@ -519,7 +521,7 @@ namespace Opm
|
|||||||
} else {
|
} else {
|
||||||
// water-oil or water-gas: we require SWAT
|
// water-oil or water-gas: we require SWAT
|
||||||
if (!deck.hasField("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 std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
||||||
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
const int wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
||||||
@@ -534,7 +536,7 @@ namespace Opm
|
|||||||
} else if (num_phases == 3) {
|
} else if (num_phases == 3) {
|
||||||
const bool has_swat_sgas = deck.hasField("SWAT") && deck.hasField("SGAS");
|
const bool has_swat_sgas = deck.hasField("SWAT") && deck.hasField("SGAS");
|
||||||
if (!has_swat_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 wpos = pu.phase_pos[BlackoilPhases::Aqua];
|
||||||
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
|
||||||
@@ -549,10 +551,10 @@ namespace Opm
|
|||||||
p[c] = p_deck[c_deck];
|
p[c] = p_deck[c_deck];
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
} 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.
|
// Finally, init face pressures.
|
||||||
@@ -617,7 +619,7 @@ namespace Opm
|
|||||||
state.gasoilratio()[c] = rs_deck[c_deck];
|
state.gasoilratio()[c] = rs_deck[c_deck];
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
degree_(degree_arg)
|
||||||
{
|
{
|
||||||
if (grid_.dimensions > 3) {
|
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) {
|
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:
|
case 3:
|
||||||
return (degree_ + 3)*(degree_ + 2)*(degree_ + 1)/6;
|
return (degree_ + 3)*(degree_ + 2)*(degree_ + 1)/6;
|
||||||
default:
|
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;
|
f_x[0] = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
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)
|
degree_(degree_arg)
|
||||||
{
|
{
|
||||||
if (grid_.dimensions > 3) {
|
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) {
|
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:
|
case 3:
|
||||||
return (degree_ + 1)*(degree_ + 1)*(degree_ + 1);
|
return (degree_ + 1)*(degree_ + 1)*(degree_ + 1);
|
||||||
default:
|
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;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Maximum degree is 1 for now.");
|
OPM_THROW(std::runtime_error, "Maximum degree is 1 for now.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,11 @@
|
|||||||
#include <opm/core/utility/VelocityInterpolation.hpp>
|
#include <opm/core/utility/VelocityInterpolation.hpp>
|
||||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/core/linalg/blas_lapack.h>
|
#include <opm/core/linalg/blas_lapack.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@@ -68,7 +70,7 @@ namespace Opm
|
|||||||
} else if (limiter_method_str == "MinUpwindAverage") {
|
} else if (limiter_method_str == "MinUpwindAverage") {
|
||||||
limiter_method_ = MinUpwindAverage;
|
limiter_method_ = MinUpwindAverage;
|
||||||
} else {
|
} 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");
|
const std::string limiter_usage_str = param.getDefault<std::string>("limiter_usage", "DuringComputations");
|
||||||
if (limiter_usage_str == "DuringComputations") {
|
if (limiter_usage_str == "DuringComputations") {
|
||||||
@@ -78,7 +80,7 @@ namespace Opm
|
|||||||
} else if (limiter_usage_str == "AsSimultaneousPostProcess") {
|
} else if (limiter_usage_str == "AsSimultaneousPostProcess") {
|
||||||
limiter_usage_ = AsSimultaneousPostProcess;
|
limiter_usage_ = AsSimultaneousPostProcess;
|
||||||
} else {
|
} 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:
|
// A note about the use_cvi_ member variable:
|
||||||
@@ -110,8 +112,8 @@ namespace Opm
|
|||||||
// Sanity check for sources.
|
// Sanity check for sources.
|
||||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
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) {
|
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);
|
OPM_MESSAGE("Warning: sources do not sum to zero: " << cum_src);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
const int num_basis = basis_func_->numBasisFunc();
|
const int num_basis = basis_func_->numBasisFunc();
|
||||||
@@ -142,7 +144,7 @@ namespace Opm
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Unknown limiter usage choice: " << limiter_usage_);
|
OPM_THROW(std::runtime_error, "Unknown limiter usage choice: " << limiter_usage_);
|
||||||
}
|
}
|
||||||
if (num_multicell_ > 0) {
|
if (num_multicell_ > 0) {
|
||||||
std::cout << num_multicell_ << " multicell blocks with max size "
|
std::cout << num_multicell_ << " multicell blocks with max size "
|
||||||
@@ -188,8 +190,8 @@ namespace Opm
|
|||||||
// Sanity check for sources.
|
// Sanity check for sources.
|
||||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
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) {
|
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);
|
OPM_MESSAGE("Warning: sources do not sum to zero: " << cum_src);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
const int num_basis = basis_func_->numBasisFunc();
|
const int num_basis = basis_func_->numBasisFunc();
|
||||||
@@ -238,7 +240,7 @@ namespace Opm
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Unknown limiter usage choice: " << limiter_usage_);
|
OPM_THROW(std::runtime_error, "Unknown limiter usage choice: " << limiter_usage_);
|
||||||
}
|
}
|
||||||
if (num_multicell_ > 0) {
|
if (num_multicell_ > 0) {
|
||||||
std::cout << num_multicell_ << " multicell blocks with max size "
|
std::cout << num_multicell_ << " multicell blocks with max size "
|
||||||
@@ -465,7 +467,7 @@ namespace Opm
|
|||||||
for (int row = 0; row < n; ++row) {
|
for (int row = 0; row < n; ++row) {
|
||||||
std::cerr << " " << orig_rhs_[row] << '\n';
|
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.
|
// The solution ends up in rhs_, so we must copy it.
|
||||||
@@ -569,7 +571,7 @@ namespace Opm
|
|||||||
applyMinUpwindLimiter(cell, false, tof);
|
applyMinUpwindLimiter(cell, false, tof);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Limiter type not implemented: " << limiter_method_);
|
OPM_THROW(std::runtime_error, "Limiter type not implemented: " << limiter_method_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,7 +581,7 @@ namespace Opm
|
|||||||
void TofDiscGalReorder::applyMinUpwindLimiter(const int cell, const bool face_min, double* tof)
|
void TofDiscGalReorder::applyMinUpwindLimiter(const int cell, const bool face_min, double* tof)
|
||||||
{
|
{
|
||||||
if (basis_func_->degree() != 1) {
|
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:
|
// Limiter principles:
|
||||||
@@ -649,7 +651,7 @@ namespace Opm
|
|||||||
limiter = 0.0;
|
limiter = 0.0;
|
||||||
basis_func_->addConstant(min_upstream_tof - tof_c, tof + num_basis*cell);
|
basis_func_->addConstant(min_upstream_tof - tof_c, tof + num_basis*cell);
|
||||||
}
|
}
|
||||||
ASSERT(limiter >= 0.0);
|
assert(limiter >= 0.0);
|
||||||
|
|
||||||
// Actually do the limiting (if applicable).
|
// Actually do the limiting (if applicable).
|
||||||
if (limiter < 1.0) {
|
if (limiter < 1.0) {
|
||||||
@@ -672,7 +674,7 @@ namespace Opm
|
|||||||
// any limiting applied to its upstream cells.
|
// any limiting applied to its upstream cells.
|
||||||
const std::vector<int>& seq = ReorderSolverInterface::sequence();
|
const std::vector<int>& seq = ReorderSolverInterface::sequence();
|
||||||
const int nc = seq.size();
|
const int nc = seq.size();
|
||||||
ASSERT(nc == grid_.number_of_cells);
|
assert(nc == grid_.number_of_cells);
|
||||||
for (int i = 0; i < nc; ++i) {
|
for (int i = 0; i < nc; ++i) {
|
||||||
const int cell = seq[i];
|
const int cell = seq[i];
|
||||||
applyLimiter(cell, tof_coeff_);
|
applyLimiter(cell, tof_coeff_);
|
||||||
|
|||||||
@@ -22,9 +22,11 @@
|
|||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/SparseTable.hpp>
|
#include <opm/core/utility/SparseTable.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@@ -69,7 +71,7 @@ namespace Opm
|
|||||||
// Sanity check for sources.
|
// Sanity check for sources.
|
||||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
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) {
|
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
|
#endif
|
||||||
tof.resize(grid_.number_of_cells);
|
tof.resize(grid_.number_of_cells);
|
||||||
@@ -119,7 +121,7 @@ namespace Opm
|
|||||||
// Sanity check for sources.
|
// Sanity check for sources.
|
||||||
const double cum_src = std::accumulate(source, source + grid_.number_of_cells, 0.0);
|
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) {
|
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
|
#endif
|
||||||
tof.resize(grid_.number_of_cells);
|
tof.resize(grid_.number_of_cells);
|
||||||
@@ -146,7 +148,7 @@ namespace Opm
|
|||||||
if (use_multidim_upwind_) {
|
if (use_multidim_upwind_) {
|
||||||
face_tof_.resize(grid_.number_of_faces);
|
face_tof_.resize(grid_.number_of_faces);
|
||||||
std::fill(face_tof_.begin(), face_tof_.end(), 0.0);
|
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;
|
num_multicell_ = 0;
|
||||||
max_size_multicell_ = 0;
|
max_size_multicell_ = 0;
|
||||||
@@ -329,7 +331,7 @@ namespace Opm
|
|||||||
// Identify the adjacent faces of the upwind cell.
|
// Identify the adjacent faces of the upwind cell.
|
||||||
const int* face_nodes_beg = grid_.face_nodes + grid_.face_nodepos[face];
|
const int* face_nodes_beg = grid_.face_nodes + grid_.face_nodepos[face];
|
||||||
const int* face_nodes_end = grid_.face_nodes + grid_.face_nodepos[face + 1];
|
const int* face_nodes_end = grid_.face_nodes + grid_.face_nodepos[face + 1];
|
||||||
ASSERT(face_nodes_end - face_nodes_beg == 2 || grid_.dimensions != 2);
|
assert(face_nodes_end - face_nodes_beg == 2 || grid_.dimensions != 2);
|
||||||
adj_faces_.clear();
|
adj_faces_.clear();
|
||||||
for (int hf = grid_.cell_facepos[upwind_cell]; hf < grid_.cell_facepos[upwind_cell + 1]; ++hf) {
|
for (int hf = grid_.cell_facepos[upwind_cell]; hf < grid_.cell_facepos[upwind_cell + 1]; ++hf) {
|
||||||
const int f = grid_.cell_faces[hf];
|
const int f = grid_.cell_faces[hf];
|
||||||
@@ -356,7 +358,7 @@ namespace Opm
|
|||||||
const int num_adj = adj_faces_.size();
|
const int num_adj = adj_faces_.size();
|
||||||
// The assertion below only holds if the grid is edge-conformal.
|
// The assertion below only holds if the grid is edge-conformal.
|
||||||
// No longer testing, since method no longer requires it.
|
// No longer testing, since method no longer requires it.
|
||||||
// ASSERT(num_adj == face_nodes_end - face_nodes_beg);
|
// assert(num_adj == face_nodes_end - face_nodes_beg);
|
||||||
const double flux_face = std::fabs(darcyflux_[face]);
|
const double flux_face = std::fabs(darcyflux_[face]);
|
||||||
face_term = 0.0;
|
face_term = 0.0;
|
||||||
cell_term_factor = 0.0;
|
cell_term_factor = 0.0;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace Opm
|
|||||||
#if HAVE_SUITESPARSE_UMFPACK_H
|
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||||
call_UMFPACK(const_cast<CSRMatrix*>(A), b, x);
|
call_UMFPACK(const_cast<CSRMatrix*>(A), b, x);
|
||||||
#else
|
#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.");
|
"Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ namespace Opm
|
|||||||
#if HAVE_SUITESPARSE_UMFPACK_H
|
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||||
call_UMFPACK(const_cast<CSRMatrix*>(&A), &b[0], &x[0]);
|
call_UMFPACK(const_cast<CSRMatrix*>(&A), &b[0], &x[0]);
|
||||||
#else
|
#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.");
|
"Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,11 @@
|
|||||||
#include <opm/core/transport/GravityColumnSolver.hpp>
|
#include <opm/core/transport/GravityColumnSolver.hpp>
|
||||||
#include <opm/core/linalg/blas_lapack.h>
|
#include <opm/core/linalg/blas_lapack.h>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -110,7 +114,7 @@ namespace Opm
|
|||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
if (max_delta >= tol_) {
|
if (max_delta >= tol_) {
|
||||||
THROW("Failed to converge!");
|
OPM_THROW(std::runtime_error, "Failed to converge!");
|
||||||
}
|
}
|
||||||
// Finalize.
|
// Finalize.
|
||||||
// model_.finishIteration(); // Doesn't do anything in th 2p model.
|
// model_.finishIteration(); // Doesn't do anything in th 2p model.
|
||||||
@@ -161,7 +165,7 @@ namespace Opm
|
|||||||
if (c1 == prev_cell || c2 == prev_cell) {
|
if (c1 == prev_cell || c2 == prev_cell) {
|
||||||
DL[ci-1] += j2contrib;
|
DL[ci-1] += j2contrib;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(c1 == next_cell || c2 == next_cell);
|
assert(c1 == next_cell || c2 == next_cell);
|
||||||
DU[ci] += j2contrib;
|
DU[ci] += j2contrib;
|
||||||
}
|
}
|
||||||
D[ci] += j1contrib;
|
D[ci] += j1contrib;
|
||||||
@@ -180,7 +184,7 @@ namespace Opm
|
|||||||
// Solution will be written to rhs.
|
// Solution will be written to rhs.
|
||||||
dgtsv_(&colSize, &num_rhs, DL, D, DU, &rhs[0], &colSize, &info);
|
dgtsv_(&colSize, &num_rhs, DL, D, DU, &rhs[0], &colSize, &info);
|
||||||
if (info != 0) {
|
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) {
|
for (int ci = 0; ci < col_size; ++ci) {
|
||||||
sol_vec[column_cells[ci]] = -rhs[ci];
|
sol_vec[column_cells[ci]] = -rhs[ci];
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
#include <opm/core/transport/implicit/ImplicitAssembly.hpp>
|
#include <opm/core/transport/implicit/ImplicitAssembly.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
namespace ImplicitTransportDetails {
|
namespace ImplicitTransportDetails {
|
||||||
struct NRControl {
|
struct NRControl {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Opm{
|
|||||||
smax_(props.numCells()*props.numPhases())
|
smax_(props.numCells()*props.numPhases())
|
||||||
{
|
{
|
||||||
if (props.numPhases() != 2) {
|
if (props.numPhases() != 2) {
|
||||||
THROW("SimpleFluid2pWrapper requires 2 phases.");
|
OPM_THROW(std::runtime_error, "SimpleFluid2pWrapper requires 2 phases.");
|
||||||
}
|
}
|
||||||
const int num_cells = props.numCells();
|
const int num_cells = props.numCells();
|
||||||
std::vector<int> cells(num_cells);
|
std::vector<int> cells(num_cells);
|
||||||
@@ -83,11 +83,11 @@ namespace Opm{
|
|||||||
double dpcow[4];
|
double dpcow[4];
|
||||||
props_.capPress(1, &s[0], &c, pcow, dpcow);
|
props_.capPress(1, &s[0], &c, pcow, dpcow);
|
||||||
pcap = pcow[0];
|
pcap = pcow[0];
|
||||||
ASSERT(pcow[1] == 0.0);
|
assert(pcow[1] == 0.0);
|
||||||
dpcap = dpcow[0];
|
dpcap = dpcow[0];
|
||||||
ASSERT(dpcow[1] == 0.0);
|
assert(dpcow[1] == 0.0);
|
||||||
ASSERT(dpcow[2] == 0.0);
|
assert(dpcow[2] == 0.0);
|
||||||
ASSERT(dpcow[3] == 0.0);
|
assert(dpcow[3] == 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double SimpleFluid2pWrappingProps::s_min(int c) const
|
inline double SimpleFluid2pWrappingProps::s_min(int c) const
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include <opm/core/simulator/TwophaseState.hpp>
|
#include <opm/core/simulator/TwophaseState.hpp>
|
||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
// A very crude check for constant porosity (i.e. no rock-compressibility).
|
// A very crude check for constant porosity (i.e. no rock-compressibility).
|
||||||
if (porevolume[0] != initial_porevolume_cell0_) {
|
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 ssrc[] = { 1.0, 0.0 };
|
||||||
double dummy[] = { 0.0, 0.0 };
|
double dummy[] = { 0.0, 0.0 };
|
||||||
@@ -90,7 +92,7 @@ namespace Opm
|
|||||||
success = append_transport_source(cell, num_phases, state.pressure()[cell], source[cell], dummy, dummy, tsrc_);
|
success = append_transport_source(cell, num_phases, state.pressure()[cell], source[cell], dummy, dummy, tsrc_);
|
||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
THROW("Failed building TransportSource struct.");
|
OPM_THROW(std::runtime_error, "Failed building TransportSource struct.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Opm::ImplicitTransportDetails::NRReport rpt;
|
Opm::ImplicitTransportDetails::NRReport rpt;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
void Opm::ReorderSolverInterface::reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux)
|
void Opm::ReorderSolverInterface::reorderAndTransport(const UnstructuredGrid& grid, const double* darcyflux)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
|
#include <opm/core/utility/miscUtilitiesBlackoil.hpp>
|
||||||
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
@@ -62,7 +63,7 @@ namespace Opm
|
|||||||
ja_downw_(grid.number_of_faces, -1)
|
ja_downw_(grid.number_of_faces, -1)
|
||||||
{
|
{
|
||||||
if (props.numPhases() != 2) {
|
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 np = props.numPhases();
|
||||||
int num_cells = props.numCells();
|
int num_cells = props.numCells();
|
||||||
@@ -99,7 +100,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Check immiscibility requirement (only done for first cell).
|
// Check immiscibility requirement (only done for first cell).
|
||||||
if (A_[1] != 0.0 || A_[2] != 0.0) {
|
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);
|
std::vector<int> seq(grid_.number_of_cells);
|
||||||
@@ -295,7 +296,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Done with iterations, check if we succeeded.
|
// Done with iterations, check if we succeeded.
|
||||||
if (update_count > 0) {
|
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);
|
<< num_iters << " iterations. Remaining update count = " << update_count);
|
||||||
}
|
}
|
||||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||||
@@ -414,7 +415,7 @@ namespace Opm
|
|||||||
const int nc = grid_.number_of_cells;
|
const int nc = grid_.number_of_cells;
|
||||||
const int nf = grid_.number_of_faces;
|
const int nf = grid_.number_of_faces;
|
||||||
const int np = props_.numPhases();
|
const int np = props_.numPhases();
|
||||||
ASSERT(np == 2);
|
assert(np == 2);
|
||||||
const int dim = grid_.dimensions;
|
const int dim = grid_.dimensions;
|
||||||
density_.resize(nc*np);
|
density_.resize(nc*np);
|
||||||
props_.density(grid_.number_of_cells, &A_[0], &density_[0]);
|
props_.density(grid_.number_of_cells, &A_[0], &density_[0]);
|
||||||
@@ -497,7 +498,7 @@ namespace Opm
|
|||||||
} while (max_s_change > tol_ && ++num_iters < maxit_);
|
} while (max_s_change > tol_ && ++num_iters < maxit_);
|
||||||
|
|
||||||
if (max_s_change > tol_) {
|
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);
|
<< num_iters << " iterations. Delta s = " << max_s_change);
|
||||||
}
|
}
|
||||||
return num_iters + 1;
|
return num_iters + 1;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <opm/core/utility/miscUtilities.hpp>
|
#include <opm/core/utility/miscUtilities.hpp>
|
||||||
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
@@ -66,7 +67,7 @@ namespace Opm
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (props.numPhases() != 2) {
|
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();
|
visc_ = props.viscosity();
|
||||||
int num_cells = props.numCells();
|
int num_cells = props.numCells();
|
||||||
@@ -408,7 +409,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Done with iterations, check if we succeeded.
|
// Done with iterations, check if we succeeded.
|
||||||
if (update_count > 0) {
|
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);
|
<< num_iters << " iterations. Remaining update count = " << update_count);
|
||||||
}
|
}
|
||||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||||
@@ -444,7 +445,7 @@ namespace Opm
|
|||||||
// << " in cell " << max_change_cell << std::endl;
|
// << " in cell " << max_change_cell << std::endl;
|
||||||
} while (max_s_change > tol && ++num_iters < max_iters);
|
} while (max_s_change > tol && ++num_iters < max_iters);
|
||||||
if (max_s_change > tol) {
|
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);
|
<< num_iters << " iterations. Delta s = " << max_s_change);
|
||||||
}
|
}
|
||||||
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
std::cout << "Solved " << num_cells << " cell multicell problem in "
|
||||||
@@ -628,7 +629,7 @@ namespace Opm
|
|||||||
} while (max_s_change > tol_ && ++num_iters < maxit_);
|
} while (max_s_change > tol_ && ++num_iters < maxit_);
|
||||||
|
|
||||||
if (max_s_change > tol_) {
|
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);
|
<< num_iters << " iterations. Delta s = " << max_s_change);
|
||||||
}
|
}
|
||||||
return num_iters + 1;
|
return num_iters + 1;
|
||||||
|
|||||||
@@ -37,8 +37,7 @@
|
|||||||
#define OPM_AVERAGE_HEADER
|
#define OPM_AVERAGE_HEADER
|
||||||
|
|
||||||
|
|
||||||
#include <boost/static_assert.hpp>
|
#include <type_traits>
|
||||||
#include <boost/type_traits.hpp>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm {
|
||||||
@@ -53,7 +52,7 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
// To avoid some user errors, we disallow taking averages of
|
// To avoid some user errors, we disallow taking averages of
|
||||||
// integral values.
|
// integral values.
|
||||||
BOOST_STATIC_ASSERT(boost::is_integral<T>::value == false);
|
static_assert(std::is_integral<T>::value == false, "");
|
||||||
Tresult retval(t1);
|
Tresult retval(t1);
|
||||||
retval += t2;
|
retval += t2;
|
||||||
retval *= 0.5;
|
retval *= 0.5;
|
||||||
@@ -71,7 +70,7 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
// To avoid some user errors, we disallow taking averages of
|
// To avoid some user errors, we disallow taking averages of
|
||||||
// integral values.
|
// integral values.
|
||||||
BOOST_STATIC_ASSERT(boost::is_integral<T>::value == false);
|
static_assert(std::is_integral<T>::value == false, "");
|
||||||
return std::sqrt(t1*t2);
|
return std::sqrt(t1*t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +83,7 @@ namespace Opm {
|
|||||||
{
|
{
|
||||||
// To avoid some user errors, we disallow taking averages of
|
// To avoid some user errors, we disallow taking averages of
|
||||||
// integral values.
|
// integral values.
|
||||||
BOOST_STATIC_ASSERT(boost::is_integral<T>::value == false);
|
static_assert(std::is_integral<T>::value == false, "");
|
||||||
return (2*t1*t2)/(t1 + t2);
|
return (2*t1*t2)/(t1 + t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,5 @@
|
|||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// File: ErrorMacros.hpp
|
|
||||||
//
|
|
||||||
// Created: Tue May 14 12:22:16 2002
|
|
||||||
//
|
|
||||||
// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
|
|
||||||
//
|
|
||||||
// $Date$
|
|
||||||
//
|
|
||||||
// $Revision$
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Copyright 2013 Andreas Lauser
|
||||||
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
|
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
|
||||||
Copyright 2009, 2010 Statoil ASA.
|
Copyright 2009, 2010 Statoil ASA.
|
||||||
|
|
||||||
@@ -31,77 +18,45 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#ifndef OPM_ERRORMACROS_HPP
|
||||||
|
#define OPM_ERRORMACROS_HPP
|
||||||
|
|
||||||
#ifndef OPM_ERRORMACROS_HEADER
|
#include <string>
|
||||||
#define OPM_ERRORMACROS_HEADER
|
#include <sstream>
|
||||||
|
|
||||||
|
|
||||||
/// Error macros. In order to use some of them, you must also
|
|
||||||
/// include <iostream> or <exception>, so they are included by
|
|
||||||
/// this file. The compile defines NDEBUG and NVERBOSE control
|
|
||||||
/// the behaviour of these macros.
|
|
||||||
|
|
||||||
#ifndef NVERBOSE
|
|
||||||
#include <iostream>
|
|
||||||
#endif
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
/// Usage: REPORT;
|
#include <cassert>
|
||||||
/// Usage: MESSAGE("Message string.");
|
|
||||||
#ifdef NVERBOSE // Not verbose mode
|
// macros for reporting to stderr
|
||||||
# ifndef REPORT
|
#ifdef OPM_VERBOSE // Verbose mode
|
||||||
# define REPORT
|
# include <iostream>
|
||||||
# endif
|
# define OPM_REPORT do { std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " } while (false)
|
||||||
# ifndef MESSAGE
|
# define OPM_MESSAGE(x) do { OPM_REPORT; std::cerr << x << "\n"; } while (false)
|
||||||
# define MESSAGE(x)
|
# define OPM_MESSAGE_IF(cond, m) do {if(cond) OPM_MESSAGE(m);} while (false)
|
||||||
# endif
|
#else // non-verbose mode (default)
|
||||||
# ifndef MESSAGE_IF
|
# define OPM_REPORT do {} while (false)
|
||||||
# define MESSAGE_IF(cond, m)
|
# define OPM_MESSAGE(x) do {} while (false)
|
||||||
# endif
|
# define OPM_MESSAGE_IF(cond, m) do {} while (false)
|
||||||
#else // Verbose mode
|
|
||||||
# ifndef REPORT
|
|
||||||
# define REPORT std::cerr << "\nIn file " << __FILE__ << ", line " << __LINE__ << std::endl
|
|
||||||
# endif
|
|
||||||
# ifndef MESSAGE
|
|
||||||
# define MESSAGE(x) std::cerr << "\nIn file " << __FILE__ << ", line " << __LINE__ << ": " << x << std::endl
|
|
||||||
# endif
|
|
||||||
# ifndef MESSAGE_IF
|
|
||||||
# define MESSAGE_IF(cond, m) do {if(cond) MESSAGE(m);} while(0)
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Macro to throw an exception. NOTE: For this macro to work, the
|
||||||
|
// exception class must exhibit a constructor with the signature
|
||||||
|
// (const std::string &message). Since this condition is not fulfilled
|
||||||
|
// for the std::exception, you should use this macro with some
|
||||||
|
// exception class derived from either std::logic_error or
|
||||||
|
// std::runtime_error.
|
||||||
|
//
|
||||||
|
// Usage: OPM_THROW(ExceptionClass, "Error message " << value);
|
||||||
|
#define OPM_THROW(Exception, message) \
|
||||||
|
do { \
|
||||||
|
std::ostringstream oss; \
|
||||||
|
oss << "[" << __FILE__ << ":" << __LINE__ << "] " << message; \
|
||||||
|
OPM_MESSAGE(message); \
|
||||||
|
throw Exception(oss.str()); \
|
||||||
|
} while (false)
|
||||||
|
|
||||||
/// Usage: THROW("Error message string.");
|
// throw an exception if a condition is true
|
||||||
#ifndef THROW
|
#define OPM_ERROR_IF(condition, message) do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)
|
||||||
# define THROW(x) do { MESSAGE(x); throw std::exception(); } while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ALWAYS_ERROR_IF(condition, message) do {if(condition){ THROW(message);}} while(0)
|
#endif // OPM_ERRORMACROS_HPP
|
||||||
|
|
||||||
/// Usage: ASSERT(condition)
|
|
||||||
/// Usage: ASSERT2(condition, "Error message string.")
|
|
||||||
/// Usage: DEBUG_ERROR_IF(condition, "Error message string.");
|
|
||||||
#ifdef NDEBUG // Not in debug mode
|
|
||||||
# ifndef ASSERT
|
|
||||||
# define ASSERT(x)
|
|
||||||
# endif
|
|
||||||
# ifndef ASSERT2
|
|
||||||
# define ASSERT2(cond, x)
|
|
||||||
# endif
|
|
||||||
# ifndef DEBUG_ERROR_IF
|
|
||||||
# define DEBUG_ERROR_IF(cond, x)
|
|
||||||
# endif
|
|
||||||
#else // Debug mode
|
|
||||||
# ifndef ASSERT
|
|
||||||
# define ASSERT(cond) if (!(cond)) THROW("Assertion \'" #cond "\' failed.")
|
|
||||||
# endif
|
|
||||||
# ifndef ASSERT2
|
|
||||||
# define ASSERT2(cond, x) do { if (!(cond)) THROW(x);} while(0)
|
|
||||||
# endif
|
|
||||||
# ifndef DEBUG_ERROR_IF
|
|
||||||
# define DEBUG_ERROR_IF(cond, x) do { if (cond) THROW(x); } while(0)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif // OPM_ERRORMACROS_HEADER
|
|
||||||
|
|||||||
63
opm/core/utility/Exceptions.hpp
Normal file
63
opm/core/utility/Exceptions.hpp
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
// vi: set et ts=4 sw=4 sts=4:
|
||||||
|
/*****************************************************************************
|
||||||
|
* Copyright (C) 2013 by Andreas Lauser *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
*****************************************************************************/
|
||||||
|
/*!
|
||||||
|
* \file
|
||||||
|
* \brief Provides the OPM specific exception classes.
|
||||||
|
*/
|
||||||
|
#ifndef OPM_EXCEPTIONS_HPP
|
||||||
|
#define OPM_EXCEPTIONS_HPP
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
// the OPM-specific exception classes
|
||||||
|
namespace Opm {
|
||||||
|
class NotImplemented : public std::logic_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NotImplemented(const std::string &message)
|
||||||
|
: std::logic_error(message)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
class NumericalProblem : public std::runtime_error
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NumericalProblem(const std::string &message)
|
||||||
|
: std::runtime_error(message)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
class MaterialLawProblem : public NumericalProblem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit MaterialLawProblem(const std::string &message)
|
||||||
|
: NumericalProblem(message)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
class LinearSolverProblem : public NumericalProblem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit LinearSolverProblem(const std::string &message)
|
||||||
|
: NumericalProblem(message)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // OPM_EXCEPTIONS_HPP
|
||||||
@@ -139,7 +139,7 @@ namespace Opm
|
|||||||
typename CreatorMap::iterator it;
|
typename CreatorMap::iterator it;
|
||||||
it = string_to_creator_.find(type);
|
it = string_to_creator_.find(type);
|
||||||
if (it == string_to_creator_.end()) {
|
if (it == string_to_creator_.end()) {
|
||||||
THROW("Creator type " << type
|
OPM_THROW(std::runtime_error, "Creator type " << type
|
||||||
<< " is not registered in the factory.");
|
<< " is not registered in the factory.");
|
||||||
}
|
}
|
||||||
return it->second->create();
|
return it->second->create();
|
||||||
@@ -152,7 +152,7 @@ namespace Opm
|
|||||||
typename CreatorMap::iterator it;
|
typename CreatorMap::iterator it;
|
||||||
it = string_to_creator_.find(type);
|
it = string_to_creator_.find(type);
|
||||||
if (it == string_to_creator_.end()) {
|
if (it == string_to_creator_.end()) {
|
||||||
THROW("Creator type " << type
|
OPM_THROW(std::runtime_error, "Creator type " << type
|
||||||
<< " is not registered in the factory.");
|
<< " is not registered in the factory.");
|
||||||
}
|
}
|
||||||
return it->second->clone(original);
|
return it->second->clone(original);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace Opm
|
|||||||
const std::vector<T>& y_values)
|
const std::vector<T>& y_values)
|
||||||
: x_values_(x_values), y_values_(y_values)
|
: x_values_(x_values), y_values_(y_values)
|
||||||
{
|
{
|
||||||
ASSERT(isNondecreasing(x_values.begin(), x_values.end()));
|
assert(isNondecreasing(x_values.begin(), x_values.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -180,7 +180,7 @@ namespace Opm
|
|||||||
if (y_values_reversed_.empty()) {
|
if (y_values_reversed_.empty()) {
|
||||||
y_values_reversed_ = y_values_;
|
y_values_reversed_ = y_values_;
|
||||||
std::reverse(y_values_reversed_.begin(), y_values_reversed_.end());
|
std::reverse(y_values_reversed_.begin(), y_values_reversed_.end());
|
||||||
ASSERT(isNondecreasing(y_values_reversed_.begin(), y_values_reversed_.end()));
|
assert(isNondecreasing(y_values_reversed_.begin(), y_values_reversed_.end()));
|
||||||
x_values_reversed_ = x_values_;
|
x_values_reversed_ = x_values_;
|
||||||
std::reverse(x_values_reversed_.begin(), x_values_reversed_.end());
|
std::reverse(x_values_reversed_.begin(), x_values_reversed_.end());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,12 @@
|
|||||||
#ifndef OPM_ROOTFINDERS_HEADER
|
#ifndef OPM_ROOTFINDERS_HEADER
|
||||||
#define OPM_ROOTFINDERS_HEADER
|
#define OPM_ROOTFINDERS_HEADER
|
||||||
|
|
||||||
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@@ -50,13 +50,13 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
static double handleBracketingFailure(const double x0, const double x1, const double f0, const double f1)
|
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);
|
<< x0 << ", " << x1 << "] f(a) = " << f0 << " f(b) = " << f1);
|
||||||
return -1e100; // Never reached.
|
return -1e100; // Never reached.
|
||||||
}
|
}
|
||||||
static double handleTooManyIterations(const double x0, const double x1, const int maxiter)
|
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) << ", "
|
<< "Current interval is [" << std::min(x0, x1) << ", "
|
||||||
<< std::max(x0, x1) << "]");
|
<< std::max(x0, x1) << "]");
|
||||||
return -1e100; // Never reached.
|
return -1e100; // Never reached.
|
||||||
@@ -68,14 +68,14 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
static double handleBracketingFailure(const double x0, const double x1, const double f0, const double f1)
|
static double handleBracketingFailure(const double x0, const double x1, const double f0, const double f1)
|
||||||
{
|
{
|
||||||
MESSAGE("Error in parameters, zero not bracketed: [a, b] = ["
|
OPM_MESSAGE("Error in parameters, zero not bracketed: [a, b] = ["
|
||||||
<< x0 << ", " << x1 << "] f(a) = " << f0 << " f(b) = " << f1
|
<< x0 << ", " << x1 << "] f(a) = " << f0 << " f(b) = " << f1
|
||||||
<< "");
|
<< "");
|
||||||
return std::fabs(f0) < std::fabs(f1) ? x0 : x1;
|
return std::fabs(f0) < std::fabs(f1) ? x0 : x1;
|
||||||
}
|
}
|
||||||
static double handleTooManyIterations(const double x0, const double x1, const int maxiter)
|
static double handleTooManyIterations(const double x0, const double x1, const int maxiter)
|
||||||
{
|
{
|
||||||
MESSAGE("Maximum number of iterations exceeded: " << maxiter
|
OPM_MESSAGE("Maximum number of iterations exceeded: " << maxiter
|
||||||
<< ", current interval is [" << std::min(x0, x1) << ", "
|
<< ", current interval is [" << std::min(x0, x1) << ", "
|
||||||
<< std::max(x0, x1) << "]");
|
<< std::max(x0, x1) << "]");
|
||||||
return 0.5*(x0 + x1);
|
return 0.5*(x0 + x1);
|
||||||
@@ -284,7 +284,7 @@ namespace Opm
|
|||||||
const double fa,
|
const double fa,
|
||||||
const double fb)
|
const double fb)
|
||||||
{
|
{
|
||||||
ASSERT(fa*fb < 0.0);
|
assert(fa*fb < 0.0);
|
||||||
return (b*fa - a*fb)/(fa - fb);
|
return (b*fa - a*fb)/(fa - fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ namespace Opm
|
|||||||
cur_dx = -2.0*cur_dx;
|
cur_dx = -2.0*cur_dx;
|
||||||
}
|
}
|
||||||
if (i == max_iters) {
|
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) {
|
if (cur_dx < 0.0) {
|
||||||
a = x0 + cur_dx;
|
a = x0 + cur_dx;
|
||||||
|
|||||||
@@ -149,7 +149,9 @@ namespace Opm
|
|||||||
/// Returns the size of a table row.
|
/// Returns the size of a table row.
|
||||||
int rowSize(int row) const
|
int rowSize(int row) const
|
||||||
{
|
{
|
||||||
ASSERT(row >= 0 && row < size());
|
#ifndef NDEBUG
|
||||||
|
OPM_ERROR_IF(row < 0 || row >= size(), "Row index " << row << " is out of range");
|
||||||
|
#endif
|
||||||
return row_start_[row + 1] - row_start_[row];
|
return row_start_[row + 1] - row_start_[row];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,7 +169,7 @@ namespace Opm
|
|||||||
/// Returns a row of the table.
|
/// Returns a row of the table.
|
||||||
row_type operator[](int row) const
|
row_type operator[](int row) const
|
||||||
{
|
{
|
||||||
ASSERT(row >= 0 && row < size());
|
assert(row >= 0 && row < size());
|
||||||
const T* start_ptr = data_.empty() ? 0 : &data_[0];
|
const T* start_ptr = data_.empty() ? 0 : &data_[0];
|
||||||
return row_type(start_ptr + row_start_[row], start_ptr + row_start_[row + 1]);
|
return row_type(start_ptr + row_start_[row], start_ptr + row_start_[row + 1]);
|
||||||
}
|
}
|
||||||
@@ -175,7 +177,7 @@ namespace Opm
|
|||||||
/// Returns a mutable row of the table.
|
/// Returns a mutable row of the table.
|
||||||
mutable_row_type operator[](int row)
|
mutable_row_type operator[](int row)
|
||||||
{
|
{
|
||||||
ASSERT(row >= 0 && row < size());
|
assert(row >= 0 && row < size());
|
||||||
T* start_ptr = data_.empty() ? 0 : &data_[0];
|
T* start_ptr = data_.empty() ? 0 : &data_[0];
|
||||||
return mutable_row_type(start_ptr + row_start_[row], start_ptr + row_start_[row + 1]);
|
return mutable_row_type(start_ptr + row_start_[row], start_ptr + row_start_[row + 1]);
|
||||||
}
|
}
|
||||||
@@ -218,11 +220,11 @@ namespace Opm
|
|||||||
// we have to create the cumulative ones.
|
// we have to create the cumulative ones.
|
||||||
int num_rows = rowsize_end - rowsize_beg;
|
int num_rows = rowsize_end - rowsize_beg;
|
||||||
if (num_rows < 1) {
|
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
|
#ifndef NDEBUG
|
||||||
if (*std::min_element(rowsize_beg, rowsize_end) < 0) {
|
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
|
#endif
|
||||||
row_start_.resize(num_rows + 1);
|
row_start_.resize(num_rows + 1);
|
||||||
@@ -230,7 +232,7 @@ namespace Opm
|
|||||||
std::partial_sum(rowsize_beg, rowsize_end, row_start_.begin() + 1);
|
std::partial_sum(rowsize_beg, rowsize_end, row_start_.begin() + 1);
|
||||||
// Check that data_ and row_start_ match.
|
// Check that data_ and row_start_ match.
|
||||||
if (int(data_.size()) != row_start_.back()) {
|
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.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,14 +81,14 @@ namespace Opm
|
|||||||
default_elem_()
|
default_elem_()
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
ASSERT(sz >= 0);
|
OPM_ERROR_IF(sz < 0, "The size of a SparseVector must be non-negative");
|
||||||
ASSERT(indices_.size() == data_.size());
|
OPM_ERROR_IF(indices_.size() != data_.size(), "The number of indices of a SparseVector must equal to the number of entries");
|
||||||
int last_index = -1;
|
int last_index = -1;
|
||||||
int num_ind = indices_.size();
|
int num_ind = indices_.size();
|
||||||
for (int i = 0; i < num_ind; ++i) {
|
for (int i = 0; i < num_ind; ++i) {
|
||||||
int index = indices_[i];
|
int index = indices_[i];
|
||||||
if (index <= last_index || index >= sz) {
|
if (index <= last_index || index >= sz) {
|
||||||
THROW("Error in SparseVector construction, index is nonincreasing or out of range.");
|
OPM_THROW(std::logic_error, "Error in SparseVector construction, index is nonincreasing or out of range.");
|
||||||
}
|
}
|
||||||
last_index = index;
|
last_index = index;
|
||||||
}
|
}
|
||||||
@@ -101,8 +101,8 @@ namespace Opm
|
|||||||
/// Elements must be added in index order.
|
/// Elements must be added in index order.
|
||||||
void addElement(const T& elem, int index)
|
void addElement(const T& elem, int index)
|
||||||
{
|
{
|
||||||
ASSERT(indices_.empty() || index > indices_.back());
|
assert(indices_.empty() || index > indices_.back());
|
||||||
ASSERT(index < size_);
|
assert(index < size_);
|
||||||
data_.push_back(elem);
|
data_.push_back(elem);
|
||||||
indices_.push_back(index);
|
indices_.push_back(index);
|
||||||
}
|
}
|
||||||
@@ -146,8 +146,10 @@ namespace Opm
|
|||||||
/// the vector has the given index.
|
/// the vector has the given index.
|
||||||
const T& element(int index) const
|
const T& element(int index) const
|
||||||
{
|
{
|
||||||
ASSERT(index >= 0);
|
#ifndef NDEBUG
|
||||||
ASSERT(index < size_);
|
OPM_ERROR_IF(index < 0, "The index of a SparseVector must be non-negative (is " << index << ")");
|
||||||
|
OPM_ERROR_IF(index >= size_, "The index of a SparseVector must be smaller than the maximum value (is " << index << ", max value: " << size_ <<")");
|
||||||
|
#endif
|
||||||
std::vector<int>::const_iterator lb = std::lower_bound(indices_.begin(), indices_.end(), index);
|
std::vector<int>::const_iterator lb = std::lower_bound(indices_.begin(), indices_.end(), index);
|
||||||
if (lb != indices_.end() && *lb == index) {
|
if (lb != indices_.end() && *lb == index) {
|
||||||
return data_[lb - indices_.begin()];
|
return data_[lb - indices_.begin()];
|
||||||
@@ -161,8 +163,10 @@ namespace Opm
|
|||||||
/// \return the nzindex'th nonzero element.
|
/// \return the nzindex'th nonzero element.
|
||||||
const T& nonzeroElement(int nzindex) const
|
const T& nonzeroElement(int nzindex) const
|
||||||
{
|
{
|
||||||
ASSERT(nzindex >= 0);
|
#ifndef NDEBUG
|
||||||
ASSERT(nzindex < nonzeroSize());
|
OPM_ERROR_IF(nzindex < 0, "The index of a SparseVector must be non-negative (is " << nzindex << ")");
|
||||||
|
OPM_ERROR_IF(nzindex >= nonzeroSize(), "The index of a SparseVector must be smaller than the maximum value (is " << nzindex << ", max value: " << nonzeroSize() <<")");
|
||||||
|
#endif
|
||||||
return data_[nzindex];
|
return data_[nzindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,8 +175,8 @@ namespace Opm
|
|||||||
/// \return the index of the nzindex'th nonzero element.
|
/// \return the index of the nzindex'th nonzero element.
|
||||||
int nonzeroIndex(int nzindex) const
|
int nonzeroIndex(int nzindex) const
|
||||||
{
|
{
|
||||||
ASSERT(nzindex >= 0);
|
assert(nzindex >= 0);
|
||||||
ASSERT(nzindex < nonzeroSize());
|
assert(nzindex < nonzeroSize());
|
||||||
return indices_[nzindex];
|
return indices_[nzindex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Opm
|
|||||||
void StopWatch::stop()
|
void StopWatch::stop()
|
||||||
{
|
{
|
||||||
if (state_ != Running) {
|
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();
|
stop_time_ = boost::posix_time::microsec_clock::local_time();
|
||||||
state_ = Stopped;
|
state_ = Stopped;
|
||||||
@@ -75,8 +75,8 @@ namespace Opm
|
|||||||
} else if (state_ == Stopped) {
|
} else if (state_ == Stopped) {
|
||||||
run_time = stop_time_;
|
run_time = stop_time_;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(state_ == UnStarted);
|
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_;
|
boost::posix_time::time_duration dur = run_time - last_time_;
|
||||||
last_time_ = run_time;
|
last_time_ = run_time;
|
||||||
@@ -91,8 +91,8 @@ namespace Opm
|
|||||||
} else if (state_ == Stopped) {
|
} else if (state_ == Stopped) {
|
||||||
run_time = stop_time_;
|
run_time = stop_time_;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(state_ == UnStarted);
|
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_;
|
boost::posix_time::time_duration dur = run_time - start_time_;
|
||||||
return double(dur.total_microseconds())/1000000.0;
|
return double(dur.total_microseconds())/1000000.0;
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ namespace Opm {
|
|||||||
: xmin_(xmin), xmax_(xmax), y_values_(y_values),
|
: xmin_(xmin), xmax_(xmax), y_values_(y_values),
|
||||||
left_(ClosestValue), right_(ClosestValue)
|
left_(ClosestValue), right_(ClosestValue)
|
||||||
{
|
{
|
||||||
ASSERT(xmax > xmin);
|
assert(xmax > xmin);
|
||||||
ASSERT(y_values.size() > 1);
|
assert(y_values.size() > 1);
|
||||||
xdelta_ = (xmax - xmin)/(y_values.size() - 1);
|
xdelta_ = (xmax - xmin)/(y_values.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,8 +139,8 @@ namespace Opm {
|
|||||||
y_values_(y_values, y_values + num_y_values),
|
y_values_(y_values, y_values + num_y_values),
|
||||||
left_(ClosestValue), right_(ClosestValue)
|
left_(ClosestValue), right_(ClosestValue)
|
||||||
{
|
{
|
||||||
ASSERT(xmax > xmin);
|
assert(xmax > xmin);
|
||||||
ASSERT(y_values_.size() > 1);
|
assert(y_values_.size() > 1);
|
||||||
xdelta_ = (xmax - xmin)/(y_values_.size() - 1);
|
xdelta_ = (xmax - xmin)/(y_values_.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ namespace Opm {
|
|||||||
::setLeftPolicy(RangePolicy rp)
|
::setLeftPolicy(RangePolicy rp)
|
||||||
{
|
{
|
||||||
if (rp != ClosestValue) {
|
if (rp != ClosestValue) {
|
||||||
THROW("Only ClosestValue RangePolicy implemented.");
|
OPM_THROW(std::runtime_error, "Only ClosestValue RangePolicy implemented.");
|
||||||
}
|
}
|
||||||
left_ = rp;
|
left_ = rp;
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ namespace Opm {
|
|||||||
::setRightPolicy(RangePolicy rp)
|
::setRightPolicy(RangePolicy rp)
|
||||||
{
|
{
|
||||||
if (rp != ClosestValue) {
|
if (rp != ClosestValue) {
|
||||||
THROW("Only ClosestValue RangePolicy implemented.");
|
OPM_THROW(std::runtime_error, "Only ClosestValue RangePolicy implemented.");
|
||||||
}
|
}
|
||||||
right_ = rp;
|
right_ = rp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
#include <opm/core/grid.h>
|
#include <opm/core/grid.h>
|
||||||
#include <opm/core/linalg/blas_lapack.h>
|
#include <opm/core/linalg/blas_lapack.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@ namespace Opm
|
|||||||
if (cell == grid_.face_cells[2*face]) {
|
if (cell == grid_.face_cells[2*face]) {
|
||||||
face_flux = flux_[face];
|
face_flux = flux_[face];
|
||||||
} else {
|
} else {
|
||||||
ASSERT(cell == grid_.face_cells[2*face + 1]);
|
assert(cell == grid_.face_cells[2*face + 1]);
|
||||||
face_flux = -flux_[face];
|
face_flux = -flux_[face];
|
||||||
}
|
}
|
||||||
for (int dd = 0; dd < dim; ++dd) {
|
for (int dd = 0; dd < dim; ++dd) {
|
||||||
@@ -147,7 +149,7 @@ namespace Opm
|
|||||||
for (int row = 0; row < n; ++row) {
|
for (int row = 0; row < n; ++row) {
|
||||||
std::cerr << " " << orig_f[row] << '\n';
|
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.
|
// The solution ends up in f, so we must copy it.
|
||||||
std::copy(f.begin(), f.end(), corner_velocity_.begin() + dim*cid);
|
std::copy(f.begin(), f.end(), corner_velocity_.begin() + dim*cid);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Opm
|
|||||||
/// the vectors n[i] for i = 0..(dim-1), each n[i] is of size dim.
|
/// the vectors n[i] for i = 0..(dim-1), each n[i] is of size dim.
|
||||||
double cornerVolume(double** n, const int dim)
|
double cornerVolume(double** n, const int dim)
|
||||||
{
|
{
|
||||||
ASSERT(dim == 2 || dim == 3);
|
assert(dim == 2 || dim == 3);
|
||||||
double det = (dim == 2) ? determinantOf(n[0], n[1]) : determinantOf(n[0], n[1], n[2]);
|
double det = (dim == 2) ? determinantOf(n[0], n[1]) : determinantOf(n[0], n[1], n[2]);
|
||||||
return std::fabs(det);
|
return std::fabs(det);
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ namespace Opm
|
|||||||
enum { Maxdim = 3 };
|
enum { Maxdim = 3 };
|
||||||
const int dim = grid.dimensions;
|
const int dim = grid.dimensions;
|
||||||
if (dim > Maxdim) {
|
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.
|
// Compute static data for each corner.
|
||||||
const int num_cells = grid.number_of_cells;
|
const int num_cells = grid.number_of_cells;
|
||||||
@@ -134,13 +134,13 @@ namespace Opm
|
|||||||
std::vector<int> vert_adj_faces(dim);
|
std::vector<int> vert_adj_faces(dim);
|
||||||
for (MMIt face_it = frange.first; face_it != frange.second; ++face_it, ++fi) {
|
for (MMIt face_it = frange.first; face_it != frange.second; ++face_it, ++fi) {
|
||||||
if (fi >= dim) {
|
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.");
|
<< " more than " << dim << " adjacent faces.");
|
||||||
}
|
}
|
||||||
fnorm[fi] = grid_.face_normals + dim*(face_it->second);
|
fnorm[fi] = grid_.face_normals + dim*(face_it->second);
|
||||||
vert_adj_faces[fi] = face_it->second;
|
vert_adj_faces[fi] = face_it->second;
|
||||||
}
|
}
|
||||||
ASSERT(fi == dim);
|
assert(fi == dim);
|
||||||
adj_faces_.insert(adj_faces_.end(), vert_adj_faces.begin(), vert_adj_faces.end());
|
adj_faces_.insert(adj_faces_.end(), vert_adj_faces.begin(), vert_adj_faces.end());
|
||||||
const double corner_vol = cornerVolume(fnorm, dim);
|
const double corner_vol = cornerVolume(fnorm, dim);
|
||||||
ci.volume = corner_vol;
|
ci.volume = corner_vol;
|
||||||
@@ -154,7 +154,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
corner_info_.appendRow(cell_corner_info.begin(), cell_corner_info.end());
|
corner_info_.appendRow(cell_corner_info.begin(), cell_corner_info.end());
|
||||||
}
|
}
|
||||||
ASSERT(corner_id_count == corner_info_.dataSize());
|
assert(corner_id_count == corner_info_.dataSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
// Assumes outward-pointing normals, so negate factor if necessary.
|
// Assumes outward-pointing normals, so negate factor if necessary.
|
||||||
if (grid_.face_cells[2*face] != cell) {
|
if (grid_.face_cells[2*face] != cell) {
|
||||||
ASSERT(grid_.face_cells[2*face + 1] == cell);
|
assert(grid_.face_cells[2*face + 1] == cell);
|
||||||
factor = -factor;
|
factor = -factor;
|
||||||
}
|
}
|
||||||
xb[i] *= factor;
|
xb[i] *= factor;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
|
||||||
#include <opm/core/props/rock/RockCompressibility.hpp>
|
#include <opm/core/props/rock/RockCompressibility.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -105,7 +106,7 @@ namespace Opm
|
|||||||
const int num_cells = pv.size();
|
const int num_cells = pv.size();
|
||||||
const int np = s.size()/pv.size();
|
const int np = s.size()/pv.size();
|
||||||
if (int(s.size()) != num_cells*np) {
|
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);
|
std::fill(sat_vol, sat_vol + np, 0.0);
|
||||||
for (int c = 0; c < num_cells; ++c) {
|
for (int c = 0; c < num_cells; ++c) {
|
||||||
@@ -130,7 +131,7 @@ namespace Opm
|
|||||||
const int num_cells = pv.size();
|
const int num_cells = pv.size();
|
||||||
const int np = s.size()/pv.size();
|
const int np = s.size()/pv.size();
|
||||||
if (int(s.size()) != num_cells*np) {
|
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;
|
double tot_pv = 0.0;
|
||||||
// Note that we abuse the output array to accumulate the
|
// Note that we abuse the output array to accumulate the
|
||||||
@@ -171,7 +172,7 @@ namespace Opm
|
|||||||
const int num_cells = src.size();
|
const int num_cells = src.size();
|
||||||
const int np = s.size()/src.size();
|
const int np = s.size()/src.size();
|
||||||
if (int(s.size()) != num_cells*np) {
|
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(injected, injected + np, 0.0);
|
||||||
std::fill(produced, produced + np, 0.0);
|
std::fill(produced, produced + np, 0.0);
|
||||||
@@ -272,7 +273,7 @@ namespace Opm
|
|||||||
const std::vector<int>::size_type nc = cells.size();
|
const std::vector<int>::size_type nc = cells.size();
|
||||||
const std::size_t np = props.numPhases();
|
const std::size_t np = props.numPhases();
|
||||||
|
|
||||||
ASSERT (s.size() == nc * np);
|
assert(s.size() == nc * np);
|
||||||
|
|
||||||
std::vector<double>(nc * np, 0.0).swap(pmobc );
|
std::vector<double>(nc * np, 0.0).swap(pmobc );
|
||||||
double* dpmobc = 0;
|
double* dpmobc = 0;
|
||||||
@@ -365,7 +366,7 @@ namespace Opm
|
|||||||
const int nw = wells->number_of_wells;
|
const int nw = wells->number_of_wells;
|
||||||
const int np = wells->number_of_phases;
|
const int np = wells->number_of_phases;
|
||||||
if (np != 2) {
|
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) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
const double* comp_frac = wells->comp_frac + np*w;
|
const double* comp_frac = wells->comp_frac + np*w;
|
||||||
@@ -381,7 +382,7 @@ namespace Opm
|
|||||||
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
|
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
|
||||||
perf_rate = 0.0;
|
perf_rate = 0.0;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
|
assert(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
|
||||||
perf_rate *= comp_frac[0];
|
perf_rate *= comp_frac[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,23 +453,23 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const int np = wells.number_of_phases;
|
const int np = wells.number_of_phases;
|
||||||
if (np != 2) {
|
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);
|
src.resize(num_cells);
|
||||||
for (int w = 0; w < wells.number_of_wells; ++w) {
|
for (int w = 0; w < wells.number_of_wells; ++w) {
|
||||||
const int cur = wells.ctrls[w]->current;
|
const int cur = wells.ctrls[w]->current;
|
||||||
if (wells.ctrls[w]->num != 1) {
|
if (wells.ctrls[w]->num != 1) {
|
||||||
MESSAGE("In wellsToSrc(): well has more than one control, all but current control will be ignored.");
|
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) {
|
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) {
|
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) {
|
for (int p = 0; p < np; ++p) {
|
||||||
if (wells.ctrls[w]->distr[np*cur + p] != 1.0) {
|
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];
|
double flow = wells.ctrls[w]->target[cur];
|
||||||
@@ -554,7 +555,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const int np = wells.number_of_phases;
|
const int np = wells.number_of_phases;
|
||||||
const int nw = wells.number_of_wells;
|
const int nw = wells.number_of_wells;
|
||||||
ASSERT(int(flow_rates_per_well_cell.size()) == wells.well_connpos[nw]);
|
assert(int(flow_rates_per_well_cell.size()) == wells.well_connpos[nw]);
|
||||||
phase_flow_per_well.resize(nw * np);
|
phase_flow_per_well.resize(nw * np);
|
||||||
for (int wix = 0; wix < nw; ++wix) {
|
for (int wix = 0; wix < nw; ++wix) {
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
@@ -597,11 +598,11 @@ namespace Opm
|
|||||||
const std::vector<double>& well_perfrates)
|
const std::vector<double>& well_perfrates)
|
||||||
{
|
{
|
||||||
int nw = well_bhp.size();
|
int nw = well_bhp.size();
|
||||||
ASSERT(nw == wells.number_of_wells);
|
assert(nw == wells.number_of_wells);
|
||||||
int np = props.numPhases();
|
int np = props.numPhases();
|
||||||
const int max_np = 3;
|
const int max_np = 3;
|
||||||
if (np > max_np) {
|
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();
|
const double* visc = props.viscosity();
|
||||||
std::vector<double> data_now;
|
std::vector<double> data_now;
|
||||||
@@ -656,11 +657,11 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
// TODO: refactor, since this is almost identical to the other push().
|
// TODO: refactor, since this is almost identical to the other push().
|
||||||
int nw = well_bhp.size();
|
int nw = well_bhp.size();
|
||||||
ASSERT(nw == wells.number_of_wells);
|
assert(nw == wells.number_of_wells);
|
||||||
int np = props.numPhases();
|
int np = props.numPhases();
|
||||||
const int max_np = 3;
|
const int max_np = 3;
|
||||||
if (np > max_np) {
|
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;
|
std::vector<double> data_now;
|
||||||
data_now.reserve(1 + 3*nw);
|
data_now.reserve(1 + 3*nw);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <opm/core/simulator/BlackoilState.hpp>
|
#include <opm/core/simulator/BlackoilState.hpp>
|
||||||
#include <opm/core/simulator/WellState.hpp>
|
#include <opm/core/simulator/WellState.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -60,11 +61,11 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const int num_cells = transport_src.size();
|
const int num_cells = transport_src.size();
|
||||||
if (props.numCells() != num_cells) {
|
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();
|
const int np = props.numPhases();
|
||||||
if (int(state.saturation().size()) != num_cells*np) {
|
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>& press = state.pressure();
|
||||||
const std::vector<double>& s = state.saturation();
|
const std::vector<double>& s = state.saturation();
|
||||||
@@ -199,7 +200,7 @@ namespace Opm
|
|||||||
const int nc = props.numCells();
|
const int nc = props.numCells();
|
||||||
const int np = props.numPhases();
|
const int np = props.numPhases();
|
||||||
|
|
||||||
ASSERT (int(s.size()) == nc * np);
|
assert(int(s.size()) == nc * np);
|
||||||
|
|
||||||
std::vector<double> mu(nc*np);
|
std::vector<double> mu(nc*np);
|
||||||
props.viscosity(nc, &p[0], &z[0], &cells[0], &mu[0], 0);
|
props.viscosity(nc, &p[0], &z[0], &cells[0], &mu[0], 0);
|
||||||
@@ -300,7 +301,7 @@ namespace Opm
|
|||||||
const int nw = wells->number_of_wells;
|
const int nw = wells->number_of_wells;
|
||||||
const int np = wells->number_of_phases;
|
const int np = wells->number_of_phases;
|
||||||
if (np != 2) {
|
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);
|
std::vector<double> A(np*np);
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
@@ -317,7 +318,7 @@ namespace Opm
|
|||||||
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
|
<< perf_rate/Opm::unit::day << " m^3/day." << std::endl;
|
||||||
perf_rate = 0.0;
|
perf_rate = 0.0;
|
||||||
} else {
|
} else {
|
||||||
ASSERT(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
|
assert(std::fabs(comp_frac[0] + comp_frac[1] - 1.0) < 1e-6);
|
||||||
perf_rate *= comp_frac[0]; // Water reservoir volume rate.
|
perf_rate *= comp_frac[0]; // Water reservoir volume rate.
|
||||||
props.matrix(1, &well_state.perfPress()[perf], comp_frac, &perf_cell, &A[0], 0);
|
props.matrix(1, &well_state.perfPress()[perf], comp_frac, &perf_cell, &A[0], 0);
|
||||||
perf_rate *= A[0]; // Water surface volume rate.
|
perf_rate *= A[0]; // Water surface volume rate.
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Opm
|
|||||||
|
|
||||||
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
|
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
|
||||||
if (!parent_as_group) {
|
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);
|
parent_as_group->addChild(child);
|
||||||
|
|
||||||
@@ -104,9 +104,9 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
WellsGroupInterface* parent = findNode(parent_name);
|
WellsGroupInterface* parent = findNode(parent_name);
|
||||||
if (parent == NULL) {
|
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());
|
assert(!parent->isLeafNode());
|
||||||
static_cast<WellsGroup*>(parent)->addChild(child_node);
|
static_cast<WellsGroup*>(parent)->addChild(child_node);
|
||||||
if (child_node->isLeafNode()) {
|
if (child_node->isLeafNode()) {
|
||||||
leaf_nodes_.push_back(static_cast<WellNode*>(child_node.get()));
|
leaf_nodes_.push_back(static_cast<WellNode*>(child_node.get()));
|
||||||
|
|||||||
@@ -19,11 +19,13 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <opm/core/wells/WellsGroup.hpp>
|
#include <opm/core/wells/WellsGroup.hpp>
|
||||||
#include <cmath>
|
|
||||||
#include <memory>
|
|
||||||
#include <opm/core/wells.h>
|
#include <opm/core/wells.h>
|
||||||
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <memory>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -142,7 +144,7 @@ namespace Opm
|
|||||||
return tot_rate;
|
return tot_rate;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
THROW("No rate associated with production control mode" << mode);
|
OPM_THROW(std::runtime_error, "No rate associated with production control mode" << mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +162,7 @@ namespace Opm
|
|||||||
rates = res_rates;
|
rates = res_rates;
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
double tot_rate = 0.0;
|
||||||
for (int phase = 0; phase < phaseUsage().num_phases; ++phase) {
|
for (int phase = 0; phase < phaseUsage().num_phases; ++phase) {
|
||||||
@@ -189,10 +191,10 @@ namespace Opm
|
|||||||
target = prodSpec().liquid_max_rate_;
|
target = prodSpec().liquid_max_rate_;
|
||||||
break;
|
break;
|
||||||
case ProductionSpecification::GRUP:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Unsupported control mode to query target " << mode);
|
OPM_THROW(std::runtime_error, "Unsupported control mode to query target " << mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,10 +212,10 @@ namespace Opm
|
|||||||
target = injSpec().reservoir_flow_max_rate_;
|
target = injSpec().reservoir_flow_max_rate_;
|
||||||
break;
|
break;
|
||||||
case InjectionSpecification::GRUP:
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Unsupported control mode to query target " << mode);
|
OPM_THROW(std::runtime_error, "Unsupported control mode to query target " << mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,7 +449,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
const double my_guide_rate = productionGuideRate(true);
|
const double my_guide_rate = productionGuideRate(true);
|
||||||
if (my_guide_rate == 0) {
|
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 ) {
|
for (size_t i = 0; i < children_.size(); ++i ) {
|
||||||
// Apply for all children.
|
// Apply for all children.
|
||||||
@@ -468,7 +470,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
THROW("Unhandled group production control type " << prod_mode);
|
OPM_THROW(std::runtime_error, "Unhandled group production control type " << prod_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +505,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
THROW("Unhandled group injection control mode " << inj_mode);
|
OPM_THROW(std::runtime_error, "Unhandled group injection control mode " << inj_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -786,7 +788,7 @@ namespace Opm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wells_->type[self_index_] != INJECTOR) {
|
if (wells_->type[self_index_] != INJECTOR) {
|
||||||
ASSERT(target == 0.0);
|
assert(target == 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,7 +802,7 @@ namespace Opm
|
|||||||
wct = RESERVOIR_RATE;
|
wct = RESERVOIR_RATE;
|
||||||
break;
|
break;
|
||||||
default:
|
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) {
|
if (group_control_index_ < 0) {
|
||||||
@@ -863,7 +865,7 @@ namespace Opm
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (wells_->type[self_index_] != PRODUCER) {
|
if (wells_->type[self_index_] != PRODUCER) {
|
||||||
ASSERT(target == 0.0);
|
assert(target == 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// We're a producer, so we need to negate the input
|
// We're a producer, so we need to negate the input
|
||||||
@@ -877,21 +879,21 @@ namespace Opm
|
|||||||
case ProductionSpecification::ORAT:
|
case ProductionSpecification::ORAT:
|
||||||
wct = SURFACE_RATE;
|
wct = SURFACE_RATE;
|
||||||
if (!phase_used[BlackoilPhases::Liquid]) {
|
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;
|
distr[phase_pos[BlackoilPhases::Liquid]] = 1.0;
|
||||||
break;
|
break;
|
||||||
case ProductionSpecification::WRAT:
|
case ProductionSpecification::WRAT:
|
||||||
wct = SURFACE_RATE;
|
wct = SURFACE_RATE;
|
||||||
if (!phase_used[BlackoilPhases::Aqua]) {
|
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;
|
distr[phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
||||||
break;
|
break;
|
||||||
case ProductionSpecification::GRAT:
|
case ProductionSpecification::GRAT:
|
||||||
wct = SURFACE_RATE;
|
wct = SURFACE_RATE;
|
||||||
if (!phase_used[BlackoilPhases::Vapour]) {
|
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;
|
distr[phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||||
break;
|
break;
|
||||||
@@ -899,10 +901,10 @@ namespace Opm
|
|||||||
std::cout << "applying rate" << std::endl;
|
std::cout << "applying rate" << std::endl;
|
||||||
wct = SURFACE_RATE;
|
wct = SURFACE_RATE;
|
||||||
if (!phase_used[BlackoilPhases::Liquid]) {
|
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]) {
|
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::Liquid]] = 1.0;
|
||||||
distr[phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
distr[phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
||||||
@@ -912,7 +914,7 @@ namespace Opm
|
|||||||
wct = RESERVOIR_RATE;
|
wct = RESERVOIR_RATE;
|
||||||
break;
|
break;
|
||||||
default:
|
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) {
|
if (group_control_index_ < 0) {
|
||||||
@@ -978,7 +980,7 @@ namespace Opm
|
|||||||
if (type[0] == 'G') {
|
if (type[0] == 'G') {
|
||||||
return InjectionSpecification::GAS;
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -998,7 +1000,7 @@ namespace Opm
|
|||||||
HANDLE_ICM(VREP);
|
HANDLE_ICM(VREP);
|
||||||
HANDLE_ICM(GRUP);
|
HANDLE_ICM(GRUP);
|
||||||
HANDLE_ICM(FLD);
|
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
|
#undef HANDLE_ICM
|
||||||
|
|
||||||
@@ -1021,7 +1023,7 @@ namespace Opm
|
|||||||
HANDLE_PCM(THP);
|
HANDLE_PCM(THP);
|
||||||
HANDLE_PCM(GRUP);
|
HANDLE_PCM(GRUP);
|
||||||
HANDLE_PCM(FLD);
|
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
|
#undef HANDLE_PCM
|
||||||
|
|
||||||
@@ -1038,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
|
} // anonymous namespace
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
// Helper structs and functions for the implementation.
|
// Helper structs and functions for the implementation.
|
||||||
@@ -95,7 +96,7 @@ namespace
|
|||||||
return p->second;
|
return p->second;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
THROW("Unknown well control mode = "
|
OPM_THROW(std::runtime_error, "Unknown well control mode = "
|
||||||
<< control << " in input file");
|
<< control << " in input file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +135,7 @@ namespace
|
|||||||
return p->second;
|
return p->second;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
THROW("Unknown well control mode = "
|
OPM_THROW(std::runtime_error, "Unknown well control mode = "
|
||||||
<< control << " in input file");
|
<< control << " in input file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -240,7 +241,7 @@ namespace Opm
|
|||||||
: w_(0)
|
: w_(0)
|
||||||
{
|
{
|
||||||
if (grid.dimensions != 3) {
|
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.
|
// NOTE: Implementation copied and modified from dune-porsol's class BlackoilWells.
|
||||||
std::vector<std::string> keywords;
|
std::vector<std::string> keywords;
|
||||||
@@ -248,11 +249,11 @@ namespace Opm
|
|||||||
keywords.push_back("COMPDAT");
|
keywords.push_back("COMPDAT");
|
||||||
// keywords.push_back("WELTARG");
|
// keywords.push_back("WELTARG");
|
||||||
if (!deck.hasFields(keywords)) {
|
if (!deck.hasFields(keywords)) {
|
||||||
MESSAGE("Missing well keywords in deck, initializing no wells.");
|
OPM_MESSAGE("Missing well keywords in deck, initializing no wells.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(deck.hasField("WCONINJE") || deck.hasField("WCONPROD")) ) {
|
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.
|
// Obtain phase usage data.
|
||||||
@@ -372,7 +373,7 @@ namespace Opm
|
|||||||
std::map<int, int>::const_iterator cgit =
|
std::map<int, int>::const_iterator cgit =
|
||||||
cartesian_to_compressed.find(cart_grid_indx);
|
cartesian_to_compressed.find(cart_grid_indx);
|
||||||
if (cgit == cartesian_to_compressed.end()) {
|
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 << ')');
|
<< kz << " not found in grid (well = " << name << ')');
|
||||||
}
|
}
|
||||||
int cell = cgit->second;
|
int cell = cgit->second;
|
||||||
@@ -384,7 +385,7 @@ namespace Opm
|
|||||||
double radius = 0.5*compdat.compdat[kw].diameter_;
|
double radius = 0.5*compdat.compdat[kw].diameter_;
|
||||||
if (radius <= 0.0) {
|
if (radius <= 0.0) {
|
||||||
radius = 0.5*unit::feet;
|
radius = 0.5*unit::feet;
|
||||||
MESSAGE("**** Warning: Well bore internal radius set to " << radius);
|
OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius);
|
||||||
}
|
}
|
||||||
std::array<double, 3> cubical = getCubeDim(grid, cell);
|
std::array<double, 3> cubical = getCubeDim(grid, cell);
|
||||||
const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell];
|
const double* cell_perm = &permeability[grid.dimensions*grid.dimensions*cell];
|
||||||
@@ -398,14 +399,14 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
THROW("Undefined well name: " << compdat.compdat[kw].well_
|
OPM_THROW(std::runtime_error, "Undefined well name: " << compdat.compdat[kw].well_
|
||||||
<< " in COMPDAT");
|
<< " in COMPDAT");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up reference depths that were defaulted. Count perfs.
|
// Set up reference depths that were defaulted. Count perfs.
|
||||||
int num_perfs = 0;
|
int num_perfs = 0;
|
||||||
ASSERT(grid.dimensions == 3);
|
assert(grid.dimensions == 3);
|
||||||
for (int w = 0; w < num_wells; ++w) {
|
for (int w = 0; w < num_wells; ++w) {
|
||||||
num_perfs += wellperf_data[w].size();
|
num_perfs += wellperf_data[w].size();
|
||||||
if (well_data[w].reference_bhp_depth < 0.0) {
|
if (well_data[w].reference_bhp_depth < 0.0) {
|
||||||
@@ -423,7 +424,7 @@ namespace Opm
|
|||||||
// Create the well data structures.
|
// Create the well data structures.
|
||||||
w_ = create_wells(pu.num_phases, num_wells, num_perfs);
|
w_ = create_wells(pu.num_phases, num_wells, num_perfs);
|
||||||
if (!w_) {
|
if (!w_) {
|
||||||
THROW("Failed creating Wells struct.");
|
OPM_THROW(std::runtime_error, "Failed creating Wells struct.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify wells
|
// Classify wells
|
||||||
@@ -435,7 +436,7 @@ namespace Opm
|
|||||||
const int well_index = it->second;
|
const int well_index = it->second;
|
||||||
well_data[well_index].type = INJECTOR;
|
well_data[well_index].type = INJECTOR;
|
||||||
} else {
|
} 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -447,7 +448,7 @@ namespace Opm
|
|||||||
const int well_index = it->second;
|
const int well_index = it->second;
|
||||||
well_data[well_index].type = PRODUCER;
|
well_data[well_index].type = PRODUCER;
|
||||||
} else {
|
} 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");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -468,7 +469,7 @@ namespace Opm
|
|||||||
int ok = add_well(well_data[w].type, well_data[w].reference_bhp_depth, w_num_perf,
|
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_);
|
comp_frac, &perf_cells[0], &perf_prodind[0], well_names[w].c_str(), w_);
|
||||||
if (!ok) {
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,9 +493,9 @@ namespace Opm
|
|||||||
for (int wix = 0; wix < num_wells; ++wix) {
|
for (int wix = 0; wix < num_wells; ++wix) {
|
||||||
if (well_names[wix].compare(0,len, name) == 0) { //equal
|
if (well_names[wix].compare(0,len, name) == 0) { //equal
|
||||||
well_found = true;
|
well_found = true;
|
||||||
ASSERT(well_data[wix].type == w_->type[wix]);
|
assert(well_data[wix].type == w_->type[wix]);
|
||||||
if (well_data[wix].type != INJECTOR) {
|
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.
|
// Add all controls that are present in well.
|
||||||
@@ -513,7 +514,7 @@ namespace Opm
|
|||||||
} else if (wci_line.injector_type_ == "GAS") {
|
} else if (wci_line.injector_type_ == "GAS") {
|
||||||
distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||||
} else {
|
} 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.");
|
"WellsManager only supports WATER, OIL and GAS injector types.");
|
||||||
}
|
}
|
||||||
ok = append_well_controls(SURFACE_RATE, wci_line.surface_flow_max_rate_,
|
ok = append_well_controls(SURFACE_RATE, wci_line.surface_flow_max_rate_,
|
||||||
@@ -529,7 +530,7 @@ namespace Opm
|
|||||||
} else if (wci_line.injector_type_ == "GAS") {
|
} else if (wci_line.injector_type_ == "GAS") {
|
||||||
distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
distr[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||||
} else {
|
} 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.");
|
"WellsManager only supports WATER, OIL and GAS injector types.");
|
||||||
}
|
}
|
||||||
ok = append_well_controls(RESERVOIR_RATE, wci_line.reservoir_flow_max_rate_,
|
ok = append_well_controls(RESERVOIR_RATE, wci_line.reservoir_flow_max_rate_,
|
||||||
@@ -541,15 +542,15 @@ namespace Opm
|
|||||||
NULL, wix, w_);
|
NULL, wix, w_);
|
||||||
}
|
}
|
||||||
if (ok && wci_line.THP_limit_ > 0.0) {
|
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) {
|
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_);
|
InjectionControl::Mode mode = InjectionControl::mode(wci_line.control_mode_);
|
||||||
int cpos = control_pos[mode];
|
int cpos = control_pos[mode];
|
||||||
if (cpos == -1 && mode != InjectionControl::GRUP) {
|
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
|
// We need to check if the well is shut or not
|
||||||
if (wci_line.open_shut_flag_ == "SHUT") {
|
if (wci_line.open_shut_flag_ == "SHUT") {
|
||||||
@@ -561,17 +562,17 @@ namespace Opm
|
|||||||
double cf[3] = { 0.0, 0.0, 0.0 };
|
double cf[3] = { 0.0, 0.0, 0.0 };
|
||||||
if (wci_line.injector_type_[0] == 'W') {
|
if (wci_line.injector_type_[0] == 'W') {
|
||||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
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;
|
cf[pu.phase_pos[BlackoilPhases::Aqua]] = 1.0;
|
||||||
} else if (wci_line.injector_type_[0] == 'O') {
|
} else if (wci_line.injector_type_[0] == 'O') {
|
||||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
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;
|
cf[pu.phase_pos[BlackoilPhases::Liquid]] = 1.0;
|
||||||
} else if (wci_line.injector_type_[0] == 'G') {
|
} else if (wci_line.injector_type_[0] == 'G') {
|
||||||
if (!pu.phase_used[BlackoilPhases::Vapour]) {
|
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;
|
cf[pu.phase_pos[BlackoilPhases::Vapour]] = 1.0;
|
||||||
}
|
}
|
||||||
@@ -579,7 +580,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!well_found) {
|
if (!well_found) {
|
||||||
THROW("Undefined well name: " << wci_line.well_
|
OPM_THROW(std::runtime_error, "Undefined well name: " << wci_line.well_
|
||||||
<< " in WCONINJE");
|
<< " in WCONINJE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,9 +604,9 @@ namespace Opm
|
|||||||
for (int wix = 0; wix < num_wells; ++wix) {
|
for (int wix = 0; wix < num_wells; ++wix) {
|
||||||
if (well_names[wix].compare(0,len, name) == 0) { //equal
|
if (well_names[wix].compare(0,len, name) == 0) { //equal
|
||||||
well_found = true;
|
well_found = true;
|
||||||
ASSERT(well_data[wix].type == w_->type[wix]);
|
assert(well_data[wix].type == w_->type[wix]);
|
||||||
if (well_data[wix].type != PRODUCER) {
|
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.
|
// Add all controls that are present in well.
|
||||||
// First we must clear existing controls, in case the
|
// First we must clear existing controls, in case the
|
||||||
@@ -615,7 +616,7 @@ namespace Opm
|
|||||||
int ok = 1;
|
int ok = 1;
|
||||||
if (ok && wcp_line.oil_max_rate_ >= 0.0) {
|
if (ok && wcp_line.oil_max_rate_ >= 0.0) {
|
||||||
if (!pu.phase_used[BlackoilPhases::Liquid]) {
|
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;
|
control_pos[ProductionControl::ORAT] = w_->ctrls[wix]->num;
|
||||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||||
@@ -625,7 +626,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
if (ok && wcp_line.water_max_rate_ >= 0.0) {
|
if (ok && wcp_line.water_max_rate_ >= 0.0) {
|
||||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
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;
|
control_pos[ProductionControl::WRAT] = w_->ctrls[wix]->num;
|
||||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||||
@@ -635,7 +636,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
if (ok && wcp_line.gas_max_rate_ >= 0.0) {
|
if (ok && wcp_line.gas_max_rate_ >= 0.0) {
|
||||||
if (!pu.phase_used[BlackoilPhases::Vapour]) {
|
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;
|
control_pos[ProductionControl::GRAT] = w_->ctrls[wix]->num;
|
||||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||||
@@ -645,10 +646,10 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
if (ok && wcp_line.liquid_max_rate_ >= 0.0) {
|
if (ok && wcp_line.liquid_max_rate_ >= 0.0) {
|
||||||
if (!pu.phase_used[BlackoilPhases::Aqua]) {
|
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]) {
|
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;
|
control_pos[ProductionControl::LRAT] = w_->ctrls[wix]->num;
|
||||||
double distr[3] = { 0.0, 0.0, 0.0 };
|
double distr[3] = { 0.0, 0.0, 0.0 };
|
||||||
@@ -669,15 +670,15 @@ namespace Opm
|
|||||||
NULL, wix, w_);
|
NULL, wix, w_);
|
||||||
}
|
}
|
||||||
if (ok && wcp_line.THP_limit_ > 0.0) {
|
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) {
|
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_);
|
ProductionControl::Mode mode = ProductionControl::mode(wcp_line.control_mode_);
|
||||||
int cpos = control_pos[mode];
|
int cpos = control_pos[mode];
|
||||||
if (cpos == -1 && mode != ProductionControl::GRUP) {
|
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 it's shut, we complement the cpos
|
||||||
if (wcp_line.open_shut_flag_ == "SHUT") {
|
if (wcp_line.open_shut_flag_ == "SHUT") {
|
||||||
@@ -687,7 +688,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!well_found) {
|
if (!well_found) {
|
||||||
THROW("Undefined well name: " << wcp_line.well_
|
OPM_THROW(std::runtime_error, "Undefined well name: " << wcp_line.well_
|
||||||
<< " in WCONPROD");
|
<< " in WCONPROD");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,7 +696,7 @@ namespace Opm
|
|||||||
|
|
||||||
// Get WELTARG data
|
// Get WELTARG data
|
||||||
if (deck.hasField("WELTARG")) {
|
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 WELTARG& weltargs = deck.getWELTARG();
|
||||||
const int num_weltargs = weltargs.weltarg.size();
|
const int num_weltargs = weltargs.weltarg.size();
|
||||||
@@ -714,7 +715,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!well_found) {
|
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");
|
<< " in WELTARG");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -749,7 +750,7 @@ namespace Opm
|
|||||||
std::string wellname = line.well_;
|
std::string wellname = line.well_;
|
||||||
std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname);
|
std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname);
|
||||||
if (it == well_names_to_index.end()) {
|
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;
|
const int index = it->second;
|
||||||
if (line.openshutflag_ == "SHUT") {
|
if (line.openshutflag_ == "SHUT") {
|
||||||
@@ -757,15 +758,15 @@ namespace Opm
|
|||||||
if (cur_ctrl >= 0) {
|
if (cur_ctrl >= 0) {
|
||||||
cur_ctrl = ~cur_ctrl;
|
cur_ctrl = ~cur_ctrl;
|
||||||
}
|
}
|
||||||
ASSERT(w_->ctrls[index]->current < 0);
|
assert(w_->ctrls[index]->current < 0);
|
||||||
} else if (line.openshutflag_ == "OPEN") {
|
} else if (line.openshutflag_ == "OPEN") {
|
||||||
int& cur_ctrl = w_->ctrls[index]->current;
|
int& cur_ctrl = w_->ctrls[index]->current;
|
||||||
if (cur_ctrl < 0) {
|
if (cur_ctrl < 0) {
|
||||||
cur_ctrl = ~cur_ctrl;
|
cur_ctrl = ~cur_ctrl;
|
||||||
}
|
}
|
||||||
ASSERT(w_->ctrls[index]->current >= 0);
|
assert(w_->ctrls[index]->current >= 0);
|
||||||
} else {
|
} 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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -796,13 +797,13 @@ namespace Opm
|
|||||||
std::string name = lines[i].well_;
|
std::string name = lines[i].well_;
|
||||||
const int wix = well_names_to_index[name];
|
const int wix = well_names_to_index[name];
|
||||||
WellNode& wellnode = *well_collection_.getLeafNodes()[wix];
|
WellNode& wellnode = *well_collection_.getLeafNodes()[wix];
|
||||||
ASSERT(wellnode.name() == name);
|
assert(wellnode.name() == name);
|
||||||
if (well_data[wix].type == PRODUCER) {
|
if (well_data[wix].type == PRODUCER) {
|
||||||
wellnode.prodSpec().guide_rate_ = lines[i].guide_rate_;
|
wellnode.prodSpec().guide_rate_ = lines[i].guide_rate_;
|
||||||
if (lines[i].phase_ == "OIL") {
|
if (lines[i].phase_ == "OIL") {
|
||||||
wellnode.prodSpec().guide_rate_type_ = ProductionSpecification::OIL;
|
wellnode.prodSpec().guide_rate_type_ = ProductionSpecification::OIL;
|
||||||
} else {
|
} 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.");
|
<< name << " in WGRUPCON, cannot handle.");
|
||||||
}
|
}
|
||||||
} else if (well_data[wix].type == INJECTOR) {
|
} else if (well_data[wix].type == INJECTOR) {
|
||||||
@@ -810,11 +811,11 @@ namespace Opm
|
|||||||
if (lines[i].phase_ == "RAT") {
|
if (lines[i].phase_ == "RAT") {
|
||||||
wellnode.injSpec().guide_rate_type_ = InjectionSpecification::RAT;
|
wellnode.injSpec().guide_rate_type_ = InjectionSpecification::RAT;
|
||||||
} else {
|
} 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.");
|
<< name << " in WGRUPCON, cannot handle.");
|
||||||
}
|
}
|
||||||
} else {
|
} 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")) {
|
} 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
|
||||||
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(test_blackoilfluid)
|
|||||||
} 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(SingleColumnTest)
|
BOOST_AUTO_TEST_CASE(SingleColumnTest)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace
|
|||||||
void computeFlux(const UnstructuredGrid& grid, const std::vector<double>& v, std::vector<double>& flux)
|
void computeFlux(const UnstructuredGrid& grid, const std::vector<double>& v, std::vector<double>& flux)
|
||||||
{
|
{
|
||||||
const int dim = v.size();
|
const int dim = v.size();
|
||||||
ASSERT(dim == grid.dimensions);
|
assert(dim == grid.dimensions);
|
||||||
flux.resize(grid.number_of_faces);
|
flux.resize(grid.number_of_faces);
|
||||||
for (int face = 0; face < grid.number_of_faces; ++face) {
|
for (int face = 0; face < grid.number_of_faces; ++face) {
|
||||||
flux[face] = std::inner_product(v.begin(), v.end(), grid.face_normals + face*dim, 0.0);
|
flux[face] = std::inner_product(v.begin(), v.end(), grid.face_normals + face*dim, 0.0);
|
||||||
@@ -54,7 +54,7 @@ namespace
|
|||||||
const std::vector<double>& x,
|
const std::vector<double>& x,
|
||||||
std::vector<double>& v)
|
std::vector<double>& v)
|
||||||
{
|
{
|
||||||
ASSERT(v0.size() == v1.size() && v0.size() == x.size());
|
assert(v0.size() == v1.size() && v0.size() == x.size());
|
||||||
const int dim = v0.size();
|
const int dim = v0.size();
|
||||||
v.resize(dim);
|
v.resize(dim);
|
||||||
for (int dd = 0; dd < dim; ++dd) {
|
for (int dd = 0; dd < dim; ++dd) {
|
||||||
@@ -70,7 +70,7 @@ namespace
|
|||||||
std::vector<double>& flux)
|
std::vector<double>& flux)
|
||||||
{
|
{
|
||||||
const int dim = v0.size();
|
const int dim = v0.size();
|
||||||
ASSERT(dim == grid.dimensions);
|
assert(dim == grid.dimensions);
|
||||||
flux.resize(grid.number_of_faces);
|
flux.resize(grid.number_of_faces);
|
||||||
std::vector<double> x(dim);
|
std::vector<double> x(dim);
|
||||||
std::vector<double> v(dim);
|
std::vector<double> v(dim);
|
||||||
@@ -85,7 +85,7 @@ namespace
|
|||||||
|
|
||||||
double vectorDiff2(const std::vector<double>& v1, const std::vector<double>& v2)
|
double vectorDiff2(const std::vector<double>& v1, const std::vector<double>& v2)
|
||||||
{
|
{
|
||||||
ASSERT(v1.size() == v2.size());
|
assert(v1.size() == v2.size());
|
||||||
const int sz = v1.size();
|
const int sz = v1.size();
|
||||||
double vdiff = 0.0;
|
double vdiff = 0.0;
|
||||||
for (int i = 0; i < sz; ++i) {
|
for (int i = 0; i < sz; ++i) {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// We set the number of blocks in each direction.
|
/// We set the number of blocks in each direction.
|
||||||
@@ -102,6 +103,10 @@ int main()
|
|||||||
/// \internal [write vtk]
|
/// \internal [write vtk]
|
||||||
/// \endinternal
|
/// \endinternal
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
/// \page tutorial1
|
/// \page tutorial1
|
||||||
/// We read the vtu output file in \a Paraview and obtain the following grid.
|
/// We read the vtu output file in \a Paraview and obtain the following grid.
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
///
|
///
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
/// \page tutorial2
|
/// \page tutorial2
|
||||||
@@ -195,6 +196,10 @@ int main()
|
|||||||
/// \internal [write output]
|
/// \internal [write output]
|
||||||
/// \endinternal
|
/// \endinternal
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
/// \page tutorial2
|
/// \page tutorial2
|
||||||
/// We read the vtu output file in \a Paraview and obtain the following pressure
|
/// We read the vtu output file in \a Paraview and obtain the following pressure
|
||||||
|
|||||||
@@ -93,6 +93,7 @@
|
|||||||
/// \snippet tutorial3.cpp main
|
/// \snippet tutorial3.cpp main
|
||||||
/// \internal [main]
|
/// \internal [main]
|
||||||
int main ()
|
int main ()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/// \internal [main]
|
/// \internal [main]
|
||||||
/// \endinternal
|
/// \endinternal
|
||||||
@@ -316,6 +317,10 @@ int main ()
|
|||||||
Opm::writeVtkData(grid, dm, vtkfile);
|
Opm::writeVtkData(grid, dm, vtkfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
/// \internal [write output]
|
/// \internal [write output]
|
||||||
/// \endinternal
|
/// \endinternal
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
/// \snippet tutorial4.cpp main
|
/// \snippet tutorial4.cpp main
|
||||||
/// \internal[main]
|
/// \internal[main]
|
||||||
int main ()
|
int main ()
|
||||||
|
try
|
||||||
{
|
{
|
||||||
/// \internal[main]
|
/// \internal[main]
|
||||||
/// \endinternal
|
/// \endinternal
|
||||||
@@ -406,7 +407,7 @@ int main ()
|
|||||||
well_conditions_met = well_collection.conditionsMet(well_state.bhp(), well_resflowrates_phase, well_surflowrates_phase);
|
well_conditions_met = well_collection.conditionsMet(well_state.bhp(), well_resflowrates_phase, well_surflowrates_phase);
|
||||||
++well_iter;
|
++well_iter;
|
||||||
if (!well_conditions_met && well_iter == max_well_iterations) {
|
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]
|
/// \internal[check well conditions]
|
||||||
@@ -436,6 +437,11 @@ int main ()
|
|||||||
|
|
||||||
destroy_wells(wells);
|
destroy_wells(wells);
|
||||||
}
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
std::cerr << "Program threw an exception: " << e.what() << "\n";
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
/// \internal[write output]
|
/// \internal[write output]
|
||||||
/// \endinternal
|
/// \endinternal
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user