8 #include "AtmosModel.h"
10 #include "HapkeAtm1.h"
11 #include "NumericalApproximation.h"
14 #include "IException.h"
20 HapkeAtm1::HapkeAtm1(Pvl &pvl, PhotoModel &pmodel) : AtmosModel(pvl, pmodel) {
67 double xmunot, ymunot;
77 if(p_atmosTau == 0.0) {
88 p_wha2 = 0.5 * p_atmosWha;
98 p_delta = (1.0 - (p_x0 + p_y0) - (1.0 - p_atmosWha) / (1.0 - (p_x0 - p_y0))) / (p_atmosWha * (0.5 - p_e3));
101 p_alpha0 = 1.0 + p_delta * (0.5 - p_e3);
102 p_alpha1 = 0.5 + p_delta * ((1.0 / 3.0) - p_e4);
103 p_beta0 = p_e2 + p_delta * (0.5 - p_e3);
104 p_beta1 = p_e3 + p_delta * ((1.0 / 3.0) - p_e4);
107 if(p_atmosWha == 1.0) {
109 p_alpha2 = (1.0 / 3.0) + p_delta * (0.25 - p_e5);
110 p_beta2 = p_e4 + p_delta * (0.25 - p_e5);
111 p_fixcon = (p_beta0 * p_atmosTau - p_alpha1 + p_beta1) /
112 ((p_alpha1 + p_beta1) * p_atmosTau + 2.0 * (p_alpha2 + p_beta2));
117 p_gammax = p_wha2 * p_beta0;
118 p_gammay = 1.0 - p_wha2 * p_alpha0;
128 p_sbar = 1.0 - ((2.0 - p_atmosWha * p_alpha0) * p_alpha1 + p_atmosWha * p_beta0 * p_beta1) + p_atmosHahgsb;
130 SetOldTau(p_atmosTau);
131 SetOldWha(p_atmosWha);
137 if(incidence == 90.0) {
141 munot = cos((
PI / 180.0) * incidence);
144 maxval = max(1.0e-30, hpsq1 + munot * munot);
146 munotp = max(munotp, p_atmosTau / 69.0);
148 if(emission == 90.0) {
152 mu = cos((
PI / 180.0) * emission);
155 maxval = max(1.0e-30, hpsq1 + mu * mu);
157 mup = max(mup, p_atmosTau / 69.0);
159 maxval = max(1.0e-30, munotp);
160 xx = -p_atmosTau / maxval;
169 emunot = exp(-p_atmosTau / munotp);
172 maxval = max(1.0e-30, mup);
173 xx = -p_atmosTau / maxval;
182 emu = exp(-p_atmosTau / mup);
185 xmunot = 1.0 + p_delta * munotp * (1.0 - emunot);
186 ymunot = emunot + p_delta * munotp * (1.0 - emunot);
187 xmu = 1.0 + p_delta * mup * (1.0 - emu);
188 ymu = emu + p_delta * mup * (1.0 - emu);
191 if(p_atmosWha == 1.0) {
192 fix = p_fixcon * munotp * (xmunot + ymunot);
193 xmunot = xmunot + fix;
194 ymunot = ymunot + fix;
195 fix = p_fixcon * mup * (xmu + ymu);
206 p_atmosAtmSwitch = 1;
208 p_atmosInc = incidence;
209 p_atmosMunot = cos((
PI / 180.0) * incidence);
210 p_atmosSini = sin((
PI / 180.0) * incidence);
212 gmunot = p_gammax * xmunot + p_gammay * ymunot + hahgt *
AtmosWha() / 360.0;
213 p_atmosInc = emission;
214 p_atmosMunot = cos((
PI / 180.0) * emission);
215 p_atmosSini = sin((
PI / 180.0) * emission);
217 gmu = p_gammax * xmu + p_gammay * ymu + hahgt *
AtmosWha() / 360.0;
220 gmunot = p_gammax * xmunot + p_gammay * ymunot + hahgt;
222 gmu = p_gammax * xmu + p_gammay * ymu + hahgt;
228 phasefn = (1.0 - p_atmosHga * p_atmosHga) / pow(1.0 + 2.0 * p_atmosHga * 0.0 + p_atmosHga * p_atmosHga, 1.5);
231 phasefn = (1.0 - p_atmosHga * p_atmosHga) /
232 pow(1.0 + 2.0 * p_atmosHga * cos((
PI / 180.0) * phase) + p_atmosHga * p_atmosHga, 1.5);
235 p_pstd = 0.25 * p_atmosWha * munotp / (munotp + mup) *
236 ((xmunot * xmu - ymunot * ymu) + (phasefn - 1.0) * (1.0 - emu * emunot));
248 p_atmosAtmSwitch = 3;
250 p_atmosInc = incidence;
251 p_atmosMunot = cos((
PI / 180.0) * incidence);
252 p_atmosSini = sin((
PI / 180.0) * incidence);
254 hahgt0 = hahgt0 *
AtmosWha() * p_atmosMunot / (360.0 * p_atmosSini);
267 p_atmosAtmSwitch = 1;
270 hahgt = .5 * (p_gammax * xmunot + p_gammay * ymunot - emunot) + hahgt *