use commandline instead of paramGroup.
This commit is contained in:
parent
8810a47215
commit
c128e218da
@ -44,18 +44,10 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
|
||||||
|
|
||||||
namespace
|
void usage() {
|
||||||
{
|
std::cout << std::endl <<
|
||||||
void warnIfUnusedParams(const Opm::parameter::ParameterGroup& param)
|
"Usage: diagnose_relperm <eclipseFile>" << std::endl;
|
||||||
{
|
}
|
||||||
if (param.anyUnused()) {
|
|
||||||
std::cout << "-------------------- Warning: unused parameters: --------------------\n";
|
|
||||||
param.displayUsage();
|
|
||||||
std::cout << "-------------------------------------------------------------------------" << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // anon namespace
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------- Main program -----------------
|
// ----------------- Main program -----------------
|
||||||
@ -64,28 +56,40 @@ main(int argc, char** argv)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
parameter::ParameterGroup param(argc, argv);
|
if (argc <= 1) {
|
||||||
|
usage();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
static char* ECLIPSEFILENAME(argv[1]);
|
||||||
|
std::ifstream eclipseFile(ECLIPSEFILENAME, std::ios::in);
|
||||||
|
if (eclipseFile.fail()) {
|
||||||
|
std::cerr << "Error: Filename " << ECLIPSEFILENAME << " not found or not readable." << std::endl;
|
||||||
|
usage();
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
eclipseFile.close();
|
||||||
|
//parameter::ParameterGroup param(argc, argv);
|
||||||
// Read saturation tables.
|
// Read saturation tables.
|
||||||
EclipseStateConstPtr eclState;
|
EclipseStateConstPtr eclState;
|
||||||
ParserPtr parser(new Opm::Parser);
|
ParserPtr parser(new Opm::Parser);
|
||||||
Opm::DeckConstPtr deck;
|
|
||||||
//ParseMode parseMode;
|
//ParseMode parseMode;
|
||||||
Opm::ParseMode parseMode({{ ParseMode::PARSE_RANDOM_SLASH , InputError::IGNORE },
|
Opm::ParseMode parseMode({{ ParseMode::PARSE_RANDOM_SLASH , InputError::IGNORE },
|
||||||
{ ParseMode::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE},
|
{ ParseMode::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE},
|
||||||
{ ParseMode::PARSE_RANDOM_TEXT, InputError::IGNORE}
|
{ ParseMode::PARSE_RANDOM_TEXT, InputError::IGNORE}
|
||||||
});
|
});
|
||||||
std::string deck_filename = param.get<std::string>("deck_filename");
|
Opm::DeckConstPtr deck(parser->parseFile(ECLIPSEFILENAME, parseMode));
|
||||||
deck = parser->parseFile(deck_filename, parseMode);
|
//std::string deck_filename = param.get<std::string>("deck_filename");
|
||||||
|
//deck = parser->parseFile(deck_filename, parseMode);
|
||||||
eclState.reset(new EclipseState(deck, parseMode));
|
eclState.reset(new EclipseState(deck, parseMode));
|
||||||
|
|
||||||
GridManager gm(deck);
|
GridManager gm(deck);
|
||||||
const UnstructuredGrid& grid = *gm.c_grid();
|
const UnstructuredGrid& grid = *gm.c_grid();
|
||||||
// Write parameters used for later reference.
|
// Write parameters used for later reference.
|
||||||
bool output = param.getDefault("output", true);
|
//bool output = param.getDefault("output", true);
|
||||||
|
bool output = true;
|
||||||
std::string output_dir;
|
std::string output_dir;
|
||||||
if (output) {
|
if (output) {
|
||||||
output_dir =
|
output_dir = "output";
|
||||||
param.getDefault("output_dir", std::string("output"));
|
|
||||||
boost::filesystem::path fpath(output_dir);
|
boost::filesystem::path fpath(output_dir);
|
||||||
try {
|
try {
|
||||||
create_directories(fpath);
|
create_directories(fpath);
|
||||||
@ -93,12 +97,8 @@ try
|
|||||||
catch (...) {
|
catch (...) {
|
||||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||||
}
|
}
|
||||||
param.writeParam(output_dir + "/relperm.param");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue a warning if any parameters were unused.
|
|
||||||
warnIfUnusedParams(param);
|
|
||||||
|
|
||||||
Opm::time::StopWatch timer;
|
Opm::time::StopWatch timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
RelpermDiagnostics diagnostic(eclState);
|
RelpermDiagnostics diagnostic(eclState);
|
||||||
|
Loading…
Reference in New Issue
Block a user