add changes to fix the order

enabling reordering as default
This commit is contained in:
Elyes Ahmed 2024-09-25 10:09:39 +02:00
parent 02555ac504
commit 6c2e957df0
4 changed files with 12 additions and 6 deletions

View File

@ -17,6 +17,9 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
// The default in dune-ALUGrird is "DISABLE_ALUGRID_SFC_ORDERING is false"
#undef DISABLE_ALUGRID_SFC_ORDERING
#undef USE_ALUGRID_SFC_ORDERING
#include <dune/alugrid/grid.hh>
#include <opm/simulators/flow/Main.hpp>

View File

@ -325,7 +325,8 @@ protected:
factory_ = std::make_unique<Factory>();
grid_ = factory_->convert(*equilGrid_, cartesianCellId_, ordering_);
OpmLog::warning("Space Filling Curve Ordering is not yet supported: DISABLE_ALUGRID_SFC_ORDERING is enabled");
OpmLog::warning("Space Filling Curve Ordering (SFCO) is used");
OpmLog::warning("Add '#define DISABLE_ALUGRID_SFC_ORDERING 1' to disable SFC reordering");
equilGridToGrid_.resize(ordering_.size());
for (std::size_t index = 0; index < ordering_.size(); ++index) {
equilGridToGrid_[ordering_[index]] = index;

View File

@ -451,10 +451,11 @@ public:
const auto& residual = this->model().linearizer().residual();
for (unsigned globalDofIdx = 0; globalDofIdx < residual.size(); globalDofIdx ++) {
this->drift_[globalDofIdx] = residual[globalDofIdx] * simulator.timeStepSize();
int sfcdofIdx = simulator.vanguard().gridEquilIdxToGridIdx(globalDofIdx);
this->drift_[sfcdofIdx] = residual[sfcdofIdx] * simulator.timeStepSize();
if constexpr (getPropValue<TypeTag, Properties::UseVolumetricResidual>()) {
this->drift_[globalDofIdx] *= this->model().dofTotalVolume(globalDofIdx);
this->drift_[sfcdofIdx] *= this->model().dofTotalVolume(sfcdofIdx);
}
}
}
@ -1375,14 +1376,15 @@ protected:
const auto& fp = eclState.fieldProps();
const std::vector<double> porvData = this -> fieldPropDoubleOnLeafAssigner_()(fp, "PORV");
for (std::size_t dofIdx = 0; dofIdx < numDof; ++dofIdx) {
int sfcdofIdx = simulator.vanguard().gridEquilIdxToGridIdx(dofIdx);
Scalar poreVolume = porvData[dofIdx];
// we define the porosity as the accumulated pore volume divided by the
// geometric volume of the element. Note that -- in pathetic cases -- it can
// be larger than 1.0!
Scalar dofVolume = simulator.model().dofTotalVolume(dofIdx);
Scalar dofVolume = simulator.model().dofTotalVolume(sfcdofIdx);
assert(dofVolume > 0.0);
this->referencePorosity_[/*timeIdx=*/0][dofIdx] = poreVolume/dofVolume;
this->referencePorosity_[/*timeIdx=*/0][sfcdofIdx] = poreVolume/dofVolume;
}
}

View File

@ -134,7 +134,7 @@ namespace Opm {
const auto& fs = intQuants.fluidState();
// use pore volume weighted averages.
const Scalar pv_cell =
simulator.model().dofTotalVolume(cellIdx)
simulator.model().dofTotalVolume(simulator.vanguard().gridEquilIdxToGridIdx(cellIdx))
* intQuants.porosity().value();
// only count oil and gas filled parts of the domain