source: CONFIG/publications/ICOLMDZORINCA_CO2_Transport_GMD_2023/INCA/src/INCA_VEG/surf_chem_atm.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: 7.1 KB
Line 
1!$Id
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!!
11!! Anne Cozic, LSCE, anne.cozic@cea.fr
12!! Juliette Lathiere, LSCE, juliette.lathiere@cea.fr
13!!
14!! This software is a computer program whose purpose is to simulate the
15!! atmospheric gas phase and aerosol composition. The model is designed to be
16!! used within a transport model or a general circulation model. This version
17!! of INCA was designed to be coupled to the LMDz GCM. LMDz-INCA accounts
18!! for emissions, transport (resolved and sub-grid scale), photochemical
19!! transformations, and scavenging (dry deposition and washout) of chemical
20!! species and aerosols interactively in the GCM. Several versions of the INCA
21!! model are currently used depending on the envisaged applications with the
22!! chemistry-climate model.
23!!
24!! This software is governed by the CeCILL  license under French law and
25!! abiding by the rules of distribution of free software.  You can  use,
26!! modify and/ or redistribute the software under the terms of the CeCILL
27!! license as circulated by CEA, CNRS and INRIA at the following URL
28!! "http://www.cecill.info".
29!!
30!! As a counterpart to the access to the source code and  rights to copy,
31!! modify and redistribute granted by the license, users are provided only
32!! with a limited warranty  and the software's author,  the holder of the
33!! economic rights,  and the successive licensors  have only  limited
34!! liability.
35!!
36!! In this respect, the user's attention is drawn to the risks associated
37!! with loading,  using,  modifying and/or developing or reproducing the
38!! software by the user in light of its specific status of free software,
39!! that may mean  that it is complicated to manipulate,  and  that  also
40!! therefore means  that it is reserved for developers  and  experienced
41!! professionals having in-depth computer knowledge. Users are therefore
42!! encouraged to load and test the software's suitability as regards their
43!! requirements in conditions enabling the security of their systems and/or
44!! data to be ensured and,  more generally, to use and operate it in the
45!! same conditions as regards security.
46!!
47!! The fact that you are presently reading this means that you have had
48!! knowledge of the CeCILL license and that you accept its terms.
49!! =========================================================================
50
51#include <inca_define.h>
52
53SUBROUTINE SURF_CHEM_ATM(pctsrf,fraction_landuse)
54
55  USE CONST_LMDZ
56  USE MOD_GRID_INCA
57  USE MOD_INCA_MPI_DATA
58  USE SURF_CHEM_MOD
59  USE MOD_INCA_MPI_TRANSFERT
60  USE SECHIBA
61  USE PRINT_INCA
62  USE PARAM_CHEM
63  USE DRYDEP_PARAMETERS, ONLY : n_land_type
64
65
66  IMPLICIT NONE
67
68
69  !
70  REAL,  INTENT(in)    :: pctsrf(PLON,nbsrf)         
71  REAL, INTENT(out)    :: fraction_landuse(PLON,n_land_type) 
72
73  ! local
74  INTEGER :: knon, i, j, knon_orch
75  INTEGER :: nvm_orch
76  LOGICAL, SAVE :: first= .TRUE. 
77!$OMP THREADPRIVATE(first)
78
79  ! variables pour le changement de grille
80  INTEGER , DIMENSION(PLON) :: knindex, ktindex_orch
81  INTEGER, SAVE, ALLOCATABLE,DIMENSION(:) :: ktindex
82!$OMP THREADPRIVATE(ktindex)
83  INTEGER, SAVE :: orch_comm
84!$OMP THREADPRIVATE(orch_comm)
85  INTEGER,SAVE :: offset
86!$OMP THREADPRIVATE(offset)
87
88  ! variables pour le transfert de variables
89  REAL, SAVE,allocatable, DIMENSION(:,:) :: veget_tmp
90!$OMP THREADPRIVATE(veget_tmp)
91  REAL, SAVE,allocatable, DIMENSION(:,:) :: lai_tmp
92!$OMP THREADPRIVATE(lai_tmp)
93  REAL, SAVE,allocatable, DIMENSION(:,:) :: vegetfrac_tmp
94!$OMP THREADPRIVATE(vegetfrac_tmp)
95  REAL, SAVE,allocatable, DIMENSION(:) :: snow_tmp
96!$OMP THREADPRIVATE(snow_tmp)
97  REAL, SAVE,allocatable, DIMENSION(:) :: hdry_tmp
98!$OMP THREADPRIVATE(hdry_tmp)
99  REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) :: emission_tmp
100!$OMP THREADPRIVATE(emission_tmp)
101 
102 
103  ! Search for index(knindex) and size(knon) of domaine to treat
104  knindex(:) = 0
105  knon  = 0
106  DO i = 1, PLON
107    IF (pctsrf(i,is_ter) > 0.) THEN
108        knon = knon + 1
109        knindex(knon) = i
110    ENDIF
111  ENDDO
112
113
114  IF (first) THEN
115
116      IF (nb_flux .NE. 0) then
117         ALLOCATE(emission_tmp(knon,nbveget,nb_flux))
118      ENDIF
119      ALLOCATE(veget_tmp(knon,nbveget))
120      ALLOCATE(lai_tmp(knon,nbveget))
121      ALLOCATE(vegetfrac_tmp(knon,nbveget))
122      ALLOCATE(snow_tmp(knon))
123      ALLOCATE(hdry_tmp(knon))
124
125      ALLOCATE(maxvegetfrac_fromOrch(PLON,nbveget))
126      maxvegetfrac_fromOrch(:,:) = 0
127
128      ALLOCATE(lai_fromOrch(PLON,nbveget)) 
129      lai_fromOrch(:,:) = 0 
130
131
132      ALLOCATE(surftype_frac(PLON,nbsurf))
133      surftype_frac(:,:) = 0
134
135      ALLOCATE(vegetfrac_fromOrch(PLON,nbveget))
136      vegetfrac_fromOrch(:,:) = 0
137
138      ALLOCATE(snow_fromOrch(PLON))
139      snow_fromOrch(:) = 0
140
141      ALLOCATE(hdry_fromOrch(PLON))
142      hdry_fromOrch(:) = 0 
143
144      DO i=1,PLON
145        IF (pctsrf(i,is_oce) > 0.) surftype_frac(i,14) = pctsrf(i,is_oce)
146        IF (pctsrf(i,is_sic) > 0.) surftype_frac(i,15) = pctsrf(i,is_sic)
147        IF (pctsrf(i,is_lic) > 0.) surftype_frac(i,16) = pctsrf(i,is_lic)
148      ENDDO
149     
150      first = .FALSE. 
151 
152  ENDIF
153
154      emission_tmp(:,:,:) = 0.
155      veget_tmp(:,:) = 0.
156      lai_tmp(:,:) = 0. 
157      vegetfrac_tmp(:,:) = 0.
158      snow_tmp(:) = 0. 
159      hdry_tmp(:) = 0. 
160
161      IF (knon /=0 ) THEN
162         IF (nb_flux .NE. 0) THEN
163            CALL sechiba_interface_orchidee_inca(nvm_orch,veget_tmp(1:knon,:), vegetfrac_tmp(1:knon, :), &
164                 lai_tmp(1:knon,:), snow_tmp(1:knon), field_out_names=field_emi_names, fields_out=emission_tmp)
165         ELSE
166            CALL sechiba_interface_orchidee_inca(nvm_orch,veget_tmp(1:knon,:), vegetfrac_tmp(1:knon, :), &
167                 lai_tmp(1:knon,:), snow_tmp(1:knon))
168         ENDIF
169         IF (nvm_orch .ne. nbveget ) THEN
170            WRITE(lunout, *) '[nbveget in INCA] [nbveget in ORCHIDEE]', nbveget, nvm_orch
171            call print_err(3, 'SURF_CHEM_ATM',' nbveget incorrect in inca.def', 'check nbveget is not consistant with orchidee value', '')
172         endif
173
174      ELSE
175          nvm_orch = 0 
176      ENDIF
177
178      DO j=1,knon
179        i = knindex(j)
180
181        ! On fait la ponderation sur la fraction de terre dans mksflx
182        maxvegetfrac_fromOrch(i,:) = veget_tmp(j,:) 
183        vegetfrac_fromOrch(i,:) = vegetfrac_tmp(j,:)
184        lai_fromOrch(i,:) = lai_tmp(j,:)
185        snow_fromOrch(i) = snow_tmp(j) 
186!        hdry_fromOrch(i) = hdry_tmp(j)
187        surftype_frac(i,1:nbveget) = veget_tmp(j,:)*pctsrf(i,is_ter)
188
189        IF (nb_flux .NE. 0) THEN
190           emiflx_fromOrch(i,:,:) = emission_tmp(j,:,:) 
191        ENDIF
192
193      ENDDO
194
195
196      IF (nb_flux .NE. 0) THEN
197         CALL Surf_weightedflx() 
198      ENDIF
199
200
201      ! choix du depot
202      IF (dep_orch) THEN
203         IF (n_land_type .EQ. nbsurf) THEN
204            fraction_landuse(:,:) = surftype_frac(:,:) * 100
205         ELSE
206            CALL print_err(3, 'SURF_CHEM_ATM','There is a problem of dimension ', &
207                 'check n_land_type and nbsurf', 'dep_orch can be activate only if n_land_type = nbsurf')
208         ENDIF
209      ENDIF
210
211END SUBROUTINE SURF_CHEM_ATM
212
213
Note: See TracBrowser for help on using the repository browser.