Skip to content

Commit e29103e

Browse files
committed
Merge branch 'sensitivity_analysis' into modifs-pp-rem
2 parents 7258384 + 8e727de commit e29103e

1 file changed

Lines changed: 53 additions & 27 deletions

File tree

src/sparging/inputs.py

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from dataclasses import dataclass
2+
from dataclasses import dataclass, replace
33
from sparging.correlations import Correlation, all_correlations
44
import pint
55
from typing import List
@@ -29,6 +29,9 @@ def tank_diameter(self):
2929
def tank_volume(self):
3030
return self.area * self.height
3131

32+
def copy(self):
33+
return replace(self)
34+
3235

3336
@dataclass
3437
class BreederMaterial:
@@ -39,6 +42,9 @@ class BreederMaterial:
3942
viscosity: pint.Quantity | Correlation | None = None
4043
surface_tension: pint.Quantity | Correlation | None = None
4144

45+
def copy(self):
46+
return replace(self)
47+
4248

4349
@dataclass
4450
class OperatingParameters:
@@ -53,6 +59,9 @@ class OperatingParameters:
5359
n_gen_rate: pint.Quantity | None = None
5460
Q_T: pint.Quantity | None = None
5561

62+
def copy(self):
63+
return replace(self)
64+
5665

5766
@dataclass
5867
class SpargingParameters:
@@ -65,6 +74,9 @@ class SpargingParameters:
6574
E_l: pint.Quantity | Correlation | None = None
6675
a: pint.Quantity | Correlation | None = None
6776

77+
def copy(self):
78+
return replace(self)
79+
6880

6981
@dataclass # should it not be a normal class ? (init method)s
7082
class SimulationInput:
@@ -184,6 +196,9 @@ def __str__(self):
184196
]
185197
)
186198

199+
def copy(self):
200+
return replace(self)
201+
187202

188203
def find_in_graph(
189204
required_node: str,
@@ -395,34 +410,45 @@ def get_sim_input_standard() -> SimulationInput:
395410
librapi_input_dict = MappingProxyType(_librapi_input_dict) # make it immutable
396411

397412

398-
def get_sim_input(input_dict: dict) -> SimulationInput:
399-
"""Returns the SimulationInput for the given input dictionary"""
400-
geom = ColumnGeometry(
401-
area=input_dict["area"],
402-
height=input_dict["height"],
403-
nozzle_diameter=input_dict["nozzle_diameter"],
404-
nb_nozzle=input_dict["nb_nozzle"],
405-
)
413+
# NOTE potentially we could make sure it's immutable with something like this
414+
# class PresetInputs:
415+
# def __init__(self, name: str):
416+
# self.name = name
406417

407-
material = BreederMaterial(
408-
name=input_dict["material"],
409-
)
410418

411-
operating_params = OperatingParameters(
412-
temperature=input_dict["temperature"],
413-
P_top=input_dict["P_top"],
414-
flow_g_mol=input_dict["flow_g_mol"],
415-
tbr=input_dict["tbr"],
416-
n_gen_rate=input_dict["n_gen_rate"],
417-
)
419+
# class LIBRA_Pi_Input(PresetInputs):
420+
# @property
421+
# def geometry(self):
422+
# return ColumnGeometry(
423+
# area=0.2 * ureg.m**2, # 1/4 * pi * (0.5m)^2
424+
# height=1 * ureg.m,
425+
# nozzle_diameter=1.4 * ureg.mm,
426+
# nb_nozzle=5 * ureg.dimensionless,
427+
# )
418428

419-
sparging_params = SpargingParameters(
420-
h_l=all_correlations("h_l_briggs"),
421-
)
422429

423-
my_input = SimulationInput.from_parameters(
424-
geom, material, operating_params, sparging_params
425-
)
426-
logger.info(my_input)
430+
# new_geometry = LIBRA_Pi_Input.geometry
427431

428-
return my_input
432+
433+
LIBRA_PI_GEOM = ColumnGeometry(
434+
area=_librapi_input_dict["area"],
435+
height=_librapi_input_dict["height"],
436+
nozzle_diameter=_librapi_input_dict["nozzle_diameter"],
437+
nb_nozzle=_librapi_input_dict["nb_nozzle"],
438+
)
439+
440+
LIBRA_PI_MAT = BreederMaterial(
441+
name=_librapi_input_dict["material"],
442+
)
443+
444+
LIBRA_PI_OPERATING_PARAMS = OperatingParameters(
445+
temperature=_librapi_input_dict["temperature"],
446+
P_top=_librapi_input_dict["P_top"],
447+
flow_g_mol=_librapi_input_dict["flow_g_mol"],
448+
tbr=_librapi_input_dict["tbr"],
449+
n_gen_rate=_librapi_input_dict["n_gen_rate"],
450+
)
451+
452+
LIBRA_PI_SPARGING_PARAMS = SpargingParameters(
453+
h_l=all_correlations("h_l_briggs"),
454+
)

0 commit comments

Comments
 (0)