Merge pull request #390 from akva2/janitoring_sca

Janitoring: quell some static analyzer warnings
This commit is contained in:
Markus Blatt 2024-08-16 17:49:17 +02:00 committed by GitHub
commit 37e095aef6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 260 additions and 209 deletions

View File

@ -51,12 +51,12 @@ namespace Opm
typedef typename Super::GridInterface GI; typedef typename Super::GridInterface GI;
typedef typename Super::Vector Vector; typedef typename Super::Vector Vector;
virtual void initSources(const Opm::ParameterGroup& param) void initSources(const Opm::ParameterGroup& param) override
{ {
// Zero-initializing first. // Zero-initializing first.
int nc = this->ginterf_.numberOfCells(); int nc = this->ginterf_.numberOfCells();
this->injection_rates_ = Opm::SparseVector<double>(nc); this->injection_rates_ = Opm::SparseVector<double>(nc);
this->injection_rates_psolver_.resize(nc, 0.0); this->injection_rates_psolver_.resize(nc, 0.0);
// this->injection_rates_.addElement(1.0, 0); // this->injection_rates_.addElement(1.0, 0);
// this->injection_rates_psolver_[0] = 1.0; // this->injection_rates_psolver_[0] = 1.0;
@ -99,10 +99,10 @@ namespace Opm
} }
} }
virtual void initBoundaryConditions(const Opm::ParameterGroup& param) void initBoundaryConditions(const Opm::ParameterGroup& param) override
{ {
setupBoundaryConditions(param, this->ginterf_, this->bcond_); setupBoundaryConditions(param, this->ginterf_, this->bcond_);
} }
private: private:
bool isInside(const Vector& low, const Vector& high, const Vector& pt) bool isInside(const Vector& low, const Vector& high, const Vector& pt)

View File

