Skip to content

Commit 0c59b72

Browse files
committed
It goes
1 parent b4e7654 commit 0c59b72

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

test/mismip_test.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import numpy as np
12
import firedrake
23
from firedrake import (
34
sqrt, exp, max_value, inner, as_vector, Constant, dx
45
)
5-
from icepack2.model import mass_Balance
6+
from icepack2.model import mass_balance
67
from icepack2.model.variational import (
78
momentum_balance, flow_law, friction_law, calving_terminus
89
)
910
from icepack2.constants import (
10-
gravity, ice_density, glen_flow_law, weertman_sliding_law
11+
gravity, ice_density, water_density, glen_flow_law, weertman_sliding_law
1112
)
1213

1314

@@ -111,6 +112,10 @@ def run_simulation(ny: int):
111112
τ_c = Constant(0.1)
112113
ε_c = Constant(A * τ_c ** n)
113114

115+
ρ_I = Constant(ice_density)
116+
ρ_W = Constant(water_density)
117+
g = Constant(gravity)
118+
114119
# Friction coefficient in MPa (m yr⁻¹)⁻¹ᐟ³
115120
C = Constant(1e-2)
116121
K = C ** (-m) ## TODO: just use 1e6
@@ -119,11 +124,10 @@ def run_simulation(ny: int):
119124
rheo3 = {
120125
"flow_law_exponent": n,
121126
"flow_law_coefficient": ε_c / τ_c ** n,
122-
"sliding_exponent": n,
123-
"sliding_coefficient": u_c / τ_c ** n,
127+
"sliding_exponent": m,
128+
"sliding_coefficient": u_c / τ_c ** m,
124129
}
125130

126-
α = firedrake.Constant(1e-4)
127131
rheo1 = {
128132
"flow_law_exponent": 1,
129133
"flow_law_coefficient": ε_c / τ_c,
@@ -134,8 +138,12 @@ def run_simulation(ny: int):
134138
z = firedrake.Function(Z)
135139
u, M, τ, h = firedrake.split(z)
136140
s = max_value(b + h, (1 - ρ_I / ρ_W) * h)
137-
# TODO: figure this one out
138-
f = None
141+
142+
# TODO: Think very hard about the float mask
143+
p_I = ρ_I * g * h
144+
p_W = ρ_W * g * max_value(0, -(s - h))
145+
N = max_value(0, p_I - p_W)
146+
f = N / (2 * τ_c)
139147

140148
fields = {
141149
"velocity": u,
@@ -163,7 +171,11 @@ def run_simulation(ny: int):
163171
}
164172

165173
print("Initial momentum solve")
174+
α = firedrake.Constant(1e-4)
175+
H = Constant(500.0)
176+
166177
v, N, σ, η = firedrake.TestFunctions(Z)
178+
167179
F_momentum = form_momentum_balance((u, M, τ), (v, N, σ), h, b, H, α, rheo1, rheo3)
168180
F_mass = (h - h_0) * η * dx
169181
F = F_momentum + F_mass
@@ -175,3 +187,7 @@ def run_simulation(ny: int):
175187
n.assign((1 - r) + r * glen_flow_law)
176188
m.assign((1 - r) + r * weertman_sliding_law)
177189
solver.solve()
190+
191+
192+
def test_mismip():
193+
run_simulation(ny=20)

0 commit comments

Comments
 (0)