Skip to content

Commit 9f58116

Browse files
committed
Held-Suarez Te bugfix
In the troposphere, there was a bug in the meridional dependence of Te in the Held-Suarez part. I corrected the wrong cos^4 dependence to be the correct cos^2 dependence.
1 parent 5001c53 commit 9f58116

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

Te_analytic.m

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function TePV=Te_analytic(lat,pres,days,limlatSH,limlatNH,A0_SH,A0_NH,A1_SH,A1_NH,T_strat,epsS,epsN,p_hsin,p_bdin,filename)
22
% Computes analytic profile as a function of latitude, pressure, and day of the year, approximating radiatively found profiles
3-
%
3+
%
44
% Inputs are:
55
% STRATOSPHERE:
66
% lat: latitude for output grid [deg]
@@ -17,7 +17,7 @@
1717
% p_bdin: for pressures below p_bdin [hPa, size latin x days], Tin is used.
1818
% standard: 100hPa
1919
% for p_bdin < p < p_hsin, linear interpolation between the two
20-
% filename, if present, is the name of the file containing final tau.
20+
% filename, if present, is the name of the file containing final tau.
2121
% For usage with FMS, this should be [some directory/]temp.nc.
2222
% If empty, no file will be created.
2323
%
@@ -85,7 +85,7 @@
8585
AS(:,II) = AS(:,II(end)+1)*ones(size(II))'; % choice B: constant amplitude above p1
8686

8787
Te0 = zeros(size(Te,1),size(Te,2),t_length); %this will be the stratospheric Te
88-
for d=1:t_length
88+
for d=1:t_length
8989
cosNH = cos(2*pi*(days(d ))/365); %days(d)-349 for realistic solstice, but needs change in Held-Suarez as well
9090
cosSH = cos(2*pi*(days(d-182.5))/365); %days(d)-166.5 for realistic solstice
9191
if(cosNH>0)
@@ -127,7 +127,7 @@
127127
else
128128
eps=epsN*cos(2*pi*days(d)/365);
129129
end
130-
TeHS(l,k,d)=max(T_strat,(T0 - delT*(sin(lat(l)*pi/180).^2) - eps*sin(lat(l)*pi/180)- delv*log(sigma(k)).*(cos(lat(l)*pi/180).^4)).*(sigma(k)^kap));
130+
TeHS(l,k,d)=max(T_strat,(T0 - delT*(sin(lat(l)*pi/180).^2) - eps*sin(lat(l)*pi/180)- delv*log(sigma(k)).*(cos(lat(l)*pi/180).^2)).*(sigma(k)^kap));
131131
end
132132
end
133133
end
@@ -144,7 +144,7 @@
144144
III=find(pres <= p_bdin(j,d));
145145
TePV(j,III,d) = Te0(j,III,d);
146146
end
147-
147+
148148
end
149149

150150

@@ -173,13 +173,13 @@
173173
phalf = zeros(length(pres)+1,1);
174174
phalf(2:end-1) = pres(2:end) - diff(pres)/2;
175175
phalf(end) = 1e3;
176-
177-
176+
177+
178178
Te = zeros(length(lon),length(lat),length(pres),length(days));
179179
for l=1:length(lon)
180180
Te(l,:,:,:)=TePV;
181181
end
182-
182+
183183
ncid = netcdf.create(filename,'64BIT_OFFSET');
184184
% define dimensions and variables
185185
lond_id = netcdf.defDim(ncid,'lon',length(lon));
@@ -189,7 +189,7 @@
189189
pd_id = netcdf.defDim(ncid,'pfull',length(pres'));
190190
phd_id = netcdf.defDim(ncid,'phalf',length(phalf));
191191
td_id = netcdf.defDim(ncid,'time',netcdf.getConstant('NC_UNLIMITED'));
192-
192+
193193
lon_id = netcdf.defVar(ncid,'lon','double',lond_id);
194194
netcdf.putAtt(ncid,lon_id,'long_name','longitude');
195195
netcdf.putAtt(ncid,lon_id,'units','degrees_E');
@@ -224,14 +224,14 @@
224224
netcdf.putAtt(ncid,t_id,'units','days since 0000-00-00 00:00:00');
225225
%netcdf.putAtt(ncid,t_id,'calendar_type','NO_CALENDAR'); %THIRTY_DAY_MONTHS %THIRTY_DAY_MONTHS
226226
%netcdf.putAtt(ncid,t_id,'calendar','NO_CALENDAR'); %writetempin_time.m
227-
227+
228228
T_id = netcdf.defVar(ncid,'temp','double',[lond_id,latd_id,pd_id,td_id]);
229229
netcdf.putAtt(ncid,T_id,'long_name','radiative relaxation temperature');
230230
netcdf.putAtt(ncid,T_id,'units','deg_K');
231231
netcdf.putAtt(ncid,T_id,'valid_range',[0,500]);
232232
netcdf.putAtt(ncid,T_id,'missing_value',-1.e+10);
233-
234-
233+
234+
235235
netcdf.endDef(ncid);
236236
% write fields
237237
netcdf.putVar(ncid,lon_id,lon);
@@ -242,10 +242,9 @@
242242
netcdf.putVar(ncid,ph_id,phalf);
243243
netcdf.putVar(ncid,t_id,0,length(days),days);
244244
netcdf.putVar(ncid,T_id,[0,0,0,0],[size(Te,1),size(Te,2),size(Te,3),size(Te,4)],Te);
245-
246-
245+
246+
247247
netcdf.close(ncid)
248-
248+
249249
end
250250
end
251-

0 commit comments

Comments
 (0)