forked from kpoinar/moulin-physical-model
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubglacialsc_fixedS.m
More file actions
74 lines (48 loc) · 1.91 KB
/
subglacialsc_fixedS.m
File metadata and controls
74 lines (48 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%function [t,hw,S,Qout] = subglacialsc(Mr,z,Qin,H,dx,C,tspan,y0) %for
%TestSubglacial.m
function [hw,S,Qout, dydt_out] = subglacialsc_fixedS(Ms,z,Qin_compensated,H,L,C,dt, tspan,y0, opt)
% import constants
%C = makeConstants;
%{
This function solves the coupled differential equations for the subglacial part
It needs the function subglacial_equations_melt_creep to work.
input:
------
Mr = Moulin radius in function of z.
z = Vertical position of modeled Moulin radius (m)
Qin = Supraglacial recharge. Can be constant or a function of time.
H = Ice thickness (m)
dx = Distance between terminus and moulin. Equivalent to channel length L in schoof? (m)
tspan = [t0, tf] vector composed of t initial and t final.
Which will be the current timestep in the single ode solver, and the next timestep
y0 = initial condition
y0(1) = initial/previous timestep value of hw (moulin head)
y0(2) = initial/previous timestep value of S (cross-section area) or the
output:
-------
hw = Moulin head (m)
S = Channel cross-section area (semi-circular)
Qout = Discharge out of the channel
We use ode23s to solve the ODE. is it a stiff ode?
With Matt Covington, we've been using LSODA in python, and ode23s seems to
be the equivalent in matlab.
-look into that
%}
%[t,y] = ode45(@(t,y) subglacial_odefcn(t,y,Mr,z,Qin,H,dx,C), tspan, y0);
Qin = Qin_compensated; %Qin with adds or remove the volume of water squeezed or relaxed when the moulin creep or elastic.
Pw = C.rhow .* C.g .* y0(1);
Pi = C.rhoi .* C.g .* H;
Ms_hw = interp1(z,Ms,y0(1));
hw = y0(1) + 1./Ms_hw .* ( Qin - C.c3.*y0(2).^(5/4) .* sqrt(Pw./L) ); % moulin head (m)
if hw < H
hw = hw;
elseif hw>=H
hw = H;
elseif hw <= 1
hw = 1;
end
dydt_out = 0 ; %C.c1 .* C.c3 * S.^(5./4) .* (Pw./L).^(3./2) ...
% - C.c2 .* ( Pi - Pw ).^C.n .* S;
S = y0(2) + dydt_out*dt;
%end
Qout = C.c3 .* S.^(5/4) .* sqrt( C.rhow*C.g*hw/L); % discharge out the channel