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

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

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


Revision 1.2 - (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.1: +30 -71 lines

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

1 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
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 nbt=tmp00;
24 nbt=ceil(1.1*2*nbt^2);
25
26 dt=1;
27 T=nbt*dt;
28
29 %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
42 %time step problem:
43 FLD=gcmfaces_timestep(myOp,fld);
44

  ViewVC Help
Powered by ViewVC 1.1.22