Commit 73c153ea authored by Salko Jr, Robert's avatar Salko Jr, Robert
Browse files

Condense some plotting scripts to reduce code duplication

parent 67dbf35b
Loading
Loading
Loading
Loading
+18 −64
Original line number Diff line number Diff line
@@ -322,76 +322,30 @@ class PlotTools(object):
          labels.append("ch {:4d}".format(c))
       me._plotAxial(voids, zs, plotYLabel, figname, labels, location)

   def plotChAxialVoid(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of void for a channel
   def plotChAxial(me, field, state=None, ch=None, figname=None):
       """ Makes an axial plot of channel data

       Args:
          field (str): The name of the data to plot.  Select from the following---'massflux' for total,
             massflux, 'temp' for liquid temperature, 'eq_quality' for equilibrium quality, 'drop_velocity'
             for droplet axial velocity, 'vap_velocity' for vapor axial velocity, 'liq_velocity' for liquid
             axial velocity, or 'void' for vapor void.
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('chan_void_vap', "Void [-]", state, ch, figname)

   def plotChAxialVliq(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of liquid velocity for a channel

       Args:
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('chan_velocity_liq', "Velocity [m/s]", state, ch, figname)

   def plotChAxialVvap(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of vapor velocity for a channel

       Args:
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('chan_velocity_vap', "Velocity [m/s]", state, ch, figname)

   def plotChAxialVdrp(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of droplet velocity for a channel

       Args:
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('chan_velocity_drp', "Velocity [m/s]", state, ch, figname)

   def plotChAxialQuality(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of equilibrium quality for a channel

       Args:
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('chan_equilibrium_quality', "Quality [-]", state, ch, figname)

   def plotChAxialTemperature(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of temperature for a channel

       Args:
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('chan_temp', "Temperature [C]", state, ch, figname)

   def plotChAxial(me, state=None, ch=None, figname=None):
       """ Makes an axial plot of equilibrium quality for a channel

       Args:
          state (int): State number to plot (1-based).  If not present, selects state with maximum.
          ch (int): Chan number to plot (1-based). If not present, selects chan with maximum.
          figname (str): Name of the figure.
       """
       me._chanPlotMaxWrapper('massflux_tot', "Mass flux [kg/m**2/s]", state, ch, figname)

       chData = {'massflux': ['massflux_tot', 'Mass flux [kg/m**2/s]'],
                 'temp': ['chan_temp', 'Temperature [C]'],
                 'eq_quality': ['chan_equilibrium_quality', 'Quality [-]'],
                 'drop_velocity': ['chan_velocity_drp', 'Velocity [m/s]'],
                 'vap_velocity': ['chan_velocity_vap', 'Velocity [m/s]'],
                 'liq_velocity': ['chan_velocity_liq', 'Velocity [m/s]'],
                 'void': ['chan_void_vap', 'Void [-]']
                 }
       if field in chData:
          me._chanPlotMaxWrapper(chData[field][0], chData[field][1], state, ch, figname)
       else:
          raise RuntimeError("Selected dataset: {:s} is not a valid field name".format(field))

   def plotPinCoupling(me, pin, dataset, state=None, figname=None, axialBounds=None, minData=None, maxData=None):
      """ Makes a contour plot of rod surface data
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ def main():

   plotter = PlotTools(args.h5name)

   plotter.plotChAxialQuality(args.state, args.ch, args.figname)
   plotter.plotChAxial('eq_quality', args.state, args.ch, args.figname)

if __name__=='__main__':
   main()
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ def main():

   plotter = PlotTools(args.h5name)

   plotter.plotChAxialTemperature(args.state, args.ch, args.figname)
   plotter.plotChAxial('temp', args.state, args.ch, args.figname)

if __name__=='__main__':
   main()
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ def main():

   plotter = PlotTools(args.h5name)

   plotter.plotChAxialVdrp(args.state, args.ch, args.figname)
   plotter.plotChAxial('drop_velocity', args.state, args.ch, args.figname)

if __name__=='__main__':
   main()
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ def main():

   plotter = PlotTools(args.h5name)

   plotter.plotChAxialVliq(args.state, args.ch, args.figname)
   plotter.plotChAxial('liq_velocity', args.state, args.ch, args.figname)

if __name__=='__main__':
   main()
Loading