mapc2p.py.html | clawcode2html |
Source file: mapc2p.py | |
Directory: /home/rjl/www/pubs/cise08/cise08levequeV2 | |
Converted: Wed Jul 2 2008 at 13:40:45 | |
This documentation file will not reflect any later changes in the source file. |
def mapc2p(xc,yc): # # specifies the mapping to curvilinear coordinates -- should be consistent # with mapc2p.f # # import sys from clawtools import ClawData data = ClawData('setprob.data') igrid = data.igrid # indicates which grid mapping to use if igrid==1: # Cartesian (no mapping) xp = xc yp = yc elif igrid==2: # Polar coordinates (xc = r, yc = theta) xp = xc * cos(yc) yp = xc * sin(yc) elif igrid==3: # New mapping r1 = 1 absxc = abs(xc) absyc = abs(yc) d = where(absxc>absyc, absxc, absyc) r = sqrt(xc**2 + yc**2) r = where(r<1e-10, 1e-10, r) # to avoid divide by zero xp = r1 * d * xc/r yp = r1 * d * yc/r # interpolate w = d xp = w*xp + (1-w)*xc yp = w*yp + (1-w)*yc else: print 'Error - Mapping not defined for igrid = ',igrid sys.exit(1) return (xp,yp)