# Depletion Calculation Performance Issue

**URL:** https://openmc.discourse.group/t/depletion-calculation-performance-issue/3746
**Category:** User Support
**Created:** [December 15, 2023, 6:09am UTC](https://openmc.discourse.group/t/depletion-calculation-performance-issue/3746 "2023-12-15T06:09:50Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tianxiang](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/tianxiang/32/3806_2.png) [@Tianxiang](https://openmc.discourse.group/u/Tianxiang)
#### Post date: [December 15, 2023, 6:09am UTC](https://openmc.discourse.group/t/depletion-calculation-performance-issue/3746/1 "2023-12-15T06:09:50Z")

</div>

Hi,  
Recently, I’m working on refining my fuel analysis by dividing it into multiple layers for more accurate calculations. However, I have encountered a significant decrease in calculation speed during the depletion phase.  
When I perform the calculations without importing openmc.deplete, it takes only two minutes for the initial moment. However, generating simulation\_n0 takes several hours  
I would appreciate it if you could take a moment to review the code snippet below to see if there are any apparent issues causing the drastic difference in calculation speeds 😀:

> layer\_info = {1:[0.0000,0.2048,Temps\_input[0]],2:[0.2048,0.2867,Temps\_input[1]],3:[0.2867,0.3072,Temps\_input[2]],  
> 4:[0.3072,0.3481,Temps\_input[3]],5:[0.3481,0.3604,Temps\_input[4]],6:[0.3604,0.3842,Temps\_input[5]],  
> 7:[0.3842,0.3969,Temps\_input[6]],8:[0.3969,0.4038,Temps\_input[7]],9:[0.4038,0.4096,Temps\_input[8]],}
> 
> fuel\_1 = openmc.Material(name=‘Fuel\_1’,material\_id=1)  
> fuel\_2 = openmc.Material(name=‘Fuel\_2’,material\_id=2)  
> fuel\_3 = openmc.Material(name=‘Fuel\_3’,material\_id=3)  
> fuel\_4 = openmc.Material(name=‘Fuel\_4’,material\_id=4)  
> fuel\_5 = openmc.Material(name=‘Fuel\_5’,material\_id=5)  
> fuel\_6 = openmc.Material(name=‘Fuel\_6’,material\_id=6)  
> fuel\_7 = openmc.Material(name=‘Fuel\_7’,material\_id=7)  
> fuel\_8 = openmc.Material(name=‘Fuel\_8’,material\_id=8)  
> fuel\_9 = openmc.Material(name=‘Fuel\_9’,material\_id=9)
> 
> fuels = [fuel\_1, fuel\_2, fuel\_3, fuel\_4, fuel\_5,  
> fuel\_6, fuel\_7, fuel\_8, fuel\_9]
> 
> for k, fuel in enumerate(fuels, start=1):  
> fuel.set\_density(‘g/cm3’, 10.42)  
> fuel.add\_element(‘U’, 1., enrichment=4.45)  
> fuel.add\_element(‘O’, 2.)  
> fuel.temperature = round(layer\_info[k][2],2) # k  
> fuel.volume = pi\*(layer\_info[k][1]\*\*2-layer\_info[k][0]\*\*2)\*h  
> fuel.depletable = True
> 
> clad = openmc.Material(name=‘Cladding’,material\_id=22)  
> clad.set\_density(‘g/cm3’, 6.55)  
> clad.add\_element(‘S’, 0.0005, ‘wo’)  
> clad.add\_element(‘Fe’, 0.0005, ‘wo’)  
> clad.add\_element(‘Cr’, 0.001, ‘wo’)  
> clad.add\_element(‘O’, 0.009, ‘wo’)  
> clad.add\_element(‘Nb’, 0.009, ‘wo’)  
> clad.add\_element(‘Zr’, 0.98, ‘wo’)  
> clad.temperature = 318.52 + 273.15
> 
> hot\_water = openmc.Material(name=‘Hot borated water’,material\_id=23)  
> hot\_water.set\_density(‘g/cm3’, 0.685511) #0.7119  
> hot\_water.add\_element(‘B’, 4.0e-5)  
> hot\_water.add\_element(‘H’, 5.0e-2)  
> hot\_water.add\_element(‘O’, 2.4e-2)  
> hot\_water.add\_s\_alpha\_beta(‘c\_H\_in\_H2O’)  
> hot\_water.temperature = 318.52 + 273.15
> 
> Helium = openmc.Material(name=“Helium”,material\_id=24)  
> Helium.set\_density(‘g/cm3’, 0.001598)  
> Helium.add\_element(‘He’, 2.4044e-4)  
> Helium.temperature = 318.52 + 273.15  
> materials = openmc.Materials([fuel\_1,fuel\_2,fuel\_3,fuel\_4,fuel\_5,fuel\_6,fuel\_7,fuel\_8,fuel\_9  
> ,clad,hot\_water,Helium])  
> materials.cross\_sections = “/data/NuData/OpenMC/endfb71\_hdf5/cross\_sections.xml”

> surf1 = openmc.ZCylinder(r=0.4096)  
> surf2 = openmc.ZCylinder(r=0.418)  
> surf3 = openmc.ZCylinder(r=0.4750)  
> surf4 = openmc.XPlane(x0=-0.63, boundary\_type=‘reflective’)  
> surf5 = openmc.XPlane(x0=0.63, boundary\_type=‘reflective’)  
> surf6 = openmc.YPlane(y0=-0.63, boundary\_type=‘reflective’)  
> surf7 = openmc.YPlane(y0=0.63, boundary\_type=‘reflective’)  
> surf8 = openmc.ZPlane(z0=-201.96, boundary\_type=‘reflective’)  
> surf9 = openmc.ZPlane(z0=201.96, boundary\_type=‘reflective’)
> 
> surf19 = openmc.ZPlane(z0=-182.88)  
> surf20 = openmc.ZPlane(z0=182.88)
> 
> Cell\_1 = openmc.Cell(fill=fuel\_1, region = -openmc.ZCylinder(r=layer\_info[1][1]) & +surf19 & -surf20)  
> Cell\_2 = openmc.Cell(fill=fuel\_2, region = +openmc.ZCylinder(r=layer\_info[2][0]) & -openmc.ZCylinder(r=layer\_info[2][1]) & +surf19 & -surf20)  
> Cell\_3 = openmc.Cell(fill=fuel\_3, region = +openmc.ZCylinder(r=layer\_info[3][0]) & -openmc.ZCylinder(r=layer\_info[3][1]) & +surf19 & -surf20)  
> Cell\_4 = openmc.Cell(fill=fuel\_4, region = +openmc.ZCylinder(r=layer\_info[4][0]) & -openmc.ZCylinder(r=layer\_info[4][1]) & +surf19 & -surf20)  
> Cell\_5 = openmc.Cell(fill=fuel\_5, region = +openmc.ZCylinder(r=layer\_info[5][0]) & -openmc.ZCylinder(r=layer\_info[5][1]) & +surf19 & -surf20)  
> Cell\_6 = openmc.Cell(fill=fuel\_6, region = +openmc.ZCylinder(r=layer\_info[6][0]) & -openmc.ZCylinder(r=layer\_info[6][1]) & +surf19 & -surf20)  
> Cell\_7 = openmc.Cell(fill=fuel\_7, region = +openmc.ZCylinder(r=layer\_info[7][0]) & -openmc.ZCylinder(r=layer\_info[7][1]) & +surf19 & -surf20)  
> Cell\_8 = openmc.Cell(fill=fuel\_8, region = +openmc.ZCylinder(r=layer\_info[8][0]) & -openmc.ZCylinder(r=layer\_info[8][1]) & +surf19 & -surf20)  
> Cell\_9 = openmc.Cell(fill=fuel\_9, region = +openmc.ZCylinder(r=layer\_info[9][0]) & -openmc.ZCylinder(r=layer\_info[9][1]) & +surf19 & -surf20)
> 
> Cell\_Helium = openmc.Cell(fill=Helium, region = +surf1 & -surf2 & +surf19 & -surf20)  
> Cell\_Clad = openmc.Cell(fill=clad, region = +surf2 & -surf3 & +surf19 & -surf20)  
> Cell\_water = openmc.Cell(fill=hot\_water,region=((+surf4 & -surf5 & +surf6 & -surf7 & +surf8 & -surf9) & (~(-surf3 & +surf19 & -surf20))))

> Universe = openmc.Universe(cells=[Cell\_1, Cell\_2, Cell\_3, Cell\_4, Cell\_5, Cell\_6, Cell\_7, Cell\_8, Cell\_9,  
> Cell\_Helium, Cell\_Clad, Cell\_water])  
> Geo = openmc.Geometry(root=Universe)

> settings = openmc.Settings()  
> settings.source = openmc.Source(space=openmc.stats.Point((0,0,0)))  
> settings.batches = 900  
> settings.inactive = 100  
> settings.particles = 100000  
> settings.temperature = {“method”:“interpolation”,“range”:(294,1144.75+274)}

> model = openmc.model.Model()  
> model.materials = materials  
> model.geometry = Geo  
> model.settings = settings
> 
> model.export\_to\_xml()
> 
> #openmc.run(geometry\_debug=True)
> 
> #time\_step = [0.1,1,2.6]
> 
> time\_step1 = [0.1, 0.5, 1, 1]  
> time\_step2 = [14.75, 156.16]+5\*[173.51]  
> time\_step = time\_step1+time\_step2  
> chain = openmc.deplete.Chain.from\_xml(“/data/NuData/OpenMC/Depletion/chain\_endfb71\_pwr.xml”)  
> op = openmc.deplete.CoupledOperator(model,chain\_file=“/data/NuData/OpenMC/Depletion/chain\_endfb71\_pwr.xml”,  
> diff\_burnable\_mats=True)  
> power = 27.9_1e3_h\*1e-2 #w  
> integrator = openmc.deplete.CECMIntegrator(op,time\_step,power,timestep\_units=“d”)  
> integrator.integrate()

---

<div class="post-metadata">

### Author: ![ASureda](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@ASureda](https://openmc.discourse.group/u/ASureda)
#### Post date: [December 15, 2023, 11:27am UTC](https://openmc.discourse.group/t/depletion-calculation-performance-issue/3746/2 "2023-12-15T11:27:45Z")

</div>

Hello, to reduce the computation time you can reduce the chain with (reduce\_chain) in the operator. You can also perform activation calculations via Independent operator which does not perform transport simulations between each time\_step. See the workshop by @Shimwell.  
[neutronics-workshop](https://github.com/fusion-energy/neutronics-workshop/tree/main/tasks/task_10_activation_transmutation_depletion)
