-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplicate_hoffman_results.m
182 lines (132 loc) · 6.54 KB
/
replicate_hoffman_results.m
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
% Go crazy! run it a whole bunch of times!
%
clear all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Planet verticies at 1 bar pressure %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%He=54.5;
%Hp=41.0;
ao=6.0268e9; % along x
bo=ao; % along y
co=5.4364e9; % along z
%ao=ao+He*(1/0.5);
%bo=ao+He*(1/0.5);
%co=bo+Hp*(1/0.5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
He_range=[0.01:0.01:0.1]
[n,mm]=size(He_range)
zstep=10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Input variables from Hoffman's Thesis p.97 %
% table 4.3: %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Model_names={'A','A2','A3','A4','B','B2','B3','C','C2','C3','C4','D','E','F','G'};
Tbeam_thesis=[146.68,146.54,146.28,146.68,145.89,146.13,146.27,146.43,146.13,146.30,146.56,146.18,145.90,145.40,144.75];
Tbeam_thesis_seventy_five=[139.58,139.24,138.62,139.58,138.45,139.06,139.42,138.91,138.89,138.60,139.23,138.90,138.63,138.04,137.51];
dz=[zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep,zstep]; % Set dz to zero for autostep
%dz=zstep:0.01:5;
XH2S_i=[410e-6,410e-6,410e-6,410e-6,30.8e-6,30.8e-6,30.8e-6,308e-6,154e-6,308e-6,308e-6,30.8e-6,0.0,30.8e-6,30.8e-6];
XNH3_i=[520e-6,520e-6,520e-6,520e-6,468e-6,468e-6,468e-6,412.5e-6,412.5e-6,412.5e-6,412.5e-6,281e-6,468e-6,468e-6,468e-6];
XH2O_i=(1e-6)*[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0];
XCH4_i=[4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3,4.2e-3];
XPH3_i=[0,6.2e-6,12.4e-6,3.1e-6,12.4e-6,6.2e-6,3.1e-6,9.3e-6,9.3e-6,12.4e-6,6.2e-6,9.3e-6,6.2e-6,12.4e-6,12.4e-6];
XCO=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
P_temp=[70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0,70.0];
T_temp=[489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5,489.5];
g0_i=[900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0];
g0_p=[900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0,900.0];
%g0_p=[1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0,1200.0];
R0e_i=[ao,ao,ao,ao,ao,ao,ao,ao,ao,ao,ao,ao,ao,ao,ao];
R0p_i=[co,co,co,co,co,co,co,co,co,co,co,co,co,co,co];
P0_i=[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0];
T_targ_i=[146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2,146.2];
P_targ_i=[1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848,1.29848];
P_term_i=(0.5/0.0631)*[0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631,0.0631];
use_lindal={'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'};
n_lindal_pts=[27,27,27,27,27,27,27,27,27,27,27,27,27,27,27];
SuperSatSelf_H2S=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
SuperSatSelf_NH3=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
SuperSatSelf_PH3=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
SuperSatSelf_H2O=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
supersatNH3=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.1,0.2];
supersatH2S=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0];
AutoStep_constant_range=8*[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0];
%AutoStep_constant=8;
He=0.034;
XHe_i=[He,He,He,He,He,He,He,He,He,He,He,He,He,He,He];
%AutoStep_range=5.6:0.01:7;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Run TCM, and arrange variables for maintam %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%for kk=1:1%length(AutoStep_range)
AutoStep_constant=8;
for k=1:15
cd TCM_mex
[P,T,XH2,XHe,XH2S,XNH3,XH20,XCH4,XPH3,clouds,DNH4SH,DH2S,DNH3,DH2O,DCH4,DPH3,DSOL,g,mu,ref_w_o,ref_w,z]=TCM(dz(k),XHe_i(k),XH2S_i(k),XNH3_i(k),XH2O_i(k),XCH4_i(k),XPH3_i(k),XCO(k),P_temp(k),T_temp(k),g0_i(k),R0e_i(k),P0_i(k),T_targ_i(k),P_targ_i(k),P_term_i(k),1,27,SuperSatSelf_H2S(k),SuperSatSelf_NH3(k),SuperSatSelf_PH3(k),SuperSatSelf_H2O(k),supersatNH3(k),supersatH2S(k),AutoStep_constant,0.25);
clear TCM;
[me(k),n]=size(P);
cd ..
tcme(1:me(k),1:22,k)=[P(1:me(k)),T(1:me(k)),z(1:me(k)),XH2(1:me(k)),XHe(1:me(k)),XH2S(1:me(k)),XNH3(1:me(k)),XH20(1:me(k)),XCH4(1:me(k)),XPH3(1:me(k)),clouds(1:me(k)),DNH4SH(1:me(k)),DH2S(1:me(k)),DNH3(1:me(k)),DH2O(1:me(k)),DCH4(1:me(k)),DPH3(1:me(k)),DSOL(1:me(k)),g(1:me(k)),mu(1:me(k)),ref_w_o(1:me(k)),ref_w(1:me(k))];
tcmp(1:me(k),1:22,k)=[tcme(1:me(k),1:2,k),(co/ao).*tcme(1:me(k),3,k),tcme(1:me(k),4:22,k)];
end
%load craft;
%Raydirection
%Rayorigin
%Beam pattern parameters
N_ring_one=4;
BWHM=0.33;
f=13.78; %operating frequency in GHz
%select_h2h2_model
%1=joiner
%2=goodman
%3=goodman by joiner
%4=borysow
%5=borysow with orton modification
select_h2h2_model=5;
%select_ammonia_model
%1 original hoffman coding of spilker
%2 toms code joiner-steffes
%3 " berge-gulkis
%4 " mohammed-steffes
%5 " spilker
% Note, 1 and 5 won't work for current Jupiter/adams data set
% spilker correction factor C goes negative, giving negative absorption
% coefficient
select_ammonia_model=1;
%select_water_model
%1 original deboer water vapor model
%2 corrected deboer water vapor model
%3 (to be implemented goodman 1969 water vapor model
select_water_model=1;
include_clouds=0;
Rayorigin=[4.2e10 0 0]
Sphereradius=ao;
Spherecenter=[0 0 0];
Raydirection=[-1 0 0];
% theta=7.889
for j=1:15
if(j==1)
no_ph3=0;
else
no_ph3=1;
end
[Tbeam(j)]= maintamone(Spherecenter,Sphereradius,Raydirection,Rayorigin,tcme(1:me(j),:,j),tcmp(1:me(j),:,j),ao,bo,co,f,no_ph3,select_h2h2_model,select_ammonia_model,select_water_model,include_clouds,N_ring_one,BWHM)
Model_names(j)
me(j)
residual(j)=Tbeam(j)-Tbeam_thesis(j)
end
theta=7.5
Raydirection(1)=-cos(theta*(pi/180))
Raydirection(2)=sin(theta*(pi/180))
for j=1:15
if(j==1)
no_ph3=0;
else
no_ph3=1;
end
[Tbeam_seventy_five(j)]= maintamone(Spherecenter,Sphereradius,Raydirection,Rayorigin,tcme(1:me(j),:,j),tcmp(1:me(j),:,j),ao,bo,co,f,no_ph3,select_h2h2_model,select_ammonia_model,select_water_model,include_clouds,N_ring_one,BWHM)
Model_names(j)
residual_seventy_five(j)=Tbeam_seventy_five(j)-Tbeam_thesis_seventy_five(j)
end