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