From ee077b4d6168cc2dbfe6a1b2c51bccfb4805d522 Mon Sep 17 00:00:00 2001 From: Shikhar Kumar Date: Tue, 9 Feb 2021 13:47:04 -0500 Subject: [PATCH] Define cmfd_src on all procs --- openmc/cmfd.py | 9 ++++++--- openmc/lib/mesh.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/openmc/cmfd.py b/openmc/cmfd.py index 91c264633..61bda9ed9 100644 --- a/openmc/cmfd.py +++ b/openmc/cmfd.py @@ -1090,6 +1090,12 @@ class CMFDRun: # Initialize parameters for CMFD tally windows self._set_tally_window() + # Extract spatial and energy indices + nx, ny, nz, ng = self._indices + + # Initialize CMFD source to all ones + self._cmfd_src = np.ones((nx, ny, nz, ng)) + # Define all variables that will exist only on master process if openmc.lib.master(): # Set global albedo @@ -1101,9 +1107,6 @@ class CMFDRun: # Set up CMFD coremap self._set_coremap() - # Extract spatial and energy indices - nx, ny, nz, ng = self._indices - # Allocate parameters that need to be stored for tally window self._openmc_src_rate = np.zeros((nx, ny, nz, ng, 0)) self._flux_rate = np.zeros((nx, ny, nz, ng, 0)) diff --git a/openmc/lib/mesh.py b/openmc/lib/mesh.py index 90db09397..79404c628 100644 --- a/openmc/lib/mesh.py +++ b/openmc/lib/mesh.py @@ -3,6 +3,7 @@ from ctypes import (c_int, c_int32, c_char_p, c_double, POINTER, create_string_buffer) from weakref import WeakValueDictionary +import numpy as np from numpy.ctypeslib import as_array from ..exceptions import AllocationError, InvalidIDError