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