63 void Isotropic2::AtmosModelAlgorithm(
double phase,
double incidence,
71 double f1munot, f1mmunot, f1mmu, f1mu;
72 double xmunot, ymunot;
77 if(p_atmosTau == 0.0) {
86 if(TauOrWhaChanged()) {
88 p_wha2 = 0.5 * p_atmosWha;
89 p_e1 = AtmosModel::En(1, p_atmosTau);
90 p_e1_2 = AtmosModel::En(1, 2.0 * p_atmosTau);
91 p_e2 = AtmosModel::En(2, p_atmosTau);
92 p_e3 = AtmosModel::En(3, p_atmosTau);
93 p_e4 = AtmosModel::En(4, p_atmosTau);
106 p_f1m = log(2.0) - p_em * p_e1 + p_e1_2;
107 p_f2m = -1.0 * (p_f1m + p_em * p_e2 - 1.0);
108 p_f3m = -1.0 * (p_f2m + p_em * p_e3 - 0.5);
109 p_g12 = (p_atmosTau * p_e1 * p_e2 + p_f1m + p_f2m) * 0.5;
110 p_g13 = (p_atmosTau * p_e1 * p_e3 + p_f1m + p_f3m) * (1.0 / 3.0);
124 p_f1 = Eulgam() + log(p_atmosTau) + p_e * p_e1;
125 p_f2 = p_f1 + p_e * p_e2 - 1.0;
126 p_f3 = p_f2 + p_e * p_e3 - 0.5;
127 p_g11p = AtmosModel::G11Prime(p_atmosTau);
128 p_g12p = (p_atmosTau * (p_e1 - p_g11p) + p_em * (p_f1 + p_f2)) * 0.25;
129 p_g13p = (p_atmosTau * (0.5 * p_e1 - p_g12p) + p_em * (p_f1 + p_f3)) * 0.2;
132 p_x0 = p_wha2 * (1.0 + p_wha2 * p_g12);
133 p_y0 = p_wha2 * (p_e2 + p_wha2 * p_g12p);
136 p_delta = (1.0 - (p_x0 + p_y0) - (1.0 - p_atmosWha) / (1.0 - (p_x0 - p_y0))) / (p_atmosWha * (0.5 - p_e3));
139 p_alpha0 = 1.0 + p_wha2 * p_g12 + p_delta * (0.5 - p_e3);
140 p_alpha1 = 0.5 + p_wha2 * p_g13 + p_delta * ((1.0 / 3.0) - p_e4);
141 p_beta0 = p_e2 + p_wha2 * p_g12p + p_delta * (0.5 - p_e3);
142 p_beta1 = p_e3 + p_wha2 * p_g13p + p_delta * ((1.0 / 3.0) - p_e4);
145 if(p_atmosWha == 1.0) {
146 p_e5 = AtmosModel::En(5, p_atmosTau);
147 p_f4m = -1.0 * (p_f3m + p_em * p_e4 - (1.0 / 3.0));
148 p_g14 = (p_atmosTau * p_e1 * p_e4 + p_f1m + p_f4m) * 0.25;
149 p_f4 = p_f3 + p_e * p_e4 - (1.0 / 3.0);
150 p_g14p = (p_atmosTau * (0.5 * p_e1 - p_g13p) + p_em * (p_f1 + p_f4)) * (1.0 / 6.0);
151 p_alpha2 = (1.0 / 3.0) + p_wha2 * p_g14 + p_delta * (0.25 - p_e5);
152 p_beta2 = p_e4 + p_wha2 * p_g14p + p_delta * (0.25 - p_e5);
153 p_fixcon = (p_beta0 * p_atmosTau - p_alpha1 + p_beta1) / ((p_alpha1 + p_beta1) * p_atmosTau + 2.0 * (p_alpha2 + p_beta2));
157 p_gammax = p_wha2 * p_beta0;
158 p_gammay = 1.0 - p_wha2 * p_alpha0;
161 p_sbar = 1.0 - ((2.0 - p_atmosWha * p_alpha0) * p_alpha1 + p_atmosWha * p_beta0 * p_beta1);
163 SetOldTau(p_atmosTau);
164 SetOldWha(p_atmosWha);
168 hpsq1 = pow((1.0 + p_atmosHnorm), 2.0) - 1.0;
169 munot = cos((
PI / 180.0) * incidence);
170 maxval = max(1.0e-30, hpsq1 + munot * munot);
171 munotp = p_atmosHnorm / (sqrt(maxval) - munot);
172 munotp = max(munotp, p_atmosTau / 69.0);
173 mu = cos((
PI / 180.0) * emission);
174 maxval = max(1.0e-30, hpsq1 + mu * mu);
175 mup = p_atmosHnorm / (sqrt(maxval) - mu);
176 mup = max(mup, p_atmosTau / 69.0);
179 xx = -p_atmosTau / max(munotp, 1.0e-30);
187 emunot = exp(-p_atmosTau / munotp);
190 xx = -p_atmosTau / max(mup, 1.0e-30);
198 emu = exp(-p_atmosTau / mup);
203 if(fabs(xx - 1.0) < 1.0e-10) {
205 f1mmunot = xx * (log(1.0 + 1.0 / xx) - p_e1 * emunot +
206 AtmosModel::En(1, p_atmosTau * (1.0 + 1.0 / xx)));
209 f1munot = xx * (log(xx / (1.0 - xx)) + p_e1 / emunot +
210 AtmosModel::Ei(p_atmosTau * (1.0 / xx - 1.0)));
211 f1mmunot = xx * (log(1.0 + 1.0 / xx) - p_e1 * emunot +
212 AtmosModel::En(1, p_atmosTau * (1.0 + 1.0 / xx)));
215 std::string msg =
"Negative length of planetary curvature ";
216 msg +=
"encountered";
217 throw IException(IException::Unknown, msg, _FILEINFO_);
221 if(fabs(xx - 1.0) < 1.0e-10) {
223 f1mmu = xx * (log(1.0 + 1.0 / xx) - p_e1 * emu + AtmosModel::En(1, p_atmosTau * (1.0 + 1.0 / xx)));
226 f1mu = xx * (log(xx / (1.0 - xx)) + p_e1 / emu + AtmosModel::Ei(p_atmosTau * (1.0 / xx - 1.0)));
227 f1mmu = xx * (log(1.0 + 1.0 / xx) - p_e1 * emu + AtmosModel::En(1, p_atmosTau * (1.0 + 1.0 / xx)));
230 std::string msg =
"Negative length of planetary curvature encountered";
231 throw IException(IException::Unknown, msg, _FILEINFO_);
234 xmunot = 1.0 + p_wha2 * f1mmunot + p_delta * munotp * (1.0 - emunot);
235 ymunot = emunot * (1.0 + p_wha2 * f1munot) + p_delta * munotp * (1.0 - emunot);
236 xmu = 1.0 + p_wha2 * f1mmu + p_delta * mup * (1.0 - emu);
237 ymu = emu * (1.0 + p_wha2 * f1mu) + p_delta * mup * (1.0 - emu);
240 if(p_atmosWha == 1.0) {
241 fix = p_fixcon * munotp * (xmunot + ymunot);
242 xmunot = xmunot + fix;
243 ymunot = ymunot + fix;
244 fix = p_fixcon * mup * (xmu + ymu);
250 gmunot = p_gammax * xmunot + p_gammay * ymunot;
251 gmu = p_gammax * xmu + p_gammay * ymu;
254 p_pstd = 0.25 * p_atmosWha * munotp / (munotp + mup) * (xmunot * xmu - ymunot * ymu);
255 p_trans = gmunot * gmu;
258 p_trans0 = emunot * emu;
263 p_transs = (emunot + 0.5 * (p_gammax * xmunot + p_gammay * ymunot - emunot)) * emu;