1 |
function [V,C,H]=ice_recast(v,c,h); |
2 |
%object: recast ice categories after thermodynamical ice growth/melt |
3 |
% (v increments) may result in ice categories outgrowing |
4 |
% their limits ( v/c>h(n) or v/c<h(n-1) ). Here the |
5 |
% recasting to smaller categories is done synchroneously for |
6 |
% all cats., and then the recasting to larger cats. similarly. |
7 |
%inputs: v is the ice volume in each cat |
8 |
% c is the ice concentration in each cat |
9 |
% h is the cat thickness limits |
10 |
%outputs: V,C,H are the recasted vol.,conc., and thick. |
11 |
%note: below, for growing ice, the fraction of ice cover getting |
12 |
% recasted (0<beta<=1) can be changed (default is beta=1). |
13 |
|
14 |
V=v; C=c; H=V./c; |
15 |
nh=size(V,1); |
16 |
nx=size(V,2); |
17 |
|
18 |
%1) recast to thinner categories |
19 |
|
20 |
Vmin=c(3:end,:).*h(2:end-1,:); |
21 |
V0=v(3:end,:); |
22 |
C0=c(3:end,:); |
23 |
|
24 |
dV0=V0.*(V0<Vmin); |
25 |
V(2:end-1,:)=V(2:end-1,:)+dV0; |
26 |
V(3:end,:)=V(3:end,:)-dV0; |
27 |
|
28 |
dC0=C0.*(V0<Vmin); |
29 |
C(2:end-1,:)=C(2:end-1,:)+dC0; |
30 |
C(3:end,:)=C(3:end,:)-dC0; |
31 |
|
32 |
%2) recast to thicker categories |
33 |
|
34 |
Vmax=c(2:end-1,:).*h(2:end-1,:); |
35 |
V1=v(2:end-1,:); |
36 |
C1=c(2:end-1,:); |
37 |
|
38 |
beta=1*ones(size(V1)); |
39 |
% beta=0.5*ones(size(V1)); |
40 |
% beta(1:10,:)=0.25+0.75*([1:10]'-1)/(10)*ones(1,nx); |
41 |
V2=V1+(1./beta-1).*(V1-Vmax); |
42 |
alpha=beta.*V2./V1; |
43 |
beta(V1==0|V1<=Vmax)=0; |
44 |
alpha(V1==0|V1<=Vmax)=0; |
45 |
|
46 |
dV1=alpha.*V1; |
47 |
V(2:end-1,:)=V(2:end-1,:)-dV1; |
48 |
V(3:end,:)=V(3:end,:)+dV1; |
49 |
|
50 |
dC1=beta.*C1; |
51 |
C(2:end-1,:)=C(2:end-1,:)-dC1; |
52 |
C(3:end,:)=C(3:end,:)+dC1; |
53 |
|