1 |
function [FLD]=diffsmooth2D(fld,dxCsm,dyCsm); |
function [FLD]=diffsmooth2D(fld,dxCsm,dyCsm); |
2 |
|
|
3 |
%object: implementation (gforget@mit.edu) of a diffusive smoother (Weaver and Courtier 2001) |
%object: implementation (gforget@mit.edu) of a diffusive smoother (Weaver and Courtier 2001) |
4 |
|
% |
5 |
%input: fld field to be smoothed (masked with NaN) |
%input: fld field to be smoothed (masked with NaN) |
6 |
% dxCsm,dyCsm scale in first/second direction |
% dxCsm,dyCsm scale in first/second direction |
7 |
%output:FLD smoothed field |
%output:FLD smoothed field |
8 |
|
% |
9 |
%asumption: dxCsm/dyCsm are assumed to be given at the positions of U/V points |
%asumption: dxCsm/dyCsm are assumed to be given at the positions of U/V points |
10 |
|
|
11 |
global mygrid; |
global mygrid; |
34 |
[dTdxAtU,dTdyAtV]=calc_T_grad(FLD,0); |
[dTdxAtU,dTdyAtV]=calc_T_grad(FLD,0); |
35 |
tmpU=dTdxAtU.*smooth2D_Kux; |
tmpU=dTdxAtU.*smooth2D_Kux; |
36 |
tmpV=dTdyAtV.*smooth2D_Kvy; |
tmpV=dTdyAtV.*smooth2D_Kvy; |
37 |
[fldDIV]=calc_UV_div(tmpU,tmpV); |
[fldDIV]=calc_UV_div(tmpU,tmpV,{'dh'}); |
38 |
dFLDdt=smooth2D_dt*fldDIV./rA; |
dFLDdt=smooth2D_dt*fldDIV./rA; |
39 |
FLD=FLD-dFLDdt; |
FLD=FLD-dFLDdt; |
40 |
|
|