1 |
gforget |
1.2 |
function [FLD]=diffsmooth2Drotated(fld,dxLarge,dxSmall,fldRef); |
2 |
|
|
% |
3 |
|
|
%object: slanted diffusive smoother (after Weaver and Courtier 2001) |
4 |
|
|
% |
5 |
|
|
%input: fld field to be smoothed (masked with NaN) |
6 |
|
|
% dxLarge,dySmall smoothing scale in direction of |
7 |
|
|
% weak,strong fldRef gradient |
8 |
|
|
% fldRef tracer field which gradient defines |
9 |
|
|
% directions of strong,weak smoothing |
10 |
|
|
%output:FLD smoothed field |
11 |
|
|
% |
12 |
|
|
%asumption: dxLarge/dxSmall are given at tracer points (not U/V points) |
13 |
gforget |
1.1 |
|
14 |
|
|
global mygrid; |
15 |
|
|
|
16 |
|
|
dxC=mygrid.DXC; dyC=mygrid.DYC; |
17 |
|
|
dxG=mygrid.DXG; dyG=mygrid.DYG; |
18 |
|
|
rA=mygrid.RAC; |
19 |
|
|
|
20 |
|
|
%scale the diffusive operator: |
21 |
|
|
tmp0=dxLarge./dxC; tmp0(isnan(fld))=NaN; tmp00=nanmax(tmp0); |
22 |
|
|
tmp0=dxLarge./dyC; tmp0(isnan(fld))=NaN; tmp00=max([tmp00 nanmax(tmp0)]); |
23 |
gforget |
1.2 |
nbt=tmp00; |
24 |
|
|
nbt=ceil(1.1*2*nbt^2); |
25 |
gforget |
1.1 |
|
26 |
gforget |
1.2 |
dt=1; |
27 |
|
|
T=nbt*dt; |
28 |
gforget |
1.1 |
|
29 |
gforget |
1.2 |
%diffusion operator: |
30 |
|
|
kLarge=dxLarge.*dxLarge/T/2; |
31 |
|
|
kSmall=dxSmall.*dxSmall/T/2; |
32 |
|
|
[Kux,Kuy,Kvx,Kvy]=diffrotated(kLarge,kSmall,fldRef); |
33 |
|
|
|
34 |
|
|
%setup problem: |
35 |
|
|
myOp.dt=1; |
36 |
|
|
myOp.nbt=nbt; |
37 |
|
|
myOp.Kux=Kux; |
38 |
|
|
myOp.Kuy=Kuy; |
39 |
|
|
myOp.Kvx=Kvx; |
40 |
|
|
myOp.Kvy=Kvy; |
41 |
gforget |
1.1 |
|
42 |
gforget |
1.2 |
%time step problem: |
43 |
|
|
FLD=gcmfaces_timestep(myOp,fld); |
44 |
gforget |
1.1 |
|