| 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 | import numpy as np
|
|---|
| 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)
|
|---|
| 18 | icefront=np.where(np.logical_and(np.sum(md.mask.ice_levelset[elements],1)<3,np.sum(md.mask.ice_levelset[elements],1)>-3))
|
|---|
| 19 | onlyice=np.where(np.sum(md.mask.ice_levelset[elements],1)==-3)
|
|---|
| 20 | noice=np.where(np.sum(md.mask.ice_levelset[elements],1)==3)
|
|---|
| 21 |
|
|---|
| 22 | #plot mesh
|
|---|
| 23 | ax.triplot(x,y,elements)
|
|---|
| 24 |
|
|---|
| 25 | #highlight elements on neumann
|
|---|
| 26 | colors=np.asarray([0.5 for element in elements[icefront]])
|
|---|
| 27 |
|
|---|
| 28 | ax.tripcolor(x,y,elements[icefront],facecolors=colors,alpha=0.5,label='elements on ice front')#,facecolor='b'
|
|---|
| 29 |
|
|---|
| 30 | #apply options
|
|---|
| 31 | options.addfielddefault('title','Neumann boundary conditions')
|
|---|
| 32 | options.addfielddefault('colorbar','off')
|
|---|
| 33 | applyoptions(md,[],options,fig,ax)
|
|---|