Skip to content

Commit

Permalink
Added UO2 material convenience function (#163)
Browse files Browse the repository at this point in the history
Added a function to create a UO2 material given U235 enrichment and Gd2O3 wt%.
  • Loading branch information
KyleVaughn authored Jul 12, 2024
1 parent 7ba16a9 commit e9ff912
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 111 deletions.
5 changes: 5 additions & 0 deletions include/um2/physics/material.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ class Material

void
populateXSec(XSLibrary const & xsec_lib) noexcept;

// wt_u235 is the wt% of U-235 amongst the uranium isotopes
// wt_gad is the wt% of Gd2O3 in the final UO2-Gd2O3 mixture
void
setUO2(Float wt_u235, Float wt_gad = 0) noexcept;
};

//======================================================================
Expand Down
62 changes: 9 additions & 53 deletions models/nuscale/nuscale_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,56 +26,6 @@ Float constexpr h2o_density = 0.84478;
Float constexpr temp_fuel = 900.0;
Float constexpr temp_water = 531.26;

Float constexpr m_u235 = 235.043928;
Float constexpr m_u238 = 238.05079;
Float constexpr m_o16 = 15.9949;

CONST auto
weightToAtomPercentU235(Float const wo) -> Float
{
return wo * m_u238 / (m_u235 + wo * (m_u238 - m_u235));
}

// void
// addFuelFromWeightPercentEnrichment(um2::Material & fuel, Float const wo)
//{
// Float const ao = weightToAtomPercentU235(wo);
// fuel.setDensity(uo2_density);
// fuel.setTemperature(temp_fuel);
// um2::Vector<um2::String> const names = {"U235", "U238", "O16"};
// um2::Vector<Float> const percents = {ao / 3.0, (1.0 - ao) / 3.0, 2.0 / 3.0};
// fuel.addNuclidesAtomPercent(names, percents);
// }

void
addFuel(um2::Material & fuel, Float const wo_u235, Float const wo_gd = 0)
{
Float const ao_u235 = weightToAtomPercentU235(wo_u235) / 3.0;
Float const ao_u238 = (1.0 - ao_u235) / 3.0;
Float const ao_o16 = 2.0 / 3.0;
Float const m_uo2 = ao_u235 * m_u235 + ao_u238 * m_u238 + ao_o16 * m_o16;
Float const wo_235 = (1 - wo_gd) * ao_u235 * m_u235 / m_uo2;
Float const wo_238 = (1 - wo_gd) * ao_u238 * m_u238 / m_uo2;
Float const wo_o16 = (1 - wo_gd) * ao_o16 * m_o16 / m_uo2;
fuel.setDensity(uo2_density); // This should be smaller, but we match the MPACT model
fuel.setTemperature(temp_fuel);
fuel.addNuclideWt("U235", wo_235);
fuel.addNuclideWt("U238", wo_238);
fuel.addNuclideWt("O16", wo_o16);
if (wo_gd < 1e-6) {
return;
}
// Just approximate all Gd as the same weight, so we simply multiply the
// isotopic abundances by the weight fraction of Gd
fuel.addNuclideWt("Gd152", wo_gd * 0.002);
fuel.addNuclideWt("Gd154", wo_gd * 0.0218);
fuel.addNuclideWt("Gd155", wo_gd * 0.148);
fuel.addNuclideWt("Gd156", wo_gd * 0.205);
fuel.addNuclideWt("Gd157", wo_gd * 0.157);
fuel.addNuclideWt("Gd158", wo_gd * 0.248);
fuel.addNuclideWt("Gd160", wo_gd * 0.219);
}

auto
main(int argc, char ** argv) -> int
{
Expand Down Expand Up @@ -131,7 +81,9 @@ main(int argc, char ** argv) -> int
um2::Material fuel;
fuel.setName(names[i]);
fuel.setColor(colors[i]);
addFuel(fuel, enrichments[i] / 100);
fuel.setDensity(uo2_density); // This should be smaller, but we match the MPACT model
fuel.setTemperature(temp_fuel);
fuel.setUO2(enrichments[i] / 100);
fuel.populateXSec(xslib);
materials[i] = fuel;
}
Expand All @@ -140,14 +92,18 @@ main(int argc, char ** argv) -> int
um2::Material g260;
g260.setName("G260");
g260.setColor(um2::lightpink);
addFuel(g260, 0.026, 0.06); // 6% wt Gd
g260.setDensity(uo2_density);
g260.setTemperature(temp_fuel);
g260.setUO2(0.026, /*wt_gad=*/0.06); // 6% wt Gd
g260.populateXSec(xslib);
materials.push_back(g260);

