Skip to content

Commit

Permalink
add time census regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ilhamv committed Jan 21, 2025
1 parent 3d9e2c7 commit 22923d4
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
Binary file not shown.
Binary file added test/regression/inf_shem361_td_census/answer.h5
Binary file not shown.
68 changes: 68 additions & 0 deletions test/regression/inf_shem361_td_census/input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import numpy as np
import sys

import mcdc


# =============================================================================
# Set model
# =============================================================================
# The infinite homogenous medium is modeled with reflecting slab

# Load material data
with np.load("SHEM-361.npz") as data:
SigmaC = data["SigmaC"] * 1.28 # /cm
SigmaS = data["SigmaS"]
SigmaF = data["SigmaF"]
nu_p = data["nu_p"]
nu_d = data["nu_d"]
chi_p = data["chi_p"]
chi_d = data["chi_d"]
G = data["G"]
speed = data["v"]
lamd = data["lamd"]

# Set material
m = mcdc.material(
capture=SigmaC,
scatter=SigmaS,
fission=SigmaF,
nu_p=nu_p,
chi_p=chi_p,
nu_d=nu_d,
chi_d=chi_d,
decay=lamd,
speed=speed,
)

# Set surfaces
s1 = mcdc.surface("plane-x", x=-1e10, bc="reflective")
s2 = mcdc.surface("plane-x", x=1e10, bc="reflective")

# Set cells
c = mcdc.cell(+s1 & -s2, m)

# =============================================================================
# Set initial source
# =============================================================================

energy = np.zeros(G)
energy[-1] = 1.0
source = mcdc.source(energy=energy)

# =============================================================================
# Set problem and tally, and then run mcdc
# =============================================================================

# Tally
mcdc.tally.mesh_tally(
scores=["flux"], t=np.insert(np.logspace(-8, 1, 100), 0, 0.0), g="all"
)

# Setting
mcdc.setting(N_particle=9, active_bank_buff=1000, rng_seed=4)
mcdc.time_census(np.logspace(-5, 1, 6))
mcdc.population_control()

# Run
mcdc.run()
Binary file added test/regression/slab_isobeam_td_census/answer.h5
Binary file not shown.
45 changes: 45 additions & 0 deletions test/regression/slab_isobeam_td_census/input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import numpy as np

import mcdc


# =============================================================================
# Set model
# =============================================================================
# Finite homogeneous pure-absorbing slab

# Set materials
m = mcdc.material(capture=np.array([1.0]))

# Set surfaces
s1 = mcdc.surface("plane-x", x=0.0, bc="vacuum")
s2 = mcdc.surface("plane-x", x=5.0, bc="vacuum")

# Set cells
mcdc.cell(+s1 & -s2, m)

# =============================================================================
# Set source
# =============================================================================
# Isotropic beam from left-end

mcdc.source(point=[1e-10, 0.0, 0.0], time=[0.0, 5.0], white_direction=[1.0, 0.0, 0.0])

# =============================================================================
# Set tally, setting, and run mcdc
# =============================================================================

# Tally
mcdc.tally.mesh_tally(
scores=["flux"],
x=np.linspace(0.0, 5.0, 51),
t=np.linspace(0.0, 5.0, 51),
)

# Setting
mcdc.setting(N_particle=100)
mcdc.time_census(np.linspace(0.0, 5.0, 6)[1:])
mcdc.population_control()

# Run
mcdc.run()

0 comments on commit 22923d4

Please sign in to comment.