source: CONFIG/publications/ICOLMDZORINCA_CO2_Transport_GMD_2023/INCA/src/INCA_SRC/mr_xform.F90 @ 6610

Last change on this file since 6610 was 6610, checked in by acosce, 10 months ago

INCA used for ICOLMDZORINCA_CO2_Transport_GMD_2023

File size: 6.4 KB
Line 
1!$Id: mr_xform.F90 10 2007-08-09 12:43:01Z acosce $
2!! =========================================================================
3!! INCA - INteraction with Chemistry and Aerosols
4!!
5!! Copyright Laboratoire des Sciences du Climat et de l'Environnement (LSCE)
6!!           Unite mixte CEA-CNRS-UVSQ
7!!
8!! Contributors to this INCA subroutine:
9!!
10!! Didier Hauglustaine, LSCE, hauglustaine@cea.fr
11!! Stacy Walters, NCAR, stacy@ucar.edu
12!!
13!! Anne Cozic, LSCE, anne.cozic@cea.fr
14!! Yann Meurdesoif, LSCE, yann.meurdesoif@cea.fr
15!!
16!! This software is a computer program whose purpose is to simulate the
17!! atmospheric gas phase and aerosol composition. The model is designed to be
18!! used within a transport model or a general circulation model. This version
19!! of INCA was designed to be coupled to the LMDz GCM. LMDz-INCA accounts
20!! for emissions, transport (resolved and sub-grid scale), photochemical
21!! transformations, and scavenging (dry deposition and washout) of chemical
22!! species and aerosols interactively in the GCM. Several versions of the INCA
23!! model are currently used depending on the envisaged applications with the
24!! chemistry-climate model.
25!!
26!! This software is governed by the CeCILL  license under French law and
27!! abiding by the rules of distribution of free software.  You can  use,
28!! modify and/ or redistribute the software under the terms of the CeCILL
29!! license as circulated by CEA, CNRS and INRIA at the following URL
30!! "http://www.cecill.info".
31!!
32!! As a counterpart to the access to the source code and  rights to copy,
33!! modify and redistribute granted by the license, users are provided only
34!! with a limited warranty  and the software's author,  the holder of the
35!! economic rights,  and the successive licensors  have only  limited
36!! liability.
37!!
38!! In this respect, the user's attention is drawn to the risks associated
39!! with loading,  using,  modifying and/or developing or reproducing the
40!! software by the user in light of its specific status of free software,
41!! that may mean  that it is complicated to manipulate,  and  that  also
42!! therefore means  that it is reserved for developers  and  experienced
43!! professionals having in-depth computer knowledge. Users are therefore
44!! encouraged to load and test the software's suitability as regards their
45!! requirements in conditions enabling the security of their systems and/or
46!! data to be ensured and,  more generally, to use and operate it in the
47!! same conditions as regards security.
48!!
49!! The fact that you are presently reading this means that you have had
50!! knowledge of the CeCILL license and that you accept its terms.
51!! =========================================================================
52
53#include <inca_define.h>
54  subroutine MMR2VMR(vmr, mmr, mbar)
55    !-----------------------------------------------------------------
56    !   ... Xfrom from mass to volume mixing ratio
57    ! Stacy Walters, NCAR, 1998.
58    ! Modified by Didier Hauglustaine, IPSL, for LMDZ/INCA, 1999.
59    !-----------------------------------------------------------------
60
61    use SPECIES_NAMES
62    use INCA_DIM
63    use CHEM_MODS, only : adv_mass, nadv_mass
64
65    implicit none
66
67    !-----------------------------------------------------------------
68    !   ... Dummy args
69    !-----------------------------------------------------------------
70    real, intent(in)  :: mbar(PLON,PLEV)
71    real, intent(in)  :: mmr(PLON,PLEV,PCNST)
72    real, intent(out) :: vmr(PLON,PLEV,PCNST)
73   
74    !-----------------------------------------------------------------
75    !   ... Local variables
76    !-----------------------------------------------------------------
77    integer :: m
78    vmr(:,:,:) = 0. 
79    do m = 1,PCNST
80       if( adv_mass(m) /= 0. ) THEN
81          vmr(:,:,m) = mbar(:,:) * mmr(:PLON,:,m) / adv_mass(m)
82       end if
83    end do
84   
85#if GRPCNT != 0
86    !-----------------------------------------------------------------------
87    !        ... Xform family ox assuming that all ox is o3
88    !-----------------------------------------------------------------------
89    vmr(:,:,id_ox) = mbar(:,:) * mmr(:PLON,:,id_ox) / nadv_mass(id_o3)
90#endif
91   
92  end subroutine MMR2VMR
93
94  subroutine VMR2MMR( vmr          ,& 
95       mmr          ,&
96# if GRPCNT != 0                       
97       nas          ,&
98       grp_ratios   ,&
99# endif
100       mbar )
101    !-----------------------------------------------------------------
102    !   ... Xfrom from mass to volume mixing ratio
103    ! Stacy Walters, NCAR, 1998.
104    ! Modified by Didier Hauglustaine, IPSL, for LMDZ/INCA, 1999.
105    !-----------------------------------------------------------------
106   
107    use SPECIES_NAMES
108    use INCA_DIM
109    use CHEM_MODS, only : adv_mass, nadv_mass
110
111    implicit none
112
113    !-----------------------------------------------------------------
114    !   ... Dummy args
115    !-----------------------------------------------------------------
116    real, intent(in)  :: mbar(PLON,PLEV)
117    real, intent(in)  :: vmr(PLON,PLEV,PCNST)
118    real, intent(out) :: mmr(PLON,PLEV,PCNST)
119# if GRPCNT != 0
120    real, intent(in)  :: grp_ratios(PLON,PLEV,GRPCNT)
121    real, intent(out) :: nas(PLON,PLEV,GRPCNT)
122# endif
123
124    !-----------------------------------------------------------------
125    !   ... Local variables
126    !-----------------------------------------------------------------
127    integer :: m
128# if GRPCNT != 0
129    real :: grp_mass(PLON,PLEV)            ! weighted group mass
130# endif
131
132    !-----------------------------------------------------------------
133    !   ... The non-group species
134    !-----------------------------------------------------------------
135    do m = 1,PCNST
136       if( adv_mass(m) /= 0. ) then
137          mmr(:PLON,:,m) = adv_mass(m) * vmr(:,:,m) / mbar(:,:)
138       end if
139    end do
140   
141# if GRPCNT != 0
142    !-----------------------------------------------------------------
143    !   ... The "group" species
144    !-----------------------------------------------------------------
145    grp_mass(:,:) = grp_ratios(:,:,id_o3) * nadv_mass(id_o3) &     
146         + grp_ratios(:,:,id_o) * nadv_mass(id_o)   &   
147         + grp_ratios(:,:,id_o1d) * nadv_mass(id_o1d)     
148    mmr(:PLON,:,id_ox) = grp_mass(:,:) * vmr(:,:,id_ox) / mbar(:,:)
149    grp_mass(:,:) = mmr(:PLON,:,id_ox) / grp_mass(:,:)
150    nas(:PLON,:,id_o3) = nadv_mass(id_o3) * grp_ratios(:,:,id_o3) &
151         * grp_mass(:,:)
152    nas(:PLON,:,id_o) = nadv_mass(id_o) * grp_ratios(:,:,id_o) &
153         * grp_mass(:,:)
154    nas(:PLON,:,id_o1d) = nadv_mass(id_o1d) * grp_ratios(:,:,id_o1d) &
155         * grp_mass(:,:)
156# endif
157
158  end subroutine VMR2MMR
Note: See TracBrowser for help on using the repository browser.