source: issm/trunk-jpl/test/Par/SquareSheetConstrained.py@ 13676

Last change on this file since 13676 was 13676, checked in by Mathieu Morlighem, 12 years ago

NEW: added SquareSheetShelf.py

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1import os.path
2import netCDF4
3import numpy
4import inspect
5from verbose import *
6from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
7from paterson import *
8from SetIceSheetBC import *
9
10#Start defining model parameters here
11
12#Geometry
13hmin=300.
14hmax=1000.
15ymin=numpy.min(md.mesh.y)
16ymax=numpy.max(md.mesh.y)
17
18md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)
19md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness+20.
20md.geometry.surface=md.geometry.bed+md.geometry.thickness
21
22#Initial velocity
23f = netCDF4.Dataset('../Data/SquareSheetConstrained.nc','r')
24x = numpy.reshape(f.variables['x'][:],(-1))
25y = numpy.reshape(f.variables['y'][:],(-1))
26vx = f.variables['vx'][:]
27vy = f.variables['vy'][:]
28index = f.variables['index'][:]
29f.close()
30
31[md.initialization.vx]=InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y)
32[md.initialization.vy]=InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y)
33md.initialization.vz=numpy.zeros((md.mesh.numberofvertices,1))
34md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices,1))
35
36#Materials
37md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices,1))
38md.materials.rheology_B=paterson(md.initialization.temperature)
39md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
40
41#Friction
42pos=numpy.nonzero(md.mask.elementonfloatingice)
43md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
44md.friction.coefficient[md.mesh.elements[pos,:].astype(int)-1]=0.
45md.friction.p=numpy.ones((md.mesh.numberofelements,1))
46md.friction.q=numpy.ones((md.mesh.numberofelements,1))
47
48#Numerical parameters
49md.diagnostic.viscosity_overshoot=0.0
50md.prognostic.stabilization=1.
51md.thermal.stabilization=1.
52md.verbose=verbose(0)
53md.settings.waitonlock=30.
54md.diagnostic.restol=0.05
55md.steadystate.reltol=0.05
56md.diagnostic.reltol=0.05
57md.diagnostic.abstol=float('NaN')
58md.timestepping.time_step=1.
59md.timestepping.final_time=3.
60
61#Boundary conditions:
62md=SetIceSheetBC(md)
63
64#Change name so that no test have the same name
65if len(inspect.stack()) > 2:
66 md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
67
Note: See TracBrowser for help on using the repository browser.