/[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.4 - (show annotations) (download)
Wed Aug 1 00:27:13 2012 UTC (12 years, 11 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.3: +22 -31 lines

- diffsmooth2D.m diffsmooth2Drotated.m : use newly added gcmfaces_timestep.
- added diffsmooth2Drotated.m : compute slanted diffusive operator coefficients.

1 function [FLD]=diffsmooth2D(fld,dxCsm,dyCsm);
2 %object: diffusive smoother (after Weaver and Courtier 2001)
3 %
4 %input: fld field to be smoothed (masked with NaN)
5 % dxCsm,dyCsm scale in first/second grid direction
6 %output:FLD smoothed field
7 %
8 %asumption: dxCsm/dyCsm are given at U/V points (as DXC/DYC are)
9
10 global mygrid;
11
12 %scale the diffusive operator:
13 dxC=mygrid.DXC; dyC=mygrid.DYC;
14
15 tmp0=dxCsm./dxC; tmp0(isnan(fld))=NaN; tmp00=nanmax(tmp0);
16 tmp0=dyCsm./dyC; tmp0(isnan(fld))=NaN; tmp00=max([tmp00 nanmax(tmp0)]);
17 nbt=tmp00;
18 nbt=ceil(1.1*2*nbt^2);
19
20 dt=1;
21 T=nbt*dt;
22
23 %diffusion operator:
24 Kux=dxCsm.*dxCsm/T/2;
25 Kvy=dyCsm.*dyCsm/T/2;
26
27 %setup problem:
28 myOp.dt=1;
29 myOp.nbt=nbt;
30 myOp.Kux=Kux;
31 myOp.Kvy=Kvy;
32
33 %time step problem:
34 FLD=gcmfaces_timestep(myOp,fld);

  ViewVC Help
Powered by ViewVC 1.1.22