Skip to content
Draft
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
2 changes: 0 additions & 2 deletions process/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from process.data_structure.reinke_variables import init_reinke_variables
from process.data_structure.scan_variables import init_scan_variables
from process.data_structure.stellarator_variables import init_stellarator_variables
from process.data_structure.structure_variables import init_structure_variables
from process.data_structure.superconducting_tf_coil_variables import (
init_superconducting_tf_coil_variables,
)
Expand Down Expand Up @@ -286,7 +285,6 @@ def init_all_module_vars():
init_current_drive_variables()
init_primary_pumping_variables()
init_pfcoil_variables()
init_structure_variables()
init_pf_power_variables()
init_build_variables()
init_constraint_variables()
Expand Down
2 changes: 2 additions & 0 deletions process/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from process.data_structure.cs_fatigue_variables import CSFatigueData
from process.data_structure.first_wall_variables import FirstWallData
from process.data_structure.fwbs_variables import FWBSData
from process.data_structure.structure_variables import StructureVariables
from process.data_structure.vacuum_variables import VacuumData
from process.data_structure.water_usage_variables import WaterUseData

Expand All @@ -21,6 +22,7 @@ class DataStructure:
costs: CostData = initialise_later
first_wall: FirstWallData = initialise_later
fwbs: FWBSData = initialise_later
structure: StructureVariables = initialise_later

def __post_init__(self):
for f in fields(self):
Expand Down
35 changes: 17 additions & 18 deletions process/data_structure/structure_variables.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
aintmass: float = None
"""intercoil structure mass (kg)"""
from dataclasses import dataclass

clgsmass: float = None
"""gravity support structure for TF coil, PF coil and intercoil support systems (kg)"""

coldmass: float = None
"""total mass of components at cryogenic temperatures (kg)"""
@dataclass
class StructureVariables:
"""Data describing the structure."""

fncmass: float = None
"""PF coil outer support fence mass (kg)"""
aintmass: float = 0.0
"""intercoil structure mass (kg)"""

gsmass: float = None
"""reactor core gravity support mass (kg)"""
clgsmass: float = 0.0
"""gravity support structure for TF coil, PF coil and intercoil support systems (kg)"""

coldmass: float = 0.0
"""total mass of components at cryogenic temperatures (kg)"""

def init_structure_variables():
"""Initialise structure variables"""
global aintmass, clgsmass, coldmass, fncmass, gsmass
fncmass: float = 0.0
"""PF coil outer support fence mass (kg)"""

aintmass = 0.0
clgsmass = 0.0
coldmass = 0.0
fncmass = 0.0
gsmass = 0.0
gsmass: float = 0.0
"""reactor core gravity support mass (kg)"""


CREATE_DICTS_FROM_DATACLASS = StructureVariables
9 changes: 4 additions & 5 deletions process/models/costs/costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
pfcoil_variables,
physics_variables,
pulse_variables,
structure_variables,
tfcoil_variables,
times_variables,
)
Expand Down Expand Up @@ -1403,7 +1402,7 @@ def acc2214(self):

self.data.costs.c2214 = (
1.0e-6
* structure_variables.gsmass
* self.data.structure.gsmass
* self.data.costs.UCGSS
* cmlsa[self.data.costs.lsa - 1]
)
Expand Down Expand Up @@ -1566,7 +1565,7 @@ def acc2221(self):
# Account 222.1.4 : Intercoil structure

