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