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 |
|
---|
6 | import numpy as np
|
---|
7 | from processmesh import processmesh
|
---|
8 | from applyoptions import applyoptions
|
---|
9 | from plot_icefront import plot_icefront
|
---|
10 | from mpl_toolkits.mplot3d import Axes3D
|
---|
11 |
|
---|
12 | def plot_BC(md,options,fig,axgrid,gridindex):
|
---|
13 | '''
|
---|
14 | PLOT_BC - plot model boundary conditions
|
---|
15 |
|
---|
16 | Usage:
|
---|
17 | plot_BC(md,options,fig,axes)
|
---|
18 |
|
---|
19 | See also: PLOTMODEL
|
---|
20 | '''
|
---|
21 | x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
22 |
|
---|
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 |
|
---|
29 | #plot neuman
|
---|
30 | plot_icefront(md,options,fig,ax)
|
---|
31 |
|
---|
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)
|
---|
46 | try:
|
---|
47 | ax.scatter(x[np.where(~np.isnan(md.hydrology.spcepl_head))],
|
---|
48 | y[np.where(~np.isnan(md.hydrology.spcepl_head))],
|
---|
49 | marker='v',c='r',s=240,label='EPL Head',linewidth=0)
|
---|
50 | ax.scatter(x[np.where(~np.isnan(md.hydrology.spcsediment_head))],
|
---|
51 | y[np.where(~np.isnan(md.hydrology.spcsediment_head))],
|
---|
52 | marker='^',c='b',s=240,label='IDS head',linewidth=0)
|
---|
53 | except AttributeError:
|
---|
54 | print ('Not treating Hydrologydc, skipping these boundaries')
|
---|
55 | ax.set_xlim(XLims)
|
---|
56 | ax.set_ylim(YLims)
|
---|
57 | ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
|
---|
58 | ncol=3, mode="expand", borderaxespad=0.)
|
---|
59 | #apply options
|
---|
60 | options.addfielddefault('title','Boundary conditions')
|
---|
61 | options.addfielddefault('colorbar','off')
|
---|
62 | applyoptions(md,[],options,fig,axgrid,gridindex)
|
---|
63 |
|
---|