From faf0ab8ee1cd607c1b2424c8fb8b10c860359721 Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Thu, 3 Oct 2024 11:26:07 +0200 Subject: [PATCH] Getting numcomp out of configuration file. --- flowexperimental/comp/flowexp_comp.cpp | 36 +++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/flowexperimental/comp/flowexp_comp.cpp b/flowexperimental/comp/flowexp_comp.cpp index 997232fd5..cd991d96b 100644 --- a/flowexperimental/comp/flowexp_comp.cpp +++ b/flowexperimental/comp/flowexp_comp.cpp @@ -17,6 +17,12 @@ along with OPM. If not, see . */ #include "config.h" + +#include + +#include +#include + #include #include #include "../FlowExpNewtonMethod.hpp" @@ -29,6 +35,7 @@ // TODO: not understanding why we need FlowGenericProblem here #include #include +//#include #include // // the current code use eclnewtonmethod adding other conditions to proceed_ should do the trick for KA @@ -303,6 +310,33 @@ struct EnableThermalFluxBoundaries { int main(int argc, char** argv) { using TypeTag = Opm::Properties::TTag::FlowExpCompProblem; + using PreVanguard = Opm::GetPropType; + //using TypeTagTemporary = Opm::Properties::TTag::FlowEarlyBird; Opm::registerEclTimeSteppingParameters(); - return Opm::start(argc, argv); + + auto comm = Dune::MPIHelper::instance(argc, argv).getCommunication(); + auto commPtr = std::make_unique(comm); + // This is a bit cumbersome, but we need to read the input file + // first to figure out the number of components (I think) in order + // to select the correct type tag. + // + // TODO: Do a more dynamic dispatch approach similar to the normal + // flow application + Opm::setupParameters_(argc, const_cast(argv), true); + + auto inputFilename = Opm::FlowGenericVanguard::canonicalDeckPath(Opm::Parameters::Get()); + Opm::FlowGenericVanguard::setCommunication(std::move(commPtr)); + Opm::FlowGenericVanguard::readDeck(inputFilename); + Opm::FlowGenericVanguard vanguard; + + const auto& eclState = vanguard.eclState(); + const auto numComps = vanguard.eclState().compositionalConfig().numComps(); + std::cout << "numComps = " << numComps << std::endl; + + std::cout << inputFilename << std::endl; + //Opm::Parser parser; + + // Opm::Deck deck = parser.parseFile(inputFilename); + + return Opm::start(argc, argv, false); }