c Copyright (C) 2008-2014 Vincent Eymet c c KDISTRIBUTION is free software; you can redistribute it and/or modify c it under the terms of the GNU General Public License as published by c the Free Software Foundation; either version 3, or (at your option) c any later version. c KDISTRIBUTION is distributed in the hope that it will be useful, c but WITHOUT ANY WARRANTY; without even the implied warranty of c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the c GNU General Public License for more details. c You should have received a copy of the GNU General Public License c along with KDISTRIBUTION; if not, see c subroutine mean_tr(n,nu,k,l,tr) implicit none include 'max.inc' c c Purpose: to compute the value of the mean transmittivity from c a discretized nu/k spectrum and a given length "l" c c Inputs: c + n: number of points in the nu/k spectrum c + nu: values of nu c + k: associated values of k c + l: length in meters c c Outputs: c + tr: mean transmittivity c integer i,n double precision l,tau,dnu double precision nu(1:kmax),k(1:kmax) double precision tr double precision func double precision sum c label integer strlen character*(Nchar_mx) label label='subroutine mean_tr' sum=0.0D+0 do i=2,n dnu=nu(i)-nu(i-1) tau=(k(i)+k(i-1))/2.0D+0*l sum=sum+func(tau)*dnu enddo tr=sum/(nu(n)-nu(1)) return end subroutine mean_tr_quad(n,w,kdist,i,band,l,tr) implicit none include 'max.inc' c c Purpose: to compute the value of the mean transmittivity from c a k-distribution data set c c Inputs: c + n: quadrature order c + w: values of the "n" quadrature weights c + kdist: k-distribution data set (for a number of bands) c + i: (parameter that is actually not used) c + band: index of the band the mean transmittivity has to be computed for c + l: length in meters c c Outputs: c + tr: mean transmittivity c integer i,n,band,quad double precision kdist(1:Nbmx,1:Nqmx) double precision w(Nqmx) double precision l,tr,tau double precision func c label integer strlen character*(Nchar_mx) label label='subroutine mean_tr_quad' tr=0.0D+0 do quad=1,n tau=kdist(band,quad)*l tr=tr+func(tau)*w(quad) enddo return end double precision function func(tau) implicit none include 'max.inc' c c Purpose: to provide the attenuation function c c Inputs: c + tau: optical depth c c Outputs: c + func: attenuation along "tau" c double precision tau c label integer strlen character*(Nchar_mx) label label='subroutine func' func=dexp(-tau) return end