[13463] | 1 | import os.path
|
---|
| 2 | import inspect
|
---|
| 3 | import netCDF4
|
---|
[16560] | 4 | import numpy
|
---|
| 5 | from verbose import verbose
|
---|
[13463] | 6 | from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
|
---|
[16560] | 7 | from paterson import paterson
|
---|
| 8 | from SetMarineIceSheetBC import SetMarineIceSheetBC
|
---|
[13463] | 9 |
|
---|
| 10 | #Start defining model parameters here
|
---|
| 11 |
|
---|
| 12 | #Geometry and observation
|
---|
| 13 | f = netCDF4.Dataset('../Data/Pig.nc','r')
|
---|
[16560] | 14 | x = numpy.reshape(f.variables['x'][:],(-1))
|
---|
| 15 | y = numpy.reshape(f.variables['y'][:],(-1))
|
---|
[13463] | 16 | vx_obs = f.variables['vx_obs'][:]
|
---|
| 17 | vy_obs = f.variables['vy_obs'][:]
|
---|
| 18 | index = f.variables['index'][:]
|
---|
| 19 | surface = f.variables['surface'][:]
|
---|
| 20 | thickness = f.variables['thickness'][:]
|
---|
| 21 | f.close()
|
---|
| 22 |
|
---|
| 23 | [md.inversion.vx_obs] =InterpFromMeshToMesh2d(index,x,y,vx_obs,md.mesh.x,md.mesh.y)
|
---|
| 24 | [md.inversion.vy_obs] =InterpFromMeshToMesh2d(index,x,y,vy_obs,md.mesh.x,md.mesh.y)
|
---|
| 25 | [md.geometry.surface] =InterpFromMeshToMesh2d(index,x,y,surface,md.mesh.x,md.mesh.y)
|
---|
| 26 | [md.geometry.thickness]=InterpFromMeshToMesh2d(index,x,y,thickness,md.mesh.x,md.mesh.y)
|
---|
| 27 | md.geometry.bed=md.geometry.surface-md.geometry.thickness
|
---|
| 28 | md.initialization.vx=md.inversion.vx_obs
|
---|
| 29 | md.initialization.vy=md.inversion.vy_obs
|
---|
[16560] | 30 | md.initialization.vz=numpy.zeros((md.mesh.numberofvertices,1))
|
---|
| 31 | md.initialization.pressure=numpy.zeros((md.mesh.numberofvertices,1))
|
---|
[13463] | 32 |
|
---|
| 33 | #Materials
|
---|
[16560] | 34 | md.initialization.temperature=(273.-20.)*numpy.ones((md.mesh.numberofvertices,1))
|
---|
[13463] | 35 | md.materials.rheology_B=paterson(md.initialization.temperature)
|
---|
[16560] | 36 | md.materials.rheology_n=3.*numpy.ones((md.mesh.numberofelements,1))
|
---|
[13463] | 37 | md.initialization.temperature=md.initialization.temperature
|
---|
| 38 |
|
---|
[16560] | 39 | #Damage
|
---|
| 40 | md.damage.D=numpy.zeros((md.mesh.numberofvertices,1))
|
---|
| 41 |
|
---|
[13463] | 42 | #Friction
|
---|
[16560] | 43 | md.friction.coefficient=50.*numpy.ones((md.mesh.numberofvertices,1))
|
---|
[16137] | 44 | md.friction.coefficient[numpy.nonzero(md.mask.groundedice_levelset<0.)[0]]=0.
|
---|
[16560] | 45 | md.friction.p=numpy.ones((md.mesh.numberofelements,1))
|
---|
| 46 | md.friction.q=numpy.ones((md.mesh.numberofelements,1))
|
---|
[13463] | 47 |
|
---|
| 48 | #Numerical parameters
|
---|
[16137] | 49 | md.stressbalance.viscosity_overshoot=0.3
|
---|
| 50 | md.masstransport.stabilization=1.
|
---|
[13463] | 51 | md.verbose=verbose(0)
|
---|
[14310] | 52 | md.settings.waitonlock=30
|
---|
[13463] | 53 | md.timestepping.time_step=1.
|
---|
| 54 | md.timestepping.final_time=2.
|
---|
[16137] | 55 | md.stressbalance.restol=0.05
|
---|
| 56 | md.stressbalance.reltol=1.
|
---|
[13463] | 57 | md.steadystate.reltol=1.
|
---|
[16137] | 58 | md.stressbalance.abstol=float('nan')
|
---|
[13463] | 59 |
|
---|
| 60 | #Boundary conditions:
|
---|
[13471] | 61 | md=SetMarineIceSheetBC(md)
|
---|
[13463] | 62 |
|
---|
| 63 | #Change name so that no test have the same name
|
---|
| 64 | if len(inspect.stack()) > 2:
|
---|
| 65 | md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
|
---|