1 | import inspect
|
---|
2 | import os.path
|
---|
3 | import numpy as np
|
---|
4 | from arch import *
|
---|
5 | from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
|
---|
6 | from paterson import paterson
|
---|
7 | from SetIceSheetBC import SetIceSheetBC
|
---|
8 | from verbose import verbose
|
---|
9 |
|
---|
10 | #Start defining model parameters here
|
---|
11 |
|
---|
12 | # Geometry
|
---|
13 | hmin = 300.0
|
---|
14 | hmax = 1000.0
|
---|
15 | ymin = np.min(md.mesh.y)
|
---|
16 | ymax = np.max(md.mesh.y)
|
---|
17 | xmin = np.min(md.mesh.x)
|
---|
18 | xmax = np.max(md.mesh.x)
|
---|
19 | md.geometry.thickness = hmax + (hmin - hmax) * (md.mesh.y - ymin) / (ymax - ymin) + 0.1 * (hmin - hmax) * (md.mesh.x - xmin) / (xmax - xmin)
|
---|
20 | md.geometry.base = -md.materials.rho_ice / md.materials.rho_water * md.geometry.thickness + 20.0
|
---|
21 | md.geometry.bed = md.geometry.base
|
---|
22 | md.geometry.surface = md.geometry.base + md.geometry.thickness
|
---|
23 |
|
---|
24 | #Initial velocity
|
---|
25 | x = np.array(archread('../Data/SquareSheetConstrained.arch', 'x'))
|
---|
26 | y = np.array(archread('../Data/SquareSheetConstrained.arch', 'y'))
|
---|
27 | vx = np.array(archread('../Data/SquareSheetConstrained.arch', 'vx'))
|
---|
28 | vy = np.array(archread('../Data/SquareSheetConstrained.arch', 'vy'))
|
---|
29 | index = archread('../Data/SquareSheetConstrained.arch', 'index').astype(int)
|
---|
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 = np.zeros((md.mesh.numberofvertices))
|
---|
34 | md.initialization.pressure = np.zeros((md.mesh.numberofvertices))
|
---|
35 |
|
---|
36 | #Materials
|
---|
37 | md.initialization.temperature = (273.0 - 20.0) * np.ones((md.mesh.numberofvertices))
|
---|
38 | md.materials.rheology_B = paterson(md.initialization.temperature)
|
---|
39 | md.materials.rheology_n = 3.0 * np.ones((md.mesh.numberofelements))
|
---|
40 |
|
---|
41 | #Calving
|
---|
42 | md.calving.calvingrate = np.zeros((md.mesh.numberofvertices))
|
---|
43 | md.levelset.spclevelset = np.nan * np.ones((md.mesh.numberofvertices))
|
---|
44 |
|
---|
45 | #Friction
|
---|
46 | md.friction.coefficient = 20.0 * np.ones((md.mesh.numberofvertices))
|
---|
47 | md.friction.coefficient[np.where(md.mask.ocean_levelset < 0.0)[0]] = 0.0
|
---|
48 | md.friction.p = np.ones((md.mesh.numberofelements))
|
---|
49 | md.friction.q = np.ones((md.mesh.numberofelements))
|
---|
50 |
|
---|
51 | #Numerical parameters
|
---|
52 | md.masstransport.stabilization = 1.0
|
---|
53 | md.thermal.stabilization = 1.0
|
---|
54 | md.verbose = verbose(0)
|
---|
55 | md.settings.waitonlock = 30
|
---|
56 | md.stressbalance.restol = 0.05
|
---|
57 | md.steadystate.reltol = 0.05
|
---|
58 | md.stressbalance.reltol = 0.05
|
---|
59 | md.stressbalance.abstol = np.nan
|
---|
60 | md.timestepping.time_step = 1.0
|
---|
61 | md.timestepping.final_time = 3.0
|
---|
62 | md.groundingline.migration = 'None'
|
---|
63 |
|
---|
64 | #Boundary conditions:
|
---|
65 | md = SetIceSheetBC(md)
|
---|
66 |
|
---|
67 | #Change name so that no test have the same name
|
---|
68 | if len(inspect.stack()) > 2:
|
---|
69 | md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
|
---|