diff --git a/examples/SimulatorTesterFlexibleBC.hpp b/examples/SimulatorTesterFlexibleBC.hpp index a80a321..f57075e 100644 --- a/examples/SimulatorTesterFlexibleBC.hpp +++ b/examples/SimulatorTesterFlexibleBC.hpp @@ -51,12 +51,12 @@ namespace Opm typedef typename Super::GridInterface GI; typedef typename Super::Vector Vector; - virtual void initSources(const Opm::ParameterGroup& param) + void initSources(const Opm::ParameterGroup& param) override { // Zero-initializing first. int nc = this->ginterf_.numberOfCells(); - this->injection_rates_ = Opm::SparseVector(nc); - this->injection_rates_psolver_.resize(nc, 0.0); + this->injection_rates_ = Opm::SparseVector(nc); + this->injection_rates_psolver_.resize(nc, 0.0); // this->injection_rates_.addElement(1.0, 0); // this->injection_rates_psolver_[0] = 1.0; @@ -99,10 +99,10 @@ namespace Opm } } - virtual void initBoundaryConditions(const Opm::ParameterGroup& param) - { - setupBoundaryConditions(param, this->ginterf_, this->bcond_); - } + void initBoundaryConditions(const Opm::ParameterGroup& param) override + { + setupBoundaryConditions(param, this->ginterf_, this->bcond_); + } private: bool isInside(const Vector& low, const Vector& high, const Vector& pt) diff --git a/examples/known_answer_test.cpp b/examples/known_answer_test.cpp index 6fbd277..c8f483e 100644 --- a/examples/known_answer_test.cpp +++ b/examples/known_answer_test.cpp @@ -99,7 +99,7 @@ namespace Opm class FunctionBoundaryConditions : public PeriodicConditionHandler { public: - FunctionBoundaryConditions(BoundaryFunc bfunc) + explicit FunctionBoundaryConditions(BoundaryFunc bfunc) : bfunc_(bfunc) { } diff --git a/examples/upscale_cap.cpp b/examples/upscale_cap.cpp index 0e90633..2e66bc2 100644 --- a/examples/upscale_cap.cpp +++ b/examples/upscale_cap.cpp @@ -160,13 +160,6 @@ try // 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 for options. diff --git a/examples/upscale_cond.cpp b/examples/upscale_cond.cpp index 3aa6e70..476ad12 100644 --- a/examples/upscale_cond.cpp +++ b/examples/upscale_cond.cpp @@ -214,12 +214,6 @@ try 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 for options. @@ -360,8 +354,10 @@ try Jtmp = MonotCubicInterpolator(vararg[JFindex + i], 1, jFunctionCurve); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << endl; - if (isMaster) cerr << "Check filename and -jFunctionCurve" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << endl + << "Check filename and -jFunctionCurve" << endl; + } usageandexit(); } @@ -394,8 +390,10 @@ try Jtmp = MonotCubicInterpolator(vararg[JFindex], 1, jFunctionCurve); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << endl; - if (isMaster) cerr << "Check filename and -jFunctionCurve" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << endl + << "Check filename and -jFunctionCurve" << endl; + } usageandexit(); } @@ -528,8 +526,10 @@ try ++tesselatedCells; // keep count. } - if (isMaster) cout << "Pcmin: " << Pcmin << endl; - if (isMaster) cout << "Pcmax: " << Pcmax << endl; + if (isMaster) { + cout << "Pcmin: " << Pcmin << endl + << "Pcmax: " << Pcmax << endl; + } if (Pcmin > Pcmax) { if (isMaster) cerr << "ERROR: No legal capillary pressures found for this system. Exiting..." << endl; diff --git a/examples/upscale_elasticity.cpp b/examples/upscale_elasticity.cpp index 66e1ab1..a66acb3 100644 --- a/examples/upscale_elasticity.cpp +++ b/examples/upscale_elasticity.cpp @@ -202,9 +202,8 @@ void writeOutput(const Params& p, Opm::time::StopWatch& watch, int cells, { // get current time time_t rawtime; - struct tm* timeinfo; time(&rawtime); - timeinfo = localtime(&rawtime); + const struct tm* timeinfo = localtime(&rawtime); // get hostname char hostname[1024]; @@ -444,7 +443,7 @@ int run(Params& p) return 0; } - catch (Dune::Exception &e) { + catch (const Dune::Exception &e) { throw e; } catch (...) { @@ -496,7 +495,7 @@ try return runAMG(p); else return runAMG(p); - } catch (Dune::Exception &e) { + } catch (const Dune::Exception &e) { std::cerr << "Dune reported error: " << e << std::endl; } catch (const std::exception &e) { throw e; diff --git a/examples/upscale_relperm.cpp b/examples/upscale_relperm.cpp index f125525..4069c97 100644 --- a/examples/upscale_relperm.cpp +++ b/examples/upscale_relperm.cpp @@ -470,13 +470,6 @@ try */ 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. */ diff --git a/examples/upscale_relpermvisc.cpp b/examples/upscale_relpermvisc.cpp index b913d65..bec02af 100644 --- a/examples/upscale_relpermvisc.cpp +++ b/examples/upscale_relpermvisc.cpp @@ -365,8 +365,10 @@ try anisotropic_input = true; permys = deck["PERMY"].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) cout << " Options -relPermCurve and -jFunctionCurve is meaningless.\n"; + if (isMaster) { + 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]); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; - if (isMaster) cerr << "Check filename and -waterCurve" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl + << "Check filename and -waterCurve" << endl; + } usageandexit(); } if (!Krwtmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } MonotCubicInterpolator Krotmp; @@ -527,27 +533,35 @@ try Krotmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[oilPhaseIndex]); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; - if (isMaster) cerr << "Check filename and -oilCurve" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl + << "Check filename and -oilCurve" << endl; + } usageandexit(); } if (!Krotmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } 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(); } Krw.push_back(Krwtmp); Kro.push_back(Krotmp); - if (isMaster) cout << "Loaded rock file: " << ROCKFILENAME - << ", for stone type " << i+1 << endl; + if (isMaster) { + cout << "Loaded rock file: " << ROCKFILENAME + << ", for stone type " << i+1 << endl; + } rockTypeNames.push_back(ROCKFILENAME); } @@ -557,7 +571,9 @@ try // Check if rock files exists and is readable: ifstream rockfile(ROCKFILENAME, ios::in); 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(); } rockfile.close(); @@ -566,13 +582,17 @@ try Krwtmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[waterPhaseIndex]); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; - if (isMaster) cerr << "Check filename and -waterCurve" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl + << "Check filename and -waterCurve" << endl; + } usageandexit(); } if (!Krwtmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << relPermCurves[waterPhaseIndex] << " of file " << ROCKFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } MonotCubicInterpolator Krotmp; @@ -580,17 +600,23 @@ try Krotmp = MonotCubicInterpolator(ROCKFILENAME, 1, relPermCurves[oilPhaseIndex]); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl; - if (isMaster) cerr << "Check filename and -oilCurve" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << ROCKFILENAME << endl + << "Check filename and -oilCurve" << endl; + } usageandexit(); } if (!Krotmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << relPermCurves[oilPhaseIndex] << " of file " << ROCKFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } 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(); } 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); } - if (isMaster) cout << "Loaded rock file: " << ROCKFILENAME - << ", for all stone types" << endl; + if (isMaster) { + cout << "Loaded rock file: " << ROCKFILENAME + << ", for all stone types" << endl; + } } else { cerr << "Error: Wrong number of stone-functions provided. " << endl @@ -623,12 +651,16 @@ try ifstream waterfile(WATERFILENAME, ios::in); ifstream oilfile(OILFILENAME, ios::in); 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(); } waterfile.close(); 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(); } oilfile.close(); @@ -640,23 +672,31 @@ try Krwztmp = MonotCubicInterpolator(WATERFILENAME, 2, 5); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl; - if (isMaster) cerr << "Check filename and relpermcurves" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl + << "Check filename and relpermcurves" << endl; + } usageandexit(); } if (!Krwxtmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Krwytmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Krwztmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } try { @@ -665,29 +705,39 @@ try Kroztmp = MonotCubicInterpolator(OILFILENAME, 2, 5); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl; - if (isMaster) cerr << "Check filename and relpermcurves" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl + << "Check filename and relpermcurves" << endl; + } usageandexit(); } if (!Kroxtmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Kroytmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Kroztmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } Krwx.push_back(Krwxtmp); Krwy.push_back(Krwytmp); Krwz.push_back(Krwztmp); Krox.push_back(Kroxtmp); Kroy.push_back(Kroytmp); Kroz.push_back(Kroztmp); - if (isMaster) cout << "Loaded rock files: " << WATERFILENAME << " and " - << OILFILENAME << ", for stone type " << rockidx << endl; + if (isMaster) { + cout << "Loaded rock files: " << WATERFILENAME << " and " + << OILFILENAME << ", for stone type " << rockidx << endl; + } rockTypeNames.push_back(WATERFILENAME); rockTypeNames.push_back(OILFILENAME); } @@ -699,12 +749,16 @@ try ifstream waterfile(WATERFILENAME, ios::in); ifstream oilfile(OILFILENAME, ios::in); 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(); } waterfile.close(); 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(); } oilfile.close(); @@ -715,23 +769,31 @@ try Krwztmp = MonotCubicInterpolator(WATERFILENAME, 2, 5); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl; - if (isMaster) cerr << "Check filename and relpermcurves" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << WATERFILENAME << endl + << "Check filename and relpermcurves" << endl; + } usageandexit(); } if (!Krwxtmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 3 << " of file " << WATERFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Krwytmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 4 << " of file " << WATERFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Krwztmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 5 << " of file " << WATERFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } MonotCubicInterpolator Kroxtmp, Kroytmp, Kroztmp; @@ -741,23 +803,31 @@ try Kroztmp = MonotCubicInterpolator(OILFILENAME, 2, 5); } catch (const char * errormessage) { - if (isMaster) cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl; - if (isMaster) cerr << "Check filename and relpermcurves" << endl; + if (isMaster) { + cerr << "Error: " << errormessage << " Filename: " << OILFILENAME << endl + << "Check filename and relpermcurves" << endl; + } usageandexit(); } if (!Kroxtmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 3 << " of file " << OILFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Kroytmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 4 << " of file " << OILFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } if (!Kroztmp.isStrictlyMonotone()) { - if (isMaster) cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl << - " was not strictly monotone. Exiting." << endl; + if (isMaster) { + cerr << "Error: Data in column " << 5 << " of file " << OILFILENAME << endl << + " was not strictly monotone. Exiting." << endl; + } usageandexit(); } for (int i=0 ; i < 2*stone_types; i+=2) { @@ -766,9 +836,10 @@ try rockTypeNames.push_back(WATERFILENAME); rockTypeNames.push_back(OILFILENAME); } - if (isMaster) cout << "Loaded rock files: " << WATERFILENAME << " and " - << OILFILENAME << ", for all stone types" << endl; - + if (isMaster) { + cout << "Loaded rock files: " << WATERFILENAME << " and " + << OILFILENAME << ", for all stone types" << endl; + } } else { cerr << "Error: Wrong number of stone-functions provided. " << endl @@ -892,7 +963,9 @@ try Swir = 0.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(); } @@ -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 // (i.e., populate the vector WaterSaturationVsFractionalFlow) @@ -1048,7 +1123,9 @@ try // Check for saneness of 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 } diff --git a/opm/core/transport/implicit/ImplicitAssembly.hpp b/opm/core/transport/implicit/ImplicitAssembly.hpp index 705af10..b6facff 100644 --- a/opm/core/transport/implicit/ImplicitAssembly.hpp +++ b/opm/core/transport/implicit/ImplicitAssembly.hpp @@ -46,7 +46,7 @@ namespace Opm { enum { DofPerCell = Model::DofPerCell }; public: - ImplicitAssembly(Model& model) + explicit ImplicitAssembly(Model& model) : model_(model), nconn_(-1) , asm_buffer_() diff --git a/opm/core/transport/implicit/ImplicitTransport.hpp b/opm/core/transport/implicit/ImplicitTransport.hpp index b775575..8cd4833 100644 --- a/opm/core/transport/implicit/ImplicitTransport.hpp +++ b/opm/core/transport/implicit/ImplicitTransport.hpp @@ -104,7 +104,7 @@ namespace Opm { template class VAsgn > class ImplicitTransport { public: - ImplicitTransport(Model& model) + explicit ImplicitTransport(Model& model) : model_(model), asm_ (model) {} @@ -119,14 +119,14 @@ namespace Opm { const ImplicitTransportDetails::NRControl& ctrl , ReservoirState& state , LinearSolver& linsolve, - ImplicitTransportDetails::NRReport& rpt ) { - bool init; + ImplicitTransportDetails::NRReport& rpt ) + { typedef typename JacobianSystem::vector_type vector_type; typedef typename JacobianSystem::matrix_type matrix_type; asm_.createSystem(g, sys_); model_.initStep(state, g, sys_); - init = model_.initIteration(state, g, sys_); + model_.initIteration(state, g, sys_); MZero::zero(sys_.writableMatrix()); VZero::zero(sys_.vector().writableResidual()); @@ -157,7 +157,7 @@ namespace Opm { VNorm::norm(sys_.vector().increment()); // Begin line search - double residual=VNorm::norm(sys_.vector().residual()); + double residual; int lin_it=0; bool finished=rpt.norm_res::zero(sys_.writableMatrix()); VZero::zero(sys_.vector().writableResidual()); diff --git a/opm/core/transport/implicit/JacobianSystem.hpp b/opm/core/transport/implicit/JacobianSystem.hpp index c472aa2..e60647b 100644 --- a/opm/core/transport/implicit/JacobianSystem.hpp +++ b/opm/core/transport/implicit/JacobianSystem.hpp @@ -126,7 +126,7 @@ namespace Opm { template class VectorSizeSetter { public: - VectorSizeSetter(BaseVec& v) : v_(v) {} + explicit VectorSizeSetter(BaseVec& v) : v_(v) {} void setSize(::std::size_t ndof, ::std::size_t m) { diff --git a/opm/elasticity/applier.hpp b/opm/elasticity/applier.hpp index 1b46ad0..db6f6f0 100644 --- a/opm/elasticity/applier.hpp +++ b/opm/elasticity/applier.hpp @@ -24,7 +24,7 @@ struct OperatorApplier { //! \brief Constructor //! \param[in] t The preconditioner or inverse operator - OperatorApplier(T& t) : A(t) + explicit OperatorApplier(T& t) : A(t) { } diff --git a/opm/elasticity/asmhandler.hpp b/opm/elasticity/asmhandler.hpp index b3cb055..0ef737b 100644 --- a/opm/elasticity/asmhandler.hpp +++ b/opm/elasticity/asmhandler.hpp @@ -45,7 +45,7 @@ class ASMHandler { //! \brief The default constructor //! \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) { } diff --git a/opm/elasticity/asmhandler_impl.hpp b/opm/elasticity/asmhandler_impl.hpp index 2898fe6..d23dd4c 100644 --- a/opm/elasticity/asmhandler_impl.hpp +++ b/opm/elasticity/asmhandler_impl.hpp @@ -170,7 +170,7 @@ void ASMHandler::expandSolution(Vector& result, const Vector& u) l = 0; for (int i=0;igetNoMaster();++n) { int idx = mpc->getMaster(n).node*dim+mpc->getMaster(n).dof-1; @@ -322,7 +322,7 @@ void ASMHandler::preprocess() fixIt it2 = fixedNodes.find(indexi); if (it2 == fixedNodes.end()) { for (int i=0;i::preprocess() if (it2->second.first & flag) meqn[indexi*dim+i] = -1; else { - MPC* mpc = getMPC(indexi,i); + const MPC* mpc = getMPC(indexi,i); if (!mpc) meqn[indexi*dim+i] = maxeqn++; else @@ -390,7 +390,7 @@ void ASMHandler::determineAdjacencyPattern() for (int i=0; i < vertexsize; i++) { int indexi = set.subIndex(*it,i,dim); for (int k=0;kgetNoMaster();++l) { nodeAdjacency(it,vertexsize, diff --git a/opm/elasticity/boundarygrid.cpp b/opm/elasticity/boundarygrid.cpp index 41c109d..f26d322 100644 --- a/opm/elasticity/boundarygrid.cpp +++ b/opm/elasticity/boundarygrid.cpp @@ -348,7 +348,7 @@ std::vector BoundaryGrid::Quad::evalBasis(double xi, double eta) const return res; } -BoundaryGrid::Vertex minXminY(std::vector& in) +BoundaryGrid::Vertex minXminY(const std::vector& in) { // find the nodes with minimal X // then find the minimum Y among these @@ -358,7 +358,7 @@ BoundaryGrid::Vertex minXminY(std::vector& in) return *s.begin(); } -BoundaryGrid::Vertex maxXminY(std::vector& in) +BoundaryGrid::Vertex maxXminY(const std::vector& in) { // find the nodes with maximum X // then find the minimum Y among these @@ -368,7 +368,7 @@ BoundaryGrid::Vertex maxXminY(std::vector& in) return *(s.end()-2); } -BoundaryGrid::Vertex maxXmaxY(std::vector& in) +BoundaryGrid::Vertex maxXmaxY(const std::vector& in) { // find the nodes with maximum X // then find the maximum Y among these @@ -378,7 +378,7 @@ BoundaryGrid::Vertex maxXmaxY(std::vector& in) return *(s.end()-1); } -BoundaryGrid::Vertex minXmaxY(std::vector& in) +BoundaryGrid::Vertex minXmaxY(const std::vector& in) { // find the nodes with minimum X // then find the maximum Y among these diff --git a/opm/elasticity/boundarygrid.hh b/opm/elasticity/boundarygrid.hh index 737fd70..772615d 100644 --- a/opm/elasticity/boundarygrid.hh +++ b/opm/elasticity/boundarygrid.hh @@ -197,7 +197,7 @@ class BoundaryGrid { struct VertexLess { //! \brief Default constructor. //! \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 bool operator()(const Vertex& q1, const Vertex& q2) @@ -215,7 +215,7 @@ class BoundaryGrid { struct BoundedPredicate { //! \brief Default constructor //! \param[in] coord_ The coordinates to check - BoundedPredicate(const FaceCoord& coord_) : coord(coord_) {} + explicit BoundedPredicate(const FaceCoord& coord_) : coord(coord_) {} //! \brief The comparison operator bool operator()(const Quad& q) @@ -345,7 +345,7 @@ class HexGeometry<2, cdim, GridImp> //! \brief Construct integration 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) 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 //! \returns The requested vertex -BoundaryGrid::Vertex minXminY(std::vector& in); +BoundaryGrid::Vertex minXminY(const std::vector& in); //! \brief Find the vertex in the vector with maximum X and minimum Y //! \returns The requested vertex -BoundaryGrid::Vertex maxXminY(std::vector& in); +BoundaryGrid::Vertex maxXminY(const std::vector& in); //! \brief Find the vertex in the vector with maximum X and maximum Y //! \returns The requested vertex -BoundaryGrid::Vertex maxXmaxY(std::vector& in); +BoundaryGrid::Vertex maxXmaxY(const std::vector& in); //! \brief Find the vertex in the vector with minimum X and maximum Y //! \returns The requested vertex -BoundaryGrid::Vertex minXmaxY(std::vector& in); +BoundaryGrid::Vertex minXmaxY(const std::vector& in); } } diff --git a/opm/elasticity/elasticity.hpp b/opm/elasticity/elasticity.hpp index 1b4c6b0..182787a 100644 --- a/opm/elasticity/elasticity.hpp +++ b/opm/elasticity/elasticity.hpp @@ -29,7 +29,7 @@ class Elasticity { //! \brief Default constructor //! \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 //! \param[in] point (Reference) coordinates of quadrature point diff --git a/opm/elasticity/elasticity_upscale_impl.hpp b/opm/elasticity/elasticity_upscale_impl.hpp index 5202ef1..01f3f63 100644 --- a/opm/elasticity/elasticity_upscale_impl.hpp +++ b/opm/elasticity/elasticity_upscale_impl.hpp @@ -726,10 +726,10 @@ IMPL_FUNC(void, loadMaterialsFromRocklist(const std::string& file, if (Escale > 0) { Emin=1e10; for (size_t i=0;igetE()); + Emin = std::min(Emin,static_cast(cache[i].get())->getE()); for (size_t i=0;igetE(); - ((Isotropic*)cache[i].get())->setE(lE*Escale/Emin); + double lE = static_cast(cache[i].get())->getE(); + static_cast(cache[i].get())->setE(lE*Escale/Emin); } } std::vector volume; @@ -1084,7 +1084,7 @@ IMPL_FUNC(void, solve(int loadcase)) tsolver[solver]->apply(u[loadcase], b[loadcase], r); 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; } } diff --git a/opm/elasticity/material.hh b/opm/elasticity/material.hh index 8358bca..b77ef1b 100644 --- a/opm/elasticity/material.hh +++ b/opm/elasticity/material.hh @@ -19,8 +19,7 @@ #include -namespace Opm { -namespace Elasticity { +namespace Opm::Elasticity { /*! @@ -43,6 +42,7 @@ protected: { return os; } + public: //! \brief Empty virtual destructor. virtual ~Material() {} @@ -95,12 +95,12 @@ public: //! \param[in] ID ID of the material //! \param[in] file The URL to the rocklist static Material* create(int ID, const std::string& file); + private: int id; //!< External material number double rho; //!< Mass density }; -} -} +} // namespace Opm::Elasticity #endif diff --git a/opm/elasticity/materials.hh b/opm/elasticity/materials.hh index f1acbbe..5369995 100644 --- a/opm/elasticity/materials.hh +++ b/opm/elasticity/materials.hh @@ -14,9 +14,7 @@ #include "material.hh" - -namespace Opm { -namespace Elasticity { +namespace Opm::Elasticity { /*! \brief Isotropic linear elastic material. @@ -38,16 +36,16 @@ public: } //! \brief Empty virtual destructor. - virtual ~Isotropic() {} + ~Isotropic() override {} //! \brief Returns the number of parameters describing this material. - virtual int numPar() const + int numPar() const override { return 2; } //! \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; } @@ -68,17 +66,18 @@ public: //! \brief Establishes the full constitutive matrix for this material. //! \param[out] C The constitutive matrix //! \param[in] invers If \e true, set up the inverse matrix instead - virtual bool getConstitutiveMatrix(Dune::FieldMatrix& C, - bool invers = false) const; + bool getConstitutiveMatrix(Dune::FieldMatrix& C, + bool invers = false) const override; //! \brief Establishes the full constitutive matrix for this material. //! \param[out] C The constitutive matrix //! \param[in] invers If \e true, set up the inverse matrix instead - virtual bool getConstitutiveMatrix(Dune::FieldMatrix& C, - bool invers = false) const; + bool getConstitutiveMatrix(Dune::FieldMatrix& C, + bool invers = false) const override; + protected: //! \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: double E; //!< Young's modulus @@ -101,32 +100,32 @@ public: double Gxy, double Gxz = double(-1), double Gyz = double(-1)); //! \brief Empty virtual destructor. - virtual ~OrthotropicD() {} + ~OrthotropicD() override {} //! \brief Returns the number of parameters describing this material. - virtual int numPar() const + int numPar() const override { return 6; } //! \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. //! \param[out] C The constitutive matrix //! \param[in] invers If \e true, set up the inverse matrix instead - virtual bool getConstitutiveMatrix(Dune::FieldMatrix& C, - bool invers = false) const; + bool getConstitutiveMatrix(Dune::FieldMatrix& C, + bool invers = false) const override; //! \brief Establishes the full constitutive matrix for this material. //! \param[out] C The constitutive matrix //! \param[in] invers If \e true, set up the inverse matrix instead - virtual bool getConstitutiveMatrix(Dune::FieldMatrix& C, - bool invers = false) const; + bool getConstitutiveMatrix(Dune::FieldMatrix& C, + bool invers = false) const override; protected: //! \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: double E[6]; //!< The diagonal of the constitutive matrix @@ -142,37 +141,37 @@ public: OrthotropicSym(int ID, const Dune::DynamicVector& Cu); //! \brief Empty virtual destructor. - virtual ~OrthotropicSym() {} + ~OrthotropicSym() override {} //! \brief Returns the number of parameters describing this material. - virtual int numPar() const + int numPar() const override { return 21; } //! \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. //! \param[out] C The constitutive matrix //! \param[in] invers If \e true, set up the inverse matrix instead - virtual bool getConstitutiveMatrix(Dune::FieldMatrix& C, - bool invers = false) const; + bool getConstitutiveMatrix(Dune::FieldMatrix& C, + bool invers = false) const override; //! \brief Establishes the full constitutive matrix for this material. //! \param[out] C The constitutive matrix //! \param[in] invers If \e true, set up the inverse matrix instead - virtual bool getConstitutiveMatrix(Dune::FieldMatrix& C, - bool invers = false) const; + bool getConstitutiveMatrix(Dune::FieldMatrix& C, + bool invers = false) const override; + protected: //! \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: double Cupper[21]; //!< Upper triangle of the symmetric constitutive matrix }; -} -} +} // namespace Opm::Elasticity #endif diff --git a/opm/elasticity/meshcolorizer.hpp b/opm/elasticity/meshcolorizer.hpp index d7ffb9c..5370683 100644 --- a/opm/elasticity/meshcolorizer.hpp +++ b/opm/elasticity/meshcolorizer.hpp @@ -30,7 +30,7 @@ class MeshColorizer { public: //! \brief Default constructor //! \param[in] grid_ The grid to colorize - MeshColorizer(const GridType& grid_) : + explicit MeshColorizer(const GridType& grid_) : grid(grid_) { calcGroups(); diff --git a/opm/elasticity/shapefunctions.hpp b/opm/elasticity/shapefunctions.hpp index f7157d0..3a51ad5 100644 --- a/opm/elasticity/shapefunctions.hpp +++ b/opm/elasticity/shapefunctions.hpp @@ -150,7 +150,7 @@ class TensorProductFunction //! \brief Construct a tensor-product function //! \param[in] funcs_ The functions - TensorProductFunction(const Dune::FieldVector& funcs_) + explicit TensorProductFunction(const Dune::FieldVector& funcs_) : funcs(funcs_) {} //! \brief Evaluate the function @@ -279,7 +279,7 @@ public: PNShapeFunctionSet(int n1, int n2, int n3=0) { - int dims[3] = {n1, n2, n3}; + const int dims[3] = {n1, n2, n3}; cfuncs.resize(dim); for (int i=0; i < dim; ++i) { std::vector grid; diff --git a/opm/porsol/common/BoundaryConditions.hpp b/opm/porsol/common/BoundaryConditions.hpp index 93baa7f..e14cb37 100644 --- a/opm/porsol/common/BoundaryConditions.hpp +++ b/opm/porsol/common/BoundaryConditions.hpp @@ -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), canonical_bid_(num_different_boundary_ids, 0) { @@ -333,7 +333,7 @@ namespace Opm { public: DummyVec() {} - DummyVec(int) {} + explicit DummyVec(int) {} void resize(int) {} 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), FlowConds(num_different_boundary_ids), SatConds(num_different_boundary_ids), diff --git a/opm/porsol/common/ImplicitTransportDefs.hpp b/opm/porsol/common/ImplicitTransportDefs.hpp index a7689b3..42cfc2c 100644 --- a/opm/porsol/common/ImplicitTransportDefs.hpp +++ b/opm/porsol/common/ImplicitTransportDefs.hpp @@ -51,7 +51,7 @@ namespace Opm { template class ReservoirState { public: - ReservoirState(const UnstructuredGrid* g) + explicit ReservoirState(const UnstructuredGrid* g) : press_ (g->number_of_cells), fpress_(g->number_of_faces), flux_ (g->number_of_faces), @@ -114,7 +114,7 @@ namespace Opm { class TwophaseFluidWrapper { public: - TwophaseFluidWrapper(const Opm::ReservoirPropertyCapillary<3>& r) + explicit TwophaseFluidWrapper(const Opm::ReservoirPropertyCapillary<3>& r) : r_(r) {} diff --git a/opm/porsol/common/ReservoirPropertyFixedMobility.hpp b/opm/porsol/common/ReservoirPropertyFixedMobility.hpp index 886df1a..62c9342 100644 --- a/opm/porsol/common/ReservoirPropertyFixedMobility.hpp +++ b/opm/porsol/common/ReservoirPropertyFixedMobility.hpp @@ -45,7 +45,7 @@ namespace Opm { template class ReservoirPropertyFixedMobility { public: - ReservoirPropertyFixedMobility(const std::vector& mobs) + explicit ReservoirPropertyFixedMobility(const std::vector& mobs) : mobs_(mobs) { } diff --git a/opm/porsol/euler/EulerUpstreamImplicit_impl.hpp b/opm/porsol/euler/EulerUpstreamImplicit_impl.hpp index 4431a68..200deb2 100644 --- a/opm/porsol/euler/EulerUpstreamImplicit_impl.hpp +++ b/opm/porsol/euler/EulerUpstreamImplicit_impl.hpp @@ -323,7 +323,7 @@ namespace Opm std::cout << "Seconds taken by transport solver: " << clock.secsSinceStart() << std::endl; #endif // VERBOSE { - std::vector& sat = state.saturation(); + const std::vector& sat = state.saturation(); for (int i=0; i < mygrid_.numCells(); ++i){ saturation[i] = sat[2*i]; } diff --git a/opm/porsol/euler/EulerUpstreamResidual_impl.hpp b/opm/porsol/euler/EulerUpstreamResidual_impl.hpp index 5aed240..90485d3 100644 --- a/opm/porsol/euler/EulerUpstreamResidual_impl.hpp +++ b/opm/porsol/euler/EulerUpstreamResidual_impl.hpp @@ -201,7 +201,7 @@ namespace Opm s.preservoir_properties_->phaseMobility(triv_phase, cell[ups_cell], cell_sat[ups_cell], m_ups[triv_phase].mob); // 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 *inner(loc_normal, m_ups[triv_phase].multiply(grav_influence)); // Find flow direction of nontrivial phase. @@ -289,7 +289,7 @@ namespace Opm struct IndirectRange { typedef Iter Iterator; - IndirectRange(const std::vector& iters) + explicit IndirectRange(const std::vector& iters) : iters_(iters), beg_(0), end_(iters_.size() - 1) { assert(iters_.size() >= 2); @@ -329,7 +329,7 @@ namespace Opm template struct UpdateLoopBody { - UpdateLoopBody(const Updater& upd) + explicit UpdateLoopBody(const Updater& upd) : updater(upd) { } diff --git a/opm/porsol/mimetic/IncompFlowSolverHybrid.hpp b/opm/porsol/mimetic/IncompFlowSolverHybrid.hpp index 911c949..17e26f0 100644 --- a/opm/porsol/mimetic/IncompFlowSolverHybrid.hpp +++ b/opm/porsol/mimetic/IncompFlowSolverHybrid.hpp @@ -699,7 +699,7 @@ namespace Opm { class FaceFluxes { public: - FaceFluxes(int sz) + explicit FaceFluxes(int sz) : fluxes_(sz, 0.0), visited_(sz, 0), max_modification_(0.0) { } diff --git a/opm/porsol/mimetic/MimeticIPAnisoRelpermEvaluator.hpp b/opm/porsol/mimetic/MimeticIPAnisoRelpermEvaluator.hpp index 1141513..cd697c1 100644 --- a/opm/porsol/mimetic/MimeticIPAnisoRelpermEvaluator.hpp +++ b/opm/porsol/mimetic/MimeticIPAnisoRelpermEvaluator.hpp @@ -111,7 +111,7 @@ namespace Opm { /// in the model. Used to set the size of certain internal /// 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$. - MimeticIPAnisoRelpermEvaluator(const int max_nf) + explicit MimeticIPAnisoRelpermEvaluator(const int max_nf) : max_nf_ (max_nf ), fa_ (max_nf * max_nf), t1_ (max_nf * dim ), diff --git a/opm/porsol/mimetic/MimeticIPEvaluator.hpp b/opm/porsol/mimetic/MimeticIPEvaluator.hpp index 37e6c55..cbe3d11 100644 --- a/opm/porsol/mimetic/MimeticIPEvaluator.hpp +++ b/opm/porsol/mimetic/MimeticIPEvaluator.hpp @@ -115,7 +115,7 @@ namespace Opm { /// in the model. Used to set the size of certain internal /// 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$. - MimeticIPEvaluator(const int max_nf) + explicit MimeticIPEvaluator(const int max_nf) : max_nf_(max_nf ), fa_ (max_nf * max_nf), t1_ (max_nf * dim ), diff --git a/opm/upscaling/CornerpointChopper.hpp b/opm/upscaling/CornerpointChopper.hpp index 4b7f932..b51bcd2 100644 --- a/opm/upscaling/CornerpointChopper.hpp +++ b/opm/upscaling/CornerpointChopper.hpp @@ -39,7 +39,7 @@ namespace Opm class CornerPointChopper { public: - CornerPointChopper(const std::string& file) : + explicit CornerPointChopper(const std::string& file) : parser_(Parser{}), deck_(parser_.parseFile(file)), 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_to_old_cell_.resize(new_dims_[0]*new_dims_[1]*new_dims_[2], -1); int cellcount = 0; - 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 delta[3] = { 1, 2*dims_[0], 4*dims_[0]*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 j = jmin; j < jmax; ++j) { for (int i = imin; i < imax; ++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 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], - old_ix + delta[1], old_ix + delta[1] + 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] }; - 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[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] }; + const int old_indices[8] = {old_ix, old_ix + 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] + delta[1], old_ix + delta[2] + delta[1] + 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[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] }; 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; } diff --git a/opm/upscaling/SteadyStateUpscalerImplicit.hpp b/opm/upscaling/SteadyStateUpscalerImplicit.hpp index 5ca5e07..5b803d2 100644 --- a/opm/upscaling/SteadyStateUpscalerImplicit.hpp +++ b/opm/upscaling/SteadyStateUpscalerImplicit.hpp @@ -40,7 +40,6 @@ #include #include #include -#include namespace Opm { @@ -100,7 +99,7 @@ namespace Opm protected: // ------- Typedefs ------- - typedef typename Traits::template TransportSolver::Type TransportSolver; + typedef typename Traits::template TransportSolver::Type TransportSolver; // ------- Methods ------- template @@ -109,8 +108,7 @@ namespace Opm const FlowSol& flow_solution, const std::vector& saturations) const; /// Override from superclass. - virtual void initImpl(const Opm::ParameterGroup& param); - + void initImpl(const Opm::ParameterGroup& param) override; // ------- Data members ------- std::vector last_saturation_state_; diff --git a/opm/upscaling/SteadyStateUpscalerImplicit_impl.hpp b/opm/upscaling/SteadyStateUpscalerImplicit_impl.hpp index 0048b70..473aeae 100644 --- a/opm/upscaling/SteadyStateUpscalerImplicit_impl.hpp +++ b/opm/upscaling/SteadyStateUpscalerImplicit_impl.hpp @@ -233,7 +233,6 @@ namespace Opm double ecl_time = 0.0; std::vector ecl_sat; std::vector ecl_press; - std::vector init_saturation(saturation); while ((!stationary) && (it_count < max_it_)) { // && transport_cost < max_transport_cost_) // Run transport solver. std::cout << "Running transport step " << it_count << " with stepsize " @@ -242,7 +241,6 @@ namespace Opm this->flow_solver_.getSolution(), injection); // Run pressure solver. if (converged) { - init_saturation = saturation; // this->flow_solver_.solve(this->res_prop_, saturation, this->bcond_, src, // this->residual_tolerance_, this->linsolver_verbosity_, this->linsolver_type_); // max_mod = this->flow_solver_.postProcessFluxes(); @@ -324,7 +322,6 @@ namespace Opm } } else { std::cerr << "Cutting time step\n"; - init_saturation = saturation_old; stepsize=stepsize/2.0; } ++it_count; @@ -466,9 +463,6 @@ namespace Opm double side1_flux_oil = 0.0; double side2_flux_oil = 0.0; std::map frac_flow_by_bid; - int num_cells = this->ginterf_.numberOfCells(); - std::vector cell_inflows_w(num_cells, 0.0); - std::vector cell_outflows_w(num_cells, 0.0); // 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 @@ -497,7 +491,6 @@ namespace Opm assert(sc.isDirichlet()); 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_oil += flux*(1.0 - frac_flow); } else if (flux >= 0.0 && pass == 0) { @@ -507,7 +500,6 @@ namespace Opm frac_flow_by_bid[f->boundaryId()] = frac_flow; // std::cout << "Inserted bid " << f->boundaryId() << std::endl; } - cell_outflows_w[c->index()] += flux*frac_flow; side2_flux += flux*frac_flow; side2_flux_oil += flux*(1.0 - frac_flow); }