diff --git a/samples/python/reactors/mix1.py b/samples/python/reactors/mix1.py index 9cc2ad97e3b..bc2bb79d25f 100644 --- a/samples/python/reactors/mix1.py +++ b/samples/python/reactors/mix1.py @@ -62,12 +62,12 @@ # Create two mass flow controllers connecting the upstream reservoirs to the # mixer, and set their mass flow rates to values corresponding to # stoichiometric combustion. -mfc1 = ct.MassFlowController(res_a, mixer, mdot=rho_a*2.5/0.21) -mfc2 = ct.MassFlowController(res_b, mixer, mdot=rho_b*1.0) +mfc1 = ct.MassFlowController(res_a, mixer, mdot=rho_a*2.5/0.21, name="Air inlet") +mfc2 = ct.MassFlowController(res_b, mixer, mdot=rho_b*1.0, name="Fuel inlet") # %% # Connect the mixer to the downstream reservoir with a valve. -outlet = ct.Valve(mixer, downstream, K=10.0) +outlet = ct.Valve(mixer, downstream, K=10.0, name="Valve") sim = ct.ReactorNet([mixer]) @@ -84,4 +84,8 @@ # %% # Show the network structure # -------------------------- -diagram = sim.draw(print_state=True, species="X") +try: + diagram = sim.draw(print_state=True, species="X") + diagram.view("mix1.gv") +except ImportError as err: + print(f"Unable to show network structure:\n{err}") diff --git a/samples/python/reactors/reactor2.py b/samples/python/reactors/reactor2.py index 56bd26c236d..72d8c7b18ec 100644 --- a/samples/python/reactors/reactor2.py +++ b/samples/python/reactors/reactor2.py @@ -57,12 +57,12 @@ # conduct heat # add a flexible wall (a piston) between r2 and r1 -w = ct.Wall(r2, r1, A=1.0, K=0.5e-4, U=100.0) +w = ct.Wall(r2, r1, A=1.0, K=0.5e-4, U=100.0, name="Piston") # heat loss to the environment. Heat loss always occur through walls, so we # create a wall separating r2 from the environment, give it a non-zero area, # and specify the overall heat transfer coefficient through the wall. -w2 = ct.Wall(r2, env, A=1.0, U=500.0) +w2 = ct.Wall(r2, env, A=1.0, U=500.0, name="External Wall") sim = ct.ReactorNet([r1, r2]) @@ -118,4 +118,8 @@ # %% # Show the final state # -------------------- -sim.draw(print_state=True, species="X") +try: + diagram = sim.draw(print_state=True, species="X") + diagram.view("reactor2.gv") +except ImportError as err: + print(f"Unable to show network structure:\n{err}")