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 partial_pressures(P,m,x,i,Nmol_ini,mol_index_ini, & mol_niso_ini,iso_index_ini,iso_Qref_ini,iso_g_ini, & iso_mass_ini,mol_name_ini,Ps,Nmol,mol_index, & mol_niso,iso_index,iso_Qref,iso_g,iso_mass,mol_name) implicit none c c Purpose: to compute the partial pressure of each molecular species, c at each atmospheric level c c Inputs: c + P: the total pressure, at each atmospheric level (atm) c + m: number of atmospheric levels c + Nmol: number of molecular species c + x: abundance of each molecular species, at each level c + i: current atmospheric level c c Outputs: c + Ps: partial pressure of each species (atm) c include 'max.inc' integer m,i,mol,iso double precision P(1:Nmax) double precision x(1:Nmax,1:Nmol_max) double precision Ps(1:Nmol_max) integer Nmol_ini integer mol_index_ini(1:Nmol_max) integer mol_niso_ini(1:Nmol_max) integer iso_index_ini(1:Nmol_max,1:Niso_max) double precision iso_Qref_ini(1:Nmol_max,1:Niso_max) integer iso_g_ini(1:Nmol_max,1:Niso_max) double precision iso_mass_ini(1:Nmol_max,1:Niso_max) character*10 mol_name_ini(1:Nmol_max) integer Nmol,ncf,ind integer mol_index(1:Nmol_max) integer mol_niso(1:Nmol_max) integer iso_index(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) character*10 mol_name(1:Nmol_max) c double precision sum_Ps c Debug c write(*,*) 'This is routine partial_pressures' c write(*,*) 'Nmol_ini=',Nmol_ini c Debug do mol=1,Nmol_ini Ps(mol)=P(i)*x(i,mol) enddo ! mol c Debug c sum_Ps=0.0D+0 c do mol=1,Nmol_ini c write(*,*) 'Ps(',mol,')=',Ps(mol) c sum_Ps=sum_Ps+Ps(mol) c enddo c write(*,*) 'sum_Ps=',sum_Ps c stop c Debug c default: all data take "ini" values Nmol=Nmol_ini do mol=1,Nmol mol_index(mol)=mol_index_ini(mol) mol_niso(mol)=mol_niso_ini(mol) mol_name(mol)=mol_name_ini(mol) do iso=1,mol_niso(mol) iso_index(mol,iso)=iso_index_ini(mol,iso) iso_Qref(mol,iso)=iso_Qref_ini(mol,iso) iso_g(mol,iso)=iso_g_ini(mol,iso) iso_mass(mol,iso)=iso_mass_ini(mol,iso) enddo ! iso enddo ! mol c remove each molecule whose concentration is null 123 continue ncf=0 do mol=1,Nmol if (Ps(mol).eq.0.0D+0) then ncf=1 ind=mol goto 124 endif enddo ! mol 124 continue if (ncf.eq.1) then do mol=ind,Nmol-1 do iso=1,mol_niso(mol+1) iso_index(mol,iso)=iso_index(mol+1,iso) iso_Qref(mol,iso)=iso_Qref(mol+1,iso) iso_g(mol,iso)=iso_g(mol+1,iso) iso_mass(mol,iso)=iso_mass(mol+1,iso) enddo ! iso mol_index(mol)=mol_index(mol+1) mol_niso(mol)=mol_niso(mol+1) mol_name(mol)=mol_name(mol+1) Ps(mol)=Ps(mol+1) enddo ! mol Nmol=Nmol-1 goto 123 endif c Debug c write(*,*) 'This is partial_pressures' c write(*,*) 'Nmol=',Nmol c do mol=1,Nmol c write(*,*) 'mol_index(',mol,')=',mol_index(mol),' Ps=',Ps(mol) c enddo c stop c Debug return end