!$Id: ac_sulf.F90 10 2007-08-09 12:43:01Z 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. !! ========================================================================= SUBROUTINE FINDPLB( x, nx, xval, index ) !----------------------------------------------------------------------- ! ... "find periodic lower bound" ! Search the input array for the lower bound of the interval that ! contains the input value. The returned index satifies: ! x(index) .le. xval .lt. x(index+1) ! Assume the array represents values in one cycle of a periodic coordinate. ! So, if xval .lt. x(1), then index=nx. ! Stacy Walters, NCAR, 1998. !----------------------------------------------------------------------- USE PRINT_INCA IMPLICIT NONE !----------------------------------------------------------------------- ! ... Dummy args !----------------------------------------------------------------------- INTEGER, INTENT(in) :: nx INTEGER, INTENT(out) :: index REAL, INTENT(in) :: x(nx) ! strictly increasing array REAL, INTENT(in) :: xval !----------------------------------------------------------------------- ! ... Local variables !----------------------------------------------------------------------- INTEGER :: i IF( xval < x(1) .OR. xval >= x(nx) ) THEN index = nx RETURN END IF DO i = 2,nx IF( xval < x(i) ) THEN index = i - 1 EXIT END IF END DO END SUBROUTINE FINDPLB subroutine LININTP( npts, t1, t2, tint, f1, f2, fint ) !----------------------------------------------------------------------- ! ... Linearly interpolate between f1(t1) and f2(t2) to fint(tint) ! Stacy Walters, NCAR, 1998. !----------------------------------------------------------------------- implicit none !----------------------------------------------------------------------- ! ... Dummy args !----------------------------------------------------------------------- integer, intent(in) :: npts real, intent(in) :: t1 ! time level of f1 real, intent(in) :: t2 ! time level of f2 real, intent(in) :: tint ! interpolant time real, intent(in) :: f1(npts) ! field at time t1 real, intent(in) :: f2(npts) ! field at time t2 real, intent(out) :: fint(npts) ! field at time tint !----------------------------------------------------------------------- ! ... Local variables !----------------------------------------------------------------------- integer :: i real :: factor factor = (tint - t1) / (t2 - t1) do i = 1, npts fint(i) = f1(i) + ( f2(i) - f1(i) )*factor end do end subroutine LININTP