[13636] | 1 | import os.path
|
---|
| 2 | import netCDF4
|
---|
| 3 | import numpy
|
---|
| 4 | import inspect
|
---|
[16170] | 5 | from verbose import verbose
|
---|
[13636] | 6 | from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
|
---|
[16170] | 7 | from paterson import paterson
|
---|
| 8 | from SetIceSheetBC import SetIceSheetBC
|
---|
[13636] | 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)
|
---|
[16063] | 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)
|
---|
[17590] | 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
|
---|
[13636] | 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 |
|
---|
[17438] | 42 | #Masstransport
|
---|
| 43 | md.masstransport.calvingrate=0.*numpy.ones((md.mesh.numberofvertices,1))
|
---|
| 44 |
|
---|
[13636] | 45 | #Friction
|
---|
| 46 | md.friction.coefficient=20.*numpy.ones((md.mesh.numberofvertices,1))
|
---|
[15988] | 47 | md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
|
---|
[13636] | 48 | md.friction.p=numpy.ones((md.mesh.numberofelements,1))
|
---|
| 49 | md.friction.q=numpy.ones((md.mesh.numberofelements,1))
|
---|
| 50 |
|
---|
| 51 | #Numerical parameters
|
---|
[15771] | 52 | md.stressbalance.viscosity_overshoot=0.0
|
---|
[15767] | 53 | md.masstransport.stabilization=1.
|
---|
[13636] | 54 | md.thermal.stabilization=1.
|
---|
| 55 | md.verbose=verbose(0)
|
---|
[14102] | 56 | md.settings.waitonlock=30
|
---|
[15771] | 57 | md.stressbalance.restol=0.05
|
---|
[13636] | 58 | md.steadystate.reltol=0.05
|
---|
[15771] | 59 | md.stressbalance.reltol=0.05
|
---|
| 60 | md.stressbalance.abstol=float('NaN')
|
---|
[13636] | 61 | md.timestepping.time_step=1.
|
---|
| 62 | md.timestepping.final_time=3.
|
---|
| 63 |
|
---|
[14826] | 64 | #GIA:
|
---|
| 65 | md.gia.lithosphere_thickness=100.*numpy.ones((md.mesh.numberofvertices,1)); # in km
|
---|
[14902] | 66 | md.gia.mantle_viscosity=1.*10**21*numpy.ones((md.mesh.numberofvertices,1)); # in Pa.s
|
---|
[14826] | 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 |
|
---|
[13636] | 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]
|
---|