Loading...
Searching...
No Matches
ConnFracStatistics.hpp
/*
Copyright 2024 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 <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_CONNFRACSTATISTICS_HPP
#define OPM_CONNFRACSTATISTICS_HPP
#include <opm/simulators/wells/RunningStatistics.hpp>
#include <array>
#include <cstddef>
#include <type_traits>
namespace Opm {
template <typename Scalar>
class ConnFracStatistics
{
public:
enum class Quantity : std::size_t
{
Pressure,
FlowRate,
Width,
// -------------------------------------------------------------
// Helper. Must be last enumerator.
NumQuantities,
};
using SamplePoint = std::array
<Scalar, static_cast<std::underlying_type_t<Quantity>>(Quantity::NumQuantities)>;
template <class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(this->quantity_);
}
void reset()
{
for (auto& q : this->quantity_) { q.reset(); }
}
void addSamplePoint(const SamplePoint& samplePoint)
{
for (auto qIdx = 0*samplePoint.size(); qIdx < samplePoint.size(); ++qIdx) {
this->quantity_[qIdx].addSamplePoint(samplePoint[qIdx]);
}
}
const RunningStatistics<Scalar>& statistics(const Quantity q) const
{
return this->quantity_[ static_cast<std::underlying_type_t<Quantity>>(q) ];
}
static ConnFracStatistics serializationTestObject()
{
auto stat = ConnFracStatistics{};
stat.quantity_
.fill(RunningStatistics<Scalar>::serializationTestObject());
return stat;
}
bool operator==(const ConnFracStatistics& that) const
{
return this->quantity_ == that.quantity_;
}
private:
using StatArray = std::array<
RunningStatistics<Scalar>,
static_cast<std::underlying_type_t<Quantity>>(Quantity::NumQuantities)
>;
StatArray quantity_{};
};
} // namespace Opm
#endif // OPM_CONNFRACSTATISTICS_HPP
Opm::ConnFracStatistics
Collection of fracturing statistics measures at the connection level.
Definition ConnFracStatistics.hpp:37
Opm::ConnFracStatistics::reset
void reset()
Reset internal counters to prepare for calculating a new set of sample statistics.
Definition ConnFracStatistics.hpp:77
Opm::ConnFracStatistics::operator==
bool operator==(const ConnFracStatistics &that) const
Equality predicate.
Definition ConnFracStatistics.hpp:122
Opm::ConnFracStatistics::addSamplePoint
void addSamplePoint(const SamplePoint &samplePoint)
Include new element into sample.
Definition ConnFracStatistics.hpp:88
Opm::ConnFracStatistics::Quantity
Quantity
Known quantities for which this collection provides statistics measures.
Definition ConnFracStatistics.hpp:42
Opm::ConnFracStatistics::Quantity::Width
@ Width
Fracture width.
Definition ConnFracStatistics.hpp:50
Opm::ConnFracStatistics::Quantity::FlowRate
@ FlowRate
Fracture flow rate.
Definition ConnFracStatistics.hpp:47
Opm::ConnFracStatistics::Quantity::Pressure
@ Pressure
Fracture pressure.
Definition ConnFracStatistics.hpp:44
Opm::ConnFracStatistics::SamplePoint
std::array< Scalar, static_cast< std::underlying_type_t< Quantity > >(Quantity::NumQuantities)> SamplePoint
Sample point representation.
Definition ConnFracStatistics.hpp:61
Opm::ConnFracStatistics::statistics
const RunningStatistics< Scalar > & statistics(const Quantity q) const
Retrieve collection of sample statistics for a single quantity.
Definition ConnFracStatistics.hpp:100
Opm::ConnFracStatistics::serializationTestObject
static ConnFracStatistics serializationTestObject()
Create a serialisation test object.
Definition ConnFracStatistics.hpp:106
Opm::ConnFracStatistics::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition ConnFracStatistics.hpp:70
Opm::RunningStatistics
Facility for calculating simple sample statistics without having full sample available.
Definition RunningStatistics.hpp:36
Opm::RunningStatistics::serializationTestObject
static RunningStatistics serializationTestObject()
Create a serialisation test object.
Definition RunningStatistics.hpp:54
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43