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

Annotation 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.3 - (hide annotations) (download)
Thu Oct 20 20:58:31 2011 UTC (13 years, 8 months ago) by gforget
Branch: MAIN
Changes since 1.2: +3 -3 lines
- accomodate calc_UV_div revision.

1 gforget 1.1 function [FLD]=diffsmooth2D(fld,dxCsm,dyCsm);
2    
3     %object: implementation (gforget@mit.edu) of a diffusive smoother (Weaver and Courtier 2001)
4 gforget 1.3 %
5 gforget 1.1 %input: fld field to be smoothed (masked with NaN)
6     % dxCsm,dyCsm scale in first/second direction
7     %output:FLD smoothed field
8 gforget 1.3 %
9 gforget 1.1 %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 gforget 1.2 % if mod(it,ceil(smooth2D_nbt/50))==0; fprintf([num2str(it) '/' num2str(smooth2D_nbt) ' done\n']); end;
33 gforget 1.1
34     [dTdxAtU,dTdyAtV]=calc_T_grad(FLD,0);
35     tmpU=dTdxAtU.*smooth2D_Kux;
36     tmpV=dTdyAtV.*smooth2D_Kvy;
37 gforget 1.3 [fldDIV]=calc_UV_div(tmpU,tmpV,{'dh'});
38 gforget 1.1 dFLDdt=smooth2D_dt*fldDIV./rA;
39     FLD=FLD-dFLDdt;
40    
41     end;
42    
43    

  ViewVC Help
Powered by ViewVC 1.1.22