forked from sergio66/UMBC_LBL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
broad.m.old
73 lines (63 loc) · 1.96 KB
/
broad.m.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function [brd]=broad(press,press_self,press_ref,air,self,m,T,iGas)
%function [brd]=broad(press,press_self,press_ref,air,self,m,T,iGas)
%compute the broadening by combing air and self broadening
%remember units are in cm-1 per atm at 296 K, so we need the pressures
% press = current AIRS pressure in atm
% press_self = current self pressure in atm
% press_ref = current reference pressure in atm
% air = air broadening cm-1/atm at 296 k
% self = air broadening cm-1/atm at 296 k
% m = power relationship to scale brd wrt temperature
% T = temperature
%iGas = GAS ID
%this eqn is from pg 31 of Genln2 manual
%%%brd=air*(press-press_self)/press_ref + self*press_self/press_ref;
%assume press_ref = 1.0 atm
if (iGas ~= 2) %all gases except CO2
%this is the vectorised code
dummysmall = (self < eps);
dummybig = (self >= eps);
slfb=self.*dummybig;
if (sum(dummysmall) > 0)
if (iGas == 1) %for water, self width ~ 5 x air width
slfs=(5*air).*dummysmall;
else
slfs=air.*dummysmall;
end
else
slfs=zeros(size(self));
end
slf=slfs+slfb;
brd=air*(press-press_self) + slf*press_self;
brd=(296.0/T).^(m).*brd;
else %%%%%%%%%%for CO2
%this is the vectorised code
dummysmall = (self < eps);
dummybig = (self >= eps);
slfb=self.*dummybig;
if (sum(dummysmall) > 0)
slfs=air.*dummysmall;
else
slfs=zeros(size(self));
end
slf=slfs+slfb;
brdf=(press-press_self)*air.*(296.0/T).^(m);
brds=(press_self)*slf.*(296.0/T).^(0.685);
brd=brdf+brds;
end
%%%% this is the non vectorized code
%%if (self < eps)
%% if (iGas == 1)
%% slf=5*air;
%% brd=air*(press-press_self) + slf*press_self;
%% else
%% brd=air*press;
%% end
%%elseif (self >= eps)
%% slf=self;
%% brd=air*(press-press_self) + slf*press_self;
%% end
%%brd=(296.0/T)^(m)*brd;
%%%%if (abs(T-296.0) > eps)
%%%% brd=(296.0/T)^(m)*brd;
%%%% end