forked from CEMeNT-PSAAP/MCDC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Numba mode works for capture xsec uq
- Loading branch information
Showing
7 changed files
with
148 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import h5py | ||
import numpy as np | ||
|
||
f = h5py.File('output.h5','r') | ||
Nb = 1E4 | ||
mean = f['tally']['exit']['mean'][:][1] | ||
sdev = f['tally']['exit']['sdev'][:][1] | ||
varp = f['tally']['exit']['uq_var'][:][1] | ||
|
||
exact = 5.504/1000 | ||
|
||
print('Var param: ' + str(varp)) | ||
total = (sdev**2)*Nb | ||
print('Var total: ' + str(total)) | ||
print('param error: ' + str(abs(exact-varp))) | ||
print('total error: ' + str(abs(exact-total))) | ||
|
||
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import numpy as np | ||
import mcdc | ||
|
||
|
||
def submit_mcdc(seed, output): | ||
# ============================================================================= | ||
# Set model | ||
# ============================================================================= | ||
# Three slab layers with different purely-absorbing materials | ||
|
||
# Set materials | ||
m1 = mcdc.material(capture=np.array([0.90])) | ||
m2 = mcdc.material(capture=np.array([0.15])) | ||
m3 = mcdc.material(capture=np.array([0.60])) | ||
|
||
# Set surfaces | ||
s1 = mcdc.surface("plane-x", x=-1.0, bc="vacuum") | ||
s2 = mcdc.surface("plane-x", x=2.0) | ||
s3 = mcdc.surface("plane-x", x=5.0) | ||
s4 = mcdc.surface("plane-x", x=6.0, bc="vacuum") | ||
|
||
# Set cells | ||
mcdc.cell([+s1, -s2], m1) | ||
mcdc.cell([+s2, -s3], m2) | ||
mcdc.cell([+s3, -s4], m3) | ||
|
||
# ============================================================================= | ||
# Set source | ||
# ============================================================================= | ||
# Incident beam source | ||
mcdc.source(point=[0.0, 0.0, 0.0], direction=[1.0, 0.0, 0.0]) | ||
|
||
# ============================================================================= | ||
# Set tally, setting, and run mcdc | ||
# ============================================================================= | ||
|
||
# Tally: cell-average fluxes | ||
mcdc.tally( | ||
scores=["exit"], | ||
x=np.linspace(0.0, 6.0, 2) | ||
) | ||
|
||
# Setting | ||
mcdc.setting(N_particle=1E3, N_batch=1E3, rng_seed=seed, output_name=output) | ||
|
||
mcdc.uq(material=m1, distribution="uniform", capture=np.array([0.7])) | ||
mcdc.uq(material=m2, distribution="uniform", capture=np.array([0.12])) | ||
mcdc.uq(material=m3, distribution="uniform", capture=np.array([0.5])) | ||
|
||
# Run | ||
mcdc.run() | ||
|
||
|
||
for i in range(10): | ||
seed = np.random.randint(10000000) | ||
output = 'output' + str(i) | ||
submit_mcdc(seed, output) |