Skip to content

Commit

Permalink
update examples to follow the new csg region interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhamv committed Oct 7, 2024
1 parent f151b67 commit 78ecaca
Show file tree
Hide file tree
Showing 38 changed files with 482 additions and 966 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# =============================================================================

# Load material data
lib = h5py.File("2d_c5g7_xs.h5", "r")
lib = h5py.File("../../MGXS-C5G7.h5", "r")


# Materials
Expand Down Expand Up @@ -51,13 +51,13 @@ def set_mat(mat):
modi = mcdc.cell(-cy, mat_mod) # For all-water lattice

# Universes
u = mcdc.universe(uo2, mod)["ID"]
l = mcdc.universe(mox4, mod)["ID"]
m = mcdc.universe(mox7, mod)["ID"]
n = mcdc.universe(mox8, mod)["ID"]
g = mcdc.universe(gt, mod)["ID"]
f = mcdc.universe(fc, mod)["ID"]
w = mcdc.universe(modi, mod)["ID"]
u = mcdc.universe([uo2, mod])
l = mcdc.universe([mox4, mod])
m = mcdc.universe([mox7, mod])
n = mcdc.universe([mox8, mod])
g = mcdc.universe([gt, mod])
f = mcdc.universe([fc, mod])
w = mcdc.universe([modi, mod])

# =============================================================================
# Assemblies
Expand Down Expand Up @@ -130,9 +130,9 @@ def set_mat(mat):
assembly_mod = mcdc.cell(+x0 & -x1 & +y0 & -y1, lattice_mod)

# Set assemblies in their respective universes
u_ = mcdc.universe([assembly_uo2])["ID"]
m_ = mcdc.universe([assembly_mox])["ID"]
w_ = mcdc.universe([assembly_mod])["ID"]
u_ = mcdc.universe([assembly_uo2])
m_ = mcdc.universe([assembly_mox])
w_ = mcdc.universe([assembly_mod])

# =============================================================================
# Root universe: core
Expand All @@ -155,7 +155,7 @@ def set_mat(mat):
core = mcdc.cell(
+x0_ & -x1_ & +y0_ & -y1_,
lattice_core,
lattice_center=[pitch * 17 * 3 / 2, -pitch * 17 * 3 / 2, 0.0],
translation=[pitch * 17 * 3 / 2, -pitch * 17 * 3 / 2, 0.0],
)

# Root universe
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# =============================================================================

# Load material data
lib = h5py.File("2d_c5g7_xs.h5", "r")
lib = h5py.File("../../MGXS-C5G7.h5", "r")


# Materials
Expand Down Expand Up @@ -41,23 +41,23 @@ def set_mat(mat):
cy = mcdc.surface("cylinder-z", center=[0.0, 0.0], radius=radius)

# Cells
uo2 = mcdc.cell([-cy], mat_uo2)
mox4 = mcdc.cell([-cy], mat_mox43)
mox7 = mcdc.cell([-cy], mat_mox7)
mox8 = mcdc.cell([-cy], mat_mox87)
gt = mcdc.cell([-cy], mat_gt)
fc = mcdc.cell([-cy], mat_fc)
mod = mcdc.cell([+cy], mat_mod)
modi = mcdc.cell([-cy], mat_mod) # For all-water lattice
uo2 = mcdc.cell(-cy, mat_uo2)
mox4 = mcdc.cell(-cy, mat_mox43)
mox7 = mcdc.cell(-cy, mat_mox7)
mox8 = mcdc.cell(-cy, mat_mox87)
gt = mcdc.cell(-cy, mat_gt)
fc = mcdc.cell(-cy, mat_fc)
mod = mcdc.cell(+cy, mat_mod)
modi = mcdc.cell(-cy, mat_mod) # For all-water lattice

# Universes
u = mcdc.universe([uo2, mod])["ID"]
l = mcdc.universe([mox4, mod])["ID"]
m = mcdc.universe([mox7, mod])["ID"]
n = mcdc.universe([mox8, mod])["ID"]
g = mcdc.universe([gt, mod])["ID"]
f = mcdc.universe([fc, mod])["ID"]
w = mcdc.universe([modi, mod])["ID"]
u = mcdc.universe([uo2, mod])
l = mcdc.universe([mox4, mod])
m = mcdc.universe([mox7, mod])
n = mcdc.universe([mox8, mod])
g = mcdc.universe([gt, mod])
f = mcdc.universe([fc, mod])
w = mcdc.universe([modi, mod])

