2023-02-28 05:41:36 -06:00
|
|
|
/*
|
|
|
|
Copyright 2013, 2014, 2015 SINTEF ICT, Applied Mathematics.
|
|
|
|
Copyright 2014 Dr. Blatt - HPC-Simulation-Software & Services
|
|
|
|
Copyright 2015 IRIS AS
|
|
|
|
Copyright 2014 STATOIL ASA.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <opm/simulators/flow/FlowMainEbos.hpp>
|
|
|
|
|
|
|
|
#include <opm/common/utility/String.hpp>
|
|
|
|
|
2023-02-28 05:41:36 -06:00
|
|
|
#include <opm/simulators/flow/ConvergenceOutputConfiguration.hpp>
|
|
|
|
|
2023-02-28 05:41:36 -06:00
|
|
|
#include <opm/simulators/utils/ParallelFileMerger.hpp>
|
|
|
|
|
|
|
|
#include <algorithm>
|
2023-02-28 05:41:36 -06:00
|
|
|
#include <filesystem>
|
|
|
|
#include <fstream>
|
2023-02-28 05:41:36 -06:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace Opm {
|
|
|
|
namespace detail {
|
|
|
|
|
|
|
|
void mergeParallelLogFiles(std::string_view output_dir,
|
|
|
|
std::string_view deckFilename,
|
|
|
|
bool enableLoggingFalloutWarning)
|
|
|
|
{
|
|
|
|
namespace fs = ::std::filesystem;
|
|
|
|
fs::path output_path(output_dir);
|
|
|
|
fs::path deck_filename(deckFilename);
|
|
|
|
std::string basename;
|
|
|
|
// Strip extension "." and ".DATA"
|
|
|
|
std::string extension = uppercase(deck_filename.extension().string());
|
|
|
|
if (extension == ".DATA" || extension == ".") {
|
|
|
|
basename = uppercase(deck_filename.stem().string());
|
|
|
|
} else {
|
|
|
|
basename = uppercase(deck_filename.filename().string());
|
|
|
|
}
|
|
|
|
std::for_each(fs::directory_iterator(output_path),
|
|
|
|
fs::directory_iterator(),
|
|
|
|
detail::ParallelFileMerger(output_path, basename,
|
|
|
|
enableLoggingFalloutWarning));
|
|
|
|
}
|
|
|
|
|
2023-02-28 05:41:36 -06:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-28 05:41:36 -06:00
|
|
|
} // namespace detail
|
|
|
|
} // namespace Opm
|