68 const Numeric& FA_ratio_to_dtarget,
69 const Numeric& FB_ratio_to_dtarget,
72 const Numeric& lma_real_ratio_to_dtarget,
73 const Numeric& lma_imag_ratio_to_dtarget,
74 const Numeric& lmb_real_ratio_to_dtarget,
75 const Numeric& lmb_imag_ratio_to_dtarget,
86 FA * FA_ratio_to_dtarget +
88 lma_real_ratio_to_dtarget +
89 lmb * lmb_real_ratio_to_dtarget;
90 dxsec_dtarget += dtarget;
91 dsrc_dtarget += dtarget * nlte + FA * dnlte_dtarget;
98 FA * FA_ratio_to_dtarget +
100 lma_real_ratio_to_dtarget +
101 lmb * lmb_real_ratio_to_dtarget;
105 dFB_dx * dx_dtarget +
106 dFB_dy * dy_dtarget +
107 FB * FB_ratio_to_dtarget +
109 lma_imag_ratio_to_dtarget +
110 lmb * lmb_imag_ratio_to_dtarget;
128 const Range& this_f_grid,
139 const Numeric& line_temperature,
154 const Index& ind_lsn,
164 const bool do_zeeman,
166 const Index& pressure_level_index,
167 const bool do_partials_phase,
176 const Numeric nlte = do_src ? K4 / K3 - 1.0 : 0.0;
177 const Numeric f0 = line_frequency + df_0 + DF_LM + DF_Zeeman * H_mag_Zeeman;
179 Vector LM_Fa(nv), LM_Fb(nv), empty_vector(nv);
180 for (
Index iv = 0; iv < nv; iv++) {
181 LM_Fa[iv] = ((1.0 + G_LM) * CF_A[iv] + Y_LM * CF_B[iv]);
182 if (do_partials_phase)
183 LM_Fb[iv] = ((1.0 + G_LM) * CF_B[iv] - Y_LM * CF_A[iv]);
187 for (
Index ii = 0; ii < flag_partials_position.
nelem(); ii++) {
188 if ((flag_partials[flag_partials_position[ii]] ==
190 if (!do_zeeman)
continue;
193 partials_attenuation[ii](this_f_grid, pressure_level_index);
195 partials_phase[ii](this_f_grid, pressure_level_index);
197 do_src ? partials_src[ii](this_f_grid, pressure_level_index)
200 const Numeric& dF_dH = DF_Zeeman;
203 Vector dfn_dH_div_dF_dH(nv);
208 dfn_dH_div_dF_dH, f0, this_f, temperature);
209 for (
Index iv = 0; iv < nv; iv++) {
210 const Numeric ls_A = ((1.0 + G_LM) * CF_A[iv] + Y_LM * CF_B[iv]),
211 ls_B = ((1.0 + G_LM) * CF_B[iv] - Y_LM * CF_A[iv]);
213 this_partial_attenuation[iv] +=
214 dFa_dx[iv] * dx_dH + ls_A * dfn_dH_div_dF_dH[iv] * dF_dH / C[iv];
215 this_partial_phase[iv] +=
216 dFb_dx[iv] * dx_dH + ls_B * dfn_dH_div_dF_dH[iv] * dF_dH / C[iv];
218 this_partial_src[iv] +=
219 (dFa_dx[iv] * dx_dH +
220 ls_A * dfn_dH_div_dF_dH[iv] * dF_dH / C[iv]) *
224 flag_partials[flag_partials_position[ii]] ==
226 flag_partials[flag_partials_position[ii]] ==
228 flag_partials[flag_partials_position[ii]] ==
232 flag_partials[flag_partials_position[ii]])) {
234 partials_attenuation[ii](this_f_grid, pressure_level_index);
237 ? partials_phase[ii](this_f_grid, pressure_level_index)
240 do_src ? partials_src[ii](this_f_grid, pressure_level_index)
249 dfn_dF, f0, this_f, temperature);
251 for (
Index iv = 0; iv < nv; iv++) {
252 const Numeric ls_A = ((1.0 + G_LM) * CF_A[iv] + Y_LM * CF_B[iv]),
253 ls_B = ((1.0 + G_LM) * CF_B[iv] - Y_LM * CF_A[iv]);
255 this_partial_attenuation[iv] +=
256 dfn_dF[iv] / C[iv] * ls_A + dFa_dx[iv] * dF_dF;
257 if (do_partials_phase)
258 this_partial_phase[iv] +=
259 dfn_dF[iv] / C[iv] * ls_B + dFb_dx[iv] * dF_dF;
261 this_partial_src[iv] +=
262 (dfn_dF[iv] / C[iv] * ls_A + dFa_dx[iv] * dF_dF) * nlte;
267 }
else if (flag_partials[flag_partials_position[ii]] ==
270 partials_attenuation[ii](this_f_grid, pressure_level_index);
273 ? partials_phase[ii](this_f_grid, pressure_level_index)
276 do_src ? partials_src[ii](this_f_grid, pressure_level_index)
279 const Numeric kT2 = BOLTZMAN_CONST * temperature * temperature;
282 const Numeric dK1 = line_E_low / kT2;
283 const Numeric dK2 = dK2_dT / K2;
284 const Numeric dK3 = do_src ? (dK3_dT / K3) : 0.0;
285 const Numeric dK4 = line_E_v_upp >= 0 ? -K4 * line_E_v_upp / kT2 : 0.0;
287 dK1 + dK2 + dQ_dT + dK3;
290 const Numeric dsigma_dT = 0.5 * sigma / temperature;
294 Vector dfn_dT(nv), dF_dT(nv);
309 dfn_dT, f0, this_f, temperature);
311 for (
Index iv = 0; iv < nv; iv++) {
312 const Numeric ls_A = ((1.0 + G_LM) * CF_A[iv] + Y_LM * CF_B[iv]),
313 ls_B = ((1.0 + G_LM) * CF_B[iv] - Y_LM * CF_A[iv]);
315 this_partial_attenuation[iv] +=
316 (dS_dT + dfn_dT[iv] / C[iv] + dFu_dT) *
318 dG_LM_dT * CF_A[iv] +
319 dY_LM_dT * CF_B[iv] +
320 dF_dT[iv] * dFa_dx[iv] +
323 if (do_partials_phase)
324 this_partial_phase[iv] +=
325 (dS_dT + dfn_dT[iv] / C[iv] + dFu_dT) * ls_B +
326 dG_LM_dT * CF_B[iv] -
327 dY_LM_dT * CF_A[iv] +
328 dF_dT[iv] * dFb_dx[iv] +
332 this_partial_src[iv] +=
334 ((dS_dT + dfn_dT[iv] / C[iv] + dFu_dT) *
336 dG_LM_dT * CF_A[iv] +
337 dY_LM_dT * CF_B[iv] +
338 dF_dT[iv] * dFa_dx[iv] +
339 dP_dT * dFa_dy[iv]) +
340 ls_A / K3 * (dK4 - K4 * dK3);
345 }
else if (flag_partials[flag_partials_position[ii]] ==
348 }
else if (flag_partials[flag_partials_position[ii]] ==
351 flag_partials[flag_partials_position[ii]].QuantumIdentity(),
359 partials_attenuation[ii](this_f_grid, pressure_level_index);
362 ? partials_phase[ii](this_f_grid, pressure_level_index)
365 do_src ? partials_src[ii](this_f_grid, pressure_level_index)
368 Numeric dK2_dF0, dK3_dF0 = 0.0;
369 GetLineScalingData_dF0(dK2_dF0,
379 if (do_src) dK3_dF0 /= K3;
380 const Numeric dS_dF0 = dK2_dF0 + dK3_dF0;
387 dfn_dF0, f0, this_f, temperature);
389 const Numeric dx_dF0_part = dF_dF0 / f0, dy_dF0 = gamma * dF_dF0 / f0;
391 for (
Index iv = 0; iv < nv; iv++) {
392 const Numeric ratio = (dS_dF0 + dfn_dF0[iv] / C[iv] - 1.0 / f0);
394 this_partial_phase[iv],
395 this_partial_src[iv],
400 dx_dF0_part * this_f[iv],
420 }
else if (flag_partials[flag_partials_position[ii]] ==
423 flag_partials[flag_partials_position[ii]].QuantumIdentity(),
431 partials_attenuation[ii](this_f_grid, pressure_level_index);
434 ? partials_phase[ii](this_f_grid, pressure_level_index)
437 do_src ? partials_src[ii](this_f_grid, pressure_level_index)
440 const Numeric ratio = 1.0 / line_strength;
442 for (
Index iv = 0; iv < nv; iv++) {
444 this_partial_phase[iv],
445 this_partial_src[iv],
469 }
else if (flag_partials[flag_partials_position[ii]] ==
484 flag_partials[flag_partials_position[ii]].QuantumIdentity(),
489 if (!(lower || upper))
continue;
492 partials_attenuation[ii](this_f_grid, pressure_level_index);
495 ? partials_phase[ii](this_f_grid, pressure_level_index)
498 do_src ? partials_src[ii](this_f_grid, pressure_level_index)
502 exp(-PLANCK_CONST * line_frequency / BOLTZMAN_CONST / temperature);
504 Numeric dK4_dTu = 0., dK3_dTu = 0., dK3_dTl = 0.;
507 dK4_dTu = K4 * line_E_v_upp / line_T_v_upp / line_T_v_upp;
508 dK3_dTu = -K4 * line_E_v_upp / line_T_v_upp / line_T_v_upp /
509 BOLTZMAN_CONST * Gamma / (Gamma - 1.0);
513 dK3_dTl = -K4 * line_E_v_low / line_T_v_low / line_T_v_low /
514 BOLTZMAN_CONST * Gamma / (Gamma - 1.0);
521 const Numeric dK_dTu = nlte * dK3_dTu / K3;
523 const Numeric dsourceC_dTl = -dK3_dTl / K3;
524 const Numeric dsourceC_dTu = (dK4_dTu - dK3_dTu) / K3;
526 for (
Index iv = 0; iv < nv; iv++) {
527 const Numeric ls_A = ((1.0 + G_LM) * CF_A[iv] + Y_LM * CF_B[iv]),
528 ls_B = ((1.0 + G_LM) * CF_B[iv] - Y_LM * CF_A[iv]);
530 this_partial_src[iv] +=
531 (dsourceC_dTl + dsourceC_dTu) * ls_A;
532 this_partial_attenuation[iv] +=
533 (dK_dTl + dK_dTu) * ls_A;
534 if (do_partials_phase)
535 this_partial_phase[iv] +=
536 (dK_dTl + dK_dTu) * ls_B;
543 const Index& species,
544 const Index& isotopologue,
547 if (species not_eq from_jac.
Species() or
565 bool& upper_energy_level,
567 const Index& species,
568 const Index& isotopologue,
571 if (species not_eq from_jac.
Species() or
573 lower_energy_level =
false;
574 upper_energy_level =
false;
577 lower_energy_level = lower_qn.
Compare(
579 upper_energy_level = upper_qn.
Compare(
INDEX Index
The type to use for all integer numbers and indices.
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
const String PROPMAT_SUBSUBTAG
const QuantumNumbers & UpperQuantumNumbers() const noexcept
Return the upper quantum numbers by const reference.
Array< LineshapeNormRecord > lineshape_norm_data
bool Compare(const QuantumNumbers &qn) const
Compare Quantum Numbers Ignores any undefined numbers in the comparison.
Index nelem() const
Number of elements.
void Isotopologue(Index iso)
Set the Isotopologue.
const Numeric BOLTZMAN_CONST
Global constant, the Boltzmann constant [J/K].
static constexpr Index TRANSITION_LOWER_INDEX
Lower level index.
Index nelem() const
Returns the number of elements.
JacPropMatType
List of Jacobian properties for analytical line shape related derivatives.
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
The global header file for ARTS.
static constexpr Index TRANSITION_UPPER_INDEX
Upper level index.
void Species(Index sp)
Set the Species.
constexpr Index get_extent() const
Returns the extent of the range.
void partial_derivatives_lineshape_dependency(ArrayOfMatrix &partials_attenuation, ArrayOfMatrix &partials_phase, ArrayOfMatrix &partials_src, const ArrayOfRetrievalQuantity &flag_partials, const ArrayOfIndex &flag_partials_position, ConstVectorView CF_A, ConstVectorView CF_B, ConstVectorView C, ConstVectorView dFa_dx, ConstVectorView dFb_dx, ConstVectorView dFa_dy, ConstVectorView dFb_dy, ConstVectorView f_grid, const Range &this_f_grid, const Numeric &temperature, const Numeric &sigma, const Numeric &K2, const Numeric &dK2_dT, const Numeric &K3, const Numeric &dK3_dT, const Numeric &K4, const Numeric &line_frequency, const Numeric &line_strength, const Numeric &line_temperature, const Numeric &line_E_low, const Numeric &line_E_v_low, const Numeric &line_E_v_upp, const Numeric &line_T_v_low, const Numeric &line_T_v_upp, const Numeric &Y_LM, const Numeric &dY_LM_dT, const Numeric &G_LM, const Numeric &dG_LM_dT, const Numeric &DF_LM, const Numeric &dDF_LM_dT, const QuantumIdentifier &qi, const Index &ind_ls, const Index &ind_lsn, const Numeric &df_0, const Numeric &ddf_dT, const Numeric &gamma, const Numeric &dgamma_dT, const Numeric &dQ_dT, const Numeric &DF_Zeeman, const Numeric &H_mag_Zeeman, const bool do_zeeman, const Index &pressure_level_index, const bool do_partials_phase, const bool do_src)
Computes all partial derivatives in old method.
void calc_derivative(Numeric &dxsec_dtarget, Numeric &dphase_dtarget, Numeric &dsrc_dtarget, const Numeric &dFA_dx, const Numeric &dFB_dx, const Numeric &dFA_dy, const Numeric &dFB_dy, const Numeric &dx_dtarget, const Numeric &dy_dtarget, const Numeric &FA, const Numeric &FB, const Numeric &FA_ratio_to_dtarget, const Numeric &FB_ratio_to_dtarget, const Numeric &lma, const Numeric &lmb, const Numeric &lma_real_ratio_to_dtarget, const Numeric &lma_imag_ratio_to_dtarget, const Numeric &lmb_real_ratio_to_dtarget, const Numeric &lmb_imag_ratio_to_dtarget, const Numeric &nlte, const Numeric &dnlte_dtarget, const bool do_phase, const bool do_src)
Class to identify and match lines by their quantum numbers.
NUMERIC Numeric
The type to use for all floating point numbers.
Declarations required for the calculation of absorption coefficients.
Computes partial derivatives (old method)
Container class for Quantum Numbers.
This can be used to make arrays out of anything.
constexpr QType Type() const
const QuantumNumbers & LowerQuantumNumbers() const noexcept
Return the lower quantum numbers by const reference.
Constains various line scaling functions.
Array< LineshapeRecord > lineshape_data
A constant view of a Vector.
const std::array< QuantumNumbers, 2 > & QuantumMatch() const
Return the quantum numbers array const reference.
bool line_match_line(const QuantumIdentifier &from_jac, const Index &species, const Index &isotopologue, const QuantumNumbers &lower_qn, const QuantumNumbers &upper_qn)
Does this line match the identifier.
void line_match_level(bool &lower_energy_level, bool &upper_energy_level, const QuantumIdentifier &from_jac, const Index &species, const Index &isotopologue, const QuantumNumbers &lower_qn, const QuantumNumbers &upper_qn)
Match energy level to the identifier.