1 | import numpy as np
|
---|
2 | from model import *
|
---|
3 | from solve import solve
|
---|
4 | from hydrologyshakti import hydrologyshakti
|
---|
5 | from parameterize import parameterize
|
---|
6 | from export_netCDF import export_netCDF
|
---|
7 | from transient import transient
|
---|
8 | from setmask import setmask
|
---|
9 | from triangle import triangle
|
---|
10 |
|
---|
11 |
|
---|
12 | steps = [1, 2, 3]
|
---|
13 |
|
---|
14 | if 1 in steps:
|
---|
15 | print(' Step 1: Mesh')
|
---|
16 | #Generate unstructured mesh on 1, 000 m square with typical element edge length of 20 m
|
---|
17 | md = triangle(model(), './outline.exp', 20)
|
---|
18 | export_netCDF(md, 'MoulinMesh.nc')
|
---|
19 |
|
---|
20 |
|
---|
21 | if 2 in steps:
|
---|
22 | print(' Step 2: Parameterization')
|
---|
23 | md = loadmodel('MoulinMesh.nc')
|
---|
24 | md = setmask(md, '', '')
|
---|
25 |
|
---|
26 | # Run parameterization script to set up geometry, velocity, material properties, etc.
|
---|
27 | md = parameterize(md, 'moulin.py')
|
---|
28 |
|
---|
29 | # HYDROLOGY SPECIFIC PARAMETERIZATION:
|
---|
30 | # Change hydrology class to Sommers' SHaKTI model
|
---|
31 | md.hydrology = hydrologyshakti()
|
---|
32 |
|
---|
33 | # Define initial water head such that water pressure is 50% of ice overburden pressure
|
---|
34 | md.hydrology.head = 0.5 * md.materials.rho_ice / md.materials.rho_freshwater * md.geometry.thickness + md.geometry.base
|
---|
35 |
|
---|
36 | # Initial subglacial gap height of 0.01m everywhere
|
---|
37 | md.hydrology.gap_height = 0.01 * np.ones(md.mesh.numberofelements)
|
---|
38 |
|
---|
39 | # Typical bed bump bump spacing (2m)
|
---|
40 | md.hydrology.bump_spacing = 2 * np.ones(md.mesh.numberofelements)
|
---|
41 |
|
---|
42 | # Typical bed bump height (0.1m)
|
---|
43 | md.hydrology.bump_height = 0.1 * np.ones(md.mesh.numberofelements)
|
---|
44 |
|
---|
45 | # Define distributed englacial input to the subglacial system (m / yr)
|
---|
46 | # Change the value 0.0 to add distributed input
|
---|
47 | md.hydrology.englacial_input = 0.0 * np.ones(md.mesh.numberofvertices)
|
---|
48 |
|
---|
49 | # Initial Reynolds number (start at Re = 1000 everywhere)
|
---|
50 | md.hydrology.reynolds = 1000. * np.ones(md.mesh.numberofelements)
|
---|
51 |
|
---|
52 | # Set up atmospheric pressure Type I boundary condition at left edge of
|
---|
53 | # domain (outflow, i.e. h = zb at x = xmin)
|
---|
54 | md.hydrology.spchead = np.nan * np.ones(md.mesh.numberofvertices)
|
---|
55 | pos = np.where(np.logical_and(md.mesh.vertexonboundary, md.mesh.x == np.nanmin(md.mesh.x)))
|
---|
56 | md.hydrology.spchead[pos] = md.geometry.base[pos]
|
---|
57 |
|
---|
58 | export_netCDF(md, 'MoulinParam.nc')
|
---|
59 |
|
---|
60 | if 3 in steps:
|
---|
61 | print(' Step 3: Solve!')
|
---|
62 | md = loadmodel('MoulinParam.nc')
|
---|
63 |
|
---|
64 | md.transient = transient.deactivateall(md.transient)
|
---|
65 | md.transient.ishydrology = 1
|
---|
66 |
|
---|
67 | # Specify that you want to run the model on your current computer
|
---|
68 | # Change the number of processors according to your machine (here np = 4)
|
---|
69 | md.cluster = generic('np', 2)
|
---|
70 |
|
---|
71 | # Define the time stepping scheme: run for 90 days with a time step of 1 hr
|
---|
72 | md.timestepping.time_step = 3600. / md.constants.yts # Time step (in years)
|
---|
73 | md.timestepping.final_time = 30. / 365.
|
---|
74 |
|
---|
75 | #Add one moulin with steady input at x = 500, y = 500
|
---|
76 | DistToCenter = np.sqrt((md.mesh.x - 500)**2 + (md.mesh.y - 500)**2)
|
---|
77 | loc = np.where(np.nanmin(DistToCenter) == DistToCenter)
|
---|
78 | time = np.arange(0, md.timestepping.final_time + md.timestepping.time_step, md.timestepping.time_step)
|
---|
79 | md.hydrology.moulin_input = np.zeros((md.mesh.numberofvertices, len(time)))
|
---|
80 | md.hydrology.moulin_input = np.vstack((md.hydrology.moulin_input, time))
|
---|
81 | md.hydrology.moulin_input[loc, :] = 4
|
---|
82 |
|
---|
83 | # Specify no - flux Type 2 boundary conditions on all edges (except
|
---|
84 | # the Type 1 condition set at the outflow above)
|
---|
85 | md.hydrology.neumannflux = np.zeros((md.mesh.numberofelements, len(time)))
|
---|
86 | md.hydrology.neumannflux = np.vstack((md.hydrology.neumannflux, time))
|
---|
87 |
|
---|
88 | md.verbose.solution = 1
|
---|
89 | md = solve(md, 'Transient')
|
---|
90 |
|
---|
91 | export_netCDF(md, 'MoulinTransient.nc')
|
---|