From 2f43fa3960d81a41b25426c2e9188493c887c54f Mon Sep 17 00:00:00 2001 From: Shikhar Kumar Date: Thu, 16 Aug 2018 20:12:04 -0400 Subject: [PATCH] Set cmfd tally type and estimator through C API --- examples/cmfd_testing/basic/capi/run_openmc_cmfd.py | 3 +-- openmc/cmfd.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/cmfd_testing/basic/capi/run_openmc_cmfd.py b/examples/cmfd_testing/basic/capi/run_openmc_cmfd.py index d377c0cd14..5db5394ac0 100644 --- a/examples/cmfd_testing/basic/capi/run_openmc_cmfd.py +++ b/examples/cmfd_testing/basic/capi/run_openmc_cmfd.py @@ -7,15 +7,14 @@ cmfd_mesh.lower_left = [-10, -1, -1] cmfd_mesh.upper_right = [10, 1, 1] cmfd_mesh.dimension = [10, 1, 1] cmfd_mesh.albedo = [0., 0., 1., 1., 1., 1.] -cmfd_mesh.energy = [0.001, 0.01, 0.1] # Initialize CMFDRun object cmfd_run = openmc.CMFDRun() # Set all runtime parameters (cmfd_mesh, tolerances, tally_resets, etc) - # All error checking done under the hood when setter function called cmfd_run.cmfd_mesh = cmfd_mesh +cmfd_run.cmfd_reset = [5,10] # Run CMFD cmfd_run.run() diff --git a/openmc/cmfd.py b/openmc/cmfd.py index 0a0adb6780..3cf5e6cbec 100644 --- a/openmc/cmfd.py +++ b/openmc/cmfd.py @@ -637,7 +637,7 @@ class CMFDRun(object): self._cmfd_shift = 1.e-6 self._cmfd_spectral = 0. self._cmfd_stol = 1.e-8 - self._cmfd_reset = [5,10] + self._cmfd_reset = [] self._cmfd_write_matrices = False # External variables used during runtime but users don't have control over @@ -899,7 +899,7 @@ class CMFDRun(object): #call time_cmfdsolve % reset() # Initialize all numpy arrays used for cmfd solver - self._allocate_cmfd(n_batches) + self._allocate_cmfd() def _read_cmfd_input(self): print(' Configuring CMFD parameters for simulation') @@ -1085,6 +1085,8 @@ class CMFDRun(object): tally.filters = [mesh_filter] # Set scores for tally tally.scores = ['flux', 'total'] + tally.type = 'volume' + tally.estimator = 'analog' # Set attributes of CMFD neutron production tally if i == 1: @@ -1095,6 +1097,8 @@ class CMFDRun(object): tally.filters = [mesh_filter] # Set scores for tally tally.scores = ['nu-scatter', 'nu-fission'] + tally.type = 'volume' + tally.estimator = 'analog' # Set attributes of CMFD surface current tally if i == 2: @@ -1105,6 +1109,8 @@ class CMFDRun(object): tally.filters = [meshsurface_filter] # Set scores for tally tally.scores = ['current'] + tally.type = 'mesh-surface' + tally.estimator = 'analog' # Set attributes of CMFD P1 scatter tally if i == 3: @@ -1115,6 +1121,8 @@ class CMFDRun(object): tally.filters = [mesh_filter, legendre_filter] # Set scores for tally tally.scores = ['scatter'] + tally.type = 'volume' + tally.estimator = 'analog' # Set all tallies to be active from beginning tally.active = True \ No newline at end of file