program make_input_files implicit none c c Purpose: to create input data files "composition.in" and "narrowbands.in" c include 'max.inc' include 'formats.inc' c composition file integer Nlevels double precision altitude(1:Nmax) double precision pressure(1:Nmax) double precision temperature(1:Nmax) double precision x(1:Nmax,1:Nmol_max) c narrowband file integer Nbands double precision nu_lo(1:Nbmx) double precision nu_hi(1:Nbmx) double precision nu_min,nu_max,d_nu c temp integer level,molecule,band logical imol_found integer imol,i,j character*(Nchar_mx) input_file character*(Nchar_mx) composition_file character*(Nchar_mx) narrowbands_file character*(Nchar_mx) iso_comp_file character*(Nchar_mx) planet_descriptor c Isotopic composition integer Nmolecules character*10 molec_names(1:Nmol_max) integer mol_index(1:Nmol_max) integer mol_niso(1:Nmol_max) integer iso_index(1:Nmol_max,1:Niso_max) double precision iso_abundance(1:Nmax,1:Nmol_max,1:Niso_max) double precision iso_Qref(1:Nmol_max,1:Niso_max) integer iso_g(1:Nmol_max,1:Niso_max) double precision iso_mass(1:Nmol_max,1:Niso_max) c HITRAN data integer HNmol integer Hmol_index(1:Nmol_max) integer Hmol_niso(1:Nmol_max) character*10 Hmol_name(1:Nmol_max) integer Hiso_index(1:Nmol_max,1:Niso_max) double precision Hiso_abundance(1:Nmol_max,1:Niso_max) double precision Hiso_Qref(1:Nmol_max,1:Niso_max) integer Hiso_g(1:Nmol_max,1:Niso_max) double precision Hiso_mass(1:Nmol_max,1:Niso_max) c label integer strlen character*(Nchar_mx) label label='program make_input_files' c ------------------------------------------------------------- c Beginning of user interface zone c c "planet_descriptor" is a label used by the code for some settings, such as c line-by-line database choices. c There are currently only a few values of "planet_descriptor" that are c recognized by the code: "VENUS VIRA", "EARTH" and "TITAN" c so do not use these values if you do not intend to make very specific c atmospheric calculations; use anything else such as "GENERIC" planet_descriptor='GENERIC' c --------------------------------- c Composition file c --------------------------------- c This file holds the values of altitude, pressure, temperature and composition c for a given numnber of 'levels'. c c "Nlevels" is the number of altitude/pressure/temperature/concentration levels Nlevels=1 c "altitude" should be specified for each level, in unit of meters c This array is currently NOT used by "kspectrum", so a value of zero is fine. altitude(1)=0.0D+0 ! m c altitude(2)=2.0D+2 ! m c altitude(3)=0.0D+0 ! m c altitude(4)=0.0D+0 ! m c "pressure" should be speficied for each level, in units of pascals pressure(1)=1.0D+0*1.013D+5 ! Pa (1 atm) c pressure(2)=1.0D+0*1.013D+5 ! Pa (1 atm) c pressure(2)=0.987166831E-06*1.013D+5 ! Pa (1 atm) c pressure(2)=1.013D+5 ! Pa (1 atm) c pressure(1)=1.013D+6 ! Pa (10 atm) c pressure(4)=1.013D+6 ! Pa (10 atm) c "temperature" should be specified for each level, in units of kelvins temperature(1)=1200.0D+0 ! K c temperature(2)=1500.0D+0 ! K c temperature(3)=600.0D+0 ! K c temperature(4)=600.0D+0 ! K c "Nmolecules" is the number of molecular species in the mixture of gas Nmolecules=3 c "x(level,molecule)" should be specified for each level and for each c molecular species; this array sets the molar fraction (or partial pressure) c of each molecular species, at each level; a value of 1 stands for 100% x(1,1)=0.10D+0 x(1,2)=0.20D-1 x(1,3)=0.05D-1 c x(4,1)=0.5D+0 c x(2,1)=5.0D-2 c x(1,3)=0.10D+0 c x(1,4)=0.00D+0 c "molec_names(molecule)" is the name of each molecular species; use names c that are specified within the "data/molparam_hitran200*.txt" files molec_names(1)='H2O' molec_names(2)='CO2' molec_names(3)='CO' c molec_names(4)='CH4' c --------------------------------- c Narrowbands file c --------------------------------- c This file holds the limits (in units of inverse centimeters) of each c narrowband spectral interval; these intervals are used only for acceleration c purposes in "kspectrum": the code will produce the same spectra for different c narrowband discretization files, only the computation time should change. c "nu_min" is the lower limit of the spectral range you want to produce your spectra for nu_min=100.0D+0 ! cm^{-1} c "nu_max" is the higher limit of the spectral range you want to produce your spectra for nu_max=2500.0D+0 ! cm^{-1} c The provided interval covers the [2-20] cm^-1 range (LW for Earth conditions) c "d_nu" is the narrowband width; a typical value is 20 inverse centimeters for the LW range d_nu=2.50D+1 ! cm^{-1} c End of user-interface zone c ------------------------------------------------------------- if (Nlevels.gt.Nmax) then call error(label) write(*,*) 'Number of levels:',Nlevels write(*,*) 'while maximum allowed is:',Nmax write(*,*) 'please adjust the value of "Nmax" in "max.inc"' write(*,*) 'and recompile' stop endif if (Nmolecules.gt.Nmol_max) then call error(label) write(*,*) 'Number of species:',Nmolecules write(*,*) 'while maximum allowed is:',Nmol_max write(*,*) 'please adjust the value of ' & //'"Nmol_max" in "max.inc"' write(*,*) 'and recompile' stop endif c c ================================================================================================================= c Composition file c composition_file='./composition.in' call write_composition_file(composition_file, & planet_descriptor,Nlevels,Nmolecules,molec_names, & altitude,pressure,temperature,x) c c ================================================================================================================= c Isotopic composition file c c get molecules names and indexes from HITRAN input_file='./molparam_hitran2008.txt' call read_molparam(input_file, & HNmol,Hmol_index,Hmol_niso,Hmol_name, & Hiso_index,Hiso_abundance,Hiso_Qref,Hiso_g,Hiso_mass) do molecule=1,Nmolecules c Set mol_index mol_index(molecule)=molecule c Indentify molecule index 'mol' among HITRAN molecules imol_found=.false. do i=1,HNmol if (molec_names(molecule)(1:strlen(molec_names(molecule))) & .eq.Hmol_name(i)(1:strlen(Hmol_name(i)))) then imol_found=.true. imol=i goto 311 endif enddo ! i 311 continue c Set mol_niso, iso_index, iso_Qref, iso_g, iso_mass, iso_abundance mol_niso(molecule)=Hmol_niso(imol) do j=1,mol_niso(molecule) iso_index(molecule,j)=Hiso_index(imol,j) iso_Qref(molecule,j)=Hiso_Qref(imol,j) iso_g(molecule,j)=Hiso_g(imol,j) iso_mass(molecule,j)=Hiso_mass(imol,j) do level=1,Nlevels iso_abundance(level,molecule,j)=Hiso_abundance(imol,j) enddo ! level enddo ! iso enddo ! mol iso_comp_file='./molparam.in' call write_isotopic_composition_file(iso_comp_file, & Nlevels,Nmolecules,molec_names,mol_index,mol_niso,iso_index, & iso_abundance,iso_Qref,iso_g,iso_mass) c c ================================================================================================================= c Narrowbands file c Nbands=(nu_max-nu_min)/d_nu if (nu_min+d_nu*Nbands.lt.nu_max) then Nbands=Nbands+1 endif if (Nbands.gt.Nbmx) then call error(label) write(*,*) 'Number of narrowbands:',Nbands write(*,*) 'while maximum allowed is:',Nbmx write(*,*) 'please adjust the value of "Nbmx" in "max.inc"' write(*,*) 'and recompile' stop endif do band=1,Nbands nu_lo(band)=nu_min+d_nu*(band-1) nu_hi(band)=nu_min+d_nu*band enddo narrowbands_file='./narrowbands.in' call write_narrowbands_file(narrowbands_file, & Nbands,nu_lo,nu_hi) end