From 29d85c04472738f46d854d3aaa5c151040ecf3c2 Mon Sep 17 00:00:00 2001 From: adrianaghiozzi <67669644+adrianaghiozzi@users.noreply.github.com> Date: Wed, 3 Apr 2024 14:48:05 -0700 Subject: [PATCH 1/2] Update to reflect compound material layers --- src/physics/build.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/physics/build.jl b/src/physics/build.jl index dacb0043..c79a952b 100644 --- a/src/physics/build.jl +++ b/src/physics/build.jl @@ -154,7 +154,7 @@ function structures_mask(bd::IMAS.build; ngrid::Int=257, border_fraction::Real=0 # start from the first vacuum that goes to zero outside of the TF start_from = -1 for k in get_build_indexes(bd.layer; fs=_out_) - if bd.layer[k].material == "vacuum" && minimum(bd.layer[k].outline.r) < bd.layer[1].end_radius + if "vacuum" ∈ [bd.layer[k].material[i].name for i in length(bd.layer[k].material)] && minimum(bd.layer[k].outline.r) < bd.layer[1].end_radius start_from = k break end @@ -168,7 +168,7 @@ function structures_mask(bd::IMAS.build; ngrid::Int=257, border_fraction::Real=0 end if valid && !ismissing(layer.outline, :r) outline = collect(zip(layer.outline.r, layer.outline.z)) - if (layer.material == "vacuum") && (layer.side != Int(_in_)) + if ("vacuum" ∈ [layer.material[i].name for i in length(layer.material)]) && (layer.side != Int(_in_)) for (kr, rr) in enumerate(rmask) for (kz, zz) in enumerate(zmask) if PolygonOps.inpolygon((rr, zz), outline) != 0 From 67af9fdbb415c2ae32afc23566a5c035a7bc6f89 Mon Sep 17 00:00:00 2001 From: adrianaghiozzi <67669644+adrianaghiozzi@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:22:20 -0700 Subject: [PATCH 2/2] Initiate coil_tech as compound materials and add expressions for fraction_steel, ratio_SC_to_copper, etc --- src/expressions/dynamic.jl | 54 ++++++++++++++++ src/physics/technology.jl | 125 ++++++++++++++++++++++++++++--------- 2 files changed, 151 insertions(+), 28 deletions(-) diff --git a/src/expressions/dynamic.jl b/src/expressions/dynamic.jl index ff8acc93..819af0c8 100644 --- a/src/expressions/dynamic.jl +++ b/src/expressions/dynamic.jl @@ -463,6 +463,60 @@ dyexp["build.tf.ripple"] = dyexp["build.tf.wedge_thickness"] = (; build, _...) -> 2π * get_build_layer(build.layer; type=_tf_, fs=_hfs_).end_radius / build.tf.coils_n +dyexp["build.tf.technology.fraction_steel"] = + (; build, _...) -> begin + material = IMAS.get_build_layer(build.layer; type=_tf_, fs=_hfs_).material + return sum([mat.name == "steel" ? mat.composition : 0.0 for mat in material]) + end + +dyexp["build.tf.technology.ratio_SC_to_copper"] = + (; build, _...) -> begin + material = IMAS.get_build_layer(build.layer; type=_tf_, fs=_hfs_).material + return sum([contains(mat.name, "rebco") || contains(mat.name, "nb3sn") || contains(mat.name, "nbti") ? mat.composition : 0 for mat in material]) / sum([mat.name == "copper" ? mat.composition : 0 for mat in material]) + end + +dyexp["build.tf.technology.fraction_void"] = + (; build, _...) -> begin + material = IMAS.get_build_layer(build.layer; type=_tf_, fs=_hfs_).material + return sum([mat.name == "vacuum" ? mat.composition : 0.0 for mat in material]) +end + +dyexp["build.oh.technology.fraction_steel"] = + (; build, _...) -> begin + material = IMAS.get_build_layer(build.layer; type=_oh_).material + return sum([mat.name == "steel" ? mat.composition : 0.0 for mat in material]) + end + +dyexp["build.oh.technology.ratio_SC_to_copper"] = + (; build, _...) -> begin + material = IMAS.get_build_layer(build.layer; type=_oh_).material + return sum([contains(mat.name, "rebco") || contains(mat.name, "nb3sn") || contains(mat.name, "nbti") ? mat.composition : 0 for mat in material]) / sum([mat.name == "copper" ? mat.composition : 0 for mat in material]) + end + +dyexp["build.oh.technology.fraction_void"] = + (; build, _...) -> begin + material = IMAS.get_build_layer(build.layer; type=_oh_).material + return sum([mat.name == "vacuum" ? mat.composition : 0.0 for mat in material]) +end + +dyexp["build.pf_active.technology.fraction_steel"] = + (; build, _...) -> begin + material = build.pf_active.technology.material + return sum([mat.name == "steel" ? mat.composition : 0.0 for mat in material]) + end + +dyexp["build.pf_active.technology.ratio_SC_to_copper"] = + (; build, _...) -> begin + material = build.pf_active.technology.material + return sum([contains(mat.name, "rebco") || contains(mat.name, "nb3sn") || contains(mat.name, "nbti") ? mat.composition : 0 for mat in material]) / sum([mat.name == "copper" ? mat.composition : 0 for mat in material]) + end + +dyexp["build.pf_active.technology.fraction_void"] = + (; build, _...) -> begin + material = build.pf_active.technology.material + return sum([mat.name == "vacuum" ? mat.composition : 0.0 for mat in material]) +end + #= ======= =# # costing # #= ======= =# diff --git a/src/physics/technology.jl b/src/physics/technology.jl index e559825a..444880a4 100644 --- a/src/physics/technology.jl +++ b/src/physics/technology.jl @@ -41,53 +41,131 @@ function coil_technology(coil_tech::Union{IMAS.build__pf_active__technology,IMAS end if technology == :copper - coil_tech.material = "copper" + resize!(coil_tech.material, 2) coil_tech.temperature = 293.0 - coil_tech.fraction_steel = 0.0 - coil_tech.ratio_SC_to_copper = 0.0 - coil_tech.fraction_void = 0.2 + coil_tech.material[1].name = "copper" + coil_tech.material[1].composition = 0.8 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.2 elseif technology ∈ (:nb3sn, :nbti, :nb3sn_iter, :nb3sn_kdemo, :rebco) + resize!(coil_tech.material, 4) if technology == :nb3sn coil_tech.temperature = 4.2 - coil_tech.material = "nb3sn" - coil_tech.fraction_void = 0.1 + coil_tech.material[1].name = "nb3sn" + coil_tech.material[1].composition = 0.2 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.1 + + coil_tech.material[3].name = "steel" + coil_tech.material[3].composition = 0.5 + + coil_tech.material[4].name = "copper" + coil_tech.material[4].composition = 0.2 elseif technology == :nbti coil_tech.temperature = 4.2 - coil_tech.material = "nbti" - coil_tech.fraction_void = 0.2 # from Supercond. Sci. Technol. 36 (2023) 075009 + coil_tech.material[1].name = "nbti" + coil_tech.material[1].composition = 0.15 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.2 # from Supercond. Sci. Technol. 36 (2023) 075009 + + coil_tech.material[3].name = "steel" + coil_tech.material[3].composition = 0.5 + + coil_tech.material[4].name = "copper" + coil_tech.material[4].composition = 0.15 elseif technology == :nb3sn_iter coil_tech.temperature = 4.2 - coil_tech.material = "nb3sn_iter" - coil_tech.fraction_void = 0.1 + coil_tech.material[1].name = "nb3sn" + coil_tech.material[1].composition = 0.2 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.1 + + coil_tech.material[3].name = "steel" + coil_tech.material[3].composition = 0.5 + + coil_tech.material[4].name = "copper" + coil_tech.material[4].composition = 0.2 elseif technology == :nb3sn_kdemo coil_tech.temperature = 4.2 - coil_tech.material = "nb3sn_kdemo" + coil_tech.material[1].name = "nb3sn_kdemo" + coil_tech.material[1].composition = 0.2 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.1 + + coil_tech.material[3].name = "steel" + coil_tech.material[3].composition = 0.5 + + coil_tech.material[4].name = "copper" + coil_tech.material[4].composition = 0.2 + if coil_type == :tf - coil_tech.fraction_void = 0.26 # from NF 55 (2015) 053027, Table 2 + coil_tech.material[1].name = "nb3sn_kdemo" + coil_tech.material[1].composition = 0.12 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.26 # from NF 55 (2015) 053027, Table 2 + + coil_tech.material[3].name = "steel" + coil_tech.material[3].composition = 0.5 + + coil_tech.material[4].name = "copper" + coil_tech.material[4].composition = 0.12 end else coil_tech.temperature = 4.2 - coil_tech.material = "rebco" + coil_tech.material[1].name = "rebco" + coil_tech.material[1].composition = 0.2 + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.1 + + coil_tech.material[3].name = "steel" + coil_tech.material[3].composition = 0.5 + + coil_tech.material[4].name = "copper" + coil_tech.material[4].composition = 0.2 + end - coil_tech.fraction_steel = 0.5 - coil_tech.ratio_SC_to_copper = 1.0 - coil_tech.fraction_void = 0.1 end if technology == :nb3sn_iter + resize!(coil_tech.material, 4) + coil_tech.material[1].name = "nb3sn_iter" + + coil_tech.material[2].name = "vacuum" + coil_tech.material[2].composition = 0.1 + + coil_tech.material[3].name = "steel" + + coil_tech.material[4].name = "copper" + if coil_type == :oh coil_tech.thermal_strain = -0.64 coil_tech.JxB_strain = -0.05 - coil_tech.fraction_steel = 0.46 + + coil_tech.material[1].composition = 0.22 + coil_tech.material[3].composition = 0.46 + coil_tech.material[4].composition = 0.22 elseif coil_type == :tf coil_tech.thermal_strain = -0.69 coil_tech.JxB_strain = -0.13 - coil_tech.fraction_steel = 0.55 + + coil_tech.material[1].composition = 0.175 + coil_tech.material[3].composition = 0.55 + coil_tech.material[4].composition = 0.175 elseif coil_type == :pf_active coil_tech.thermal_strain = -0.64 coil_tech.JxB_strain = -0.05 - coil_tech.fraction_steel = 0.46 + + coil_tech.material[1].composition = 0.22 + coil_tech.material[3].composition = 0.46 + coil_tech.material[4].composition = 0.22 end end @@ -97,15 +175,6 @@ function coil_technology(coil_tech::Union{IMAS.build__pf_active__technology,IMAS return coil_tech end -function fraction_conductor(coil_tech::Union{IMAS.build__pf_active__technology,IMAS.build__oh__technology,IMAS.build__tf__technology}) - frac = 1.0 - coil_tech.fraction_steel - coil_tech.fraction_void # fraction of coil that is a conductor - @assert frac > 0.0 "coil technology has no room for conductor" - if coil_tech.material == "copper" - return frac - else - return frac * coil_tech.ratio_SC_to_copper / (1.0 + coil_tech.ratio_SC_to_copper) # fraction of coil that is Nb3Sn superconductor - end -end function GAMBL_blanket(bm::IMAS.blanket__module) layers = resize!(bm.layer, 3)