!$Id: chem_controls_mod.F90 104 2008-12-23 10:28:51Z acosce $ !! ========================================================================= !! INCA - INteraction with Chemistry and Aerosols !! !! Copyright Laboratoire des Sciences du Climat et de l'Environnement (LSCE) !! Unite mixte CEA-CNRS-UVSQ !! !! Contributors to this INCA subroutine: !! !! Stacy Walters, NCAR, stacy@ucar.edu !! !! Anne Cozic, LSCE, anne.cozic@cea.fr !! Yann Meurdesoif, LSCE, yann.meurdesoif@cea.fr !! !! This software is a computer program whose purpose is to simulate the !! atmospheric gas phase and aerosol composition. The model is designed to be !! used within a transport model or a general circulation model. This version !! of INCA was designed to be coupled to the LMDz GCM. LMDz-INCA accounts !! for emissions, transport (resolved and sub-grid scale), photochemical !! transformations, and scavenging (dry deposition and washout) of chemical !! species and aerosols interactively in the GCM. Several versions of the INCA !! model are currently used depending on the envisaged applications with the !! chemistry-climate model. !! !! This software is governed by the CeCILL license under French law and !! abiding by the rules of distribution of free software. You can use, !! modify and/ or redistribute the software under the terms of the CeCILL !! license as circulated by CEA, CNRS and INRIA at the following URL !! "http://www.cecill.info". !! !! As a counterpart to the access to the source code and rights to copy, !! modify and redistribute granted by the license, users are provided only !! with a limited warranty and the software's author, the holder of the !! economic rights, and the successive licensors have only limited !! liability. !! !! In this respect, the user's attention is drawn to the risks associated !! with loading, using, modifying and/or developing or reproducing the !! software by the user in light of its specific status of free software, !! that may mean that it is complicated to manipulate, and that also !! therefore means that it is reserved for developers and experienced !! professionals having in-depth computer knowledge. Users are therefore !! encouraged to load and test the software's suitability as regards their !! requirements in conditions enabling the security of their systems and/or !! data to be ensured and, more generally, to use and operate it in the !! same conditions as regards security. !! !! The fact that you are presently reading this means that you have had !! knowledge of the CeCILL license and that you accept its terms. !! ========================================================================= #include module CHEM_CONTROLS !------------------------------------------------------------------- ! ... Control variables ! Stacy Walters, NCAR, 1998. !------------------------------------------------------------------- implicit none real, parameter :: secpday = 86400. integer, save :: nspday ! number of steps per day integer, save :: delt ! delt in seconds integer, save :: step_cnt = 0 ! time step counter integer, save :: time_step ! time step index integer, save :: total_steps logical, save :: first_step logical, save :: last_step logical, save :: diurnal_step = .false. !$OMP THREADPRIVATE(nspday,delt,step_cnt,time_step,total_steps) !$OMP THREADPRIVATE(first_step,last_step,diurnal_step) type DATE_TIME integer :: date integer :: secs end type DATE_TIME type(DATE_TIME), SAVE :: time_t !$OMP THREADPRIVATE(time_t) !ym logical, SAVE :: lafin=.FALSE. !$OMP THREADPRIVATE(lafin) CONTAINS subroutine INI_DATE( ncdate, ncsec, mdelt, begstep, endstep ) !------------------------------------------------------------------- ! ... Initialize the time_t structure to next time !------------------------------------------------------------------- implicit none !------------------------------------------------------------------- ! ... Dummy args !------------------------------------------------------------------- integer, intent(in) :: ncdate, ncsec, begstep, mdelt, endstep time_step = begstep time_t%date = ncdate time_t%secs = ncsec delt = mdelt total_steps = endstep - begstep nspday = NINT( secpday/REAL(mdelt) ) end subroutine INI_DATE subroutine UPDATE_TIME( ) !------------------------------------------------------------------- ! ... Update the time_t structure to next time !------------------------------------------------------------------- implicit none !------------------------------------------------------------------- ! ... Local variables !------------------------------------------------------------------- integer :: iday !------------------------------------------------------------------- ! ... Function declarations !------------------------------------------------------------------- integer :: NEWDATE step_cnt = step_cnt + 1 time_step = time_step + 1 time_t%secs = time_t%secs + delt if( time_t%secs >= secpday ) then iday = INT(time_t%secs/secpday) time_t%secs = MOD( time_t%secs,INT(secpday) ) time_t%date = NEWDATE( time_t%date, iday ) end if first_step = step_cnt == 1 last_step = step_cnt == total_steps diurnal_step = MOD( step_cnt,nspday ) == 0 end subroutine UPDATE_TIME end module CHEM_CONTROLS