[13636] | 1 | import os.path
|
---|
| 2 | import netCDF4
|
---|
| 3 | import numpy
|
---|
| 4 | import inspect
|
---|
| 5 | from verbose import *
|
---|
| 6 | from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
|
---|
| 7 | from paterson import *
|
---|
| 8 | from SetIceSheetBC import *
|
---|
| 9 |
|
---|
| 10 | #Start defining model parameters here
|
---|
| 11 |
|
---|
| 12 | #Geometry
|
---|
[13676] | 13 | hmin=300.
|
---|
| 14 | hmax=1000.
|
---|
[13636] | 15 | ymin=numpy.min(md.mesh.y)
|
---|
| 16 | ymax=numpy.max(md.mesh.y)
|
---|
| 17 |
|
---|
| 18 | md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y.reshape(-1,1)-ymin)/(ymax-ymin)
|
---|
| 19 | md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness+20.
|
---|
| 20 | md.geometry.surface=md.geometry.bed+md.geometry.thickness
|
---|
| 21 |
|
---|
| 22 | #Initial velocity
|
---|
| 23 | f = netCDF4.Dataset('../Data/SquareSheetConstrained.nc','r')
|
---|
| 24 | x = numpy.reshape(f.variables['x'][:],(-1))
|
---|
| 25 | y = numpy.reshape(f.variables['y'][:],(-1))
|
---|
| 26 | vx = f.variables['vx'][:]
|
---|
| 27 | vy = f.variables['vy'][:]
|
---|
| 28 | index = f.variables['index'][:]
|
---|
| 29 | f.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)
|
---|
| 33 | md.initialization.vz=numpy.zeros((md.mesh.numberofvertices,1))
|
---|
| 34 | md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices,1))
|
---|
| 35 |
|
---|
| 36 | #Materials
|
---|
| 37 | md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices,1))
|
---|
| 38 | md.materials.rheology_B=paterson(md.initialization.temperature)
|
---|
| 39 | md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
|
---|
| 40 |
|
---|
| 41 | #Friction
|
---|
| 42 | pos=numpy.nonzero(md.mask.elementonfloatingice)
|
---|
| 43 | md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
|
---|
| 44 | md.friction.coefficient[md.mesh.elements[pos,:].astype(int)-1]=0.
|
---|
| 45 | md.friction.p=numpy.ones((md.mesh.numberofelements,1))
|
---|
| 46 | md.friction.q=numpy.ones((md.mesh.numberofelements,1))
|
---|
| 47 |
|
---|
| 48 | #Numerical parameters
|
---|
| 49 | md.diagnostic.viscosity_overshoot=0.0
|
---|
| 50 | md.prognostic.stabilization=1.
|
---|
| 51 | md.thermal.stabilization=1.
|
---|
| 52 | md.verbose=verbose(0)
|
---|
[14102] | 53 | md.settings.waitonlock=30
|
---|
[13636] | 54 | md.diagnostic.restol=0.05
|
---|
| 55 | md.steadystate.reltol=0.05
|
---|
| 56 | md.diagnostic.reltol=0.05
|
---|
| 57 | md.diagnostic.abstol=float('NaN')
|
---|
| 58 | md.timestepping.time_step=1.
|
---|
| 59 | md.timestepping.final_time=3.
|
---|
| 60 |
|
---|
[14826] | 61 | #GIA:
|
---|
| 62 | md.gia.lithosphere_thickness=100.*numpy.ones((md.mesh.numberofvertices,1)); # in km
|
---|
| 63 | md.materials.lithosphere_shear_modulus=6.7*10**10; # in Pa
|
---|
| 64 | md.materials.lithosphere_density=3.32; # in g/cm^-3
|
---|
| 65 | md.materials.mantle_shear_modulus=1.45*10**11; # in Pa
|
---|
| 66 | md.materials.mantle_viscosity=1.*10**21; # in Pa.s
|
---|
| 67 | md.materials.mantle_density=3.34; # in g/cm^-3
|
---|
| 68 |
|
---|
[13636] | 69 | #Boundary conditions:
|
---|
| 70 | md=SetIceSheetBC(md)
|
---|
| 71 |
|
---|
| 72 | #Change name so that no test have the same name
|
---|
| 73 | if len(inspect.stack()) > 2:
|
---|
| 74 | md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
|
---|
| 75 |
|
---|