um2::Material g350;
g350.setName("G350");
g350.setColor(um2::pink);
addFuel(g350, 0.035, 0.04); // 4% wt Gd
g350.setDensity(uo2_density);
g350.setTemperature(temp_fuel);
g350.setUO2(0.035, /*wt_gad=*/0.04); // 4% wt Gd
g350.populateXSec(xslib);
materials.push_back(g350);

Expand Down
33 changes: 6 additions & 27 deletions models/svea/svea_2d_advanced_mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ main(int argc, char ** argv) -> int
uo2_300.setDensity(10.257);
uo2_300.setTemperature(900.0);
uo2_300.setColor(um2::pink);
uo2_300.addNuclidesAtomPercent({"U235", "U238", "O16"}, {0.03 / 3, 0.97 / 3, 2.0 / 3});
uo2_300.setUO2(0.03);
uo2_300.populateXSec(xslib);
materials.push_back(uo2_300);

Expand All @@ -292,8 +292,7 @@ main(int argc, char ** argv) -> int
uo2_380.setDensity(10.257);
uo2_380.setTemperature(900.0);
uo2_380.setColor(um2::lightblue);
uo2_380.addNuclidesAtomPercent({"U235", "U238", "O16"},
{0.038 / 3, 0.962 / 3, 2.0 / 3});
uo2_380.setUO2(0.038);
uo2_380.populateXSec(xslib);
materials.push_back(uo2_380);

Expand All @@ -304,16 +303,7 @@ main(int argc, char ** argv) -> int
uo2_410gd.setDensity(10.111);
uo2_410gd.setTemperature(900.0);
uo2_410gd.setColor(um2::purple);
uo2_410gd.addNuclide(92235, 8.78236e-04);
uo2_410gd.addNuclide(92238, 2.05422e-02);
uo2_410gd.addNuclide(64152, 3.35960e-06);
uo2_410gd.addNuclide(64154, 3.66190e-05);
uo2_410gd.addNuclide(64155, 2.48606e-04);
uo2_410gd.addNuclide(64156, 3.43849e-04);
uo2_410gd.addNuclide(64157, 2.62884e-04);
uo2_410gd.addNuclide(64158, 4.17255e-04);
uo2_410gd.addNuclide(64160, 3.67198e-04);
uo2_410gd.addNuclide(8016, 4.53705e-02);
uo2_410gd.setUO2(0.041, /*wt_gad=*/0.05);
uo2_410gd.populateXSec(xslib);
materials.push_back(uo2_410gd);

Expand All @@ -324,8 +314,7 @@ main(int argc, char ** argv) -> int
uo2_460.setDensity(10.257);
uo2_460.setTemperature(900.0);
uo2_460.setColor(um2::brown);
uo2_460.addNuclidesAtomPercent({"U235", "U238", "O16"},
{0.046 / 3, 0.954 / 3, 2.0 / 3});
uo2_460.setUO2(0.046);
uo2_460.populateXSec(xslib);
materials.push_back(uo2_460);

Expand All @@ -336,16 +325,7 @@ main(int argc, char ** argv) -> int
uo2_470gd.setDensity(10.111);
uo2_470gd.setTemperature(900.0);
uo2_470gd.setColor(um2::green);
uo2_470gd.addNuclide(92235, 1.00676e-04);
uo2_470gd.addNuclide(92238, 2.04136e-02);
uo2_470gd.addNuclide(64152, 3.35960e-06);
uo2_470gd.addNuclide(64154, 3.66190e-05);
uo2_470gd.addNuclide(64155, 2.48606e-04);
uo2_470gd.addNuclide(64156, 3.43849e-04);
uo2_470gd.addNuclide(64157, 2.62884e-04);
uo2_470gd.addNuclide(64158, 4.17255e-04);
uo2_470gd.addNuclide(64160, 3.67198e-04);
uo2_470gd.addNuclide(8016, 4.53705e-02);
uo2_470gd.setUO2(0.047, /*wt_gad=*/0.05);
uo2_470gd.populateXSec(xslib);
materials.push_back(uo2_470gd);

Expand All @@ -356,8 +336,7 @@ main(int argc, char ** argv) -> int
uo2_495.setDensity(10.257);
uo2_495.setTemperature(900.0);
uo2_495.setColor(um2::orange);
uo2_495.addNuclidesAtomPercent({"U235", "U238", "O16"},
{0.0495 / 3, 0.9505 / 3, 2.0 / 3});
uo2_495.setUO2(0.0495);
uo2_495.populateXSec(xslib);
materials.push_back(uo2_495);

