[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"
|
---|
[21303] | 5 | import numpy as np
|
---|
[21283] | 6 | from processmesh import processmesh
|
---|
| 7 | from applyoptions import applyoptions
|
---|
| 8 |
|
---|
| 9 | def plot_icefront(md,options,fig,ax):
|
---|
| 10 | #PLOT_ICEFRONT - plot segment on neumann BC
|
---|
| 11 | #
|
---|
| 12 | # Usage:
|
---|
| 13 | # plot_icefront(md,options,width,i)
|
---|
| 14 | #
|
---|
| 15 | # See also: PLOTMODEL
|
---|
| 16 | #process mesh and data
|
---|
| 17 | x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
|
---|
[21588] | 18 |
|
---|
| 19 | #icefront check
|
---|
| 20 | icefront=np.where(np.abs(np.sum(md.mask.ice_levelset[elements],1))!=3)
|
---|
[21283] | 21 | onlyice=np.where(np.sum(md.mask.ice_levelset[elements],1)==-3)
|
---|
| 22 | noice=np.where(np.sum(md.mask.ice_levelset[elements],1)==3)
|
---|
| 23 |
|
---|
| 24 | #plot mesh
|
---|
| 25 | ax.triplot(x,y,elements)
|
---|
| 26 |
|
---|
| 27 | #highlight elements on neumann
|
---|
[21588] | 28 | if len(icefront[0])>0:
|
---|
| 29 | colors=np.asarray([0.5 for element in elements[icefront]])
|
---|
| 30 | ax.tripcolor(x,y,elements[icefront],facecolors=colors,alpha=0.5,label='elements on ice front')
|
---|
[21283] | 31 |
|
---|
| 32 | #apply options
|
---|
| 33 | options.addfielddefault('title','Neumann boundary conditions')
|
---|
| 34 | options.addfielddefault('colorbar','off')
|
---|