Merge pull request #5817 from daavid00/allocTrans

Skip allocTrans when !(enableEclOutput || loadBalancerSet == 0 || partitionJacobiBlocks)
This commit is contained in:
Atgeirr Flø Rasmussen 2025-01-16 07:47:22 +01:00 committed by GitHub
commit 82665d23e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 20 additions and 19 deletions

View File

@ -233,7 +233,7 @@ public:
this->imbalanceTol(),
this->gridView(), this->schedule(),
this->eclState(), this->parallelWells_,
this->numJacobiBlocks());
this->numJacobiBlocks(), this->enableEclOutput());
#endif
this->updateGridView_();

View File

@ -65,9 +65,6 @@
namespace Opm::Parameters {
// enable the ECL output by default
struct EnableEclOutput { static constexpr bool value = true; };
// If available, write the ECL output in a non-blocking manner
struct EnableAsyncEclOutput { static constexpr bool value = true; };

View File

@ -126,6 +126,7 @@ FlowGenericVanguard::FlowGenericVanguard(SimulationModelParams&& params)
externalPartitionFile_ = Parameters::Get<Parameters::ExternalPartition>();
#endif
enableDistributedWells_ = Parameters::Get<Parameters::AllowDistributedWells>();
enableEclOutput_ = Parameters::Get<Parameters::EnableEclOutput>();
allow_splitting_inactive_wells_ = Parameters::Get<Parameters::AllowSplittingInactiveWells>();
ignoredKeywords_ = Parameters::Get<Parameters::IgnoreKeywords>();
int output_param = Parameters::Get<Parameters::EclOutputInterval>();
@ -416,6 +417,8 @@ void FlowGenericVanguard::registerParameters_()
("The number of report steps that ought to be skipped between two writes of ECL results");
Parameters::Register<Parameters::EnableDryRun>
("Specify if the simulation ought to be actually run, or just pretended to be");
Parameters::Register<Parameters::EnableEclOutput>
("Write binary output which is compatible with the commercial Eclipse simulator");
Parameters::Register<Parameters::EnableOpmRstFile>
("Include OPM-specific keywords in the ECL restart file to "
"enable restart of OPM simulators from these files");

View File

@ -53,6 +53,7 @@ struct AllowSplittingInactiveWells { static constexpr bool value = true; };
struct EclOutputInterval { static constexpr int value = -1; };
struct EdgeWeightsMethod { static constexpr int value = 1; };
struct EnableDryRun { static constexpr auto value = "auto"; };
struct EnableEclOutput { static constexpr auto value = true; };
struct EnableOpmRstFile { static constexpr bool value = false; };
struct ExternalPartition { static constexpr auto* value = ""; };
@ -292,6 +293,12 @@ public:
bool enableDistributedWells() const
{ return enableDistributedWells_; }
/*!
* \brief Wheter to write binary output which is compatible with the commercial Eclipse simulator.
*/
bool enableEclOutput() const
{ return enableEclOutput_; }
/*!
* \brief Returns vector with name and whether the has local perforated cells
* for all wells.
@ -363,6 +370,7 @@ protected:
std::string externalPartitionFile_{};
#endif
bool enableDistributedWells_;
bool enableEclOutput_;
bool allow_splitting_inactive_wells_;
std::string ignoredKeywords_;

View File

@ -42,9 +42,6 @@ void registerFlowProblemParameters()
Parameters::Register<Parameters::EnableWriteAllSolutions>
("Write all solutions to disk instead of only the ones for the "
"report steps");
Parameters::Register<Parameters::EnableEclOutput>
("Write binary output which is compatible with the commercial "
"Eclipse simulator");
#if HAVE_DAMARIS
Parameters::Register<Parameters::EnableDamarisOutput>
("Write a specific variable using Damaris in a separate core");

View File

@ -153,7 +153,8 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
const Schedule& schedule,
EclipseState& eclState1,
FlowGenericVanguard::ParallelWellStruct& parallelWells,
const int numJacobiBlocks)
const int numJacobiBlocks,
const bool enableEclOutput)
{
if ((partitionMethod == Dune::PartitionMethod::zoltan
|| partitionMethod == Dune::PartitionMethod::zoltanGoG) && !this->zoltanParams().empty())
@ -167,16 +168,6 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
(numJacobiBlocks > 1) && (mpiSize == 1);
if ((mpiSize > 1) || (numJacobiBlocks > 1)) {
if (this->grid_->size(0) > 0) {
// Generally needed in parallel runs both when there is and when
// there is not an externally defined load-balancing function.
// In addition to being used in CpGrid::loadBalance(), the
// transmissibilities are also output to the .INIT file. Thus,
// transmissiblity values must exist on the I/O rank for derived
// classes such as EclCpGridVanguard<>.
this->allocTrans();
}
// CpGrid's loadBalance() method uses transmissibilities as edge
// weights. This is arguably a layering violation and extracting
// the per-face transmissibilities as a linear array is relatively
@ -185,6 +176,10 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
auto loadBalancerSet = static_cast<int>(externalLoadBalancer.has_value());
this->grid_->comm().broadcast(&loadBalancerSet, 1, 0);
if ((this->grid_->size(0) > 0) && (enableEclOutput || loadBalancerSet == 0 || partitionJacobiBlocks)) {
this->allocTrans();
}
std::vector<double> faceTrans;
{
OPM_TIMEBLOCK(extractTrans);

View File

@ -167,7 +167,8 @@ protected:
const Schedule& schedule,
EclipseState& eclState,
FlowGenericVanguard::ParallelWellStruct& parallelWells,
const int numJacobiBlocks);
const int numJacobiBlocks,
const bool enableEclOutput);
void distributeFieldProps_(EclipseState& eclState);