Note
Click here to download the full example code
Computing Component Volume Fractions on a Block with Automatic Thermal Expansion¶
Given an Block
, compute
the component volume fractions. Assess the change in volume
of these components within the block as the temperatures of
the fuel and structure components are uniformly increased.
Note: Thermal expansion is automatically considered with
material data defined within materials
.
Out:
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 600 0.23641
<Circle: clad> 450 0.0189566
<Hexagon: duct> 400 0.0764606
<DerivedShape: coolant> 400 0.553986
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 400.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 400 0.233214
<Circle: clad> 400 0.0189313
<Hexagon: duct> 400 0.0764606
<DerivedShape: coolant> 400 0.557207
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 500.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 500 0.234575
<Circle: clad> 500 0.0189824
<Hexagon: duct> 500 0.0766673
<DerivedShape: coolant> 400 0.555588
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 600.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 600 0.23641
<Circle: clad> 600 0.0190348
<Hexagon: duct> 600 0.0768788
<DerivedShape: coolant> 400 0.55349
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 700.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 700 0.238847
<Circle: clad> 700 0.0190871
<Hexagon: duct> 700 0.07709
<DerivedShape: coolant> 400 0.550789
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 800.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 800 0.242019
<Circle: clad> 800 0.0191381
<Hexagon: duct> 800 0.0772959
<DerivedShape: coolant> 400 0.54736
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 900.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 900 0.246067
<Circle: clad> 900 0.0191865
<Hexagon: duct> 900 0.0774913
<DerivedShape: coolant> 400 0.543069
<Hexagon: intercoolant> 400 0.114187
Updating fuel/structure components to 1200.0 °C
Component Temperature, °C Volume Fraction
----------------------- ----------------- -----------------
<Circle: fuel> 1200 0.264995
<Circle: clad> 1200 0.0193035
<Hexagon: duct> 1200 0.0779642
<DerivedShape: coolant> 400 0.52355
<Hexagon: intercoolant> 400 0.114187
import collections
import tabulate
import matplotlib.pyplot as plt
from armi import configure
configure(permissive=True)
from armi.reactor.flags import Flags
from armi.reactor.tests.test_blocks import buildSimpleFuelBlock
def writeInitialVolumeFractions(b):
"""Write out the initial temperatures and component volume fractions."""
headers = ["Component", "Temperature, °C", "Volume Fraction"]
data = [(c, c.temperatureInC, volFrac) for c, volFrac in b.getVolumeFractions()]
print(tabulate.tabulate(tabular_data=data, headers=headers) + "\n")
def plotVolFracsWithComponentTemps(b, uniformTemps):
"""Plot the percent change in vol. fractions as fuel/structure temperatures are uniformly increased."""
# Perform uniform temperature modifications of the fuel and structural
# components.
componentsToModify = b.getComponents([Flags.FUEL, Flags.CLAD, Flags.DUCT])
initialVols = {}
relativeVols = collections.defaultdict(list)
for tempInC in uniformTemps:
print(f"Updating fuel/structure components to {tempInC} °C")
# Modify the fuel/structure components to the
# same uniform temperature
for c in componentsToModify:
c.setTemperature(tempInC)
writeInitialVolumeFractions(b)
# Iterate over all components and calculate the mass
# and volume fractions
for c in b:
# Set the initial volume fractions at the first uniform temperature
if tempInC == uniformTempsInC[0]:
initialVols[c] = c.getVolume()
relativeVols[c].append(
(c.getVolume() - initialVols[c]) / initialVols[c] * 100.0
)
fig, ax = plt.subplots()
for c in b.getComponents():
ax.plot(uniformTempsInC, relativeVols[c], label=c.name)
ax.set_title("Component Volume Fractions with Automatic Thermal Expansion")
ax.set_ylabel(f"% Change in Volume from {uniformTempsInC[0]} °C")
ax.set_xlabel("Uniform Fuel/Structure Temperature, °C")
ax.legend()
ax.grid()
plt.show()
uniformTempsInC = [400.0, 500.0, 600.0, 700.0, 800.0, 900.0, 1200.0]
b = buildSimpleFuelBlock()
writeInitialVolumeFractions(b)
plotVolFracsWithComponentTemps(b, uniformTempsInC)
Total running time of the script: ( 0 minutes 0.247 seconds)