Skip to content

Commit

Permalink
Get cold mass working and add way to disable calc
Browse files Browse the repository at this point in the history
  • Loading branch information
djsegal committed May 23, 2017
1 parent 7205599 commit 3585691
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
1 change: 1 addition & 0 deletions defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ max_h_parallel = 500 * ( 1u"MW" / 1u"m^2" )
enable_bremsstrahlung = true
enable_eta_CD_derive = true
enable_blanket_derive = true
enable_cold_mass_calc = true

confinement_scaling = Dict(
"constant" => 0.145,
Expand Down
4 changes: 4 additions & 0 deletions lib/input_decks/magnet_defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ WP_AR = 2 # Winding pack aspect ratio

magnet_max_neutron_fluence = 1e23 * 1u"m^-2"

magnet_standard_cold_mass = 10135

St_Rho = 8000 # Density of steel

Cu_Rho = 8950 # Density of copper

magnet_Tcs = 60 # lowest current sharing temperature
Expand Down
18 changes: 12 additions & 6 deletions src/functions/magnets/magnet_cold_mass.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
"""
magnet_cold_mass(cur_solution=solve_magnet_equations())
Lorem ipsum dolor sit amet.
Total volume of magnets times density (~8000 kg/m3) in [tons].
"""
function magnet_cold_mass(cur_solution=solve_magnet_equations())
# comes from total volume of magnets x density (~8000 kg/m3) in [tons]

# cur_cold_mass = Vol_ST_Total(cur_solution)
if !enable_cold_mass_calc
return magnet_standard_cold_mass
end

# cur_cold_mass += Vol_HTS_Total(cur_solution)
cur_cold_mass = Vol_ST_Total(cur_solution)

# cur_cold_mass *= 8000 # density
cur_cold_mass += Vol_HTS_Total(cur_solution)

cur_cold_mass *= St_Rho

cur_cold_mass *= 1e-3

cur_cold_mass

10135
end
18 changes: 11 additions & 7 deletions test/functions/magnets/magnet_cold_mass_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

@test isdefined(Tokamak, :magnet_cold_mass) == true

Tokamak.load_input(" R_0 = 5.7 * 1u\"m\" ")
Tokamak.load_input(" R_0 = 3.3 * 1u\"m\" ")
Tokamak.load_input(" B_0 = 9.2 * 1u\"T\" ")
Tokamak.load_input(" I_M = 8 * 1u\"MA\" ")
Tokamak.load_input(" T_k = 15 * 1u\"keV\" ")
Tokamak.load_input(" epsilon = 0.2807017544 ")
Tokamak.load_input(" kappa = 2.0 ")

# chosen to get P_F = 500
Tokamak.load_input(" n_bar = 0.55229943350020245 * 1u\"n20\" ")
Tokamak.load_input(" n_bar = 1.5 * 1u\"n20\" ")
Tokamak.load_input(" nu_T = 1.3 ")
Tokamak.load_input(" nu_n = 0.5 ")
Tokamak.load_input(" delta = 0.45 ")
Tokamak.load_input(" epsilon = 0.3424242424 ")
Tokamak.load_input(" enable_blanket_derive = false ")

actual_value = Tokamak.magnet_cold_mass()

expected_value = 10135
expected_value = 9.467301448145846e+05
expected_value /= 1e3

@test isapprox(expected_value, actual_value, rtol=5e-4)

Expand Down

0 comments on commit 3585691

Please sign in to comment.