mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge remote-tracking branch 'upstream/master' into timestepcontrol
This commit is contained in:
commit
28bac5ebc9
@ -50,6 +50,8 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
@ -102,10 +104,29 @@ try
|
||||
double gravity[3] = { 0.0 };
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
|
||||
Opm::ParserPtr newParser(new Opm::Parser() );
|
||||
Opm::ParserPtr parser(new Opm::Parser() );
|
||||
Opm::ParserLogPtr parserLog(new Opm::ParserLog());
|
||||
bool strict_parsing = param.getDefault("strict_parsing", true);
|
||||
Opm::DeckConstPtr deck = newParser->parseFile(deck_filename, strict_parsing);
|
||||
std::shared_ptr<EclipseState> eclipseState(new EclipseState(deck));
|
||||
Opm::DeckConstPtr deck;
|
||||
std::shared_ptr<EclipseState> eclipseState;
|
||||
try {
|
||||
deck = parser->parseFile(deck_filename, strict_parsing, parserLog);
|
||||
Opm::checkDeck(deck, parserLog);
|
||||
eclipseState.reset(new Opm::EclipseState(deck, parserLog));
|
||||
}
|
||||
catch (const std::invalid_argument& e) {
|
||||
if (parserLog->size() > 0) {
|
||||
std::cerr << "Issues found while parsing the deck file:\n";
|
||||
parserLog->printAll(std::cerr);
|
||||
}
|
||||
std::cerr << "error while parsing the deck file: " << e.what() << "\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (parserLog->size() > 0) {
|
||||
std::cerr << "Issues found while parsing the deck file:\n";
|
||||
parserLog->printAll(std::cerr);
|
||||
}
|
||||
|
||||
// Grid init
|
||||
std::vector<double> porv;
|
||||
|
@ -72,6 +72,8 @@
|
||||
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
@ -128,10 +130,29 @@ try
|
||||
double gravity[3] = { 0.0 };
|
||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
||||
|
||||
Opm::ParserPtr newParser(new Opm::Parser() );
|
||||
Opm::ParserPtr parser(new Opm::Parser() );
|
||||
Opm::ParserLogPtr parserLog(new Opm::ParserLog());
|
||||
bool strict_parsing = param.getDefault("strict_parsing", true);
|
||||
Opm::DeckConstPtr deck = newParser->parseFile(deck_filename, strict_parsing);
|
||||
std::shared_ptr<EclipseState> eclipseState(new EclipseState(deck));
|
||||
Opm::DeckConstPtr deck;
|
||||
std::shared_ptr<EclipseState> eclipseState;
|
||||
try {
|
||||
deck = parser->parseFile(deck_filename, strict_parsing, parserLog);
|
||||
checkDeck(deck, parserLog);
|
||||
eclipseState.reset(new EclipseState(deck, parserLog));
|
||||
}
|
||||
catch (const std::invalid_argument& e) {
|
||||
if (parserLog->size() > 0) {
|
||||
std::cerr << "Issues found while parsing the deck file:\n";
|
||||
parserLog->printAll(std::cerr);
|
||||
}
|
||||
std::cerr << "error while parsing the deck file: " << e.what() << "\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (parserLog->size() > 0) {
|
||||
std::cerr << "Issues found while parsing the deck file:\n";
|
||||
parserLog->printAll(std::cerr);
|
||||
}
|
||||
|
||||
// Grid init
|
||||
grid.reset(new Dune::CpGrid());
|
||||
|
@ -1771,21 +1771,18 @@ namespace {
|
||||
|
||||
stagnate = true;
|
||||
int oscillatePhase = 0;
|
||||
const std::vector<double>& F0 = residual_history[it];
|
||||
const std::vector<double>& F1 = residual_history[it - 1];
|
||||
const std::vector<double>& F2 = residual_history[it - 2];
|
||||
for (int p= 0; p < fluid_.numPhases(); ++p){
|
||||
const double d1 = std::abs((F0[p] - F2[p]) / F0[p]);
|
||||
const double d2 = std::abs((F0[p] - F1[p]) / F0[p]);
|
||||
|
||||
for (int phaseIdx= 0; phaseIdx < fluid_.numPhases(); ++ phaseIdx){
|
||||
if (active_[phaseIdx]) {
|
||||
double relChange1 = std::fabs((residual_history[it][phaseIdx] - residual_history[it - 2][phaseIdx]) /
|
||||
residual_history[it][phaseIdx]);
|
||||
double relChange2 = std::fabs((residual_history[it][phaseIdx] - residual_history[it - 1][phaseIdx]) /
|
||||
residual_history[it][phaseIdx]);
|
||||
oscillatePhase += (relChange1 < relaxRelTol) && (relChange2 > relaxRelTol);
|
||||
oscillatePhase += (d1 < relaxRelTol) && (relaxRelTol < d2);
|
||||
|
||||
double relChange3 = std::fabs((residual_history[it - 1][phaseIdx] - residual_history[it - 2][phaseIdx]) /
|
||||
residual_history[it - 2][phaseIdx]);
|
||||
if (relChange3 > 1.e-3) {
|
||||
stagnate = false;
|
||||
}
|
||||
}
|
||||
// Process is 'stagnate' unless at least one phase
|
||||
// exhibits significant residual change.
|
||||
stagnate = (stagnate && !(std::abs((F1[p] - F2[p]) / F2[p]) > 1.0e-3));
|
||||
}
|
||||
|
||||
oscillate = (oscillatePhase > 1);
|
||||
|
Loading…
Reference in New Issue
Block a user