[21283] | 1 | try:
|
---|
| 2 | import pylab as p
|
---|
| 3 | except ImportError:
|
---|
| 4 | print "could not import pylab, matplotlib has not been installed, no plotting capabilities enabled"
|
---|
| 5 |
|
---|
[21303] | 6 | import numpy as np
|
---|
[21283] | 7 | from processmesh import processmesh
|
---|
| 8 | from applyoptions import applyoptions
|
---|
| 9 | from plot_icefront import plot_icefront
|
---|
[21588] | 10 | from mpl_toolkits.mplot3d import Axes3D
|
---|
[21283] | 11 |
|
---|
[21588] | 12 | def plot_BC(md,options,fig,axgrid,gridindex):
|
---|
[21283] | 13 | '''
|
---|
| 14 | PLOT_BC - plot model boundary conditions
|
---|
| 15 |
|
---|
| 16 | Usage:
|
---|
| 17 | plot_BC(md,options,fig,axes)
|
---|
| 18 |
|
---|
| 19 | See also: PLOTMODEL
|
---|
| 20 | '''
|
---|
[21588] | 21 | x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
[21283] | 22 |
|
---|
[21588] | 23 | ax=axgrid[gridindex]
|
---|
| 24 | fig.delaxes(axgrid.cbar_axes[gridindex])
|
---|
| 25 |
|
---|
| 26 | if not is2d:
|
---|
| 27 | ax=inset_locator.inset_axes(axgrid[gridindex],width='100%',height='100%',loc=3,borderpad=0,axes_class=Axes3D)
|
---|
| 28 |
|
---|
[21283] | 29 | #plot neuman
|
---|
| 30 | plot_icefront(md,options,fig,ax)
|
---|
[21588] | 31 |
|
---|
[21283] | 32 | XLims=[np.min(x),np.max(x)]
|
---|
| 33 | YLims=[np.min(y),np.max(y)]
|
---|
| 34 | #plot dirichlets
|
---|
| 35 | dirichleton=options.getfieldvalue('dirichlet','on')
|
---|
| 36 | if dirichleton=='on':
|
---|
| 37 | ax.scatter(x[np.where(~np.isnan(md.stressbalance.spcvx))],
|
---|
| 38 | y[np.where(~np.isnan(md.stressbalance.spcvx))],
|
---|
| 39 | marker='o',c='r',s=240,label='vx Dirichlet',linewidth=0)
|
---|
| 40 | ax.scatter(x[np.where(~np.isnan(md.stressbalance.spcvy))],
|
---|
| 41 | y[np.where(~np.isnan(md.stressbalance.spcvy))],
|
---|
| 42 | marker='o',c='b',s=160,label='vy Dirichlet',linewidth=0)
|
---|
| 43 | ax.scatter(x[np.where(~np.isnan(md.stressbalance.spcvz))],
|
---|
| 44 | y[np.where(~np.isnan(md.stressbalance.spcvz))],
|
---|
| 45 | marker='o',c='y',s=80,label='vz Dirichlet',linewidth=0)
|
---|
[21588] | 46 | ax.scatter(x[np.where(~np.isnan(md.hydrology.spcepl_head))],
|
---|
| 47 | y[np.where(~np.isnan(md.hydrology.spcepl_head))],
|
---|
| 48 | marker='v',c='r',s=240,label='EPL Head',linewidth=0)
|
---|
| 49 | ax.scatter(x[np.where(~np.isnan(md.hydrology.spcsediment_head))],
|
---|
| 50 | y[np.where(~np.isnan(md.hydrology.spcsediment_head))],
|
---|
| 51 | marker='^',c='b',s=240,label='IDS head',linewidth=0)
|
---|
| 52 |
|
---|
[21283] | 53 | ax.set_xlim(XLims)
|
---|
| 54 | ax.set_ylim(YLims)
|
---|
[21588] | 55 | ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
|
---|
| 56 | ncol=3, mode="expand", borderaxespad=0.)
|
---|
[21283] | 57 | #apply options
|
---|
| 58 | options.addfielddefault('title','Boundary conditions')
|
---|
| 59 | options.addfielddefault('colorbar','off')
|
---|
[21588] | 60 | applyoptions(md,[],options,fig,axgrid,gridindex)
|
---|
[21283] | 61 |
|
---|