[6610] | 1 | !$Id: chem_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 | !! 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 | |
---|
| 51 | MODULE PRINT_INCA |
---|
| 52 | |
---|
| 53 | IMPLICIT NONE |
---|
| 54 | INTEGER, SAVE :: lunout |
---|
| 55 | !$OMP THREADPRIVATE(lunout) |
---|
| 56 | INTEGER, SAVE :: outxml |
---|
| 57 | !$OMP THREADPRIVATE(outxml) |
---|
| 58 | |
---|
| 59 | CONTAINS |
---|
| 60 | |
---|
| 61 | SUBROUTINE INIT_PRINT_INCA() |
---|
| 62 | |
---|
| 63 | USE MOD_INCA_MPI_DATA, ONLY : is_ok_mpi, mpi_rank |
---|
| 64 | USE MOD_INCA_OMP_DATA, ONLY : is_ok_omp, omp_rank |
---|
| 65 | USE mod_inca_mpi_data, ONLY : is_mpi_root |
---|
| 66 | |
---|
| 67 | IMPLICIT NONE |
---|
| 68 | CHARACTER(len=8) :: namefile |
---|
| 69 | INTEGER :: ierr2 |
---|
| 70 | CHARACTER(len=255) :: fileout |
---|
| 71 | CHARACTER(len=4) :: num_mpi |
---|
| 72 | CHARACTER(len=4) :: num_omp |
---|
| 73 | INTEGER,PARAMETER :: base_lunout=350 |
---|
| 74 | INTEGER :: ierr |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | namefile='inca.out' |
---|
| 78 | IF (is_ok_mpi) THEN |
---|
| 79 | WRITE(num_mpi,'(I4.4)') mpi_rank |
---|
| 80 | ENDIF |
---|
| 81 | |
---|
| 82 | IF (is_ok_omp) THEN |
---|
| 83 | WRITE(num_omp,'(I4.4)') omp_rank |
---|
| 84 | ENDIF |
---|
| 85 | |
---|
| 86 | IF (is_ok_mpi .AND. is_ok_omp) THEN |
---|
| 87 | fileout=TRIM(namefile)//'_'//num_mpi//'.'//num_omp |
---|
| 88 | lunout=base_lunout+omp_rank |
---|
| 89 | ELSE IF (is_ok_mpi .AND. (.NOT. is_ok_omp)) THEN |
---|
| 90 | fileout=TRIM(namefile)//'_'//num_mpi |
---|
| 91 | lunout=base_lunout |
---|
| 92 | ELSE IF ((.NOT. is_ok_mpi) .AND. is_ok_omp) THEN |
---|
| 93 | fileout=TRIM(namefile)//'_'//num_omp |
---|
| 94 | lunout=base_lunout+omp_rank |
---|
| 95 | ELSE |
---|
| 96 | fileout=TRIM(namefile) |
---|
| 97 | lunout=base_lunout |
---|
| 98 | ENDIF |
---|
| 99 | !open(UNIT=lunout,file=fileout, action='write',status='unknown', form='formatted', iostat=ierr2) |
---|
| 100 | !IF (ierr2 /= 0) THEN |
---|
| 101 | ! stop 'print_inca' |
---|
| 102 | !endif |
---|
| 103 | lunout = 6 |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | !$OMP MASTER |
---|
| 107 | IF (is_mpi_root) THEN |
---|
| 108 | outxml=base_lunout*10 |
---|
| 109 | open(UNIT=outxml,file='inca_IDxml.out', action='write',status='unknown', form='formatted', iostat=ierr2) |
---|
| 110 | IF (ierr2 /= 0) THEN |
---|
| 111 | stop 'print_inca xml' |
---|
| 112 | endif |
---|
| 113 | endif |
---|
| 114 | |
---|
| 115 | !$OMP END MASTER |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | END SUBROUTINE INIT_PRINT_INCA |
---|
| 119 | END MODULE PRINT_INCA |
---|