1111from scipy .optimize import root_scalar
1212import scipy .constants as const
1313import pathsim
14+ from pathsim .utils .register import Register
1415
1516# --- Physical Constants ---
1617g = const .g # m/s^2, Gravitational acceleration
@@ -248,11 +249,10 @@ def _process_results(solution, params, phys_props, dim_params):
248249 y_T2_in = params ["y_T2_in" ]
249250
250251 ########### Debugging ##########
251- print ("c_T_in: " ,c_T_in )
252+ print ("c_T_in: " , c_T_in )
252253 print ("y_T2_in :" , y_T2_in )
253- print ("flow_l: " ,params ["flow_l" ])
254- print ("flow_g: " ,params ["flow_g" ])
255-
254+ print ("flow_l: " , params ["flow_l" ])
255+ print ("flow_g: " , params ["flow_g" ])
256256
257257 if not solution .success :
258258 raise RuntimeError ("BVP solver failed to converge." )
@@ -364,24 +364,6 @@ class GLC(pathsim.blocks.Function):
364364 BCs: Boundary conditions type, "C-C" (Closed-Closed) or "O-C" (Open-Closed), default is "C-C"
365365 """
366366
367- _port_map_in = {
368- "c_T_in" : 0 ,
369- "flow_l" :1 ,
370- "y_T2_in" : 2 ,
371- "flow_g" :3 ,
372- }
373-
374- _port_map_out = {
375- "c_T_out" : 0 ,
376- "y_T2_out" : 1 ,
377- "eff" : 2 ,
378- "P_out" : 3 ,
379- "Q_l" : 4 ,
380- "Q_g_out" : 5 ,
381- "n_T_out_liquid" : 6 ,
382- "n_T_out_gas" : 7 ,
383- }
384-
385367 def __init__ (
386368 self ,
387369 P_in ,
@@ -401,6 +383,28 @@ def __init__(
401383 "elements" : initial_nb_of_elements ,
402384 "BCs" : BCs ,
403385 }
386+ self .intputs = Register (
387+ size = 4 ,
388+ mapping = {
389+ "c_T_in" : 0 ,
390+ "flow_l" : 1 ,
391+ "y_T2_inlet" : 2 ,
392+ "flow_g" : 3 ,
393+ },
394+ )
395+ self .outputs = Register (
396+ size = 8 ,
397+ mapping = {
398+ "c_T_out" : 0 ,
399+ "y_T2_out" : 1 ,
400+ "eff" : 2 ,
401+ "P_out" : 3 ,
402+ "Q_l" : 4 ,
403+ "Q_g_out" : 5 ,
404+ "n_T_out_liquid" : 6 ,
405+ "n_T_out_gas" : 7 ,
406+ },
407+ )
404408 super ().__init__ (func = self .func )
405409
406410 def func (self , c_T_in , flow_l , y_T2_inlet , flow_g ):
@@ -410,7 +414,6 @@ def func(self, c_T_in, flow_l, y_T2_inlet, flow_g):
410414 new_params ["y_T2_in" ] = y_T2_inlet
411415 new_params ["flow_g" ] = flow_g
412416
413-
414417 res , _ = solve (new_params )
415418
416419 c_T_out = res ["c_T_outlet [mol/m^3]" ]
0 commit comments