mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Only read RUNSPEC to get numComps.
This commit is contained in:
parent
6adf4a6fb9
commit
b49741c77d
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||||
|
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
||||||
|
|
||||||
#include <opm/models/utils/start.hh>
|
#include <opm/models/utils/start.hh>
|
||||||
#include <opm/material/constraintsolvers/PTFlash.hpp>
|
#include <opm/material/constraintsolvers/PTFlash.hpp>
|
||||||
@ -343,28 +344,28 @@ startSimulationComponents(int numComponentsRuntime, int argc, char** argv)
|
|||||||
// this to avoid warnings.
|
// this to avoid warnings.
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
using TypeTag = Opm::Properties::TTag::FlowExpCompProblem<0>;
|
using TypeTag = Opm::Properties::TTag::FlowExpCompProblem<0>;
|
||||||
Opm::registerEclTimeSteppingParameters<double>();
|
Opm::registerEclTimeSteppingParameters<double>();
|
||||||
|
|
||||||
// This is a bit cumbersome, but we need to read the input file
|
// At the moment, this is probably as optimal as can be.
|
||||||
// first to figure out the number of components (I think) in order
|
// We only read the RUNSPEC of the Deck file to get the numComp,
|
||||||
// to select the correct type tag.
|
// and for this we need to first read the CLI arguments.
|
||||||
//
|
|
||||||
// TODO: Do a more dynamic dispatch approach similar to the normal
|
|
||||||
// flow application
|
|
||||||
auto comm = Dune::MPIHelper::instance(argc, argv).getCommunication();
|
|
||||||
auto commPtr = std::make_unique<decltype(comm)>(comm);
|
|
||||||
Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), true);
|
Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), true);
|
||||||
|
|
||||||
auto inputFilename
|
auto inputFilename
|
||||||
= Opm::FlowGenericVanguard::canonicalDeckPath(Opm::Parameters::Get<Opm::Parameters::EclDeckFileName>());
|
= Opm::FlowGenericVanguard::canonicalDeckPath(Opm::Parameters::Get<Opm::Parameters::EclDeckFileName>());
|
||||||
Opm::FlowGenericVanguard::setCommunication(std::move(commPtr));
|
|
||||||
Opm::FlowGenericVanguard::readDeck(inputFilename);
|
// Only read the RUNSPEC section of the deck
|
||||||
Opm::FlowGenericVanguard vanguard;
|
const auto deck = Opm::Parser{}.parseFile(inputFilename,
|
||||||
const auto numComps = vanguard.eclState().compositionalConfig().numComps();
|
Opm::ParseContext{},
|
||||||
|
std::vector { Opm::Ecl::SectionType::RUNSPEC });
|
||||||
|
const auto runspec = Opm::Runspec(deck);
|
||||||
|
const auto numComps = runspec.numComps();
|
||||||
|
|
||||||
return startSimulationComponents<2, 7>(numComps, argc, argv);
|
return startSimulationComponents<2, 7>(numComps, argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user