Skip to content

Commit 55cf8bb

Browse files
committed
Change exact solution in momentum balance test
1 parent a2f7fda commit 55cf8bb

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

test/momentum_balance_test.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
def test_convergence_rate_grounded(degree, form):
3838
Lx, Ly = Constant(20e3), Constant(20e3)
3939
h0, dh = Constant(500.0), Constant(100.0)
40+
s0, ds = Constant(150.0), Constant(90.0)
4041
u_inflow = Constant(100.0)
4142

4243
n = firedrake.Constant(glen_flow_law)
@@ -46,28 +47,27 @@ def test_convergence_rate_grounded(degree, form):
4647
ε_c = Constant(0.01)
4748
A = ε_c / τ_c**n
4849

49-
height_above_flotation = Constant(10.0)
50-
d = Constant(-ρ_I / ρ_W * (h0 - dh) + height_above_flotation)
51-
ρ = Constant(ρ_I - ρ_W * d**2 / (h0 - dh) ** 2)
50+
h_L = h0 - dh
51+
s_L = s0 - ds
52+
β = dh / ds * (ρ_I * h_L**2 - ρ_W * (s_L - h_L)**2) / (ρ_I * h_L**2)
5253

5354
# We'll arbitrarily pick this to be the velocity, then we'll find a
5455
# friction coefficient and surface elevation that makes this velocity
5556
# an exact solution of the shelfy stream equations.
5657
def exact_u(x):
57-
Z = A * (ρ * g * h0 / 4) ** n
58-
q = 1 - (1 - (dh / h0) * (x / Lx)) ** (n + 1)
59-
du = Z * q * Lx * (h0 / dh) / (n + 1)
58+
ρ = β * ρ_I * ds / dh
59+
h = h0 - dh * x / Lx
60+
P = ρ * g * h / 4
61+
dP = ρ * g * dh / 4
62+
P0 = ρ * g * h0 / 4
63+
du = Lx * A * (P0 ** (n + 1) - P ** (n + 1)) / ((n + 1) * dP)
6064
return u_inflow + du
6165

6266

63-
# With this choice of friction coefficient, we can take the surface
64-
# elevation to be a linear function of the horizontal coordinate and the
65-
# velocity will be an exact solution of the shelfy stream equations.
66-
β = Constant(0.5)
67-
α = Constant(β * ρ / ρ_I * dh / Lx)
68-
6967
def friction(x):
70-
return α * (ρ_I * g * (h0 - dh * x / Lx)) * exact_u(x) ** (-1 / m)
68+
h = h0 - dh * x / Lx
69+
return (1 - β) * (ρ_I * g * h) * ds / Lx * exact_u(x) ** (-1 / m)
70+
7171

7272
errors, mesh_sizes = [], []
7373
k_min, k_max, num_steps = 5 - degree, 8 - degree, 9
@@ -88,8 +88,7 @@ def friction(x):
8888
u_exact = Function(V).interpolate(as_vector((exact_u(x), 0)))
8989

9090
h = Function(Q).interpolate(h0 - dh * x / Lx)
91-
ds = (1 + β) * ρ / ρ_I * dh
92-
s = Function(Q).interpolate(d + h0 - dh + ds * (1 - x / Lx))
91+
s = Function(Q).interpolate(s0 - ds * x / Lx)
9392

9493
# TODO: adjust the yield stress so that this has a more sensible value
9594
C = Function(Q).interpolate(friction(x))

0 commit comments

Comments
 (0)