@@ -468,6 +468,44 @@ def draw_prim(self, gp, ivar):
468
468
if not isinstance (self .q_parabola [ivar ], HSEPPMInterpolant ):
469
469
self .q_parabola [ivar ].mark_cubic (gp )
470
470
471
+ def draw_waves (self , gp ):
472
+ """Draw the domains seen by each of the 3 characteristic waves
473
+ and the interface they interact with
474
+
475
+ Parameters
476
+ ----------
477
+ gp : GridPlot
478
+ the grid plot object for the figure
479
+ """
480
+
481
+ ilo = max (gp .lo_index , self .grid .lo - 1 )
482
+ ihi = min (gp .hi_index , self .grid .hi + 1 )
483
+
484
+ q = self .cons_to_prim ()
485
+ cs = np .sqrt (self .gamma * q [:, self .v .qp ] / q [:, self .v .qrho ])
486
+
487
+ for n in range (ilo , ihi + 1 ):
488
+ u = q [n , self .v .qu ]
489
+ evals = np .array ([u - cs [n ], u , u + cs [n ]])
490
+ colors = ["C4" , "C9" , "C8" ]
491
+ for iwave , ev in enumerate (evals ):
492
+ if ev > 0 :
493
+ # reaches the right side of the zone
494
+ gp .ax .fill ([self .grid .xr [n ] - ev * self .dt ,
495
+ self .grid .xr [n ],
496
+ self .grid .xr [n ],
497
+ self .grid .xr [n ] - ev * self .dt ],
498
+ [0.0 , 1.0 , 0.0 , 0.0 ],
499
+ color = colors [iwave ], alpha = 0.33 )
500
+ elif ev < 0 :
501
+ # reaches the left side of the zone
502
+ gp .ax .fill ([self .grid .xl [n ],
503
+ self .grid .xl [n ] + np .abs (ev ) * self .dt ,
504
+ self .grid .xl [n ],
505
+ self .grid .xl [n ]],
506
+ [1.0 , 0.0 , 0.0 , 1.0 ],
507
+ color = colors [iwave ], alpha = 0.25 )
508
+
471
509
def plot_prim (self , * , ivar = None ):
472
510
"""Plot the primitive variable(s) for the current solution.
473
511
@@ -489,7 +527,7 @@ def plot_prim(self, *, ivar=None):
489
527
fig = plt .figure ()
490
528
ax = fig .add_subplot ()
491
529
ax .plot (self .grid .x [self .grid .lo :self .grid .hi + 1 ],
492
- q [self .grid .lo :self .grid .hi + 1 , ivar ])
530
+ q [self .grid .lo :self .grid .hi + 1 , ivar ], lw = 2 )
493
531
ax .grid (color = "0.5" , linestyle = ":" )
494
532
ax .set_xlabel ("x" )
495
533
ax .set_ylabel (self .v .prim_names [ivar ])
@@ -498,7 +536,7 @@ def plot_prim(self, *, ivar=None):
498
536
fig , ax = plt .subplots (self .v .nvar , 1 , sharex = True )
499
537
for idx in range (self .v .nvar ):
500
538
ax [idx ].plot (self .grid .x [self .grid .lo :self .grid .hi + 1 ],
501
- q [self .grid .lo :self .grid .hi + 1 , idx ])
539
+ q [self .grid .lo :self .grid .hi + 1 , idx ], lw = 2 )
502
540
ax [idx ].grid (color = "0.5" , linestyle = ":" )
503
541
if idx == self .v .nvar - 1 :
504
542
ax [idx ].set_xlabel ("x" )
0 commit comments