63 void HapkeAtm1::AtmosModelAlgorithm(
double phase,
double incidence,
double emission) {
67 double xmunot, ymunot;
77 if(p_atmosTau == 0.0) {
86 if(TauOrWhaChanged()) {
88 p_wha2 = 0.5 * p_atmosWha;
89 p_e2 = AtmosModel::En(2, p_atmosTau);
90 p_e3 = AtmosModel::En(3, p_atmosTau);
91 p_e4 = AtmosModel::En(4, p_atmosTau);
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) {
108 p_e5 = AtmosModel::En(5, p_atmosTau);
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;
124 GenerateHahgTablesShadow();
126 GenerateHahgTables();
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);
135 hpsq1 = pow((1.0 + p_atmosHnorm), 2.0) - 1.0;
137 if(incidence == 90.0) {
141 munot = cos((
PI / 180.0) * incidence);
144 maxval = max(1.0e-30, hpsq1 + munot * munot);
145 munotp = p_atmosHnorm / (sqrt(maxval) - 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);
156 mup = p_atmosHnorm / (sqrt(maxval) - 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);
204 sub = NumericalAtmosApprox::OuterFunction;
206 p_atmosAtmSwitch = 1;
208 p_atmosInc = incidence;
209 p_atmosMunot = cos((
PI / 180.0) * incidence);
210 p_atmosSini = sin((
PI / 180.0) * incidence);
211 hahgt = qromb.RombergsMethod(
this, sub, 0, 180);
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);
216 hahgt = qromb.RombergsMethod(
this, sub, 0, 180);
217 gmu = p_gammax * xmu + p_gammay * ymu + hahgt * AtmosWha() / 360.0;
219 hahgt = p_atmosHahgtSpline.Evaluate(incidence, NumericalApproximation::Extrapolate);
220 gmunot = p_gammax * xmunot + p_gammay * ymunot + hahgt;
221 hahgt = p_atmosHahgtSpline.Evaluate(emission, NumericalApproximation::Extrapolate);
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));
239 p_trans = gmunot * gmu;
246 sub = NumericalAtmosApprox::OuterFunction;
248 p_atmosAtmSwitch = 3;
250 p_atmosInc = incidence;
251 p_atmosMunot = cos((
PI / 180.0) * incidence);
252 p_atmosSini = sin((
PI / 180.0) * incidence);
253 hahgt0 = qromb.RombergsMethod(
this, sub, 0, 180);
254 hahgt0 = hahgt0 * AtmosWha() * p_atmosMunot / (360.0 * p_atmosSini);
256 hahgt0 = p_atmosHahgt0Spline.Evaluate(incidence, NumericalApproximation::Extrapolate);
258 p_trans0 = (emunot + hahgt0) * emu;
265 sub = NumericalAtmosApprox::OuterFunction;
267 p_atmosAtmSwitch = 1;
269 hahgt = qromb.RombergsMethod(
this, sub, 90, 180);
270 hahgt = .5 * (p_gammax * xmunot + p_gammay * ymunot - emunot) + hahgt *
273 hahgt = p_atmosHahgtSpline.Evaluate(incidence, NumericalApproximation::Extrapolate);
275 p_transs = (emunot + hahgt) * emu;