/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_smooth/diffsmooth2D.m
ViewVC logotype

Contents of /MITgcm_contrib/gael/matlab_class/gcmfaces_smooth/diffsmooth2D.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sun Feb 14 17:29:28 2010 UTC (15 years, 5 months ago) by gforget
Branch: MAIN
Changes since 1.1: +1 -1 lines
remove print statement

1 function [FLD]=diffsmooth2D(fld,dxCsm,dyCsm);
2
3 %object: implementation (gforget@mit.edu) of a diffusive smoother (Weaver and Courtier 2001)
4
5 %input: fld field to be smoothed (masked with NaN)
6 % dxCsm,dyCsm scale in first/second direction
7 %output:FLD smoothed field
8
9 %asumption: dxCsm/dyCsm are assumed to be given at the positions of U/V points
10
11 global mygrid;
12
13 dxC=mygrid.DXC; dyC=mygrid.DYC;
14 dxG=mygrid.DXG; dyG=mygrid.DYG;
15 rA=mygrid.RAC;
16
17 %scale the diffusive operator:
18 tmp0=dxCsm./dxC; tmp0(isnan(fld))=NaN; tmp00=nanmax(tmp0);
19 tmp0=dyCsm./dyC; tmp0(isnan(fld))=NaN; tmp00=max([tmp00 nanmax(tmp0)]);
20 smooth2D_nbt=tmp00;
21 smooth2D_nbt=ceil(1.1*2*smooth2D_nbt^2);
22
23 smooth2D_dt=1;
24 smooth2D_T=smooth2D_nbt*smooth2D_dt;
25 smooth2D_Kux=dxCsm.*dxCsm/smooth2D_T/2;
26 smooth2D_Kvy=dyCsm.*dyCsm/smooth2D_T/2;
27
28 %time-stepping loop:
29 FLD=fld;
30
31 for it=1:smooth2D_nbt;
32 % if mod(it,ceil(smooth2D_nbt/50))==0; fprintf([num2str(it) '/' num2str(smooth2D_nbt) ' done\n']); end;
33
34 [dTdxAtU,dTdyAtV]=calc_T_grad(FLD,0);
35 tmpU=dTdxAtU.*smooth2D_Kux;
36 tmpV=dTdyAtV.*smooth2D_Kvy;
37 [fldDIV]=calc_UV_div(tmpU,tmpV);
38 dFLDdt=smooth2D_dt*fldDIV./rA;
39 FLD=FLD-dFLDdt;
40
41 end;
42
43

  ViewVC Help
Powered by ViewVC 1.1.22