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

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

INCA used for ICOLMDZORINCA_CO2_Transport_GMD_2023

File size: 9.9 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!! Anne Cozic, LSCE, anne.cozic@cea.fr
11!!
12!! This software is a computer program whose purpose is to simulate the
13!! atmospheric gas phase and aerosol composition. The model is designed to be
14!! used within a transport model or a general circulation model. This version
15!! of INCA was designed to be coupled to the LMDz GCM. LMDz-INCA accounts
16!! for emissions, transport (resolved and sub-grid scale), photochemical
17!! transformations, and scavenging (dry deposition and washout) of chemical
18!! species and aerosols interactively in the GCM. Several versions of the INCA
19!! model are currently used depending on the envisaged applications with the
20!! chemistry-climate model.
21!!
22!! This software is governed by the CeCILL  license under French law and
23!! abiding by the rules of distribution of free software.  You can  use,
24!! modify and/ or redistribute the software under the terms of the CeCILL
25!! license as circulated by CEA, CNRS and INRIA at the following URL
26!! "http://www.cecill.info".
27!!
28!! As a counterpart to the access to the source code and  rights to copy,
29!! modify and redistribute granted by the license, users are provided only
30!! with a limited warranty  and the software's author,  the holder of the
31!! economic rights,  and the successive licensors  have only  limited
32!! liability.
33!!
34!! In this respect, the user's attention is drawn to the risks associated
35!! with loading,  using,  modifying and/or developing or reproducing the
36!! software by the user in light of its specific status of free software,
37!! that may mean  that it is complicated to manipulate,  and  that  also
38!! therefore means  that it is reserved for developers  and  experienced
39!! professionals having in-depth computer knowledge. Users are therefore
40!! encouraged to load and test the software's suitability as regards their
41!! requirements in conditions enabling the security of their systems and/or
42!! data to be ensured and,  more generally, to use and operate it in the
43!! same conditions as regards security.
44!!
45!! The fact that you are presently reading this means that you have had
46!! knowledge of the CeCILL license and that you accept its terms.
47!! =========================================================================
48
49#include <inca_define.h>
50
51SUBROUTINE CONF_CHEM(chemistry_couple) 
52
53! Routine permettant de lire les parametres definis
54! dans le fichier texte inca.def
55
56  USE PARAM_CHEM
57  USE IOIPSL
58  USE MOD_INCA_PARA
59
60
61  IMPLICIT NONE
62
63  LOGICAL, INTENT(in) :: chemistry_couple
64
65  CHARACTER*(13), ALLOCATABLE, DIMENSION(:) :: tmp_emi_names_omp
66  INTEGER :: i 
67
68
69  LOGICAL :: xios_remap_output_omp, LMDZ_10m_winds_omp, CoupSurfAtm_omp, dep_orch_omp
70  INTEGER :: feedb_omp, nbveget_omp, nbflux_omp
71  INTEGER :: emi_interp_time_omp
72  REAL :: tref_omp, ss_corr_omp
73  LOGICAL :: multilayer_sediment_omp
74  LOGICAL :: calcul_flux_omp
75  CHARACTER(len=13) :: field_emi_names_omp
76  CHARACTER(len=6) :: flag_o3_omp
77  INTEGER :: flag_plane_omp, flag_plume_omp
78  LOGICAL :: use_group_omp, cmip_xml
79
80
81!$OMP MASTER
82
83! default value for xios_remap_output
84  xios_remap_output_omp=.TRUE.
85! reading in inca.def if define
86  CALL getin ('xios_remap_output',xios_remap_output_omp) 
87
88
89
90! default value for LMDZ_10m_winds
91  LMDZ_10m_winds_omp=.FALSE.
92! reading in inca.def if define
93  CALL getin('LMDZ_10m_winds', LMDZ_10m_winds_omp) 
94
95  ! default value for feedb
96  feedb_omp=0
97  ! reading in inca.def if define
98  CALL getin('feedb', feedb_omp) 
99
100  ! default value for tref (threshold parameter)
101  tref_omp=0.85
102  ! reading in inca.def if define
103  CALL getin('tref', tref_omp) 
104
105
106  ! default value for ss_corr (correctif seasalt)
107  ss_corr_omp = 1. 
108  call getin('ss_corr', ss_corr_omp) 
109
110
111  ! choose if we run without plane (0) with old-aircraft routines (1) -  plane subsonic (2), hypersonic (3)
112  flag_plane_omp=1
113  CALL getin('flag_plane', flag_plane_omp)
114#ifndef NMHC
115  flag_plane_omp = 0 
116#endif
117
118  ! choose if we run with planes plume (1) or not (0)
119  flag_plume_omp=0
120  CALL getin('flag_plume', flag_plume_omp) 
121
122  !choose in mod without strat how we work for the o3 stratospheric (o3clim, o3lin)
123  flag_o3_omp='o3clim'
124  CALL getin('flag_o3', flag_o3_omp)
125#ifdef STRAT
126  flag_o3_omp='o3strt'
127#endif
128
129! Test pour le flag choisissant la sedimentation
130  multilayer_sediment_omp = .true.
131  CALL getin('multilayer_sediment', multilayer_sediment_omp) 
132
133
134! Test pour le calcul des flux en interactif
135  calcul_flux_omp = .false. 
136  CALL getin('calcul_flux', calcul_flux_omp) 
137
138
139  ! si 1 on garde les interpolations temporelles des emissions / si 0 on les annule / 2 on passe au nouveau schema d'interpolation
140  emi_interp_time_omp = 1
141  CALL getin('emi_interp_time', emi_interp_time_omp)
142
143  ! choose if we use groups in .xml files
144  cmip_xml = .FALSE. 
145  call getin('cmip_xml', cmip_xml) 
146  if (cmip_xml .eq. .FALSE.) then
147     use_group_omp = .TRUE. 
148  else
149     use_group_omp = .FALSE. 
150  endif
151
152!$OMP END MASTER
153!$OMP BARRIER
154
155
156  CALL bcast(xios_remap_output_omp)
157  CALL bcast(LMDZ_10m_winds_omp) 
158  CALL bcast(feedb_omp) 
159  CALL bcast(tref_omp) 
160  CALL bcast(ss_corr_omp)
161  CALL bcast(flag_plane_omp)
162  CALL bcast(flag_plume_omp)
163  CALL bcast(flag_o3_omp)
164  CALL bcast(multilayer_sediment_omp) 
165  CALL bcast(calcul_flux_omp) 
166  CALL bcast(emi_interp_time_omp) 
167  CALL bcast(use_group_omp)
168
169
170  xios_remap_output=xios_remap_output_omp
171  LMDZ_10m_winds=LMDZ_10m_winds_omp
172  feedb=feedb_omp
173  tref=tref_omp
174  ss_corr=ss_corr_omp
175  flag_plane=flag_plane_omp
176  flag_plume=flag_plume_omp
177  flag_o3=flag_o3_omp
178  multilayer_sediment = multilayer_sediment_omp 
179  calcul_flux = calcul_flux_omp
180  emi_interp_time = emi_interp_time_omp
181  use_group = use_group_omp
182
183
184    ! Coherence test between flag and preprocessing key
185#ifndef XIOS
186    IF (xios_inca_ok) THEN
187       ! Write error messages and stop the model
188       CALL print_err(3, 'CONF_CHEM', 'Preprocessing key XIOS is missing to run INCA with XIOS', &
189            'Recompile with preprocessing flag XIOS or set XIOS_INCA_OK=n in run.def', '') 
190    END IF
191#endif
192
193#ifndef AERONLY 
194    IF (emi_interp_time .eq. 2) THEN
195       CALL print_err(3, 'CONF_CHEM', 'Preprocessing key AERONLY is missing to run INCA with emi_interp_time = 2 ', &
196            'Recompile with the chemistry AER or change the flag emi_interp_time to 0 or 1', '')       
197    END IF
198#endif
199
200
201  IF ((TRIM(flag_o3) .NE. 'o3strt') .AND. chemistry_couple ) THEN
202     CALL print_err(3, "CONF_CHEM", "you cannot use chemistry_couple for O3 ", &
203          'if you not work with configuration NMHC_AER_S', '') 
204  ENDIF
205
206! -------------------------------------------------
207! -------------------------------------------------
208! Parametres pour le couplage avec orchidee
209! -------------------------------------------------
210! -------------------------------------------------
211    ! Activation du couplage ou non
212!$OMP MASTER
213
214    CoupSurfAtm_omp=.false. 
215    call getin('CoupOrchInca', CoupSurfAtm_omp) 
216
217    ! nombre de pft
218    ! il faut une valeur par defaut pour la def des axes en sorties
219    ! meme lorsqu'il n'y a pas de couplage orchidee
220    !------------------------
221    ! valeur par defaut
222    nbveget_omp=13
223    call getin('nbveget', nbveget_omp) 
224
225    ! choix du depot entre celui de orchidee ou celui de inca
226    dep_orch_omp = .false. 
227    call getin('DepOrch', dep_orch_omp) 
228
229
230!$OMP END MASTER
231!$OMP BARRIER
232    CALL BCAST(CoupSurfAtm_omp) 
233    CALL BCAST(nbveget_omp) 
234    call bcast(dep_orch_omp) 
235
236    CoupSurfAtm =CoupSurfAtm_omp
237    nbveget=nbveget_omp
238    dep_orch = dep_orch_omp
239
240
241    IF (CoupSurfAtm) THEN 
242
243!$OMP MASTER
244       ! nombre de flux importes de orchidee
245       ! ------------------------------------
246       ! valeur par defaut
247       nbflux_omp = 23
248       CALL getin('nbFlux_FromOrch', nbflux_omp) 
249!$OMP END MASTER
250!$OMP BARRIER
251       CALL bcast(nbflux_omp) 
252       nb_flux = nbflux_omp
253 
254       ! nom des flux importes de orchidee
255       !------------------------------------
256       IF (nb_flux .NE. 0) THEN
257
258
259          ALLOCATE(tmp_emi_names_omp(nb_flux)) 
260          ALLOCATE(field_emi_names(nb_flux)) 
261       
262!$OMP MASTER
263          if (nb_flux .eq. 23) THEN 
264             ! valeur par defaut :
265             tmp_emi_names_omp(1) = "iso" 
266             tmp_emi_names_omp(2) = "mono" 
267             tmp_emi_names_omp(3) = "ORVOC" 
268             tmp_emi_names_omp(4) = "MBO" 
269             tmp_emi_names_omp(5) = "methanol" 
270             tmp_emi_names_omp(6) = "acetone" 
271             tmp_emi_names_omp(7) = "acetal" 
272             tmp_emi_names_omp(8) = "formal" 
273             tmp_emi_names_omp(9) = "acetic" 
274             tmp_emi_names_omp(10) = "formic" 
275             tmp_emi_names_omp(11) = "no_soil" 
276             tmp_emi_names_omp(12) = "nox" 
277             tmp_emi_names_omp(13) = "fertil_no" 
278             tmp_emi_names_omp(14) = "apinen"
279             tmp_emi_names_omp(15) = "bpinen"
280             tmp_emi_names_omp(16) = "limonen"
281             tmp_emi_names_omp(17) = "myrcen"
282             tmp_emi_names_omp(18) = "sabinen"
283             tmp_emi_names_omp(19) = "camphen"
284             tmp_emi_names_omp(20) = "3caren"
285             tmp_emi_names_omp(21) = "tbocimen"
286             tmp_emi_names_omp(22) = "othermono"
287             tmp_emi_names_omp(23) = "sesquiter"
288          else
289             tmp_emi_names_omp(1) = "test"
290          endif
291
292          CALL getin('emi_FromOrch', tmp_emi_names_omp) 
293!$OMP END MASTER
294!$OMP BARRIER
295          CALL bcast(tmp_emi_names_omp) 
296
297          if (trim(tmp_emi_names_omp(1)) .eq. "test") then
298             call print_err(3, "conf_chem", "if nbflux .ne. 0 and nbflux .ne. 23", "you need to defined in inca.card the flux list ", "use emi_FromOrch parameter ") 
299          endif
300
301          DO i=1, nb_flux
302             field_emi_names(i) = "flx_"//tmp_emi_names_omp(i)
303          ENDDO
304
305       ENDIF
306
307
308    else
309       nb_flux = 0. 
310    endif
311
312END SUBROUTINE CONF_CHEM
Note: See TracBrowser for help on using the repository browser.