Expand Down
35 changes: 7 additions & 28 deletions models/svea/svea_2d_variable_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ main(int argc, char ** argv) -> int
uo2_300.setDensity(10.257);
uo2_300.setTemperature(900.0);
uo2_300.setColor(um2::pink);
uo2_300.addNuclidesAtomPercent({"U235", "U238", "O16"}, {0.03 / 3, 0.97 / 3, 2.0 / 3});
uo2_300.setUO2(0.03);
uo2_300.populateXSec(xslib);
materials.push_back(uo2_300);

Expand All @@ -281,8 +281,7 @@ main(int argc, char ** argv) -> int
uo2_380.setDensity(10.257);
uo2_380.setTemperature(900.0);
uo2_380.setColor(um2::lightblue);
uo2_380.addNuclidesAtomPercent({"U235", "U238", "O16"},
{0.038 / 3, 0.962 / 3, 2.0 / 3});
uo2_380.setUO2(0.038);
uo2_380.populateXSec(xslib);
materials.push_back(uo2_380);

Expand All @@ -293,16 +292,7 @@ main(int argc, char ** argv) -> int
uo2_410gd.setDensity(10.111);
uo2_410gd.setTemperature(900.0);
uo2_410gd.setColor(um2::purple);
uo2_410gd.addNuclide(92235, 8.78236e-04);
uo2_410gd.addNuclide(92238, 2.05422e-02);
uo2_410gd.addNuclide(64152, 3.35960e-06);
uo2_410gd.addNuclide(64154, 3.66190e-05);
uo2_410gd.addNuclide(64155, 2.48606e-04);
uo2_410gd.addNuclide(64156, 3.43849e-04);
uo2_410gd.addNuclide(64157, 2.62884e-04);
uo2_410gd.addNuclide(64158, 4.17255e-04);
uo2_410gd.addNuclide(64160, 3.67198e-04);
uo2_410gd.addNuclide(8016, 4.53705e-02);
uo2_410gd.setUO2(0.041, /*wt_gad=*/0.05);
uo2_410gd.populateXSec(xslib);
materials.push_back(uo2_410gd);

Expand All @@ -313,8 +303,7 @@ main(int argc, char ** argv) -> int
uo2_460.setDensity(10.257);
uo2_460.setTemperature(900.0);
uo2_460.setColor(um2::brown);
uo2_460.addNuclidesAtomPercent({"U235", "U238", "O16"},
{0.046 / 3, 0.954 / 3, 2.0 / 3});
uo2_460.setUO2(0.046);
uo2_460.populateXSec(xslib);
materials.push_back(uo2_460);

Expand All @@ -325,16 +314,7 @@ main(int argc, char ** argv) -> int
uo2_470gd.setDensity(10.111);
uo2_470gd.setTemperature(900.0);
uo2_470gd.setColor(um2::green);
uo2_470gd.addNuclide(92235, 1.00676e-04);
uo2_470gd.addNuclide(92238, 2.04136e-02);
uo2_470gd.addNuclide(64152, 3.35960e-06);
uo2_470gd.addNuclide(64154, 3.66190e-05);
uo2_470gd.addNuclide(64155, 2.48606e-04);
uo2_470gd.addNuclide(64156, 3.43849e-04);
uo2_470gd.addNuclide(64157, 2.62884e-04);
uo2_470gd.addNuclide(64158, 4.17255e-04);
uo2_470gd.addNuclide(64160, 3.67198e-04);
uo2_470gd.addNuclide(8016, 4.53705e-02);
uo2_470gd.setUO2(0.047, /*wt_gad=*/0.05);
uo2_470gd.populateXSec(xslib);
materials.push_back(uo2_470gd);

Expand All @@ -345,8 +325,7 @@ main(int argc, char ** argv) -> int
uo2_495.setDensity(10.257);
uo2_495.setTemperature(900.0);
uo2_495.setColor(um2::orange);
uo2_495.addNuclidesAtomPercent({"U235", "U238", "O16"},
{0.0495 / 3, 0.9505 / 3, 2.0 / 3});
uo2_495.setUO2(0.0495);
uo2_495.populateXSec(xslib);
materials.push_back(uo2_495);

Expand Down Expand Up @@ -546,7 +525,7 @@ main(int argc, char ** argv) -> int
//===========================================================================

model.importCoarseCellMeshes("svea_2d.inp");
model.writeCMFDInfo("svea_2d_cmfd_info.xdmf");
// model.writeCMFDInfo("svea_2d_cmfd_info.xdmf");
model.write("svea_2d.xdmf");
um2::finalize();
return 0;
Expand Down
Loading

0 comments on commit e9ff912

Please sign in to comment.