self.data.costs.c22214 = (
1.0e-6 * structure_variables.aintmass * self.data.costs.UCINT
1.0e-6 * self.data.structure.aintmass * self.data.costs.UCINT
)
self.data.costs.c22214 = (
self.data.costs.fkind
Expand All @@ -1577,7 +1576,7 @@ def acc2221(self):
# Account 222.1.5 : Gravity support structure

self.data.costs.c22215 = (
1.0e-6 * structure_variables.clgsmass * self.data.costs.UCGSS
1.0e-6 * self.data.structure.clgsmass * self.data.costs.UCGSS
)
self.data.costs.c22215 = (
self.data.costs.fkind
Expand Down Expand Up @@ -1825,7 +1824,7 @@ def acc2222(self):
# Account 222.2.4 : Support structure

self.data.costs.c22224 = (
1.0e-6 * self.data.costs.ucfnc * structure_variables.fncmass
1.0e-6 * self.data.costs.ucfnc * self.data.structure.fncmass
)
self.data.costs.c22224 = (
self.data.costs.fkind
Expand Down
11 changes: 5 additions & 6 deletions process/models/ife.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
heat_transport_variables,
ife_variables,
physics_variables,
structure_variables,
)

MATERIALS = [
Expand Down Expand Up @@ -1647,11 +1646,11 @@ def ifestr(self):

The outputs are all, trivially, 0 as they are magnetic fusion specific.
"""
structure_variables.aintmass = 0.0
structure_variables.clgsmass = 0.0
structure_variables.coldmass = 0.0
structure_variables.fncmass = 0.0
structure_variables.gsmass = 0.0
self.data.structure.aintmass = 0.0
self.data.structure.clgsmass = 0.0
self.data.structure.coldmass = 0.0
self.data.structure.fncmass = 0.0
self.data.structure.gsmass = 0.0

def ifetgt(self):
"""Routine to calculate the power requirements of the target
Expand Down
3 changes: 1 addition & 2 deletions process/models/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
physics_variables,
power_variables,
primary_pumping_variables,
structure_variables,
tfcoil_variables,
times_variables,
)
Expand Down Expand Up @@ -1011,7 +1010,7 @@ def calculate_cryo_loads(self):
heat_transport_variables.helpow = self.cryo(
tfcoil_variables.i_tf_sup,
tfcoil_variables.tfcryoarea,
structure_variables.coldmass,
self.data.structure.coldmass,
self.data.fwbs.p_tf_nuclear_heat_mw,
pf_power_variables.ensxpfm,
times_variables.t_plant_pulse_plasma_present,
Expand Down
21 changes: 10 additions & 11 deletions process/models/stellarator/stellarator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
physics_variables,
stellarator_configuration,
stellarator_variables,
structure_variables,
tfcoil_variables,
)
from process.models.physics.physics import Physics, rether
Expand Down Expand Up @@ -330,10 +329,10 @@ def st_strc(self, output):
output :

"""
structure_variables.fncmass = 0.0e0
self.data.structure.fncmass = 0.0e0

# Reactor core gravity support mass
structure_variables.gsmass = 0.0e0 # ? Not sure about this.
self.data.structure.gsmass = 0.0e0 # ? Not sure about this.

# This is the previous scaling law for intercoil structure
# We keep is here as a reference to the new model, which
Expand Down Expand Up @@ -367,22 +366,22 @@ def st_strc(self, output):

# This 0.18 m is an effective thickness which is scaled with empirial 1.5 law. 5.6 T is reference point of Helias
# The thickness 0.18m was obtained as a measured value from Schauer, F. and Bykov, V. design of Helias 5-B. (Nucl Fus. 2013)
structure_variables.aintmass = (
self.data.structure.aintmass = (
0.18e0
* (physics_variables.b_plasma_toroidal_on_axis / 5.6) ** 2
* intercoil_surface
* self.data.fwbs.den_steel
)

structure_variables.clgsmass = (
0.2e0 * structure_variables.aintmass
self.data.structure.clgsmass = (
0.2e0 * self.data.structure.aintmass
) # Very simple approximation for the gravity support.
# This fits for the Helias 5b reactor design point ( F. and Bykov, V. design of Helias 5-B. (nucl Fus. 2013)).

# Total mass of cooled components
structure_variables.coldmass = (
self.data.structure.coldmass = (
tfcoil_variables.m_tf_coils_total
+ structure_variables.aintmass
+ self.data.structure.aintmass
+ self.data.fwbs.dewmkg
)

Expand All @@ -394,7 +393,7 @@ def st_strc(self, output):
self.outfile,
"Intercoil support structure mass (from intercoil calculation) (kg)",
"(aintmass)",
structure_variables.aintmass,
self.data.structure.aintmass,
)
po.ovarre(
self.outfile,
Expand All @@ -406,13 +405,13 @@ def st_strc(self, output):
self.outfile,
"Gravity support structure mass (kg)",
"(clgsmass)",
structure_variables.clgsmass,
self.data.structure.clgsmass,
)
po.ovarre(
self.outfile,
"Mass of cooled components (kg)",
"(coldmass)",
structure_variables.coldmass,
self.data.structure.coldmass,
)

def blanket_neutronics(self):
Expand Down
11 changes: 5 additions & 6 deletions process/models/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from process.data_structure import divertor_variables as divv
from process.data_structure import pfcoil_variables as pfv
from process.data_structure import physics_variables as pv
from process.data_structure import structure_variables as stv
from process.data_structure import tfcoil_variables as tfv

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -44,11 +43,11 @@ def run(self, output: bool = False):
total_weight_pf = pfv.m_pf_coil_conductor_total + pfv.m_pf_coil_structure_total

(
stv.fncmass,
stv.aintmass,
stv.clgsmass,
stv.coldmass,
stv.gsmass,
self.data.structure.fncmass,
self.data.structure.aintmass,
self.data.structure.clgsmass,
self.data.structure.coldmass,
self.data.structure.gsmass,
) = self.structure(
pv.plasma_current,
pv.rmajor,
Expand Down
23 changes: 14 additions & 9 deletions tests/unit/models/stellarator/test_stellarator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
physics_variables,
stellarator_configuration,
stellarator_variables,
structure_variables,
tfcoil_variables,
)
from process.models.stellarator.build import st_build
Expand Down Expand Up @@ -807,15 +806,15 @@ def test_ststrc(ststrcparam, monkeypatch, stellarator):

monkeypatch.setattr(stellarator.data.fwbs, "den_steel", ststrcparam.den_steel)

monkeypatch.setattr(structure_variables, "aintmass", ststrcparam.aintmass)
monkeypatch.setattr(stellarator.data.structure, "aintmass", ststrcparam.aintmass)

monkeypatch.setattr(structure_variables, "clgsmass", ststrcparam.clgsmass)
monkeypatch.setattr(stellarator.data.structure, "clgsmass", ststrcparam.clgsmass)

monkeypatch.setattr(structure_variables, "coldmass", ststrcparam.coldmass)
monkeypatch.setattr(stellarator.data.structure, "coldmass", ststrcparam.coldmass)

monkeypatch.setattr(structure_variables, "fncmass", ststrcparam.fncmass)
monkeypatch.setattr(stellarator.data.structure, "fncmass", ststrcparam.fncmass)

monkeypatch.setattr(structure_variables, "gsmass", ststrcparam.gsmass)
monkeypatch.setattr(stellarator.data.structure, "gsmass", ststrcparam.gsmass)

monkeypatch.setattr(
tfcoil_variables, "m_tf_coils_total", ststrcparam.m_tf_coils_total
Expand Down Expand Up @@ -885,11 +884,17 @@ def test_ststrc(ststrcparam, monkeypatch, stellarator):

stellarator.st_strc(False)

assert structure_variables.aintmass == pytest.approx(ststrcparam.expected_aintmass)
assert stellarator.data.structure.aintmass == pytest.approx(
ststrcparam.expected_aintmass
)

assert structure_variables.clgsmass == pytest.approx(ststrcparam.expected_clgsmass)
assert stellarator.data.structure.clgsmass == pytest.approx(
ststrcparam.expected_clgsmass
)

assert structure_variables.coldmass == pytest.approx(ststrcparam.expected_coldmass)
assert stellarator.data.structure.coldmass == pytest.approx(
ststrcparam.expected_coldmass
)


def test_u_max_protect_v():
Expand Down
9 changes: 4 additions & 5 deletions tests/unit/models/test_costs_1990.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
pfcoil_variables,
physics_variables,
pulse_variables,
structure_variables,
tfcoil_variables,
times_variables,
)
Expand Down Expand Up @@ -1620,7 +1619,7 @@ def test_acc2214(acc2214param, monkeypatch, costs):

monkeypatch.setattr(costs.data.costs, "lsa", acc2214param.lsa)

monkeypatch.setattr(structure_variables, "gsmass", acc2214param.gsmass)
monkeypatch.setattr(costs.data.structure, "gsmass", acc2214param.gsmass)

monkeypatch.setattr(costs.data.costs, "c22", acc2214param.c22)

Expand Down Expand Up @@ -1955,9 +1954,9 @@ def test_acc2221(acc2221param, monkeypatch, costs):

monkeypatch.setattr(physics_variables, "itart", acc2221param.itart)

monkeypatch.setattr(structure_variables, "clgsmass", acc2221param.clgsmass)
monkeypatch.setattr(costs.data.structure, "clgsmass", acc2221param.clgsmass)

monkeypatch.setattr(structure_variables, "aintmass", acc2221param.aintmass)
monkeypatch.setattr(costs.data.structure, "aintmass", acc2221param.aintmass)

monkeypatch.setattr(
tfcoil_variables, "m_tf_coil_copper", acc2221param.m_tf_coil_copper
Expand Down Expand Up @@ -2776,7 +2775,7 @@ def test_acc2222(acc2222param, monkeypatch, costs):

monkeypatch.setattr(pfcoil_variables, "awpoh", acc2222param.awpoh)

monkeypatch.setattr(structure_variables, "fncmass", acc2222param.fncmass)
monkeypatch.setattr(costs.data.structure, "fncmass", acc2222param.fncmass)

monkeypatch.setattr(tfcoil_variables, "dcond", acc2222param.dcond)

Expand Down
Loading