/*
Copyright 2019 Equinor 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 .
*/
#ifndef RFT_CONFIG_HPP
#define RFT_CONFIG_HPP
#include
#include
#include
#include
#include
#include
#include
namespace Opm {
class RFTConfig {
public:
enum class RFT {
YES = 1,
REPT = 2,
TIMESTEP = 3,
FOPN = 4,
NO = 5
};
static std::string RFT2String(RFT enumValue);
static RFT RFTFromString(const std::string &stringValue);
enum class PLT {
YES = 1,
REPT = 2,
TIMESTEP = 3,
NO = 4
};
static std::string PLT2String(PLT enumValue);
static PLT PLTFromString( const std::string& stringValue);
template
using ConfigMap = std::unordered_map<
std::string, DynamicState>
>;
using WellOpenTimeMap = std::unordered_map;
RFTConfig();
RFTConfig(const TimeMap& tm,
const std::size_t first_rft,
const std::pair& rftTime,
const WellOpenTimeMap& rftName,
const WellOpenTimeMap& wellOpen,
const ConfigMap& rconfig,
const ConfigMap& pconfig);
explicit RFTConfig(const TimeMap& time_map);
bool rft(const std::string& well, std::size_t report_step) const;
bool plt(const std::string& well, std::size_t report_step) const;
bool getWellOpenRFT(const std::string& well_name, std::size_t report_step) const;
void setWellOpenRFT(std::size_t report_step);
void setWellOpenRFT(const std::string& well_name);
bool active(std::size_t report_step) const;
std::size_t firstRFTOutput() const { return this->first_rft_event; }
void updateRFT(const std::string& well, std::size_t report_step, RFT value);
void updatePLT(const std::string& well, std::size_t report_step, PLT value);
void addWellOpen(const std::string& well, std::size_t report_step);
const TimeMap& timeMap() const;
bool operator==(const RFTConfig& data) const;
template
void serializeOp(Serializer& serializer)
{
tm.serializeOp(serializer);
serializer(first_rft_event);
serializer(well_open_rft_time);
serializer(well_open_rft_name);
serializer(well_open);
serializer.template map,false>(rft_config);
serializer.template map,false>(plt_config);
}
private:
TimeMap tm;
std::size_t first_rft_event;
std::pair well_open_rft_time;
WellOpenTimeMap well_open_rft_name;
WellOpenTimeMap well_open;
ConfigMap rft_config;
ConfigMap plt_config;
bool outputRftAtWellopen(WellOpenTimeMap::const_iterator well, const std::size_t report_step) const;
std::size_t firstWellopenStepNotBefore(const std::size_t report_step) const;
void updateFirstIfNotShut(const std::string& well_name, const std::size_t report_step);
void updateFirst(const std::size_t report_step);
void setWellOpenRFT(const std::string& well_name, const std::size_t report_step);
template
void updateConfig(const std::string& well_name,
const std::size_t report_step,
const Value value,
ConfigMap& cfgmap);
};
}
#endif