| [13980] | 1 | Index: ../trunk-jpl/test/Par/SquareShelf.py | 
|---|
|  | 2 | =================================================================== | 
|---|
|  | 3 | --- ../trunk-jpl/test/Par/SquareShelf.py        (revision 0) | 
|---|
|  | 4 | +++ ../trunk-jpl/test/Par/SquareShelf.py        (revision 13455) | 
|---|
|  | 5 | @@ -0,0 +1,89 @@ | 
|---|
|  | 6 | +import os.path | 
|---|
|  | 7 | +import inspect | 
|---|
|  | 8 | +import netCDF4 | 
|---|
|  | 9 | +from numpy import * | 
|---|
|  | 10 | +from verbose import * | 
|---|
|  | 11 | +from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d | 
|---|
|  | 12 | +from paterson import * | 
|---|
|  | 13 | +from SetIceShelfBC import * | 
|---|
|  | 14 | + | 
|---|
|  | 15 | +#Start defining model parameters here | 
|---|
|  | 16 | +#Geometry | 
|---|
|  | 17 | +hmin=300. | 
|---|
|  | 18 | +hmax=1000. | 
|---|
|  | 19 | +ymin=min(md.mesh.y) | 
|---|
|  | 20 | +ymax=max(md.mesh.y) | 
|---|
|  | 21 | + | 
|---|
|  | 22 | +md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin) | 
|---|
|  | 23 | +md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness | 
|---|
|  | 24 | +md.geometry.surface=md.geometry.bed+md.geometry.thickness | 
|---|
|  | 25 | + | 
|---|
|  | 26 | +#Initial velocity and pressure | 
|---|
|  | 27 | +iVelF = netCDF4.Dataset('../Data/SquareShelf.nc','r') | 
|---|
|  | 28 | + | 
|---|
|  | 29 | +x=reshape(iVelF.variables['x'][:],(-1)) | 
|---|
|  | 30 | +y=reshape(iVelF.variables['y'][:],(-1)) | 
|---|
|  | 31 | +vx=iVelF.variables['vx'][:] | 
|---|
|  | 32 | +vy=iVelF.variables['vy'][:] | 
|---|
|  | 33 | +index=iVelF.variables['index'][:].astype(float) | 
|---|
|  | 34 | +index=reshape(index.T,(len(index),3),order='F') | 
|---|
|  | 35 | + | 
|---|
|  | 36 | +#dbg - begin | 
|---|
|  | 37 | +# #print 'vars in SquareShelf.nc:' | 
|---|
|  | 38 | +# #for v in iVelF.variables: | 
|---|
|  | 39 | +# #    print v | 
|---|
|  | 40 | +#dbg - end | 
|---|
|  | 41 | + | 
|---|
|  | 42 | +iVelF.close() | 
|---|
|  | 43 | + | 
|---|
|  | 44 | +[md.initialization.vx]=InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y) | 
|---|
|  | 45 | +[md.initialization.vy]=InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y) | 
|---|
|  | 46 | +md.initialization.vz=zeros(md.mesh.numberofvertices) | 
|---|
|  | 47 | +md.initialization.pressure=zeros(md.mesh.numberofvertices) | 
|---|
|  | 48 | + | 
|---|
|  | 49 | +#dbg - begin | 
|---|
|  | 50 | +#print '...vx:' | 
|---|
|  | 51 | +#print md.initialization.vx | 
|---|
|  | 52 | +#print '...vy:' | 
|---|
|  | 53 | +#print md.initialization.vy | 
|---|
|  | 54 | +##print '...vz:' | 
|---|
|  | 55 | +##print md.initialization.vz | 
|---|
|  | 56 | +##print '...pressure:' | 
|---|
|  | 57 | +##print md.initialization.pressure | 
|---|
|  | 58 | +#dbg - end | 
|---|
|  | 59 | + | 
|---|
|  | 60 | + | 
|---|
|  | 61 | +#Materials | 
|---|
|  | 62 | +md.initialization.temperature = (273.-20.)*ones(md.mesh.numberofvertices) | 
|---|
|  | 63 | +md.materials.rheology_B = paterson(md.initialization.temperature) | 
|---|
|  | 64 | +md.materials.rheology_n = 3.*ones(md.mesh.numberofelements) | 
|---|
|  | 65 | + | 
|---|
|  | 66 | +#Friction | 
|---|
|  | 67 | +pos=nonzero(md.mask.elementonfloatingice) | 
|---|
|  | 68 | +md.friction.coefficient = 20.*ones(md.mesh.numberofvertices) | 
|---|
|  | 69 | +md.friction.coefficient[md.mesh.elements[pos,:].astype(int)-1] = 0. | 
|---|
|  | 70 | +md.friction.p = ones(md.mesh.numberofelements) | 
|---|
|  | 71 | +md.friction.q = ones(md.mesh.numberofelements) | 
|---|
|  | 72 | + | 
|---|
|  | 73 | +#Numerical parameters | 
|---|
|  | 74 | +md.diagnostic.viscosity_overshoot = 0.3 | 
|---|
|  | 75 | +md.prognostic.stabilization = 1. | 
|---|
|  | 76 | +md.thermal.stabilization = 1. | 
|---|
|  | 77 | +md.settings.waitonlock = 30. | 
|---|
|  | 78 | +md.verbose=verbose() | 
|---|
|  | 79 | +md.diagnostic.restol = 0.10 | 
|---|
|  | 80 | +md.steadystate.reltol = 0.02 | 
|---|
|  | 81 | +md.diagnostic.reltol = 0.02 | 
|---|
|  | 82 | +md.diagnostic.abstol = nan | 
|---|
|  | 83 | +md.timestepping.time_step = 1. | 
|---|
|  | 84 | +md.timestepping.final_time = 3. | 
|---|
|  | 85 | + | 
|---|
|  | 86 | +#Boundary conditions: | 
|---|
|  | 87 | +# #md=SetIceShelfBC(md) | 
|---|
|  | 88 | +print '...calling seticeshelfbc:' | 
|---|
|  | 89 | +md=SetIceShelfBC(md,'../Exp/SquareFront.exp') | 
|---|
|  | 90 | +print '...called seticeshelfbc:' | 
|---|
|  | 91 | + | 
|---|
|  | 92 | +#Change name so that no test have the same name | 
|---|
|  | 93 | +if len(inspect.stack()) > 2: | 
|---|
|  | 94 | +       md.miscellaneous.name=os.path.basename(inspect.stack()[2][1]).split('.')[0] | 
|---|
|  | 95 | Index: ../trunk-jpl/test/NightlyRun/test3007.py | 
|---|
|  | 96 | =================================================================== | 
|---|
|  | 97 | --- ../trunk-jpl/test/NightlyRun/test3007.py    (revision 0) | 
|---|
|  | 98 | +++ ../trunk-jpl/test/NightlyRun/test3007.py    (revision 13455) | 
|---|
|  | 99 | @@ -0,0 +1,39 @@ | 
|---|
|  | 100 | +""" | 
|---|
|  | 101 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 102 | +Auto generated python script for ISSM:   test3007.m | 
|---|
|  | 103 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 104 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 105 | + | 
|---|
|  | 106 | +Matlab script conversion into python | 
|---|
|  | 107 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 108 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 109 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 110 | +""" | 
|---|
|  | 111 | + | 
|---|
|  | 112 | +from MatlabFuncs import * | 
|---|
|  | 113 | +from model import * | 
|---|
|  | 114 | +from EnumDefinitions import * | 
|---|
|  | 115 | +import numpy | 
|---|
|  | 116 | +from triangle import * | 
|---|
|  | 117 | +from setmask import * | 
|---|
|  | 118 | +from parameterize import * | 
|---|
|  | 119 | +from setflowequation import * | 
|---|
|  | 120 | +from solve import * | 
|---|
|  | 121 | + | 
|---|
|  | 122 | +md=triangle(model(),'../Exp/Square.exp',150000) | 
|---|
|  | 123 | +md=setmask(md,'all','') | 
|---|
|  | 124 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 125 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 126 | +md.extrude(5,3) | 
|---|
|  | 127 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 128 | +md.autodiff.isautodiff=true | 
|---|
|  | 129 | +md=solve(md,PrognosticSolutionEnum()) | 
|---|
|  | 130 | + | 
|---|
|  | 131 | + | 
|---|
|  | 132 | +# Fields and tolerances to track changes | 
|---|
|  | 133 | + | 
|---|
|  | 134 | +field_names     =['Thickness'] | 
|---|
|  | 135 | +field_tolerances=[1e-13] | 
|---|
|  | 136 | +field_values=[\ | 
|---|
|  | 137 | +       md.results['PrognosticSolution'][1]['Thickness'],\ | 
|---|
|  | 138 | +       ] | 
|---|
|  | 139 | Index: ../trunk-jpl/test/NightlyRun/test3002.py | 
|---|
|  | 140 | =================================================================== | 
|---|
|  | 141 | --- ../trunk-jpl/test/NightlyRun/test3002.py    (revision 0) | 
|---|
|  | 142 | +++ ../trunk-jpl/test/NightlyRun/test3002.py    (revision 13455) | 
|---|
|  | 143 | @@ -0,0 +1,43 @@ | 
|---|
|  | 144 | +""" | 
|---|
|  | 145 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 146 | +Auto generated python script for ISSM:   test3002.m | 
|---|
|  | 147 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 148 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 149 | + | 
|---|
|  | 150 | +Matlab script conversion into python | 
|---|
|  | 151 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 152 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 153 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 154 | +""" | 
|---|
|  | 155 | + | 
|---|
|  | 156 | +from MatlabFuncs import * | 
|---|
|  | 157 | +from model import * | 
|---|
|  | 158 | +from EnumDefinitions import * | 
|---|
|  | 159 | +import numpy | 
|---|
|  | 160 | +from triangle import * | 
|---|
|  | 161 | +from setmask import * | 
|---|
|  | 162 | +from parameterize import * | 
|---|
|  | 163 | +from setflowequation import * | 
|---|
|  | 164 | +from solve import * | 
|---|
|  | 165 | + | 
|---|
|  | 166 | +md=triangle(model(),'../Exp/Square.exp',180000) | 
|---|
|  | 167 | +md=setmask(md,'all','') | 
|---|
|  | 168 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 169 | +md.extrude(3,2) | 
|---|
|  | 170 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 171 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 172 | +md.autodiff.isautodiff=true | 
|---|
|  | 173 | +md=solve(md,DiagnosticSolutionEnum()) | 
|---|
|  | 174 | + | 
|---|
|  | 175 | + | 
|---|
|  | 176 | +# Fields and tolerances to track changes | 
|---|
|  | 177 | + | 
|---|
|  | 178 | +field_names     =['Vx','Vy','Vz','Vel','Pressure'] | 
|---|
|  | 179 | +field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13] | 
|---|
|  | 180 | +field_values=[\ | 
|---|
|  | 181 | +       md.results['DiagnosticSolution'][1]['Vx'],\ | 
|---|
|  | 182 | +       md.results['DiagnosticSolution'][1]['Vy'],\ | 
|---|
|  | 183 | +       md.results['DiagnosticSolution'][1]['Vz'],\ | 
|---|
|  | 184 | +       md.results['DiagnosticSolution'][1]['Vel'],\ | 
|---|
|  | 185 | +       md.results['DiagnosticSolution'][1]['Pressure'],\ | 
|---|
|  | 186 | +       ] | 
|---|
|  | 187 | Index: ../trunk-jpl/test/NightlyRun/test3005.py | 
|---|
|  | 188 | =================================================================== | 
|---|
|  | 189 | --- ../trunk-jpl/test/NightlyRun/test3005.py    (revision 0) | 
|---|
|  | 190 | +++ ../trunk-jpl/test/NightlyRun/test3005.py    (revision 13455) | 
|---|
|  | 191 | @@ -0,0 +1,38 @@ | 
|---|
|  | 192 | +""" | 
|---|
|  | 193 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 194 | +Auto generated python script for ISSM:   test3005.m | 
|---|
|  | 195 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 196 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 197 | + | 
|---|
|  | 198 | +Matlab script conversion into python | 
|---|
|  | 199 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 200 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 201 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 202 | +""" | 
|---|
|  | 203 | + | 
|---|
|  | 204 | +from MatlabFuncs import * | 
|---|
|  | 205 | +from model import * | 
|---|
|  | 206 | +from EnumDefinitions import * | 
|---|
|  | 207 | +import numpy | 
|---|
|  | 208 | +from triangle import * | 
|---|
|  | 209 | +from setmask import * | 
|---|
|  | 210 | +from parameterize import * | 
|---|
|  | 211 | +from setflowequation import * | 
|---|
|  | 212 | +from solve import * | 
|---|
|  | 213 | + | 
|---|
|  | 214 | +md=triangle(model(),'../Exp/Square.exp',150000) | 
|---|
|  | 215 | +md=setmask(md,'all','') | 
|---|
|  | 216 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 217 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 218 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 219 | +md.autodiff.isautodiff=true | 
|---|
|  | 220 | +md=solve(md,PrognosticSolutionEnum()) | 
|---|
|  | 221 | + | 
|---|
|  | 222 | + | 
|---|
|  | 223 | +# Fields and tolerances to track changes | 
|---|
|  | 224 | + | 
|---|
|  | 225 | +field_names     =['Thickness'] | 
|---|
|  | 226 | +field_tolerances=[1e-13] | 
|---|
|  | 227 | +field_values=[\ | 
|---|
|  | 228 | +       md.results['PrognosticSolution'][1]['Thickness'],\ | 
|---|
|  | 229 | +       ] | 
|---|
|  | 230 | Index: ../trunk-jpl/test/NightlyRun/test3008.py | 
|---|
|  | 231 | =================================================================== | 
|---|
|  | 232 | --- ../trunk-jpl/test/NightlyRun/test3008.py    (revision 0) | 
|---|
|  | 233 | +++ ../trunk-jpl/test/NightlyRun/test3008.py    (revision 13455) | 
|---|
|  | 234 | @@ -0,0 +1,41 @@ | 
|---|
|  | 235 | +""" | 
|---|
|  | 236 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 237 | +Auto generated python script for ISSM:   test3008.m | 
|---|
|  | 238 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 239 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 240 | + | 
|---|
|  | 241 | +Matlab script conversion into python | 
|---|
|  | 242 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 243 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 244 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 245 | +""" | 
|---|
|  | 246 | + | 
|---|
|  | 247 | +from MatlabFuncs import * | 
|---|
|  | 248 | +from model import * | 
|---|
|  | 249 | +from EnumDefinitions import * | 
|---|
|  | 250 | +import numpy | 
|---|
|  | 251 | +from triangle import * | 
|---|
|  | 252 | +from setmask import * | 
|---|
|  | 253 | +from parameterize import * | 
|---|
|  | 254 | +from setflowequation import * | 
|---|
|  | 255 | +from solve import * | 
|---|
|  | 256 | + | 
|---|
|  | 257 | +md=triangle(model(),'../Exp/Square.exp',180000) | 
|---|
|  | 258 | +md=setmask(md,'all','') | 
|---|
|  | 259 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 260 | +md.extrude(3,1) | 
|---|
|  | 261 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 262 | +md.timestepping.time_step=0 | 
|---|
|  | 263 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 264 | +md.autodiff.isautodiff=true | 
|---|
|  | 265 | +md=solve(md,ThermalSolutionEnum()) | 
|---|
|  | 266 | + | 
|---|
|  | 267 | + | 
|---|
|  | 268 | +# Fields and tolerances to track changes | 
|---|
|  | 269 | + | 
|---|
|  | 270 | +field_names     =['Temperature','BasalforcingsMeltingRate'] | 
|---|
|  | 271 | +field_tolerances=[1e-13,1e-13] | 
|---|
|  | 272 | +field_values=[\ | 
|---|
|  | 273 | +       md.results['ThermalSolution'][1]['Temperature'],\ | 
|---|
|  | 274 | +       md.results['ThermalSolution'][1]['BasalforcingsMeltingRate'],\ | 
|---|
|  | 275 | +       ] | 
|---|
|  | 276 | Index: ../trunk-jpl/test/NightlyRun/test3003.py | 
|---|
|  | 277 | =================================================================== | 
|---|
|  | 278 | --- ../trunk-jpl/test/NightlyRun/test3003.py    (revision 0) | 
|---|
|  | 279 | +++ ../trunk-jpl/test/NightlyRun/test3003.py    (revision 13455) | 
|---|
|  | 280 | @@ -0,0 +1,52 @@ | 
|---|
|  | 281 | +""" | 
|---|
|  | 282 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 283 | +Auto generated python script for ISSM:   test3003.m | 
|---|
|  | 284 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 285 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 286 | + | 
|---|
|  | 287 | +Matlab script conversion into python | 
|---|
|  | 288 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 289 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 290 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 291 | +""" | 
|---|
|  | 292 | + | 
|---|
|  | 293 | +from MatlabFuncs import * | 
|---|
|  | 294 | +from model import * | 
|---|
|  | 295 | +from EnumDefinitions import * | 
|---|
|  | 296 | +import numpy | 
|---|
|  | 297 | +from triangle import * | 
|---|
|  | 298 | +from setmask import * | 
|---|
|  | 299 | +from parameterize import * | 
|---|
|  | 300 | +from setflowequation import * | 
|---|
|  | 301 | +from solve import * | 
|---|
|  | 302 | + | 
|---|
|  | 303 | +md=triangle(model(),'../Exp/Square.exp',180000) | 
|---|
|  | 304 | +md=setmask(md,'all','') | 
|---|
|  | 305 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 306 | +md.extrude(3,2) | 
|---|
|  | 307 | +md=setflowequation(md,'pattyn','all') | 
|---|
|  | 308 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 309 | +md.diagnostic.requested_outputs=StressTensorEnum() | 
|---|
|  | 310 | +md.autodiff.isautodiff=true | 
|---|
|  | 311 | +md=solve(md,DiagnosticSolutionEnum()) | 
|---|
|  | 312 | + | 
|---|
|  | 313 | + | 
|---|
|  | 314 | +# Fields and tolerances to track changes | 
|---|
|  | 315 | + | 
|---|
|  | 316 | +field_names     =['Vx','Vy','Vz','Vel','Pressure',\ | 
|---|
|  | 317 | +       'StressTensorxx','StressTensoryy','StressTensorzz','StressTensorxy','StressTensorxz','StressTensoryz'] | 
|---|
|  | 318 | +field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09,\ | 
|---|
|  | 319 | +       1e-09,1e-09,1e-09,1e-09,1e-09,1e-09] | 
|---|
|  | 320 | +field_values=[\ | 
|---|
|  | 321 | +       md.results['DiagnosticSolution'][1]['Vx'],\ | 
|---|
|  | 322 | +       md.results['DiagnosticSolution'][1]['Vy'],\ | 
|---|
|  | 323 | +       md.results['DiagnosticSolution'][1]['Vz'],\ | 
|---|
|  | 324 | +       md.results['DiagnosticSolution'][1]['Vel'],\ | 
|---|
|  | 325 | +       md.results['DiagnosticSolution'][1]['Pressure'],\ | 
|---|
|  | 326 | +       md.results['DiagnosticSolution'][1]['StressTensorxx'],\ | 
|---|
|  | 327 | +       md.results['DiagnosticSolution'][1]['StressTensoryy'],\ | 
|---|
|  | 328 | +       md.results['DiagnosticSolution'][1]['StressTensorzz'],\ | 
|---|
|  | 329 | +       md.results['DiagnosticSolution'][1]['StressTensorxy'],\ | 
|---|
|  | 330 | +       md.results['DiagnosticSolution'][1]['StressTensorxz'],\ | 
|---|
|  | 331 | +       md.results['DiagnosticSolution'][1]['StressTensoryz'],\ | 
|---|
|  | 332 | +       ] | 
|---|
|  | 333 | Index: ../trunk-jpl/test/NightlyRun/test201.py | 
|---|
|  | 334 | =================================================================== | 
|---|
|  | 335 | --- ../trunk-jpl/test/NightlyRun/test201.py     (revision 0) | 
|---|
|  | 336 | +++ ../trunk-jpl/test/NightlyRun/test201.py     (revision 13455) | 
|---|
|  | 337 | @@ -0,0 +1,26 @@ | 
|---|
|  | 338 | +from model import * | 
|---|
|  | 339 | +from triangle import * | 
|---|
|  | 340 | +from setmask import * | 
|---|
|  | 341 | +from parameterize import * | 
|---|
|  | 342 | +from setflowequation import * | 
|---|
|  | 343 | +from EnumDefinitions import * | 
|---|
|  | 344 | +from solve import * | 
|---|
|  | 345 | +from MatlabFuncs import * | 
|---|
|  | 346 | +from ContourToMesh import * | 
|---|
|  | 347 | + | 
|---|
|  | 348 | +md=triangle(model(),'../Exp/Square.exp',150000) | 
|---|
|  | 349 | +md=setmask(md,'all','') | 
|---|
|  | 350 | +md=parameterize(md,'../Par/SquareShelf.py') | 
|---|
|  | 351 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 352 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 353 | +md=solve(md,DiagnosticSolutionEnum()) | 
|---|
|  | 354 | + | 
|---|
|  | 355 | +#Fields and tolerances to track changes | 
|---|
|  | 356 | +field_names     =['Vx','Vy','Vel','Pressure'] | 
|---|
|  | 357 | +field_tolerances=[1e-13,1e-13,1e-13,1e-13] | 
|---|
|  | 358 | +field_values=[\ | 
|---|
|  | 359 | +       md.results['DiagnosticSolution'][1]['Vx'],\ | 
|---|
|  | 360 | +       md.results['DiagnosticSolution'][1]['Vy'],\ | 
|---|
|  | 361 | +       md.results['DiagnosticSolution'][1]['Vel'],\ | 
|---|
|  | 362 | +       md.results['DiagnosticSolution'][1]['Pressure'],\ | 
|---|
|  | 363 | +       ] | 
|---|
|  | 364 | Index: ../trunk-jpl/test/NightlyRun/test3006.py | 
|---|
|  | 365 | =================================================================== | 
|---|
|  | 366 | --- ../trunk-jpl/test/NightlyRun/test3006.py    (revision 0) | 
|---|
|  | 367 | +++ ../trunk-jpl/test/NightlyRun/test3006.py    (revision 13455) | 
|---|
|  | 368 | @@ -0,0 +1,42 @@ | 
|---|
|  | 369 | +""" | 
|---|
|  | 370 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 371 | +Auto generated python script for ISSM:   test3006.m | 
|---|
|  | 372 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 373 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 374 | + | 
|---|
|  | 375 | +Matlab script conversion into python | 
|---|
|  | 376 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 377 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 378 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 379 | +""" | 
|---|
|  | 380 | + | 
|---|
|  | 381 | +from MatlabFuncs import * | 
|---|
|  | 382 | +from model import * | 
|---|
|  | 383 | +from EnumDefinitions import * | 
|---|
|  | 384 | +import numpy | 
|---|
|  | 385 | +from triangle import * | 
|---|
|  | 386 | +from meshconvert import * | 
|---|
|  | 387 | +from setmask import * | 
|---|
|  | 388 | +from parameterize import * | 
|---|
|  | 389 | +from setflowequation import * | 
|---|
|  | 390 | +from solve import * | 
|---|
|  | 391 | + | 
|---|
|  | 392 | +md=triangle(model(),'../Exp/Square.exp',150000) | 
|---|
|  | 393 | +md=meshconvert(md) | 
|---|
|  | 394 | +md=setmask(md,'all','') | 
|---|
|  | 395 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 396 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 397 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 398 | +md.prognostic.stabilization=3 | 
|---|
|  | 399 | +md.prognostic.spcthickness=md.geometry.thickness | 
|---|
|  | 400 | +md.autodiff.isautodiff=true | 
|---|
|  | 401 | +md=solve(md,PrognosticSolutionEnum()) | 
|---|
|  | 402 | + | 
|---|
|  | 403 | + | 
|---|
|  | 404 | +# Fields and tolerances to track changes | 
|---|
|  | 405 | + | 
|---|
|  | 406 | +field_names     =['Thickness'] | 
|---|
|  | 407 | +field_tolerances=[1e-13] | 
|---|
|  | 408 | +field_values=[\ | 
|---|
|  | 409 | +       md.results['PrognosticSolution'][1]['Thickness'],\ | 
|---|
|  | 410 | +       ] | 
|---|
|  | 411 | Index: ../trunk-jpl/test/NightlyRun/test3001.py | 
|---|
|  | 412 | =================================================================== | 
|---|
|  | 413 | --- ../trunk-jpl/test/NightlyRun/test3001.py    (revision 0) | 
|---|
|  | 414 | +++ ../trunk-jpl/test/NightlyRun/test3001.py    (revision 13455) | 
|---|
|  | 415 | @@ -0,0 +1,47 @@ | 
|---|
|  | 416 | +""" | 
|---|
|  | 417 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 418 | +Auto generated python script for ISSM:   test3001.m | 
|---|
|  | 419 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 420 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 421 | + | 
|---|
|  | 422 | +Matlab script conversion into python | 
|---|
|  | 423 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 424 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 425 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 426 | +""" | 
|---|
|  | 427 | + | 
|---|
|  | 428 | +from MatlabFuncs import * | 
|---|
|  | 429 | +from model import * | 
|---|
|  | 430 | +from EnumDefinitions import * | 
|---|
|  | 431 | +import numpy | 
|---|
|  | 432 | +from triangle import * | 
|---|
|  | 433 | +from setmask import * | 
|---|
|  | 434 | +from parameterize import * | 
|---|
|  | 435 | +from setflowequation import * | 
|---|
|  | 436 | +from solve import * | 
|---|
|  | 437 | + | 
|---|
|  | 438 | +md=triangle(model(),'../Exp/Square.exp',50000) | 
|---|
|  | 439 | +md=setmask(md,'all','') | 
|---|
|  | 440 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 441 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 442 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 443 | +md.diagnostic.requested_outputs=StressTensorEnum() | 
|---|
|  | 444 | +md.autodiff.isautodiff=true | 
|---|
|  | 445 | +md=solve(md,DiagnosticSolutionEnum()) | 
|---|
|  | 446 | + | 
|---|
|  | 447 | + | 
|---|
|  | 448 | +# Fields and tolerances to track changes | 
|---|
|  | 449 | + | 
|---|
|  | 450 | +field_names     =['Vx','Vy','Vel','Pressure',\ | 
|---|
|  | 451 | +       'StressTensorxx','StressTensoryy','StressTensorxy'] | 
|---|
|  | 452 | +field_tolerances=[1e-13,1e-13,1e-13,1e-13,\ | 
|---|
|  | 453 | +       1e-13,1e-13,1e-13] | 
|---|
|  | 454 | +field_values=[\ | 
|---|
|  | 455 | +       md.results['DiagnosticSolution'][1]['Vx'],\ | 
|---|
|  | 456 | +       md.results['DiagnosticSolution'][1]['Vy'],\ | 
|---|
|  | 457 | +       md.results['DiagnosticSolution'][1]['Vel'],\ | 
|---|
|  | 458 | +       md.results['DiagnosticSolution'][1]['Pressure'],\ | 
|---|
|  | 459 | +       md.results['DiagnosticSolution'][1]['StressTensorxx'],\ | 
|---|
|  | 460 | +       md.results['DiagnosticSolution'][1]['StressTensoryy'],\ | 
|---|
|  | 461 | +       md.results['DiagnosticSolution'][1]['StressTensorxy'],\ | 
|---|
|  | 462 | +       ] | 
|---|
|  | 463 | Index: ../trunk-jpl/test/NightlyRun/test3009.py | 
|---|
|  | 464 | =================================================================== | 
|---|
|  | 465 | --- ../trunk-jpl/test/NightlyRun/test3009.py    (revision 0) | 
|---|
|  | 466 | +++ ../trunk-jpl/test/NightlyRun/test3009.py    (revision 13455) | 
|---|
|  | 467 | @@ -0,0 +1,44 @@ | 
|---|
|  | 468 | +""" | 
|---|
|  | 469 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 470 | +Auto generated python script for ISSM:   test3009.m | 
|---|
|  | 471 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 472 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 473 | + | 
|---|
|  | 474 | +Matlab script conversion into python | 
|---|
|  | 475 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 476 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 477 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 478 | +""" | 
|---|
|  | 479 | + | 
|---|
|  | 480 | +from MatlabFuncs import * | 
|---|
|  | 481 | +from model import * | 
|---|
|  | 482 | +from EnumDefinitions import * | 
|---|
|  | 483 | +import numpy | 
|---|
|  | 484 | +from triangle import * | 
|---|
|  | 485 | +from setmask import * | 
|---|
|  | 486 | +from parameterize import * | 
|---|
|  | 487 | +from setflowequation import * | 
|---|
|  | 488 | +from solve import * | 
|---|
|  | 489 | + | 
|---|
|  | 490 | +md=triangle(model(),'../Exp/Square.exp',180000) | 
|---|
|  | 491 | +md=setmask(md,'all','') | 
|---|
|  | 492 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 493 | +md.extrude(3,1) | 
|---|
|  | 494 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 495 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 496 | +md.transient.isdiagnostic=0 | 
|---|
|  | 497 | +md.transient.isprognostic=0 | 
|---|
|  | 498 | +md.transient.isthermal=1 | 
|---|
|  | 499 | +md.transient.isgroundingline=0 | 
|---|
|  | 500 | +md.autodiff.isautodiff=true | 
|---|
|  | 501 | +md=solve(md,TransientSolutionEnum()) | 
|---|
|  | 502 | + | 
|---|
|  | 503 | + | 
|---|
|  | 504 | +# Fields and tolerances to track changes | 
|---|
|  | 505 | + | 
|---|
|  | 506 | +field_names     =['Temperature','BasalforcingsMeltingRate'] | 
|---|
|  | 507 | +field_tolerances=[1e-13,1e-13] | 
|---|
|  | 508 | +field_values=[\ | 
|---|
|  | 509 | +       md.results['TransientSolution'][1]['Temperature'],\ | 
|---|
|  | 510 | +       md.results['TransientSolution'][1]['BasalforcingsMeltingRate'],\ | 
|---|
|  | 511 | +       ] | 
|---|
|  | 512 | Index: ../trunk-jpl/test/NightlyRun/test3010.py | 
|---|
|  | 513 | =================================================================== | 
|---|
|  | 514 | --- ../trunk-jpl/test/NightlyRun/test3010.py    (revision 0) | 
|---|
|  | 515 | +++ ../trunk-jpl/test/NightlyRun/test3010.py    (revision 13455) | 
|---|
|  | 516 | @@ -0,0 +1,66 @@ | 
|---|
|  | 517 | +""" | 
|---|
|  | 518 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 519 | +Auto generated python script for ISSM:   test3010.m | 
|---|
|  | 520 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 521 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 522 | + | 
|---|
|  | 523 | +Matlab script conversion into python | 
|---|
|  | 524 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 525 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 526 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 527 | +""" | 
|---|
|  | 528 | + | 
|---|
|  | 529 | +from MatlabFuncs import * | 
|---|
|  | 530 | +from model import * | 
|---|
|  | 531 | +from EnumDefinitions import * | 
|---|
|  | 532 | +import numpy | 
|---|
|  | 533 | +from triangle import * | 
|---|
|  | 534 | +from setmask import * | 
|---|
|  | 535 | +from parameterize import * | 
|---|
|  | 536 | +from setflowequation import * | 
|---|
|  | 537 | +from solve import * | 
|---|
|  | 538 | + | 
|---|
|  | 539 | +md=triangle(model(),'../Exp/Square.exp',150000) | 
|---|
|  | 540 | +md=setmask(md,'all','') | 
|---|
|  | 541 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 542 | +md=setflowequation(md,'macayeal','all') | 
|---|
|  | 543 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 544 | +md.transient.requested_outputs=IceVolumeEnum() | 
|---|
|  | 545 | + | 
|---|
|  | 546 | + | 
|---|
|  | 547 | +md.autodiff.isautodiff=true | 
|---|
|  | 548 | +md=solve(md,TransientSolutionEnum()) | 
|---|
|  | 549 | + | 
|---|
|  | 550 | + | 
|---|
|  | 551 | +# Fields and tolerances to track changes | 
|---|
|  | 552 | + | 
|---|
|  | 553 | +field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Volume1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Volume2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Volume3'] | 
|---|
|  | 554 | +field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\ | 
|---|
|  | 555 | +                                               1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\ | 
|---|
|  | 556 | +                                               1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13] | 
|---|
|  | 557 | +field_values=[\ | 
|---|
|  | 558 | +       md.results['TransientSolution'][1]['Vx'],\ | 
|---|
|  | 559 | +       md.results['TransientSolution'][1]['Vy'],\ | 
|---|
|  | 560 | +       md.results['TransientSolution'][1]['Vel'],\ | 
|---|
|  | 561 | +       md.results['TransientSolution'][1]['Pressure'],\ | 
|---|
|  | 562 | +       md.results['TransientSolution'][1]['Bed'],\ | 
|---|
|  | 563 | +       md.results['TransientSolution'][1]['Surface'],\ | 
|---|
|  | 564 | +       md.results['TransientSolution'][1]['Thickness'],\ | 
|---|
|  | 565 | +       md.results['TransientSolution'][1]['IceVolume'],\ | 
|---|
|  | 566 | +       md.results['TransientSolution'][2]['Vx'],\ | 
|---|
|  | 567 | +       md.results['TransientSolution'][2]['Vy'],\ | 
|---|
|  | 568 | +       md.results['TransientSolution'][2]['Vel'],\ | 
|---|
|  | 569 | +       md.results['TransientSolution'][2]['Pressure'],\ | 
|---|
|  | 570 | +       md.results['TransientSolution'][2]['Bed'],\ | 
|---|
|  | 571 | +       md.results['TransientSolution'][2]['Surface'],\ | 
|---|
|  | 572 | +       md.results['TransientSolution'][2]['Thickness'],\ | 
|---|
|  | 573 | +       md.results['TransientSolution'][2]['IceVolume'],\ | 
|---|
|  | 574 | +       md.results['TransientSolution'][3]['Vx'],\ | 
|---|
|  | 575 | +       md.results['TransientSolution'][3]['Vy'],\ | 
|---|
|  | 576 | +       md.results['TransientSolution'][3]['Vel'],\ | 
|---|
|  | 577 | +       md.results['TransientSolution'][3]['Pressure'],\ | 
|---|
|  | 578 | +       md.results['TransientSolution'][3]['Bed'],\ | 
|---|
|  | 579 | +       md.results['TransientSolution'][3]['Surface'],\ | 
|---|
|  | 580 | +       md.results['TransientSolution'][3]['Thickness'],\ | 
|---|
|  | 581 | +       md.results['TransientSolution'][3]['IceVolume'],\ | 
|---|
|  | 582 | +       ] | 
|---|
|  | 583 | Index: ../trunk-jpl/test/NightlyRun/test3004.py | 
|---|
|  | 584 | =================================================================== | 
|---|
|  | 585 | --- ../trunk-jpl/test/NightlyRun/test3004.py    (revision 0) | 
|---|
|  | 586 | +++ ../trunk-jpl/test/NightlyRun/test3004.py    (revision 13455) | 
|---|
|  | 587 | @@ -0,0 +1,43 @@ | 
|---|
|  | 588 | +""" | 
|---|
|  | 589 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 590 | +Auto generated python script for ISSM:   test3004.m | 
|---|
|  | 591 | +Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep | 
|---|
|  | 592 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 593 | + | 
|---|
|  | 594 | +Matlab script conversion into python | 
|---|
|  | 595 | +translateToPy.py Author: Michael Pellegrin | 
|---|
|  | 596 | +translateToPy.py Date: 09/24/12 | 
|---|
|  | 597 | +== == == == == == == == == == == == == == == == == == == | 
|---|
|  | 598 | +""" | 
|---|
|  | 599 | + | 
|---|
|  | 600 | +from MatlabFuncs import * | 
|---|
|  | 601 | +from model import * | 
|---|
|  | 602 | +from EnumDefinitions import * | 
|---|
|  | 603 | +import numpy | 
|---|
|  | 604 | +from triangle import * | 
|---|
|  | 605 | +from setmask import * | 
|---|
|  | 606 | +from parameterize import * | 
|---|
|  | 607 | +from setflowequation import * | 
|---|
|  | 608 | +from solve import * | 
|---|
|  | 609 | + | 
|---|
|  | 610 | +md=triangle(model(),'../Exp/Square.exp',180000) | 
|---|
|  | 611 | +md=setmask(md,'all','') | 
|---|
|  | 612 | +md=parameterize(md,'../Par/SquareShelfConstrained.py') | 
|---|
|  | 613 | +md.extrude(3,2) | 
|---|
|  | 614 | +md=setflowequation(md,'stokes','all') | 
|---|
|  | 615 | +md.cluster=generic('name',oshostname(),'np',3) | 
|---|
|  | 616 | +md.autodiff.isautodiff=true | 
|---|
|  | 617 | +md=solve(md,DiagnosticSolutionEnum()) | 
|---|
|  | 618 | + | 
|---|
|  | 619 | + | 
|---|
|  | 620 | +# Fields and tolerances to track changes | 
|---|
|  | 621 | + | 
|---|
|  | 622 | +field_names     =['Vx','Vy','Vz','Vel','Pressure'] | 
|---|
|  | 623 | +field_tolerances=[1e-08,1e-08,1e-07,1e-08,1e-08] | 
|---|
|  | 624 | +field_values=[\ | 
|---|
|  | 625 | +       md.results['DiagnosticSolution'][1]['Vx'],\ | 
|---|
|  | 626 | +       md.results['DiagnosticSolution'][1]['Vy'],\ | 
|---|
|  | 627 | +       md.results['DiagnosticSolution'][1]['Vz'],\ | 
|---|
|  | 628 | +       md.results['DiagnosticSolution'][1]['Vel'],\ | 
|---|
|  | 629 | +       md.results['DiagnosticSolution'][1]['Pressure'],\ | 
|---|
|  | 630 | +       ] | 
|---|
|  | 631 | Index: ../trunk-jpl/src/modules/python/Makefile.am | 
|---|
|  | 632 | =================================================================== | 
|---|
|  | 633 | --- ../trunk-jpl/src/modules/python/Makefile.am (revision 13454) | 
|---|
|  | 634 | +++ ../trunk-jpl/src/modules/python/Makefile.am (revision 13455) | 
|---|
|  | 635 | @@ -13,6 +13,7 @@ | 
|---|
|  | 636 | InterpFromMeshToMesh2d.la\ | 
|---|
|  | 637 | NodeConnectivity.la\ | 
|---|
|  | 638 | StringToEnum.la\ | 
|---|
|  | 639 | +                                               ContourToMesh.la\ | 
|---|
|  | 640 | TriMesh.la | 
|---|
|  | 641 | endif | 
|---|
|  | 642 | #}}} | 
|---|
|  | 643 | @@ -93,6 +94,10 @@ | 
|---|
|  | 644 | ../StringToEnum/StringToEnum.h | 
|---|
|  | 645 | StringToEnum_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) | 
|---|
|  | 646 |  | 
|---|
|  | 647 | +ContourToMesh_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp\ | 
|---|
|  | 648 | +                                                                 ../ContourToMesh/ContourToMesh.h | 
|---|
|  | 649 | +ContourToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) | 
|---|
|  | 650 | + | 
|---|
|  | 651 | TriMesh_la_SOURCES = ../TriMesh/TriMesh.cpp\ | 
|---|
|  | 652 | ../TriMesh/TriMesh.h | 
|---|
|  | 653 | TriMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(TRIANGLELIB) | 
|---|
|  | 654 | Index: ../trunk-jpl/src/m/classes/flowequation.py | 
|---|
|  | 655 | =================================================================== | 
|---|
|  | 656 | --- ../trunk-jpl/src/m/classes/flowequation.py  (revision 13454) | 
|---|
|  | 657 | +++ ../trunk-jpl/src/m/classes/flowequation.py  (revision 13455) | 
|---|
|  | 658 | @@ -1,4 +1,5 @@ | 
|---|
|  | 659 | #module imports | 
|---|
|  | 660 | +import copy | 
|---|
|  | 661 | import numpy | 
|---|
|  | 662 | from fielddisplay import fielddisplay | 
|---|
|  | 663 | from EnumDefinitions import * | 
|---|
|  | 664 | @@ -80,6 +81,8 @@ | 
|---|
|  | 665 | # }}} | 
|---|
|  | 666 |  | 
|---|
|  | 667 | def marshall(self,fid):    # {{{ | 
|---|
|  | 668 | +               #print "marshalling flowequation-1" | 
|---|
|  | 669 | +               #print self.vertex_equation | 
|---|
|  | 670 | WriteData(fid,'object',self,'fieldname','ismacayealpattyn','format','Boolean') | 
|---|
|  | 671 | WriteData(fid,'object',self,'fieldname','ishutter','format','Boolean') | 
|---|
|  | 672 | WriteData(fid,'object',self,'fieldname','isl1l2','format','Boolean') | 
|---|
|  | 673 | @@ -88,7 +91,8 @@ | 
|---|
|  | 674 | WriteData(fid,'object',self,'fieldname','borderpattyn','format','DoubleMat','mattype',1) | 
|---|
|  | 675 | WriteData(fid,'object',self,'fieldname','borderstokes','format','DoubleMat','mattype',1) | 
|---|
|  | 676 | #convert approximations to enums | 
|---|
|  | 677 | -               data=self.vertex_equation | 
|---|
|  | 678 | +               ## data=list(self.vertex_equation) | 
|---|
|  | 679 | +               data=copy.deepcopy(self.vertex_equation) | 
|---|
|  | 680 | data[numpy.nonzero(data==0)]=NoneApproximationEnum() | 
|---|
|  | 681 | data[numpy.nonzero(data==1)]=HutterApproximationEnum() | 
|---|
|  | 682 | data[numpy.nonzero(data==2)]=MacAyealApproximationEnum() | 
|---|
|  | 683 | @@ -99,7 +103,8 @@ | 
|---|
|  | 684 | data[numpy.nonzero(data==7)]=PattynStokesApproximationEnum() | 
|---|
|  | 685 | data[numpy.nonzero(data==8)]=L1L2ApproximationEnum() | 
|---|
|  | 686 | WriteData(fid,'data',data,'enum',FlowequationVertexEquationEnum(),'format','DoubleMat','mattype',1) | 
|---|
|  | 687 | -               data=self.element_equation | 
|---|
|  | 688 | +               ########data=self.element_equation | 
|---|
|  | 689 | +               data=copy.deepcopy(self.element_equation) | 
|---|
|  | 690 | data[numpy.nonzero(data==0)]=NoneApproximationEnum() | 
|---|
|  | 691 | data[numpy.nonzero(data==1)]=HutterApproximationEnum() | 
|---|
|  | 692 | data[numpy.nonzero(data==2)]=MacAyealApproximationEnum() | 
|---|
|  | 693 | @@ -110,5 +115,7 @@ | 
|---|
|  | 694 | data[numpy.nonzero(data==7)]=PattynStokesApproximationEnum() | 
|---|
|  | 695 | data[numpy.nonzero(data==8)]=L1L2ApproximationEnum() | 
|---|
|  | 696 | WriteData(fid,'data',data,'enum',FlowequationElementEquationEnum(),'format','DoubleMat','mattype',2) | 
|---|
|  | 697 | +               #print "marshalling flowequation-4" | 
|---|
|  | 698 | +               #print self.vertex_equation | 
|---|
|  | 699 | # }}} | 
|---|
|  | 700 |  | 
|---|
|  | 701 | Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py | 
|---|
|  | 702 | =================================================================== | 
|---|
|  | 703 | --- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py      (revision 13454) | 
|---|
|  | 704 | +++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py      (revision 13455) | 
|---|
|  | 705 | @@ -1,5 +1,6 @@ | 
|---|
|  | 706 | import os | 
|---|
|  | 707 | import numpy | 
|---|
|  | 708 | +from ContourToMesh import ContourToMesh | 
|---|
|  | 709 |  | 
|---|
|  | 710 | def SetIceShelfBC(md,icefrontfile=''): | 
|---|
|  | 711 | """ | 
|---|
|  | 712 | @@ -23,8 +24,8 @@ | 
|---|
|  | 713 | if icefrontfile: | 
|---|
|  | 714 | if not os.path.exists(icefrontfile): | 
|---|
|  | 715 | raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile) | 
|---|
|  | 716 | -               nodeinsideicefront=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2) | 
|---|
|  | 717 | -               nodeonicefront=double(md.mesh.vertexonboundary and nodeinsideicefront) | 
|---|
|  | 718 | +               nodeinsideicefront=ContourToMesh((md.mesh.elements).reshape(-1,1),(md.mesh.x).reshape(-1,1),(md.mesh.y).reshape(-1,1),icefrontfile,'node',2) | 
|---|
|  | 719 | +               nodeonicefront= numpy.bitwise_and( map(int,md.mesh.vertexonboundary), map(int,nodeinsideicefront[0].ravel()) ) | 
|---|
|  | 720 | else: | 
|---|
|  | 721 | nodeonicefront=numpy.zeros(md.mesh.numberofvertices) | 
|---|
|  | 722 |  | 
|---|
|  | 723 | Index: ../trunk-jpl/scripts/mToPy.py | 
|---|
|  | 724 | =================================================================== | 
|---|
|  | 725 | --- ../trunk-jpl/scripts/mToPy.py       (revision 0) | 
|---|
|  | 726 | +++ ../trunk-jpl/scripts/mToPy.py       (revision 13455) | 
|---|
|  | 727 | @@ -0,0 +1,52 @@ | 
|---|
|  | 728 | +#!/usr/bin/env python | 
|---|
|  | 729 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 730 | +# | 
|---|
|  | 731 | +program =               'mToPy.py' | 
|---|
|  | 732 | +version =               '1.0' | 
|---|
|  | 733 | +versionReleaseDate =    '09/24/12' | 
|---|
|  | 734 | +origAuthor =            'Mike Pellegrin' | 
|---|
|  | 735 | +desc = '\nMain control unit for converting an matlab script file to python' | 
|---|
|  | 736 | +# | 
|---|
|  | 737 | +#   Note: Output will be put in the same (absolute) location as the input. | 
|---|
|  | 738 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 739 | +#                              History | 
|---|
|  | 740 | +#      Date            Developer           Modification | 
|---|
|  | 741 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 742 | +#      09/24/12        Michael Pellegrin       Initial Release         V1.0 | 
|---|
|  | 743 | +# | 
|---|
|  | 744 | +# | 
|---|
|  | 745 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 746 | + | 
|---|
|  | 747 | +import sys, os, shutil | 
|---|
|  | 748 | +import translateToPy | 
|---|
|  | 749 | +import mToPy   # touch mToPy to assertain location of installation | 
|---|
|  | 750 | + | 
|---|
|  | 751 | +def convert ( inputFile ): | 
|---|
|  | 752 | +    try: | 
|---|
|  | 753 | +      if os.path.exists( inputFile + '.m') and os.path.isfile( inputFile + '.m'): | 
|---|
|  | 754 | +        checkBackupOutputFile( inputFile ) | 
|---|
|  | 755 | +        convertMToPy( inputFile ) | 
|---|
|  | 756 | +      else: | 
|---|
|  | 757 | +        print 'Specified input file: ' + inputFile + '.m doesn\'t appear to exist' | 
|---|
|  | 758 | +    finally: | 
|---|
|  | 759 | +      print '' | 
|---|
|  | 760 | + | 
|---|
|  | 761 | +def convertMToPy ( inputFileName ): | 
|---|
|  | 762 | +    translateToPy.convertToPython ( inputFileName + '.m', inputFileName + '.py' ) | 
|---|
|  | 763 | + | 
|---|
|  | 764 | +def checkBackupOutputFile ( inputFile ): | 
|---|
|  | 765 | +    mFile = inputFile + '.m' | 
|---|
|  | 766 | +    pyFile = inputFile + '.py' | 
|---|
|  | 767 | +    if os.path.exists( pyFile ): | 
|---|
|  | 768 | +        i=1 | 
|---|
|  | 769 | +        bkupName = pyFile + str(i) | 
|---|
|  | 770 | +        while os.path.exists( bkupName ): | 
|---|
|  | 771 | +            i+=1 | 
|---|
|  | 772 | +            bkupName = pyFile + str(i) | 
|---|
|  | 773 | +        os.rename( pyFile, bkupName ) | 
|---|
|  | 774 | + | 
|---|
|  | 775 | +    shutil.copyfile(mFile, pyFile) | 
|---|
|  | 776 | + | 
|---|
|  | 777 | +if __name__ == "__main__": | 
|---|
|  | 778 | +    convert( sys.argv[1]) | 
|---|
|  | 779 | + | 
|---|
|  | 780 |  | 
|---|
|  | 781 | Property changes on: ../trunk-jpl/scripts/mToPy.py | 
|---|
|  | 782 | ___________________________________________________________________ | 
|---|
|  | 783 | Added: svn:executable | 
|---|
|  | 784 | ## -0,0 +1 ## | 
|---|
|  | 785 | +* | 
|---|
|  | 786 | Index: ../trunk-jpl/scripts/translateToPy.py | 
|---|
|  | 787 | =================================================================== | 
|---|
|  | 788 | --- ../trunk-jpl/scripts/translateToPy.py       (revision 0) | 
|---|
|  | 789 | +++ ../trunk-jpl/scripts/translateToPy.py       (revision 13455) | 
|---|
|  | 790 | @@ -0,0 +1,220 @@ | 
|---|
|  | 791 | + | 
|---|
|  | 792 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 793 | +# | 
|---|
|  | 794 | +program =               'translateToPy.py' | 
|---|
|  | 795 | +version =               '1.0' | 
|---|
|  | 796 | +versionReleaseDate =    '09/24/12' | 
|---|
|  | 797 | +origAuthor =            'Mike Pellegrin' | 
|---|
|  | 798 | +desc = '\nMatlab script conversion into python' | 
|---|
|  | 799 | +# | 
|---|
|  | 800 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 801 | +#                              History | 
|---|
|  | 802 | +#      Date            Developer           Modification | 
|---|
|  | 803 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 804 | +#      09/24/12 Michael Pellegrin      Initial Release     V1.0 | 
|---|
|  | 805 | +# | 
|---|
|  | 806 | +#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | 
|---|
|  | 807 | + | 
|---|
|  | 808 | +import codecs, unicodedata | 
|---|
|  | 809 | +import sys, re, datetime, os | 
|---|
|  | 810 | +import decimal, operator | 
|---|
|  | 811 | + | 
|---|
|  | 812 | + | 
|---|
|  | 813 | +outputLocation = sys.stdout | 
|---|
|  | 814 | +inputFile = "" | 
|---|
|  | 815 | + | 
|---|
|  | 816 | +# other global vars | 
|---|
|  | 817 | +indentLevel = 0 | 
|---|
|  | 818 | + | 
|---|
|  | 819 | + | 
|---|
|  | 820 | +def setupOutputLocation ( outFile ): | 
|---|
|  | 821 | +    if outFile != sys.stdout: | 
|---|
|  | 822 | +               globals()['outputLocation'] = open( outFile, 'w' ) # clobber | 
|---|
|  | 823 | + | 
|---|
|  | 824 | +def translateFile ( inputFile ): | 
|---|
|  | 825 | +       f = codecs.open( inputFile, encoding='utf-8' ) | 
|---|
|  | 826 | +       try: | 
|---|
|  | 827 | +               for line in f: | 
|---|
|  | 828 | +                       # print "in: " +line | 
|---|
|  | 829 | + | 
|---|
|  | 830 | +                       asciiLine = unicodedata.normalize('NFKD', line).encode('ascii','ignore') | 
|---|
|  | 831 | +                       line = asciiLine | 
|---|
|  | 832 | + | 
|---|
|  | 833 | +                       translateLine( line ) | 
|---|
|  | 834 | + | 
|---|
|  | 835 | +       finally: | 
|---|
|  | 836 | +               f.close() | 
|---|
|  | 837 | + | 
|---|
|  | 838 | +def translateLine ( line ): | 
|---|
|  | 839 | + | 
|---|
|  | 840 | +       if len(line) == 1:      # blank line | 
|---|
|  | 841 | +               output( line ) | 
|---|
|  | 842 | + | 
|---|
|  | 843 | +       elif line.split()[0][0] == '%':         # comment line | 
|---|
|  | 844 | +               output("# " + line.replace('%','') ) | 
|---|
|  | 845 | + | 
|---|
|  | 846 | +       else:           # needs cleanup.  this is a real-quick-n-dirty implimentation | 
|---|
|  | 847 | +               #print line | 
|---|
|  | 848 | +               res = line.replace('{','[') | 
|---|
|  | 849 | +               res = res.replace('}',']') | 
|---|
|  | 850 | +               res = res.replace('model','model()') | 
|---|
|  | 851 | +               res = res.replace('SolutionEnum','SolutionEnum()') | 
|---|
|  | 852 | +               res = res.replace('StressTensorEnum','StressTensorEnum()') | 
|---|
|  | 853 | +               res = res.replace('.par','.py') | 
|---|
|  | 854 | +               res = res.replace('=extrude(md,','.extrude(') | 
|---|
|  | 855 | + | 
|---|
|  | 856 | +               res = res.replace('thickness(pos)','thickness[pos]') | 
|---|
|  | 857 | +               res = res.replace('find(md.','numpy.nonzero(md.') | 
|---|
|  | 858 | + | 
|---|
|  | 859 | +               res = res.replace('...','\\') | 
|---|
|  | 860 | +               res = res.replace(';','') | 
|---|
|  | 861 | +               res = res.replace('\n','') | 
|---|
|  | 862 | + | 
|---|
|  | 863 | +               res = convertFieldValues( res ) | 
|---|
|  | 864 | + | 
|---|
|  | 865 | +               output(res) | 
|---|
|  | 866 | + | 
|---|
|  | 867 | +def convertFieldValues ( currentLine ): | 
|---|
|  | 868 | +       # before utilizing regex's {starting w/ eg. \([0-9]\) } for special case: ...(#)... | 
|---|
|  | 869 | +       # i noticed what i'm looking for is only TransientSolution(*). So, ... | 
|---|
|  | 870 | + | 
|---|
|  | 871 | +       res = currentLine | 
|---|
|  | 872 | +       if 'md.results' in currentLine: | 
|---|
|  | 873 | +               res = res.replace('(md.results.','md.results[\'') | 
|---|
|  | 874 | + | 
|---|
|  | 875 | +               if 'TransientSolution(' in currentLine:         # got a TransientSolution([0-9..]) case | 
|---|
|  | 876 | +                       res = res.replace('TransientSolution(','TransientSolution\'][') | 
|---|
|  | 877 | +                       parts = res.split(')') | 
|---|
|  | 878 | +                       res = parts[0] + '][\'' + parts[1].replace('.','') + '\']' + parts[2] | 
|---|
|  | 879 | + | 
|---|
|  | 880 | +               else:                           # handle the other cases for md.results | 
|---|
|  | 881 | + | 
|---|
|  | 882 | +                       res = res.replace('Solution.Vx)','Solution\'][1][\'Vx\']') | 
|---|
|  | 883 | +                       res = res.replace('Solution.Vy)','Solution\'][1][\'Vy\']') | 
|---|
|  | 884 | +                       res = res.replace('Solution.Vz)','Solution\'][1][\'Vz\']') | 
|---|
|  | 885 | +                       res = res.replace('Solution.Vel)','Solution\'][1][\'Vel\']') | 
|---|
|  | 886 | + | 
|---|
|  | 887 | +                       res = res.replace('Solution.Pressure)','Solution\'][1][\'Pressure\']') | 
|---|
|  | 888 | + | 
|---|
|  | 889 | +                       res = res.replace('Solution.StressTensorxx)','Solution\'][1][\'StressTensorxx\']') | 
|---|
|  | 890 | +                       res = res.replace('Solution.StressTensorxy)','Solution\'][1][\'StressTensorxy\']') | 
|---|
|  | 891 | +                       res = res.replace('Solution.StressTensoryy)','Solution\'][1][\'StressTensoryy\']') | 
|---|
|  | 892 | +                       res = res.replace('Solution.StressTensorzz)','Solution\'][1][\'StressTensorzz\']') | 
|---|
|  | 893 | +                       res = res.replace('Solution.StressTensorxz)','Solution\'][1][\'StressTensorxz\']') | 
|---|
|  | 894 | +                       res = res.replace('Solution.StressTensoryz)','Solution\'][1][\'StressTensoryz\']') | 
|---|
|  | 895 | + | 
|---|
|  | 896 | +                       res = res.replace('Solution.Thickness)','Solution\'][1][\'Thickness\']') | 
|---|
|  | 897 | + | 
|---|
|  | 898 | +                       res = res.replace('Solution.Temperature)','Solution\'][1][\'Temperature\']') | 
|---|
|  | 899 | + | 
|---|
|  | 900 | +                       res = res.replace('Solution.BasalforcingsMeltingRate)','Solution\'][1][\'BasalforcingsMeltingRate\']') | 
|---|
|  | 901 | + | 
|---|
|  | 902 | +                       res = res.replace('Solution.SurfaceSlopeX)','Solution\'][1][\'SurfaceSlopeX\']') | 
|---|
|  | 903 | +                       res = res.replace('Solution.SurfaceSlopeY)','Solution\'][1][\'SurfaceSlopeY\']') | 
|---|
|  | 904 | +                       res = res.replace('Solution.SurfaceSlopeZ)','Solution\'][1][\'SurfaceSlopeZ\']') | 
|---|
|  | 905 | + | 
|---|
|  | 906 | +                       res = res.replace('Solution.BedSlopeX)','Solution\'][1][\'BedSlopeX\']') | 
|---|
|  | 907 | +                       res = res.replace('Solution.BedSlopeY)','Solution\'][1][\'BedSlopeY\']') | 
|---|
|  | 908 | +                       res = res.replace('Solution.BedSlopeZ)','Solution\'][1][\'BedSlopeZ\']') | 
|---|
|  | 909 | + | 
|---|
|  | 910 | +                       res = res.replace('Solution.Enthalpy)','Solution\'][1][\'Enthalpy\']') | 
|---|
|  | 911 | +                       res = res.replace('Solution.Waterfraction)','Solution\'][1][\'Waterfraction\']') | 
|---|
|  | 912 | +                       res = res.replace('Solution.Temperature)','Solution\'][1][\'Temperature\']') | 
|---|
|  | 913 | +       return res | 
|---|
|  | 914 | + | 
|---|
|  | 915 | +def output ( line ): | 
|---|
|  | 916 | +       numTabs = indentLevel | 
|---|
|  | 917 | +       while numTabs: | 
|---|
|  | 918 | +               numTabs -= 1 | 
|---|
|  | 919 | +               print >> outputLocation, '\t', | 
|---|
|  | 920 | +       print >> outputLocation, line | 
|---|
|  | 921 | + | 
|---|
|  | 922 | +def outputTopOfSript( inputFile ): | 
|---|
|  | 923 | + | 
|---|
|  | 924 | +       global indentLevel | 
|---|
|  | 925 | + | 
|---|
|  | 926 | +       output("\"\"\"") | 
|---|
|  | 927 | +       output("== == == == == == == == == == == == == == == == == == ==") | 
|---|
|  | 928 | +       output("Auto generated python script for ISSM:   %s" % (inputFile) ) | 
|---|
|  | 929 | +       output("Created on %s via %s Ver %s by %s" % ( datetime.date.today(), program, version, os.getlogin())) | 
|---|
|  | 930 | +       output("== == == == == == == == == == == == == == == == == == ==") | 
|---|
|  | 931 | +       #output("") | 
|---|
|  | 932 | +       output(desc) | 
|---|
|  | 933 | +       output("%s Author: Michael Pellegrin" % (program)) | 
|---|
|  | 934 | +       output("%s Date: %s" % (program, versionReleaseDate)) | 
|---|
|  | 935 | +       output("== == == == == == == == == == == == == == == == == == ==") | 
|---|
|  | 936 | +       output("\"\"\"") | 
|---|
|  | 937 | +       output("") | 
|---|
|  | 938 | + | 
|---|
|  | 939 | +def outputBottomOfScript(): | 
|---|
|  | 940 | + | 
|---|
|  | 941 | +       global indentLevel | 
|---|
|  | 942 | + | 
|---|
|  | 943 | +       output("") | 
|---|
|  | 944 | + | 
|---|
|  | 945 | +def genericImports (): | 
|---|
|  | 946 | +       output("from MatlabFuncs import *") | 
|---|
|  | 947 | +       output("from model import *") | 
|---|
|  | 948 | +       output("from EnumDefinitions import *") | 
|---|
|  | 949 | +       output("from numpy import *") | 
|---|
|  | 950 | + | 
|---|
|  | 951 | +def createImports ( inputFile ): | 
|---|
|  | 952 | +       genericImports() | 
|---|
|  | 953 | + | 
|---|
|  | 954 | +       # cycle through eachline to assertain import needs | 
|---|
|  | 955 | +       f = codecs.open( inputFile, encoding='utf-8' ) | 
|---|
|  | 956 | +       try: | 
|---|
|  | 957 | +               for line in f: | 
|---|
|  | 958 | +                       # print "in: " +line | 
|---|
|  | 959 | + | 
|---|
|  | 960 | +                       # toss blank lines | 
|---|
|  | 961 | +                       if len(line) == 1: | 
|---|
|  | 962 | +                               continue | 
|---|
|  | 963 | + | 
|---|
|  | 964 | +                       asciiLine = unicodedata.normalize('NFKD', line).encode('ascii','ignore') | 
|---|
|  | 965 | +                       line = asciiLine | 
|---|
|  | 966 | + | 
|---|
|  | 967 | +                       for il in importList: | 
|---|
|  | 968 | +                               if line.find(il) != -1: | 
|---|
|  | 969 | +                                       output( "from %s import *" % (il) ) | 
|---|
|  | 970 | +                                       importList.remove(il)   # already got it | 
|---|
|  | 971 | + | 
|---|
|  | 972 | +       finally: | 
|---|
|  | 973 | +               output("") | 
|---|
|  | 974 | +               f.close() | 
|---|
|  | 975 | + | 
|---|
|  | 976 | + | 
|---|
|  | 977 | +def initImportList (): | 
|---|
|  | 978 | +       global importList | 
|---|
|  | 979 | + | 
|---|
|  | 980 | +       importList = [ \ | 
|---|
|  | 981 | +               'triangle'      ,\ | 
|---|
|  | 982 | +               'setmask'       ,\ | 
|---|
|  | 983 | +               'parameterize'  ,\ | 
|---|
|  | 984 | +               'setflowequation'       ,\ | 
|---|
|  | 985 | +               'meshconvert'   ,\ | 
|---|
|  | 986 | +               'solve' ,\ | 
|---|
|  | 987 | +               #'zeros'                                        # -> numpy | 
|---|
|  | 988 | +               ] | 
|---|
|  | 989 | + | 
|---|
|  | 990 | + | 
|---|
|  | 991 | + | 
|---|
|  | 992 | +def convertToPython ( inFile, outFile = sys.stdout ): | 
|---|
|  | 993 | +    #print ' in cnvrt to python w/ file:' + inFile | 
|---|
|  | 994 | +    initImportList() | 
|---|
|  | 995 | +    setupOutputLocation( outFile ) | 
|---|
|  | 996 | +    outputTopOfSript( inFile ) | 
|---|
|  | 997 | +    createImports( inFile ) | 
|---|
|  | 998 | +    translateFile( inFile ) | 
|---|
|  | 999 | +    #    outputBottomOfScript() | 
|---|
|  | 1000 | + | 
|---|
|  | 1001 | + | 
|---|
|  | 1002 | +if __name__ == "__main__": | 
|---|
|  | 1003 | +    #print ' in main w/ arg:' + sys.argv[1]+' '+sys.argv[2] | 
|---|
|  | 1004 | +    if len(sys.argv)==2: | 
|---|
|  | 1005 | +        convertToPython( sys.argv[1], sys.argv[2] ) | 
|---|
|  | 1006 | +    else: | 
|---|
|  | 1007 | +        convertToPython( sys.argv[1] ) | 
|---|
|  | 1008 | + | 
|---|
|  | 1009 | + | 
|---|
|  | 1010 | + | 
|---|
|  | 1011 |  | 
|---|
|  | 1012 | Property changes on: ../trunk-jpl/scripts/translateToPy.py | 
|---|
|  | 1013 | ___________________________________________________________________ | 
|---|
|  | 1014 | Added: svn:executable | 
|---|
|  | 1015 | ## -0,0 +1 ## | 
|---|
|  | 1016 | +* | 
|---|