!$Id: ub_inti.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: !! !! Didier Hauglustaine, LSCE, hauglustaine@cea.fr !! 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. !! ========================================================================= SUBROUTINE OZCLIM_INTI (filename) !---------------------------------------------------------------------- ! ... Ozone climatologies initialize !---------------------------------------------------------------------- USE O3CLIM_COM USE INCA_DIM USE MOD_INCA_PARA IMPLICIT NONE INCLUDE 'netcdf.inc' !---------------------------------------------------------------------- ! ... Dummy args !---------------------------------------------------------------------- CHARACTER(len=*), INTENT(in) :: filename !---------------------------------------------------------------------- ! ... Local variables !---------------------------------------------------------------------- INTEGER :: iret INTEGER :: varid INTEGER :: error !$OMP MASTER IF (is_mpi_root) THEN ! ... Open the file iret = nf_open(filename, 0, ncidc) CALL check_err(iret, 'OZCLIM_INTI', 'problem to open file') ! ... Get lengths iret = nf_inq_dimid(ncidc, 'time', varid) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check dimid time') iret = nf_inq_dimlen(ncidc, varid, ntimec) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check dimlen time') iret = nf_inq_dimid(ncidc, 'pressure', varid) CALL check_err(iret, 'OZCLIM_INTI','problem to check dimid pressure') iret = nf_inq_dimlen(ncidc, varid, nlevc) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check dimlen pressure') iret = nf_inq_dimid(ncidc, 'vector', varid) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check dimid vector') iret = nf_inq_dimlen(ncidc, varid, klonc) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check dimlen vector') ENDIF !$OMP END MASTER CALL bcast(ntimec) CALL bcast(nlevc) CALL bcast(klonc) IF (klonc/=nbp_glo) THEN write(lunout, *) '[klonc] [nbp_glo]', klonc, nbp_glo call print_err(3, 'OZCLIM_INTI', 'check klonc and nbp_glo, they must to be equal', '', '') ELSE klonc=PLON ENDIF ! ... Allocate variables ALLOCATE(timec(ntimec), STAT=error) IF (error /= 0) CALL print_err(3, 'OZCLIM_INTI', 'Space requested not possible for timec', '', '') ALLOCATE(presc(nlevc), STAT=error) IF (error /= 0) CALL print_err(3, 'OZCLIM_INTI', 'Space requested not possible for presc', '', '') ALLOCATE(o3climbd(klonc,nlevc,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZCLIM_INTI', 'Space requested not possible for o3climbd', '', '') ALLOCATE(o3climcr(klonc,nlevc), STAT=error) IF (error /= 0) CALL print_err(3, 'OZCLIM_INTI', 'Space requested not possible for o3climcr', '', '') !$OMP MASTER IF (is_mpi_root) THEN ! ... Get the coordinates iret = nf_inq_varid(ncidc, 'time', varid) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check varid time') iret = nf_get_var_double(ncidc, varid, timec) CALL check_err(iret, 'OZCLIM_INTI', 'problem to read time') iret = nf_inq_varid(ncidc, 'pressure', varid) CALL check_err(iret, 'OZCLIM_INTI', 'problem to check varid pressure') iret = nf_get_var_double(ncidc, varid, presc) CALL check_err(iret, 'OZCLIM_INTI', 'problem to read pressure') ENDIF !$OMP END MASTER CALL bcast(timec) CALL bcast(presc) ! ... Units (pressure from mbar to Pa) presc = presc * 1.e2 END SUBROUTINE OZCLIM_INTI SUBROUTINE OZLIN_INTI (filename) !---------------------------------------------------------------------- ! ... Ozone linear initialize !---------------------------------------------------------------------- USE O3LIN_COM USE INCA_DIM USE MOD_INCA_PARA IMPLICIT NONE INCLUDE 'netcdf.inc' !---------------------------------------------------------------------- ! ... Dummy args !---------------------------------------------------------------------- CHARACTER(len=*), INTENT(in) :: filename !---------------------------------------------------------------------- ! ... Local variables !---------------------------------------------------------------------- INTEGER :: iret INTEGER :: varid INTEGER :: error !$OMP MASTER IF (is_mpi_root) THEN ! ... Open the file iret = nf_open(filename, 0, ncidl) CALL check_err(iret, 'OZLIN_INTI', 'problem to open file') ! ... Get lengths iret = nf_inq_dimid(ncidl, 'time', varid) CALL check_err(iret, 'OZLIN_INTI', 'problem to get id for dim time') iret = nf_inq_dimlen(ncidl, varid, ntimel) CALL check_err(iret, 'OZLIN_INTI', 'problem to get length time ') iret = nf_inq_dimid(ncidl, 'pressure', varid) CALL check_err(iret, 'OZLIN_INTI', 'problem to get id for dim pressure') iret = nf_inq_dimlen(ncidl, varid, nlevl) CALL check_err(iret, 'OZLIN_INTI', 'problem to get length pressure') iret = nf_inq_dimid(ncidl, 'vector', varid) CALL check_err(iret, 'OZLIN_INTI', 'problem to get id for dim vector') iret = nf_inq_dimlen(ncidl, varid, klonl) CALL check_err(iret, 'OZLIN_INTI', 'problem to get length vector') ENDIF !$OMP END MASTER CALL bcast(ntimel) CALL bcast(nlevl) CALL bcast(klonl) IF (klonl/=nbp_glo) THEN WRITE(lunout, *) '[klonl] [nbp_glo]', klonl, nbp_glo CALL print_err(3, 'OZLIN_INTI', 'check klonl and nbp_glo, they must to be equal', '', '') ELSE klonl=PLON ENDIF ! ... Allocate variables ALLOCATE(timel(ntimel), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for timel', '', '') ALLOCATE(presl(nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for presl', '', '') ALLOCATE(A1bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A1bd', '', '') ALLOCATE(A1cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A1cr', '', '') ALLOCATE(A2bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A2bd', '', '') ALLOCATE(A2cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A2cr', '', '') ALLOCATE(A3bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A3bd', '', '') ALLOCATE(A3cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A3cr', '', '') ALLOCATE(A4bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A4bd', '', '') ALLOCATE(A4cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A4cr', '', '') ALLOCATE(A5bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A5bd', '', '') ALLOCATE(A5cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A5cr', '', '') ALLOCATE(A6bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A6bd', '', '') ALLOCATE(A6cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A6cr', '', '') ALLOCATE(A7bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A7bd', '', '') ALLOCATE(A7cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A7cr', '', '') ALLOCATE(A8bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A8bd', '', '') ALLOCATE(A8cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A8cr', '', '') ALLOCATE(A9bd(klonl,nlevl,2), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A9bd', '', '') ALLOCATE(A9cr(klonl,nlevl), STAT=error) IF (error /= 0) CALL print_err(3, 'OZLIN_INTI', 'Space requested not possible for A9cr', '', '') !$OMP MASTER IF (is_mpi_root) THEN ! ... Get the coordinates iret = nf_inq_varid(ncidl, 'time', varid) CALL check_err(iret, 'OZLIN_INTI', 'problem to get id for var time') iret = nf_get_var_double(ncidl, varid, timel) CALL check_err(iret, 'OZLIN_INTI', 'problem to read var time') iret = nf_inq_varid(ncidl, 'pressure', varid) CALL check_err(iret, 'OZLIN_INTI', 'problem to get id for var pressure') iret = nf_get_var_double(ncidl, varid, presl) CALL check_err(iret, 'OZLIN_INTI', 'problem to read var pressure') ENDIF !$OMP END MASTER CALL bcast(timel) CALL bcast(presl) ! ... Units (pressure from hPa to Pa) presl = presl * 1.e2 END SUBROUTINE OZLIN_INTI