From 4d59405e78074e4180d91414119190405b77f668 Mon Sep 17 00:00:00 2001 From: aprilnovak Date: Tue, 18 Jun 2019 18:32:47 -0700 Subject: [PATCH] Incorporating comments from @RonRahaman. Refs #17 --- include/enrico/openmc_nek_driver.h | 5 ----- src/openmc_nek_driver.cpp | 11 ++++++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/enrico/openmc_nek_driver.h b/include/enrico/openmc_nek_driver.h index ff255857..1546b547 100644 --- a/include/enrico/openmc_nek_driver.h +++ b/include/enrico/openmc_nek_driver.h @@ -125,11 +125,6 @@ class OpenmcNekDriver : public CoupledDriver { //! ordered according to an MPI_Gatherv operation on Nek5000's local elements. xt::xtensor elem_volumes_; - //! The dimensionless densities of Nek's global elements - //! These are **not** ordered by Nek's global element indices. Rather, these are - //! ordered according to an MPI_Gatherv operation on Nek5000's local elements. - xt::xtensor elem_densities_; - //! Map that gives a list of Nek element global indices for a given OpenMC material //! index. The Nek global element indices refer to indices defined by the MPI_Gatherv //! operation, and do not reflect Nek's internal global element indexing. diff --git a/src/openmc_nek_driver.cpp b/src/openmc_nek_driver.cpp index c130162b..834f9b66 100644 --- a/src/openmc_nek_driver.cpp +++ b/src/openmc_nek_driver.cpp @@ -265,15 +265,20 @@ void OpenmcNekDriver::init_densities() // each Nek element is fully contained within an OpenMC cell, i.e. Nek // elements are not split between multiple OpenMC cells. for (int i = 0; i < openmc_driver_->cells_.size(); ++i) { - if (cell_fluid_mask_[i] == 1) { - auto& c = openmc_driver_->cells_[i]; - const auto& global_elems = mat_to_elems_.at(c.material_index_); + auto& c = openmc_driver_->cells_[i]; + const auto& global_elems = mat_to_elems_.at(c.material_index_); + if (cell_fluid_mask_[i] == 1) { for (int elem: global_elems) { double rho = c.get_density(); densities_[elem] = rho; densities_prev_[elem] = rho; } + } else { + for (int elem: global_elems) { + densities_[elem] = 0.0; + densities_prev_[elem] = 0.0; + } } } }