Skip to content

Commit

Permalink
add neutronics
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud Eltawila committed Jul 19, 2024
1 parent e22f749 commit 5e7d40a
Show file tree
Hide file tree
Showing 8 changed files with 1,502 additions and 0 deletions.
1,129 changes: 1,129 additions & 0 deletions test/examples/divertor_monoblock/divertor_monoblock_5/divertor_monoblock_5.i

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions test/examples/divertor_monoblock/divertor_monoblock_5/geometry.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8'?>
<geometry>
<cell id="1" material="4" name="Water_Cell" region="-1 -5 8 -9" universe="1"/>
<cell id="2" material="3" name="CuCrZr_Cell" region="1 -2 -5 8 -9" universe="1"/>
<cell id="3" material="2" name="Cu_Cell" region="2 -3 -5 8 -9" universe="1"/>
<cell id="4" material="1" name="W_Cell" region="4 -5 6 -7 3 8 -9" universe="1"/>
<cell id="5" material="void" name="Vacuum_Cell" region="~(4 -5 6 -7 3 8 -9) -10" universe="1"/>
<surface coeffs="0.0 0.0 0.6000000000000001" id="1" type="z-cylinder"/>
<surface coeffs="0.0 0.0 0.75" id="2" type="z-cylinder"/>
<surface coeffs="0.0 0.0 0.8500000000000001" id="3" type="z-cylinder"/>
<surface coeffs="-1.4000000000000001" id="4" type="x-plane"/>
<surface coeffs="0" id="5" type="x-plane"/>
<surface coeffs="-1.4000000000000001" id="6" type="y-plane"/>
<surface coeffs="1.4000000000000001" id="7" type="y-plane"/>
<surface coeffs="0" id="8" type="z-plane"/>
<surface coeffs="0.6000000000000001" id="9" type="z-plane"/>
<surface boundary="vacuum" coeffs="0.0 0.0 0.0 5.0" id="10" type="sphere"/>
</geometry>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version='1.0' encoding='utf-8'?>
<materials>
<material id="1" name="W_monoblock">
<density units="g/cc" value="19.3"/>
<nuclide ao="0.0012" name="W180"/>
<nuclide ao="0.265" name="W182"/>
<nuclide ao="0.1431" name="W183"/>
<nuclide ao="0.3064" name="W184"/>
<nuclide ao="0.2843" name="W186"/>
</material>
<material id="2" name="Cu_interlayer">
<density units="g/cc" value="8.96"/>
<nuclide ao="0.6915" name="Cu63"/>
<nuclide ao="0.3085" name="Cu65"/>
</material>
<material id="3" name="CuCrZr_tube">
<density units="g/cc" value="8.9"/>
<nuclide ao="0.0005214" name="Cr50"/>
<nuclide ao="0.01005468" name="Cr52"/>
<nuclide ao="0.00114012" name="Cr53"/>
<nuclide ao="0.0002838" name="Cr54"/>
<nuclide ao="0.0012862499999999999" name="Zr90"/>
<nuclide ao="0.0002805" name="Zr91"/>
<nuclide ao="0.00042875000000000004" name="Zr92"/>
<nuclide ao="0.00043450000000000004" name="Zr94"/>
<nuclide ao="7.000000000000001e-05" name="Zr96"/>
<nuclide ao="0.68147325" name="Cu63"/>
<nuclide ao="0.30402675" name="Cu65"/>
</material>
<material id="4" name="Water">
<density units="g/cc" value="1.0"/>
<nuclide ao="1.99968852" name="H1"/>
<nuclide ao="0.00031148" name="H2"/>
<nuclide ao="0.999621" name="O16"/>
<nuclide ao="0.000379" name="O17"/>
<sab name="c_H_in_H2O"/>
</material>
</materials>
144 changes: 144 additions & 0 deletions test/examples/divertor_monoblock/divertor_monoblock_5/neutronics.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
### Nomenclatures
### C_mobile_j mobile H concentration in "j" material, where j = CuCrZr, Cu, W
### C_trapped_j trapped H concentration in "j" material, where j = CuCrZr, Cu, W
### C_total_j total H concentration in "j" material, where j = CuCrZr, Cu, W
###
### S_empty_j empty site concentration in "j" material, where j = CuCrZr, Cu, W
### S_trapped_j trapped site concentration in "j" material, where j = CuCrZr, Cu, W
### S_total_j total site H concentration in "j" material, where j = CuCrZr, Cu, W
###
### F_permeation permeation flux
### F_recombination recombination flux
###
### Sc_ Scaled
### Int_ Integrated
### ScInt_ Scaled and integrated

thickness_monoblock = ${units 6e-3 m}
rings = '1 1 2 12' # '1 30 20 110' # Number of rings in each circle or in the enclosing square of the mesh
num_layer_mesh_thickness = 1

