commit 16bc9476d789578cacdb255cd9fa736a48198c06
parent 636b21618b76b2ebda389b3f4a920002c92affa6
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 23 Sep 2026 11:06:18 +0200
Fix line profile factor
It was computed using the thermodynamic properties at which the tree is
built. But since commit 7da5293 a line can be evaluated at thermodynamic
properties defined by the caller, independent of those associated with
the tree. This commit therefore adds the consideration of the
thermodynamic properties of the user when calculating the factor to be
applied to the line profile.
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/sln_line.c b/src/sln_line.c
@@ -70,6 +70,9 @@ static res_T
line_profile_factor
(const struct sln_tree* tree,
const struct shtr_line* shtr_line,
+ const double concentration,
+ const double pressure,
+ const double temperature,
double* out_profile_factor)
{
/* Star-HITRAN data */
@@ -103,19 +106,19 @@ line_profile_factor
ASSERT(molecule.nisotopes > (size_t)shtr_line->isotope_id_local);
isotope = molecule.isotopes + shtr_line->isotope_id_local;
- nu_c = line_center(shtr_line, tree->args.pressure);
+ nu_c = line_center(shtr_line, pressure);
/* Compute the intensity */
- Ps = tree->args.pressure * mol_params->concentration;
+ Ps = pressure * concentration;
density = (AVOGADRO_NUMBER * Ps);
- density = density / (PERFECT_GAZ_CONSTANT * tree->args.temperature);
+ density = density / (PERFECT_GAZ_CONSTANT * temperature);
density = density * 1e-6; /* Convert in molec.cm^-3 */
/* Compute the partition function. TODO precompute it for molid/isoid */
Q_Tref = isotope->Q296K;
molid = shtr_line->molecule_id;
isoid = shtr_line->isotope_id_local+1/*Local indices start at 1 in BD_TIPS*/;
- T = tree->args.temperature;
+ T = temperature;
BD_TIPS_2017(&molid, &T, &isoid, &gj, &Q_T);
if(Q_T <= 0) {
ERROR(tree->sln,
@@ -135,7 +138,7 @@ line_profile_factor
intensity_ref = shtr_line->intensity/isotope->abundance*iso_abundance;
}
intensity = line_intensity(intensity_ref, shtr_line->lower_state_energy, Q,
- tree->args.temperature, T_REF, nu_c);
+ temperature, T_REF, nu_c);
profile_factor = 1.e2 * density * intensity; /* In m^-1.cm^-1 */
@@ -460,7 +463,8 @@ line_setup
molar_mass = molecule.isotopes[shtr_line.isotope_id_local].molar_mass*1e-3;
/* Setup the line */
- res = line_profile_factor(tree, &shtr_line, &line->profile_factor);
+ res = line_profile_factor(tree, &shtr_line, concentration, pressure,
+ temperature, &line->profile_factor);
if(res != RES_OK) goto error;
line->wavenumber = line_center(&shtr_line, pressure);