@ -99,7 +99,7 @@ namespace Opm
class FunctionBoundaryConditions : public PeriodicConditionHandler class FunctionBoundaryConditions : public PeriodicConditionHandler
{ {
public: public:
FunctionBoundaryConditions(BoundaryFunc bfunc) explicit FunctionBoundaryConditions(BoundaryFunc bfunc)
: bfunc_(bfunc) : bfunc_(bfunc)
{ {
} }

View File

@ -160,13 +160,6 @@ try
// Reference: http://www.spe.org/spe-site/spe/spe/papers/authors/Metric_Standard.pdf // Reference: http://www.spe.org/spe-site/spe/spe/papers/authors/Metric_Standard.pdf
/* Check first if there is anything on the command line to look for */
if (varnum == 1) {
cout << "Error: No Eclipsefile or stonefiles found on command line." << endl;
usageandexit();
}
/* Loop over all command line options in order to look /* Loop over all command line options in order to look
for options. for options.

View File

@ -214,12 +214,6 @@ try
if found, replace default values with command line values. if found, replace default values with command line values.
*/ */
/* Check first if there is anything on the command line to look for */
if (varnum == 1) {
if (isMaster) cout << "Error: No Eclipsefile or J-functions found on command line." << endl;
usageandexit();
}
/* Loop over all command line options in order to look /* Loop over all command line options in order to look
for options. for options.
@ -360,8 +354,10 @@ try
Jtmp = MonotCubicInterpolator(vararg[JFindex + i], 1, jFunctionCurve); Jtmp = MonotCubicInterpolator(vararg[JFindex + i], 1, jFunctionCurve);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and -jFunctionCurve" << endl; cerr << "Error: " << errormessage << endl
<< "Check filename and -jFunctionCurve" << endl;
}
usageandexit(); usageandexit();
} }
@ -394,8 +390,10 @@ try
Jtmp = MonotCubicInterpolator(vararg[JFindex], 1, jFunctionCurve); Jtmp = MonotCubicInterpolator(vararg[JFindex], 1, jFunctionCurve);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and -jFunctionCurve" << endl; cerr << "Error: " << errormessage << endl
<< "Check filename and -jFunctionCurve" << endl;
}
usageandexit(); usageandexit();
} }
@ -528,8 +526,10 @@ try
++tesselatedCells; // keep count. ++tesselatedCells; // keep count.
} }
if (isMaster) cout << "Pcmin: " << Pcmin << endl; if (isMaster) {
if (isMaster) cout << "Pcmax: " << Pcmax << endl; cout << "Pcmin: " << Pcmin << endl
<< "Pcmax: " << Pcmax << endl;
}
if (Pcmin > Pcmax) { if (Pcmin > Pcmax) {
if (isMaster) cerr << "ERROR: No legal capillary pressures found for this system. Exiting..." << endl; if (isMaster) cerr << "ERROR: No legal capillary pressures found for this system. Exiting..." << endl;

View File

@ -202,9 +202,8 @@ void writeOutput(const Params& p, Opm::time::StopWatch& watch, int cells,
{ {
// get current time // get current time
time_t rawtime; time_t rawtime;
struct tm* timeinfo;
time(&rawtime); time(&rawtime);
timeinfo = localtime(&rawtime); const struct tm* timeinfo = localtime(&rawtime);
// get hostname // get hostname
char hostname[1024]; char hostname[1024];
@ -444,7 +443,7 @@ int run(Params& p)
return 0; return 0;
} }
catch (Dune::Exception &e) { catch (const Dune::Exception &e) {
throw e; throw e;
} }
catch (...) { catch (...) {
@ -496,7 +495,7 @@ try
return runAMG<AMG2Level>(p); return runAMG<AMG2Level>(p);
else else
return runAMG<AMG1>(p); return runAMG<AMG1>(p);
} catch (Dune::Exception &e) { } catch (const Dune::Exception &e) {
std::cerr << "Dune reported error: " << e << std::endl; std::cerr << "Dune reported error: " << e << std::endl;
} catch (const std::exception &e) { } catch (const std::exception &e) {
throw e; throw e;

View File

@ -470,13 +470,6 @@ try
*/ */
auto options = defineOptions(); auto options = defineOptions();
/* Check first if there is anything on the command line to look for */
if (varnum == 1) {
if (mpi_rank == 0)
cout << "Error: No Eclipsefile or stonefiles found on command line." << endl;
usageandexit();
}
/* /*
'argeclindex' is so that vararg[argeclindex] = the eclipse filename. 'argeclindex' is so that vararg[argeclindex] = the eclipse filename.
*/ */

View File

@ -365,8 +365,10 @@ try
anisotropic_input = true; anisotropic_input = true;
permys = deck["PERMY"].back().getRawDoubleData(); permys = deck["PERMY"].back().getRawDoubleData();
permzs = deck["PERMZ"].back().getRawDoubleData(); permzs = deck["PERMZ"].back().getRawDoubleData();
if (isMaster) cout << "Info: PERMY and PERMZ present, going into anisotropic input mode, no J-functions\n"; if (isMaster) {
if (isMaster) cout << " Options -relPermCurve and -jFunctionCurve is meaningless.\n"; cout << "Info: PERMY and PERMZ present, going into anisotropic input mode, no J-functions\n"
<< " Options -relPermCurve and -jFunctionCurve is meaningless.\n";
}
} }
@ -513,13 +515,17 @@ try
Krwtmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[waterPhaseIndex]); Krwtmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[waterPhaseIndex]);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and -waterCurve" << endl; cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl
<< "Check filename and -waterCurve" << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwtmp.isStrictlyMonotone()) { if (!Krwtmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
MonotCubicInterpolator Krotmp; MonotCubicInterpolator Krotmp;
@ -527,27 +533,35 @@ try
Krotmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[oilPhaseIndex]); Krotmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[oilPhaseIndex]);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and -oilCurve" << endl; cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl
<< "Check filename and -oilCurve" << endl;
}
usageandexit(); usageandexit();
} }
if (!Krotmp.isStrictlyMonotone()) { if (!Krotmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if ((Krwtmp.isStrictlyIncreasing() && Krotmp.isStrictlyIncreasing()) || (Krwtmp.isStrictlyDecreasing() && Krotmp.isStrictlyDecreasing())) { if ((Krwtmp.isStrictlyIncreasing() && Krotmp.isStrictlyIncreasing()) || (Krwtmp.isStrictlyDecreasing() && Krotmp.isStrictlyDecreasing())) {
if (isMaster) cerr << "Error: Input relperm curves are both increasing or decreasing in file " << ROCKFILENAME << endl; if (isMaster) {
cerr << "Error: Input relperm curves are both increasing or decreasing in file " << ROCKFILENAME << endl;
}
usageandexit(); usageandexit();
} }
Krw.push_back(Krwtmp); Krw.push_back(Krwtmp);
Kro.push_back(Krotmp); Kro.push_back(Krotmp);
if (isMaster) cout << "Loaded rock file: " << ROCKFILENAME if (isMaster) {
<< ", for stone type " << i+1 << endl; cout << "Loaded rock file: " << ROCKFILENAME
<< ", for stone type " << i+1 << endl;
}
rockTypeNames.push_back(ROCKFILENAME); rockTypeNames.push_back(ROCKFILENAME);
} }
@ -557,7 +571,9 @@ try
// Check if rock files exists and is readable: // Check if rock files exists and is readable:
ifstream rockfile(ROCKFILENAME, ios::in); ifstream rockfile(ROCKFILENAME, ios::in);
if (rockfile.fail()) { if (rockfile.fail()) {
if (isMaster) cerr << "Error: Filename " << ROCKFILENAME << " not found or not readable." << endl; if (isMaster) {
cerr << "Error: Filename " << ROCKFILENAME << " not found or not readable." << endl;
}
usageandexit(); usageandexit();
} }
rockfile.close(); rockfile.close();
@ -566,13 +582,17 @@ try
Krwtmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[waterPhaseIndex]); Krwtmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[waterPhaseIndex]);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and -waterCurve" << endl; cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl
<< "Check filename and -waterCurve" << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwtmp.isStrictlyMonotone()) { if (!Krwtmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
MonotCubicInterpolator Krotmp; MonotCubicInterpolator Krotmp;
@ -580,17 +600,23 @@ try
Krotmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[oilPhaseIndex]); Krotmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[oilPhaseIndex]);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and -oilCurve" << endl; cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl
<< "Check filename and -oilCurve" << endl;
}
usageandexit(); usageandexit();
} }
if (!Krotmp.isStrictlyMonotone()) { if (!Krotmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if ((Krwtmp.isStrictlyIncreasing() && Krotmp.isStrictlyIncreasing()) || (Krwtmp.isStrictlyDecreasing() && Krotmp.isStrictlyDecreasing())) { if ((Krwtmp.isStrictlyIncreasing() && Krotmp.isStrictlyIncreasing()) || (Krwtmp.isStrictlyDecreasing() && Krotmp.isStrictlyDecreasing())) {
if (isMaster) cerr << "Error: Input relperm curves are both increasing or decreasing in file " << ROCKFILENAME << endl; if (isMaster) {
cerr << "Error: Input relperm curves are both increasing or decreasing in file " << ROCKFILENAME << endl;
}
usageandexit(); usageandexit();
} }
for (int i=0 ; i < stone_types; ++i) { //Insert the same input curves for all rock types for (int i=0 ; i < stone_types; ++i) { //Insert the same input curves for all rock types
@ -599,8 +625,10 @@ try
rockTypeNames.push_back(ROCKFILENAME); rockTypeNames.push_back(ROCKFILENAME);
} }
if (isMaster) cout << "Loaded rock file: " << ROCKFILENAME if (isMaster) {
<< ", for all stone types" << endl; cout << "Loaded rock file: " << ROCKFILENAME
<< ", for all stone types" << endl;
}
} }
else { else {
cerr << "Error: Wrong number of stone-functions provided. " << endl cerr << "Error: Wrong number of stone-functions provided. " << endl
@ -623,12 +651,16 @@ try
ifstream waterfile(WATERFILENAME, ios::in); ifstream waterfile(WATERFILENAME, ios::in);
ifstream oilfile(OILFILENAME, ios::in); ifstream oilfile(OILFILENAME, ios::in);
if (waterfile.fail()) { if (waterfile.fail()) {
if (isMaster) cerr << "Error: Filename " << WATERFILENAME << " not found or not readable." << endl; if (isMaster) {
cerr << "Error: Filename " << WATERFILENAME << " not found or not readable." << endl;
}
usageandexit(); usageandexit();
} }
waterfile.close(); waterfile.close();
if (oilfile.fail()) { if (oilfile.fail()) {
if (isMaster) cerr << "Error: Filename " << OILFILENAME << " not found or not readable." << endl; if (isMaster) {
cerr << "Error: Filename " << OILFILENAME << " not found or not readable." << endl;
}
usageandexit(); usageandexit();
} }
oilfile.close(); oilfile.close();
@ -640,23 +672,31 @@ try
Krwztmp = MonotCubicInterpolator(WATERFILENAME, 2, 5); Krwztmp = MonotCubicInterpolator(WATERFILENAME, 2, 5);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and relpermcurves" << endl; cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl
<< "Check filename and relpermcurves" << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwxtmp.isStrictlyMonotone()) { if (!Krwxtmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwytmp.isStrictlyMonotone()) { if (!Krwytmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwztmp.isStrictlyMonotone()) { if (!Krwztmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
try { try {
@ -665,29 +705,39 @@ try
Kroztmp = MonotCubicInterpolator(OILFILENAME, 2, 5); Kroztmp = MonotCubicInterpolator(OILFILENAME, 2, 5);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and relpermcurves" << endl; cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl
<< "Check filename and relpermcurves" << endl;
}
usageandexit(); usageandexit();
} }
if (!Kroxtmp.isStrictlyMonotone()) { if (!Kroxtmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Kroytmp.isStrictlyMonotone()) { if (!Kroytmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Kroztmp.isStrictlyMonotone()) { if (!Kroztmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
Krwx.push_back(Krwxtmp); Krwy.push_back(Krwytmp); Krwz.push_back(Krwztmp); Krwx.push_back(Krwxtmp); Krwy.push_back(Krwytmp); Krwz.push_back(Krwztmp);
Krox.push_back(Kroxtmp); Kroy.push_back(Kroytmp); Kroz.push_back(Kroztmp); Krox.push_back(Kroxtmp); Kroy.push_back(Kroytmp); Kroz.push_back(Kroztmp);
if (isMaster) cout << "Loaded rock files: " << WATERFILENAME << " and " if (isMaster) {
<< OILFILENAME << ", for stone type " << rockidx << endl; cout << "Loaded rock files: " << WATERFILENAME << " and "
<< OILFILENAME << ", for stone type " << rockidx << endl;
}
rockTypeNames.push_back(WATERFILENAME); rockTypeNames.push_back(WATERFILENAME);
rockTypeNames.push_back(OILFILENAME); rockTypeNames.push_back(OILFILENAME);
} }
@ -699,12 +749,16 @@ try
ifstream waterfile(WATERFILENAME, ios::in); ifstream waterfile(WATERFILENAME, ios::in);
ifstream oilfile(OILFILENAME, ios::in); ifstream oilfile(OILFILENAME, ios::in);
if (waterfile.fail()) { if (waterfile.fail()) {
if (isMaster) cerr << "Error: Filename " << WATERFILENAME << " not found or not readable." << endl; if (isMaster) {
cerr << "Error: Filename " << WATERFILENAME << " not found or not readable." << endl;
}
usageandexit(); usageandexit();
} }
waterfile.close(); waterfile.close();
if (oilfile.fail()) { if (oilfile.fail()) {
if (isMaster) cerr << "Error: Filename " << OILFILENAME << " not found or not readable." << endl; if (isMaster) {
cerr << "Error: Filename " << OILFILENAME << " not found or not readable." << endl;
}
usageandexit(); usageandexit();
} }
oilfile.close(); oilfile.close();
@ -715,23 +769,31 @@ try
Krwztmp = MonotCubicInterpolator(WATERFILENAME, 2, 5); Krwztmp = MonotCubicInterpolator(WATERFILENAME, 2, 5);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and relpermcurves" << endl; cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl
<< "Check filename and relpermcurves" << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwxtmp.isStrictlyMonotone()) { if (!Krwxtmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwytmp.isStrictlyMonotone()) { if (!Krwytmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Krwztmp.isStrictlyMonotone()) { if (!Krwztmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
MonotCubicInterpolator Kroxtmp, Kroytmp, Kroztmp; MonotCubicInterpolator Kroxtmp, Kroytmp, Kroztmp;
@ -741,23 +803,31 @@ try
Kroztmp = MonotCubicInterpolator(OILFILENAME, 2, 5); Kroztmp = MonotCubicInterpolator(OILFILENAME, 2, 5);
} }
catch (const char * errormessage) { catch (const char * errormessage) {
if (isMaster) cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl; if (isMaster) {
if (isMaster) cerr << "Check filename and relpermcurves" << endl; cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl
<< "Check filename and relpermcurves" << endl;
}
usageandexit(); usageandexit();
} }
if (!Kroxtmp.isStrictlyMonotone()) { if (!Kroxtmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Kroytmp.isStrictlyMonotone()) { if (!Kroytmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
if (!Kroztmp.isStrictlyMonotone()) { if (!Kroztmp.isStrictlyMonotone()) {
if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl << if (isMaster) {
" was not strictly monotone. Exiting." << endl; cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl <<
" was not strictly monotone. Exiting." << endl;
}
usageandexit(); usageandexit();
} }
for (int i=0 ; i < 2*stone_types; i+=2) { for (int i=0 ; i < 2*stone_types; i+=2) {
@ -766,9 +836,10 @@ try
rockTypeNames.push_back(WATERFILENAME); rockTypeNames.push_back(WATERFILENAME);
rockTypeNames.push_back(OILFILENAME); rockTypeNames.push_back(OILFILENAME);
} }
if (isMaster) cout << "Loaded rock files: " << WATERFILENAME << " and " if (isMaster) {
<< OILFILENAME << ", for all stone types" << endl; cout << "Loaded rock files: " << WATERFILENAME << " and "
<< OILFILENAME << ", for all stone types" << endl;
}
} }
else { else {
cerr << "Error: Wrong number of stone-functions provided. " << endl cerr << "Error: Wrong number of stone-functions provided. " << endl
@ -892,7 +963,9 @@ try
Swir = 0.0; Swir = 0.0;
} }
if (Swir < 0.0 || Swir > 1.0 || Swor < 0.0 || Swor > 1.0) { if (Swir < 0.0 || Swir > 1.0 || Swor < 0.0 || Swor > 1.0) {
if (isMaster) cerr << "ERROR: Swir/Swor unsensible. Check your input. Exiting"; if (isMaster) {
cerr << "ERROR: Swir/Swor unsensible. Check your input. Exiting";
}
usageandexit(); usageandexit();
} }
@ -1014,7 +1087,9 @@ try
} }
} }
if (isMaster) cout << endl << "Lower fracflowratio: " << fracflowratioMin << ", Upper fracflowratio: " << fracflowratioMax << endl; if (isMaster) {
cout << endl << "Lower fracflowratio: " << fracflowratioMin << ", Upper fracflowratio: " << fracflowratioMax << endl;
}
// Now upscale fractional flow vs water saturation // Now upscale fractional flow vs water saturation
// (i.e., populate the vector WaterSaturationVsFractionalFlow) // (i.e., populate the vector WaterSaturationVsFractionalFlow)
@ -1048,7 +1123,9 @@ try
// Check for saneness of fracFlowRatioTestvalue // Check for saneness of fracFlowRatioTestvalue
if (std::isnan(fracFlowRatioTestvalue) || std::isinf(fracFlowRatioTestvalue)) { if (std::isnan(fracFlowRatioTestvalue) || std::isinf(fracFlowRatioTestvalue)) {
if (isMaster) cerr << "ERROR: fracFlowRatioTestvalue was inf or nan." << endl; if (isMaster) {
cerr << "ERROR: fracFlowRatioTestvalue was inf or nan." << endl;
}
break; // Jump out out while-loop, just print the results up to now and exit break; // Jump out out while-loop, just print the results up to now and exit
} }

View File

@ -46,7 +46,7 @@ namespace Opm {
enum { DofPerCell = Model::DofPerCell }; enum { DofPerCell = Model::DofPerCell };
public: public:
ImplicitAssembly(Model& model) explicit ImplicitAssembly(Model& model)
: model_(model), : model_(model),
nconn_(-1) , nconn_(-1) ,
asm_buffer_() asm_buffer_()

View File

@ -104,7 +104,7 @@ namespace Opm {
template <class> class VAsgn > template <class> class VAsgn >
class ImplicitTransport { class ImplicitTransport {
public: public:
ImplicitTransport(Model& model) explicit ImplicitTransport(Model& model)
: model_(model), : model_(model),
asm_ (model) asm_ (model)
{} {}
@ -119,14 +119,14 @@ namespace Opm {
const ImplicitTransportDetails::NRControl& ctrl , const ImplicitTransportDetails::NRControl& ctrl ,
ReservoirState& state , ReservoirState& state ,
LinearSolver& linsolve, LinearSolver& linsolve,
ImplicitTransportDetails::NRReport& rpt ) { ImplicitTransportDetails::NRReport& rpt )
bool init; {
typedef typename JacobianSystem::vector_type vector_type; typedef typename JacobianSystem::vector_type vector_type;
typedef typename JacobianSystem::matrix_type matrix_type; typedef typename JacobianSystem::matrix_type matrix_type;
asm_.createSystem(g, sys_); asm_.createSystem(g, sys_);
model_.initStep(state, g, sys_); model_.initStep(state, g, sys_);
init = model_.initIteration(state, g, sys_); model_.initIteration(state, g, sys_);
MZero<matrix_type>::zero(sys_.writableMatrix()); MZero<matrix_type>::zero(sys_.writableMatrix());
VZero<vector_type>::zero(sys_.vector().writableResidual()); VZero<vector_type>::zero(sys_.vector().writableResidual());
@ -157,7 +157,7 @@ namespace Opm {
VNorm<vector_type>::norm(sys_.vector().increment()); VNorm<vector_type>::norm(sys_.vector().increment());
// Begin line search // Begin line search
double residual=VNorm<vector_type>::norm(sys_.vector().residual()); double residual;
int lin_it=0; int lin_it=0;
bool finished=rpt.norm_res<ctrl.atol; bool finished=rpt.norm_res<ctrl.atol;
double alpha=2.0; double alpha=2.0;
@ -172,7 +172,7 @@ namespace Opm {
sys_.vector().writableSolution()); sys_.vector().writableSolution());
sys_.vector().addIncrement(); sys_.vector().addIncrement();
init = model_.initIteration(state, g, sys_); bool init = model_.initIteration(state, g, sys_);
if (init) { if (init) {
MZero<matrix_type>::zero(sys_.writableMatrix()); MZero<matrix_type>::zero(sys_.writableMatrix());
VZero<vector_type>::zero(sys_.vector().writableResidual()); VZero<vector_type>::zero(sys_.vector().writableResidual());

View File

@ -126,7 +126,7 @@ namespace Opm {
template <class BaseVec> template <class BaseVec>
class VectorSizeSetter { class VectorSizeSetter {
public: public:
VectorSizeSetter(BaseVec& v) : v_(v) {} explicit VectorSizeSetter(BaseVec& v) : v_(v) {}
void void
setSize(::std::size_t ndof, ::std::size_t m) { setSize(::std::size_t ndof, ::std::size_t m) {

View File

@ -24,7 +24,7 @@ struct OperatorApplier
{ {
//! \brief Constructor //! \brief Constructor
//! \param[in] t The preconditioner or inverse operator //! \param[in] t The preconditioner or inverse operator
OperatorApplier(T& t) : A(t) explicit OperatorApplier(T& t) : A(t)
{ {
} }

View File

@ -45,7 +45,7 @@ class ASMHandler {
//! \brief The default constructor //! \brief The default constructor
//! \param[in] gv_ The grid the operator is assembled over //! \param[in] gv_ The grid the operator is assembled over
ASMHandler(const GridType& gv_) : gv(gv_), maxeqn(0) explicit ASMHandler(const GridType& gv_) : gv(gv_), maxeqn(0)
{ {
} }

View File

@ -170,7 +170,7 @@ void ASMHandler<GridType>::expandSolution(Vector& result, const Vector& u)
l = 0; l = 0;
for (int i=0;i<nodes;++i) { for (int i=0;i<nodes;++i) {
for (int j=0;j<dim;++j) { for (int j=0;j<dim;++j) {
MPC* mpc = getMPC(i,j); const MPC* mpc = getMPC(i,j);
if (mpc) { if (mpc) {
for (size_t n=0;n<mpc->getNoMaster();++n) { for (size_t n=0;n<mpc->getNoMaster();++n) {
int idx = mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1; int idx = mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1;
@ -322,7 +322,7 @@ void ASMHandler<GridType>::preprocess()
fixIt it2 = fixedNodes.find(indexi); fixIt it2 = fixedNodes.find(indexi);
if (it2 == fixedNodes.end()) { if (it2 == fixedNodes.end()) {
for (int i=0;i<dim;++i) { for (int i=0;i<dim;++i) {
MPC* mpc = getMPC(indexi,i); const MPC* mpc = getMPC(indexi,i);
if (!mpc) if (!mpc)
meqn[indexi*dim+i] = maxeqn++; meqn[indexi*dim+i] = maxeqn++;
else else
@ -334,7 +334,7 @@ void ASMHandler<GridType>::preprocess()
if (it2->second.first & flag) if (it2->second.first & flag)
meqn[indexi*dim+i] = -1; meqn[indexi*dim+i] = -1;
else { else {
MPC* mpc = getMPC(indexi,i); const MPC* mpc = getMPC(indexi,i);
if (!mpc) if (!mpc)
meqn[indexi*dim+i] = maxeqn++; meqn[indexi*dim+i] = maxeqn++;
else else
@ -390,7 +390,7 @@ void ASMHandler<GridType>::determineAdjacencyPattern()
for (int i=0; i < vertexsize; i++) { for (int i=0; i < vertexsize; i++) {
int indexi = set.subIndex(*it,i,dim); int indexi = set.subIndex(*it,i,dim);
for (int k=0;k<dim;++k) { for (int k=0;k<dim;++k) {
MPC* mpc = getMPC(indexi,k); const MPC* mpc = getMPC(indexi,k);
if (mpc) { if (mpc) {
for (size_t l=0;l<mpc->getNoMaster();++l) { for (size_t l=0;l<mpc->getNoMaster();++l) {
nodeAdjacency(it,vertexsize, nodeAdjacency(it,vertexsize,

View File

@ -348,7 +348,7 @@ std::vector<double> BoundaryGrid::Quad::evalBasis(double xi, double eta) const
return res; return res;
} }
BoundaryGrid::Vertex minXminY(std::vector<BoundaryGrid::Vertex>& in) BoundaryGrid::Vertex minXminY(const std::vector<BoundaryGrid::Vertex>& in)
{ {
// find the nodes with minimal X // find the nodes with minimal X
// then find the minimum Y among these // then find the minimum Y among these
@ -358,7 +358,7 @@ BoundaryGrid::Vertex minXminY(std::vector<BoundaryGrid::Vertex>& in)
return *s.begin(); return *s.begin();
} }
BoundaryGrid::Vertex maxXminY(std::vector<BoundaryGrid::Vertex>& in) BoundaryGrid::Vertex maxXminY(const std::vector<BoundaryGrid::Vertex>& in)
{ {
// find the nodes with maximum X // find the nodes with maximum X
// then find the minimum Y among these // then find the minimum Y among these
@ -368,7 +368,7 @@ BoundaryGrid::Vertex maxXminY(std::vector<BoundaryGrid::Vertex>& in)
return *(s.end()-2); return *(s.end()-2);
} }
BoundaryGrid::Vertex maxXmaxY(std::vector<BoundaryGrid::Vertex>& in) BoundaryGrid::Vertex maxXmaxY(const std::vector<BoundaryGrid::Vertex>& in)
{ {
// find the nodes with maximum X // find the nodes with maximum X
// then find the maximum Y among these // then find the maximum Y among these
@ -378,7 +378,7 @@ BoundaryGrid::Vertex maxXmaxY(std::vector<BoundaryGrid::Vertex>& in)
return *(s.end()-1); return *(s.end()-1);
} }
BoundaryGrid::Vertex minXmaxY(std::vector<BoundaryGrid::Vertex>& in) BoundaryGrid::Vertex minXmaxY(const std::vector<BoundaryGrid::Vertex>& in)
{ {
// find the nodes with minimum X // find the nodes with minimum X
// then find the maximum Y among these // then find the maximum Y among these

View File

@ -197,7 +197,7 @@ class BoundaryGrid {
struct VertexLess { struct VertexLess {
//! \brief Default constructor. //! \brief Default constructor.
//! \param[in] comp Direction to use for comparison. -1 to use index //! \param[in] comp Direction to use for comparison. -1 to use index
VertexLess(int comp) : dir(comp) {} explicit VertexLess(int comp) : dir(comp) {}
//! \brief The comparison operator //! \brief The comparison operator
bool operator()(const Vertex& q1, const Vertex& q2) bool operator()(const Vertex& q1, const Vertex& q2)
@ -215,7 +215,7 @@ class BoundaryGrid {
struct BoundedPredicate { struct BoundedPredicate {
//! \brief Default constructor //! \brief Default constructor
//! \param[in] coord_ The coordinates to check //! \param[in] coord_ The coordinates to check
BoundedPredicate(const FaceCoord& coord_) : coord(coord_) {} explicit BoundedPredicate(const FaceCoord& coord_) : coord(coord_) {}
//! \brief The comparison operator //! \brief The comparison operator
bool operator()(const Quad& q) bool operator()(const Quad& q)
@ -345,7 +345,7 @@ class HexGeometry<2, cdim, GridImp>
//! \brief Construct integration element //! \brief Construct integration element
//! \param[in] q Quad describing element //! \param[in] q Quad describing element
HexGeometry(const BoundaryGrid::Quad& q) explicit HexGeometry(const BoundaryGrid::Quad& q)
{ {
for (int i=0;i<4;++i) for (int i=0;i<4;++i)
c[i] = q.v[i].c; c[i] = q.v[i].c;
@ -489,19 +489,19 @@ class HexGeometry<2, cdim, GridImp>
//! \brief Find the vertex in the vector with minimum X and minimum Y //! \brief Find the vertex in the vector with minimum X and minimum Y
//! \returns The requested vertex //! \returns The requested vertex
BoundaryGrid::Vertex minXminY(std::vector<BoundaryGrid::Vertex>& in); BoundaryGrid::Vertex minXminY(const std::vector<BoundaryGrid::Vertex>& in);
//! \brief Find the vertex in the vector with maximum X and minimum Y //! \brief Find the vertex in the vector with maximum X and minimum Y
//! \returns The requested vertex //! \returns The requested vertex
BoundaryGrid::Vertex maxXminY(std::vector<BoundaryGrid::Vertex>& in); BoundaryGrid::Vertex maxXminY(const std::vector<BoundaryGrid::Vertex>& in);
//! \brief Find the vertex in the vector with maximum X and maximum Y //! \brief Find the vertex in the vector with maximum X and maximum Y
//! \returns The requested vertex //! \returns The requested vertex
BoundaryGrid::Vertex maxXmaxY(std::vector<BoundaryGrid::Vertex>& in); BoundaryGrid::Vertex maxXmaxY(const std::vector<BoundaryGrid::Vertex>& in);
//! \brief Find the vertex in the vector with minimum X and maximum Y //! \brief Find the vertex in the vector with minimum X and maximum Y
//! \returns The requested vertex //! \returns The requested vertex
BoundaryGrid::Vertex minXmaxY(std::vector<BoundaryGrid::Vertex>& in); BoundaryGrid::Vertex minXmaxY(const std::vector<BoundaryGrid::Vertex>& in);
} }
} }

View File

@ -29,7 +29,7 @@ class Elasticity {
//! \brief Default constructor //! \brief Default constructor
//! \param[in] gv_ The grid we are doing the calculations on //! \param[in] gv_ The grid we are doing the calculations on
Elasticity(const GridType& gv_) : gv(gv_) {} explicit Elasticity(const GridType& gv_) : gv(gv_) {}
//! \brief Returns the B matrix in a quadrature point //! \brief Returns the B matrix in a quadrature point
//! \param[in] point (Reference) coordinates of quadrature point //! \param[in] point (Reference) coordinates of quadrature point

View File

@ -726,10 +726,10 @@ IMPL_FUNC(void, loadMaterialsFromRocklist(const std::string& file,
if (Escale > 0) { if (Escale > 0) {
Emin=1e10; Emin=1e10;
for (size_t i=0;i<cache.size();++i) for (size_t i=0;i<cache.size();++i)
Emin = std::min(Emin,((Isotropic*)cache[i].get())->getE()); Emin = std::min(Emin,static_cast<Isotropic*>(cache[i].get())->getE());
for (size_t i=0;i<cache.size();++i) { for (size_t i=0;i<cache.size();++i) {
double lE = ((Isotropic*)cache[i].get())->getE(); double lE = static_cast<Isotropic*>(cache[i].get())->getE();
((Isotropic*)cache[i].get())->setE(lE*Escale/Emin); static_cast<Isotropic*>(cache[i].get())->setE(lE*Escale/Emin);
} }
} }
std::vector<double> volume; std::vector<double> volume;
@ -1084,7 +1084,7 @@ IMPL_FUNC(void, solve(int loadcase))
tsolver[solver]->apply(u[loadcase], b[loadcase], r); tsolver[solver]->apply(u[loadcase], b[loadcase], r);
std::cout << "\tsolution norm: " << u[loadcase].two_norm() << std::endl; std::cout << "\tsolution norm: " << u[loadcase].two_norm() << std::endl;
} catch (Dune::ISTLError& e) { } catch (const Dune::ISTLError& e) {
std::cerr << "exception thrown " << e << std::endl; std::cerr << "exception thrown " << e << std::endl;
} }
} }

View File

@ -19,8 +19,7 @@
#include <opm/common/utility/platform_dependent/reenable_warnings.h> #include <opm/common/utility/platform_dependent/reenable_warnings.h>
namespace Opm { namespace Opm::Elasticity {
namespace Elasticity {
/*! /*!
@ -43,6 +42,7 @@ protected:
{ {
return os; return os;
} }
public: public:
//! \brief Empty virtual destructor. //! \brief Empty virtual destructor.
virtual ~Material() {} virtual ~Material() {}
@ -95,12 +95,12 @@ public:
//! \param[in] ID ID of the material //! \param[in] ID ID of the material
//! \param[in] file The URL to the rocklist //! \param[in] file The URL to the rocklist
static Material* create(int ID, const std::string& file); static Material* create(int ID, const std::string& file);
private: private:
int id; //!< External material number int id; //!< External material number
double rho; //!< Mass density double rho; //!< Mass density
}; };
} } // namespace Opm::Elasticity
}
#endif #endif

View File

@ -14,9 +14,7 @@
#include "material.hh" #include "material.hh"
namespace Opm::Elasticity {
namespace Opm {
namespace Elasticity {
/*! /*!
\brief Isotropic linear elastic material. \brief Isotropic linear elastic material.
@ -38,16 +36,16 @@ public:
} }
//! \brief Empty virtual destructor. //! \brief Empty virtual destructor.
virtual ~Isotropic() {} ~Isotropic() override {}
//! \brief Returns the number of parameters describing this material. //! \brief Returns the number of parameters describing this material.
virtual int numPar() const int numPar() const override
{ {
return 2; return 2;
} }
//! \brief Returns the \a ipar'th parameter describing this material. //! \brief Returns the \a ipar'th parameter describing this material.
virtual double getPar(int ipar = 1) const double getPar(int ipar = 1) const override
{ {
return ipar == 1 ? E : nu; return ipar == 1 ? E : nu;
} }
@ -68,17 +66,18 @@ public:
//! \brief Establishes the full constitutive matrix for this material. //! \brief Establishes the full constitutive matrix for this material.
//! \param[out] C The constitutive matrix //! \param[out] C The constitutive matrix
//! \param[in] invers If \e true, set up the inverse matrix instead //! \param[in] invers If \e true, set up the inverse matrix instead
virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C, bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C,
bool invers = false) const; bool invers = false) const override;
//! \brief Establishes the full constitutive matrix for this material. //! \brief Establishes the full constitutive matrix for this material.
//! \param[out] C The constitutive matrix //! \param[out] C The constitutive matrix
//! \param[in] invers If \e true, set up the inverse matrix instead //! \param[in] invers If \e true, set up the inverse matrix instead
virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C, bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C,
bool invers = false) const; bool invers = false) const override;
protected: protected:
//! \brief Prints the material properties to a stream. //! \brief Prints the material properties to a stream.
virtual std::ostream& write(std::ostream& os) const; std::ostream& write(std::ostream& os) const override;
private: private:
double E; //!< Young's modulus double E; //!< Young's modulus
@ -101,32 +100,32 @@ public:
double Gxy, double Gxz = double(-1), double Gyz = double(-1)); double Gxy, double Gxz = double(-1), double Gyz = double(-1));
//! \brief Empty virtual destructor. //! \brief Empty virtual destructor.
virtual ~OrthotropicD() {} ~OrthotropicD() override {}
//! \brief Returns the number of parameters describing this material. //! \brief Returns the number of parameters describing this material.
virtual int numPar() const int numPar() const override
{ {
return 6; return 6;
} }
//! \brief Returns the \a ipar'th parameter describing this material. //! \brief Returns the \a ipar'th parameter describing this material.
virtual double getPar(int ipar = 1) const; double getPar(int ipar = 1) const override;
//! \brief Establishes the full constitutive matrix for this material. //! \brief Establishes the full constitutive matrix for this material.
//! \param[out] C The constitutive matrix //! \param[out] C The constitutive matrix
//! \param[in] invers If \e true, set up the inverse matrix instead //! \param[in] invers If \e true, set up the inverse matrix instead
virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C, bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C,
bool invers = false) const; bool invers = false) const override;
//! \brief Establishes the full constitutive matrix for this material. //! \brief Establishes the full constitutive matrix for this material.
//! \param[out] C The constitutive matrix //! \param[out] C The constitutive matrix
//! \param[in] invers If \e true, set up the inverse matrix instead //! \param[in] invers If \e true, set up the inverse matrix instead
virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C, bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C,
bool invers = false) const; bool invers = false) const override;
protected: protected:
//! \brief Prints the material properties to a stream. //! \brief Prints the material properties to a stream.
virtual std::ostream& write(std::ostream& os) const; std::ostream& write(std::ostream& os) const override;
private: private:
double E[6]; //!< The diagonal of the constitutive matrix double E[6]; //!< The diagonal of the constitutive matrix
@ -142,37 +141,37 @@ public:
OrthotropicSym(int ID, const Dune::DynamicVector<double>& Cu); OrthotropicSym(int ID, const Dune::DynamicVector<double>& Cu);
//! \brief Empty virtual destructor. //! \brief Empty virtual destructor.
virtual ~OrthotropicSym() {} ~OrthotropicSym() override {}
//! \brief Returns the number of parameters describing this material. //! \brief Returns the number of parameters describing this material.
virtual int numPar() const int numPar() const override
{ {
return 21; return 21;
} }
//! \brief Returns the \a ipar'th parameter describing this material. //! \brief Returns the \a ipar'th parameter describing this material.
virtual double getPar(int ipar = 1) const; double getPar(int ipar = 1) const override;
//! \brief Establishes the full constitutive matrix for this material. //! \brief Establishes the full constitutive matrix for this material.
//! \param[out] C The constitutive matrix //! \param[out] C The constitutive matrix
//! \param[in] invers If \e true, set up the inverse matrix instead //! \param[in] invers If \e true, set up the inverse matrix instead
virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C, bool getConstitutiveMatrix(Dune::FieldMatrix<double,6,6>& C,
bool invers = false) const; bool invers = false) const override;
//! \brief Establishes the full constitutive matrix for this material. //! \brief Establishes the full constitutive matrix for this material.
//! \param[out] C The constitutive matrix //! \param[out] C The constitutive matrix
//! \param[in] invers If \e true, set up the inverse matrix instead //! \param[in] invers If \e true, set up the inverse matrix instead
virtual bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C, bool getConstitutiveMatrix(Dune::FieldMatrix<double,3,3>& C,
bool invers = false) const; bool invers = false) const override;
protected: protected:
//! \brief Prints the material properties to a stream. //! \brief Prints the material properties to a stream.
virtual std::ostream& write(std::ostream& os) const; std::ostream& write(std::ostream& os) const override;
private: private:
double Cupper[21]; //!< Upper triangle of the symmetric constitutive matrix double Cupper[21]; //!< Upper triangle of the symmetric constitutive matrix
}; };
} } // namespace Opm::Elasticity
}
#endif #endif

View File

@ -30,7 +30,7 @@ class MeshColorizer {
public: public:
//! \brief Default constructor //! \brief Default constructor
//! \param[in] grid_ The grid to colorize //! \param[in] grid_ The grid to colorize
MeshColorizer(const GridType& grid_) : explicit MeshColorizer(const GridType& grid_) :
grid(grid_) grid(grid_)
{ {
calcGroups(); calcGroups();

View File

@ -150,7 +150,7 @@ class TensorProductFunction
//! \brief Construct a tensor-product function //! \brief Construct a tensor-product function
//! \param[in] funcs_ The functions //! \param[in] funcs_ The functions
TensorProductFunction(const Dune::FieldVector<ftype, dim>& funcs_) explicit TensorProductFunction(const Dune::FieldVector<ftype, dim>& funcs_)
: funcs(funcs_) {} : funcs(funcs_) {}
//! \brief Evaluate the function //! \brief Evaluate the function
@ -279,7 +279,7 @@ public:
PNShapeFunctionSet(int n1, int n2, int n3=0) PNShapeFunctionSet(int n1, int n2, int n3=0)
{ {
int dims[3] = {n1, n2, n3}; const int dims[3] = {n1, n2, n3};
cfuncs.resize(dim); cfuncs.resize(dim);
for (int i=0; i < dim; ++i) { for (int i=0; i < dim; ++i) {
std::vector<double> grid; std::vector<double> grid;

View File

@ -248,7 +248,7 @@ namespace Opm
{ {
} }
PeriodicConditionHandler(int num_different_boundary_ids) explicit PeriodicConditionHandler(int num_different_boundary_ids)
: periodic_partner_bid_(num_different_boundary_ids, 0), : periodic_partner_bid_(num_different_boundary_ids, 0),
canonical_bid_(num_different_boundary_ids, 0) canonical_bid_(num_different_boundary_ids, 0)
{ {
@ -333,7 +333,7 @@ namespace Opm
{ {
public: public:
DummyVec() {} DummyVec() {}
DummyVec(int) {} explicit DummyVec(int) {}
void resize(int) {} void resize(int) {}
void clear() {} void clear() {}
}; };
@ -356,7 +356,7 @@ namespace Opm
{ {
} }
BasicBoundaryConditions(int num_different_boundary_ids) explicit BasicBoundaryConditions(int num_different_boundary_ids)
: PeriodicConditionHandler(num_different_boundary_ids), : PeriodicConditionHandler(num_different_boundary_ids),
FlowConds(num_different_boundary_ids), FlowConds(num_different_boundary_ids),
SatConds(num_different_boundary_ids), SatConds(num_different_boundary_ids),

View File

@ -51,7 +51,7 @@ namespace Opm {
template <int np = 2> template <int np = 2>
class ReservoirState { class ReservoirState {
public: public:
ReservoirState(const UnstructuredGrid* g) explicit ReservoirState(const UnstructuredGrid* g)
: press_ (g->number_of_cells), : press_ (g->number_of_cells),
fpress_(g->number_of_faces), fpress_(g->number_of_faces),
flux_ (g->number_of_faces), flux_ (g->number_of_faces),
@ -114,7 +114,7 @@ namespace Opm {
class TwophaseFluidWrapper { class TwophaseFluidWrapper {
public: public:
TwophaseFluidWrapper(const Opm::ReservoirPropertyCapillary<3>& r) explicit TwophaseFluidWrapper(const Opm::ReservoirPropertyCapillary<3>& r)
: r_(r) : r_(r)
{} {}

View File

@ -45,7 +45,7 @@ namespace Opm {
template <class Mobility> template <class Mobility>
class ReservoirPropertyFixedMobility { class ReservoirPropertyFixedMobility {
public: public:
ReservoirPropertyFixedMobility(const std::vector<Mobility>& mobs) explicit ReservoirPropertyFixedMobility(const std::vector<Mobility>& mobs)
: mobs_(mobs) : mobs_(mobs)
{ {
} }

View File

@ -323,7 +323,7 @@ namespace Opm
std::cout << "Seconds taken by transport solver: " << clock.secsSinceStart() << std::endl; std::cout << "Seconds taken by transport solver: " << clock.secsSinceStart() << std::endl;
#endif // VERBOSE #endif // VERBOSE
{ {
std::vector<double>& sat = state.saturation(); const std::vector<double>& sat = state.saturation();
for (int i=0; i < mygrid_.numCells(); ++i){ for (int i=0; i < mygrid_.numCells(); ++i){
saturation[i] = sat[2*i]; saturation[i] = sat[2*i];
} }

View File

@ -201,7 +201,7 @@ namespace Opm
s.preservoir_properties_->phaseMobility(triv_phase, cell[ups_cell], s.preservoir_properties_->phaseMobility(triv_phase, cell[ups_cell],
cell_sat[ups_cell], m_ups[triv_phase].mob); cell_sat[ups_cell], m_ups[triv_phase].mob);
// Compute gravity flow of the nontrivial phase. // Compute gravity flow of the nontrivial phase.
double sign_G[2] = { -1.0, 1.0 }; const double sign_G[2] = { -1.0, 1.0 };
double grav_flux_nontriv = sign_G[triv_phase]*loc_area double grav_flux_nontriv = sign_G[triv_phase]*loc_area
*inner(loc_normal, m_ups[triv_phase].multiply(grav_influence)); *inner(loc_normal, m_ups[triv_phase].multiply(grav_influence));
// Find flow direction of nontrivial phase. // Find flow direction of nontrivial phase.
@ -289,7 +289,7 @@ namespace Opm
struct IndirectRange struct IndirectRange
{ {
typedef Iter Iterator; typedef Iter Iterator;
IndirectRange(const std::vector<Iter>& iters) explicit IndirectRange(const std::vector<Iter>& iters)
: iters_(iters), beg_(0), end_(iters_.size() - 1) : iters_(iters), beg_(0), end_(iters_.size() - 1)
{ {
assert(iters_.size() >= 2); assert(iters_.size() >= 2);
@ -329,7 +329,7 @@ namespace Opm
template <class Updater> template <class Updater>
struct UpdateLoopBody struct UpdateLoopBody
{ {
UpdateLoopBody(const Updater& upd) explicit UpdateLoopBody(const Updater& upd)
: updater(upd) : updater(upd)
{ {
} }

View File

@ -699,7 +699,7 @@ namespace Opm {
class FaceFluxes class FaceFluxes
{ {
public: public:
FaceFluxes(int sz) explicit FaceFluxes(int sz)
: fluxes_(sz, 0.0), visited_(sz, 0), max_modification_(0.0) : fluxes_(sz, 0.0), visited_(sz, 0), max_modification_(0.0)
{ {
} }

View File

@ -111,7 +111,7 @@ namespace Opm {
/// in the model. Used to set the size of certain internal /// in the model. Used to set the size of certain internal
/// working std::arrays. A cell with @f$n_f@f$ faces results in /// working std::arrays. A cell with @f$n_f@f$ faces results in
/// an inner product matrix of size @f$n_f \times n_f@f$. /// an inner product matrix of size @f$n_f \times n_f@f$.
MimeticIPAnisoRelpermEvaluator(const int max_nf) explicit MimeticIPAnisoRelpermEvaluator(const int max_nf)
: max_nf_ (max_nf ), : max_nf_ (max_nf ),
fa_ (max_nf * max_nf), fa_ (max_nf * max_nf),
t1_ (max_nf * dim ), t1_ (max_nf * dim ),

View File

@ -115,7 +115,7 @@ namespace Opm {
/// in the model. Used to set the size of certain internal /// in the model. Used to set the size of certain internal
/// working std::arrays. A cell with @f$n_f@f$ faces results in /// working std::arrays. A cell with @f$n_f@f$ faces results in
/// an inner product matrix of size @f$n_f \times n_f@f$. /// an inner product matrix of size @f$n_f \times n_f@f$.
MimeticIPEvaluator(const int max_nf) explicit MimeticIPEvaluator(const int max_nf)
: max_nf_(max_nf ), : max_nf_(max_nf ),
fa_ (max_nf * max_nf), fa_ (max_nf * max_nf),
t1_ (max_nf * dim ), t1_ (max_nf * dim ),

View File

@ -39,7 +39,7 @@ namespace Opm
class CornerPointChopper class CornerPointChopper
{ {
public: public:
CornerPointChopper(const std::string& file) : explicit CornerPointChopper(const std::string& file) :
parser_(Parser{}), parser_(Parser{}),
deck_(parser_.parseFile(file)), deck_(parser_.parseFile(file)),
metricUnits_(Opm::UnitSystem::newMETRIC()) metricUnits_(Opm::UnitSystem::newMETRIC())
@ -217,22 +217,22 @@ namespace Opm
new_ZCORN_.resize(8*new_dims_[0]*new_dims_[1]*new_dims_[2], 1e100); new_ZCORN_.resize(8*new_dims_[0]*new_dims_[1]*new_dims_[2], 1e100);
new_to_old_cell_.resize(new_dims_[0]*new_dims_[1]*new_dims_[2], -1); new_to_old_cell_.resize(new_dims_[0]*new_dims_[1]*new_dims_[2], -1);
int cellcount = 0; int cellcount = 0;
int delta[3] = { 1, 2*dims_[0], 4*dims_[0]*dims_[1] }; const int delta[3] = { 1, 2*dims_[0], 4*dims_[0]*dims_[1] };
int new_delta[3] = { 1, 2*new_dims_[0], 4*new_dims_[0]*new_dims_[1] }; const int new_delta[3] = { 1, 2*new_dims_[0], 4*new_dims_[0]*new_dims_[1] };
for (int k = kmin; k < kmax; ++k) { for (int k = kmin; k < kmax; ++k) {
for (int j = jmin; j < jmax; ++j) { for (int j = jmin; j < jmax; ++j) {
for (int i = imin; i < imax; ++i) { for (int i = imin; i < imax; ++i) {
new_to_old_cell_[cellcount++] = dims_[0]*dims_[1]*k + dims_[0]*j + i; new_to_old_cell_[cellcount++] = dims_[0]*dims_[1]*k + dims_[0]*j + i;
int old_ix = 2*(i*delta[0] + j*delta[1] + k*delta[2]); int old_ix = 2*(i*delta[0] + j*delta[1] + k*delta[2]);
int new_ix = 2*((i-imin)*new_delta[0] + (j-jmin)*new_delta[1] + (k-kmin)*new_delta[2]); int new_ix = 2*((i-imin)*new_delta[0] + (j-jmin)*new_delta[1] + (k-kmin)*new_delta[2]);
int old_indices[8] = { old_ix, old_ix + delta[0], const int old_indices[8] = {old_ix, old_ix + delta[0],
old_ix + delta[1], old_ix + delta[1] + delta[0], old_ix + delta[1], old_ix + delta[1] + delta[0],
old_ix + delta[2], old_ix + delta[2] + delta[0], old_ix + delta[2], old_ix + delta[2] + delta[0],
old_ix + delta[2] + delta[1], old_ix + delta[2] + delta[1] + delta[0] }; old_ix + delta[2] + delta[1], old_ix + delta[2] + delta[1] + delta[0] };
int new_indices[8] = { new_ix, new_ix + new_delta[0], const int new_indices[8] = {new_ix, new_ix + new_delta[0],
new_ix + new_delta[1], new_ix + new_delta[1] + new_delta[0], new_ix + new_delta[1], new_ix + new_delta[1] + new_delta[0],
new_ix + new_delta[2], new_ix + new_delta[2] + new_delta[0], new_ix + new_delta[2], new_ix + new_delta[2] + new_delta[0],
new_ix + new_delta[2] + new_delta[1], new_ix + new_delta[2] + new_delta[1] + new_delta[0] }; new_ix + new_delta[2] + new_delta[1], new_ix + new_delta[2] + new_delta[1] + new_delta[0] };
for (int cc = 0; cc < 8; ++cc) { for (int cc = 0; cc < 8; ++cc) {
new_ZCORN_[new_indices[cc]] = std::min(zmax, std::max(zmin, ZCORN[old_indices[cc]])) - z_origin_correction; new_ZCORN_[new_indices[cc]] = std::min(zmax, std::max(zmin, ZCORN[old_indices[cc]])) - z_origin_correction;
} }

View File

@ -40,7 +40,6 @@
#include <opm/porsol/euler/EulerUpstream.hpp> #include <opm/porsol/euler/EulerUpstream.hpp>
#include <opm/porsol/euler/ImplicitCapillarity.hpp> #include <opm/porsol/euler/ImplicitCapillarity.hpp>
#include <opm/grid/common/GridAdapter.hpp> #include <opm/grid/common/GridAdapter.hpp>
#include <array>
namespace Opm namespace Opm
{ {
@ -100,7 +99,7 @@ namespace Opm
protected: protected:
// ------- Typedefs ------- // ------- Typedefs -------
typedef typename Traits::template TransportSolver<GridInterface, typename Super::BCs>::Type TransportSolver; typedef typename Traits::template TransportSolver<GridInterface, typename Super::BCs>::Type TransportSolver;
// ------- Methods ------- // ------- Methods -------
template <class FlowSol> template <class FlowSol>
@ -109,8 +108,7 @@ namespace Opm
const FlowSol& flow_solution, const FlowSol& flow_solution,
const std::vector<double>& saturations) const; const std::vector<double>& saturations) const;
/// Override from superclass. /// Override from superclass.
virtual void initImpl(const Opm::ParameterGroup& param); void initImpl(const Opm::ParameterGroup& param) override;
// ------- Data members ------- // ------- Data members -------
std::vector<double> last_saturation_state_; std::vector<double> last_saturation_state_;

View File

@ -233,7 +233,6 @@ namespace Opm
double ecl_time = 0.0; double ecl_time = 0.0;
std::vector<double> ecl_sat; std::vector<double> ecl_sat;
std::vector<double> ecl_press; std::vector<double> ecl_press;
std::vector<double> init_saturation(saturation);
while ((!stationary) && (it_count < max_it_)) { // && transport_cost < max_transport_cost_) while ((!stationary) && (it_count < max_it_)) { // && transport_cost < max_transport_cost_)
// Run transport solver. // Run transport solver.
std::cout << "Running transport step " << it_count << " with stepsize " std::cout << "Running transport step " << it_count << " with stepsize "
@ -242,7 +241,6 @@ namespace Opm
this->flow_solver_.getSolution(), injection); this->flow_solver_.getSolution(), injection);
// Run pressure solver. // Run pressure solver.
if (converged) { if (converged) {
init_saturation = saturation;
// this->flow_solver_.solve(this->res_prop_, saturation, this->bcond_, src, // this->flow_solver_.solve(this->res_prop_, saturation, this->bcond_, src,
// this->residual_tolerance_, this->linsolver_verbosity_, this->linsolver_type_); // this->residual_tolerance_, this->linsolver_verbosity_, this->linsolver_type_);
// max_mod = this->flow_solver_.postProcessFluxes(); // max_mod = this->flow_solver_.postProcessFluxes();
@ -324,7 +322,6 @@ namespace Opm
} }
} else { } else {
std::cerr << "Cutting time step\n"; std::cerr << "Cutting time step\n";
init_saturation = saturation_old;
stepsize=stepsize/2.0; stepsize=stepsize/2.0;
} }
++it_count; ++it_count;
@ -466,9 +463,6 @@ namespace Opm
double side1_flux_oil = 0.0; double side1_flux_oil = 0.0;
double side2_flux_oil = 0.0; double side2_flux_oil = 0.0;
std::map<int, double> frac_flow_by_bid; std::map<int, double> frac_flow_by_bid;
int num_cells = this->ginterf_.numberOfCells();
std::vector<double> cell_inflows_w(num_cells, 0.0);
std::vector<double> cell_outflows_w(num_cells, 0.0);
// Two passes: First pass, deal with outflow, second pass, deal with inflow. // Two passes: First pass, deal with outflow, second pass, deal with inflow.
// This is for the periodic case, so that we are sure all fractional flows have // This is for the periodic case, so that we are sure all fractional flows have
@ -497,7 +491,6 @@ namespace Opm
assert(sc.isDirichlet()); assert(sc.isDirichlet());
frac_flow = this->res_prop_.fractionalFlow(c->index(), sc.saturation()); frac_flow = this->res_prop_.fractionalFlow(c->index(), sc.saturation());
} }
cell_inflows_w[c->index()] += flux*frac_flow;
side1_flux += flux*frac_flow; side1_flux += flux*frac_flow;
side1_flux_oil += flux*(1.0 - frac_flow); side1_flux_oil += flux*(1.0 - frac_flow);
} else if (flux >= 0.0 && pass == 0) { } else if (flux >= 0.0 && pass == 0) {
@ -507,7 +500,6 @@ namespace Opm
frac_flow_by_bid[f->boundaryId()] = frac_flow; frac_flow_by_bid[f->boundaryId()] = frac_flow;
// std::cout << "Inserted bid " << f->boundaryId() << std::endl; // std::cout << "Inserted bid " << f->boundaryId() << std::endl;
} }
cell_outflows_w[c->index()] += flux*frac_flow;
side2_flux += flux*frac_flow; side2_flux += flux*frac_flow;
side2_flux_oil += flux*(1.0 - frac_flow); side2_flux_oil += flux*(1.0 - frac_flow);
} }