Calculate Local Face Area Fraction for Aquifer's Connections

This is in preparation of reinitialising the total produced volume
from the constant flux aquifer from the restart file in the case
that the aquifer's connections are split across multiple MPI ranks.
This commit is contained in:
Bård Skaflestad 2023-03-09 18:25:36 +01:00
parent 35621058c6
commit 5586ce63a0

View File

@ -58,7 +58,8 @@ public:
, aquifer_data_ (aquifer) , aquifer_data_ (aquifer)
, connection_flux_ (connections_.size(), Eval{0}) , connection_flux_ (connections_.size(), Eval{0})
{ {
this->initializeConnections(); const auto connected_face_area = this->initializeConnections();
this->area_fraction_ = this->computeFaceAreaFraction(connected_face_area);
} }
static AquiferConstantFlux serializationTestObject(const Simulator& ebos_simulator) static AquiferConstantFlux serializationTestObject(const Simulator& ebos_simulator)
@ -149,9 +150,15 @@ private:
std::vector<int> cellToConnectionIdx_{}; std::vector<int> cellToConnectionIdx_{};
double flux_rate_{}; double flux_rate_{};
double cumulative_flux_{}; double cumulative_flux_{};
double area_fraction_{1.0};
double initializeConnections()
{
auto connected_face_area = 0.0;
this->cellToConnectionIdx_
.resize(this->ebos_simulator_.gridView().size(/*codim=*/0), -1);
void initializeConnections() {
this->cellToConnectionIdx_.resize(this->ebos_simulator_.gridView().size(/*codim=*/0), -1);
for (std::size_t idx = 0; idx < this->connections_.size(); ++idx) { for (std::size_t idx = 0; idx < this->connections_.size(); ++idx) {
const auto global_index = this->connections_[idx].global_index; const auto global_index = this->connections_[idx].global_index;
const int cell_index = this->ebos_simulator_.vanguard() const int cell_index = this->ebos_simulator_.vanguard()
@ -162,11 +169,25 @@ private:
} }
this->cellToConnectionIdx_[cell_index] = idx; this->cellToConnectionIdx_[cell_index] = idx;
connected_face_area += this->connections_[idx].effective_facearea;
} }
// TODO: At the moment, we are using the effective_facearea from the // TODO: At the moment, we are using the effective_facearea from the
// parser. Should we update the facearea here if the grid changed // parser. Should we update the facearea here if the grid changed
// during the preprocessing? // during the preprocessing?
return connected_face_area;
}
double computeFaceAreaFraction(const double connected_face_area) const
{
const auto tot_face_area = this->ebos_simulator_.vanguard()
.grid().comm().sum(connected_face_area);
return (tot_face_area > 0.0)
? connected_face_area / tot_face_area
: 0.0;
} }
// TODO: this is a function from AquiferAnalytical // TODO: this is a function from AquiferAnalytical