diff --git a/process/main.py b/process/main.py index cc2464f0e..f1423dcce 100644 --- a/process/main.py +++ b/process/main.py @@ -583,6 +583,8 @@ def __init__(self): This also initialises module variables in the Fortran for that module. """ self._costs_custom = None + self._costs_old = Costs() + self._costs_2015 = Costs2015() self.cs_fatigue = CsFatigue() self.pfcoil = PFCoil(cs_fatigue=self.cs_fatigue) self.power = Power() @@ -597,7 +599,6 @@ def __init__(self): self.vacuum = Vacuum() self.water_use = WaterUse() self.pulse = Pulse() - self._costs_old = Costs() self.ife = IFE(availability=self.availability, costs=self.costs) self.plasma_profile = PlasmaProfile() self.fw = Fw() @@ -614,7 +615,6 @@ def __init__(self): hcpb=self.ccfe_hcpb, current_drive=self.current_drive, ) - self._costs_2015 = Costs2015() self.physics = Physics( plasma_profile=self.plasma_profile, current_drive=self.current_drive ) diff --git a/tests/unit/test_costs_1990.py b/tests/unit/test_costs_1990.py index 30edc9f65..f3a55ad0d 100644 --- a/tests/unit/test_costs_1990.py +++ b/tests/unit/test_costs_1990.py @@ -1,4 +1,5 @@ """Unit tests for costs.f90.""" + from process.fortran import cost_variables from process.fortran import fwbs_variables as fv from process.fortran import heat_transport_variables as htv @@ -706,7 +707,6 @@ def test_acc9(monkeypatch, costs): class Acc21Param(NamedTuple): - shovol: Any = None triv: Any = None @@ -992,7 +992,6 @@ def test_acc21(acc21param, monkeypatch, costs): class Acc2211Param(NamedTuple): - fwarea: Any = None ucblss: Any = None @@ -1130,7 +1129,6 @@ def test_acc2211(acc2211param, monkeypatch, costs): class Acc2212Param(NamedTuple): - ucblss: Any = None ucblbreed: Any = None @@ -1418,7 +1416,6 @@ def test_acc2212(acc2212param, monkeypatch, costs): class Acc2213Param(NamedTuple): - ucpens: Any = None ucshld: Any = None @@ -1580,7 +1577,6 @@ def test_acc2213(acc2213param, monkeypatch, costs): class Acc2214Param(NamedTuple): - fkind: Any = None lsa: Any = None @@ -1644,7 +1640,6 @@ def test_acc2214(acc2214param, monkeypatch, costs): class Acc2215Param(NamedTuple): - ifueltyp: Any = None divcst: Any = None @@ -1726,7 +1721,6 @@ def test_acc2215(acc2215param, monkeypatch, costs): class Acc2221Param(NamedTuple): - uccpclb: Any = None uccase: Any = None @@ -1964,7 +1958,6 @@ def test_acc2221(acc2221param, monkeypatch, costs): class Acc2222Param(NamedTuple): - iohcl: Any = None uccase: Any = None @@ -2522,7 +2515,6 @@ def test_acc2222(acc2222param, monkeypatch, costs): class Acc2223Param(NamedTuple): - uccryo: Any = None lsa: Any = None @@ -2592,7 +2584,6 @@ def test_acc2223(acc2223param, monkeypatch, costs): class Acc223Param(NamedTuple): - ucich: Any = None fkind: Any = None @@ -2818,7 +2809,6 @@ def test_acc223(acc223param, monkeypatch, costs): class Acc224Param(NamedTuple): - fkind: Any = None dlscal: Any = None @@ -2972,7 +2962,6 @@ def test_acc224(acc224param, monkeypatch, costs): class Acc2251Param(NamedTuple): - uctfsw: Any = None fkind: Any = None @@ -3174,7 +3163,6 @@ def test_acc2251(acc2251param, monkeypatch, costs): class Acc2252Param(NamedTuple): - ucpfcb: Any = None ucpfbk: Any = None @@ -3376,7 +3364,6 @@ def test_acc2252(acc2252param, monkeypatch, costs): class Acc2253Param(NamedTuple): - ucblss: Any = None fkind: Any = None @@ -3476,7 +3463,6 @@ def test_acc2253(acc2253param, monkeypatch, costs): class Acc226Param(NamedTuple): - c226: Any = None c2261: Any = None @@ -3540,7 +3526,6 @@ def test_acc226(acc226param, monkeypatch, costs): class Acc2261Param(NamedTuple): - uchts: Any = None lsa: Any = None @@ -3676,7 +3661,6 @@ def test_acc2261_rut(acc2261param, monkeypatch, costs): class Acc2262Param(NamedTuple): - lsa: Any = None fkind: Any = None @@ -3806,7 +3790,6 @@ def test_acc2262_rut(acc2262param, monkeypatch, costs): class Acc2263Param(NamedTuple): - uccry: Any = None lsa: Any = None @@ -3888,7 +3871,6 @@ def test_acc2263_rut(acc2263param, monkeypatch, costs): class Acc227Param(NamedTuple): - c227: Any = None c2271: Any = None @@ -3958,7 +3940,6 @@ def test_acc227(acc227param, monkeypatch, costs): class Acc2271Param(NamedTuple): - ucf1: Any = None fkind: Any = None @@ -4022,7 +4003,6 @@ def test_acc2271_rut(acc2271param, monkeypatch, costs): class Acc2272Param(NamedTuple): - fkind: Any = None fburn: Any = None @@ -4134,7 +4114,6 @@ def test_acc2272_rut(acc2272param, monkeypatch, costs): class Acc2273Param(NamedTuple): - wsvol: Any = None volrci: Any = None @@ -4210,7 +4189,6 @@ def test_acc2273_rut(acc2273param, monkeypatch, costs): class Acc2274Param(NamedTuple): - wsvol: Any = None volrci: Any = None @@ -4280,7 +4258,6 @@ def test_acc2274_rut(acc2274param, monkeypatch, costs): class Acc228Param(NamedTuple): - uciac: Any = None fkind: Any = None @@ -4338,7 +4315,6 @@ def test_acc228_rut(acc228param, monkeypatch, costs): class Acc229Param(NamedTuple): - ucme: Any = None fkind: Any = None @@ -4396,7 +4372,6 @@ def test_acc229_rut(acc229param, monkeypatch, costs): class Acc23Param(NamedTuple): - ucturb: Any = None ireactor: Any = None @@ -4464,7 +4439,6 @@ def test_acc23_rut(acc23param, monkeypatch, costs): class Acc24Param(NamedTuple): - c24: Any = None c241: Any = None @@ -4534,7 +4508,6 @@ def test_acc24(acc24param, monkeypatch, costs): class Acc241Param(NamedTuple): - lsa: Any = None c24: Any = None @@ -4586,7 +4559,6 @@ def test_acc241_rut(acc241param, monkeypatch, costs): class Acc242Param(NamedTuple): - lsa: Any = None pacpmw: Any = None @@ -4656,7 +4628,6 @@ def test_acc242_rut(acc242param, monkeypatch, costs): class Acc243Param(NamedTuple): - lsa: Any = None tlvpmw: Any = None @@ -4714,7 +4685,6 @@ def test_acc243_rut(acc243param, monkeypatch, costs): class Acc244Param(NamedTuple): - lsa: Any = None c24: Any = None @@ -4766,7 +4736,6 @@ def test_acc244_rut(acc244param, monkeypatch, costs): class Acc245Param(NamedTuple): - lsa: Any = None c24: Any = None @@ -4818,7 +4787,6 @@ def test_acc245_rut(acc245param, monkeypatch, costs): class Acc25Param(NamedTuple): - ucmisc: Any = None lsa: Any = None @@ -4870,7 +4838,6 @@ def test_acc25_rut(acc25param, monkeypatch, costs): class Acc26Param(NamedTuple): - ireactor: Any = None uchrs: Any = None @@ -4958,7 +4925,6 @@ def test_acc26_rut(acc26param, monkeypatch, costs): class Acc9Param(NamedTuple): - fcontng: Any = None lsa: Any = None @@ -5062,7 +5028,6 @@ def test_acc9_rut(acc9param, monkeypatch, costs): class Acc2253Param(NamedTuple): - ucblss: Any = None fkind: Any = None @@ -5162,7 +5127,6 @@ def test_acc2253_urt(acc2253param, monkeypatch, costs, initialise_error_module): class CoelcParam(NamedTuple): - fcdfuel: Any = None uche3: Any = None @@ -5249,8 +5213,6 @@ class CoelcParam(NamedTuple): tburn: Any = None - iprint: Any = None - outfile: Any = None expected_coeoam: Any = None @@ -5341,7 +5303,6 @@ class CoelcParam(NamedTuple): fhe3=0, tcycle=10864.426139387357, tburn=0, - iprint=0, outfile=11, expected_coeoam=4.4099029328740929e20, expected_coecap=4.9891775218979061e21, @@ -5422,7 +5383,6 @@ class CoelcParam(NamedTuple): fhe3=0, tcycle=864.42613938735622, tburn=10230.533336387549, - iprint=0, outfile=11, expected_coeoam=1.2419424614419636, expected_coecap=15.547404530833255, @@ -5532,7 +5492,7 @@ def test_coelc(coelcparam, monkeypatch, costs): monkeypatch.setattr(times_variables, "tburn", coelcparam.tburn) - costs.coelc(iprint=coelcparam.iprint) + costs.coelc() assert cost_variables.coeoam == pytest.approx(coelcparam.expected_coeoam) diff --git a/tests/unit/test_costs_2015.py b/tests/unit/test_costs_2015.py index 0c4235e5d..9934b9466 100644 --- a/tests/unit/test_costs_2015.py +++ b/tests/unit/test_costs_2015.py @@ -1,4 +1,5 @@ """Unit tests for costs_2015.f90.""" + import pytest import numpy from typing import NamedTuple, Any @@ -26,7 +27,6 @@ def costs2015(): class CalcBuildingCostsParam(NamedTuple): - pwpnb: Any = None pfrmax: Any = None @@ -2359,7 +2359,6 @@ def test_calc_building_costs(calcbuildingcostsparam, monkeypatch, costs2015): class CalcLandCostsParam(NamedTuple): - dr_tf_inner_bore: Any = None dh_tf_inner_bore: Any = None @@ -4631,7 +4630,6 @@ def test_calc_land_costs(calclandcostsparam, monkeypatch, costs2015): class CalcTfCoilCostsParam(NamedTuple): - n_tf: Any = None tfleng: Any = None @@ -6907,7 +6905,6 @@ def test_calc_tf_coil_costs(calctfcoilcostsparam, monkeypatch, costs2015): class CalcRemoteHandlingCostsParam(NamedTuple): - armour_fw_bl_mass: Any = None cost_factor_rh: Any = None @@ -6916,8 +6913,6 @@ class CalcRemoteHandlingCostsParam(NamedTuple): num_rh_systems: Any = None - ip: Any = None - s_kref: Any = None s_k: Any = None @@ -6947,7 +6942,6 @@ class CalcRemoteHandlingCostsParam(NamedTuple): cost_factor_rh=1, costexp=0.80000000000000004, num_rh_systems=4, - ip=0, s_kref=numpy.array( numpy.array( ( @@ -8034,7 +8028,6 @@ class CalcRemoteHandlingCostsParam(NamedTuple): cost_factor_rh=1, costexp=0.80000000000000004, num_rh_systems=4, - ip=0, s_kref=numpy.array( numpy.array( ( @@ -9149,8 +9142,6 @@ def test_calc_remote_handling_costs( cost_variables, "num_rh_systems", calcremotehandlingcostsparam.num_rh_systems ) - monkeypatch.setattr(costs2015, "ip", calcremotehandlingcostsparam.ip) - monkeypatch.setattr(costs2015, "s_kref", calcremotehandlingcostsparam.s_kref) monkeypatch.setattr(costs2015, "s_k", calcremotehandlingcostsparam.s_k) @@ -9185,7 +9176,6 @@ def test_calc_remote_handling_costs( class CalcNPlantAndVvCostsParam(NamedTuple): - rsldo: Any = None d_vv_out: Any = None @@ -11451,7 +11441,6 @@ def test_calc_n_plant_and_vv_costs(calcnplantandvvcostsparam, monkeypatch, costs class CalcEnergyConversionSystemParam(NamedTuple): - pgrossmw: Any = None cost_factor_bop: Any = None @@ -13719,7 +13708,6 @@ def test_calc_energy_conversion_system( class CalcRemainingSubsystemsParam(NamedTuple): - pinjmw: Any = None pdivt: Any = None @@ -13748,8 +13736,6 @@ class CalcRemainingSubsystemsParam(NamedTuple): costexp: Any = None - ip: Any = None - s_kref: Any = None s_k: Any = None @@ -13789,7 +13775,6 @@ class CalcRemainingSubsystemsParam(NamedTuple): zdewex=15.118436894660423, cost_factor_misc=1, costexp=0.80000000000000004, - ip=0, s_kref=numpy.array( numpy.array( ( @@ -14886,7 +14871,6 @@ class CalcRemainingSubsystemsParam(NamedTuple): zdewex=15.165858901796364, cost_factor_misc=1, costexp=0.80000000000000004, - ip=0, s_kref=numpy.array( numpy.array( ( @@ -16033,8 +16017,6 @@ def test_calc_remaining_subsystems( monkeypatch.setattr(cost_variables, "costexp", calcremainingsubsystemsparam.costexp) - monkeypatch.setattr(costs2015, "ip", calcremainingsubsystemsparam.ip) - monkeypatch.setattr(costs2015, "s_kref", calcremainingsubsystemsparam.s_kref) monkeypatch.setattr(costs2015, "s_k", calcremainingsubsystemsparam.s_k) @@ -16069,7 +16051,6 @@ def test_calc_remaining_subsystems( class ValueFunctionParam(NamedTuple): - x: Any = None expected_v: Any = None