EconomicLimitsMessage.hpp
Go to the documentation of this file.
1/*
2 Copyright 2026 Equinor ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPM_ECONOMIC_LIMITS_MESSAGE_HEADER_INCLUDED
21#define OPM_ECONOMIC_LIMITS_MESSAGE_HEADER_INCLUDED
22
23#include <opm/common/utility/TimeService.hpp>
24
25#include <opm/input/eclipse/Units/UnitSystem.hpp>
26
27#include <fmt/chrono.h>
28#include <fmt/format.h>
29
30#include <string>
31
32namespace Opm {
33
40inline std::string economicLimitDateString(const time_point start_time, const double sim_time)
41{
42 return fmt::format("{:%d-%b-%Y}",
43 asTm(TimeStampUTC { TimeService::advance(start_time, sim_time) }));
44}
45
48inline std::string economicLimitWhenString(const UnitSystem& unit_system,
49 const time_point start_time,
50 const double sim_time)
51{
52 return fmt::format("at time {:.2f} {} (date = {})",
53 unit_system.from_si(UnitSystem::measure::time, sim_time),
54 unit_system.name(UnitSystem::measure::time),
55 economicLimitDateString(start_time, sim_time));
56}
57
60inline const std::string& economicLimitMessageSeparator()
61{
62 static const std::string separator(110, '*');
63 return separator;
64}
65
66} // namespace Opm
67
68#endif // OPM_ECONOMIC_LIMITS_MESSAGE_HEADER_INCLUDED
Definition: blackoilbioeffectsmodules.hh:45
const std::string & economicLimitMessageSeparator()
Separator line used to frame economic-limit workover messages. Built once and returned by reference (...
Definition: EconomicLimitsMessage.hpp:60
std::string economicLimitWhenString(const UnitSystem &unit_system, const time_point start_time, const double sim_time)
The "at time ... (date = ...)" clause shared by the well (WECON) and connection (CECON) economic-limi...
Definition: EconomicLimitsMessage.hpp:48
std::string economicLimitDateString(const time_point start_time, const double sim_time)
Calendar date (DD-Mon-YYYY, UTC) reached at start_time plus sim_time seconds.
Definition: EconomicLimitsMessage.hpp:40