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/core/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def _call_models_once(self, xc: np.ndarray, data: DataStructure):

# Perform the various function calls
# Stellarator caller
if data_structure.stellarator_variables.istell != 0:
if data.stellarator.istell != 0:
self.models.stellarator.run()
# TODO Is this return safe?
return
Expand Down
8 changes: 2 additions & 6 deletions process/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
)
from process.data_structure.rebco_variables import init_rebco_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.superconducting_tf_coil_variables import (
init_superconducting_tf_coil_variables,
)
Expand Down Expand Up @@ -249,7 +248,6 @@ def init_all_module_vars():
init_physics_variables()
init_scan_variables()
init_superconducting_tf_coil_variables()
init_stellarator_variables()
init_tfcoil_variables()
constants.init_constants()
init_pf_power_variables()
Expand Down Expand Up @@ -1122,9 +1120,7 @@ def check_process(inputs, data): # noqa: ARG001
# Ensure that blanket material fractions allow non-zero space for steel
# CCFE HCPB Model

if data_structure.stellarator_variables.istell == 0 and (
data.fwbs.i_blanket_type == 1
):
if data.stellarator.istell == 0 and (data.fwbs.i_blanket_type == 1):
fsum = data.fwbs.breeder_multiplier + data.fwbs.vfcblkt + data.fwbs.vfpblkt
if fsum >= 1.0:
raise ProcessValidationError(
Expand Down Expand Up @@ -1244,5 +1240,5 @@ def set_active_constraints():
def set_device_type(data):
if data.ife.ife == 1:
data_structure.global_variables.icase = "Inertial Fusion model"
elif data_structure.stellarator_variables.istell != 0:
elif data.stellarator.istell != 0:
data_structure.global_variables.icase = "Stellarator model"
48 changes: 15 additions & 33 deletions process/core/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ def __post_init__(self):
"pres_blkt_coolant": InputVariable("fwbs", float, range=(100000.0, 100000000.0)),
"blpressure_liq": InputVariable("fwbs", float, range=(100000.0, 100000000.0)),
"b_cs_limit_max": InputVariable("pf_coil", float, range=(0.01, 100.0)),
"bmn": InputVariable(
data_structure.stellarator_variables, float, range=(0.0001, 0.01)
),
"bmn": InputVariable("stellarator", float, range=(0.0001, 0.01)),
"b_tf_inboard_max": InputVariable("constraints", float, range=(0.1, 50.0)),
"f_c_plasma_bootstrap_max": InputVariable(
"current_drive", float, range=(-0.999, 0.999)
Expand Down Expand Up @@ -462,9 +460,7 @@ def __post_init__(self):
"f_alpha_energy_confinement_min": InputVariable(
"constraints", float, range=(1.0, 100.0)
),
"f_asym": InputVariable(
data_structure.stellarator_variables, float, range=(0.9, 2.0)
),
"f_asym": InputVariable("stellarator", float, range=(0.9, 2.0)),
"f_fw_peak": InputVariable("fwbs", float, range=(1.0, 100.0)),
"f_fw_rad_max": InputVariable("constraints", float, range=(0.1, 10)),
"f_nd_alpha_electron": InputVariable(
Expand All @@ -479,9 +475,7 @@ def __post_init__(self):
"f_neut_shield": InputVariable("fwbs", float, range=(0.0, 1.0)),
"f_nuc_pow_bz_struct": InputVariable("fwbs", float, range=(0.0, 1.0)),
"f_r_cp": InputVariable("build", float, range=(1.0, 100.0)),
"f_rad": InputVariable(
data_structure.stellarator_variables, float, range=(0.0, 1.0)
),
"f_rad": InputVariable("stellarator", float, range=(0.0, 1.0)),
"f_sync_reflect": InputVariable(
data_structure.physics_variables, float, range=(0.0, 1.0)
),
Expand All @@ -492,10 +486,8 @@ def __post_init__(self):
"f_vforce_inboard": InputVariable(
data_structure.tfcoil_variables, float, range=(0.0, 1.0)
),
"f_w": InputVariable(data_structure.stellarator_variables, float, range=(0.1, 1.0)),
"f_st_coil_aspect": InputVariable(
data_structure.stellarator_variables, float, range=(0.1, 10.0)
),
"f_w": InputVariable("stellarator", float, range=(0.1, 1.0)),
"f_st_coil_aspect": InputVariable("stellarator", float, range=(0.1, 10.0)),
"f_z_cryostat": InputVariable("build", float, range=(2.0, 10.0)),
"fauxbop": InputVariable("ife", float, range=(0.0, 1.0)),
"fblbe": InputVariable("fwbs", float, range=(0.0, 1.0)),
Expand Down Expand Up @@ -532,9 +524,7 @@ def __post_init__(self):
"fjohc0": InputVariable("constraints", float, range=(0.001, 1.0)),
"f_ster_div_single": InputVariable("fwbs", float, range=(0.0, 1.0)),
"fdiva": InputVariable("divertor", float, range=(0.1, 2.0)),
"fdivwet": InputVariable(
data_structure.stellarator_variables, float, range=(0.01, 1.0)
),
"fdivwet": InputVariable("stellarator", float, range=(0.01, 1.0)),
"feffcd": InputVariable("current_drive", float, range=(0.0, 20.0)),
"f_a_fw_outboard_hcd": InputVariable("fwbs", float, range=(0.0, 1.0)),
"fhole": InputVariable("fwbs", float, range=(0.0, 1.0)),
Expand All @@ -543,9 +533,7 @@ def __post_init__(self):
"f_h_mode_margin": InputVariable("constraints", float, range=(0.001, 1000000.0)),
"f_l_mode_margin": InputVariable("constraints", float, range=(0.001, 1000000.0)),
"flirad": InputVariable("ife", float, range=(0.0, 10.0)),
"flpitch": InputVariable(
data_structure.stellarator_variables, float, range=(0.0001, 0.01)
),
"flpitch": InputVariable("stellarator", float, range=(0.0001, 0.01)),
"f_div_flux_expansion": InputVariable("divertor", float, range=(0.0, 10.0)),
"fmgdmw": InputVariable("heat_transport", float, range=(0.0, 100.0)),
"fndt": InputVariable("buildings", float, range=(0.0, 10.0)),
Expand Down Expand Up @@ -640,9 +628,7 @@ def __post_init__(self):
),
"temp_blkt_coolant_in": InputVariable("fwbs", float, range=(200.0, 600.0)),
"inlet_temp_liq": InputVariable("fwbs", float, range=(508.0, 1500.0)),
"iotabar": InputVariable(
data_structure.stellarator_variables, float, range=(0.1, 10.0)
),
"iotabar": InputVariable("stellarator", float, range=(0.1, 10.0)),
"j_tf_bus": InputVariable(
data_structure.tfcoil_variables, float, range=(10000.0, 100000000.0)
),
Expand Down Expand Up @@ -675,7 +661,7 @@ def __post_init__(self):
"maintenance_fwbs": InputVariable("costs", float, range=(0.0, 1.0)),
"maintenance_gen": InputVariable("costs", float, range=(0.0, 1.0)),
"max_gyrotron_frequency": InputVariable(
data_structure.stellarator_variables,
"stellarator",
float,
range=(1000000000.0, 100000000000000.0),
),
Expand Down Expand Up @@ -868,9 +854,7 @@ def __post_init__(self):
"shdr": InputVariable("ife", float, range=(0.0, 10.0)),
"shdzl": InputVariable("ife", float, range=(0.0, 10.0)),
"shdzu": InputVariable("ife", float, range=(0.0, 10.0)),
"shear": InputVariable(
data_structure.stellarator_variables, float, range=(0.1, 10.0)
),
"shear": InputVariable("stellarator", float, range=(0.1, 10.0)),
"dz_shld_lower": InputVariable("build", float, range=(0.0, 10.0)),
"dz_shld_upper": InputVariable("build", float, range=(0.0, 10.0)),
"shmf": InputVariable("buildings", float, range=(0.0, 1.0)),
Expand Down Expand Up @@ -971,9 +955,7 @@ def __post_init__(self):
"temp_plasma_electron_vol_avg_kev": InputVariable(
data_structure.physics_variables, float, range=(1.0, 200.0)
),
"te0_ecrh_achievable": InputVariable(
data_structure.stellarator_variables, float, range=(1.0, 1000.0)
),
"te0_ecrh_achievable": InputVariable("stellarator", float, range=(1.0, 1000.0)),
"temp_cp_average": InputVariable(
data_structure.tfcoil_variables, float, range=(4.0, 573.15)
),
Expand Down Expand Up @@ -1287,8 +1269,8 @@ def __post_init__(self):
"i_pf_energy_storage_source": InputVariable(
data_structure.pf_power_variables, int, range=(1, 3)
),
"istell": InputVariable(data_structure.stellarator_variables, int, range=(0, 6)),
"isthtr": InputVariable(data_structure.stellarator_variables, int, range=(1, 3)),
"istell": InputVariable("stellarator", int, range=(0, 6)),
"isthtr": InputVariable("stellarator", int, range=(1, 3)),
"istore": InputVariable("pulse", int, range=(1, 3)),
"i_cs_superconductor": InputVariable("pf_coil", int, range=(1, 9)),
"i_pf_superconductor": InputVariable("pf_coil", int, range=(1, 9)),
Expand All @@ -1299,7 +1281,7 @@ def __post_init__(self):
data_structure.physics_variables, int, range=(1, 2)
),
"lsa": InputVariable("costs", int, range=(1, 4)),
"m_res": InputVariable(data_structure.stellarator_variables, int, range=(1, 10)),
"m_res": InputVariable("stellarator", int, range=(1, 10)),
"n_tf_wp_layers": InputVariable(
data_structure.tfcoil_variables, int, range=(1, 100)
),
Expand All @@ -1313,7 +1295,7 @@ def __post_init__(self):
"n_rad_per_layer": InputVariable(
data_structure.tfcoil_variables, int, range=(1, 500)
),
"n_res": InputVariable(data_structure.stellarator_variables, int, range=(3, 6)),
"n_res": InputVariable("stellarator", int, range=(3, 6)),
"n_tf_graded_layers": InputVariable(
data_structure.tfcoil_variables, int, range=(1, 20)
),
Expand Down
4 changes: 4 additions & 0 deletions process/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from process.data_structure.primary_pumping_variables import PrimaryPumpingData
from process.data_structure.pulse_variables import PulseData
from process.data_structure.reinke_variables import ReinkeData
from process.data_structure.stellarator_configuration import StellaratorConfigData
from process.data_structure.stellarator_variables import StellaratorData
from process.data_structure.structure_variables import StructureData
from process.data_structure.times_variables import TimesData
from process.data_structure.vacuum_variables import VacuumData
Expand Down Expand Up @@ -55,6 +57,8 @@ class DataStructure:
divertor: DivertorData = initialise_later
pf_coil: PFCoilData = initialise_later
power: PowerData = initialise_later
stellarator: StellaratorData = initialise_later
stellarator_config: StellaratorConfigData = initialise_later

def __post_init__(self):
for f in fields(self):
Expand Down
2 changes: 1 addition & 1 deletion process/core/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def write(models, data, _outfile):
logging_model_handler.clear_logs()

# Call stellarator output routine instead if relevant
if data_structure.stellarator_variables.istell != 0:
if data.stellarator.istell != 0:
models.stellarator.output()
return

Expand Down
10 changes: 5 additions & 5 deletions process/core/solver/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ def constraint_equation_23(constraint_registration, data):


@ConstraintManager.register_constraint(24, "", "<=")
def constraint_equation_24(constraint_registration, _data):
def constraint_equation_24(constraint_registration, data):
"""Equation for beta upper limit

i_beta_component: switch for beta limit scaling (constraint equation 24):
Expand All @@ -758,7 +758,7 @@ def constraint_equation_24(constraint_registration, _data):
# Include all beta components: relevant for both tokamaks and stellarators
if (
data_structure.physics_variables.i_beta_component == BetaComponentLimits.TOTAL
or data_structure.stellarator_variables.istell != 0
or data.stellarator.istell != 0
):
value = data_structure.physics_variables.beta_total_vol_avg
# Here, the beta limit applies to only the thermal component, not the fast alpha or neutral beam parts
Expand Down Expand Up @@ -1821,15 +1821,15 @@ def constraint_equation_91(constraint_registration, data):
# Achievable ECRH te needs to be larger than needed te for igntion
if data_structure.physics_variables.i_plasma_ignited == 0:
value = (
data_structure.stellarator_variables.powerht_constraint
data.stellarator.powerht_constraint
+ data.current_drive.p_hcd_primary_extra_heat_mw
)
else:
value = data_structure.stellarator_variables.powerht_constraint
value = data.stellarator.powerht_constraint

return geq(
value,
data_structure.stellarator_variables.powerscaling_constraint,
data.stellarator.powerscaling_constraint,
constraint_registration,
)

Expand Down
8 changes: 2 additions & 6 deletions process/core/solver/iteration_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ class IterationVariable:
"dx_croco_strand_copper", data_structure.rebco_variables, 1.0e-3, 1.0e-1
),
162: IterationVariable("r_cp_top", "build", 0.0010, 10.0),
169: IterationVariable(
"te0_ecrh_achievable", data_structure.stellarator_variables, 1.0, 1.0e3
),
169: IterationVariable("te0_ecrh_achievable", "stellarator", 1.0, 1.0e3),
170: IterationVariable("deg_div_field_plate", "divertor", 0.49, 5.01),
171: IterationVariable(
"casths_fraction", data_structure.tfcoil_variables, 0.01, 0.99
Expand All @@ -261,9 +259,7 @@ class IterationVariable:
),
174: IterationVariable("triang", data_structure.physics_variables, 0.00, 1.00),
175: IterationVariable("kappa", data_structure.physics_variables, 0.00, 10.00),
176: IterationVariable(
"f_st_coil_aspect", data_structure.stellarator_variables, 0.70, 1.30
),
176: IterationVariable("f_st_coil_aspect", "stellarator", 0.70, 1.30),
}


Expand Down
Loading
Loading