Skip to content
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
2 changes: 1 addition & 1 deletion process/data_structure/blanket_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class BlanketData:
vol_shld_inboard: float = 0.0
"""Volume of inboard shield (m3)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/build_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class BuildData:
aplasmin: float = 0.25
"""minimum minor radius (m)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/buildings_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class BuildingsData:
admv: float = 1.0e5
"""administration building volume (m3)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/ccfe_hcpb_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class CCFEHCPBData:
armour_density: float = 0.0
"""FW armour density [kg/m3]"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/constraint_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class ConstraintData:
p_hcd_injected_min_mw: float = 0.1
"""minimum auxiliary power (MW) (`constraint equation 40`)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/cost_2015_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np


@dataclass
@dataclass(slots=True)
class Cost2015Data:
mean_electric_output: float = 0.0

Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/cost_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass, field


@dataclass
@dataclass(slots=True)
class CostData:
c228: float = 0.0
"""c228 account cost"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/cs_fatigue_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class CSFatigueData:
residual_sig_hoop: float = 2.4e8
"""residual hoop stress in strucutal material (Pa)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/current_drive_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class CurrentDriveData:
dx_beam_duct: float = 0.58
"""width of neutral beam duct where it passes between the TF coils (m)
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/dcll_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class DCLLData:
r_fci: float = 0.0
"""Radial thickness of FCIs [m]"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/divertor_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class DivertorData:
"""Divertor model dataclass"""

Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/first_wall_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class FirstWallData:
a_fw_total_full_coverage: float = 0.0
"""First wall total surface area with no holes or ports [m^2]"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/fwbs_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dataclasses import dataclass, field


@dataclass
@dataclass(slots=True)
class FWBSData:
life_blkt_fpy: float = 0.0
"""Full power blanket lifetime (years)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/heat_transport_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class HeatTransportData:
p_plant_electric_base: float = 5.0e6
"""base plant electric load (W)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/ife_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"""


@dataclass
@dataclass(slots=True)
class IFEData:
bldr: float = 1.0
"""radial thickness of IFE blanket (m; calculated `if ifetyp=4`)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/neoclassics_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""Number of Gauss laguerre roots"""


@dataclass
@dataclass(slots=True)
class NeoclassicsData:
densities: list[float] = field(default_factory=lambda: np.zeros(4))
"""Densities of the species that are considered [/m3]"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/pf_power_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np


