mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
FlowMainEbos: move ExtraConvergenceOutput code to compile unit
This commit is contained in:
@@ -25,9 +25,13 @@
|
||||
|
||||
#include <opm/common/utility/String.hpp>
|
||||
|
||||
#include <opm/simulators/flow/ConvergenceOutputConfiguration.hpp>
|
||||
|
||||
#include <opm/simulators/utils/ParallelFileMerger.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
namespace Opm {
|
||||
@@ -54,5 +58,25 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
||||
enableLoggingFalloutWarning));
|
||||
}
|
||||
|
||||
void handleExtraConvergenceOutput(SimulatorReport& report,
|
||||
std::string_view option,
|
||||
std::string_view optionName,
|
||||
std::string_view output_dir,
|
||||
std::string_view base_name)
|
||||
{
|
||||
const auto extraConvOutput = ConvergenceOutputConfiguration {
|
||||
option, optionName
|
||||
};
|
||||
|
||||
if (extraConvOutput.want(ConvergenceOutputConfiguration::Option::Steps)) {
|
||||
namespace fs = ::std::filesystem;
|
||||
|
||||
const auto infostep = fs::path{output_dir} / fs::path{base_name}.concat(".INFOSTEP");
|
||||
|
||||
std::ofstream os(infostep);
|
||||
report.fullReports(os);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace Opm
|
||||
|
@@ -22,19 +22,13 @@
|
||||
#ifndef OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
|
||||
#define OPM_FLOW_MAIN_EBOS_HEADER_INCLUDED
|
||||
|
||||
#include <opm/simulators/flow/ConvergenceOutputConfiguration.hpp>
|
||||
#include <opm/simulators/flow/Banners.hpp>
|
||||
#include <opm/simulators/flow/SimulatorFullyImplicitBlackoilEbos.hpp>
|
||||
#include <opm/simulators/utils/moduleVersion.hpp>
|
||||
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
||||
#include <flow/flow_ebos_blackoil.hpp>
|
||||
|
||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/IOConfig/IOConfig.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/InitConfig/InitConfig.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
#include <dune/fem/misc/mpimanager.hh>
|
||||
#else
|
||||
@@ -82,6 +76,13 @@ namespace detail {
|
||||
void mergeParallelLogFiles(std::string_view output_dir,
|
||||
std::string_view deck_filename,
|
||||
bool enableLoggingFalloutWarning);
|
||||
|
||||
void handleExtraConvergenceOutput(SimulatorReport& report,
|
||||
std::string_view option,
|
||||
std::string_view optionName,
|
||||
std::string_view output_dir,
|
||||
std::string_view base_name);
|
||||
|
||||
}
|
||||
|
||||
class Deck;
|
||||
@@ -99,7 +100,7 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
||||
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
|
||||
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
|
||||
|
||||
typedef SimulatorFullyImplicitBlackoilEbos<TypeTag> Simulator;
|
||||
using Simulator = SimulatorFullyImplicitBlackoilEbos<TypeTag>;
|
||||
|
||||
FlowMainEbos(int argc, char **argv, bool output_cout, bool output_files )
|
||||
: argc_{argc}, argv_{argv},
|
||||
@@ -488,20 +489,11 @@ void mergeParallelLogFiles(std::string_view output_dir,
|
||||
|
||||
printFlowTrailer(mpi_size_, threads, report);
|
||||
|
||||
const auto extraConvOutput = ConvergenceOutputConfiguration {
|
||||
EWOMS_GET_PARAM(TypeTag, std::string, OutputExtraConvergenceInfo),
|
||||
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))"
|
||||
};
|
||||
|
||||
if (extraConvOutput.want(ConvergenceOutputConfiguration::Option::Steps)) {
|
||||
namespace fs = ::std::filesystem;
|
||||
|
||||
const auto infostep = fs::path { eclState().getIOConfig().getOutputDir() } /
|
||||
fs::path { eclState().getIOConfig().getBaseName() }.concat(".INFOSTEP");
|
||||
|
||||
std::ofstream os(infostep);
|
||||
report.fullReports(os);
|
||||
}
|
||||
detail::handleExtraConvergenceOutput(report,
|
||||
EWOMS_GET_PARAM(TypeTag, std::string, OutputExtraConvergenceInfo),
|
||||
R"(OutputExtraConvergenceInfo (--output-extra-convergence-info))",
|
||||
eclState().getIOConfig().getOutputDir(),
|
||||
eclState().getIOConfig().getBaseName());
|
||||
}
|
||||
|
||||
// Run the simulator.
|
||||
|
Reference in New Issue
Block a user