mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
adjust wall velocity representation
Requires graphviz >= 9.0
This commit is contained in:
parent
c6b2d04ca8
commit
04df9f404c
@ -397,6 +397,7 @@ def draw_connections(connections, dot=None, graph_attr=None, node_attr=None, edg
|
||||
# id to ensure that wall velocity and heat flow arrows align
|
||||
samehead = sametail = r_in_name + "-" + r_out_name
|
||||
# display wall velocity as arrow indicating the wall's movement
|
||||
v = 0
|
||||
try:
|
||||
if c.velocity != 0 and show_wall_velocity:
|
||||
if c.velocity > 0:
|
||||
@ -407,10 +408,8 @@ def draw_connections(connections, dot=None, graph_attr=None, node_attr=None, edg
|
||||
inflow_name, outflow_name = r_out_name, r_in_name
|
||||
|
||||
dot.edge(inflow_name, outflow_name,
|
||||
**{"arrowtail": "teecrow", "dir": "back",
|
||||
"arrowsize": "1.5", "penwidth": "0", "weight": "2",
|
||||
"samehead": samehead, "sametail": sametail,
|
||||
"taillabel": f"wall velocity = {v:.2g} m/s",
|
||||
**{"arrowtail": "icurveteecurve", "dir": "both", "style": "dotted",
|
||||
"arrowhead": "icurveteecurve", "label": f"wall vel. = {v:.2g} m/s",
|
||||
**(wall_edge_attr or {})})
|
||||
except AttributeError:
|
||||
pass
|
||||
@ -421,11 +420,13 @@ def draw_connections(connections, dot=None, graph_attr=None, node_attr=None, edg
|
||||
- sum(getattr(c, rate_attr) for c in inv_duplicates))
|
||||
|
||||
# ensure arrow always indicates a positive flow
|
||||
if rate >= 0:
|
||||
if rate > 0:
|
||||
inflow_name, outflow_name = r_in_name, r_out_name
|
||||
else:
|
||||
elif rate < 0:
|
||||
inflow_name, outflow_name = r_out_name, r_in_name
|
||||
rate *= -1
|
||||
elif v > 0:
|
||||
return dot
|
||||
|
||||
if rate_attr == "mass_flow_rate":
|
||||
label = f"m = {rate:.2g} kg/s"
|
||||
|
@ -960,10 +960,9 @@ class TestReactor(utilities.CanteraTest):
|
||||
self.r2.name = "Name 2"
|
||||
w = ct.Wall(self.r1, self.r2, U=0.1, velocity=1)
|
||||
dot = w.draw()
|
||||
expected = [('\t"Name 1" -> "Name 2" [arrowsize=1.5 arrowtail=teecrow '
|
||||
'dir=back penwidth=0 samehead="Name 1-Name 2" '
|
||||
'sametail="Name 1-Name 2" '
|
||||
'taillabel="wall velocity = 1 m/s" weight=2]\n'),
|
||||
expected = [('\t"Name 1" -> "Name 2" [label="wall vel. = 1 m/s" '
|
||||
'arrowhead=icurveteecurve arrowtail=icurveteecurve '
|
||||
'dir=both style=dotted]\n'),
|
||||
('\t"Name 2" -> "Name 1" [label="q = 30 W" '
|
||||
'color=red samehead="Name 1-Name 2" '
|
||||
'sametail="Name 1-Name 2" style=dashed]\n')]
|
||||
|
Loading…
Reference in New Issue
Block a user