# =============================================================================
# Assemblies
Expand Down Expand Up @@ -125,14 +125,14 @@ def set_mat(mat):
y0 = mcdc.surface("plane-y", y=-pitch * 17 / 2)
y1 = mcdc.surface("plane-y", y=pitch * 17 / 2)
# Cells
assembly_uo2 = mcdc.cell([+x0, -x1, +y0, -y1], lattice_uo2)
assembly_mox = mcdc.cell([+x0, -x1, +y0, -y1], lattice_mox)
assembly_mod = mcdc.cell([+x0, -x1, +y0, -y1], lattice_mod)
assembly_uo2 = mcdc.cell(+x0 & -x1 & +y0 & -y1, lattice_uo2)
assembly_mox = mcdc.cell(+x0 & -x1 & +y0 & -y1, lattice_mox)
assembly_mod = mcdc.cell(+x0 & -x1 & +y0 & -y1, lattice_mod)

# Set assemblies in their respective universes
u_ = mcdc.universe([assembly_uo2])["ID"]
m_ = mcdc.universe([assembly_mox])["ID"]
w_ = mcdc.universe([assembly_mod])["ID"]
u_ = mcdc.universe([assembly_uo2])
m_ = mcdc.universe([assembly_mox])
w_ = mcdc.universe([assembly_mod])

# =============================================================================
# Root universe: core
Expand All @@ -153,9 +153,9 @@ def set_mat(mat):
y1_ = mcdc.surface("plane-y", y=0.0, bc="reflective")
# Cell
core = mcdc.cell(
[+x0_, -x1_, +y0_, -y1_],
+x0_ & -x1_ & +y0_ & -y1_,
lattice_core,
lattice_center=[pitch * 17 * 3 / 2, -pitch * 17 * 3 / 2, 0.0],
translation=[pitch * 17 * 3 / 2, -pitch * 17 * 3 / 2, 0.0],
)

# Root universe
Expand All @@ -177,7 +177,7 @@ def set_mat(mat):
# Tally
x_grid = np.linspace(0.0, pitch * 17 * 3, 17 * 3 + 1)
y_grid = np.linspace(-pitch * 17 * 3, 0.0, 17 * 3 + 1)
mcdc.tally(scores=["flux"], x=x_grid, y=y_grid, g="all")
mcdc.tally.mesh_tally(scores=["flux"], x=x_grid, y=y_grid, g="all")

# Setting
mcdc.setting(N_particle=1e3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

# Results
with h5py.File("output.h5", "r") as f:
phi_avg = f["tally/flux/mean"][:]
phi_sd = f["tally/flux/sdev"][:]
phi_avg = f["tallies/mesh_tally_0/flux/mean"][:]
phi_sd = f["tallies/mesh_tally_0/flux/sdev"][:]
k = f["k_cycle"][:]
k_avg = f["k_mean"][()]
k_sd = f["k_sdev"][()]
rg = f["gyration_radius"][:]
x = f["tally/grid/x"][:]
y = f["tally/grid/y"][:]
x = f["tallies/mesh_tally_0/grid/x"][:]
y = f["tallies/mesh_tally_0/grid/y"][:]

dx = x[1] - x[0]
x_mid = 0.5 * (x[1:] + x[:-1])
Expand Down
2 changes: 1 addition & 1 deletion examples/c5g7/3d/k-eigenvalue/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# =============================================================================

# Load material data
lib = h5py.File("../../c5g7_xs.h5", "r")
lib = h5py.File("../../MGXS-C5G7-TD.h5", "r")


# Setter
Expand Down
File renamed without changes.
File renamed without changes.
Binary file removed examples/eigenvalue/2d_c5g7_iqmc/2d_c5g7_xs.h5
Binary file not shown.
Binary file removed examples/eigenvalue/inf_shem361/SHEM-361.npz
Binary file not shown.
58 changes: 0 additions & 58 deletions examples/eigenvalue/inf_shem361/input.py

This file was deleted.

80 changes: 0 additions & 80 deletions examples/eigenvalue/inf_shem361/process.py

This file was deleted.

5 changes: 2 additions & 3 deletions examples/eigenvalue/slab_kornreich_iqmc/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# =============================================================================
# iQMC Parameters
# =============================================================================
N = 5000
N = 500
x = np.linspace(0.0, 2.6, 52)
Nx = len(x) - 1
phi0 = np.ones((Nx))
Expand All @@ -47,8 +47,7 @@
mcdc.iQMC(x=x, phi0=phi0, scores=["source-x"], mode="batched", sample_method="halton")
# Setting
mcdc.setting(N_particle=N)
# mcdc.eigenmode(N_inactive=20, N_active=5)
mcdc.eigenmode()
mcdc.eigenmode(N_inactive=20, N_active=5)

# Run
mcdc.run()
Binary file removed examples/eigenvalue/smrg7/c5g7.h5
Binary file not shown.
Loading

0 comments on commit 78ecaca

Please sign in to comment.