-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathCalcBasalTraction.m
executable file
·174 lines (118 loc) · 4.94 KB
/
CalcBasalTraction.m
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
function [tbx,tby,tb,eta] = CalcBasalTraction(CtrlVar,UserVar,MUA,F,options)
%%
%
% [tbx,tby,tb,eta] = CalcBasalTraction(CtrlVar,UserVar,MUA,F,options)
%
% Calculates basal traction from basal velocity using the sliding law.
%
% Returns either nodal or integration point values depending on the values of the logical optional input variables
%
% CalcNodalValues=[true|false]
% CalcIntegrationPointValues=[true|false]
%
% The calculation at integration points is fully consistent with the way basal traction is calculated internally in Ua.
%
% Also returns the effective viscosity at integration points, if CalcIntegrationPointValues=true;
%
%
% Note: This can only be used to calculate basal traction when using the SSTREAM and the Hybrid flow approximation. This will
% not return correct results for the SSHEET approximation!
%
%
%%
arguments
CtrlVar struct
UserVar struct
MUA struct
F {mustBeA(F,{'struct','UaFields','numeric'})}
options.CalcNodalValues logical = false
options.CalcIntegrationPointValues logical = true
options.CalvingFrontColor char = "b"
options.GroundingLineColor char = "r"
options.PlotResults logical = false;
options.FigureTitle string = ""
options.FigureName string = ""
end
eta=[];
if isempty(F.ub)
tbx=[]; tby=[] ; tb=[];
return
end
if options.CalcNodalValues
[tbx,tby,tb] = CalcBasalTractionAtNodes(CtrlVar,UserVar,MUA,F) ;
if options.PlotResults
FindOrCreateFigure(" nodal traction "+options.FigureName) ;
[cbar,~,Par]=QuiverColorGHG(F.x/CtrlVar.PlotXYscale,F.y/CtrlVar.PlotXYscale,tbx,tby) ;
PlotGroundingLines(CtrlVar,MUA,F.GF,[],[],[],color=options.GroundingLineColor);
PlotCalvingFronts(CtrlVar,MUA,F,color=options.CalvingFrontColor);
PlotMuaBoundary(CtrlVar,MUA,"k--");
title(cbar,"(kPa)")
title("Basal tractions at nodal points")
UaPlots(CtrlVar,MUA,F,tb,FigureTitle=" magnitude of basal traction at nodal points ")
title("magnitude of basal traction at nodal points"+options.FigureTitle)
end
end
% Note if both nodal and integration point values are calculated, only the integration point values are returned.
if options.CalcIntegrationPointValues
CtrlVar.uvhMatrixAssembly.ZeroFields=false;
CtrlVar.uvhMatrixAssembly.Ronly=false;
CtrlVar.OnlyCalcBasalDragAndEffectiveViscosity=true ;
[tbx,tby,tb,eta] = CalcBasalTractionAtIntegrationPoints(CtrlVar,UserVar,MUA,F,F) ;
if options.PlotResults
[F.xint,F.yint] = CalcIntegrationPointsCoordinates(MUA) ;
fbt=FindOrCreateFigure(" integration points traction "+options.FigureName) ; clf(fbt);
if options.CalcNodalValues % if nodal values were also calculated, make them comparable by using same scaling as before.
Par.QuiverSameVelocityScalingsAsBefore=1;
else
Par=[];
end
cbar=QuiverColorGHG(F.xint/CtrlVar.PlotXYscale,F.yint/CtrlVar.PlotXYscale,tbx,tby,Par) ;
hold on
PlotGroundingLines(CtrlVar,MUA,F.GF,[],[],[],color=options.GroundingLineColor);
PlotCalvingFronts(CtrlVar,MUA,F,color=options.CalvingFrontColor);
PlotMuaBoundary(CtrlVar,MUA,"k--");
title(cbar,"(kPa)")
title("Basal tractions at integration points"+options.FigureTitle)
UaPlots(CtrlVar,MUA,F,tb,FigureTitle=" magnitude of basal traction at integration points")
title("magnitude of basal traction at integration points")
cbar=UaPlots(CtrlVar,MUA,F,log10(eta),FigureTitle=" effective viscosity"+options.FigureName) ;
title("Effective viscosity at integration points"+options.FigureTitle)
title(cbar,"$\log_{10}(\eta)$",interpreter="latex")
end
end
%%
end
%% local functions
function [tbx,tby,tb] = CalcBasalTractionAtNodes(CtrlVar,UserVar,MUA,F)
narginchk(4,4)
%%
%
% Calculates basal traction from basal velocity using the sliding law.
%
% Returns nodal values
%
% Note: There is a slight inconsistency with respect to how this is done
% internally in Ua in the sense that the floating mask is here evaluated at
% nodes, whereas internally this is done at integration points.
%
%
%%
hf=F.rhow*(F.S-F.B)./F.rho ;
He = HeavisideApprox(CtrlVar.kH,F.h-hf,CtrlVar.Hh0); % 1
delta = DiracDelta(CtrlVar.kH,F.h-hf,CtrlVar.Hh0) ;
[tbx,tby] = ...
BasalDrag(CtrlVar,MUA,He,delta,F.h,F.B,F.S-F.B,F.rho,F.rhow,F.ub,F.vb,F.C,F.m,F.uo,F.vo,F.Co,F.mo,F.ua,F.va,F.Ca,F.ma,F.q,F.g,F.muk,F.V0);
tb=sqrt(tbx.^2+tby.^2);
end
function [tbx,tby,tb,eta] = CalcBasalTractionAtIntegrationPoints(CtrlVar,UserVar,MUA,F0,F1)
narginchk(5,5)
%%
%
% Calculates basal traction from basal velocity using the sliding law at integration points
%
%
%%
RunInfo=[];
[~,~,~,~,tbx,tby,eta]=uvhMatrixAssembly(UserVar,RunInfo,CtrlVar,MUA,F0,F1) ;
tb=sqrt(tbx.^2+tby.^2);
end