@dataclass
@dataclass(slots=True)
class PFPowerData:
acptmax: float = 0.0
"""average of currents in PF circuits (kA)"""
Expand Down
5 changes: 4 additions & 1 deletion process/data_structure/pfcoil_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""new variable to include 2 additional circuits: plasma and central solenoid"""


@dataclass
@dataclass(slots=True)
class PFCoilData:
# PF coil module variables
nef: int = 0
Expand Down Expand Up @@ -504,5 +504,8 @@ class PFCoilData:
radius_cs_turn_cable_space: float = 0.0
"""Length of CS of CS coil turn conduit length"""

r_pf_outside_tf_midplane: float = 0.0
""" Radial position of PF coil at the midplane."""


CREATE_DICTS_FROM_DATACLASS = PFCoilData
4 changes: 2 additions & 2 deletions process/data_structure/power_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass, field


@dataclass
@dataclass(slots=True)
class PowerData:
qmisc: float = 0.0

Expand Down Expand Up @@ -72,7 +72,7 @@ class PowerData:
p_cryo_plant_electric_profile_mw: list[float] = field(default_factory=list)
"""Profile of total cryo plant electric power (MW) over pulse"""

p_plant_electric_base_total__profile_mw: list[float] = field(default_factory=list)
p_plant_electric_base_total_profile_mw: list[float] = field(default_factory=list)
"""Profile of total plant electric base power (MW) over pulse"""

p_plant_electric_gross_profile_mw: list[float] = field(default_factory=list)
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/primary_pumping_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class PrimaryPumpingData:
gamma_he: float = 1.667
"""ratio of specific heats for helium (`i_p_coolant_pumping=3`)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/pulse_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class PulseData:
bctmp: float = 320.0
"""first wall bulk coolant temperature (C)"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/reinke_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class ReinkeData:
impvardiv: int = 9
"""Index of impurity to be iterated for Reinke divertor detachment criterion"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/stellarator_configuration.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class StellaratorConfigData:
stella_config_name: str = ""
"""Name of the configuration"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/stellarator_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class StellaratorData:
f_st_n_coils: float = 0.0
"""Actual number of coils to reference value from stella_config file"""
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/structure_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class StructureData:
"""Data describing the structure."""

Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/times_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np


@dataclass
@dataclass(slots=True)
class TimesData:
pulsetimings: int = 1
"""Switch for pulse timings (if i_pulsed_plant=1):
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/vacuum_variables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class VacuumData:
i_vacuum_pumping: str = "old"
"""switch for vacuum pumping model:
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/water_usage_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from dataclasses import dataclass


@dataclass
@dataclass(slots=True)
class WaterUseData:
airtemp: float = 15.0
"""ambient air temperature (degrees Celsius)"""
Expand Down
46 changes: 18 additions & 28 deletions process/models/pfcoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ def pfcoil(self):
pcls0 = np.zeros(N_PF_GROUPS_MAX, dtype=int)
ncls0 = np.zeros(N_PF_GROUPS_MAX + 2, dtype=int)

self.data.pf_coil.rcls0, self.data.pf_coil.zcls0 = np.zeros(
rcls0, zcls0 = np.zeros(
(
2,
N_PF_GROUPS_MAX,
N_PF_COILS_IN_GROUP_MAX,
),
order="F",
)
self.data.pf_coil.ccls0 = np.zeros(int(N_PF_GROUPS_MAX / 2))
ccls0 = np.zeros(int(N_PF_GROUPS_MAX / 2))
brin, bzin, rpts, zpts = np.zeros((4, NPTSMX))
bfix, bvec = np.zeros((2, lrow1))
gmat, _, _ = np.zeros((3, lrow1, lcol1), order="F")
Expand Down Expand Up @@ -504,26 +504,18 @@ def pfcoil(self):

for ccount in range(ngrp0):
ncls0[ccount] = 2
self.data.pf_coil.rcls0[ccount, 0] = (
self.data.pf_coil.r_pf_coil_middle_group_array[
pcls0[ccount] - 1, 0
]
)
self.data.pf_coil.rcls0[ccount, 1] = (
self.data.pf_coil.r_pf_coil_middle_group_array[
pcls0[ccount] - 1, 1
]
)
self.data.pf_coil.zcls0[ccount, 0] = (
self.data.pf_coil.z_pf_coil_middle_group_array[
pcls0[ccount] - 1, 0
]
)
self.data.pf_coil.zcls0[ccount, 1] = (
self.data.pf_coil.z_pf_coil_middle_group_array[
pcls0[ccount] - 1, 1
]
)
rcls0[ccount, 0] = self.data.pf_coil.r_pf_coil_middle_group_array[
pcls0[ccount] - 1, 0
]
rcls0[ccount, 1] = self.data.pf_coil.r_pf_coil_middle_group_array[
pcls0[ccount] - 1, 1
]
zcls0[ccount, 0] = self.data.pf_coil.z_pf_coil_middle_group_array[
pcls0[ccount] - 1, 0
]
zcls0[ccount, 1] = self.data.pf_coil.z_pf_coil_middle_group_array[
pcls0[ccount] - 1, 1
]

npts0 = 1
rpts[0] = pv.rmajor
Expand All @@ -546,7 +538,7 @@ def pfcoil(self):

pv.b_plasma_vertical_required = bzin[0]

_ssqef, self.data.pf_coil.ccls0 = self.efc(
_ssqef, ccls0 = self.efc(
npts0,
rpts,
zpts,
Expand All @@ -558,18 +550,16 @@ def pfcoil(self):
self.data.pf_coil.c_pf_cs_current_filaments,
ngrp0,
ncls0,
self.data.pf_coil.rcls0,
self.data.pf_coil.zcls0,
rcls0,
zcls0,
self.data.pf_coil.alfapf,
bfix,
gmat,
bvec,
)

for ccount in range(ngrp0):
self.data.pf_coil.ccls[pcls0[ccount] - 1] = self.data.pf_coil.ccls0[
ccount
]
self.data.pf_coil.ccls[pcls0[ccount] - 1] = ccls0[ccount]

# Flux swing from vertical field

Expand Down
4 changes: 2 additions & 2 deletions process/models/stellarator/heating.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def st_heat(stellarator, f_output: bool, data: DataStructure):
data.current_drive.eta_hcd_primary_injector_wall_plug = (
data.current_drive.eta_ecrh_injector_wall_plug
)
data.current_drive.p_hcd_electric_total_mw = (
data.heat_transport.p_hcd_electric_total_mw = (
data.current_drive.p_hcd_injected_ions_mw
+ data.current_drive.p_hcd_injected_electrons_mw
) / data.current_drive.eta_hcd_primary_injector_wall_plug
Expand Down Expand Up @@ -82,7 +82,7 @@ def st_heat(stellarator, f_output: bool, data: DataStructure):
data.current_drive.eta_hcd_primary_injector_wall_plug = (
data.current_drive.eta_beam_injector_wall_plug
)
data.current_drive.p_hcd_electric_total_mw = (
data.heat_transport.p_hcd_electric_total_mw = (
data.current_drive.p_hcd_injected_ions_mw
+ data.current_drive.p_hcd_injected_electrons_mw
) / data.current_drive.eta_hcd_primary_injector_wall_plug
Expand Down
13 changes: 8 additions & 5 deletions process/models/stellarator/preset_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,11 @@ def load_stellarator_config(istell: int, config_file: Path | None, data: DataStr
raise ProcessValueError(f"{istell=} is not an integer in the range [1, 6]")

for variable_name, variable_value in machine_config.items():
setattr(
data.stellarator_config,
f"stella_config_{variable_name.lower()}",
variable_value,
)
name_on_data_structure = f"stella_config_{variable_name.lower()}"

if hasattr(data.stellarator_config, name_on_data_structure):
setattr(
data.stellarator_config,
name_on_data_structure,
variable_value,
)
Loading
Loading