## Mesh generated by ConcentricCircleMeshGenerator and saved as "2DMonoblock.e"
[Mesh]
[ccmg]
type = ConcentricCircleMeshGenerator
num_sectors = 12
rings = ${rings}
radii = '${units 6 mm -> m} ${units 7.5 mm -> m} ${units 8.5 mm -> m}'
has_outer_square = on
pitch = ${units 28 mm -> m}
portion = left_half
preserve_volumes = false
smoothing_max_it = 3
[]
[ccmg_extrude]
type = MeshExtruderGenerator
input = ccmg
num_layers = ${num_layer_mesh_thickness}
extrusion_vector = '0 0 ${thickness_monoblock}'
bottom_sideset = 'front'
top_sideset = 'back'
[]
[ssbsg1]
type = SideSetsBetweenSubdomainsGenerator
input = ccmg_extrude
primary_block = '4' # W
paired_block = '3' # Cu
new_boundary = '4to3'
[]
[ssbsg2]
type = SideSetsBetweenSubdomainsGenerator
input = ssbsg1
primary_block = '3' # Cu
paired_block = '4' # W
new_boundary = '3to4'
[]
[ssbsg3]
type = SideSetsBetweenSubdomainsGenerator
input = ssbsg2
primary_block = '3' # Cu
paired_block = '2' # CuCrZr
new_boundary = '3to2'
[]
[ssbsg4]
type = SideSetsBetweenSubdomainsGenerator
input = ssbsg3
primary_block = '2' # CuCrZr
paired_block = '3' # Cu
new_boundary = '2to3'
[]
[ssbsg5]
type = SideSetsBetweenSubdomainsGenerator
input = ssbsg4
primary_block = '2' # CuCrZr
paired_block = '1' # H2O
new_boundary = '2to1'
[]
[bdg]
type = BlockDeletionGenerator
input = ssbsg5
block = '1' # H2O
[]

[]

[ICs]
[temp]
type = ConstantIC
variable = temp
value = 800
[]
[]

[Problem]
type = OpenMCCellAverageProblem
verbose = true

tally_type = mesh
mesh_template = neutronics_in.e
scaling = 100.0
tally_name = 'heat_source flux'
temperature_blocks = '2 3 4'

tally_score = 'heating_local flux'
tally_trigger = 'rel_err none'
tally_trigger_threshold = '0.05 1.0'

cell_level = 0
max_batches = 100
batch_interval = 10
particles = 100000
source_strength = 2.3e16 # Particles/s.

output = unrelaxed_tally_std_dev
volume_calculation = vol

check_tally_sum = false
[]

[UserObjects]
[vol]
type = OpenMCVolumeCalculation
n_samples = 50000
[]
[]

[Postprocessors]
[heat_source]
type = ElementIntegralVariablePostprocessor
variable = heat_source
[]
[heat_source_RelativeError]
type = TallyRelativeError
tally_score = heating_local
[]
[]

[Executioner]
type = Transient
[]

[Outputs]
exodus = true
csv = true
[]
Binary file not shown.
131 changes: 131 additions & 0 deletions test/examples/divertor_monoblock/divertor_monoblock_5/openmc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import openmc
import math

##### Materials #######

W = openmc.Material(name="W_monoblock")
W.set_density('g/cc', 19.30)
W.add_element('W', 1.0)

Cu = openmc.Material(name="Cu_interlayer")
Cu.set_density('g/cc', 8.96)
Cu.add_element('Cu', 1.0)

CuCrZr = openmc.Material(name="CuCrZr_tube")
#Ref.: https://aurubis.com/dam/jcr:d6d50d64-69d6-4742-821d-8fb8b48c9044/cucrzr-c18160-pna-372_en.pdf
CuCrZr.set_density('g/cc', 8.90)
CuCrZr.add_element('Cr', 0.012)
CuCrZr.add_element('Zr', 0.0025)
CuCrZr.add_element('Cu', 0.9855)

H2O = openmc.Material(name="Water")
H2O.set_density('g/cc', 1.0)
H2O.add_element('H', 2.0)
H2O.add_element('O', 1.0)
H2O.add_s_alpha_beta('c_H_in_H2O')

mats = openmc.Materials([W, Cu, CuCrZr, H2O])
mats.export_to_xml()

##### Geometry #######

mm_to_cm = 0.1
water_channel_radius = 6 * mm_to_cm
CuCrZr_tube_OR = 7.5 * mm_to_cm
Cu_interlayer_OR = 8.5 * mm_to_cm
monoblock_side_length = 28.0 * mm_to_cm
thickness = 6.0 * mm_to_cm

water_channel = openmc.ZCylinder(r=water_channel_radius)
CuCrZr_OR = openmc.ZCylinder(r=CuCrZr_tube_OR)
Cu_OR = openmc.ZCylinder(r=Cu_interlayer_OR)

x_ngv = openmc.XPlane(-monoblock_side_length/2)
x_psv = openmc.XPlane(0)
y_ngv = openmc.YPlane(-monoblock_side_length/2)
y_psv = openmc.YPlane(monoblock_side_length/2)
z_ngv = openmc.ZPlane(0)
z_psv = openmc.ZPlane(thickness)

out = openmc.Sphere(r=50*mm_to_cm, boundary_type='vacuum')

