/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_misc/check_budg.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_misc/check_budg.m

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


Revision 1.1 - (hide annotations) (download)
Tue Feb 3 00:57:32 2015 UTC (10 years, 5 months ago) by gforget
Branch: MAIN
- routine to double check budgets in extensive form (kg/s,J/s,g/s).

1 gforget 1.1 function [budg]=check_budg(budgIn);
2    
3     gcmfaces_global;
4    
5     %tend=read_nctiles(fileName,'tend');
6     %trU=read_nctiles(fileName,'trU');
7     %trV=read_nctiles(fileName,'trV');
8     %trWtop=read_nctiles(fileName,'trWtop');
9     %trWbot=read_nctiles(fileName,'trWbot');
10    
11     tend=budgIn.tend;
12     trU=budgIn.trU;
13     trV=budgIn.trV;
14     trWtop=budgIn.trWtop;
15     trWbot=budgIn.trWbot;
16    
17     %tend(isnan(tend))=0;
18     %trU(isnan(trU))=0; trV(isnan(trV))=0;
19     %trWtop(isnan(trWtop))=0; trWbot(isnan(trWbot))=0;
20    
21     %keyboard;
22    
23     dt=1;
24     units = budgIn.specs.units;
25    
26     %define northern hemisphere as domain of integration
27     nameMask='Northern Hemisphere';
28     mask=mygrid.mskC.*mk3D(mygrid.YC>0,mygrid.mskC);
29     if length(size(tend{1}))<3; mask=mask(:,:,1); end;
30    
31     %edit plot title accordingly
32     descr=nameMask;
33    
34     %compute northern hemisphere integrals
35     budg.tend=NaN*dt;
36     budg.hconv=NaN*dt;
37     budg.zconv=NaN*dt;
38    
39     %compute flux convergence
40     hconv=calc_UV_conv(trU,trV,{});
41     zconv=trWtop-trWbot;
42     %compute sum over domain
43     budg.tend=nansum(tend.*mask);
44     budg.hconv=nansum(hconv.*mask);
45     budg.zconv=nansum(zconv.*mask);
46    
47     budg
48     budg.tend-budg.hconv-budg.zconv
49    

  ViewVC Help
Powered by ViewVC 1.1.22