Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merging cr-doped and additional validation caes #40

Merged
merged 7 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: [ "patch-3" ]
pull_request:
branches: [ "main" ]
branches: [ "patch-3" ]
schedule:
- cron: '29 23 * * 6'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: Python application test

on:
push:
branches: [ "main" ]
branches: [ "patch-3" ]
pull_request:
branches: [ "main" ]
branches: [ "patch-3" ]

jobs:
build:
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@

cmake_minimum_required(VERSION 3.4.0)

if(APPLE)
message(STATUS "Configuring on macOS, setting custom compilers...")
set(CMAKE_C_COMPILER /opt/homebrew/bin/gcc-14)
set(CMAKE_CXX_COMPILER /opt/homebrew/bin/g++-14)
else()
message(STATUS "Not on macOS, using default compilers.")
endif()

# Name of the project created / existent in visual studio
project(sciantix)

Expand Down Expand Up @@ -66,4 +74,4 @@ add_custom_command(TARGET sciantix POST_BUILD
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})

include(CPack)
include(CPack)
85 changes: 85 additions & 0 deletions include/classes/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ class Matrix : virtual public Material
double pore_nucleation_rate;
double pore_resolution_rate;
double pore_trapping_rate;
double chromium_content;
double chromium_solubility;
double Cr2O3_solubility;
double chromium_solution;
double chromium_precipitate;
double chromia_solution;
double chromia_precipitate;


/**
* @brief Sets the theoretical density of the matrix.
Expand Down Expand Up @@ -374,6 +382,83 @@ class Matrix : virtual public Material
return healing_temperature_threshold;
}

void setChromiumContent(double cc)
{
chromium_content = cc;
}

double getChromiumContent()
{
/// Member function to set the chromium content (µg/g)
return chromium_content;
}

void setChromiumSolubility(double cs)
{
chromium_solubility = cs;
}

double getChroimumSolubility()
{
/// Member function to set the chromium solubility (weight%/UO2)
return chromium_solubility;
}

void setChromiaSolubility(double crs)
{
Cr2O3_solubility = crs;
}

double getChromiaSolubility()
{
/// Member function to set the chromia (Cr2O3) solubility (weight%/UO2)
return Cr2O3_solubility;
}

void setChromiumSolution(double cr_sol)
{
chromium_solution= cr_sol;
}

double getChromiumSolution()
{
/// Member function to set the chromium solution (kg)
return chromium_solution;
}

void setChromiumPrecipitate(double cr_p)
{
chromium_precipitate= cr_p;
}

double getChromiumPrecipitate()
{
/// Member function to set the chromium precipitate (kg)
return chromium_precipitate;
}

void setChromiaSolution(double chromia_sol)
{
chromia_solution = chromia_sol;
}

double getChromiaSolution()
{
/// Member function to set the chromia (Cr2O3) solution (kg)
return chromia_solution;
}

void setChromiaPrecipitate(double chromia_p)
{
chromia_precipitate = chromia_p;
}

double getChromiaPrecipitate()
{
/// Member function to set the chromia (Cr2O3) precipitate (kg)
return chromia_precipitate;
}

/**
* @brief Constructor
*/
Expand Down
31 changes: 31 additions & 0 deletions include/classes/Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,37 @@ class Simulation
*/
void UO2Thermochemistry();

/**
* @brief This function defines the Sciantix model *ChromiumSolubility*.
*
* @details
* The model ChromiumSolubility is used to evaluate the chromium solubility accordingly to the temperature and the oxygen content.
* Then the number of oxide chromium atoms is evaluated, accordingly to the oxygen content of the system.
*
* Solubility of Chromium is evaluated as log10(y_Cr) = p*log10(P_O2) + V + U/T
* Coefficients U and V came from experimental fitting, in this way the Gibbs Potential is approximated as a function of 1/T
* Metallic chromium shows two different phases with threshold temperature of 1651 °C
* CrO is expected to be negligible, accordingly to Cr - O phase diagram
* The exchange between Cr-metal phase and Cr-oxide phase is described accordingly to the empirical expression:
* oxide_fraction = 1 - exp(C1 * T - C1*C2)
*
* @author G. Nicodemo
*
* @ref <a href="https://www.sciencedirect.com/science/article/pii/S0022311524004033" target="_blank">Nicodemo G. et al (2024). Journal of Nuclear Materials, 601, 155301.</a>
*/