water_region = -water_channel & -x_psv & +z_ngv & -z_psv
CuCrZr_region = +water_channel & -CuCrZr_OR & -x_psv & +z_ngv & -z_psv
Cu_region = +CuCrZr_OR & - Cu_OR & -x_psv & +z_ngv & -z_psv
W_block_region = +x_ngv & -x_psv & +y_ngv & -y_psv & +Cu_OR & +z_ngv & -z_psv
vaccum_region = ~W_block_region & -out

water_cell = openmc.Cell(name='Water_Cell')
water_cell.fill = H2O
water_cell.region = water_region

CuCrZr_cell = openmc.Cell(name='CuCrZr_Cell')
CuCrZr_cell.fill = CuCrZr
CuCrZr_cell.region = CuCrZr_region

Cu_cell = openmc.Cell(name='Cu_Cell')
Cu_cell.fill = Cu
Cu_cell.region = Cu_region

W_cell = openmc.Cell(name='W_Cell')
W_cell.fill = W
W_cell.region = W_block_region

vacuum_cell = openmc.Cell(name='Vacuum_Cell')
vacuum_cell.region = vaccum_region

root_universe = openmc.Universe(cells=(water_cell, CuCrZr_cell, Cu_cell, W_cell, vacuum_cell))
geometry = openmc.Geometry(root_universe)
geometry.export_to_xml()

##### Plotting #######

px = openmc.Plot()
px.basis = 'xy'
px.origin = (0.0, 0.0, thickness/2)
px.width = (30*mm_to_cm, 30*mm_to_cm)
px.pixels = (1000, 1000)
px.color_by = 'material'

pz = openmc.Plot()
pz.basis = 'xz'
pz.origin = (0.0, 0.0, thickness/2)
pz.width = (30*mm_to_cm, thickness)
pz.pixels = (1000, 1000)
pz.color_by = 'material'

px2 = openmc.Plot()
px2.basis = 'xy'
px2.origin = (0.0, 0.0, thickness/2)
px2.width = (100*mm_to_cm, 100*mm_to_cm)
px2.pixels = (2000, 2000)
px2.color_by = 'cell'

plots = openmc.Plots([px,pz,px2])
plots.export_to_xml()

##### Settings #######

settings = openmc.Settings()
settings.batches = 100
settings.particles = 1000000
settings.run_mode = "fixed source"
settings.photon_transport = True

settings.temperature = {'default': 800.0,
'method': 'nearest',
'range': (294.0, 2000.0),
'tolerance': 1000.0}

x = openmc.stats.Uniform(-monoblock_side_length/2, 0)
y = openmc.stats.Discrete([monoblock_side_length/2+5*mm_to_cm,], [1.0,])
z = openmc.stats.Uniform(0, thickness)
spatial_dist = openmc.stats.CartesianIndependent(x, y, z)

source = openmc.IndependentSource()
source.space = spatial_dist
source.angle = openmc.stats.Monodirectional([0.0,-1.0,0])
source.energy = openmc.stats.Discrete([14.08e6], [1.0])
settings.source = source

settings.export_to_xml()
18 changes: 18 additions & 0 deletions test/examples/divertor_monoblock/divertor_monoblock_5/plots.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='UTF-8'?>
<plots>
<plot basis="xy" color_by="material" id="1" type="slice">
<pixels>1000 1000</pixels>
<origin>0.0 0.0 0.30000000000000004</origin>
<width>3.0 3.0</width>
</plot>
<plot basis="xz" color_by="material" id="2" type="slice">
<pixels>1000 1000</pixels>
<origin>0.0 0.0 0.30000000000000004</origin>
<width>3.0 0.6000000000000001</width>
</plot>
<plot basis="xy" color_by="cell" id="3" type="slice">
<pixels>2000 2000</pixels>
<origin>0.0 0.0 0.30000000000000004</origin>
<width>10.0 10.0</width>
</plot>
</plots>
24 changes: 24 additions & 0 deletions test/examples/divertor_monoblock/divertor_monoblock_5/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version='1.0' encoding='UTF-8'?>
<settings>
<run_mode>fixed source</run_mode>
<particles>1000000</particles>
<batches>100</batches>
<source particle="neutron" strength="1.0" type="independent">
<space type="cartesian">
<x parameters="-1.4000000000000001 0" type="uniform"/>
<y type="discrete">
<parameters>1.9000000000000001 1.0</parameters>
</y>
<z parameters="0 0.6000000000000001" type="uniform"/>
</space>
<angle reference_uvw="0.0 -1.0 0.0" type="monodirectional"/>
<energy type="discrete">
<parameters>14080000.0 1.0</parameters>
</energy>
</source>
<photon_transport>true</photon_transport>
<temperature_default>800.0</temperature_default>
<temperature_method>nearest</temperature_method>
<temperature_range>294.0 2000.0</temperature_range>
<temperature_tolerance>1000.0</temperature_tolerance>
</settings>

0 comments on commit 5e7d40a

Please sign in to comment.