1 | !$Id: chem_controls_mod.F90 104 2008-12-23 10:28:51Z 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 | !! Stacy Walters, NCAR, stacy@ucar.edu |
---|
11 | !! |
---|
12 | !! Anne Cozic, LSCE, anne.cozic@cea.fr |
---|
13 | !! Yann Meurdesoif, LSCE, yann.meurdesoif@cea.fr |
---|
14 | !! |
---|
15 | !! This software is a computer program whose purpose is to simulate the |
---|
16 | !! atmospheric gas phase and aerosol composition. The model is designed to be |
---|
17 | !! used within a transport model or a general circulation model. This version |
---|
18 | !! of INCA was designed to be coupled to the LMDz GCM. LMDz-INCA accounts |
---|
19 | !! for emissions, transport (resolved and sub-grid scale), photochemical |
---|
20 | !! transformations, and scavenging (dry deposition and washout) of chemical |
---|
21 | !! species and aerosols interactively in the GCM. Several versions of the INCA |
---|
22 | !! model are currently used depending on the envisaged applications with the |
---|
23 | !! chemistry-climate model. |
---|
24 | !! |
---|
25 | !! This software is governed by the CeCILL license under French law and |
---|
26 | !! abiding by the rules of distribution of free software. You can use, |
---|
27 | !! modify and/ or redistribute the software under the terms of the CeCILL |
---|
28 | !! license as circulated by CEA, CNRS and INRIA at the following URL |
---|
29 | !! "http://www.cecill.info". |
---|
30 | !! |
---|
31 | !! As a counterpart to the access to the source code and rights to copy, |
---|
32 | !! modify and redistribute granted by the license, users are provided only |
---|
33 | !! with a limited warranty and the software's author, the holder of the |
---|
34 | !! economic rights, and the successive licensors have only limited |
---|
35 | !! liability. |
---|
36 | !! |
---|
37 | !! In this respect, the user's attention is drawn to the risks associated |
---|
38 | !! with loading, using, modifying and/or developing or reproducing the |
---|
39 | !! software by the user in light of its specific status of free software, |
---|
40 | !! that may mean that it is complicated to manipulate, and that also |
---|
41 | !! therefore means that it is reserved for developers and experienced |
---|
42 | !! professionals having in-depth computer knowledge. Users are therefore |
---|
43 | !! encouraged to load and test the software's suitability as regards their |
---|
44 | !! requirements in conditions enabling the security of their systems and/or |
---|
45 | !! data to be ensured and, more generally, to use and operate it in the |
---|
46 | !! same conditions as regards security. |
---|
47 | !! |
---|
48 | !! The fact that you are presently reading this means that you have had |
---|
49 | !! knowledge of the CeCILL license and that you accept its terms. |
---|
50 | !! ========================================================================= |
---|
51 | |
---|
52 | #include <inca_define.h> |
---|
53 | |
---|
54 | module CHEM_CONTROLS |
---|
55 | !------------------------------------------------------------------- |
---|
56 | ! ... Control variables |
---|
57 | ! Stacy Walters, NCAR, 1998. |
---|
58 | !------------------------------------------------------------------- |
---|
59 | |
---|
60 | implicit none |
---|
61 | |
---|
62 | real, parameter :: secpday = 86400. |
---|
63 | integer, save :: nspday ! number of steps per day |
---|
64 | integer, save :: delt ! delt in seconds |
---|
65 | integer, save :: step_cnt = 0 ! time step counter |
---|
66 | integer, save :: time_step ! time step index |
---|
67 | integer, save :: total_steps |
---|
68 | logical, save :: first_step |
---|
69 | logical, save :: last_step |
---|
70 | logical, save :: diurnal_step = .false. |
---|
71 | !$OMP THREADPRIVATE(nspday,delt,step_cnt,time_step,total_steps) |
---|
72 | !$OMP THREADPRIVATE(first_step,last_step,diurnal_step) |
---|
73 | |
---|
74 | type DATE_TIME |
---|
75 | integer :: date |
---|
76 | integer :: secs |
---|
77 | end type DATE_TIME |
---|
78 | type(DATE_TIME), SAVE :: time_t |
---|
79 | !$OMP THREADPRIVATE(time_t) |
---|
80 | |
---|
81 | !ym |
---|
82 | logical, SAVE :: lafin=.FALSE. |
---|
83 | !$OMP THREADPRIVATE(lafin) |
---|
84 | |
---|
85 | CONTAINS |
---|
86 | |
---|
87 | subroutine INI_DATE( ncdate, ncsec, mdelt, begstep, endstep ) |
---|
88 | !------------------------------------------------------------------- |
---|
89 | ! ... Initialize the time_t structure to next time |
---|
90 | !------------------------------------------------------------------- |
---|
91 | |
---|
92 | implicit none |
---|
93 | |
---|
94 | !------------------------------------------------------------------- |
---|
95 | ! ... Dummy args |
---|
96 | !------------------------------------------------------------------- |
---|
97 | integer, intent(in) :: ncdate, ncsec, begstep, mdelt, endstep |
---|
98 | |
---|
99 | time_step = begstep |
---|
100 | time_t%date = ncdate |
---|
101 | time_t%secs = ncsec |
---|
102 | delt = mdelt |
---|
103 | total_steps = endstep - begstep |
---|
104 | nspday = NINT( secpday/REAL(mdelt) ) |
---|
105 | |
---|
106 | end subroutine INI_DATE |
---|
107 | |
---|
108 | subroutine UPDATE_TIME( ) |
---|
109 | !------------------------------------------------------------------- |
---|
110 | ! ... Update the time_t structure to next time |
---|
111 | !------------------------------------------------------------------- |
---|
112 | |
---|
113 | implicit none |
---|
114 | |
---|
115 | !------------------------------------------------------------------- |
---|
116 | ! ... Local variables |
---|
117 | !------------------------------------------------------------------- |
---|
118 | integer :: iday |
---|
119 | |
---|
120 | !------------------------------------------------------------------- |
---|
121 | ! ... Function declarations |
---|
122 | !------------------------------------------------------------------- |
---|
123 | integer :: NEWDATE |
---|
124 | |
---|
125 | step_cnt = step_cnt + 1 |
---|
126 | time_step = time_step + 1 |
---|
127 | time_t%secs = time_t%secs + delt |
---|
128 | if( time_t%secs >= secpday ) then |
---|
129 | iday = INT(time_t%secs/secpday) |
---|
130 | time_t%secs = MOD( time_t%secs,INT(secpday) ) |
---|
131 | time_t%date = NEWDATE( time_t%date, iday ) |
---|
132 | end if |
---|
133 | first_step = step_cnt == 1 |
---|
134 | last_step = step_cnt == total_steps |
---|
135 | diurnal_step = MOD( step_cnt,nspday ) == 0 |
---|
136 | |
---|
137 | end subroutine UPDATE_TIME |
---|
138 | |
---|
139 | end module CHEM_CONTROLS |
---|