#NEWLINE# def plot_primary_drainage_curve( self , pore_volume = 'volume' , throat_volume = 'volume' , pore_label = 'all' , throat_label = 'all' ) : #NEWLINE# #INDENT# '\n        Plot the primary drainage curve as the capillary pressure on ordinate\n        and total saturation of the wetting phase on the abscissa.\n        This is the preffered style in the petroleum engineering\n        ' #NEWLINE# try : #NEWLINE# #INDENT# PcPoints = sp . unique ( self [ 'pore.inv_Pc' ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# raise Exception ( 'Cannot print drainage curve: ordinary percolation                             simulation has not been run' ) #NEWLINE# #UNINDENT# pores = self . _net . pores ( labels = pore_label ) #NEWLINE# throats = self . _net . throats ( labels = throat_label ) #NEWLINE# p_inv = self [ 'pore.inv_Pc' ] #NEWLINE# t_inv = self [ 'throat.inv_Pc' ] #NEWLINE# Snwp_t = sp . zeros_like ( PcPoints ) #NEWLINE# Snwp_p = sp . zeros_like ( PcPoints ) #NEWLINE# Snwp_all = sp . zeros_like ( PcPoints ) #NEWLINE# Swp_all = sp . zeros_like ( PcPoints ) #NEWLINE# Pvol = self . _net [ ( 'pore.' + pore_volume ) ] #NEWLINE# Tvol = self . _net [ ( 'throat.' + throat_volume ) ] #NEWLINE# Pvol_tot = sp . sum ( Pvol ) #NEWLINE# Tvol_tot = sp . sum ( Tvol ) #NEWLINE# for i in range ( 0 , sp . size ( PcPoints ) ) : #NEWLINE# #INDENT# Pc = PcPoints [ i ] #NEWLINE# Snwp_p [ i ] = ( sp . sum ( Pvol [ ( p_inv [ pores ] <= Pc ) ] ) / Pvol_tot ) #NEWLINE# Snwp_t [ i ] = ( sp . sum ( Tvol [ ( t_inv [ throats ] <= Pc ) ] ) / Tvol_tot ) #NEWLINE# Snwp_all [ i ] = ( ( sp . sum ( Tvol [ ( t_inv [ throats ] <= Pc ) ] ) + sp . sum ( Pvol [ ( p_inv [ pores ] <= Pc ) ] ) ) / ( Tvol_tot + Pvol_tot ) ) #NEWLINE# Swp_all [ i ] = ( 1 - Snwp_all [ i ] ) #NEWLINE# #UNINDENT# fig = plt . figure ( ) #NEWLINE# plt . plot ( Swp_all , PcPoints , 'k.-' ) #NEWLINE# plt . xlim ( xmin = 0 ) #NEWLINE# plt . xlabel ( 'Saturation of wetting phase' ) #NEWLINE# plt . ylabel ( 'Capillary Pressure [Pa]' ) #NEWLINE# plt . title ( 'Primay Drainage Curve' ) #NEWLINE# plt . grid ( True ) #NEWLINE# return fig