-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
3,107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
""" | ||
This is a python script to execute the regression (running the validation database) of SCIANTIX. | ||
@author G. Zullo | ||
""" | ||
|
||
""" ------------------- Import Required Dependencies ------------------- """ | ||
|
||
import os | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from regression_functions import * | ||
from sklearn.linear_model import LinearRegression | ||
|
||
""" ------------------- Global Variables ------------------- """ | ||
# Plot configuration | ||
font_size = 10 | ||
|
||
plt.rcParams['axes.labelsize'] = font_size | ||
plt.rcParams['xtick.labelsize'] = font_size | ||
plt.rcParams['ytick.labelsize'] = font_size | ||
|
||
# Experimental data: | ||
# Temperature (K), intra-granular bubble radius (nm), density (bub/m3) | ||
exp_data = np.array([ | ||
[1133, 0.85, 3.80], | ||
[1253, 0.90, 3.50], | ||
[1333, 0.95, 3.30], | ||
[1543, 1.00, 2.90], | ||
[1698, 1.00, 2.46], | ||
[1743, 1.15, 1.83], | ||
[1783, 1.20, 1.32], | ||
[1843, 1.30, 1.24], | ||
[1853, 1.40, 1.18] | ||
]) | ||
|
||
intraGranularBubbleDensitySciantix = [] | ||
intraGranularBubbleRadiusSciantix = [] | ||
|
||
number_of_tests_failed = 0 | ||
gold = [] | ||
sample_number = len(exp_data[:,0]) | ||
|
||
""" ------------------- Functions ------------------- """ | ||
|
||
def do_plot(): | ||
"""Generate plots comparing experimental data with results.""" | ||
|
||
# Plot 1: Intragranular bubble radius | ||
fig, ax = plt.subplots() | ||
ax.scatter(exp_data[:,1], intraGranularBubbleRadiusSciantix, edgecolors='#757575', facecolors='brown', marker='^', s=30, label='SCIANTIX 2.0', zorder=1) | ||
ax.plot([1e-3, 1e2], [1e-3, 1e2], '-', color='#757575') | ||
ax.plot([1e-3, 1e2], [2e-3, 2e2], '--', color='#757575') | ||
ax.plot([1e-3, 1e2], [5e-4, 5e1], '--', color='#757575') | ||
ax.set_xlim(1e-1, 1.5e1) | ||
ax.set_ylim(1e-1, 1.5e1) | ||
ax.set_xscale('log') | ||
ax.set_yscale('log') | ||
ax.set_xlabel('Experimental (nm)', fontsize=font_size) | ||
ax.set_ylabel('Calculated (nm)', fontsize=font_size) | ||
ax.tick_params(axis='both', which='major', labelsize=font_size) | ||
ax.legend() | ||
plt.show() | ||
|
||
# Plot 2: Intragranular bubble density | ||
fig, ax = plt.subplots() | ||
ax.scatter(exp_data[:,2], intraGranularBubbleDensitySciantix, edgecolors='#757575', facecolors='red', marker='^', s=30, label='SCIANTIX 2.0', zorder=1) | ||
ax.plot([1e-3, 1e2], [1e-3, 1e2], '-', color='#757575') | ||
ax.plot([1e-3, 1e2], [2e-3, 2e2], '--', color='#757575') | ||
ax.plot([1e-3, 1e2], [5e-4, 5e1], '--', color='#757575') | ||
ax.set_xlim(3e-1, 1.5e1) | ||
ax.set_ylim(3e-1, 1.5e1) | ||
ax.set_xscale('log') | ||
ax.set_yscale('log') | ||
ax.set_xlabel('Experimental (10^23 bub/m3)', fontsize=font_size) | ||
ax.set_ylabel('Calculated (10^23 bub/m3)', fontsize=font_size) | ||
ax.tick_params(axis='both', which='major', labelsize=font_size) | ||
ax.legend() | ||
plt.show() | ||
|
||
def regression_cornell(wpath, mode_Baker, mode_gold, mode_plot, folderList, number_of_tests, number_of_tests_failed): | ||
""" | ||
Main function to perform the regression tests on SCIANTIX. | ||
Parameters: | ||
wpath (str): Working path to search for folders. | ||
mode_Baker (int): Mode for executing tests. | ||
mode_gold (int): Mode for using/golding results. | ||
mode_plot (int): Mode for plotting results. | ||
folderList (list): List to store folder names. | ||
number_of_tests (int): Count of tests performed. | ||
number_of_tests_failed (int): Count of failed tests. | ||
Returns: | ||
folderList (list): Updated list of folder names. | ||
number_of_tests (int): Updated count of tests performed. | ||
number_of_tests_failed (int): Updated count of failed tests. | ||
""" | ||
if mode_Baker == 0: | ||
return folderList, number_of_tests, number_of_tests_failed | ||
|
||
files_and_dirs = os.listdir(wpath) | ||
sorted_files_and_dirs = sorted(files_and_dirs) | ||
|
||
for file in sorted_files_and_dirs: | ||
if "Cornell" in file and os.path.isdir(file): | ||
folderList.append(file) | ||
os.chdir(file) | ||
print(f"Now in folder {file}...") | ||
number_of_tests += 1 | ||
|
||
if mode_gold == 0: | ||
do_sciantix() | ||
data, data_gold = check_output(file) | ||
number_of_tests_failed = check_result(number_of_tests_failed) | ||
|
||
elif mode_gold == 1: | ||
do_sciantix() | ||
data, data_gold = check_output(file) | ||
print("...golding results.") | ||
do_gold() | ||
|
||
elif mode_gold == 2: | ||
data, data_gold = check_output(file) | ||
number_of_tests_failed = check_result(number_of_tests_failed) | ||
|
||
elif mode_gold == 3: | ||
data, data_gold = check_output(file) | ||
print("...golding existing results.") | ||
do_gold() | ||
|
||
pos = findSciantixVariablePosition(data, "Intragranular bubble concentration (bub/m3)") | ||
intraGranularBubbleDensitySciantix.append(data[-1, pos].astype(float)*1e-23) | ||
|
||
pos = findSciantixVariablePosition(data, "Intragranular bubble radius (m)") | ||
intraGranularBubbleRadiusSciantix.append(data[-1, pos].astype(float)*1e9) | ||
|
||
os.chdir('..') | ||
|
||
if mode_plot == 1: | ||
do_plot() | ||
|
||
# """ Statistical analysis """ | ||
# print(f"Experimental data - mean: ", np.mean(igSwellingBaker)) | ||
# print(f"Experimental data - median: ", np.median(igSwellingBaker)) | ||
# print(f"Experimental data - Q1: ", np.percentile(igSwellingBaker, 25)) | ||
# print(f"Experimental data - Q3: ", np.percentile(igSwellingBaker, 75)) | ||
|
||
# print(f"SCIANTIX 1.0 - mean: ", np.mean(intraGranularSwellingSciantix1)) | ||
# print(f"SCIANTIX 1.0 - median: ", np.median(intraGranularSwellingSciantix1)) | ||
# print(f"SCIANTIX 1.0 - Q1: ", np.percentile(intraGranularSwellingSciantix1, 25)) | ||
# print(f"SCIANTIX 1.0 - Q3: ", np.percentile(intraGranularSwellingSciantix1, 75)) | ||
|
||
# print(f"SCIANTIX 2.0 - mean: ", np.mean(intraGranularSwellingSciantix)) | ||
# print(f"SCIANTIX 2.0 - median: ", np.median(intraGranularSwellingSciantix)) | ||
# print(f"SCIANTIX 2.0 - Q1: ", np.percentile(intraGranularSwellingSciantix, 25)) | ||
# print(f"SCIANTIX 2.0 - Q3: ", np.percentile(intraGranularSwellingSciantix, 75)) | ||
|
||
# deviations_1 = abs(np.array(igSwellingBaker) - intraGranularSwellingSciantix1) | ||
# deviations_2 = abs(np.array(igSwellingBaker) - intraGranularSwellingSciantix) | ||
# print(f"SCIANTIX 1.0 - MAD: ", np.median(deviations_1)) | ||
# print(f"SCIANTIX 2.0 - MAD: ", np.median(deviations_2)) | ||
|
||
# print(f"SCIANTIX 1.0 - RMSE: ", np.mean(np.array(igSwellingBaker) - intraGranularSwellingSciantix1)**2) | ||
# print(f"SCIANTIX 2.0 - RMSE: ", np.mean(np.array(igSwellingBaker) - intraGranularSwellingSciantix)**2) | ||
# print("\n") | ||
|
||
return folderList, number_of_tests, number_of_tests_failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0 1133 9.26e18 0 | ||
960 1133 9.26e18 0 |
28 changes: 28 additions & 0 deletions
28
regression/test_Cornell1969_1133K/input_initial_conditions.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
5.0e-06 | ||
# initial grain radius (m) | ||
0.0 0.0 0.0 0.0 0.0 0.0 | ||
# initial Xe (at/m3) produced, intragranular, intragranular in solution, intragranular in bubbles, grain boundary, released | ||
0.0 0.0 0.0 0.0 0.0 0.0 | ||
# initial Kr (at/m3) produced, intragranular, intragranular in solution, intragranular in bubbles, grain boundary, released | ||
0.0 0.0 0.0 0.0 0.0 0.0 | ||
# initial He (at/m3) produced, intragranular, intragranular in solution, intragranular in bubbles, grain boundary, released | ||
0.0 0.0 | ||
# initial intragranular bubble concentration (at/m3), radius (m) | ||
0.0 | ||
# initial fuel burn-up (MWd/kgUO2) | ||
0.0 | ||
# initial fuel effective burn-up (MWd/kgUO2) | ||
0.0 | ||
# initial irradiation time (h) | ||
10641.0 | ||
# initial fuel density (kg/m3) | ||
0.0 3.0 0.0 0.0 97.0 | ||
# initial U234 U235 U236 U237 U238 (% of heavy atoms) content | ||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 | ||
# initial Xe133 (at/m3) produced, intragranular, intragranular in solution, intragranular in bubbles, decayed, grain boundary, released | ||
0.0 0.0 0.0 0.0 0.0 0.0 0.0 | ||
# initial Kr85m (at/m3) produced, intragranular, intragranular in solution, intragranular in bubbles, decayed, grain boundary, released | ||
0.0 | ||
# initial fuel stoichiometry deviation (\) | ||
1000 | ||
# Cr content (ppm) |
18 changes: 18 additions & 0 deletions
18
regression/test_Cornell1969_1133K/input_scaling_factors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
1.0 | ||
# scaling factor - resolution rate | ||
1.0 | ||
# scaling factor - trapping rate | ||
1.0 | ||
# scaling factor - nucleation rate | ||
1.0 | ||
# scaling factor - diffusivity | ||
1.0 | ||
# scaling factor - temperature | ||
1.0 | ||
# scaling factor - fission rate | ||
1.0 | ||
# scaling factor - cent parameter | ||
1.0 | ||
# scaling factor - helium production rate | ||
1.0 | ||
# scaling factor - dummy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1 # iGrainGrowth (0= no grain growth, 1= Ainscough et al. (1973), 2= Van Uffelen et al. (2013)) | ||
1 # iFissionGasDiffusivity (0= constant value, 1= Turnbull et al. (1988)) | ||
1 # iDiffusionSolver (1= SDA with quasi-stationary hypothesis, 2= SDA without quasi-stationary hypothesis) | ||
1 # iIntraGranularBubbleBehavior (1= Pizzocri et al. (2018)) | ||
1 # iResolutionRate (0= constant value, 1= Turnbull (1971), 2= Losonen (2000), 3= thermal resolution, Cognini et al. (2021)) | ||
1 # iTrappingRate (0= constant value, 1= Ham (1958)) | ||
1 # iNucleationRate (0= constant value, 1= Olander, Wongsawaeng (2006)) | ||
1 # iOutput (1= default output files) | ||
1 # iGrainBoundaryVacancyDiffusivity (0= constant value, 1= Reynolds and Burton (1979), 2= White (2004)) | ||
1 # iGrainBoundaryBehaviour (0= no grain boundary bubbles, 1= Pastore et al (2013)) | ||
1 # iGrainBoundaryMicroCracking (0= no model considered, 1= Barani et al. (2017)) | ||
0 # iFuelMatrix (0= UO2, 1= UO2 + HBS) | ||
0 # iGrainBoundaryVenting (0= no model considered, 1= Pizzocri et al., D6.4 (2020), H2020 Project INSPYRE) | ||
0 # iRadioactiveFissionGas (0= not considered) | ||
0 # iHelium (0= not considered) | ||
0 # iHeDiffusivity (0= null value, 1= limited lattice damage, Luzzi et al. (2018), 2= significant lattice damage, Luzzi et al. (2018)) | ||
0 # iGrainBoundarySweeping (0= no model considered, 1= TRANSURANUS swept volume model) | ||
0 # iHighBurnupStructureFormation (0= no model considered, 1= fraction of HBS-restructured volume from Barani et al. (2020)) | ||
0 # iHighBurnupStructurePorosity (0= no evolution of HBS porosity, 1= HBS porosity evolution based on Spino et al. (2006) data) | ||
0 # iHeliumProductionRate (0= zero production rate, 1= helium from ternary fissions, 2= linear with burnup (FR)) | ||
0 # iStoichiometryDeviation (0= not considered, 1= Cox et al. 1986, 2= Bittel et al. 1969, 3= Abrefah et al. 1994, 4= Imamura et al. 1997, 5= Langmuir-based approach) | ||
0 # iBubbleDiffusivity (0= not considered, 1= volume diffusivity) |
Oops, something went wrong.