Push index map to Damaris for output ordering.

This commit is contained in:
Atgeirr Flø Rasmussen 2022-11-04 11:04:24 +01:00
parent 58cf299171
commit 18f6f5e4e3
3 changed files with 12 additions and 2 deletions

View File

@ -110,7 +110,12 @@ public:
{ return toIORankComm_.size() > 1; } { return toIORankComm_.size() > 1; }
int localIdxToGlobalIdx(unsigned localIdx) const; int localIdxToGlobalIdx(unsigned localIdx) const;
const std::vector<int>& localIdxToGlobalIdxMapping() const
{
return localIdxToGlobalIdx_;
}
bool doesNeedReordering() const bool doesNeedReordering() const
{ return needsReordering;} { return needsReordering;}

View File

@ -309,8 +309,11 @@ public:
// N.B. damarisUpdate_ should be set to true if at any time the model geometry changes // N.B. damarisUpdate_ should be set to true if at any time the model geometry changes
if (this->damarisUpdate_) { if (this->damarisUpdate_) {
const auto& gridView = simulator_.gridView(); const auto& gridView = simulator_.gridView();
const int numElements = gridView.size(/*codim=*/0); // This it is the local ranks model size. const auto& interior_elements = elements(gridView, Dune::Partitions::interior);
const int numElements = std::distance(interior_elements.begin(), interior_elements.end());
Opm::DamarisOutput::setupDamarisWritingPars(simulator_.vanguard().grid().comm(), numElements); Opm::DamarisOutput::setupDamarisWritingPars(simulator_.vanguard().grid().comm(), numElements);
const std::vector<int>& local_to_global = this->collectToIORank_.localIdxToGlobalIdxMapping();
damaris_write("GLOBAL_CELL_INDEX", local_to_global.data());
// By default we assume static grid // By default we assume static grid
this->damarisUpdate_ = false; this->damarisUpdate_ = false;
} }

View File

@ -47,6 +47,8 @@ std::string initDamarisXmlFile()
<parameter name="n_elements_local" type="int" value="1" /> <parameter name="n_elements_local" type="int" value="1" />
<parameter name="n" type="int" value="1" /> <parameter name="n" type="int" value="1" />
<layout name="zonal_layout_usmesh_integer" type="int" dimensions="n_elements_local" global="n_elements_total" comment="For the field data e.g. Pressure" />
<variable name="GLOBAL_CELL_INDEX" layout="zonal_layout_usmesh_integer" type="scalar" visualizable="false" time-varying="false" centering="zonal" />
<layout name="zonal_layout_usmesh" type="double" dimensions="n_elements_local" global="n_elements_total" comment="For the field data e.g. Pressure" /> <layout name="zonal_layout_usmesh" type="double" dimensions="n_elements_local" global="n_elements_total" comment="For the field data e.g. Pressure" />
<variable name="PRESSURE" layout="zonal_layout_usmesh" type="scalar" visualizable="false" unit="Pa" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" /> <variable name="PRESSURE" layout="zonal_layout_usmesh" type="scalar" visualizable="false" unit="Pa" centering="zonal" store="_MYSTORE_OR_EMPTY_REGEX_" />
_MORE_VARIABLES_REGEX_ _MORE_VARIABLES_REGEX_