Skip to content

Commit 6d7a7da

Browse files
committed
renamed Vdot_g0 and ndot_g0
1 parent 349633e commit 6d7a7da

5 files changed

Lines changed: 31 additions & 32 deletions

File tree

examples/sparging_standard.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
# P = output.exported_fields["pressure"]
5050
# plt.plot(output.x_ct, P)
5151
# output.exports_to_csv(FOLDER)
52+
output.export = ["pressure, "]
5253

5354
output.profiles_to_csv(FOLDER)
5455
output.profiles_to_cdf(FOLDER)

src/sparging/correlations.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CorrelationType(enum.Enum): # TODO do we really use it ?
3232
BUBBLE_VELOCITY = "v_g0"
3333
GAS_PHASE_DISPERSION = "E_g"
3434
LIQUID_PHASE_DISPERSION = "E_l"
35-
FLOW_RATE = "flow_g_mol"
35+
FLOW_RATE = "ndot_g0"
3636
INTERFACIAL_AREA = "a"
3737
TRITIUM_SOURCE = "source_T"
3838
LIQUID_PRESSURE_PROFILE = "P_l"
@@ -235,8 +235,8 @@ def get_list(self, corr_type: CorrelationType) -> list[Correlation]:
235235

236236
d_b0 = Correlation(
237237
identifier="d_b0",
238-
function=lambda flow_g_vol, nozzle_diameter, nb_nozzle: get_d_b0(
239-
flow_g_vol=flow_g_vol, nozzle_diameter=nozzle_diameter, nb_nozzle=nb_nozzle
238+
function=lambda Vdot_g0, nozzle_diameter, nb_nozzle: get_d_b0(
239+
Vdot_g0=Vdot_g0, nozzle_diameter=nozzle_diameter, nb_nozzle=nb_nozzle
240240
), # mean bubble diameter, Kanai 2017
241241
corr_type=CorrelationType.BUBBLE_DIAMETER,
242242
input_units=["m**3/s", "m", "dimensionless"],
@@ -311,7 +311,7 @@ def get_list(self, corr_type: CorrelationType) -> list[Correlation]:
311311
# superficial gas velocity at the inlet
312312
u_g0 = Correlation(
313313
identifier="u_g0",
314-
function=lambda flow_g_vol, area: (flow_g_vol / area).to("m/s"),
314+
function=lambda Vdot_g0, area: (Vdot_g0 / area).to("m/s"),
315315
corr_type=CorrelationType.SUPERFICIAL_GAS_VELOCITY,
316316
input_units=["m^3/s", "m^2"],
317317
output_units="m/s",
@@ -412,17 +412,17 @@ def get_list(self, corr_type: CorrelationType) -> list[Correlation]:
412412
all_correlations.append(rho_g)
413413

414414

415-
flow_g_vol = Correlation(
416-
identifier="flow_g_vol",
417-
function=lambda flow_g_mol, temperature, P_l: (
418-
flow_g_mol * const_R * temperature / P_l(0 * ureg.m)
415+
Vdot_g0 = Correlation(
416+
identifier="Vdot_g0",
417+
function=lambda ndot_g0, temperature, P_l: (
418+
ndot_g0 * const_R * temperature / P_l(0 * ureg.m)
419419
), # convert molar flow rate to volumetric flow rate using ideal gas law
420420
corr_type=CorrelationType.FLOW_RATE,
421421
description="volumetric flow rate of gas phase calculated from molar flow rate using ideal gas law",
422422
input_units=["mol/s", "kelvin", PROFILE],
423423
output_units="m**3/s",
424424
)
425-
all_correlations.append(flow_g_vol)
425+
all_correlations.append(Vdot_g0)
426426

427427

428428
source_T_integral = Correlation(
@@ -438,12 +438,12 @@ def get_list(self, corr_type: CorrelationType) -> list[Correlation]:
438438

439439

440440
def get_d_b0(
441-
flow_g_vol: pint.Quantity, nozzle_diameter: pint.Quantity, nb_nozzle: pint.Quantity
441+
Vdot_g0: pint.Quantity, nozzle_diameter: pint.Quantity, nb_nozzle: pint.Quantity
442442
) -> float:
443443
"""
444444
mean bubble diameter [m], Kanai 2017 (reported by Evans 2026)
445445
"""
446-
nozzle_flow = flow_g_vol / nb_nozzle # volumetric flow per nozzle [m3/s]
446+
nozzle_flow = Vdot_g0 / nb_nozzle # volumetric flow per nozzle [m3/s]
447447
if nozzle_flow < ureg("3 cm**3/s") or nozzle_flow > ureg("10 cm**3/s"):
448448
warnings.warn(
449449
f"nozzle flow {nozzle_flow.to('cm**3/s')} is out of the validated range for the Kanai 2017 correlation (3-10 cm3/s)"
@@ -560,11 +560,11 @@ def get_h_briggs(Re: float, Sc: float, D_l: float, d_b: float) -> float:
560560

561561
eps_g = Profile(
562562
identifier="eps_g",
563-
function=lambda temperature, P_g, flow_g_mol, area, v_g0: (
563+
function=lambda temperature, P_g, ndot_g0, area, v_g0: (
564564
lambda z: get_eps_g(
565565
T=temperature,
566566
P_g=P_g(z),
567-
n_g_dot=flow_g_mol,
567+
n_g_dot=ndot_g0,
568568
area=area,
569569
v_g=v_g0,
570570
)

src/sparging/input_examples.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_sim_input_LIBRA1L() -> tuple[SimulationInput, pint.Quantity]:
3535
operating_params = OperatingParameters(
3636
temperature=600 * ureg.celsius,
3737
P_top=1 * ureg.atm,
38-
flow_g_mol=40 * ureg.sccm,
38+
ndot_g0=40 * ureg.sccm,
3939
tbr=2e-3 * ureg("triton / neutron"), # according to LIBRA 1L paper
4040
n_gen_rate=1e9 * ureg("neutron / s"),
4141
)
@@ -75,7 +75,7 @@ def get_sim_input_standard() -> SimulationInput:
7575
operating_params = OperatingParameters(
7676
temperature=600 * ureg.celsius,
7777
P_top=1 * ureg.atm,
78-
flow_g_mol=400 * ureg.sccm,
78+
ndot_g0=400 * ureg.sccm,
7979
tbr=0.1 * ureg("triton / neutron"),
8080
n_gen_rate=1e9 * ureg("neutron / s"),
8181
)
@@ -109,7 +109,7 @@ def get_sim_input_malara() -> SimulationInput:
109109
operating_params = OperatingParameters(
110110
temperature=623 * ureg.kelvin,
111111
P_top=5e5 * ureg.pascal,
112-
flow_g_mol=0.19 * ureg("mol / s"),
112+
ndot_g0=0.19 * ureg("mol / s"),
113113
tbr=0.1 * ureg("triton / neutron"),
114114
n_gen_rate=1e9 * ureg("neutron / s"),
115115
)
@@ -142,7 +142,7 @@ def get_sim_input_malara() -> SimulationInput:
142142
LIBRA_PI_OPERATING_PARAMS = OperatingParameters(
143143
temperature=550 * ureg.celsius,
144144
P_top=1.2 * ureg.atm,
145-
flow_g_mol=400 * ureg.sccm,
145+
ndot_g0=400 * ureg.sccm,
146146
tbr=0.1 * ureg("triton / neutron"),
147147
n_gen_rate=1e9 * ureg("neutron / s"),
148148
)

src/sparging/inputs.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ def copy(self):
4949
@dataclass
5050
class OperatingParameters:
5151
temperature: pint.Quantity
52-
flow_g_mol: pint.Quantity
52+
ndot_g0: pint.Quantity
5353
P_top: pint.Quantity
54-
flow_g_vol: pint.Quantity | None = None
54+
Vdot_g0: pint.Quantity | None = None
5555
P_bottom: pint.Quantity | Correlation | None = None
5656
tbr: pint.Quantity | None = None
5757
n_gen_rate: pint.Quantity | None = None
@@ -198,16 +198,14 @@ def get_Bo(self) -> pint.Quantity:
198198
"""
199199
# return (self.eps_g * self.u_g0 * self.height / self.E_g).to("dimensionless")
200200
return (
201-
(self.graph.nodes["flow_g_vol"]["value"] / self.area)
202-
* self.height
203-
/ self.E_g
201+
(self.graph.nodes["Vdot_g0"]["value"] / self.area) * self.height / self.E_g
204202
).to("dimensionless")
205203

206204
def test_eps_g(
207205
self,
208206
): # to see if the two definitions of superficial velocity are consistent -> TODO remove
209207
print(
210-
f"{self.eps_g_0 * self.graph.nodes['v_g0']['value']} vs {self.graph.nodes['flow_g_vol']['value'] / self.area} vs {self.graph.nodes['u_g0']['value']}"
208+
f"{self.eps_g_0 * self.graph.nodes['v_g0']['value']} vs {self.graph.nodes['Vdot_g0']['value'] / self.area} vs {self.graph.nodes['u_g0']['value']}"
211209
)
212210

213211
def __post_init__(self):

test/test_simulation_input.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
operating_params = OperatingParameters(
3434
temperature=600 * ureg.celsius,
3535
P_top=1 * ureg.atm,
36-
flow_g_mol=400 * ureg.sccm,
36+
ndot_g0=400 * ureg.sccm,
3737
tbr=0.1 * ureg("triton / neutron"),
3838
n_gen_rate=1e9 * ureg("neutron / s"),
3939
)
@@ -132,13 +132,13 @@ def test_find_in_graph_result(in_discovered: bool):
132132
Test finding a node in the graph.
133133
This test checks that the `find_in_graph` function can successfully find the `d_b` parameter
134134
using the provided `ColumnGeometry` and `OperatingParameters`. It also tests both cases where
135-
`flow_g_vol` is provided in the discovered nodes and where it is not, ensuring that the
135+
`Vdot_g0` is provided in the discovered nodes and where it is not, ensuring that the
136136
function can handle both scenarios correctly.
137137
"""
138138
# BUILD
139139
discovered_graph = nx.Graph()
140140
if in_discovered:
141-
discovered_graph.add_node("flow_g_vol", value=0.01 * ureg.m**3 / ureg.s)
141+
discovered_graph.add_node("Vdot_g0", value=0.01 * ureg.m**3 / ureg.s)
142142

143143
# RUN
144144
find_in_graph(
@@ -152,9 +152,9 @@ def test_find_in_graph_result(in_discovered: bool):
152152

153153
correlation = sparging.all_correlations("d_b")
154154

155-
flow_g_vol = discovered_graph.nodes["flow_g_vol"]["value"]
155+
Vdot_g0 = discovered_graph.nodes["Vdot_g0"]["value"]
156156
expected_value = correlation(
157-
flow_g_vol=flow_g_vol,
157+
Vdot_g0=Vdot_g0,
158158
nozzle_diameter=geom.nozzle_diameter,
159159
nb_nozzle=geom.nb_nozzle,
160160
)
@@ -164,7 +164,7 @@ def test_find_in_graph_result(in_discovered: bool):
164164
)
165165

166166

167-
@pytest.mark.parametrize("missing_param", ("nb_nozzle", "flow_g_mol", "n_gen_rate"))
167+
@pytest.mark.parametrize("missing_param", ("nb_nozzle", "ndot_g0", "n_gen_rate"))
168168
def test_find_in_graph_unresolvable(missing_param: str):
169169
"""
170170
Test that find_in_graph raises an error when a parameter cannot be resolved.
@@ -178,7 +178,7 @@ def test_find_in_graph_unresolvable(missing_param: str):
178178
case "nb_nozzle":
179179
to_find = "d_b"
180180
setattr(broken_geom, missing_param, None)
181-
case "flow_g_mol":
181+
case "ndot_g0":
182182
to_find = "d_b"
183183
setattr(broken_op_params, missing_param, None)
184184
case "n_gen_rate":
@@ -199,13 +199,13 @@ def test_find_in_graph_unresolvable(missing_param: str):
199199
)
200200

201201

202-
@pytest.mark.parametrize("required_node", ("flow_g_mol", "non_existent_param"))
202+
@pytest.mark.parametrize("required_node", ("ndot_g0", "non_existent_param"))
203203
def test_check_input_none(required_node: str):
204204
"""
205205
Test that check_input returns None when the required node is not found in the graph.
206206
"""
207207
# BUILD
208-
broken_op_params = dataclasses.replace(operating_params, flow_g_mol=None)
208+
broken_op_params = dataclasses.replace(operating_params, ndot_g0=None)
209209
# RUN
210210
result = check_input(required_node, [geom, broken_op_params])
211211
# TEST

0 commit comments

Comments
 (0)