From 72a9827c8af2e6bef665ffa8bb59af82c2e3a228 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Thu, 26 Jan 2017 15:11:03 +0100 Subject: [PATCH] EclCpGridManager: export the transmissibilities of the sequential grid This only makes these transmissibilities available for parallel computations. The reason is that in the sequential case, they do not need to be computed during grid creation and they are are also accessible via the problem object. --- ebos/eclcpgridmanager.hh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ebos/eclcpgridmanager.hh b/ebos/eclcpgridmanager.hh index 5f40ac65c..c0d8152d7 100644 --- a/ebos/eclcpgridmanager.hh +++ b/ebos/eclcpgridmanager.hh @@ -41,10 +41,13 @@ class EclCpGridManager; namespace Properties { NEW_TYPE_TAG(EclCpGridManager, INHERITS_FROM(EclBaseGridManager)); +NEW_PROP_TAG(ExportGlobalTransmissibility); + // declare the properties SET_TYPE_PROP(EclCpGridManager, GridManager, Ewoms::EclCpGridManager); SET_TYPE_PROP(EclCpGridManager, Grid, Dune::CpGrid); SET_TYPE_PROP(EclCpGridManager, EquilGrid, typename GET_PROP_TYPE(TypeTag, Grid)); +SET_BOOL_PROP(EclCpGridManager, ExportGlobalTransmissibility, false); } // namespace Properties /*! @@ -84,6 +87,7 @@ public: delete equilCartesianIndexMapper_; delete grid_; delete equilGrid_; + delete globalTrans_; } /*! @@ -145,8 +149,8 @@ public: // transmissibilities are relatively expensive to compute, we only do it if // more than a single process is involved in the simulation. cartesianIndexMapper_ = new CartesianIndexMapper(*grid_); - EclTransmissibility eclTrans(*this); - eclTrans.update(); + globalTrans_ = new EclTransmissibility(*this); + globalTrans_->update(); // convert to transmissibility for faces // TODO: grid_->numFaces() is not generic. use grid_->size(1) instead? (might @@ -177,7 +181,7 @@ public: // FIXME (?): this is not portable! unsigned faceIdx = is.id(); - faceTrans[faceIdx] = eclTrans.transmissibility(I, J); + faceTrans[faceIdx] = globalTrans_->transmissibility(I, J); } } @@ -187,6 +191,11 @@ public: delete cartesianIndexMapper_; cartesianIndexMapper_ = nullptr; + + if (!GET_PROP_VALUE(TypeTag, ExportGlobalTransmissibility)) { + delete globalTrans_; + globalTrans_ = nullptr; + } } #endif @@ -209,6 +218,15 @@ public: std::unordered_set defunctWellNames() const { return defunctWellNames_; } + const EclTransmissibility& globalTransmissibility() const + { return *globalTrans_; } + + void releaseGlobalTransmissibility() + { + delete globalTrans_; + globalTrans_ = nullptr; + } + protected: void createGrids_() { @@ -237,6 +255,7 @@ protected: CartesianIndexMapper* cartesianIndexMapper_; CartesianIndexMapper* equilCartesianIndexMapper_; + EclTransmissibility* globalTrans_; std::unordered_set defunctWellNames_; };