source: issm/trunk/test/Par/Pig.py@ 16560

Last change on this file since 16560 was 16560, checked in by Mathieu Morlighem, 11 years ago

merged trunk-jpl and trunk for revision 16554

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