Skip to content

Commit

Permalink
Report Connection Level Fracturing Statistics to I/O Layer
Browse files Browse the repository at this point in the history
Populates the new data::Connection::fract data member.
  • Loading branch information
bska committed Dec 20, 2024
1 parent 52e5a3f commit 7764476
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
3 changes: 3 additions & 0 deletions opm/simulators/wells/PerfData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ PerfData<Scalar> PerfData<Scalar>::serializationTestObject()
result.skin_pressure = {27.0, 28.0};
result.water_velocity = {29.0, 30.0};
result.filtrate_data = ConnFiltrateData<Scalar>::serializationTestObject();
result.connFracStatistics.assign(3, ConnFracStatistics<Scalar>::serializationTestObject());

return result;
}
Expand Down Expand Up @@ -124,6 +125,7 @@ bool PerfData<Scalar>::try_assign(const PerfData& other)
this->skin_pressure = other.skin_pressure;
this->water_velocity = other.water_velocity;
this->filtrate_data = other.filtrate_data;
this->connFracStatistics = other.connFracStatistics;

return true;
}
Expand Down Expand Up @@ -152,6 +154,7 @@ bool PerfData<Scalar>::operator==(const PerfData& rhs) const
&& (this->skin_pressure == rhs.skin_pressure)
&& (this->water_velocity == rhs.water_velocity)
&& (this->filtrate_data == rhs.filtrate_data)
&& (this->connFracStatistics == rhs.connFracStatistics)
;
}

Expand Down
3 changes: 3 additions & 0 deletions opm/simulators/wells/PerfData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define OPM_PERFDATA_HEADER_INCLUDED

#include <opm/simulators/wells/ConnFiltrateData.hpp>
#include <opm/simulators/wells/ConnFracStatistics.hpp>

#include <cstddef>
#include <vector>
Expand Down Expand Up @@ -71,6 +72,7 @@ class PerfData
serializer(skin_pressure);
serializer(water_velocity);
serializer(filtrate_data);
serializer(connFracStatistics);
}

bool operator==(const PerfData&) const;
Expand Down Expand Up @@ -105,6 +107,7 @@ class PerfData
std::vector<Scalar> water_velocity{};

ConnFiltrateData<Scalar> filtrate_data{};
std::vector<ConnFracStatistics<Scalar>> connFracStatistics{};
};

} // namespace Opm
Expand Down
44 changes: 44 additions & 0 deletions opm/simulators/wells/WellState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@

#include <opm/output/data/Wells.hpp>

#include <opm/simulators/wells/ConnFracStatistics.hpp>
#include <opm/simulators/wells/ParallelWellInfo.hpp>
#include <opm/simulators/wells/PerforationData.hpp>
#include <opm/simulators/wells/RunningStatistics.hpp>

#include <opm/simulators/utils/ParallelCommunication.hpp>

Expand Down Expand Up @@ -639,6 +641,11 @@ void WellState<Scalar>::reportConnections(std::vector<data::Connection>& connect
if (! ws.producer) {
this->reportConnectionFilterCake(well_index, connections);
}

if (! perf_data.connFracStatistics.empty()) {
this->reportFractureStatistics(perf_data.connFracStatistics,
connections);
}
}

template<class Scalar>
Expand Down Expand Up @@ -1138,6 +1145,43 @@ reportConnectionFilterCake(const std::size_t well_index,
}
}

template <class Scalar>
void WellState<Scalar>::
reportFractureStatistics(const std::vector<ConnFracStatistics<Scalar>>& stats,
std::vector<data::Connection>& connections) const
{
using Quantity = typename ConnFracStatistics<Scalar>::Quantity;
using StatResult = data::ConnectionFracturing;

auto connIx = 0*connections.size();
for (auto& connection : connections) {
for (const auto& [q, result] : {
std::pair { Quantity::Pressure, &StatResult::press },
std::pair { Quantity::FlowRate, &StatResult::rate },
std::pair { Quantity::Width , &StatResult::width },
})
{
const auto& stat = stats[connIx].statistics(q);

if (stat.sampleSize() > 0) {
auto& x = connection.fract.*result;

x.avg = stat.mean();
x.min = stat.min();
x.max = stat.max();

if (const auto stdev = stat.stdev(); stdev.has_value()) {
x.stdev = *stdev;
}

connection.fract.numCells = stat.sampleSize();
}
}

++connIx;
}
}

template<class Scalar>
bool WellState<Scalar>::wellIsOwned(std::size_t well_index,
[[maybe_unused]] const std::string& wellName) const
Expand Down
4 changes: 4 additions & 0 deletions opm/simulators/wells/WellState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace Opm

template<class Scalar> class ParallelWellInfo;
template<class Scalar> struct PerforationData;
template<class Scalar> class ConnFracStatistics;
class Schedule;
enum class WellStatus;

Expand Down Expand Up @@ -452,6 +453,9 @@ class WellState

void reportConnectionFilterCake(const std::size_t well_index,
std::vector<data::Connection>& connections) const;

void reportFractureStatistics(const std::vector<ConnFracStatistics<Scalar>>& stats,
std::vector<data::Connection>& connections) const;
};

} // namespace Opm
Expand Down

0 comments on commit 7764476

Please sign in to comment.