void ChromiumSolubility();

/**
* @brief The model Microstructure is used to evaluate the lattice parameter and the theoretical density, accordingly to chromium content.
*
* @author G. Nicodemo
*
* @ref <a href="https://www.sciencedirect.com/science/article/pii/S0022311512000943" target="_blank">T. Cardinaels et al (2012), Journal of Nuclear Materials, 424 252-260.</a>
*/

void Microstructure();

/**
* @brief This method returns a pointer to the array of diffusion modes corresponding to the specified gas.
* @param gas_name The name of the gas for which diffusion modes are required.
Expand Down
8 changes: 4 additions & 4 deletions include/coupling/TUSrcCoupling.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
* These two functions are also defined in TRANSURANUS, and are essentially required to create the
* communication channel between the two codes.
*
* @author M. Di Gennaro
* @author E. Travaglia
*
*
*/

#ifndef TUSRCCOUPLING_H
Expand All @@ -31,9 +32,8 @@
extern "C"
{
#endif
void getSciantixOptions(int options[], double scaling_factors[]);
void callSciantix(int options[], double history[], double variables[],
double scaling_factors[], double diffusion_modes[]);
void getSciantixOptions(int Sciantix_options[], double Sciantix_scaling_factors[]);
void callSciantix(int Sciantix_options[], double Sciantix_history[], double Sciantix_variables[], double Sciantix_scaling_factors[], double Sciantix_diffusion_modes[]);

#ifdef __cplusplus
}
Expand Down
5 changes: 5 additions & 0 deletions include/namespaces/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@
* These constants are commonly used in various scientific and engineering calculations.
*
* @author G. Zullo
* @author G. Nicodemo
*
*/

const double boltzmann_constant = 1.380651e-23; // (J/K)
const double avogadro_number = 6.02214076e23; // (at/mol)
const double molar_mass_Oxygen = 15.999; // g/mol
const double molar_mass_Chromium = 51.9961; // g/mol
const double calorie = 4.186; // J
const double gas_constant = 8.3143; // J/(mol K)

#endif
23 changes: 19 additions & 4 deletions include/operations/SetVariablesFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ std::vector<std::string> getInputVariableNames()
"iHighBurnupStructurePorosity",
"iHeliumProductionRate",
"iStoichiometryDeviation",
"iBubbleDiffusivity"
"iBubbleDiffusivity",
"iChromiumSolubility"
};

