c kspectrum (http://www.meso-star.com/en_Products.html) - This file is part of kspectrum c Copyright (C) 2008-2015 - Méso-Star - Vincent Eymet c c This file must be used under the terms of the CeCILL license. c This source file is licensed as described in the file COPYING, which c you should have received as part of this distribution. The terms c are also available at c http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt c subroutine line_truncation(ltr,dorg,tr_dist,ngamma, & nu_min,nu_max,nuc,gamma,usl,line_index, & truncate) implicit none include 'max.inc' c c Purpose: to perform all tests relative to line truncation; a given line (with central wavenumber nuc) c is considered relative to a wavenumber interval [numin,nu_max] c c Input: c + ltr: true if line profiles should be truncated c + dorg: truncate (1) depending on a fixed distance or (2) depending on a number of line width c + tr_dist: fixed truncation distance (inv. cm) c + ngamma: multiple of line width c + nu_min: lower limit of the considered wavenumber interval (inv. cm) c + nu_max: higher limit of the considered wavenumber interval (inv. cm) c + nuc: central wavenumber of the considered line (inv. cm) c + gamma: width of the considered line (inv. cm) c + usl: true if sub-lorentzian profile should be used c + line_index: index of the transition, as provided in the LBL database c c Output: c + truncate: true if the considered line should be truncated c c NOTES: how truncation works now. c This routine is called by "constantk". Lines that should be truncated are added to c the constant lines over [nu_min,nu_max]. Lines that should not be truncated are then examined, and c those that do not vary a lot are also added to the constant lines over [nu_min,nu_max]. Finally, only c lines that should not be truncated and that vary over [nu_min,nu_max] are considered as non constant, c and their contributions are computed for every wavenumber within [nu_min,nu_max]. c Additionnaly, the sum of constant lines contributions can be taken into account or not (in kspectrum). c c Update 2015/05/07: I just realized that when using a sub-lorentzian profile (khi profile correction), c which may be the case for CO2 transitions, those corrected profiles should not be truncated, even if c truncation should be applied for other molecules. c c I/O logical ltr integer dorg double precision tr_dist integer ngamma double precision nu_min,nu_max double precision nuc double precision gamma integer line_index logical usl logical truncate c temp c label integer strlen character*(Nchar_mx) label label='subroutine line_truncation' truncate=.false. if (ltr) then if ((usl).and.(line_index.eq.2)) then c Special case of CO2: if a sub-lorentzian profile should be used, then DO NOT c truncate the line profile ! truncate=.false. c else c In all other cases (other species or no sub-lorentzian correction, even for CO2) c apply ordinary truncation scheme if (dorg.eq.1) then if ((nuc.lt.nu_min-tr_dist).or. & (nuc.gt.nu_max+tr_dist)) then truncate=.true. endif else if (dorg.eq.2) then if ((nuc.lt.nu_min-ngamma*gamma).or. & (nuc.gt.nu_max+ngamma*gamma)) then truncate=.true. endif else call error(label) write(*,*) 'dorg=',dorg write(*,*) 'allowed values: 1, 2' stop endif c endif ! (usl).and.(line_index=2) c endif ! ltr return end