mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
eclwriter: fix regression in parallel
order of constructing and obtaining global transmissibilities was off. replace constructor argument with a setter so it can be set at the appropriate time.
This commit is contained in:
parent
1ea70da7e6
commit
c2211b532f
@ -163,7 +163,6 @@ EclGenericWriter(const Schedule& schedule,
|
|||||||
const GridView& gridView,
|
const GridView& gridView,
|
||||||
const Dune::CartesianIndexMapper<Grid>& cartMapper,
|
const Dune::CartesianIndexMapper<Grid>& cartMapper,
|
||||||
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper,
|
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper,
|
||||||
const TransmissibilityType& globalTrans,
|
|
||||||
bool enableAsyncOutput)
|
bool enableAsyncOutput)
|
||||||
: collectToIORank_(grid,
|
: collectToIORank_(grid,
|
||||||
equilGrid,
|
equilGrid,
|
||||||
@ -175,7 +174,6 @@ EclGenericWriter(const Schedule& schedule,
|
|||||||
, schedule_(schedule)
|
, schedule_(schedule)
|
||||||
, eclState_(eclState)
|
, eclState_(eclState)
|
||||||
, summaryConfig_(summaryConfig)
|
, summaryConfig_(summaryConfig)
|
||||||
, globalTrans_(globalTrans)
|
|
||||||
, cartMapper_(cartMapper)
|
, cartMapper_(cartMapper)
|
||||||
, equilCartMapper_(equilCartMapper)
|
, equilCartMapper_(equilCartMapper)
|
||||||
, equilGrid_(equilGrid)
|
, equilGrid_(equilGrid)
|
||||||
@ -278,18 +276,18 @@ computeTrans_(const std::unordered_map<int,int>& cartesianToActive) const
|
|||||||
int gc2 = std::max(cartIdx1, cartIdx2);
|
int gc2 = std::max(cartIdx1, cartIdx2);
|
||||||
|
|
||||||
if (gc2 - gc1 == 1 && cartDims[0] > 1 ) {
|
if (gc2 - gc1 == 1 && cartDims[0] > 1 ) {
|
||||||
tranx.data[gc1] = globalTrans_.transmissibility(c1, c2);
|
tranx.data[gc1] = globalTrans().transmissibility(c1, c2);
|
||||||
continue; // skip other if clauses as they are false, last one needs some computation
|
continue; // skip other if clauses as they are false, last one needs some computation
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gc2 - gc1 == cartDims[0] && cartDims[1] > 1) {
|
if (gc2 - gc1 == cartDims[0] && cartDims[1] > 1) {
|
||||||
trany.data[gc1] = globalTrans_.transmissibility(c1, c2);
|
trany.data[gc1] = globalTrans().transmissibility(c1, c2);
|
||||||
continue; // skipt next if clause as it needs some computation
|
continue; // skipt next if clause as it needs some computation
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( gc2 - gc1 == cartDims[0]*cartDims[1] ||
|
if ( gc2 - gc1 == cartDims[0]*cartDims[1] ||
|
||||||
directVerticalNeighbors(cartDims, cartesianToActive, gc1, gc2))
|
directVerticalNeighbors(cartDims, cartesianToActive, gc1, gc2))
|
||||||
tranz.data[gc1] = globalTrans_.transmissibility(c1, c2);
|
tranz.data[gc1] = globalTrans().transmissibility(c1, c2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +363,7 @@ exportNncStructure_(const std::unordered_map<int,int>& cartesianToActive) const
|
|||||||
!directVerticalNeighbors(cartDims, cartesianToActive, cc1, cc2)) {
|
!directVerticalNeighbors(cartDims, cartesianToActive, cc1, cc2)) {
|
||||||
// We need to check whether an NNC for this face was also specified
|
// We need to check whether an NNC for this face was also specified
|
||||||
// via the NNC keyword in the deck (i.e. in the first origNncSize entries.
|
// via the NNC keyword in the deck (i.e. in the first origNncSize entries.
|
||||||
auto t = globalTrans_.transmissibility(c1, c2);
|
auto t = globalTrans().transmissibility(c1, c2);
|
||||||
auto candidate = std::lower_bound(nncData.begin(), nncData.end(), NNCdata(cc1, cc2, 0.0));
|
auto candidate = std::lower_bound(nncData.begin(), nncData.end(), NNCdata(cc1, cc2, 0.0));
|
||||||
|
|
||||||
while ( candidate != nncData.end() && candidate->cell1 == cc1
|
while ( candidate != nncData.end() && candidate->cell1 == cc1
|
||||||
@ -519,6 +517,15 @@ evalSummary(int reportStepNum,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Grid, class EquilGrid, class GridView, class ElementMapper, class Scalar>
|
||||||
|
const typename EclGenericWriter<Grid,EquilGrid,GridView,ElementMapper,Scalar>::TransmissibilityType&
|
||||||
|
EclGenericWriter<Grid,EquilGrid,GridView,ElementMapper,Scalar>::
|
||||||
|
globalTrans() const
|
||||||
|
{
|
||||||
|
assert (globalTrans_);
|
||||||
|
return *globalTrans_;
|
||||||
|
}
|
||||||
|
|
||||||
#if HAVE_DUNE_FEM
|
#if HAVE_DUNE_FEM
|
||||||
template class EclGenericWriter<Dune::CpGrid,
|
template class EclGenericWriter<Dune::CpGrid,
|
||||||
Dune::CpGrid,
|
Dune::CpGrid,
|
||||||
|
@ -69,14 +69,20 @@ public:
|
|||||||
const GridView& gridView,
|
const GridView& gridView,
|
||||||
const Dune::CartesianIndexMapper<Grid>& cartMapper,
|
const Dune::CartesianIndexMapper<Grid>& cartMapper,
|
||||||
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper,
|
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper,
|
||||||
const TransmissibilityType& globalTrans,
|
|
||||||
bool enableAsyncOutput);
|
bool enableAsyncOutput);
|
||||||
|
|
||||||
const EclipseIO& eclIO() const;
|
const EclipseIO& eclIO() const;
|
||||||
|
|
||||||
void writeInit();
|
void writeInit();
|
||||||
|
|
||||||
|
void setTransmissibilities(const TransmissibilityType* globalTrans)
|
||||||
|
{
|
||||||
|
globalTrans_ = globalTrans;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
const TransmissibilityType& globalTrans() const;
|
||||||
|
|
||||||
void doWriteOutput(const int reportStepNum,
|
void doWriteOutput(const int reportStepNum,
|
||||||
const bool isSubStep,
|
const bool isSubStep,
|
||||||
data::Solution&& localCellData,
|
data::Solution&& localCellData,
|
||||||
@ -114,7 +120,7 @@ protected:
|
|||||||
std::unique_ptr<EclipseIO> eclIO_;
|
std::unique_ptr<EclipseIO> eclIO_;
|
||||||
std::unique_ptr<TaskletRunner> taskletRunner_;
|
std::unique_ptr<TaskletRunner> taskletRunner_;
|
||||||
Scalar restartTimeStepSize_;
|
Scalar restartTimeStepSize_;
|
||||||
const TransmissibilityType& globalTrans_;
|
const TransmissibilityType* globalTrans_ = nullptr;
|
||||||
const Dune::CartesianIndexMapper<Grid>& cartMapper_;
|
const Dune::CartesianIndexMapper<Grid>& cartMapper_;
|
||||||
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper_;
|
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper_;
|
||||||
const EquilGrid* equilGrid_;
|
const EquilGrid* equilGrid_;
|
||||||
|
@ -791,7 +791,7 @@ public:
|
|||||||
ExtboModule::initFromState(vanguard.eclState());
|
ExtboModule::initFromState(vanguard.eclState());
|
||||||
|
|
||||||
// create the ECL writer
|
// create the ECL writer
|
||||||
eclWriter_.reset(new EclWriterType(simulator, *this));
|
eclWriter_.reset(new EclWriterType(simulator));
|
||||||
|
|
||||||
enableDriftCompensation_ = EWOMS_GET_PARAM(TypeTag, bool, EclEnableDriftCompensation);
|
enableDriftCompensation_ = EWOMS_GET_PARAM(TypeTag, bool, EclEnableDriftCompensation);
|
||||||
|
|
||||||
@ -926,8 +926,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write the static output files (EGRID, INIT, SMSPEC, etc.)
|
// write the static output files (EGRID, INIT, SMSPEC, etc.)
|
||||||
if (enableEclOutput_)
|
if (enableEclOutput_) {
|
||||||
|
if (simulator.vanguard().grid().comm().size() > 1) {
|
||||||
|
if (simulator.vanguard().grid().comm().rank() == 0)
|
||||||
|
eclWriter_->setTransmissibilities(&simulator.vanguard().globalTransmissibility());
|
||||||
|
} else
|
||||||
|
eclWriter_->setTransmissibilities(&simulator.problem().eclTransmissibilities());
|
||||||
|
|
||||||
eclWriter_->writeInit();
|
eclWriter_->writeInit();
|
||||||
|
}
|
||||||
|
|
||||||
simulator.vanguard().releaseGlobalTransmissibilities();
|
simulator.vanguard().releaseGlobalTransmissibilities();
|
||||||
|
|
||||||
|
@ -112,8 +112,7 @@ public:
|
|||||||
// The Simulator object should preferably have been const - the
|
// The Simulator object should preferably have been const - the
|
||||||
// only reason that is not the case is due to the SummaryState
|
// only reason that is not the case is due to the SummaryState
|
||||||
// object owned deep down by the vanguard.
|
// object owned deep down by the vanguard.
|
||||||
template<class Problem>
|
EclWriter(Simulator& simulator)
|
||||||
EclWriter(Simulator& simulator, const Problem& problem)
|
|
||||||
: BaseType(simulator.vanguard().schedule(),
|
: BaseType(simulator.vanguard().schedule(),
|
||||||
simulator.vanguard().eclState(),
|
simulator.vanguard().eclState(),
|
||||||
simulator.vanguard().summaryConfig(),
|
simulator.vanguard().summaryConfig(),
|
||||||
@ -122,7 +121,6 @@ public:
|
|||||||
simulator.vanguard().gridView(),
|
simulator.vanguard().gridView(),
|
||||||
simulator.vanguard().cartesianIndexMapper(),
|
simulator.vanguard().cartesianIndexMapper(),
|
||||||
simulator.vanguard().grid().comm().rank() == 0 ? &simulator.vanguard().equilCartesianIndexMapper() : nullptr,
|
simulator.vanguard().grid().comm().rank() == 0 ? &simulator.vanguard().equilCartesianIndexMapper() : nullptr,
|
||||||
simulator.vanguard().grid().comm().size() > 1 ? simulator.vanguard().globalTransmissibility() : problem.eclTransmissibilities(),
|
|
||||||
EWOMS_GET_PARAM(TypeTag, bool, EnableAsyncEclOutput))
|
EWOMS_GET_PARAM(TypeTag, bool, EnableAsyncEclOutput))
|
||||||
, simulator_(simulator)
|
, simulator_(simulator)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(Summary)
|
|||||||
|
|
||||||
typedef Opm::EclWriter<TypeTag> EclWriterType;
|
typedef Opm::EclWriter<TypeTag> EclWriterType;
|
||||||
// create the actual ECL writer
|
// create the actual ECL writer
|
||||||
std::unique_ptr<EclWriterType> eclWriter = std::unique_ptr<EclWriterType>(new EclWriterType(*simulator, simulator->problem()));
|
std::unique_ptr<EclWriterType> eclWriter = std::unique_ptr<EclWriterType>(new EclWriterType(*simulator));
|
||||||
|
|
||||||
simulator->model().applyInitialSolution();
|
simulator->model().applyInitialSolution();
|
||||||
Opm::data::Wells dw;
|
Opm::data::Wells dw;
|
||||||
|
Loading…
Reference in New Issue
Block a user