Go to the documentation of this file.
43 const Index i = upper[iline];
44 const Index j = lower[iline];
46 A(j, j) -= Bji[iline] * Jij[iline] + Cji[iline];
47 A(i, i) -= Aij[iline] + Bij[iline] * Jij[iline] + Cij[iline];
49 A(j, i) += Aij[iline] + Bij[iline] * Jij[iline] + Cij[iline];
50 A(i, j) += Bji[iline] * Jij[iline] + Cji[iline];
66 const Numeric& total_number_count) {
71 const Index i = upper[iline];
72 const Index j = lower[iline];
76 (
x[i] * Aij[iline] / (
x[j] * Bji[iline] -
x[i] * Bij[iline]));
78 A(j, j) -= Bji[iline] * (Jij[iline] - Lambda[iline] * Source) + Cji[iline];
79 A(i, i) -= Aij[iline] * (1.0 - Lambda[iline]) +
80 Bij[iline] * (Jij[iline] - Lambda[iline] * Source) + Cij[iline];
82 A(j, i) += Aij[iline] * (1.0 - Lambda[iline]) +
83 Bij[iline] * (Jij[iline] - Lambda[iline] * Source) + Cij[iline];
84 A(i, j) += Bji[iline] * (Jij[iline] - Lambda[iline] * Source) + Cji[iline];
103 for (
auto& band: lines) {
104 for (
Index k=0; k<band.NumLines(); k++) {
125 for (
auto& band: lines) {
126 for (
Index k=0; k<band.NumLines(); k++) {
127 Bij[i] = band.A(k) / (c0 * band.F0(k) * band.F0(k) * band.F0(k));
143 for (
auto& band: lines) {
144 for (
Index k=0; k<band.NumLines();k++) {
145 Bji[i] = Bij[i] * band.g_upp(k) / band.g_low(k);
168 const Numeric constant = c0 / T;
173 for (
auto& band: lines) {
174 for (
Index k=0; k<band.NumLines(); k++) {
175 Cji[i] = Cij[i] * exp(constant * band.F0(k)) * band.g_upp(k) / band.g_low(k);
203 for (
Index i = 0; i < nspec; i++) {
206 vmr[i] * (
abs_species[i][0].SpeciesNameMain() ==
"free_electrons"
210 for (
Index j = 0; j < ntrans; j++) {
213 for (
auto& band: lines) {
217 for (
Index k=0; k<band.NumLines(); k++) {
229 Cij[iline] +=
interp(itw, gf1.data, gp) * numden * isot_ratio;
257 for (
Index k=0; k<band.NumLines(); k++) {
258 for (
Index iq = 0; iq < nq; iq++) {
270 for (
Index il = 0; il < nl; il++)
271 if (upper[il] < 0 or lower[il] < 0) i++;
273 throw std::runtime_error(
274 "Must set upper and lower levels completely for all but one level");
279 for (
const Index& l : lower) {
280 if (std::find(upper.cbegin(), upper.cend(), l) == upper.cend())
283 return upper.nelem() - 1;
291 spec not_eq x.Species() or
292 isot not_eq x.Isotopologue() or
293 x.Type() not_eq QuantumIdentifier::TRANSITION;});
295 std::ostringstream os;
297 <<
"does not match the requirements for a line identifier\n"
298 <<
"Your list of species is:\n"
300 <<
"This contains more than one isotopologue or it contains some non-transition type identifiers.\n"
301 <<
"It will therefore fail in current code. You can only input transitions, and a single isotopologue.\n";
303 throw std::runtime_error(os.str());
ArrayOfArrayOfGriddedField1 collision_coefficients(Workspace &ws) noexcept
void check_collision_line_identifiers(const ArrayOfQuantumIdentifier &collision_line_identifiers)
Checks that a WSV is OK or throws a run-time error.
void setCji(Vector &Cji, const Vector &Cij, const ArrayOfArrayOfAbsorptionLines &abs_lines, const Numeric &T)
Set the Cji object.
void nlte_collision_factorsCalcFromCoeffs(Vector &Cij, Vector &Cji, const ArrayOfArrayOfAbsorptionLines &abs_lines, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfGriddedField1 &collision_coefficients, const ArrayOfQuantumIdentifier &collision_line_identifiers, const SpeciesAuxData &isotopologue_ratios, const ConstVectorView vmr, const Numeric &T, const Numeric &P)
Gets collisional factors from coefficients.
bool id_in_line(const Lines &band, const QuantumIdentifier &id, size_t line_index)
Checks if the external quantum identifier match a line's ID.
Index find_first_unique_in_lower(const ArrayOfIndex &upper, const ArrayOfIndex &lower) noexcept
Finds a unique lower state if one exists or returns index to last element.
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
bool id_in_line_lower(const Lines &band, const QuantumIdentifier &id, size_t line_index)
Checks if the external quantum identifier match a line's ID.
ArrayOfQuantumIdentifier collision_line_identifiers(Workspace &ws) noexcept
bool id_in_line_upper(const Lines &band, const QuantumIdentifier &id, size_t line_index)
Checks if the external quantum identifier match a line's ID.
Auxiliary data for isotopologues.
Vector createBji(const Vector &Bij, const ArrayOfArrayOfAbsorptionLines &abs_lines)
Create a Bji object.
Vector createBij(const ArrayOfArrayOfAbsorptionLines &abs_lines)
Create a Bij object.
EnergyLevelMap nlte_field(Workspace &ws) noexcept
This can be used to make arrays out of anything.
Index nelem(const Lines &l)
Number of lines.
Vector createAij(const ArrayOfArrayOfAbsorptionLines &abs_lines)
Create a Aij object.
Structure to store a grid position for higher order interpolation.
Index nelem() const
Returns the number of elements.
Array< Index > ArrayOfIndex
An array of Index.
ArrayOfArrayOfSpeciesTag abs_species(Workspace &ws) noexcept
NUMERIC Numeric
The type to use for all floating point numbers.
Header file for interpolation_poly.cc.
Vector createCji(const Vector &Cij, const ArrayOfArrayOfAbsorptionLines &abs_lines, const Numeric &T)
Create a Cji object.
ArrayOfAbsorptionLines abs_lines(Workspace &ws) noexcept
void nlte_positions_in_statistical_equilibrium_matrix(ArrayOfIndex &upper, ArrayOfIndex &lower, const ArrayOfArrayOfAbsorptionLines &abs_lines, const EnergyLevelMap &nlte_field)
Finds upper and lower states in SEE Matrix.
Deep calculations for NLTE.
void set_constant_statistical_equilibrium_matrix(MatrixView A, VectorView x, const Numeric &sem_ratio, const Index row)
Set a row of the SEE matrix and level distribution vector to constant.
void statistical_equilibrium_equation(MatrixView A, ConstVectorView Aij, ConstVectorView Bij, ConstVectorView Bji, ConstVectorView Cij, ConstVectorView Cji, ConstVectorView Jij, const ArrayOfIndex &upper, const ArrayOfIndex &lower)
Sets up the solution matrix for linear statistical equilibrium equation.
SpeciesAuxData isotopologue_ratios(Workspace &ws) noexcept
const Numeric SPEED_OF_LIGHT
Vector x(Workspace &ws) noexcept
INDEX Index
The type to use for all integer numbers and indices.
void gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac)
The maximum difference from 1 that we allow for a sum check.
A constant view of a Vector.
Index nelem() const
Number of elements.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
const Numeric BOLTZMAN_CONST
Global constant, the Boltzmann constant [J/K].
void dampened_statistical_equilibrium_equation(MatrixView A, ConstVectorView x, ConstVectorView Aij, ConstVectorView Bij, ConstVectorView Bji, ConstVectorView Cij, ConstVectorView Cji, ConstVectorView Jij, ConstVectorView Lambda, const ArrayOfIndex &upper, const ArrayOfIndex &lower, const Numeric &total_number_count)
Sets up the solution matrix for linear dampened statistical equilibrium equation.