return names;
Expand Down Expand Up @@ -106,7 +107,8 @@ std::vector<SciantixVariable> initializeSciantixVariable(
bool toOutputCracking,
bool toOutputGrainBoundary,
bool toOutputHighBurnupStructure,
bool toOutputStoichiometryDeviation
bool toOutputStoichiometryDeviation,
bool toOutputChromiumContent
)
{
std::vector<SciantixVariable> init_sciantix_variable =
Expand Down Expand Up @@ -192,7 +194,7 @@ std::vector<SciantixVariable> initializeSciantixVariable(
SciantixVariable("Intergranular fractional intactness", "(/)", Sciantix_variables[37], Sciantix_variables[37], toOutputCracking),

SciantixVariable("Burnup", "(MWd/kgUO2)", Sciantix_variables[38], Sciantix_variables[38], 1),
SciantixVariable("FIMA", "(%)", Sciantix_variables[69], Sciantix_variables[69], toOutputHighBurnupStructure),
SciantixVariable("FIMA", "(%)", Sciantix_variables[69], Sciantix_variables[69], toOutputHighBurnupStructure || toOutputChromiumContent),
SciantixVariable("Effective burnup", "(MWd/kgUO2)", Sciantix_variables[39], Sciantix_variables[39], toOutputHighBurnupStructure),
SciantixVariable("Irradiation time", "(h)", Sciantix_variables[65], Sciantix_variables[65], 0),
SciantixVariable("Fuel density", "(kg/m3)", Sciantix_variables[40], Sciantix_variables[40], 0),
Expand Down Expand Up @@ -224,7 +226,19 @@ std::vector<SciantixVariable> initializeSciantixVariable(
SciantixVariable("Xe in HBS pores", "(at/m3)", Sciantix_variables[83], Sciantix_variables[83], toOutputHighBurnupStructure),
SciantixVariable("Xe in HBS pores - variance", "(at^2/m3)", Sciantix_variables[85], Sciantix_variables[85], toOutputHighBurnupStructure),
SciantixVariable("Xe atoms per HBS pore", "(at/pore)", Sciantix_variables[86], Sciantix_variables[86], toOutputHighBurnupStructure),
SciantixVariable("Xe atoms per HBS pore - variance", "(at^2/pore)", Sciantix_variables[88], Sciantix_variables[88], toOutputHighBurnupStructure)
SciantixVariable("Xe atoms per HBS pore - variance", "(at^2/pore)", Sciantix_variables[88], Sciantix_variables[88], toOutputHighBurnupStructure),

SciantixVariable("Chromium content", "(µg/g)", Sciantix_variables[150], Sciantix_variables[150], toOutputChromiumContent),
SciantixVariable("Lattice parameter", "(m)", Sciantix_variables[151], Sciantix_variables[151], 0),
SciantixVariable("Theoretical density", "(kg/m3)", Sciantix_variables[152], Sciantix_variables[152], 0),
SciantixVariable("Chromium solubility", "(% weight/UO2)", Sciantix_variables[153], Sciantix_variables[153], toOutputChromiumContent),
SciantixVariable("Chromia solubility", "(% weight/UO2)", Sciantix_variables[154], Sciantix_variables[154], toOutputChromiumContent),
SciantixVariable("Chromium solution", "(at/m3)", Sciantix_variables[155], Sciantix_variables[155], toOutputChromiumContent),
SciantixVariable("Chromium precipitate", "(at/m3)", Sciantix_variables[156], Sciantix_variables[156], toOutputChromiumContent),
SciantixVariable("Chromia solution", "(at/m3)", Sciantix_variables[157], Sciantix_variables[157], toOutputChromiumContent),
SciantixVariable("Chromia precipitate", "(at/m3)", Sciantix_variables[158], Sciantix_variables[158], toOutputChromiumContent),

SciantixVariable("Diffusion coefficient", "(m2/s)", Sciantix_variables[160], Sciantix_variables[160], 0),
};

return init_sciantix_variable;
Expand All @@ -243,6 +257,7 @@ std::vector<std::string> getScalingFactorsNames()
"Trapping rate",
"Nucleation rate",
"Diffusivity",
"Diffusivity2",
"Temperature",
"Fission rate",
"Cent parameter",
Expand Down
10 changes: 7 additions & 3 deletions regression/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
from regression_oxidation import regression_oxidation
from regression_kashibe import regression_kashibe
from regression_hbs import regression_hbs
from regression_chromium import regression_chromium
from regression_cornell import regression_cornell

def remove_output(file):
os.chdir(file)
Expand Down Expand Up @@ -63,7 +65,9 @@ def main():
('Talip', regression_talip),
('CONTACT', regression_contact),
('oxidation', regression_oxidation),
('HBS', regression_hbs)
('HBS', regression_hbs),
('Chromium', regression_chromium),
('Cornell', regression_cornell)
]

# Check if running in GitHub Actions environment
Expand All @@ -87,7 +91,7 @@ def main():

# Option 2: Remove all output files
if execution_option == 2:
directories = ["Baker", "Kashibe", "White", "Talip", "CONTACT", "oxidation", "HBS"]
directories = ["Baker", "Kashibe", "White", "Talip", "CONTACT", "oxidation", "HBS", "Chromium", "Cornell"]
for file in os.listdir(wpath):
if any(dir_name in file for dir_name in directories) and os.path.isdir(file):
remove_output(file)
Expand All @@ -110,7 +114,7 @@ def main():
print("Possible regression options \n")
for i, (name, _) in enumerate(regression_modules):
print(f"{name} : {i}")
regression_mode = int(input("Enter the chosen regression (0, 1, 2, 3, 4, 5, 6) = "))
regression_mode = int(input("Enter the chosen regression (0, 1, 2, 3, 4, 5, 6, 7, 8) = "))

mode_gold, mode_plot = get_mode_selections()

Expand Down
Loading
Loading