source: issm/trunk/examples/Greenland/Greenland.py@ 26744

Last change on this file since 26744 was 26744, checked in by Mathieu Morlighem, 3 years ago

merged trunk-jpl and trunk for revision 26742

  • Property svn:executable set to *
File size: 3.7 KB
RevLine 
[26559]1import numpy as np
2from paterson import paterson
3from netCDF4 import Dataset
4from InterpFromGridToMesh import InterpFromGridToMesh
5
6#Name and Coordinate system
7md.miscellaneous.name = 'SeaRISEgreenland'
8md.mesh.epsg = 3413
9
10print(' Loading SeaRISE data from NetCDF')
11ncdata = Dataset('../Data/Greenland_5km_dev1.2.nc', mode='r')
12x1 = np.squeeze(ncdata.variables['x1'][:].data)
13y1 = np.squeeze(ncdata.variables['y1'][:].data)
14usrf = np.squeeze(ncdata.variables['usrf'][:].data)
15topg = np.squeeze(ncdata.variables['topg'][:].data)
16velx = np.squeeze(ncdata.variables['surfvelx'][:].data)
17vely = np.squeeze(ncdata.variables['surfvely'][:].data)
18temp = np.squeeze(ncdata.variables['airtemp2m'][:].data)
19smb = np.squeeze(ncdata.variables['smb'][:].data)
20gflux = np.squeeze(ncdata.variables['bheatflx'][:].data)
21ncdata.close()
22
23print(' Interpolating surface and bedrock')
24md.geometry.base = InterpFromGridToMesh(x1, y1, topg, md.mesh.x, md.mesh.y, 0)
25md.geometry.surface = InterpFromGridToMesh(x1, y1, usrf, md.mesh.x, md.mesh.y, 0)
26
27print(' Constructing thickness')
28md.geometry.thickness = md.geometry.surface - md.geometry.base
29
30#Set min thickness to 1 meter
31pos0 = np.nonzero(md.geometry.thickness <= 0)
32md.geometry.thickness[pos0] = 1
33md.geometry.surface = md.geometry.thickness + md.geometry.base
34
35print(' Interpolating velocities ')
36md.inversion.vx_obs = InterpFromGridToMesh(x1, y1, velx, md.mesh.x, md.mesh.y, 0)
37md.inversion.vy_obs = InterpFromGridToMesh(x1, y1, vely, md.mesh.x, md.mesh.y, 0)
38md.inversion.vel_obs = np.sqrt(md.inversion.vx_obs**2 + md.inversion.vy_obs**2)
39md.initialization.vx = md.inversion.vx_obs
40md.initialization.vy = md.inversion.vy_obs
41md.initialization.vz = np.zeros((md.mesh.numberofvertices))
42md.initialization.vel = md.inversion.vel_obs
43
44print(' Interpolating temperatures')
45md.initialization.temperature = InterpFromGridToMesh(x1, y1, temp, md.mesh.x, md.mesh.y, 0) + 273.15
46
47print(' Interpolating surface mass balance')
48md.smb.mass_balance = InterpFromGridToMesh(x1, y1, smb, md.mesh.x, md.mesh.y, 0)
49md.smb.mass_balance = md.smb.mass_balance * md.materials.rho_water / md.materials.rho_ice
50
51print(' Construct basal friction parameters')
52md.friction.coefficient = 30 * np.ones((md.mesh.numberofvertices))
53pos = np.nonzero(md.mask.ocean_levelset < 0)
54md.friction.coefficient[pos] = 0 #no friction applied on floating ice
55md.friction.p = np.ones((md.mesh.numberofelements))
56md.friction.q = np.ones((md.mesh.numberofelements))
57
58print(' Construct ice rheological properties')
59md.materials.rheology_n = 3 * np.ones((md.mesh.numberofelements))
60md.materials.rheology_B = paterson(md.initialization.temperature)
61md.friction.q = np.ones((md.mesh.numberofelements))
62md.friction.p = np.ones((md.mesh.numberofelements))
63
64print(' Set other boundary conditions')
65md.mask.ice_levelset[np.nonzero(md.mesh.vertexonboundary == 1)] = 0
66md.basalforcings.floatingice_melting_rate = np.zeros((md.mesh.numberofvertices))
67md.basalforcings.groundedice_melting_rate = np.zeros((md.mesh.numberofvertices))
68#impose observed temperature on surface
69md.thermal.spctemperature = md.initialization.temperature
70md.masstransport.spcthickness = np.nan * np.ones((md.mesh.numberofvertices))
71
72print(' Set geothermal heat flux')
73md.basalforcings.geothermalflux = InterpFromGridToMesh(x1, y1, gflux, md.mesh.x, md.mesh.y, 0)
74
75print(' Set Pressure')
76md.initialization.pressure = md.materials.rho_ice * md.constants.g * md.geometry.thickness
77
78print(' Single point constraints')
79#Initialize single point constraint arrays
80md.stressbalance.referential = np.nan * np.ones((md.mesh.numberofvertices, 6))
81md.stressbalance.spcvx = np.nan * np.ones((md.mesh.numberofvertices))
82md.stressbalance.spcvy = np.nan * np.ones((md.mesh.numberofvertices))
83md.stressbalance.spcvz = np.nan * np.ones((md.mesh.numberofvertices))
Note: See TracBrowser for help on using the repository browser.