repo_name
stringlengths
7
81
path
stringlengths
4
224
copies
stringclasses
221 values
size
stringlengths
4
7
content
stringlengths
975
1.04M
license
stringclasses
15 values
iains/darwin-gcc-4-8
libgfortran/generated/_tanh_r8.F90
26
1472
! Copyright (C) 2002-2013 Free Software Foundation, Inc. ! Contributed by Paul Brook <paul@nowt.org> ! !This file is part of the GNU Fortran 95 runtime library (libgfortran). ! !GNU libgfortran is free software; you can redistribute it and/or !modify it under the terms of the GNU General Public !License as published by the Free Software Foundation; either !version 3 of the License, or (at your option) any later version. !GNU libgfortran is distributed in the hope that it will be useful, !but WITHOUT ANY WARRANTY; without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !GNU General Public License for more details. ! !Under Section 7 of GPL version 3, you are granted additional !permissions described in the GCC Runtime Library Exception, version !3.1, as published by the Free Software Foundation. ! !You should have received a copy of the GNU General Public License and !a copy of the GCC Runtime Library Exception along with this program; !see the files COPYING3 and COPYING.RUNTIME respectively. If not, see !<http://www.gnu.org/licenses/>. ! !This file is machine generated. #include "config.h" #include "kinds.inc" #include "c99_protos.inc" #if defined (HAVE_GFC_REAL_8) #ifdef HAVE_TANH elemental function _gfortran_specific__tanh_r8 (parm) real (kind=8), intent (in) :: parm real (kind=8) :: _gfortran_specific__tanh_r8 _gfortran_specific__tanh_r8 = tanh (parm) end function #endif #endif
gpl-2.0
iains/darwin-gcc-4-8
libgfortran/generated/_sin_r10.F90
26
1474
! Copyright (C) 2002-2013 Free Software Foundation, Inc. ! Contributed by Paul Brook <paul@nowt.org> ! !This file is part of the GNU Fortran 95 runtime library (libgfortran). ! !GNU libgfortran is free software; you can redistribute it and/or !modify it under the terms of the GNU General Public !License as published by the Free Software Foundation; either !version 3 of the License, or (at your option) any later version. !GNU libgfortran is distributed in the hope that it will be useful, !but WITHOUT ANY WARRANTY; without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !GNU General Public License for more details. ! !Under Section 7 of GPL version 3, you are granted additional !permissions described in the GCC Runtime Library Exception, version !3.1, as published by the Free Software Foundation. ! !You should have received a copy of the GNU General Public License and !a copy of the GCC Runtime Library Exception along with this program; !see the files COPYING3 and COPYING.RUNTIME respectively. If not, see !<http://www.gnu.org/licenses/>. ! !This file is machine generated. #include "config.h" #include "kinds.inc" #include "c99_protos.inc" #if defined (HAVE_GFC_REAL_10) #ifdef HAVE_SINL elemental function _gfortran_specific__sin_r10 (parm) real (kind=10), intent (in) :: parm real (kind=10) :: _gfortran_specific__sin_r10 _gfortran_specific__sin_r10 = sin (parm) end function #endif #endif
gpl-2.0
richardotis/scipy
scipy/sparse/linalg/eigen/arpack/ARPACK/SRC/dsesrt.f
171
5368
c----------------------------------------------------------------------- c\BeginDoc c c\Name: dsesrt c c\Description: c Sort the array X in the order specified by WHICH and optionally c apply the permutation to the columns of the matrix A. c c\Usage: c call dsesrt c ( WHICH, APPLY, N, X, NA, A, LDA) c c\Arguments c WHICH Character*2. (Input) c 'LM' -> X is sorted into increasing order of magnitude. c 'SM' -> X is sorted into decreasing order of magnitude. c 'LA' -> X is sorted into increasing order of algebraic. c 'SA' -> X is sorted into decreasing order of algebraic. c c APPLY Logical. (Input) c APPLY = .TRUE. -> apply the sorted order to A. c APPLY = .FALSE. -> do not apply the sorted order to A. c c N Integer. (INPUT) c Dimension of the array X. c c X Double precision array of length N. (INPUT/OUTPUT) c The array to be sorted. c c NA Integer. (INPUT) c Number of rows of the matrix A. c c A Double precision array of length NA by N. (INPUT/OUTPUT) c c LDA Integer. (INPUT) c Leading dimension of A. c c\EndDoc c c----------------------------------------------------------------------- c c\BeginLib c c\Routines c dswap Level 1 BLAS that swaps the contents of two vectors. c c\Authors c Danny Sorensen Phuong Vu c Richard Lehoucq CRPC / Rice University c Dept. of Computational & Houston, Texas c Applied Mathematics c Rice University c Houston, Texas c c\Revision history: c 12/15/93: Version ' 2.1'. c Adapted from the sort routine in LANSO and c the ARPACK code dsortr c c\SCCS Information: @(#) c FILE: sesrt.F SID: 2.3 DATE OF SID: 4/19/96 RELEASE: 2 c c\EndLib c c----------------------------------------------------------------------- c subroutine dsesrt (which, apply, n, x, na, a, lda) c c %------------------% c | Scalar Arguments | c %------------------% c character*2 which logical apply integer lda, n, na c c %-----------------% c | Array Arguments | c %-----------------% c Double precision & x(0:n-1), a(lda, 0:n-1) c c %---------------% c | Local Scalars | c %---------------% c integer i, igap, j Double precision & temp c c %----------------------% c | External Subroutines | c %----------------------% c external dswap c c %-----------------------% c | Executable Statements | c %-----------------------% c igap = n / 2 c if (which .eq. 'SA') then c c X is sorted into decreasing order of algebraic. c 10 continue if (igap .eq. 0) go to 9000 do 30 i = igap, n-1 j = i-igap 20 continue c if (j.lt.0) go to 30 c if (x(j).lt.x(j+igap)) then temp = x(j) x(j) = x(j+igap) x(j+igap) = temp if (apply) call dswap( na, a(1, j), 1, a(1,j+igap), 1) else go to 30 endif j = j-igap go to 20 30 continue igap = igap / 2 go to 10 c else if (which .eq. 'SM') then c c X is sorted into decreasing order of magnitude. c 40 continue if (igap .eq. 0) go to 9000 do 60 i = igap, n-1 j = i-igap 50 continue c if (j.lt.0) go to 60 c if (abs(x(j)).lt.abs(x(j+igap))) then temp = x(j) x(j) = x(j+igap) x(j+igap) = temp if (apply) call dswap( na, a(1, j), 1, a(1,j+igap), 1) else go to 60 endif j = j-igap go to 50 60 continue igap = igap / 2 go to 40 c else if (which .eq. 'LA') then c c X is sorted into increasing order of algebraic. c 70 continue if (igap .eq. 0) go to 9000 do 90 i = igap, n-1 j = i-igap 80 continue c if (j.lt.0) go to 90 c if (x(j).gt.x(j+igap)) then temp = x(j) x(j) = x(j+igap) x(j+igap) = temp if (apply) call dswap( na, a(1, j), 1, a(1,j+igap), 1) else go to 90 endif j = j-igap go to 80 90 continue igap = igap / 2 go to 70 c else if (which .eq. 'LM') then c c X is sorted into increasing order of magnitude. c 100 continue if (igap .eq. 0) go to 9000 do 120 i = igap, n-1 j = i-igap 110 continue c if (j.lt.0) go to 120 c if (abs(x(j)).gt.abs(x(j+igap))) then temp = x(j) x(j) = x(j+igap) x(j+igap) = temp if (apply) call dswap( na, a(1, j), 1, a(1,j+igap), 1) else go to 120 endif j = j-igap go to 110 120 continue igap = igap / 2 go to 100 end if c 9000 continue return c c %---------------% c | End of dsesrt | c %---------------% c end
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/pointer_check_6.f90
155
2749
! { dg-do run } ! { dg-options "-fcheck=pointer" } ! ! { dg-shouldfail "pointer check" } ! { dg-output ".*At line 104 of file .*Fortran runtime error: Pointer actual argument 'a' is not associated.*" } ! ! PR fortran/40604 ! ! The following cases are all valid, but were failing ! for one or the other reason. ! ! Contributed by Janus Weil and Tobias Burnus. ! subroutine test1() call test(uec=-1) contains subroutine test(str,uec) implicit none character*(*), intent(in), optional:: str integer, intent(in), optional :: uec end subroutine end subroutine test1 module m interface matrixMult Module procedure matrixMult_C2 End Interface contains subroutine test implicit none complex, dimension(0:3,0:3) :: m1,m2 print *,Trace(MatrixMult(m1,m2)) end subroutine complex function trace(a) implicit none complex, intent(in), dimension(0:3,0:3) :: a end function trace function matrixMult_C2(a,b) result(matrix) implicit none complex, dimension(0:3,0:3) :: matrix,a,b end function matrixMult_C2 end module m SUBROUTINE plotdop(amat) IMPLICIT NONE REAL, INTENT (IN) :: amat(3,3) integer :: i1 real :: pt(3) i1 = 1 pt = MATMUL(amat,(/i1,i1,i1/)) END SUBROUTINE plotdop FUNCTION evaluateFirst(s,n)result(number) IMPLICIT NONE CHARACTER(len =*), INTENT(inout) :: s INTEGER,OPTIONAL :: n REAL :: number number = 1.1 end function SUBROUTINE rw_inp(scpos) IMPLICIT NONE REAL scpos interface FUNCTION evaluateFirst(s,n)result(number) IMPLICIT NONE CHARACTER(len =*), INTENT(inout) :: s INTEGER,OPTIONAL :: n REAL :: number end function end interface CHARACTER(len=100) :: line scpos = evaluatefirst(line) END SUBROUTINE rw_inp program test integer, pointer :: a ! nullify(a) allocate(a) a = 1 call sub1a(a) call sub1b(a) call sub1c() contains subroutine sub1a(a) integer, pointer :: a call sub2(a) call sub3(a) call sub4(a) end subroutine sub1a subroutine sub1b(a) integer, pointer,optional :: a call sub2(a) call sub3(a) call sub4(a) end subroutine sub1b subroutine sub1c(a) integer, pointer,optional :: a call sub4(a) ! call sub2(a) ! << Invalid - working correctly, but not allowed in F2003 call sub3(a) ! << INVALID end subroutine sub1c subroutine sub4(b) integer, optional,pointer :: b end subroutine subroutine sub2(b) integer, optional :: b end subroutine subroutine sub3(b) integer :: b end subroutine end
gpl-2.0
iains/darwin-gcc-4-8
libgfortran/generated/_log_r4.F90
26
1468
! Copyright (C) 2002-2013 Free Software Foundation, Inc. ! Contributed by Paul Brook <paul@nowt.org> ! !This file is part of the GNU Fortran 95 runtime library (libgfortran). ! !GNU libgfortran is free software; you can redistribute it and/or !modify it under the terms of the GNU General Public !License as published by the Free Software Foundation; either !version 3 of the License, or (at your option) any later version. !GNU libgfortran is distributed in the hope that it will be useful, !but WITHOUT ANY WARRANTY; without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !GNU General Public License for more details. ! !Under Section 7 of GPL version 3, you are granted additional !permissions described in the GCC Runtime Library Exception, version !3.1, as published by the Free Software Foundation. ! !You should have received a copy of the GNU General Public License and !a copy of the GCC Runtime Library Exception along with this program; !see the files COPYING3 and COPYING.RUNTIME respectively. If not, see !<http://www.gnu.org/licenses/>. ! !This file is machine generated. #include "config.h" #include "kinds.inc" #include "c99_protos.inc" #if defined (HAVE_GFC_REAL_4) #ifdef HAVE_LOGF elemental function _gfortran_specific__log_r4 (parm) real (kind=4), intent (in) :: parm real (kind=4) :: _gfortran_specific__log_r4 _gfortran_specific__log_r4 = log (parm) end function #endif #endif
gpl-2.0
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.fortran-torture/execute/entry_7.f90
190
2079
! Test alternate entry points for functions when the result types ! of all entry points match function f1 (a) integer a, b integer, pointer :: f1, e1 allocate (f1) f1 = 15 + a return entry e1 (b) allocate (e1) e1 = 42 + b end function function f2 () real, pointer :: f2, e2 entry e2 () allocate (e2) e2 = 45 end function function f3 () double precision, pointer :: f3, e3 entry e3 () allocate (f3) f3 = 47 end function function f4 (a) result (r) double precision a, b double precision, pointer :: r, s allocate (r) r = 15 + a return entry e4 (b) result (s) allocate (s) s = 42 + b end function function f5 () result (r) integer, pointer :: r, s entry e5 () result (s) allocate (r) r = 45 end function function f6 () result (r) real, pointer :: r, s entry e6 () result (s) allocate (s) s = 47 end function program entrytest interface function f1 (a) integer a integer, pointer :: f1 end function function e1 (b) integer b integer, pointer :: e1 end function function f2 () real, pointer :: f2 end function function e2 () real, pointer :: e2 end function function f3 () double precision, pointer :: f3 end function function e3 () double precision, pointer :: e3 end function function f4 (a) double precision a double precision, pointer :: f4 end function function e4 (b) double precision b double precision, pointer :: e4 end function function f5 () integer, pointer :: f5 end function function e5 () integer, pointer :: e5 end function function f6 () real, pointer :: f6 end function function e6 () real, pointer :: e6 end function end interface double precision d if (f1 (6) .ne. 21) call abort () if (e1 (7) .ne. 49) call abort () if (f2 () .ne. 45) call abort () if (e2 () .ne. 45) call abort () if (f3 () .ne. 47) call abort () if (e3 () .ne. 47) call abort () d = 17 if (f4 (d) .ne. 32) call abort () if (e4 (d) .ne. 59) call abort () if (f5 () .ne. 45) call abort () if (e5 () .ne. 45) call abort () if (f6 () .ne. 47) call abort () if (e6 () .ne. 47) call abort () end
gpl-2.0
MALBECC/lio
lioamber/tbdft_subs.f90
3
13002
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! module tbdft_subs implicit none contains !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine tbdft_init(M_in, Nuc, natom, open_shell) use tbdft_data, only: MTB, MTBDFT, end_bTB, Iend_TB, rhoa_TBDFT, rhob_TBDFT,& gammaW implicit none logical, intent(in) :: open_shell integer, intent(in) :: M_in, natom integer, intent(in) :: Nuc(M_in) integer :: ii, jj MTBDFT=2*MTB+M_in allocate(Iend_TB(2,2*end_bTB), rhoa_TBDFT(MTBDFT,MTBDFT), gammaW(2*end_bTB)) if (open_shell) allocate (rhob_TBDFT(MTBDFT,MTBDFT)) open(unit=1001, file='gamma.in') do ii = 1, 2*end_bTB read(1001,*) gammaW(ii) enddo close(1001) jj = 0 do ii = 1, M_in if ((Nuc(ii) == 1) .or. (Nuc(ii) == natom)) then jj = jj +1 Iend_TB(1,jj) = Nuc(ii) Iend_TB(2,jj) = ii end if end do end subroutine tbdft_init !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine tbdft_td_init (M_in,rho, rho_0, thrddim) use tbdft_data, only: MTB, MTBDFT, rhoa_TBDFT, rhob_TBDFT, rhold_AOTB, & rhonew_AOTB implicit none integer , intent(in) :: M_in integer , intent(in) :: thrddim #ifdef TD_SIMPLE complex(kind=4), intent(in) :: rho_0(M_in,M_in,thrddim) complex(kind=4), intent(out) :: rho(MTBDFT,MTBDFT,thrddim) #else complex(kind=8), intent(in) :: rho_0(M_in,M_in,thrddim) complex(kind=8), intent(out) :: rho(MTBDFT,MTBDFT,thrddim) #endif integer :: ii, jj allocate(rhold_AOTB(MTBDFT,MTBDFT,thrddim), & rhonew_AOTB(MTBDFT,MTBDFT,thrddim)) rhold_AOTB = 0.0d0 rhonew_AOTB = 0.0d0 do jj = 1, MTBDFT do ii = 1, MTBDFT if (ii == jj) then rho(ii,jj,1) = cmplx(rhoa_TBDFT(ii,jj), 0.0D0) else rho(ii,jj,1) = cmplx(rhoa_TBDFT(ii,jj)/2.0d0, 0.0D0) end if end do end do ! Open shell option if (thrddim == 2) then do jj = 1, MTBDFT do ii = 1, MTBDFT if (ii == jj) then rho(ii,jj,2) = cmplx(rhob_TBDFT(ii,jj), 0.0D0) else rho(ii,jj,2) = cmplx(rhob_TBDFT(ii,jj)/2.0d0, 0.0D0) end if end do end do end if do jj = 1, M_in do ii = 1, M_in rho(ii+MTB,jj+MTB,:) = rho_0(ii,jj,:) end do end do end subroutine tbdft_td_init !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine getXY_TBDFT(M_in,x_in,y_in,xmat,ymat) use tbdft_data, only: MTB, MTBDFT implicit none integer , intent(in) :: M_in real(kind=8), intent(in) :: x_in(M_in,M_in) real(kind=8), intent(in) :: y_in(M_in,M_in) real(kind=8), intent(out) :: xmat(MTBDFT,MTBDFT) real(kind=8), intent(out) :: ymat(MTBDFT,MTBDFT) integer :: ii, jj xmat = 0.0d0 ymat = 0.0d0 do ii = 1, MTB xmat(ii,ii) = 1.0d0 xmat(MTB+M_in+ii,MTB+M_in+ii) = 1.0d0 ymat(ii,ii) = 1.0d0 ymat(MTB+M_in+ii,MTB+M_in+ii) = 1.0d0 end do do jj = 1, M_in do ii = 1, M_in xmat(MTB+ii, MTB+jj) = x_in(ii,jj) ymat(MTB+ii, MTB+jj) = y_in(ii,jj) end do end do end subroutine !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine construct_rhoTBDFT(M, rho, rho_0 ,rho_TBDFT, niter, open_shell) use tbdft_data , only: MTB, MTBDFT implicit none logical , intent(in) :: open_shell integer , intent(in) :: M integer , intent(in) :: niter real(kind=8), intent(in) :: rho_0(M,M) real(kind=8), intent(in) :: rho_TBDFT(MTBDFT,MTBDFT) real(kind=8), intent(out) :: rho(MTBDFT,MTBDFT) integer :: ii, jj real(kind=8) :: ocup ocup = 1.0d0 if (open_shell) ocup = 0.5d0 if (niter/=1) then do ii = 1 , MTBDFT do jj = ii+1, MTBDFT rho(ii,jj) = rho_TBDFT(ii,jj) / 2 rho(jj,ii) = rho(ii,jj) end do end do else if (niter == 1) then rho = 0.0D0 do ii = 1, MTB rho(ii,ii) = ocup rho(MTB+M+ii,MTB+M+ii) = ocup end do rho(MTB+1:MTB+M,MTB+1:MTB+M) = rho_0 end if end subroutine construct_rhoTBDFT !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine build_chimera_TBDFT (M_in,fock_in, fock_TBDFT, natom) use tbdft_data, only: MTBDFT, MTB, Iend_TB, end_bTB, alfaTB, betaTB, & gammaTB, Vbias_TB, gammaW integer , intent(in) :: M_in integer , intent(in) :: natom real(kind=8), intent(in) :: fock_in (M_in, M_in) real(kind=8), intent(out) :: fock_TBDFT (MTBDFT, MTBDFT) integer :: ii, link fock_TBDFT(:,:) = 0.0D0 do ii = 1, 2*end_bTB if (Iend_TB(1,ii) == 1) link = MTB if (Iend_TB(1,ii) == natom) link = MTB+M_in+1 fock_TBDFT(Iend_TB(2,ii)+MTB,link) = gammaW(ii) * gammaTB fock_TBDFT(link,Iend_TB(2,ii)+MTB) = gammaW(ii) * gammaTB end do do ii = 1,MTB fock_TBDFT(ii,ii) = alfaTB fock_TBDFT(MTB+M_in+ii, MTB+M_in+ii) = alfaTB if (ii<MTB) then fock_TBDFT(ii,ii+1) = betaTB fock_TBDFT(ii+1,ii) = betaTB fock_TBDFT(2*MTB+M_in-ii, 2*MTB+M_in-ii+1) = betaTB fock_TBDFT(2*MTB+M_in-ii+1, 2*MTB+M_in-ii) = betaTB end if end do fock_TBDFT(MTB+1:MTB+M_in, MTB+1:MTB+M_in) = fock_in(:,:) end subroutine build_chimera_TBDFT !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine extract_rhoDFT (M_in, rho_in, rho_out) use tbdft_data, only: MTBDFT, MTB implicit none integer , intent(in) :: M_in real(kind=8), intent(in) :: rho_in(MTBDFT,MTBDFT) real(kind=8), intent(out) :: rho_out(M_in,M_in) integer :: ii, jj rho_out=0.0D0 do jj = 1, M_in do ii = 1, M_in rho_out(ii,jj) = rho_in(MTB+ii,MTB+jj) end do end do end subroutine extract_rhoDFT !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine chimeraTBDFT_evol(M_in,fock_in, fock_TBDFT, natom, istep) use tbdft_data, only: MTBDFT, MTB, Iend_TB, end_bTB, alfaTB, betaTB, & gammaTB, Vbias_TB, start_tdtb, end_tdtb, gammaW integer , intent(in) :: M_in integer , intent(in) :: natom integer , intent(in) :: istep real(kind=8), intent(in) :: fock_in(M_in, M_in) real(kind=8), intent(out) :: fock_TBDFT(MTBDFT, MTBDFT) !temporal dimensions real(kind=8) :: pi = 4.0D0 * atan(1.0D0) real(kind=8) :: lambda, t_step, f_t integer :: ii, link lambda = 1.0d0 / real(end_tdtb - start_tdtb) if (istep < start_tdtb) then f_t = 0.0D0 else if ((istep >= start_tdtb) .and. (istep < end_tdtb)) then t_step = real(istep - start_tdtb) f_t = (-cos(pi * lambda * t_step) + 1.0D0) / 2.0D0 else if (istep >= end_tdtb) then f_t = 1.0D0 end if fock_TBDFT(:,:) = 0.0D0 do ii = 1, 2*end_bTB if (Iend_TB(1,ii) == 1) link = MTB if (Iend_TB(1,ii) == natom) link = MTB+M_in+1 fock_TBDFT(Iend_TB(2,ii)+MTB,link) = gammaW(ii) * gammaTB fock_TBDFT(link,Iend_TB(2,ii)+MTB) = gammaW(ii) * gammaTB end do do ii = 1,MTB fock_TBDFT(ii,ii) = alfaTB - (Vbias_TB / 2.0d0) * f_t fock_TBDFT(MTB+M_in+ii, MTB+M_in+ii) = alfaTB + & (Vbias_TB / 2.0d0) * f_t if (ii<MTB) then fock_TBDFT(ii,ii+1) = betaTB fock_TBDFT(ii+1,ii) = betaTB fock_TBDFT(2*MTB+M_in-ii, 2*MTB+M_in-ii+1) = betaTB fock_TBDFT(2*MTB+M_in-ii+1, 2*MTB+M_in-ii) = betaTB end if end do fock_TBDFT(MTB+1:MTB+M_in, MTB+1:MTB+M_in) = fock_in(:,:) end subroutine chimeraTBDFT_evol !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine TB_current (M_in,rhold,rhonew, overlap, TB_A, TB_B, TB_M) use tbdft_data, only:MTBDFT, MTB implicit none integer , intent(in) :: M_in real(kind=8) , intent(in) :: overlap(M_in, M_in) #ifdef TD_SIMPLE complex(kind=4), intent(in) :: rhold(MTBDFT,MTBDFT) complex(kind=4), intent(in) :: rhonew(MTBDFT,MTBDFT) #else complex(kind=8), intent(in) :: rhold(MTBDFT,MTBDFT) complex(kind=8), intent(in) :: rhonew(MTBDFT,MTBDFT) #endif real(kind=8) , intent(out) :: TB_A, TB_B, TB_M integer :: ii, jj real(kind=8) :: qe real(kind=8), allocatable :: delta_rho(:,:) allocate(delta_rho(MTBDFT,MTBDFT)) delta_rho = real(rhonew) - real(rhold) TB_A = 0.0D0 TB_B = 0.0D0 TB_M = 0.0D0 do ii = 1, MTB TB_A = delta_rho(ii,ii) + TB_A TB_B = delta_rho(MTB+M_in+ii, MTB+M_in+ii) + TB_B end do do ii = 1,M_in do jj = 1,M_in qe = delta_rho(MTB+ii,MTB+jj) * overlap(ii, jj) TB_M = qe + TB_M enddo enddo end subroutine TB_current !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine tbdft_scf_output(M_in, open_shell) use tbdft_data, only: rhoa_TBDFT, rhob_TBDFT, MTBDFT, MTB implicit none logical, intent(in) :: open_shell integer, intent(in) :: M_in real(kind=8) :: rho_aux(MTBDFT, MTBDFT) real(kind=8) :: chargeA_TB, chargeB_TB integer :: ii if (open_shell) then rho_aux = rhoa_TBDFT + rhob_TBDFT else rho_aux = rhoa_TBDFT end if chargeA_TB = MTB chargeB_TB = MTB do ii = 1, MTB chargeA_TB = chargeA_TB - rho_aux(ii,ii) chargeB_TB = chargeB_TB - rho_aux(MTB+M_in+ii,MTB+M_in+ii) end do ! Really? unit 20202? XD open(unit=20202, file='mullikenTB') write(20202,*) "Mulliken TB part A", chargeA_TB write(20202,*) "Mulliken TB part B", chargeB_TB close(20202) end subroutine tbdft_scf_output !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine tbdft_td_output(M_in, thrddim, rho_aux, overlap, istep, Iz, natom, & Nuc, open_shell) use tbdft_data, only: rhold_AOTB, rhonew_AOTB, MTB, MTBDFT implicit none logical , intent(in) :: open_shell integer , intent(in) :: M_in, istep, thrddim integer , intent(in) :: natom integer , intent(in) :: Nuc(M_in) integer , intent(in) :: Iz(natom) real(kind=8) , intent(in) :: overlap(M_in,M_in) #ifdef TD_SIMPLE complex(kind=4), intent(in) :: rho_aux(MTBDFT, MTBDFT,thrddim) #else complex(kind=8), intent(in) :: rho_aux(MTBDFT, MTBDFT,thrddim) #endif integer :: ii real(kind=8) :: I_TB_A(thrddim), I_TB_B(thrddim), I_TB_M(thrddim) real(kind=8) :: chargeA_TB, chargeB_TB, chargeM_TB real(kind=8) :: orb_charge, tot_orb_charge real(kind=8) :: qe(natom) real(kind=8) :: rhoscratch(M_in,M_in) if (istep == 1) then open(unit=10101,file='currentTB') open(unit=20202,file='mullikenTB') else if (open_shell) then call TB_current(M_in,rhold_AOTB(:,:,1),rhonew_AOTB(:,:,1), overlap, & I_TB_A(1), I_TB_B(1), I_TB_M(1)) call TB_current(M_in,rhold_AOTB(:,:,2),rhonew_AOTB(:,:,2), overlap, & I_TB_A(2), I_TB_B(2), I_TB_M(2)) write(10101,*) "Current TB part A", I_TB_A(1) + I_TB_A(2) write(10101,*) "Current TB part B", I_TB_B(1) + I_TB_B(2) write(10101,*) "Current DFT part M", I_TB_M(1) + I_TB_M(2) else call TB_current(M_in,rhold_AOTB(:,:,1),rhonew_AOTB(:,:,1), overlap, & I_TB_A(1), I_TB_B(1), I_TB_M(1)) write(10101,*) "Current TB part A", I_TB_A(1) write(10101,*) "Current TB part B", I_TB_B(1) write(10101,*) "Current DFT part M", I_TB_M(1) end if chargeA_TB = MTB chargeB_TB = MTB do ii = 1, MTB chargeA_TB = chargeA_TB - rho_aux(ii,ii,1) chargeB_TB = chargeB_TB - rho_aux(MTB+M_in+ii,MTB+M_in+ii,1) end do if (open_shell) then do ii = 1, MTB chargeA_TB = chargeA_TB - rho_aux(ii,ii,2) chargeB_TB = chargeB_TB - rho_aux(MTB+M_in+ii,MTB+M_in+ii,2) end do end if chargeM_TB = 0.0D0 do ii = 1,natom qe(ii) = Iz(ii) enddo rhoscratch = real(rho_aux(MTB+1:MTB+M_in,MTB+1:MTB+M_in,1)) call mulliken_calc(natom, M_in, rhoscratch, overlap, Nuc, qe) do ii = 1, natom chargeM_TB = chargeM_TB + qe(ii) enddo if (open_shell) then rhoscratch = real(rho_aux(MTB+1:MTB+M_in,MTB+1:MTB+M_in,2)) call mulliken_calc(natom, M_in, rhoscratch, overlap, Nuc, qe) do ii = 1,natom chargeM_TB = chargeM_TB + qe(ii) enddo end if write(20202,*) "Mulliken TB part A", chargeA_TB write(20202,*) "Mulliken TB part B", chargeB_TB write(20202,*) "Mulliken DFT part M", chargeM_TB endif end subroutine tbdft_td_output end module tbdft_subs
gpl-2.0
jiangmi/DQMC_PAM_dilute
BLAS/dasum.f
72
2558
*> \brief \b DASUM * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX) * * .. Scalar Arguments .. * INTEGER INCX,N * .. * .. Array Arguments .. * DOUBLE PRECISION DX(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DASUM takes the sum of the absolute values. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup double_blas_level1 * *> \par Further Details: * ===================== *> *> \verbatim *> *> jack dongarra, linpack, 3/11/78. *> modified 3/93 to return if incx .le. 0. *> modified 12/3/93, array(1) declarations changed to array(*) *> \endverbatim *> * ===================================================================== DOUBLE PRECISION FUNCTION DASUM(N,DX,INCX) * * -- Reference BLAS level1 routine (version 3.4.0) -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER INCX,N * .. * .. Array Arguments .. DOUBLE PRECISION DX(*) * .. * * ===================================================================== * * .. Local Scalars .. DOUBLE PRECISION DTEMP INTEGER I,M,MP1,NINCX * .. * .. Intrinsic Functions .. INTRINSIC DABS,MOD * .. DASUM = 0.0d0 DTEMP = 0.0d0 IF (N.LE.0 .OR. INCX.LE.0) RETURN IF (INCX.EQ.1) THEN * code for increment equal to 1 * * * clean-up loop * M = MOD(N,6) IF (M.NE.0) THEN DO I = 1,M DTEMP = DTEMP + DABS(DX(I)) END DO IF (N.LT.6) THEN DASUM = DTEMP RETURN END IF END IF MP1 = M + 1 DO I = MP1,N,6 DTEMP = DTEMP + DABS(DX(I)) + DABS(DX(I+1)) + $ DABS(DX(I+2)) + DABS(DX(I+3)) + $ DABS(DX(I+4)) + DABS(DX(I+5)) END DO ELSE * * code for increment not equal to 1 * NINCX = N*INCX DO I = 1,NINCX,INCX DTEMP = DTEMP + DABS(DX(I)) END DO END IF DASUM = DTEMP RETURN END
bsd-2-clause
richardotis/scipy
scipy/integrate/dop/dopri5.f
101
23979
SUBROUTINE DOPRI5(N,FCN,X,Y,XEND, & RTOL,ATOL,ITOL, & SOLOUT,IOUT, & WORK,LWORK,IWORK,LIWORK,RPAR,IPAR,IDID) C ---------------------------------------------------------- C NUMERICAL SOLUTION OF A SYSTEM OF FIRST 0RDER C ORDINARY DIFFERENTIAL EQUATIONS Y'=F(X,Y). C THIS IS AN EXPLICIT RUNGE-KUTTA METHOD OF ORDER (4)5 C DUE TO DORMAND & PRINCE (WITH STEPSIZE CONTROL AND C DENSE OUTPUT). C C AUTHORS: E. HAIRER AND G. WANNER C UNIVERSITE DE GENEVE, DEPT. DE MATHEMATIQUES C CH-1211 GENEVE 24, SWITZERLAND C E-MAIL: Ernst.Hairer@math.unige.ch C Gerhard.Wanner@math.unige.ch C C THIS CODE IS DESCRIBED IN: C E. HAIRER, S.P. NORSETT AND G. WANNER, SOLVING ORDINARY C DIFFERENTIAL EQUATIONS I. NONSTIFF PROBLEMS. 2ND EDITION. C SPRINGER SERIES IN COMPUTATIONAL MATHEMATICS, C SPRINGER-VERLAG (1993) C C VERSION OF APRIL 25, 1996 C (latest correction of a small bug: August 8, 2005) C C INPUT PARAMETERS C ---------------- C N DIMENSION OF THE SYSTEM C C FCN NAME (EXTERNAL) OF SUBROUTINE COMPUTING THE C VALUE OF F(X,Y): C SUBROUTINE FCN(N,X,Y,F,RPAR,IPAR) C DOUBLE PRECISION X,Y(N),F(N) C F(1)=... ETC. C C X INITIAL X-VALUE C C Y(N) INITIAL VALUES FOR Y C C XEND FINAL X-VALUE (XEND-X MAY BE POSITIVE OR NEGATIVE) C C RTOL,ATOL RELATIVE AND ABSOLUTE ERROR TOLERANCES. THEY C CAN BE BOTH SCALARS OR ELSE BOTH VECTORS OF LENGTH N. C C ITOL SWITCH FOR RTOL AND ATOL: C ITOL=0: BOTH RTOL AND ATOL ARE SCALARS. C THE CODE KEEPS, ROUGHLY, THE LOCAL ERROR OF C Y(I) BELOW RTOL*ABS(Y(I))+ATOL C ITOL=1: BOTH RTOL AND ATOL ARE VECTORS. C THE CODE KEEPS THE LOCAL ERROR OF Y(I) BELOW C RTOL(I)*ABS(Y(I))+ATOL(I). C C SOLOUT NAME (EXTERNAL) OF SUBROUTINE PROVIDING THE C NUMERICAL SOLUTION DURING INTEGRATION. C IF IOUT.GE.1, IT IS CALLED AFTER EVERY SUCCESSFUL STEP. C SUPPLY A DUMMY SUBROUTINE IF IOUT=0. C IT MUST HAVE THE FORM C SUBROUTINE SOLOUT (NR,XOLD,X,Y,N,CON,ICOMP,ND, C RPAR,IPAR,IRTRN) C DIMENSION Y(N),CON(5*ND),ICOMP(ND) C .... C SOLOUT FURNISHES THE SOLUTION "Y" AT THE NR-TH C GRID-POINT "X" (THEREBY THE INITIAL VALUE IS C THE FIRST GRID-POINT). C "XOLD" IS THE PRECEEDING GRID-POINT. C "IRTRN" SERVES TO INTERRUPT THE INTEGRATION. IF IRTRN C IS SET <0, DOPRI5 WILL RETURN TO THE CALLING PROGRAM. C IF THE NUMERICAL SOLUTION IS ALTERED IN SOLOUT, C SET IRTRN = 2 C C ----- CONTINUOUS OUTPUT: ----- C DURING CALLS TO "SOLOUT", A CONTINUOUS SOLUTION C FOR THE INTERVAL [XOLD,X] IS AVAILABLE THROUGH C THE FUNCTION C >>> CONTD5(I,S,CON,ICOMP,ND) <<< C WHICH PROVIDES AN APPROXIMATION TO THE I-TH C COMPONENT OF THE SOLUTION AT THE POINT S. THE VALUE C S SHOULD LIE IN THE INTERVAL [XOLD,X]. C C IOUT SWITCH FOR CALLING THE SUBROUTINE SOLOUT: C IOUT=0: SUBROUTINE IS NEVER CALLED C IOUT=1: SUBROUTINE IS USED FOR OUTPUT. C IOUT=2: DENSE OUTPUT IS PERFORMED IN SOLOUT C (IN THIS CASE WORK(5) MUST BE SPECIFIED) C C WORK ARRAY OF WORKING SPACE OF LENGTH "LWORK". C WORK(1),...,WORK(20) SERVE AS PARAMETERS FOR THE CODE. C FOR STANDARD USE, SET THEM TO ZERO BEFORE CALLING. C "LWORK" MUST BE AT LEAST 8*N+5*NRDENS+21 C WHERE NRDENS = IWORK(5) C C LWORK DECLARED LENGHT OF ARRAY "WORK". C C IWORK INTEGER WORKING SPACE OF LENGHT "LIWORK". C IWORK(1),...,IWORK(20) SERVE AS PARAMETERS FOR THE CODE. C FOR STANDARD USE, SET THEM TO ZERO BEFORE CALLING. C "LIWORK" MUST BE AT LEAST NRDENS+21 . C C LIWORK DECLARED LENGHT OF ARRAY "IWORK". C C RPAR, IPAR REAL AND INTEGER PARAMETERS (OR PARAMETER ARRAYS) WHICH C CAN BE USED FOR COMMUNICATION BETWEEN YOUR CALLING C PROGRAM AND THE FCN, JAC, MAS, SOLOUT SUBROUTINES. C C----------------------------------------------------------------------- C C SOPHISTICATED SETTING OF PARAMETERS C ----------------------------------- C SEVERAL PARAMETERS (WORK(1),...,IWORK(1),...) ALLOW C TO ADAPT THE CODE TO THE PROBLEM AND TO THE NEEDS OF C THE USER. FOR ZERO INPUT, THE CODE CHOOSES DEFAULT VALUES. C C WORK(1) UROUND, THE ROUNDING UNIT, DEFAULT 2.3D-16. C C WORK(2) THE SAFETY FACTOR IN STEP SIZE PREDICTION, C DEFAULT 0.9D0. C C WORK(3), WORK(4) PARAMETERS FOR STEP SIZE SELECTION C THE NEW STEP SIZE IS CHOSEN SUBJECT TO THE RESTRICTION C WORK(3) <= HNEW/HOLD <= WORK(4) C DEFAULT VALUES: WORK(3)=0.2D0, WORK(4)=10.D0 C C WORK(5) IS THE "BETA" FOR STABILIZED STEP SIZE CONTROL C (SEE SECTION IV.2). LARGER VALUES OF BETA ( <= 0.1 ) C MAKE THE STEP SIZE CONTROL MORE STABLE. DOPRI5 NEEDS C A LARGER BETA THAN HIGHAM & HALL. NEGATIVE WORK(5) C PROVOKE BETA=0. C DEFAULT 0.04D0. C C WORK(6) MAXIMAL STEP SIZE, DEFAULT XEND-X. C C WORK(7) INITIAL STEP SIZE, FOR WORK(7)=0.D0 AN INITIAL GUESS C IS COMPUTED WITH HELP OF THE FUNCTION HINIT C C IWORK(1) THIS IS THE MAXIMAL NUMBER OF ALLOWED STEPS. C THE DEFAULT VALUE (FOR IWORK(1)=0) IS 100000. C C IWORK(2) SWITCH FOR THE CHOICE OF THE COEFFICIENTS C IF IWORK(2).EQ.1 METHOD DOPRI5 OF DORMAND AND PRINCE C (TABLE 5.2 OF SECTION II.5). C AT THE MOMENT THIS IS THE ONLY POSSIBLE CHOICE. C THE DEFAULT VALUE (FOR IWORK(2)=0) IS IWORK(2)=1. C C IWORK(3) SWITCH FOR PRINTING ERROR MESSAGES C IF IWORK(3).LT.0 NO MESSAGES ARE BEING PRINTED C IF IWORK(3).GT.0 MESSAGES ARE PRINTED WITH C WRITE (IWORK(3),*) ... C DEFAULT VALUE (FOR IWORK(3)=0) IS IWORK(3)=6 C C IWORK(4) TEST FOR STIFFNESS IS ACTIVATED AFTER STEP NUMBER C J*IWORK(4) (J INTEGER), PROVIDED IWORK(4).GT.0. C FOR NEGATIVE IWORK(4) THE STIFFNESS TEST IS C NEVER ACTIVATED; DEFAULT VALUE IS IWORK(4)=1000 C C IWORK(5) = NRDENS = NUMBER OF COMPONENTS, FOR WHICH DENSE OUTPUT C IS REQUIRED; DEFAULT VALUE IS IWORK(5)=0; C FOR 0 < NRDENS < N THE COMPONENTS (FOR WHICH DENSE C OUTPUT IS REQUIRED) HAVE TO BE SPECIFIED IN C IWORK(21),...,IWORK(NRDENS+20); C FOR NRDENS=N THIS IS DONE BY THE CODE. C C---------------------------------------------------------------------- C C OUTPUT PARAMETERS C ----------------- C X X-VALUE FOR WHICH THE SOLUTION HAS BEEN COMPUTED C (AFTER SUCCESSFUL RETURN X=XEND). C C Y(N) NUMERICAL SOLUTION AT X C C H PREDICTED STEP SIZE OF THE LAST ACCEPTED STEP C C IDID REPORTS ON SUCCESSFULNESS UPON RETURN: C IDID= 1 COMPUTATION SUCCESSFUL, C IDID= 2 COMPUT. SUCCESSFUL (INTERRUPTED BY SOLOUT) C IDID=-1 INPUT IS NOT CONSISTENT, C IDID=-2 LARGER NMAX IS NEEDED, C IDID=-3 STEP SIZE BECOMES TOO SMALL. C IDID=-4 PROBLEM IS PROBABLY STIFF (INTERRUPTED). C C IWORK(17) NFCN NUMBER OF FUNCTION EVALUATIONS C IWORK(18) NSTEP NUMBER OF COMPUTED STEPS C IWORK(19) NACCPT NUMBER OF ACCEPTED STEPS C IWORK(20) NREJCT NUMBER OF REJECTED STEPS (DUE TO ERROR TEST), C (STEP REJECTIONS IN THE FIRST STEP ARE NOT COUNTED) C----------------------------------------------------------------------- C *** *** *** *** *** *** *** *** *** *** *** *** *** C DECLARATIONS C *** *** *** *** *** *** *** *** *** *** *** *** *** IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION Y(N),ATOL(*),RTOL(*),WORK(LWORK),IWORK(LIWORK) DIMENSION RPAR(*),IPAR(*) LOGICAL ARRET EXTERNAL FCN,SOLOUT C *** *** *** *** *** *** *** C SETTING THE PARAMETERS C *** *** *** *** *** *** *** NFCN=0 NSTEP=0 NACCPT=0 NREJCT=0 ARRET=.FALSE. C -------- IPRINT FOR MONITORING THE PRINTING IF(IWORK(3).EQ.0)THEN IPRINT=6 ELSE IPRINT=IWORK(3) END IF C -------- NMAX , THE MAXIMAL NUMBER OF STEPS ----- IF(IWORK(1).EQ.0)THEN NMAX=100000 ELSE NMAX=IWORK(1) IF(NMAX.LE.0)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' WRONG INPUT IWORK(1)=',IWORK(1) ARRET=.TRUE. END IF END IF C -------- METH COEFFICIENTS OF THE METHOD IF(IWORK(2).EQ.0)THEN METH=1 ELSE METH=IWORK(2) IF(METH.LE.0.OR.METH.GE.4)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' CURIOUS INPUT IWORK(2)=',IWORK(2) ARRET=.TRUE. END IF END IF C -------- NSTIFF PARAMETER FOR STIFFNESS DETECTION NSTIFF=IWORK(4) IF (NSTIFF.EQ.0) NSTIFF=1000 IF (NSTIFF.LT.0) NSTIFF=NMAX+10 C -------- NRDENS NUMBER OF DENSE OUTPUT COMPONENTS NRDENS=IWORK(5) IF(NRDENS.LT.0.OR.NRDENS.GT.N)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' CURIOUS INPUT IWORK(5)=',IWORK(5) ARRET=.TRUE. ELSE IF(NRDENS.GT.0.AND.IOUT.LT.2)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' WARNING: PUT IOUT=2 FOR DENSE OUTPUT ' END IF IF (NRDENS.EQ.N) THEN DO 16 I=1,NRDENS 16 IWORK(20+I)=I END IF END IF C -------- UROUND SMALLEST NUMBER SATISFYING 1.D0+UROUND>1.D0 IF(WORK(1).EQ.0.D0)THEN UROUND=2.3D-16 ELSE UROUND=WORK(1) IF(UROUND.LE.1.D-35.OR.UROUND.GE.1.D0)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' WHICH MACHINE DO YOU HAVE? YOUR UROUND WAS:',WORK(1) ARRET=.TRUE. END IF END IF C ------- SAFETY FACTOR ------------- IF(WORK(2).EQ.0.D0)THEN SAFE=0.9D0 ELSE SAFE=WORK(2) IF(SAFE.GE.1.D0.OR.SAFE.LE.1.D-4)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' CURIOUS INPUT FOR SAFETY FACTOR WORK(2)=',WORK(2) ARRET=.TRUE. END IF END IF C ------- FAC1,FAC2 PARAMETERS FOR STEP SIZE SELECTION IF(WORK(3).EQ.0.D0)THEN FAC1=0.2D0 ELSE FAC1=WORK(3) END IF IF(WORK(4).EQ.0.D0)THEN FAC2=10.D0 ELSE FAC2=WORK(4) END IF C --------- BETA FOR STEP CONTROL STABILIZATION ----------- IF(WORK(5).EQ.0.D0)THEN BETA=0.04D0 ELSE IF(WORK(5).LT.0.D0)THEN BETA=0.D0 ELSE BETA=WORK(5) IF(BETA.GT.0.2D0)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' CURIOUS INPUT FOR BETA: WORK(5)=',WORK(5) ARRET=.TRUE. END IF END IF END IF C -------- MAXIMAL STEP SIZE IF(WORK(6).EQ.0.D0)THEN HMAX=XEND-X ELSE HMAX=WORK(6) END IF C -------- INITIAL STEP SIZE H=WORK(7) C ------- PREPARE THE ENTRY-POINTS FOR THE ARRAYS IN WORK ----- IEY1=21 IEK1=IEY1+N IEK2=IEK1+N IEK3=IEK2+N IEK4=IEK3+N IEK5=IEK4+N IEK6=IEK5+N IEYS=IEK6+N IECO=IEYS+N C ------ TOTAL STORAGE REQUIREMENT ----------- ISTORE=IEYS+5*NRDENS-1 IF(ISTORE.GT.LWORK)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' INSUFFICIENT STORAGE FOR WORK, MIN. LWORK=',ISTORE ARRET=.TRUE. END IF ICOMP=21 ISTORE=ICOMP+NRDENS-1 IF(ISTORE.GT.LIWORK)THEN IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' INSUFFICIENT STORAGE FOR IWORK, MIN. LIWORK=',ISTORE ARRET=.TRUE. END IF C ------ WHEN A FAIL HAS OCCURED, WE RETURN WITH IDID=-1 IF (ARRET) THEN IDID=-1 RETURN END IF C -------- CALL TO CORE INTEGRATOR ------------ CALL DOPCOR(N,FCN,X,Y,XEND,HMAX,H,RTOL,ATOL,ITOL,IPRINT, & SOLOUT,IOUT,IDID,NMAX,UROUND,METH,NSTIFF,SAFE,BETA,FAC1,FAC2, & WORK(IEY1),WORK(IEK1),WORK(IEK2),WORK(IEK3),WORK(IEK4), & WORK(IEK5),WORK(IEK6),WORK(IEYS),WORK(IECO),IWORK(ICOMP), & NRDENS,RPAR,IPAR,NFCN,NSTEP,NACCPT,NREJCT) WORK(7)=H IWORK(17)=NFCN IWORK(18)=NSTEP IWORK(19)=NACCPT IWORK(20)=NREJCT C ----------- RETURN ----------- RETURN END C C C C ----- ... AND HERE IS THE CORE INTEGRATOR ---------- C SUBROUTINE DOPCOR(N,FCN,X,Y,XEND,HMAX,H,RTOL,ATOL,ITOL,IPRINT, & SOLOUT,IOUT,IDID,NMAX,UROUND,METH,NSTIFF,SAFE,BETA,FAC1,FAC2, & Y1,K1,K2,K3,K4,K5,K6,YSTI,CONT,ICOMP,NRD,RPAR,IPAR, & NFCN,NSTEP,NACCPT,NREJCT) C ---------------------------------------------------------- C CORE INTEGRATOR FOR DOPRI5 C PARAMETERS SAME AS IN DOPRI5 WITH WORKSPACE ADDED C ---------------------------------------------------------- C DECLARATIONS C ---------------------------------------------------------- IMPLICIT DOUBLE PRECISION (A-H,O-Z) DOUBLE PRECISION K1(N),K2(N),K3(N),K4(N),K5(N),K6(N) DIMENSION Y(N),Y1(N),YSTI(N),ATOL(*),RTOL(*),RPAR(*),IPAR(*) DIMENSION CONT(5*NRD),ICOMP(NRD) LOGICAL REJECT,LAST EXTERNAL FCN COMMON /CONDO5/XOLD,HOUT C *** *** *** *** *** *** *** C INITIALISATIONS C *** *** *** *** *** *** *** IF (METH.EQ.1) CALL CDOPRI(C2,C3,C4,C5,E1,E3,E4,E5,E6,E7, & A21,A31,A32,A41,A42,A43,A51,A52,A53,A54, & A61,A62,A63,A64,A65,A71,A73,A74,A75,A76, & D1,D3,D4,D5,D6,D7) FACOLD=1.D-4 EXPO1=0.2D0-BETA*0.75D0 FACC1=1.D0/FAC1 FACC2=1.D0/FAC2 POSNEG=SIGN(1.D0,XEND-X) C --- INITIAL PREPARATIONS ATOLI=ATOL(1) RTOLI=RTOL(1) LAST=.FALSE. HLAMB=0.D0 IASTI=0 CALL FCN(N,X,Y,K1,RPAR,IPAR) HMAX=ABS(HMAX) IORD=5 IF (H.EQ.0.D0) H=HINIT(N,FCN,X,Y,XEND,POSNEG,K1,K2,K3,IORD, & HMAX,ATOL,RTOL,ITOL,RPAR,IPAR) NFCN=NFCN+2 REJECT=.FALSE. XOLD=X IF (IOUT.NE.0) THEN IRTRN=1 HOUT=H CALL SOLOUT(NACCPT+1,XOLD,X,Y,N,CONT,ICOMP,NRD, & RPAR,IPAR,IRTRN) IF (IRTRN.LT.0) GOTO 79 ELSE IRTRN=0 END IF C --- BASIC INTEGRATION STEP 1 CONTINUE IF (NSTEP.GT.NMAX) GOTO 78 IF (0.1D0*ABS(H).LE.ABS(X)*UROUND)GOTO 77 IF ((X+1.01D0*H-XEND)*POSNEG.GT.0.D0) THEN H=XEND-X LAST=.TRUE. END IF NSTEP=NSTEP+1 C --- THE FIRST 6 STAGES IF (IRTRN.GE.2) THEN CALL FCN(N,X,Y,K1,RPAR,IPAR) END IF DO 22 I=1,N 22 Y1(I)=Y(I)+H*A21*K1(I) CALL FCN(N,X+C2*H,Y1,K2,RPAR,IPAR) DO 23 I=1,N 23 Y1(I)=Y(I)+H*(A31*K1(I)+A32*K2(I)) CALL FCN(N,X+C3*H,Y1,K3,RPAR,IPAR) DO 24 I=1,N 24 Y1(I)=Y(I)+H*(A41*K1(I)+A42*K2(I)+A43*K3(I)) CALL FCN(N,X+C4*H,Y1,K4,RPAR,IPAR) DO 25 I=1,N 25 Y1(I)=Y(I)+H*(A51*K1(I)+A52*K2(I)+A53*K3(I)+A54*K4(I)) CALL FCN(N,X+C5*H,Y1,K5,RPAR,IPAR) DO 26 I=1,N 26 YSTI(I)=Y(I)+H*(A61*K1(I)+A62*K2(I)+A63*K3(I)+A64*K4(I)+A65*K5(I)) XPH=X+H CALL FCN(N,XPH,YSTI,K6,RPAR,IPAR) DO 27 I=1,N 27 Y1(I)=Y(I)+H*(A71*K1(I)+A73*K3(I)+A74*K4(I)+A75*K5(I)+A76*K6(I)) CALL FCN(N,XPH,Y1,K2,RPAR,IPAR) IF (IOUT.GE.2) THEN DO 40 J=1,NRD I=ICOMP(J) CONT(4*NRD+J)=H*(D1*K1(I)+D3*K3(I)+D4*K4(I)+D5*K5(I) & +D6*K6(I)+D7*K2(I)) 40 CONTINUE END IF DO 28 I=1,N 28 K4(I)=(E1*K1(I)+E3*K3(I)+E4*K4(I)+E5*K5(I)+E6*K6(I)+E7*K2(I))*H NFCN=NFCN+6 C --- ERROR ESTIMATION ERR=0.D0 IF (ITOL.EQ.0) THEN DO 41 I=1,N SK=ATOLI+RTOLI*MAX(ABS(Y(I)),ABS(Y1(I))) 41 ERR=ERR+(K4(I)/SK)**2 ELSE DO 42 I=1,N SK=ATOL(I)+RTOL(I)*MAX(ABS(Y(I)),ABS(Y1(I))) 42 ERR=ERR+(K4(I)/SK)**2 END IF ERR=SQRT(ERR/N) C --- COMPUTATION OF HNEW FAC11=ERR**EXPO1 C --- LUND-STABILIZATION FAC=FAC11/FACOLD**BETA C --- WE REQUIRE FAC1 <= HNEW/H <= FAC2 FAC=MAX(FACC2,MIN(FACC1,FAC/SAFE)) HNEW=H/FAC IF(ERR.LE.1.D0)THEN C --- STEP IS ACCEPTED FACOLD=MAX(ERR,1.0D-4) NACCPT=NACCPT+1 C ------- STIFFNESS DETECTION IF (MOD(NACCPT,NSTIFF).EQ.0.OR.IASTI.GT.0) THEN STNUM=0.D0 STDEN=0.D0 DO 64 I=1,N STNUM=STNUM+(K2(I)-K6(I))**2 STDEN=STDEN+(Y1(I)-YSTI(I))**2 64 CONTINUE IF (STDEN.GT.0.D0) HLAMB=H*SQRT(STNUM/STDEN) IF (HLAMB.GT.3.25D0) THEN NONSTI=0 IASTI=IASTI+1 IF (IASTI.EQ.15) THEN IF (IPRINT.GT.0) WRITE (IPRINT,*) & ' THE PROBLEM SEEMS TO BECOME STIFF AT X = ',X IF (IPRINT.LE.0) GOTO 76 END IF ELSE NONSTI=NONSTI+1 IF (NONSTI.EQ.6) IASTI=0 END IF END IF IF (IOUT.GE.2) THEN DO 43 J=1,NRD I=ICOMP(J) YD0=Y(I) YDIFF=Y1(I)-YD0 BSPL=H*K1(I)-YDIFF CONT(J)=Y(I) CONT(NRD+J)=YDIFF CONT(2*NRD+J)=BSPL CONT(3*NRD+J)=-H*K2(I)+YDIFF-BSPL 43 CONTINUE END IF DO 44 I=1,N K1(I)=K2(I) 44 Y(I)=Y1(I) XOLD=X X=XPH IF (IOUT.NE.0) THEN HOUT=H CALL SOLOUT(NACCPT+1,XOLD,X,Y,N,CONT,ICOMP,NRD, & RPAR,IPAR,IRTRN) IF (IRTRN.LT.0) GOTO 79 END IF C ------- NORMAL EXIT IF (LAST) THEN H=HNEW IDID=1 RETURN END IF IF(ABS(HNEW).GT.HMAX)HNEW=POSNEG*HMAX IF(REJECT)HNEW=POSNEG*MIN(ABS(HNEW),ABS(H)) REJECT=.FALSE. ELSE C --- STEP IS REJECTED HNEW=H/MIN(FACC1,FAC11/SAFE) REJECT=.TRUE. IF(NACCPT.GE.1)NREJCT=NREJCT+1 LAST=.FALSE. END IF H=HNEW GOTO 1 C --- FAIL EXIT 76 CONTINUE IDID=-4 RETURN 77 CONTINUE IF (IPRINT.GT.0) WRITE(IPRINT,979)X IF (IPRINT.GT.0) WRITE(IPRINT,*)' STEP SIZE T0O SMALL, H=',H IDID=-3 RETURN 78 CONTINUE IF (IPRINT.GT.0) WRITE(IPRINT,979)X IF (IPRINT.GT.0) WRITE(IPRINT,*) & ' MORE THAN NMAX =',NMAX,'STEPS ARE NEEDED' IDID=-2 RETURN 79 CONTINUE IF (IPRINT.GT.0) WRITE(IPRINT,979)X 979 FORMAT(' EXIT OF DOPRI5 AT X=',E18.4) IDID=2 RETURN END C FUNCTION HINIT(N,FCN,X,Y,XEND,POSNEG,F0,F1,Y1,IORD, & HMAX,ATOL,RTOL,ITOL,RPAR,IPAR) C ---------------------------------------------------------- C ---- COMPUTATION OF AN INITIAL STEP SIZE GUESS C ---------------------------------------------------------- IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION Y(N),Y1(N),F0(N),F1(N),ATOL(*),RTOL(*) DIMENSION RPAR(*),IPAR(*) C ---- COMPUTE A FIRST GUESS FOR EXPLICIT EULER AS C ---- H = 0.01 * NORM (Y0) / NORM (F0) C ---- THE INCREMENT FOR EXPLICIT EULER IS SMALL C ---- COMPARED TO THE SOLUTION DNF=0.0D0 DNY=0.0D0 ATOLI=ATOL(1) RTOLI=RTOL(1) IF (ITOL.EQ.0) THEN DO 10 I=1,N SK=ATOLI+RTOLI*ABS(Y(I)) DNF=DNF+(F0(I)/SK)**2 10 DNY=DNY+(Y(I)/SK)**2 ELSE DO 11 I=1,N SK=ATOL(I)+RTOL(I)*ABS(Y(I)) DNF=DNF+(F0(I)/SK)**2 11 DNY=DNY+(Y(I)/SK)**2 END IF IF (DNF.LE.1.D-10.OR.DNY.LE.1.D-10) THEN H=1.0D-6 ELSE H=SQRT(DNY/DNF)*0.01D0 END IF H=MIN(H,HMAX) H=SIGN(H,POSNEG) C ---- PERFORM AN EXPLICIT EULER STEP DO 12 I=1,N 12 Y1(I)=Y(I)+H*F0(I) CALL FCN(N,X+H,Y1,F1,RPAR,IPAR) C ---- ESTIMATE THE SECOND DERIVATIVE OF THE SOLUTION DER2=0.0D0 IF (ITOL.EQ.0) THEN DO 15 I=1,N SK=ATOLI+RTOLI*ABS(Y(I)) 15 DER2=DER2+((F1(I)-F0(I))/SK)**2 ELSE DO 16 I=1,N SK=ATOL(I)+RTOL(I)*ABS(Y(I)) 16 DER2=DER2+((F1(I)-F0(I))/SK)**2 END IF DER2=SQRT(DER2)/H C ---- STEP SIZE IS COMPUTED SUCH THAT C ---- H**IORD * MAX ( NORM (F0), NORM (DER2)) = 0.01 DER12=MAX(ABS(DER2),SQRT(DNF)) IF (DER12.LE.1.D-15) THEN H1=MAX(1.0D-6,ABS(H)*1.0D-3) ELSE H1=(0.01D0/DER12)**(1.D0/IORD) END IF H=MIN(100*ABS(H),H1,HMAX) HINIT=SIGN(H,POSNEG) RETURN END C FUNCTION CONTD5(II,X,CON,ICOMP,ND) C ---------------------------------------------------------- C THIS FUNCTION CAN BE USED FOR CONTINUOUS OUTPUT IN CONNECTION C WITH THE OUTPUT-SUBROUTINE FOR DOPRI5. IT PROVIDES AN C APPROXIMATION TO THE II-TH COMPONENT OF THE SOLUTION AT X. C ---------------------------------------------------------- IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION CON(5*ND),ICOMP(ND) COMMON /CONDO5/XOLD,H C ----- COMPUTE PLACE OF II-TH COMPONENT I=0 DO 5 J=1,ND IF (ICOMP(J).EQ.II) I=J 5 CONTINUE IF (I.EQ.0) THEN WRITE (6,*) ' NO DENSE OUTPUT AVAILABLE FOR COMP.',II CONTD5=-1 RETURN END IF THETA=(X-XOLD)/H THETA1=1.D0-THETA CONTD5=CON(I)+THETA*(CON(ND+I)+THETA1*(CON(2*ND+I)+THETA* & (CON(3*ND+I)+THETA1*CON(4*ND+I)))) RETURN END C SUBROUTINE CDOPRI(C2,C3,C4,C5,E1,E3,E4,E5,E6,E7, & A21,A31,A32,A41,A42,A43,A51,A52,A53,A54, & A61,A62,A63,A64,A65,A71,A73,A74,A75,A76, & D1,D3,D4,D5,D6,D7) C ---------------------------------------------------------- C RUNGE-KUTTA COEFFICIENTS OF DORMAND AND PRINCE (1980) C ---------------------------------------------------------- IMPLICIT DOUBLE PRECISION (A-H,O-Z) C2=0.2D0 C3=0.3D0 C4=0.8D0 C5=8.D0/9.D0 A21=0.2D0 A31=3.D0/40.D0 A32=9.D0/40.D0 A41=44.D0/45.D0 A42=-56.D0/15.D0 A43=32.D0/9.D0 A51=19372.D0/6561.D0 A52=-25360.D0/2187.D0 A53=64448.D0/6561.D0 A54=-212.D0/729.D0 A61=9017.D0/3168.D0 A62=-355.D0/33.D0 A63=46732.D0/5247.D0 A64=49.D0/176.D0 A65=-5103.D0/18656.D0 A71=35.D0/384.D0 A73=500.D0/1113.D0 A74=125.D0/192.D0 A75=-2187.D0/6784.D0 A76=11.D0/84.D0 E1=71.D0/57600.D0 E3=-71.D0/16695.D0 E4=71.D0/1920.D0 E5=-17253.D0/339200.D0 E6=22.D0/525.D0 E7=-1.D0/40.D0 C ---- DENSE OUTPUT OF SHAMPINE (1986) D1=-12715105075.D0/11282082432.D0 D3=87487479700.D0/32700410799.D0 D4=-10690763975.D0/1880347072.D0 D5=701980252875.D0/199316789632.D0 D6=-1453857185.D0/822651844.D0 D7=69997945.D0/29380423.D0 RETURN END
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/interface_assignment_2.f90
136
1607
! { dg-do run } ! Checks the fix for PR32842, in which the interface assignment ! below caused a segfault. This testcase is reduced from vst_2.f95 ! in the iso_varying_string testsuite, from Lawrie Schonfelder ! ! Contributed by Tobias Burnus <burnus@gcc.gnu.org> ! module iso_varying_string implicit none integer, parameter :: GET_BUFFER_LEN = 256 type varying_string character(LEN=1), dimension(:), allocatable :: chars end type varying_string interface assignment(=) module procedure op_assign_VS_CH end interface assignment(=) contains elemental subroutine op_assign_VS_CH (var, expr) type(varying_string), intent(out) :: var character(LEN=*), intent(in) :: expr var = var_str(expr) end subroutine op_assign_VS_CH elemental function var_str (chr) result (string) character(LEN=*), intent(in) :: chr type(varying_string) :: string integer :: length integer :: i_char length = LEN(chr) ALLOCATE(string%chars(length)) forall(i_char = 1:length) string%chars(i_char) = chr(i_char:i_char) end forall end function var_str end module iso_varying_string PROGRAM VST_2 USE ISO_VARYING_STRING IMPLICIT NONE CHARACTER(LEN=5) :: char_arb(2) CHARACTER(LEN=1) :: char_elm(10) equivalence (char_arb, char_elm) type(VARYING_STRING) :: str_ara(2) char_arb(1)= "Hello" char_arb(2)= "World" str_ara = char_arb if (any (str_ara(1)%chars(1:5) .ne. char_elm(1:5))) call abort if (any (str_ara(2)%chars(1:5) .ne. char_elm(6:10))) call abort END PROGRAM VST_2
gpl-2.0
richardotis/scipy
scipy/special/cdflib/cumbet.f
151
2110
SUBROUTINE cumbet(x,y,a,b,cum,ccum) C********************************************************************** C C SUBROUTINE CUMBET(X,Y,A,B,CUM,CCUM) C Double precision cUMulative incomplete BETa distribution C C C Function C C C Calculates the cdf to X of the incomplete beta distribution C with parameters a and b. This is the integral from 0 to x C of (1/B(a,b))*f(t)) where f(t) = t**(a-1) * (1-t)**(b-1) C C C Arguments C C C X --> Upper limit of integration. C X is DOUBLE PRECISION C C Y --> 1 - X. C Y is DOUBLE PRECISION C C A --> First parameter of the beta distribution. C A is DOUBLE PRECISION C C B --> Second parameter of the beta distribution. C B is DOUBLE PRECISION C C CUM <-- Cumulative incomplete beta distribution. C CUM is DOUBLE PRECISION C C CCUM <-- Compliment of Cumulative incomplete beta distribution. C CCUM is DOUBLE PRECISION C C C Method C C C Calls the routine BRATIO. C C References C C Didonato, Armido R. and Morris, Alfred H. Jr. (1992) Algorithim C 708 Significant Digit Computation of the Incomplete Beta Function C Ratios. ACM ToMS, Vol.18, No. 3, Sept. 1992, 360-373. C C********************************************************************** C .. Scalar Arguments .. DOUBLE PRECISION x,y,a,b,cum,ccum C .. C .. Local Scalars .. INTEGER ierr C .. C .. External Routines .. EXTERNAL bratio C .. C .. Executable Statements .. IF (.NOT. (x.LE.0.0D0)) GO TO 10 cum = 0.0D0 ccum = 1.0D0 RETURN 10 IF (.NOT. (y.LE.0.0D0)) GO TO 20 cum = 1.0D0 ccum = 0.0D0 RETURN 20 CALL bratio(a,b,x,y,cum,ccum,ierr) C Call bratio routine RETURN END
bsd-3-clause
iains/darwin-gcc-4-8
libgfortran/generated/_log_c16.F90
26
1484
! Copyright (C) 2002-2013 Free Software Foundation, Inc. ! Contributed by Paul Brook <paul@nowt.org> ! !This file is part of the GNU Fortran 95 runtime library (libgfortran). ! !GNU libgfortran is free software; you can redistribute it and/or !modify it under the terms of the GNU General Public !License as published by the Free Software Foundation; either !version 3 of the License, or (at your option) any later version. !GNU libgfortran is distributed in the hope that it will be useful, !but WITHOUT ANY WARRANTY; without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !GNU General Public License for more details. ! !Under Section 7 of GPL version 3, you are granted additional !permissions described in the GCC Runtime Library Exception, version !3.1, as published by the Free Software Foundation. ! !You should have received a copy of the GNU General Public License and !a copy of the GCC Runtime Library Exception along with this program; !see the files COPYING3 and COPYING.RUNTIME respectively. If not, see !<http://www.gnu.org/licenses/>. ! !This file is machine generated. #include "config.h" #include "kinds.inc" #include "c99_protos.inc" #if defined (HAVE_GFC_COMPLEX_16) #ifdef HAVE_CLOGL elemental function _gfortran_specific__log_c16 (parm) complex (kind=16), intent (in) :: parm complex (kind=16) :: _gfortran_specific__log_c16 _gfortran_specific__log_c16 = log (parm) end function #endif #endif
gpl-2.0
aeklant/scipy
scipy/special/cdflib/rlog1.f
151
1422
DOUBLE PRECISION FUNCTION rlog1(x) C----------------------------------------------------------------------- C EVALUATION OF THE FUNCTION X - LN(1 + X) C----------------------------------------------------------------------- C .. Scalar Arguments .. DOUBLE PRECISION x C .. C .. Local Scalars .. DOUBLE PRECISION a,b,h,p0,p1,p2,q1,q2,r,t,w,w1 C .. C .. Intrinsic Functions .. INTRINSIC dble,dlog C .. C .. Data statements .. C------------------------ DATA a/.566749439387324D-01/ DATA b/.456512608815524D-01/ DATA p0/.333333333333333D+00/,p1/-.224696413112536D+00/, + p2/.620886815375787D-02/ DATA q1/-.127408923933623D+01/,q2/.354508718369557D+00/ C .. C .. Executable Statements .. C------------------------ IF (x.LT.-0.39D0 .OR. x.GT.0.57D0) GO TO 40 IF (x.LT.-0.18D0) GO TO 10 IF (x.GT.0.18D0) GO TO 20 C C ARGUMENT REDUCTION C h = x w1 = 0.0D0 GO TO 30 C 10 h = dble(x) + 0.3D0 h = h/0.7D0 w1 = a - h*0.3D0 GO TO 30 C 20 h = 0.75D0*dble(x) - 0.25D0 w1 = b + h/3.0D0 C C SERIES EXPANSION C 30 r = h/ (h+2.0D0) t = r*r w = ((p2*t+p1)*t+p0)/ ((q2*t+q1)*t+1.0D0) rlog1 = 2.0D0*t* (1.0D0/ (1.0D0-r)-r*w) + w1 RETURN C C 40 w = (x+0.5D0) + 0.5D0 rlog1 = x - dlog(w) RETURN END
bsd-3-clause
RSIA-LIESMARS-WHU/LSHBOX
include/eigen/lapack/iladlc.f
272
2952
*> \brief \b ILADLC * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download ILADLC + dependencies *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/iladlc.f"> *> [TGZ]</a> *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/iladlc.f"> *> [ZIP]</a> *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/iladlc.f"> *> [TXT]</a> *> \endhtmlonly * * Definition: * =========== * * INTEGER FUNCTION ILADLC( M, N, A, LDA ) * * .. Scalar Arguments .. * INTEGER M, N, LDA * .. * .. Array Arguments .. * DOUBLE PRECISION A( LDA, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> ILADLC scans A for its last non-zero column. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> The number of rows of the matrix A. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The number of columns of the matrix A. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION array, dimension (LDA,N) *> The m by n matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,M). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup auxOTHERauxiliary * * ===================================================================== INTEGER FUNCTION ILADLC( M, N, A, LDA ) * * -- LAPACK auxiliary routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. INTEGER M, N, LDA * .. * .. Array Arguments .. DOUBLE PRECISION A( LDA, * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D+0 ) * .. * .. Local Scalars .. INTEGER I * .. * .. Executable Statements .. * * Quick test for the common case where one corner is non-zero. IF( N.EQ.0 ) THEN ILADLC = N ELSE IF( A(1, N).NE.ZERO .OR. A(M, N).NE.ZERO ) THEN ILADLC = N ELSE * Now scan each column from the end, returning with the first non-zero. DO ILADLC = N, 1, -1 DO I = 1, M IF( A(I, ILADLC).NE.ZERO ) RETURN END DO END DO END IF RETURN END
gpl-3.0
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/protected_5.f90
136
1573
! { dg-do compile } ! { dg-shouldfail "Invalid Fortran 2003 code" } ! { dg-options "-std=f2003 -fall-intrinsics" } ! PR fortran/23994 ! ! Test PROTECTED attribute. Within the module everything is allowed. ! Outside (use-associated): For pointers, their association status ! may not be changed. For nonpointers, their value may not be changed. ! ! Test of a invalid code module good1 implicit none integer :: a integer :: b,c protected :: c equivalence (a,c) ! { dg-error "Either all or none of the objects in the EQUIVALENCE" } end module good1 module bad1 implicit none integer, protected :: a integer :: b,c protected :: c equivalence (a,b) ! { dg-error "Either all or none of the objects in the EQUIVALENCE" } end module bad1 module bad2 implicit none integer, protected :: a integer :: b,c,d protected :: c common /one/ a,b ! { dg-error "PROTECTED attribute conflicts with COMMON" } common /two/ c,d ! { dg-error "PROTECTED attribute conflicts with COMMON" } end module bad2 module good2 implicit none type myT integer :: j integer, pointer :: p real, allocatable, dimension(:) :: array end type myT type(myT), save :: t protected :: t end module good2 program main use good2 implicit none t%j = 15 ! { dg-error "variable definition context" } nullify(t%p) ! { dg-error "pointer association context" } allocate(t%array(15))! { dg-error "variable definition context" } end program main
gpl-2.0
MALBECC/lio
lioamber/liosubs_math/transform_gen.f90
3
1267
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! ! transform generic procedure ! ! HEADER DESCRIPTION PENDING ! !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! function transform_gen( Bmat, Cmat ) result( Dmat ) implicit none GEN_TYPE , intent(in) :: Bmat(:,:) double precision, intent(in) :: Cmat(:,:) GEN_TYPE , allocatable :: Dmat(:,:), Xmat(:,:) double precision, allocatable :: Amat(:,:) logical :: error_found if (allocated(Amat)) deallocate(Amat) allocate(Amat(size(Cmat,2), size(Cmat,1))) Amat = transpose(Cmat) # include "matmul3_body.f90" ! This does not seem to work as intended. I am leaving it here for future ! reference -- F. Pedron Oct/2018 !if (allocated(Mato)) deallocate(Mato) !allocate(Mato( size(Mati,1), size(Mati,2) )) !do jj = 1, size(Mati,2) !do ii = 1, size(Mati,1) ! Mato(ii,jj) = 0.0d0 ! do kj = 1, size(Mati,2) ! do ki = 1, size(Mati,1) ! Mato(ii,jj) = Mato(ii,jj) + Bmat(ki,ii) * Mati(ki,kj) * Bmat(kj,jj) ! end do ! end do !end do !end do deallocate(Amat) end function transform_gen !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%!
gpl-2.0
MALBECC/lio
lioamber/liosubs/atmvec_to_orbvec.header.f90
3
1866
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine atmvec_to_orbvec_n( atmvec, atm_of_orb, orbvec ) implicit none integer , intent(in) :: atmvec(:) integer , intent(in) :: atm_of_orb(:) integer , intent(out) :: orbvec(:) # include "atmvec_to_orbvec.proced.f90" end subroutine atmvec_to_orbvec_n !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine atmvec_to_orbvec_r( atmvec, atm_of_orb, orbvec ) implicit none real*4 , intent(in) :: atmvec(:) integer , intent(in) :: atm_of_orb(:) real*4 , intent(out) :: orbvec(:) # include "atmvec_to_orbvec.proced.f90" end subroutine atmvec_to_orbvec_r !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine atmvec_to_orbvec_d( atmvec, atm_of_orb, orbvec ) implicit none real*8 , intent(in) :: atmvec(:) integer , intent(in) :: atm_of_orb(:) real*8 , intent(out) :: orbvec(:) # include "atmvec_to_orbvec.proced.f90" end subroutine atmvec_to_orbvec_d !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine atmvec_to_orbvec_c( atmvec, atm_of_orb, orbvec ) implicit none complex*8 , intent(in) :: atmvec(:) integer , intent(in) :: atm_of_orb(:) complex*8 , intent(out) :: orbvec(:) # include "atmvec_to_orbvec.proced.f90" end subroutine atmvec_to_orbvec_c !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! subroutine atmvec_to_orbvec_z( atmvec, atm_of_orb, orbvec ) implicit none complex*16, intent(in) :: atmvec(:) integer , intent(in) :: atm_of_orb(:) complex*16, intent(out) :: orbvec(:) # include "atmvec_to_orbvec.proced.f90" end subroutine atmvec_to_orbvec_z !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%!
gpl-2.0
aeklant/scipy
scipy/special/cdflib/cumfnc.f
44
5329
SUBROUTINE cumfnc(f,dfn,dfd,pnonc,cum,ccum,status) C********************************************************************** C C F -NON- -C-ENTRAL F DISTRIBUTION C C C C Function C C C COMPUTES NONCENTRAL F DISTRIBUTION WITH DFN AND DFD C DEGREES OF FREEDOM AND NONCENTRALITY PARAMETER PNONC C C C Arguments C C C X --> UPPER LIMIT OF INTEGRATION OF NONCENTRAL F IN EQUATION C C DFN --> DEGREES OF FREEDOM OF NUMERATOR C C DFD --> DEGREES OF FREEDOM OF DENOMINATOR C C PNONC --> NONCENTRALITY PARAMETER. C C CUM <-- CUMULATIVE NONCENTRAL F DISTRIBUTION C C CCUM <-- COMPLIMENT OF CUMMULATIVE C C C Method C C C USES FORMULA 26.6.20 OF REFERENCE FOR INFINITE SERIES. C SERIES IS CALCULATED BACKWARD AND FORWARD FROM J = LAMBDA/2 C (THIS IS THE TERM WITH THE LARGEST POISSON WEIGHT) UNTIL C THE CONVERGENCE CRITERION IS MET. C C FOR SPEED, THE INCOMPLETE BETA FUNCTIONS ARE EVALUATED C BY FORMULA 26.5.16. C C C REFERENCE C C C HANDBOOD OF MATHEMATICAL FUNCTIONS C EDITED BY MILTON ABRAMOWITZ AND IRENE A. STEGUN C NATIONAL BUREAU OF STANDARDS APPLIED MATEMATICS SERIES - 55 C MARCH 1965 C P 947, EQUATIONS 26.6.17, 26.6.18 C C C Note C C C THE SUM CONTINUES UNTIL A SUCCEEDING TERM IS LESS THAN EPS C TIMES THE SUM (OR THE SUM IS LESS THAN 1.0E-20). EPS IS C SET TO 1.0E-4 IN A DATA STATEMENT WHICH CAN BE CHANGED. C C********************************************************************** C .. Scalar Arguments .. DOUBLE PRECISION dfd,dfn,pnonc,f,cum,ccum C .. C .. Local Scalars .. DOUBLE PRECISION dsum,dummy,prod,xx,yy DOUBLE PRECISION adn,aup,b,betdn,betup,centwt,dnterm,eps,sum, + upterm,xmult,xnonc,x,abstol INTEGER i,icent,ierr,status C .. C .. External Functions .. DOUBLE PRECISION alngam, betaln EXTERNAL alngam, betaln C .. C .. Intrinsic Functions .. INTRINSIC log,dble,exp C .. C .. Statement Functions .. LOGICAL qsmall C .. C .. External Subroutines .. EXTERNAL bratio,cumf C .. C .. Parameters .. DOUBLE PRECISION half PARAMETER (half=0.5D0) DOUBLE PRECISION done PARAMETER (done=1.0D0) C .. C .. Data statements .. DATA eps/1.0D-4/ DATA abstol/1.0D-300/ C .. C .. Statement Function definitions .. qsmall(x) = .NOT. (sum .GE. abstol .AND. x .GE. eps*sum) C .. C .. Executable Statements .. C status = 0 IF (.NOT. (f.LE.0.0D0)) GO TO 10 cum = 0.0D0 ccum = 1.0D0 RETURN 10 IF (.NOT. (pnonc.LT.1.0D-10)) GO TO 20 C C Handle case in which the non-centrality parameter is C (essentially) zero. CALL cumf(f,dfn,dfd,cum,ccum) RETURN 20 xnonc = pnonc/2.0D0 C Calculate the central term of the poisson weighting factor. icent = xnonc IF (.NOT.(DABS(xnonc-icent).LT.1)) THEN status = 1 RETURN ENDIF IF (icent.EQ.0) icent = 1 C Compute central weight term centwt = exp(-xnonc+icent*log(xnonc)-alngam(dble(icent+1))) C Compute central incomplete beta term C Assure that minimum of arg to beta and 1 - arg is computed C accurately. prod = dfn*f dsum = dfd + prod yy = dfd/dsum IF (yy.GT.half) THEN xx = prod/dsum yy = done - xx ELSE xx = done - yy END IF CALL bratio(dfn*half+dble(icent),dfd*half,xx,yy,betdn,dummy,ierr) adn = dfn/2.0D0 + dble(icent) aup = adn b = dfd/2.0D0 betup = betdn sum = centwt*betdn C Now sum terms backward from icent until convergence or all done xmult = centwt i = icent IF (adn.LT.2D0) THEN dnterm = exp(alngam(adn+b)-alngam(adn+1.0D0)-alngam(b)+ + adn*log(xx)+b*log(yy)) ELSE C Same expression, but avoid problems for large adn dnterm = exp(-betaln(adn,b)-log(adn)+ + adn*log(xx)+b*log(yy)) END IF 30 IF (qsmall(xmult*betdn) .OR. i.LE.0) GO TO 40 xmult = xmult* (i/xnonc) i = i - 1 adn = adn - 1 dnterm = (adn+1)/ ((adn+b)*xx)*dnterm betdn = betdn + dnterm sum = sum + xmult*betdn GO TO 30 40 i = icent + 1 C Now sum forwards until convergence xmult = centwt IF ((aup-1+b).EQ.0) THEN upterm = exp(-alngam(aup)-alngam(b)+ (aup-1)*log(xx)+ + b*log(yy)) ELSE IF (aup.LT.2D0) THEN upterm = exp(alngam(aup-1+b)-alngam(aup)-alngam(b)+ + (aup-1)*log(xx)+b*log(yy)) ELSE C Same expression, but avoid problems for large aup upterm = exp(-betaln(aup-1,b)-log(aup-1)+ + (aup-1)*log(xx)+b*log(yy)) END IF END IF GO TO 60 50 IF (qsmall(xmult*betup)) GO TO 70 60 xmult = xmult* (xnonc/i) i = i + 1 aup = aup + 1 upterm = (aup+b-2.0D0)*xx/ (aup-1)*upterm betup = betup - upterm sum = sum + xmult*betup GO TO 50 70 cum = sum ccum = 0.5D0 + (0.5D0-cum) RETURN END
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/gomp/allocatable_components_1.f90
36
1263
! { dg-do compile } ! ! PR fortran/32467 ! Derived types with allocatable components ! MODULE test_allocatable_components type :: t integer, allocatable :: a(:) end type CONTAINS SUBROUTINE test_copyin() TYPE(t), SAVE :: a !$omp threadprivate(a) !$omp parallel copyin(a) ! { dg-error "has ALLOCATABLE components" } ! do something !$omp end parallel END SUBROUTINE SUBROUTINE test_copyprivate() TYPE(t) :: a !$omp single ! { dg-error "has ALLOCATABLE components" } ! do something !$omp end single copyprivate (a) END SUBROUTINE SUBROUTINE test_firstprivate TYPE(t) :: a !$omp parallel firstprivate(a) ! { dg-error "has ALLOCATABLE components" } ! do something !$omp end parallel END SUBROUTINE SUBROUTINE test_lastprivate TYPE(t) :: a INTEGER :: i !$omp parallel do lastprivate(a) ! { dg-error "has ALLOCATABLE components" } DO i = 1, 1 END DO !$omp end parallel do END SUBROUTINE SUBROUTINE test_reduction TYPE(t) :: a(10) INTEGER :: i !$omp parallel do reduction(+: a) ! { dg-error "must be of numeric type" } DO i = 1, SIZE(a) END DO !$omp end parallel do END SUBROUTINE END MODULE
gpl-2.0
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/entry_17.f90
181
1157
function test1(n) integer :: n character(n) :: test1 character(n) :: bar1 test1 = "" return entry bar1() bar1 = "" end function test1 function test2() character(1) :: test2 character(1) :: bar2 test2 = "" return entry bar2() bar2 = "" end function test2 function test3() ! { dg-warning "Obsolescent feature" } character(*) :: test3 character(*) :: bar3 ! { dg-warning "Obsolescent feature" } test3 = "" return entry bar3() bar3 = "" end function test3 function test4(n) ! { dg-warning "returning variables of different string lengths" } integer :: n character(n) :: test4 character(*) :: bar4 ! { dg-warning "Obsolescent feature" } test4 = "" return entry bar4() bar4 = "" end function test4 function test5() ! { dg-warning "returning variables of different string lengths" } character(1) :: test5 character(2) :: bar5 test5 = "" return entry bar5() bar5 = "" end function test5 function test6() ! { dg-warning "Obsolescent feature|returning variables of different string lengths" } character(*) :: test6 character(2) :: bar6 test6 = "" return entry bar6() bar6 = "" end function test6
gpl-2.0
richardotis/scipy
scipy/linalg/src/id_dist/src/idz_snorm.f
139
12408
c this file contains the following user-callable routines: c c c routine idz_snorm estimates the spectral norm c of a matrix specified by routines for applying the matrix c and its adjoint to arbitrary vectors. This routine uses c the power method with a random starting vector. c c routine idz_diffsnorm estimates the spectral norm c of the difference between two matrices specified by routines c for applying the matrices and their adjoints c to arbitrary vectors. This routine uses c the power method with a random starting vector. c c routine idz_enorm calculates the Euclidean norm of a vector. c c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c c c subroutine idz_snorm(m,n,matveca,p1a,p2a,p3a,p4a, 1 matvec,p1,p2,p3,p4,its,snorm,v,u) c c estimates the spectral norm of a matrix a specified c by a routine matvec for applying a to an arbitrary vector, c and by a routine matveca for applying a^* c to an arbitrary vector. This routine uses the power method c with a random starting vector. c c input: c m -- number of rows in a c n -- number of columns in a c matveca -- routine which applies the adjoint of a c to an arbitrary vector; this routine must have c a calling sequence of the form c c matveca(m,x,n,y,p1a,p2a,p3a,p4a), c c where m is the length of x, c x is the vector to which the adjoint of a c is to be applied, c n is the length of y, c y is the product of the adjoint of a and x, c and p1a, p2a, p3a, and p4a are user-specified c parameters c p1a -- parameter to be passed to routine matveca c p2a -- parameter to be passed to routine matveca c p3a -- parameter to be passed to routine matveca c p4a -- parameter to be passed to routine matveca c matvec -- routine which applies the matrix a c to an arbitrary vector; this routine must have c a calling sequence of the form c c matvec(n,x,m,y,p1,p2,p3,p4), c c where n is the length of x, c x is the vector to which a is to be applied, c m is the length of y, c y is the product of a and x, c and p1, p2, p3, and p4 are user-specified parameters c p1 -- parameter to be passed to routine matvec c p2 -- parameter to be passed to routine matvec c p3 -- parameter to be passed to routine matvec c p4 -- parameter to be passed to routine matvec c its -- number of iterations of the power method to conduct c c output: c snorm -- estimate of the spectral norm of a c v -- estimate of a normalized right singular vector c corresponding to the greatest singular value of a c c work: c u -- must be at least m complex*16 elements long c c reference: c Kuczynski and Wozniakowski, "Estimating the largest eigenvalue c by the power and Lanczos algorithms with a random start," c SIAM Journal on Matrix Analysis and Applications, c 13 (4): 1992, 1094-1122. c implicit none integer m,n,its,it,n2,k real*8 snorm,enorm complex*16 p1a,p2a,p3a,p4a,p1,p2,p3,p4,u(m),v(n) external matveca,matvec c c c Fill the real and imaginary parts of each entry c of the initial vector v with i.i.d. random variables c drawn uniformly from [-1,1]. c n2 = 2*n call id_srand(n2,v) c do k = 1,n v(k) = 2*v(k)-1 enddo ! k c c c Normalize v. c call idz_enorm(n,v,enorm) c do k = 1,n v(k) = v(k)/enorm enddo ! k c c do it = 1,its c c Apply a to v, obtaining u. c call matvec(n,v,m,u,p1,p2,p3,p4) c c Apply a^* to u, obtaining v. c call matveca(m,u,n,v,p1a,p2a,p3a,p4a) c c Normalize v. c call idz_enorm(n,v,snorm) c if(snorm .ne. 0) then c do k = 1,n v(k) = v(k)/snorm enddo ! k c endif c snorm = sqrt(snorm) c enddo ! it c c return end c c c c subroutine idz_enorm(n,v,enorm) c c computes the Euclidean norm of v, the square root c of the sum of the squares of the absolute values c of the entries of v. c c input: c n -- length of v c v -- vector whose Euclidean norm is to be calculated c c output: c enorm -- Euclidean norm of v c implicit none integer n,k real*8 enorm complex*16 v(n) c c enorm = 0 c do k = 1,n enorm = enorm+v(k)*conjg(v(k)) enddo ! k c enorm = sqrt(enorm) c c return end c c c c subroutine idz_diffsnorm(m,n,matveca,p1a,p2a,p3a,p4a, 1 matveca2,p1a2,p2a2,p3a2,p4a2, 2 matvec,p1,p2,p3,p4, 3 matvec2,p12,p22,p32,p42,its,snorm,w) c c estimates the spectral norm of the difference between matrices c a and a2, where a is specified by routines matvec and matveca c for applying a and a^* to arbitrary vectors, c and a2 is specified by routines matvec2 and matveca2 c for applying a2 and (a2)^* to arbitrary vectors. c This routine uses the power method c with a random starting vector. c c input: c m -- number of rows in a, as well as the number of rows in a2 c n -- number of columns in a, as well as the number of columns c in a2 c matveca -- routine which applies the adjoint of a c to an arbitrary vector; this routine must have c a calling sequence of the form c c matveca(m,x,n,y,p1a,p2a,p3a,p4a), c c where m is the length of x, c x is the vector to which the adjoint of a c is to be applied, c n is the length of y, c y is the product of the adjoint of a and x, c and p1a, p2a, p3a, and p4a are user-specified c parameters c p1a -- parameter to be passed to routine matveca c p2a -- parameter to be passed to routine matveca c p3a -- parameter to be passed to routine matveca c p4a -- parameter to be passed to routine matveca c matveca2 -- routine which applies the adjoint of a2 c to an arbitrary vector; this routine must have c a calling sequence of the form c c matveca2(m,x,n,y,p1a2,p2a2,p3a2,p4a2), c c where m is the length of x, c x is the vector to which the adjoint of a2 c is to be applied, c n is the length of y, c y is the product of the adjoint of a2 and x, c and p1a2, p2a2, p3a2, and p4a2 are user-specified c parameters c p1a2 -- parameter to be passed to routine matveca2 c p2a2 -- parameter to be passed to routine matveca2 c p3a2 -- parameter to be passed to routine matveca2 c p4a2 -- parameter to be passed to routine matveca2 c matvec -- routine which applies the matrix a c to an arbitrary vector; this routine must have c a calling sequence of the form c c matvec(n,x,m,y,p1,p2,p3,p4), c c where n is the length of x, c x is the vector to which a is to be applied, c m is the length of y, c y is the product of a and x, c and p1, p2, p3, and p4 are user-specified parameters c p1 -- parameter to be passed to routine matvec c p2 -- parameter to be passed to routine matvec c p3 -- parameter to be passed to routine matvec c p4 -- parameter to be passed to routine matvec c matvec2 -- routine which applies the matrix a2 c to an arbitrary vector; this routine must have c a calling sequence of the form c c matvec2(n,x,m,y,p12,p22,p32,p42), c c where n is the length of x, c x is the vector to which a2 is to be applied, c m is the length of y, c y is the product of a2 and x, and c p12, p22, p32, and p42 are user-specified parameters c p12 -- parameter to be passed to routine matvec2 c p22 -- parameter to be passed to routine matvec2 c p32 -- parameter to be passed to routine matvec2 c p42 -- parameter to be passed to routine matvec2 c its -- number of iterations of the power method to conduct c c output: c snorm -- estimate of the spectral norm of a-a2 c c work: c w -- must be at least 3*m+3*n complex*16 elements long c c reference: c Kuczynski and Wozniakowski, "Estimating the largest eigenvalue c by the power and Lanczos algorithms with a random start," c SIAM Journal on Matrix Analysis and Applications, c 13 (4): 1992, 1094-1122. c implicit none integer m,n,its,lw,iu,lu,iu1,lu1,iu2,lu2, 1 iv,lv,iv1,lv1,iv2,lv2 real*8 snorm complex*16 p1a,p2a,p3a,p4a,p1a2,p2a2,p3a2,p4a2, 1 p1,p2,p3,p4,p12,p22,p32,p42,w(3*m+3*n) external matveca,matvec,matveca2,matvec2 c c c Allocate memory in w. c lw = 0 c iu = lw+1 lu = m lw = lw+lu c iu1 = lw+1 lu1 = m lw = lw+lu1 c iu2 = lw+1 lu2 = m lw = lw+lu2 c iv = lw+1 lv = n lw = lw+1 c iv1 = lw+1 lv1 = n lw = lw+lv1 c iv2 = lw+1 lv2 = n lw = lw+lv2 c c call idz_diffsnorm0(m,n,matveca,p1a,p2a,p3a,p4a, 1 matveca2,p1a2,p2a2,p3a2,p4a2, 2 matvec,p1,p2,p3,p4, 3 matvec2,p12,p22,p32,p42, 4 its,snorm,w(iu),w(iu1),w(iu2), 5 w(iv),w(iv1),w(iv2)) c c return end c c c c subroutine idz_diffsnorm0(m,n,matveca,p1a,p2a,p3a,p4a, 1 matveca2,p1a2,p2a2,p3a2,p4a2, 2 matvec,p1,p2,p3,p4, 3 matvec2,p12,p22,p32,p42, 4 its,snorm,u,u1,u2,v,v1,v2) c c routine idz_diffsnorm serves as a memory wrapper c for the present routine. (Please see routine idz_diffsnorm c for further documentation.) c implicit none integer m,n,its,it,n2,k real*8 snorm,enorm complex*16 p1a,p2a,p3a,p4a,p1a2,p2a2,p3a2,p4a2, 1 p1,p2,p3,p4,p12,p22,p32,p42,u(m),u1(m),u2(m), 2 v(n),v1(n),v2(n) external matveca,matvec,matveca2,matvec2 c c c Fill the real and imaginary parts of each entry c of the initial vector v with i.i.d. random variables c drawn uniformly from [-1,1]. c n2 = 2*n call id_srand(n2,v) c do k = 1,n v(k) = 2*v(k)-1 enddo ! k c c c Normalize v. c call idz_enorm(n,v,enorm) c do k = 1,n v(k) = v(k)/enorm enddo ! k c c do it = 1,its c c Apply a and a2 to v, obtaining u1 and u2. c call matvec(n,v,m,u1,p1,p2,p3,p4) call matvec2(n,v,m,u2,p12,p22,p32,p42) c c Form u = u1-u2. c do k = 1,m u(k) = u1(k)-u2(k) enddo ! k c c Apply a^* and (a2)^* to u, obtaining v1 and v2. c call matveca(m,u,n,v1,p1a,p2a,p3a,p4a) call matveca2(m,u,n,v2,p1a2,p2a2,p3a2,p4a2) c c Form v = v1-v2. c do k = 1,n v(k) = v1(k)-v2(k) enddo ! k c c Normalize v. c call idz_enorm(n,v,snorm) c if(snorm .gt. 0) then c do k = 1,n v(k) = v(k)/snorm enddo ! k c endif c snorm = sqrt(snorm) c enddo ! it c c return end
bsd-3-clause
ganna10/global_tagging
Land_mask/module_write_output.f90
1
3064
module module_write_output implicit none contains subroutine write_output_netcdf(outfile_method, outfile, nlong1, nlat1, & long1,lat1,region_codes) !, & use timeroutines, only: time, eqtime, timediff, inctime use netcdf, only: NF90_CLOBBER, NF90_CREATE, NF90_GLOBAL, & NF90_PUT_ATT, NF90_UNLIMITED, NF90_DEF_DIM, NF90_FLOAT, NF90_DEF_VAR, & NF90_CHAR, NF90_ENDDEF, NF90_WRITE, NF90_OPEN, NF90_INQ_DIMID, & NF90_INQUIRE_DIMENSION, NF90_INQ_VARID, NF90_GET_ATT, NF90_PUT_VAR, NF90_SYNC,& NF90_CLOSE use ncroutines implicit none !intent-in character(len=*), intent(in) :: outfile_method, outfile integer, intent(in) :: nlong1, nlat1 real, dimension(nlong1,nlat1), intent(in) :: region_codes real, dimension(:), intent(in) :: lat1, long1 ! type(time), intent(inout) :: ctime ! integer(kind=8), intent(in) :: hrinc !Local variables character(len = 1000) :: Times,BTIMESTR, inclusion_method type(time) :: btime integer :: NCIDOUT, DIMID_T, DIMID_NT, DIMID_NLAT1, DIMID_NLONG1, DIMID_NZ integer :: VARID, i,j,k, tdiff_mm, ft !FT is hardwired ft =104 ! ! Setup output time ! print*, 'method create' ! print*, 'hrinc',hrinc if(outfile_method=="create" ) then !Only define file on the first timestep call nf90call(nf90_create(outfile,NF90_CLOBBER,ncidout)) ! The global attributes... call nf90call(nf90_put_att(ncidout,NF90_GLOBAL,"Longitude",nlong1)) call nf90call(nf90_put_att(ncidout,NF90_GLOBAL,"Latitude",nlat1)) call nf90call(nf90_put_att(ncidout,NF90_GLOBAL,"inclusion_method",inclusion_method)) print*,"inclusion_method" ! The dimensions... call nf90call(nf90_def_dim(ncidout,"lon",nlong1,dimid_nlong1)) call nf90call(nf90_def_dim(ncidout,"lat",nlat1,dimid_nlat1)) ! The data variables... call nf90call(nf90_def_var(ncidout,"region_codes",NF90_FLOAT, & (/dimid_nlong1,dimid_nlat1/),varid)) print*,"region_codes" call nf90call(nf90_def_var(ncidout,"lon",NF90_FLOAT, & (/dimid_nlong1/),varid)) call nf90call(nf90_def_var(ncidout,"lat",NF90_FLOAT, & (/dimid_nlat1/),varid)) print*,"lat" ! call nf90call(nf90_put_att(ncidout,NF90_GLOBAL,"TITLE","GENERATED OFFLINE")) call nf90call(nf90_enddef(ncidout)) end if !End of outfile setup print*, 'end if setup file' ! !print 77, lat1,long1,region_codes call write2das3dnc(ncidout,"region_codes",region_codes,(/1,1,1/),(/nlong1,nlat1,1/)) call write1das2dnc(ncidout,"lat",lat1,(/1,1/),(/nlat1,1/)) call write1das2dnc(ncidout,"lon",long1,(/1,1/),(/nlong1,1/)) print*, 'everything was written' call nf90call(nf90_sync(ncidout)) ! call nf90call(nf90_close(ncidout)) 77 format(3f8.2) end subroutine write_output_netcdf end module
gpl-3.0
richardotis/scipy
scipy/stats/futil.f
64
3361
C Sorts an array arr(1:N) into ascending numerical order C using the QuickSort algorithm. On output arr is replaced with its C sorted rearrangement. SUBROUTINE DQSORT(N,ARR) CF2PY INTENT(IN,OUT,COPY) ARR CF2PY INTEGER, INTENT(HIDE), DEPEND(ARR) :: N=len(ARR) INTEGER N,M,NSTACK REAL*8 ARR(N) PARAMETER (M=7, NSTACK=100) INTEGER I, IR, J, JSTACK, K, L, ISTACK(NSTACK) REAL*8 A, TEMP JSTACK = 0 L = 1 IR = N 1 IF(IR-L.LT.M)THEN DO J=L+1,IR A = ARR(J) DO I = J-1,L,-1 IF (ARR(I).LE.A) GOTO 2 ARR(I+1)=ARR(I) ENDDO I = L-1 2 ARR(I+1) = A ENDDO IF(JSTACK.EQ.0)RETURN IR=ISTACK(JSTACK) L=ISTACK(JSTACK-1) JSTACK = JSTACK - 2 ELSE K = (L+IR)/2 TEMP = ARR(K) ARR(K) = ARR(L+1) ARR(L+1) = TEMP IF(ARR(L).GT.ARR(IR))THEN TEMP = ARR(L) ARR(L) = ARR(IR) ARR(IR) = TEMP ENDIF IF(ARR(L+1).GT.ARR(IR))THEN TEMP=ARR(L+1) ARR(L+1)=ARR(IR) ARR(IR)=TEMP ENDIF IF(ARR(L).GT.ARR(L+1))THEN TEMP=ARR(L) ARR(L) = ARR(L+1) ARR(L+1) = TEMP ENDIF I=L+1 J=IR A=ARR(L+1) 3 CONTINUE I=I+1 IF(ARR(I).LT.A)GOTO 3 4 CONTINUE J=J-1 IF(ARR(J).GT.A)GOTO 4 IF(J.LT.I)GOTO 5 TEMP = ARR(I) ARR(I) = ARR(J) ARR(J) = TEMP GOTO 3 5 ARR(L+1) = ARR(J) ARR(J) = A JSTACK = JSTACK + 2 IF(JSTACK.GT.NSTACK)RETURN IF(IR-I+1.GE.J-1)THEN ISTACK(JSTACK)=IR ISTACK(JSTACK-1)=I IR=J-1 ELSE ISTACK(JSTACK)=J-1 ISTACK(JSTACK-1)=L L=I ENDIF ENDIF GOTO 1 END C Finds repeated elements of ARR and their occurrence incidence C reporting the result in REPLIST and REPNUM respectively. C NLIST is the number of repeated elements found. C Algorithm first sorts the list and then walks down it C counting repeats as they are found. SUBROUTINE DFREPS(ARR,N,REPLIST,REPNUM,NLIST) CF2PY INTENT(IN) ARR CF2PY INTENT(OUT) REPLIST CF2PY INTENT(OUT) REPNUM CF2PY INTENT(OUT) NLIST CF2PY INTEGER, INTENT(HIDE), DEPEND(ARR) :: N=len(ARR) REAL*8 REPLIST(N), ARR(N) REAL*8 LASTVAL INTEGER REPNUM(N) INTEGER HOWMANY, REPEAT, IND, NLIST, NNUM CALL DQSORT(N,ARR) LASTVAL = ARR(1) HOWMANY = 0 IND = 2 NNUM = 1 NLIST = 1 REPEAT = 0 DO WHILE(IND.LE.N) IF(ARR(IND).NE.LASTVAL)THEN IF (REPEAT.EQ.1)THEN REPNUM(NNUM)=HOWMANY+1 NNUM=NNUM+1 REPEAT=0 HOWMANY=0 ENDIF ELSE HOWMANY=HOWMANY+1 REPEAT=1 IF(HOWMANY.EQ.1)THEN REPLIST(NLIST)=ARR(IND) NLIST=NLIST+1 ENDIF ENDIF LASTVAL=ARR(IND) IND=IND+1 ENDDO IF(REPEAT.EQ.1)THEN REPNUM(NNUM)=HOWMANY+1 ENDIF NLIST = NLIST - 1 END
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/used_types_16.f90
110
1472
! { dg-do compile } ! Tests the fix for PR31550 in which pointers to derived type components ! were being TREE-SSA declared in the wrong order and so in the incorrect ! context. ! ! Contributed by Daniel Franke <dfranke@gcc.gnu.org> ! MODULE class_dummy_atom_types TYPE :: dummy_atom_list TYPE(dummy_atom), DIMENSION(:), POINTER :: table INTEGER :: nused END TYPE TYPE :: dummy_atom TYPE(dummy_atom_private), POINTER :: p END TYPE TYPE :: dummy_atom_private TYPE(dummy_atom_list) :: neighbours END TYPE END MODULE MODULE class_dummy_atom_list USE class_dummy_atom_types, ONLY: dummy_atom_list INTERFACE SUBROUTINE dummy_atom_list_init_copy(this, other) USE class_dummy_atom_types, ONLY: dummy_atom_list TYPE(dummy_atom_list), INTENT(out) :: this TYPE(dummy_atom_list), INTENT(in) :: other END SUBROUTINE END INTERFACE INTERFACE SUBROUTINE dummy_atom_list_merge(this, other) USE class_dummy_atom_types, ONLY: dummy_atom_list TYPE(dummy_atom_list), INTENT(inout) :: this TYPE(dummy_atom_list), INTENT(in) :: other END SUBROUTINE END INTERFACE END MODULE SUBROUTINE dummy_atom_list_init_copy(this, other) USE class_dummy_atom_list, ONLY: dummy_atom_list, dummy_atom_list_merge TYPE(dummy_atom_list), INTENT(out) :: this TYPE(dummy_atom_list), INTENT(in) :: other this%table(1:this%nused) = other%table(1:other%nused) END SUBROUTINE
gpl-2.0
chunshen1987/iEBE
EBE-Node/osc2u/gnuranf.f
2
1637
c $Id: gnuranf.f,v 1.2 1996/12/02 16:12:26 weber Exp $ C***************** R A N F ******************************* c sab 05.03.1992 real*8 FUNCTION RANF(ix) integer ix,iseed real ran2 common /seed/iseed ranf=dble(ran2(iseed)) RETURN end c c c integer function mclock() c mclock = 0; c return c end subroutine SSEED(ranseed) real*8 dummy real ran2 integer iseed,ranseed common /seed/iseed save iseed = -ranseed dummy=dble(ran2(iseed)) RETURN END FUNCTION ran2(idum) INTEGER idum,IM1,IM2,IMM1,IA1,IA2,IQ1,IQ2,IR1,IR2,NTAB,NDIV REAL ran2,AM,EPS,RNMX PARAMETER (IM1=2147483563,IM2=2147483399,AM=1./IM1,IMM1=IM1-1, *IA1=40014,IA2=40692,IQ1=53668,IQ2=52774,IR1=12211,IR2=3791, *NTAB=32,NDIV=1+IMM1/NTAB,EPS=1.2e-7,RNMX=1.-EPS) INTEGER idum2,j,k,iv(NTAB),iy SAVE iv,iy,idum2 DATA idum2/123456789/, iv/NTAB*0/, iy/0/ if (idum.le.0) then idum=max(-idum,1) idum2=idum do 11 j=NTAB+8,1,-1 k=idum/IQ1 idum=IA1*(idum-k*IQ1)-k*IR1 if (idum.lt.0) idum=idum+IM1 if (j.le.NTAB) iv(j)=idum 11 continue iy=iv(1) endif k=idum/IQ1 idum=IA1*(idum-k*IQ1)-k*IR1 if (idum.lt.0) idum=idum+IM1 k=idum2/IQ2 idum2=IA2*(idum2-k*IQ2)-k*IR2 if (idum2.lt.0) idum2=idum2+IM2 j=1+iy/NDIV iy=iv(j)-idum2 iv(j)=idum if(iy.lt.1)iy=iy+IMM1 ran2=min(AM*iy,RNMX) return END C (C) Copr. 1986-92 Numerical Recipes Software 5&40.
gpl-3.0
walshjon/openmc-0.6.1
src/initialize.F90
2
30741
module initialize use ace, only: read_xs, same_nuclide_list use bank_header, only: Bank use constants use dict_header, only: DictIntInt, ElemKeyValueII use energy_grid, only: unionized_grid use error, only: fatal_error, warning use geometry, only: neighbor_lists use geometry_header, only: Cell, Universe, Lattice, BASE_UNIVERSE use global use input_xml, only: read_input_xml, read_cross_sections_xml, & cells_in_univ_dict, read_plots_xml use material_header, only: Material use output, only: title, header, write_summary, print_version, & print_usage, write_xs_summary, print_plot, & write_message use output_interface use random_lcg, only: initialize_prng use source, only: initialize_source use state_point, only: load_state_point use string, only: to_str, str_to_int, starts_with, ends_with use tally_header, only: TallyObject, TallyResult use tally_initialize, only: configure_tallies #ifdef MPI use mpi #endif #ifdef _OPENMP use omp_lib #endif #ifdef HDF5 use hdf5_interface use hdf5_summary, only: hdf5_write_summary #endif implicit none contains !=============================================================================== ! INITIALIZE_RUN takes care of all initialization tasks, i.e. reading ! from command line, reading xml input files, initializing random ! number seeds, reading cross sections, initializing starting source, ! setting up timers, etc. !=============================================================================== subroutine initialize_run() ! Start total and initialization timer call time_total % start() call time_initialize % start() #ifdef MPI ! Setup MPI call initialize_mpi() #endif #ifdef HDF5 ! Initialize HDF5 interface call hdf5_initialize() #endif ! Read command line arguments call read_command_line() if (master) then ! Display title and initialization header call title() call header("INITIALIZATION", level=1) end if ! Read XML input files call read_input_xml() ! Initialize random number generator -- this has to be done after the input ! files have been read in case the user specified a seed for the random ! number generator call initialize_prng() ! Read plots.xml if it exists -- this has to be done separate from the other ! XML files because we need the PRNG to be initialized first if (run_mode == MODE_PLOTTING) call read_plots_xml() ! Set up universe structures call prepare_universes() ! Use dictionaries to redefine index pointers call adjust_indices() ! After reading input and basic geometry setup is complete, build lists of ! neighboring cells for efficient tracking call neighbor_lists() if (run_mode /= MODE_PLOTTING) then ! With the AWRs from the xs_listings, change all material specifications ! so that they contain atom percents summing to 1 call normalize_ao() ! Read ACE-format cross sections call time_read_xs % start() call read_xs() call time_read_xs % stop() ! Create linked lists for multiple instances of the same nuclide call same_nuclide_list() ! Construct unionized energy grid from cross-sections if (grid_method == GRID_UNION) then call time_unionize % start() call unionized_grid() call time_unionize % stop() end if ! Allocate and setup tally stride, matching_bins, and tally maps call configure_tallies() ! Determine how much work each processor should do call calculate_work() ! Allocate banks and create source particles -- for a fixed source ! calculation, the external source distribution is sampled during the ! run, not at initialization if (run_mode == MODE_EIGENVALUE) then call allocate_banks() if (.not. restart_run) call initialize_source() end if ! If this is a restart run, load the state point data and binary source ! file if (restart_run) call load_state_point() end if if (master) then if (run_mode == MODE_PLOTTING) then ! Display plotting information call print_plot() else ! Write summary information #ifdef HDF5 if (output_summary) call hdf5_write_summary() #else if (output_summary) call write_summary() #endif ! Write cross section information if (output_xs) call write_xs_summary() end if end if ! Check for particle restart run if (particle_restart_run) run_mode = MODE_PARTICLE ! Warn if overlap checking is on if (master .and. check_overlaps) then message = "" call write_message() message = "Cell overlap checking is ON" call warning() end if ! Stop initialization timer call time_initialize % stop() end subroutine initialize_run #ifdef MPI !=============================================================================== ! INITIALIZE_MPI starts up the Message Passing Interface (MPI) and determines ! the number of processors the problem is being run with as well as the rank of ! each processor. !=============================================================================== subroutine initialize_mpi() integer :: bank_blocks(4) ! Count for each datatype integer :: bank_types(4) ! Datatypes integer(MPI_ADDRESS_KIND) :: bank_disp(4) ! Displacements integer :: temp_type ! temporary derived type integer :: result_blocks(1) ! Count for each datatype integer :: result_types(1) ! Datatypes integer(MPI_ADDRESS_KIND) :: result_disp(1) ! Displacements integer(MPI_ADDRESS_KIND) :: result_base_disp ! Base displacement integer(MPI_ADDRESS_KIND) :: lower_bound ! Lower bound for TallyResult integer(MPI_ADDRESS_KIND) :: extent ! Extent for TallyResult type(Bank) :: b type(TallyResult) :: tr ! Indicate that MPI is turned on mpi_enabled = .true. ! Initialize MPI call MPI_INIT(mpi_err) ! Determine number of processors and rank of each processor call MPI_COMM_SIZE(MPI_COMM_WORLD, n_procs, mpi_err) call MPI_COMM_RANK(MPI_COMM_WORLD, rank, mpi_err) ! Determine master if (rank == 0) then master = .true. else master = .false. end if ! ========================================================================== ! CREATE MPI_BANK TYPE ! Determine displacements for MPI_BANK type call MPI_GET_ADDRESS(b % wgt, bank_disp(1), mpi_err) call MPI_GET_ADDRESS(b % xyz, bank_disp(2), mpi_err) call MPI_GET_ADDRESS(b % uvw, bank_disp(3), mpi_err) call MPI_GET_ADDRESS(b % E, bank_disp(4), mpi_err) ! Adjust displacements bank_disp = bank_disp - bank_disp(1) ! Define MPI_BANK for fission sites bank_blocks = (/ 1, 3, 3, 1 /) bank_types = (/ MPI_REAL8, MPI_REAL8, MPI_REAL8, MPI_REAL8 /) call MPI_TYPE_CREATE_STRUCT(4, bank_blocks, bank_disp, & bank_types, MPI_BANK, mpi_err) call MPI_TYPE_COMMIT(MPI_BANK, mpi_err) ! ========================================================================== ! CREATE MPI_TALLYRESULT TYPE ! Determine displacements for MPI_BANK type call MPI_GET_ADDRESS(tr % value, result_base_disp, mpi_err) call MPI_GET_ADDRESS(tr % sum, result_disp(1), mpi_err) ! Adjust displacements result_disp = result_disp - result_base_disp ! Define temporary type for TallyResult result_blocks = (/ 2 /) result_types = (/ MPI_REAL8 /) call MPI_TYPE_CREATE_STRUCT(1, result_blocks, result_disp, result_types, & temp_type, mpi_err) ! Adjust lower-bound and extent of type for tally score lower_bound = 0 extent = result_disp(1) + 16 call MPI_TYPE_CREATE_RESIZED(temp_type, lower_bound, extent, & MPI_TALLYRESULT, mpi_err) ! Commit derived type for tally scores call MPI_TYPE_COMMIT(MPI_TALLYRESULT, mpi_err) ! Free temporary MPI type call MPI_TYPE_FREE(temp_type, mpi_err) end subroutine initialize_mpi #endif #ifdef HDF5 !=============================================================================== ! HDF5_INITIALIZE !=============================================================================== subroutine hdf5_initialize() type(TallyResult), target :: tmp(2) ! temporary TallyResult type(Bank), target :: tmpb(2) ! temporary Bank integer(HID_T) :: coordinates_t ! HDF5 type for 3 reals integer(HSIZE_T) :: dims(1) = (/3/) ! size of coordinates ! Initialize FORTRAN interface. call h5open_f(hdf5_err) ! Create the compound datatype for TallyResult call h5tcreate_f(H5T_COMPOUND_F, h5offsetof(c_loc(tmp(1)), & c_loc(tmp(2))), hdf5_tallyresult_t, hdf5_err) call h5tinsert_f(hdf5_tallyresult_t, "sum", h5offsetof(c_loc(tmp(1)), & c_loc(tmp(1)%sum)), H5T_NATIVE_DOUBLE, hdf5_err) call h5tinsert_f(hdf5_tallyresult_t, "sum_sq", h5offsetof(c_loc(tmp(1)), & c_loc(tmp(1)%sum_sq)), H5T_NATIVE_DOUBLE, hdf5_err) ! Create compound type for xyz and uvw call h5tarray_create_f(H5T_NATIVE_DOUBLE, 1, dims, coordinates_t, hdf5_err) ! Create the compound datatype for Bank call h5tcreate_f(H5T_COMPOUND_F, h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(2))), hdf5_bank_t, hdf5_err) call h5tinsert_f(hdf5_bank_t, "wgt", h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(1)%wgt)), H5T_NATIVE_DOUBLE, hdf5_err) call h5tinsert_f(hdf5_bank_t, "xyz", h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(1)%xyz)), coordinates_t, hdf5_err) call h5tinsert_f(hdf5_bank_t, "uvw", h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(1)%uvw)), coordinates_t, hdf5_err) call h5tinsert_f(hdf5_bank_t, "E", h5offsetof(c_loc(tmpb(1)), & c_loc(tmpb(1)%E)), H5T_NATIVE_DOUBLE, hdf5_err) ! Determine type for integer(8) hdf5_integer8_t = h5kind_to_type(8, H5_INTEGER_KIND) end subroutine hdf5_initialize #endif !=============================================================================== ! READ_COMMAND_LINE reads all parameters from the command line !=============================================================================== subroutine read_command_line() integer :: i ! loop index integer :: argc ! number of command line arguments integer :: last_flag ! index of last flag integer :: filetype character(MAX_WORD_LEN), allocatable :: argv(:) ! command line arguments type(BinaryOutput) :: sp ! Check number of command line arguments and allocate argv argc = COMMAND_ARGUMENT_COUNT() ! Allocate and retrieve command arguments allocate(argv(argc)) do i = 1, argc call GET_COMMAND_ARGUMENT(i, argv(i)) end do ! Process command arguments last_flag = 0 i = 1 do while (i <= argc) ! Check for flags if (starts_with(argv(i), "-")) then select case (argv(i)) case ('-p', '-plot', '--plot') run_mode = MODE_PLOTTING check_overlaps = .true. case ('-n', '-particles', '--particles') ! Read number of particles per cycle i = i + 1 n_particles = str_to_int(argv(i)) ! Check that number specified was valid if (n_particles == ERROR_INT) then message = "Must specify integer after " // trim(argv(i-1)) // & " command-line flag." call fatal_error() end if case ('-r', '-restart', '--restart') ! Read path for state point/particle restart i = i + 1 ! Check what type of file this is call sp % file_open(argv(i), 'r', serial = .false.) call sp % read_data(filetype, 'filetype') call sp % file_close() ! Set path and flag for type of run select case (filetype) case (FILETYPE_STATEPOINT) path_state_point = argv(i) restart_run = .true. case (FILETYPE_PARTICLE_RESTART) path_particle_restart = argv(i) particle_restart_run = .true. case default message = "Unrecognized file after restart flag." call fatal_error() end select ! If its a restart run check for additional source file if (restart_run .and. i + 1 <= argc) then ! Increment arg i = i + 1 ! Check if it has extension we can read if ((ends_with(argv(i), '.binary') .or. & ends_with(argv(i), '.h5'))) then ! Check file type is a source file call sp % file_open(argv(i), 'r', serial = .false.) call sp % read_data(filetype, 'filetype') call sp % file_close() if (filetype /= FILETYPE_SOURCE) then message = "Second file after restart flag must be a source file" call fatal_error() end if ! It is a source file path_source_point = argv(i) else ! Different option is specified not a source file ! Source is in statepoint file path_source_point = path_state_point ! Set argument back i = i - 1 end if else ! No command line arg after statepoint ! Source is assumed to be in statepoint file path_source_point = path_state_point end if case ('-g', '-geometry-debug', '--geometry-debug') check_overlaps = .true. case ('-s', '--threads') ! Read number of threads i = i + 1 #ifdef _OPENMP ! Read and set number of OpenMP threads n_threads = int(str_to_int(argv(i)), 4) if (n_threads < 1) then message = "Invalid number of threads specified on command line." call fatal_error() end if call omp_set_num_threads(n_threads) #else message = "Ignoring number of threads specified on command line." call warning() #endif case ('-?', '-h', '-help', '--help') call print_usage() stop case ('-v', '-version', '--version') call print_version() stop case ('-eps_tol', '-ksp_gmres_restart') ! Handle options that would be based to PETSC i = i + 1 case ('-t', '-track', '--track') write_all_tracks = .true. i = i + 1 case default message = "Unknown command line option: " // argv(i) call fatal_error() end select last_flag = i end if ! Increment counter i = i + 1 end do ! Determine directory where XML input files are if (argc > 0 .and. last_flag < argc) then path_input = argv(last_flag + 1) else path_input = '' end if ! Add slash at end of directory if it isn't there if (.not. ends_with(path_input, "/") .and. len_trim(path_input) > 0) then path_input = trim(path_input) // "/" end if ! Free memory from argv deallocate(argv) ! TODO: Check that directory exists end subroutine read_command_line !=============================================================================== ! PREPARE_UNIVERSES allocates the universes array and determines the cells array ! for each universe. !=============================================================================== subroutine prepare_universes() integer :: i ! index in cells array integer :: i_univ ! index in universes array integer :: n_cells_in_univ ! number of cells in a universe integer, allocatable :: index_cell_in_univ(:) ! the index in the univ%cells ! array for each universe type(ElemKeyValueII), pointer :: pair_list => null() type(ElemKeyValueII), pointer :: current => null() type(ElemKeyValueII), pointer :: next => null() type(Universe), pointer :: univ => null() type(Cell), pointer :: c => null() allocate(universes(n_universes)) ! We also need to allocate the cell count lists for each universe. The logic ! for this is a little more convoluted. In universe_dict, the (key,value) ! pairs are the id of the universe and the index in the array. In ! cells_in_univ_dict, it's the id of the universe and the number of cells. pair_list => universe_dict % keys() current => pair_list do while (associated(current)) ! Find index of universe in universes array i_univ = current % value univ => universes(i_univ) univ % id = current % key ! Check for lowest level universe if (univ % id == 0) BASE_UNIVERSE = i_univ ! Find cell count for this universe n_cells_in_univ = cells_in_univ_dict % get_key(univ % id) ! Allocate cell list for universe allocate(univ % cells(n_cells_in_univ)) univ % n_cells = n_cells_in_univ ! Move to next universe next => current % next deallocate(current) current => next end do ! Also allocate a list for keeping track of where cells have been assigned ! in each universe allocate(index_cell_in_univ(n_universes)) index_cell_in_univ = 0 do i = 1, n_cells c => cells(i) ! Get pointer to corresponding universe i_univ = universe_dict % get_key(c % universe) univ => universes(i_univ) ! Increment the index for the cells array within the Universe object and ! then store the index of the Cell object in that array index_cell_in_univ(i_univ) = index_cell_in_univ(i_univ) + 1 univ % cells(index_cell_in_univ(i_univ)) = i end do ! Clear dictionary call cells_in_univ_dict % clear() end subroutine prepare_universes !=============================================================================== ! ADJUST_INDICES changes the values for 'surfaces' for each cell and the ! material index assigned to each to the indices in the surfaces and material ! array rather than the unique IDs assigned to each surface and material. Also ! assigns boundary conditions to surfaces based on those read into the bc_dict ! dictionary !=============================================================================== subroutine adjust_indices() integer :: i ! index for various purposes integer :: j ! index for various purposes integer :: k ! loop index for lattices integer :: m ! loop index for lattices integer :: mid, lid ! material and lattice IDs integer :: n_x, n_y, n_z ! size of lattice integer :: i_array ! index in surfaces/materials array integer :: id ! user-specified id type(Cell), pointer :: c => null() type(Lattice), pointer :: lat => null() type(TallyObject), pointer :: t => null() do i = 1, n_cells ! ======================================================================= ! ADJUST SURFACE LIST FOR EACH CELL c => cells(i) do j = 1, c % n_surfaces id = c % surfaces(j) if (id < OP_DIFFERENCE) then if (surface_dict % has_key(abs(id))) then i_array = surface_dict % get_key(abs(id)) c % surfaces(j) = sign(i_array, id) else message = "Could not find surface " // trim(to_str(abs(id))) // & " specified on cell " // trim(to_str(c % id)) call fatal_error() end if end if end do ! ======================================================================= ! ADJUST UNIVERSE INDEX FOR EACH CELL id = c % universe if (universe_dict % has_key(id)) then c % universe = universe_dict % get_key(id) else message = "Could not find universe " // trim(to_str(id)) // & " specified on cell " // trim(to_str(c % id)) call fatal_error() end if ! ======================================================================= ! ADJUST MATERIAL/FILL POINTERS FOR EACH CELL id = c % material if (id == MATERIAL_VOID) then c % type = CELL_NORMAL elseif (id /= 0) then if (material_dict % has_key(id)) then c % type = CELL_NORMAL c % material = material_dict % get_key(id) else message = "Could not find material " // trim(to_str(id)) // & " specified on cell " // trim(to_str(c % id)) call fatal_error() end if else id = c % fill if (universe_dict % has_key(id)) then c % type = CELL_FILL c % fill = universe_dict % get_key(id) elseif (lattice_dict % has_key(id)) then lid = lattice_dict % get_key(id) mid = lattices(lid) % outside c % type = CELL_LATTICE c % fill = lid if (mid == MATERIAL_VOID) then c % material = mid else if (material_dict % has_key(mid)) then c % material = material_dict % get_key(mid) else message = "Could not find material " // trim(to_str(mid)) // & " specified on lattice " // trim(to_str(lid)) call fatal_error() end if else message = "Specified fill " // trim(to_str(id)) // " on cell " // & trim(to_str(c % id)) // " is neither a universe nor a lattice." call fatal_error() end if end if end do ! ========================================================================== ! ADJUST UNIVERSE INDICES FOR EACH LATTICE do i = 1, n_lattices lat => lattices(i) n_x = lat % dimension(1) n_y = lat % dimension(2) if (lat % n_dimension == 3) then n_z = lat % dimension(3) else n_z = 1 end if do m = 1, n_z do k = 1, n_y do j = 1, n_x id = lat % universes(j,k,m) if (universe_dict % has_key(id)) then lat % universes(j,k,m) = universe_dict % get_key(id) else message = "Invalid universe number " // trim(to_str(id)) & // " specified on lattice " // trim(to_str(lat % id)) call fatal_error() end if end do end do end do end do TALLY_LOOP: do i = 1, n_tallies t => tallies(i) ! ======================================================================= ! ADJUST INDICES FOR EACH TALLY FILTER FILTER_LOOP: do j = 1, t % n_filters select case (t % filters(j) % type) case (FILTER_CELL, FILTER_CELLBORN) do k = 1, t % filters(j) % n_bins id = t % filters(j) % int_bins(k) if (cell_dict % has_key(id)) then t % filters(j) % int_bins(k) = cell_dict % get_key(id) else message = "Could not find cell " // trim(to_str(id)) // & " specified on tally " // trim(to_str(t % id)) call fatal_error() end if end do case (FILTER_SURFACE) ! Check if this is a surface filter only for surface currents if (any(t % score_bins == SCORE_CURRENT)) cycle FILTER_LOOP do k = 1, t % filters(j) % n_bins id = t % filters(j) % int_bins(k) if (surface_dict % has_key(id)) then t % filters(j) % int_bins(k) = surface_dict % get_key(id) else message = "Could not find surface " // trim(to_str(id)) // & " specified on tally " // trim(to_str(t % id)) call fatal_error() end if end do case (FILTER_UNIVERSE) do k = 1, t % filters(j) % n_bins id = t % filters(j) % int_bins(k) if (universe_dict % has_key(id)) then t % filters(j) % int_bins(k) = universe_dict % get_key(id) else message = "Could not find universe " // trim(to_str(id)) // & " specified on tally " // trim(to_str(t % id)) call fatal_error() end if end do case (FILTER_MATERIAL) do k = 1, t % filters(j) % n_bins id = t % filters(j) % int_bins(k) if (material_dict % has_key(id)) then t % filters(j) % int_bins(k) = material_dict % get_key(id) else message = "Could not find material " // trim(to_str(id)) // & " specified on tally " // trim(to_str(t % id)) call fatal_error() end if end do case (FILTER_MESH) ! The mesh filter already has been set to the index in meshes rather ! than the user-specified id, so it doesn't need to be changed. end select end do FILTER_LOOP end do TALLY_LOOP end subroutine adjust_indices !=============================================================================== ! NORMALIZE_AO normalizes the atom or weight percentages for each material !=============================================================================== subroutine normalize_ao() integer :: index_list ! index in xs_listings array integer :: i ! index in materials array integer :: j ! index over nuclides in material real(8) :: sum_percent ! summation real(8) :: awr ! atomic weight ratio real(8) :: x ! atom percent logical :: percent_in_atom ! nuclides specified in atom percent? logical :: density_in_atom ! density specified in atom/b-cm? type(Material), pointer :: mat => null() ! first find the index in the xs_listings array for each nuclide in each ! material do i = 1, n_materials mat => materials(i) percent_in_atom = (mat % atom_density(1) > ZERO) density_in_atom = (mat % density > ZERO) sum_percent = ZERO do j = 1, mat % n_nuclides ! determine atomic weight ratio index_list = xs_listing_dict % get_key(mat % names(j)) awr = xs_listings(index_list) % awr ! if given weight percent, convert all values so that they are divided ! by awr. thus, when a sum is done over the values, it's actually ! sum(w/awr) if (.not. percent_in_atom) then mat % atom_density(j) = -mat % atom_density(j) / awr end if end do ! determine normalized atom percents. if given atom percents, this is ! straightforward. if given weight percents, the value is w/awr and is ! divided by sum(w/awr) sum_percent = sum(mat % atom_density) mat % atom_density = mat % atom_density / sum_percent ! Change density in g/cm^3 to atom/b-cm. Since all values are now in atom ! percent, the sum needs to be re-evaluated as 1/sum(x*awr) if (.not. density_in_atom) then sum_percent = ZERO do j = 1, mat % n_nuclides index_list = xs_listing_dict % get_key(mat % names(j)) awr = xs_listings(index_list) % awr x = mat % atom_density(j) sum_percent = sum_percent + x*awr end do sum_percent = ONE / sum_percent mat % density = -mat % density * N_AVOGADRO & / MASS_NEUTRON * sum_percent end if ! Calculate nuclide atom densities mat % atom_density = mat % density * mat % atom_density end do end subroutine normalize_ao !=============================================================================== ! CALCULATE_WORK determines how many particles each processor should simulate !=============================================================================== subroutine calculate_work() integer :: i ! loop index integer :: remainder ! Number of processors with one extra particle integer(8) :: i_bank ! Running count of number of particles integer(8) :: min_work ! Minimum number of particles on each proc integer(8) :: work_i ! Number of particles on rank i allocate(work_index(0:n_procs)) ! Determine minimum amount of particles to simulate on each processor min_work = n_particles/n_procs ! Determine number of processors that have one extra particle remainder = int(mod(n_particles, int(n_procs,8)), 4) i_bank = 0 work_index(0) = 0 do i = 0, n_procs - 1 ! Number of particles for rank i if (i < remainder) then work_i = min_work + 1 else work_i = min_work end if ! Set number of particles if (rank == i) work = work_i ! Set index into source bank for rank i i_bank = i_bank + work_i work_index(i+1) = i_bank end do end subroutine calculate_work !=============================================================================== ! ALLOCATE_BANKS allocates memory for the fission and source banks !=============================================================================== subroutine allocate_banks() integer :: alloc_err ! allocation error code ! Allocate source bank allocate(source_bank(work), STAT=alloc_err) ! Check for allocation errors if (alloc_err /= 0) then message = "Failed to allocate source bank." call fatal_error() end if #ifdef _OPENMP ! If OpenMP is being used, each thread needs its own private fission ! bank. Since the private fission banks need to be combined at the end of a ! generation, there is also a 'master_fission_bank' that is used to collect ! the sites from each thread. n_threads = omp_get_max_threads() !$omp parallel thread_id = omp_get_thread_num() if (thread_id == 0) then allocate(fission_bank(3*work)) else allocate(fission_bank(3*work/n_threads)) end if !$omp end parallel allocate(master_fission_bank(3*work), STAT=alloc_err) #else allocate(fission_bank(3*work), STAT=alloc_err) #endif ! Check for allocation errors if (alloc_err /= 0) then message = "Failed to allocate fission bank." call fatal_error() end if end subroutine allocate_banks end module initialize
mit
richardotis/scipy
scipy/sparse/linalg/eigen/arpack/ARPACK/SRC/sstats.f
161
1166
c c\SCCS Information: @(#) c FILE: stats.F SID: 2.1 DATE OF SID: 4/19/96 RELEASE: 2 c %---------------------------------------------% c | Initialize statistic and timing information | c | for symmetric Arnoldi code. | c %---------------------------------------------% subroutine sstats c %--------------------------------% c | See stat.doc for documentation | c %--------------------------------% include 'stat.h' c %-----------------------% c | Executable Statements | c %-----------------------% nopx = 0 nbx = 0 nrorth = 0 nitref = 0 nrstrt = 0 tsaupd = 0.0E+0 tsaup2 = 0.0E+0 tsaitr = 0.0E+0 tseigt = 0.0E+0 tsgets = 0.0E+0 tsapps = 0.0E+0 tsconv = 0.0E+0 titref = 0.0E+0 tgetv0 = 0.0E+0 trvec = 0.0E+0 c %----------------------------------------------------% c | User time including reverse communication overhead | c %----------------------------------------------------% tmvopx = 0.0E+0 tmvbx = 0.0E+0 return c c End of sstats c end
bsd-3-clause
aeklant/scipy
scipy/interpolate/fitpack/fpgrsp.f
33
19763
subroutine fpgrsp(ifsu,ifsv,ifbu,ifbv,iback,u,mu,v,mv,r,mr,dr, * iop0,iop1,tu,nu,tv,nv,p,c,nc,sq,fp,fpu,fpv,mm,mvnu,spu,spv, * right,q,au,av1,av2,bu,bv,a0,a1,b0,b1,c0,c1,cosi,nru,nrv) c .. c ..scalar arguments.. real*8 p,sq,fp integer ifsu,ifsv,ifbu,ifbv,iback,mu,mv,mr,iop0,iop1,nu,nv,nc, * mm,mvnu c ..array arguments.. real*8 u(mu),v(mv),r(mr),dr(6),tu(nu),tv(nv),c(nc),fpu(nu),fpv(nv) *, * spu(mu,4),spv(mv,4),right(mm),q(mvnu),au(nu,5),av1(nv,6),c0(nv), * av2(nv,4),a0(2,mv),b0(2,nv),cosi(2,nv),bu(nu,5),bv(nv,5),c1(nv), * a1(2,mv),b1(2,nv) integer nru(mu),nrv(mv) c ..local scalars.. real*8 arg,co,dr01,dr02,dr03,dr11,dr12,dr13,fac,fac0,fac1,pinv,piv *, * si,term,one,three,half integer i,ic,ii,ij,ik,iq,irot,it,ir,i0,i1,i2,i3,j,jj,jk,jper, * j0,j1,k,k1,k2,l,l0,l1,l2,mvv,ncof,nrold,nroldu,nroldv,number, * numu,numu1,numv,numv1,nuu,nu4,nu7,nu8,nu9,nv11,nv4,nv7,nv8,n1 c ..local arrays.. real*8 h(5),h1(5),h2(4) c ..function references.. integer min0 real*8 cos,sin c ..subroutine references.. c fpback,fpbspl,fpgivs,fpcyt1,fpcyt2,fpdisc,fpbacp,fprota c .. c let c | (spu) | | (spv) | c (au) = | -------------- | (av) = | -------------- | c | sqrt(1/p) (bu) | | sqrt(1/p) (bv) | c c | r ' 0 | c q = | ------ | c | 0 ' 0 | c c with c : the (nu-4) x (nv-4) matrix which contains the b-spline c coefficients. c r : the mu x mv matrix which contains the function values. c spu,spv: the mu x (nu-4), resp. mv x (nv-4) observation matrices c according to the least-squares problems in the u-,resp. c v-direction. c bu,bv : the (nu-7) x (nu-4),resp. (nv-7) x (nv-4) matrices c containing the discontinuity jumps of the derivatives c of the b-splines in the u-,resp.v-variable at the knots c the b-spline coefficients of the smoothing spline are then calculated c as the least-squares solution of the following over-determined linear c system of equations c c (1) (av) c (au)' = q c c subject to the constraints c c (2) c(i,nv-3+j) = c(i,j), j=1,2,3 ; i=1,2,...,nu-4 c c (3) if iop0 = 0 c(1,j) = dr(1) c iop0 = 1 c(1,j) = dr(1) c c(2,j) = dr(1)+(dr(2)*cosi(1,j)+dr(3)*cosi(2,j))* c tu(5)/3. = c0(j) , j=1,2,...nv-4 c c (4) if iop1 = 0 c(nu-4,j) = dr(4) c iop1 = 1 c(nu-4,j) = dr(4) c c(nu-5,j) = dr(4)+(dr(5)*cosi(1,j)+dr(6)*cosi(2,j)) c *(tu(nu-4)-tu(nu-3))/3. = c1(j) c c set constants one = 1 three = 3 half = 0.5 c initialization nu4 = nu-4 nu7 = nu-7 nu8 = nu-8 nu9 = nu-9 nv4 = nv-4 nv7 = nv-7 nv8 = nv-8 nv11 = nv-11 nuu = nu4-iop0-iop1-2 if(p.gt.0.) pinv = one/p c it depends on the value of the flags ifsu,ifsv,ifbu,ifbv,iop0,iop1 c and on the value of p whether the matrices (spu), (spv), (bu), (bv), c (cosi) still must be determined. if(ifsu.ne.0) go to 30 c calculate the non-zero elements of the matrix (spu) which is the ob- c servation matrix according to the least-squares spline approximation c problem in the u-direction. l = 4 l1 = 5 number = 0 do 25 it=1,mu arg = u(it) 10 if(arg.lt.tu(l1) .or. l.eq.nu4) go to 15 l = l1 l1 = l+1 number = number+1 go to 10 15 call fpbspl(tu,nu,3,arg,l,h) do 20 i=1,4 spu(it,i) = h(i) 20 continue nru(it) = number 25 continue ifsu = 1 c calculate the non-zero elements of the matrix (spv) which is the ob- c servation matrix according to the least-squares spline approximation c problem in the v-direction. 30 if(ifsv.ne.0) go to 85 l = 4 l1 = 5 number = 0 do 50 it=1,mv arg = v(it) 35 if(arg.lt.tv(l1) .or. l.eq.nv4) go to 40 l = l1 l1 = l+1 number = number+1 go to 35 40 call fpbspl(tv,nv,3,arg,l,h) do 45 i=1,4 spv(it,i) = h(i) 45 continue nrv(it) = number 50 continue ifsv = 1 if(iop0.eq.0 .and. iop1.eq.0) go to 85 c calculate the coefficients of the interpolating splines for cos(v) c and sin(v). do 55 i=1,nv4 cosi(1,i) = 0. cosi(2,i) = 0. 55 continue if(nv7.lt.4) go to 85 do 65 i=1,nv7 l = i+3 arg = tv(l) call fpbspl(tv,nv,3,arg,l,h) do 60 j=1,3 av1(i,j) = h(j) 60 continue cosi(1,i) = cos(arg) cosi(2,i) = sin(arg) 65 continue call fpcyt1(av1,nv7,nv) do 80 j=1,2 do 70 i=1,nv7 right(i) = cosi(j,i) 70 continue call fpcyt2(av1,nv7,right,right,nv) do 75 i=1,nv7 cosi(j,i+1) = right(i) 75 continue cosi(j,1) = cosi(j,nv7+1) cosi(j,nv7+2) = cosi(j,2) cosi(j,nv4) = cosi(j,3) 80 continue 85 if(p.le.0.) go to 150 c calculate the non-zero elements of the matrix (bu). if(ifbu.ne.0 .or. nu8.eq.0) go to 90 call fpdisc(tu,nu,5,bu,nu) ifbu = 1 c calculate the non-zero elements of the matrix (bv). 90 if(ifbv.ne.0 .or. nv8.eq.0) go to 150 call fpdisc(tv,nv,5,bv,nv) ifbv = 1 c substituting (2),(3) and (4) into (1), we obtain the overdetermined c system c (5) (avv) (cc) (auu)' = (qq) c from which the nuu*nv7 remaining coefficients c c(i,j) , i=2+iop0,3+iop0,...,nu-5-iop1,j=1,2,...,nv-7. c the elements of (cc), are then determined in the least-squares sense. c simultaneously, we compute the resulting sum of squared residuals sq. 150 dr01 = dr(1) dr11 = dr(4) do 155 i=1,mv a0(1,i) = dr01 a1(1,i) = dr11 155 continue if(nv8.eq.0 .or. p.le.0.) go to 165 do 160 i=1,nv8 b0(1,i) = 0. b1(1,i) = 0. 160 continue 165 mvv = mv if(iop0.eq.0) go to 195 fac = (tu(5)-tu(4))/three dr02 = dr(2)*fac dr03 = dr(3)*fac do 170 i=1,nv4 c0(i) = dr01+dr02*cosi(1,i)+dr03*cosi(2,i) 170 continue do 180 i=1,mv number = nrv(i) fac = 0. do 175 j=1,4 number = number+1 fac = fac+c0(number)*spv(i,j) 175 continue a0(2,i) = fac 180 continue if(nv8.eq.0 .or. p.le.0.) go to 195 do 190 i=1,nv8 number = i fac = 0. do 185 j=1,5 fac = fac+c0(number)*bv(i,j) number = number+1 185 continue b0(2,i) = fac*pinv 190 continue mvv = mv+nv8 195 if(iop1.eq.0) go to 225 fac = (tu(nu4)-tu(nu4+1))/three dr12 = dr(5)*fac dr13 = dr(6)*fac do 200 i=1,nv4 c1(i) = dr11+dr12*cosi(1,i)+dr13*cosi(2,i) 200 continue do 210 i=1,mv number = nrv(i) fac = 0. do 205 j=1,4 number = number+1 fac = fac+c1(number)*spv(i,j) 205 continue a1(2,i) = fac 210 continue if(nv8.eq.0 .or. p.le.0.) go to 225 do 220 i=1,nv8 number = i fac = 0. do 215 j=1,5 fac = fac+c1(number)*bv(i,j) number = number+1 215 continue b1(2,i) = fac*pinv 220 continue mvv = mv+nv8 c we first determine the matrices (auu) and (qq). then we reduce the c matrix (auu) to an unit upper triangular form (ru) using givens c rotations without square roots. we apply the same transformations to c the rows of matrix qq to obtain the mv x nuu matrix g. c we store matrix (ru) into au and g into q. 225 l = mvv*nuu c initialization. sq = 0. if(l.eq.0) go to 245 do 230 i=1,l q(i) = 0. 230 continue do 240 i=1,nuu do 240 j=1,5 au(i,j) = 0. 240 continue l = 0 245 nrold = 0 n1 = nrold+1 do 420 it=1,mu number = nru(it) c find the appropriate column of q. 250 do 260 j=1,mvv right(j) = 0. 260 continue if(nrold.eq.number) go to 280 if(p.le.0.) go to 410 c fetch a new row of matrix (bu). do 270 j=1,5 h(j) = bu(n1,j)*pinv 270 continue i0 = 1 i1 = 5 go to 310 c fetch a new row of matrix (spu). 280 do 290 j=1,4 h(j) = spu(it,j) 290 continue c find the appropriate column of q. do 300 j=1,mv l = l+1 right(j) = r(l) 300 continue i0 = 1 i1 = 4 310 j0 = n1 j1 = nu7-number c take into account that we eliminate the constraints (3) 315 if(j0-1.gt.iop0) go to 335 fac0 = h(i0) do 320 j=1,mv right(j) = right(j)-fac0*a0(j0,j) 320 continue if(mv.eq.mvv) go to 330 j = mv do 325 jj=1,nv8 j = j+1 right(j) = right(j)-fac0*b0(j0,jj) 325 continue 330 j0 = j0+1 i0 = i0+1 go to 315 c take into account that we eliminate the constraints (4) 335 if(j1-1.gt.iop1) go to 360 fac1 = h(i1) do 340 j=1,mv right(j) = right(j)-fac1*a1(j1,j) 340 continue if(mv.eq.mvv) go to 350 j = mv do 345 jj=1,nv8 j = j+1 right(j) = right(j)-fac1*b1(j1,jj) 345 continue 350 j1 = j1+1 i1 = i1-1 go to 335 360 irot = nrold-iop0-1 if(irot.lt.0) irot = 0 c rotate the new row of matrix (auu) into triangle. if(i0.gt.i1) go to 390 do 385 i=i0,i1 irot = irot+1 piv = h(i) if(piv.eq.0.) go to 385 c calculate the parameters of the givens transformation. call fpgivs(piv,au(irot,1),co,si) c apply that transformation to the rows of matrix (qq). iq = (irot-1)*mvv do 370 j=1,mvv iq = iq+1 call fprota(co,si,right(j),q(iq)) 370 continue c apply that transformation to the columns of (auu). if(i.eq.i1) go to 385 i2 = 1 i3 = i+1 do 380 j=i3,i1 i2 = i2+1 call fprota(co,si,h(j),au(irot,i2)) 380 continue 385 continue c we update the sum of squared residuals. 390 do 395 j=1,mvv sq = sq+right(j)**2 395 continue if(nrold.eq.number) go to 420 410 nrold = n1 n1 = n1+1 go to 250 420 continue if(nuu.eq.0) go to 800 c we determine the matrix (avv) and then we reduce her to an unit c upper triangular form (rv) using givens rotations without square c roots. we apply the same transformations to the columns of matrix c g to obtain the (nv-7) x (nu-6-iop0-iop1) matrix h. c we store matrix (rv) into av1 and av2, h into c. c the nv7 x nv7 triangular unit upper matrix (rv) has the form c | av1 ' | c (rv) = | ' av2 | c | 0 ' | c with (av2) a nv7 x 4 matrix and (av1) a nv11 x nv11 unit upper c triangular matrix of bandwidth 5. ncof = nuu*nv7 c initialization. do 430 i=1,ncof c(i) = 0. 430 continue do 440 i=1,nv4 av1(i,5) = 0. do 440 j=1,4 av1(i,j) = 0. av2(i,j) = 0. 440 continue jper = 0 nrold = 0 do 770 it=1,mv number = nrv(it) 450 if(nrold.eq.number) go to 480 if(p.le.0.) go to 760 c fetch a new row of matrix (bv). n1 = nrold+1 do 460 j=1,5 h(j) = bv(n1,j)*pinv 460 continue c find the appropriate row of g. do 465 j=1,nuu right(j) = 0. 465 continue if(mv.eq.mvv) go to 510 l = mv+n1 do 470 j=1,nuu right(j) = q(l) l = l+mvv 470 continue go to 510 c fetch a new row of matrix (spv) 480 h(5) = 0. do 490 j=1,4 h(j) = spv(it,j) 490 continue c find the appropriate row of g. l = it do 500 j=1,nuu right(j) = q(l) l = l+mvv 500 continue c test whether there are non-zero values in the new row of (avv) c corresponding to the b-splines n(j;v),j=nv7+1,...,nv4. 510 if(nrold.lt.nv11) go to 710 if(jper.ne.0) go to 550 c initialize the matrix (av2). jk = nv11+1 do 540 i=1,4 ik = jk do 520 j=1,5 if(ik.le.0) go to 530 av2(ik,i) = av1(ik,j) ik = ik-1 520 continue 530 jk = jk+1 540 continue jper = 1 c if one of the non-zero elements of the new row corresponds to one of c the b-splines n(j;v),j=nv7+1,...,nv4, we take account of condition c (2) for setting up this row of (avv). the row is stored in h1( the c part with respect to av1) and h2 (the part with respect to av2). 550 do 560 i=1,4 h1(i) = 0. h2(i) = 0. 560 continue h1(5) = 0. j = nrold-nv11 do 600 i=1,5 j = j+1 l0 = j 570 l1 = l0-4 if(l1.le.0) go to 590 if(l1.le.nv11) go to 580 l0 = l1-nv11 go to 570 580 h1(l1) = h(i) go to 600 590 h2(l0) = h2(l0) + h(i) 600 continue c rotate the new row of (avv) into triangle. if(nv11.le.0) go to 670 c rotations with the rows 1,2,...,nv11 of (avv). do 660 j=1,nv11 piv = h1(1) i2 = min0(nv11-j,4) if(piv.eq.0.) go to 640 c calculate the parameters of the givens transformation. call fpgivs(piv,av1(j,1),co,si) c apply that transformation to the columns of matrix g. ic = j do 610 i=1,nuu call fprota(co,si,right(i),c(ic)) ic = ic+nv7 610 continue c apply that transformation to the rows of (avv) with respect to av2. do 620 i=1,4 call fprota(co,si,h2(i),av2(j,i)) 620 continue c apply that transformation to the rows of (avv) with respect to av1. if(i2.eq.0) go to 670 do 630 i=1,i2 i1 = i+1 call fprota(co,si,h1(i1),av1(j,i1)) 630 continue 640 do 650 i=1,i2 h1(i) = h1(i+1) 650 continue h1(i2+1) = 0. 660 continue c rotations with the rows nv11+1,...,nv7 of avv. 670 do 700 j=1,4 ij = nv11+j if(ij.le.0) go to 700 piv = h2(j) if(piv.eq.0.) go to 700 c calculate the parameters of the givens transformation. call fpgivs(piv,av2(ij,j),co,si) c apply that transformation to the columns of matrix g. ic = ij do 680 i=1,nuu call fprota(co,si,right(i),c(ic)) ic = ic+nv7 680 continue if(j.eq.4) go to 700 c apply that transformation to the rows of (avv) with respect to av2. j1 = j+1 do 690 i=j1,4 call fprota(co,si,h2(i),av2(ij,i)) 690 continue 700 continue c we update the sum of squared residuals. do 705 i=1,nuu sq = sq+right(i)**2 705 continue go to 750 c rotation into triangle of the new row of (avv), in case the elements c corresponding to the b-splines n(j;v),j=nv7+1,...,nv4 are all zero. 710 irot =nrold do 740 i=1,5 irot = irot+1 piv = h(i) if(piv.eq.0.) go to 740 c calculate the parameters of the givens transformation. call fpgivs(piv,av1(irot,1),co,si) c apply that transformation to the columns of matrix g. ic = irot do 720 j=1,nuu call fprota(co,si,right(j),c(ic)) ic = ic+nv7 720 continue c apply that transformation to the rows of (avv). if(i.eq.5) go to 740 i2 = 1 i3 = i+1 do 730 j=i3,5 i2 = i2+1 call fprota(co,si,h(j),av1(irot,i2)) 730 continue 740 continue c we update the sum of squared residuals. do 745 i=1,nuu sq = sq+right(i)**2 745 continue 750 if(nrold.eq.number) go to 770 760 nrold = nrold+1 go to 450 770 continue c test whether the b-spline coefficients must be determined. if(iback.ne.0) return c backward substitution to obtain the b-spline coefficients as the c solution of the linear system (rv) (cr) (ru)' = h. c first step: solve the system (rv) (c1) = h. k = 1 do 780 i=1,nuu call fpbacp(av1,av2,c(k),nv7,4,c(k),5,nv) k = k+nv7 780 continue c second step: solve the system (cr) (ru)' = (c1). k = 0 do 795 j=1,nv7 k = k+1 l = k do 785 i=1,nuu right(i) = c(l) l = l+nv7 785 continue call fpback(au,right,nuu,5,right,nu) l = k do 790 i=1,nuu c(l) = right(i) l = l+nv7 790 continue 795 continue c calculate from the conditions (2)-(3)-(4), the remaining b-spline c coefficients. 800 ncof = nu4*nv4 j = ncof do 805 l=1,nv4 q(l) = dr01 q(j) = dr11 j = j-1 805 continue i = nv4 j = 0 if(iop0.eq.0) go to 815 do 810 l=1,nv4 i = i+1 q(i) = c0(l) 810 continue 815 if(nuu.eq.0) go to 835 do 830 l=1,nuu ii = i do 820 k=1,nv7 i = i+1 j = j+1 q(i) = c(j) 820 continue do 825 k=1,3 ii = ii+1 i = i+1 q(i) = q(ii) 825 continue 830 continue 835 if(iop1.eq.0) go to 845 do 840 l=1,nv4 i = i+1 q(i) = c1(l) 840 continue 845 do 850 i=1,ncof c(i) = q(i) 850 continue c calculate the quantities c res(i,j) = (r(i,j) - s(u(i),v(j)))**2 , i=1,2,..,mu;j=1,2,..,mv c fp = sumi=1,mu(sumj=1,mv(res(i,j))) c fpu(r) = sum''i(sumj=1,mv(res(i,j))) , r=1,2,...,nu-7 c tu(r+3) <= u(i) <= tu(r+4) c fpv(r) = sumi=1,mu(sum''j(res(i,j))) , r=1,2,...,nv-7 c tv(r+3) <= v(j) <= tv(r+4) fp = 0. do 890 i=1,nu fpu(i) = 0. 890 continue do 900 i=1,nv fpv(i) = 0. 900 continue ir = 0 nroldu = 0 c main loop for the different grid points. do 950 i1=1,mu numu = nru(i1) numu1 = numu+1 nroldv = 0 do 940 i2=1,mv numv = nrv(i2) numv1 = numv+1 ir = ir+1 c evaluate s(u,v) at the current grid point by making the sum of the c cross products of the non-zero b-splines at (u,v), multiplied with c the appropriate b-spline coefficients. term = 0. k1 = numu*nv4+numv do 920 l1=1,4 k2 = k1 fac = spu(i1,l1) do 910 l2=1,4 k2 = k2+1 term = term+fac*spv(i2,l2)*c(k2) 910 continue k1 = k1+nv4 920 continue c calculate the squared residual at the current grid point. term = (r(ir)-term)**2 c adjust the different parameters. fp = fp+term fpu(numu1) = fpu(numu1)+term fpv(numv1) = fpv(numv1)+term fac = term*half if(numv.eq.nroldv) go to 930 fpv(numv1) = fpv(numv1)-fac fpv(numv) = fpv(numv)+fac 930 nroldv = numv if(numu.eq.nroldu) go to 940 fpu(numu1) = fpu(numu1)-fac fpu(numu) = fpu(numu)+fac 940 continue nroldu = numu 950 continue return end
bsd-3-clause
aeklant/scipy
scipy/special/cdflib/bcorr.f
151
1549
DOUBLE PRECISION FUNCTION bcorr(a0,b0) C----------------------------------------------------------------------- C C EVALUATION OF DEL(A0) + DEL(B0) - DEL(A0 + B0) WHERE C LN(GAMMA(A)) = (A - 0.5)*LN(A) - A + 0.5*LN(2*PI) + DEL(A). C IT IS ASSUMED THAT A0 .GE. 8 AND B0 .GE. 8. C C----------------------------------------------------------------------- C .. Scalar Arguments .. DOUBLE PRECISION a0,b0 C .. C .. Local Scalars .. DOUBLE PRECISION a,b,c,c0,c1,c2,c3,c4,c5,h,s11,s3,s5,s7,s9,t,w,x, + x2 C .. C .. Intrinsic Functions .. INTRINSIC dmax1,dmin1 C .. C .. Data statements .. DATA c0/.833333333333333D-01/,c1/-.277777777760991D-02/, + c2/.793650666825390D-03/,c3/-.595202931351870D-03/, + c4/.837308034031215D-03/,c5/-.165322962780713D-02/ C .. C .. Executable Statements .. C------------------------ a = dmin1(a0,b0) b = dmax1(a0,b0) C h = a/b c = h/ (1.0D0+h) x = 1.0D0/ (1.0D0+h) x2 = x*x C C SET SN = (1 - X**N)/(1 - X) C s3 = 1.0D0 + (x+x2) s5 = 1.0D0 + (x+x2*s3) s7 = 1.0D0 + (x+x2*s5) s9 = 1.0D0 + (x+x2*s7) s11 = 1.0D0 + (x+x2*s9) C C SET W = DEL(B) - DEL(A + B) C t = (1.0D0/b)**2 w = ((((c5*s11*t+c4*s9)*t+c3*s7)*t+c2*s5)*t+c1*s3)*t + c0 w = w* (c/b) C C COMPUTE DEL(A) + W C t = (1.0D0/a)**2 bcorr = (((((c5*t+c4)*t+c3)*t+c2)*t+c1)*t+c0)/a + w RETURN END
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/optional_dim_3.f90
144
1760
! { dg-do run } ! PR34540 cshift, eoshift, kind=1 and kind=2 arguments. ! Test case thanks to Thomas Koenig. module tst_foo implicit none contains subroutine tst_optional(a,n1,n2) integer(kind=1), intent(in), optional:: n1 integer(kind=2), intent(in), optional:: n2 integer(kind=1), dimension(2) :: s1 character(64) :: testbuf real, dimension(:,:) :: a s1 = (/1, 1/) write(testbuf,'(4F10.2)') cshift(a, shift=s1) if (testbuf /= " 2.00 1.00 4.00 3.00") CALL abort write(testbuf,'(4F10.2)') cshift(a,shift=s1,dim=n2) if (testbuf /= " 2.00 1.00 4.00 3.00") CALL abort write(testbuf,'(4F10.2)') eoshift(a,shift=s1,dim=n1) if (testbuf /= " 2.00 0.00 4.00 0.00") CALL abort write(testbuf,'(4F10.2)') eoshift(a,shift=s1,dim=n2) if (testbuf /= " 2.00 0.00 4.00 0.00") CALL abort end subroutine tst_optional subroutine sub(bound, dimmy) integer(kind=8), optional :: dimmy logical, optional :: bound logical :: lotto(4) character(20) :: testbuf lotto = .false. lotto = cshift((/.true.,.false.,.true.,.false./),1,dim=dimmy) write(testbuf,*) lotto if (trim(testbuf).ne." F T F T") call abort lotto = .false. lotto = eoshift((/.true.,.true.,.true.,.true./),1,boundary=bound,dim=dimmy) lotto = eoshift(lotto,1,dim=dimmy) write(testbuf,*) lotto if (trim(testbuf).ne." T T F F") call abort end subroutine end module tst_foo program main use tst_foo implicit none real, dimension(2,2) :: r integer(kind=1) :: d1 integer(kind=2) :: d2 data r /1.0, 2.0, 3.0, 4.0/ d1 = 1_1 d2 = 1_2 call tst_optional(r,d1, d2) call sub(bound=.false., dimmy=1_8) call sub() end program main
gpl-2.0
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/vector_subscript_6.f90
114
1154
! { dg-do compile } ! { dg-options "-fdump-tree-original" } subroutine test0(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix integer(kind=kind(1)), dimension(:), intent(in) :: e_x esss = Ix(e_x) end subroutine subroutine test1(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix integer(kind=4), dimension(:), intent(in) :: e_x esss = Ix(e_x) end subroutine subroutine test2(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix integer(kind=8), dimension(:), intent(in) :: e_x esss = Ix(e_x) end subroutine subroutine test3(esss,Ix,Iyz, e_x, ii_ivec) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix,Iyz integer(kind=kind(1)), dimension(:), intent(in) :: e_x,ii_ivec esss = esss + Ix(e_x) * Iyz(ii_ivec) end subroutine ! { dg-final { scan-tree-dump-not "malloc" "original" } } ! { dg-final { cleanup-tree-dump "original" } }
gpl-2.0
richardotis/scipy
scipy/sparse/linalg/eigen/arpack/ARPACK/SRC/snaup2.f
103
31679
c\BeginDoc c c\Name: snaup2 c c\Description: c Intermediate level interface called by snaupd. c c\Usage: c call snaup2 c ( IDO, BMAT, N, WHICH, NEV, NP, TOL, RESID, MODE, IUPD, c ISHIFT, MXITER, V, LDV, H, LDH, RITZR, RITZI, BOUNDS, c Q, LDQ, WORKL, IPNTR, WORKD, INFO ) c c\Arguments c c IDO, BMAT, N, WHICH, NEV, TOL, RESID: same as defined in snaupd. c MODE, ISHIFT, MXITER: see the definition of IPARAM in snaupd. c c NP Integer. (INPUT/OUTPUT) c Contains the number of implicit shifts to apply during c each Arnoldi iteration. c If ISHIFT=1, NP is adjusted dynamically at each iteration c to accelerate convergence and prevent stagnation. c This is also roughly equal to the number of matrix-vector c products (involving the operator OP) per Arnoldi iteration. c The logic for adjusting is contained within the current c subroutine. c If ISHIFT=0, NP is the number of shifts the user needs c to provide via reverse comunication. 0 < NP < NCV-NEV. c NP may be less than NCV-NEV for two reasons. The first, is c to keep complex conjugate pairs of "wanted" Ritz values c together. The second, is that a leading block of the current c upper Hessenberg matrix has split off and contains "unwanted" c Ritz values. c Upon termination of the IRA iteration, NP contains the number c of "converged" wanted Ritz values. c c IUPD Integer. (INPUT) c IUPD .EQ. 0: use explicit restart instead implicit update. c IUPD .NE. 0: use implicit update. c c V Real N by (NEV+NP) array. (INPUT/OUTPUT) c The Arnoldi basis vectors are returned in the first NEV c columns of V. c c LDV Integer. (INPUT) c Leading dimension of V exactly as declared in the calling c program. c c H Real (NEV+NP) by (NEV+NP) array. (OUTPUT) c H is used to store the generated upper Hessenberg matrix c c LDH Integer. (INPUT) c Leading dimension of H exactly as declared in the calling c program. c c RITZR, Real arrays of length NEV+NP. (OUTPUT) c RITZI RITZR(1:NEV) (resp. RITZI(1:NEV)) contains the real (resp. c imaginary) part of the computed Ritz values of OP. c c BOUNDS Real array of length NEV+NP. (OUTPUT) c BOUNDS(1:NEV) contain the error bounds corresponding to c the computed Ritz values. c c Q Real (NEV+NP) by (NEV+NP) array. (WORKSPACE) c Private (replicated) work array used to accumulate the c rotation in the shift application step. c c LDQ Integer. (INPUT) c Leading dimension of Q exactly as declared in the calling c program. c c WORKL Real work array of length at least c (NEV+NP)**2 + 3*(NEV+NP). (INPUT/WORKSPACE) c Private (replicated) array on each PE or array allocated on c the front end. It is used in shifts calculation, shifts c application and convergence checking. c c On exit, the last 3*(NEV+NP) locations of WORKL contain c the Ritz values (real,imaginary) and associated Ritz c estimates of the current Hessenberg matrix. They are c listed in the same order as returned from sneigh. c c If ISHIFT .EQ. O and IDO .EQ. 3, the first 2*NP locations c of WORKL are used in reverse communication to hold the user c supplied shifts. c c IPNTR Integer array of length 3. (OUTPUT) c Pointer to mark the starting locations in the WORKD for c vectors used by the Arnoldi iteration. c ------------------------------------------------------------- c IPNTR(1): pointer to the current operand vector X. c IPNTR(2): pointer to the current result vector Y. c IPNTR(3): pointer to the vector B * X when used in the c shift-and-invert mode. X is the current operand. c ------------------------------------------------------------- c c WORKD Real work array of length 3*N. (WORKSPACE) c Distributed array to be used in the basic Arnoldi iteration c for reverse communication. The user should not use WORKD c as temporary workspace during the iteration !!!!!!!!!! c See Data Distribution Note in DNAUPD. c c INFO Integer. (INPUT/OUTPUT) c If INFO .EQ. 0, a randomly initial residual vector is used. c If INFO .NE. 0, RESID contains the initial residual vector, c possibly from a previous run. c Error flag on output. c = 0: Normal return. c = 1: Maximum number of iterations taken. c All possible eigenvalues of OP has been found. c NP returns the number of converged Ritz values. c = 2: No shifts could be applied. c = -8: Error return from LAPACK eigenvalue calculation; c This should never happen. c = -9: Starting vector is zero. c = -9999: Could not build an Arnoldi factorization. c Size that was built in returned in NP. c c\EndDoc c c----------------------------------------------------------------------- c c\BeginLib c c\Local variables: c xxxxxx real c c\References: c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), c pp 357-385. c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly c Restarted Arnoldi Iteration", Rice University Technical Report c TR95-13, Department of Computational and Applied Mathematics. c c\Routines called: c sgetv0 ARPACK initial vector generation routine. c snaitr ARPACK Arnoldi factorization routine. c snapps ARPACK application of implicit shifts routine. c snconv ARPACK convergence of Ritz values routine. c sneigh ARPACK compute Ritz values and error bounds routine. c sngets ARPACK reorder Ritz values and error bounds routine. c ssortc ARPACK sorting routine. c ivout ARPACK utility routine that prints integers. c arscnd ARPACK utility routine for timing. c smout ARPACK utility routine that prints matrices c svout ARPACK utility routine that prints vectors. c wslamch LAPACK routine that determines machine constants. c wslapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. c scopy Level 1 BLAS that copies one vector to another . c wsdot Level 1 BLAS that computes the scalar product of two vectors. c wsnrm2 Level 1 BLAS that computes the norm of a vector. c sswap Level 1 BLAS that swaps two vectors. c c\Author c Danny Sorensen Phuong Vu c Richard Lehoucq CRPC / Rice University c Dept. of Computational & Houston, Texas c Applied Mathematics c Rice University c Houston, Texas c c\SCCS Information: @(#) c FILE: naup2.F SID: 2.8 DATE OF SID: 10/17/00 RELEASE: 2 c c\Remarks c 1. None c c\EndLib c c----------------------------------------------------------------------- c subroutine snaup2 & ( ido, bmat, n, which, nev, np, tol, resid, mode, iupd, & ishift, mxiter, v, ldv, h, ldh, ritzr, ritzi, bounds, & q, ldq, workl, ipntr, workd, info ) c c %----------------------------------------------------% c | Include files for debugging and timing information | c %----------------------------------------------------% c include 'debug.h' include 'stat.h' c c %------------------% c | Scalar Arguments | c %------------------% c character bmat*1, which*2 integer ido, info, ishift, iupd, mode, ldh, ldq, ldv, mxiter, & n, nev, np Real & tol c c %-----------------% c | Array Arguments | c %-----------------% c integer ipntr(13) Real & bounds(nev+np), h(ldh,nev+np), q(ldq,nev+np), resid(n), & ritzi(nev+np), ritzr(nev+np), v(ldv,nev+np), & workd(3*n), workl( (nev+np)*(nev+np+3) ) c c %------------% c | Parameters | c %------------% c Real & one, zero parameter (one = 1.0E+0 , zero = 0.0E+0 ) c c %---------------% c | Local Scalars | c %---------------% c character wprime*2 logical cnorm , getv0, initv, update, ushift integer ierr , iter , j , kplusp, msglvl, nconv, & nevbef, nev0 , np0 , nptemp, numcnv Real & rnorm , temp , eps23 save cnorm , getv0, initv, update, ushift, & rnorm , iter , eps23, kplusp, msglvl, nconv , & nevbef, nev0 , np0 , numcnv c c %-----------------------% c | Local array arguments | c %-----------------------% c integer kp(4) c c %----------------------% c | External Subroutines | c %----------------------% c external scopy , sgetv0, snaitr, snconv, sneigh, & sngets, snapps, svout , ivout , arscnd c c %--------------------% c | External Functions | c %--------------------% c Real & wsdot, wsnrm2, wslapy2, wslamch external wsdot, wsnrm2, wslapy2, wslamch c c %---------------------% c | Intrinsic Functions | c %---------------------% c intrinsic min, max, abs, sqrt c c %-----------------------% c | Executable Statements | c %-----------------------% c if (ido .eq. 0) then c call arscnd (t0) c msglvl = mnaup2 c c %-------------------------------------% c | Get the machine dependent constant. | c %-------------------------------------% c eps23 = wslamch('Epsilon-Machine') eps23 = eps23**(2.0E+0 / 3.0E+0 ) c nev0 = nev np0 = np c c %-------------------------------------% c | kplusp is the bound on the largest | c | Lanczos factorization built. | c | nconv is the current number of | c | "converged" eigenvlues. | c | iter is the counter on the current | c | iteration step. | c %-------------------------------------% c kplusp = nev + np nconv = 0 iter = 0 c c %---------------------------------------% c | Set flags for computing the first NEV | c | steps of the Arnoldi factorization. | c %---------------------------------------% c getv0 = .true. update = .false. ushift = .false. cnorm = .false. c if (info .ne. 0) then c c %--------------------------------------------% c | User provides the initial residual vector. | c %--------------------------------------------% c initv = .true. info = 0 else initv = .false. end if end if c c %---------------------------------------------% c | Get a possibly random starting vector and | c | force it into the range of the operator OP. | c %---------------------------------------------% c 10 continue c if (getv0) then call sgetv0 (ido, bmat, 1, initv, n, 1, v, ldv, resid, rnorm, & ipntr, workd, info) c if (ido .ne. 99) go to 9000 c if (rnorm .eq. zero) then c c %-----------------------------------------% c | The initial vector is zero. Error exit. | c %-----------------------------------------% c info = -9 go to 1100 end if getv0 = .false. ido = 0 end if c c %-----------------------------------% c | Back from reverse communication : | c | continue with update step | c %-----------------------------------% c if (update) go to 20 c c %-------------------------------------------% c | Back from computing user specified shifts | c %-------------------------------------------% c if (ushift) go to 50 c c %-------------------------------------% c | Back from computing residual norm | c | at the end of the current iteration | c %-------------------------------------% c if (cnorm) go to 100 c c %----------------------------------------------------------% c | Compute the first NEV steps of the Arnoldi factorization | c %----------------------------------------------------------% c call snaitr (ido, bmat, n, 0, nev, mode, resid, rnorm, v, ldv, & h, ldh, ipntr, workd, info) c c %---------------------------------------------------% c | ido .ne. 99 implies use of reverse communication | c | to compute operations involving OP and possibly B | c %---------------------------------------------------% c if (ido .ne. 99) go to 9000 c if (info .gt. 0) then np = info mxiter = iter info = -9999 go to 1200 end if c c %--------------------------------------------------------------% c | | c | M A I N ARNOLDI I T E R A T I O N L O O P | c | Each iteration implicitly restarts the Arnoldi | c | factorization in place. | c | | c %--------------------------------------------------------------% c 1000 continue c iter = iter + 1 c if (msglvl .gt. 0) then call ivout (logfil, 1, iter, ndigit, & '_naup2: **** Start of major iteration number ****') end if c c %-----------------------------------------------------------% c | Compute NP additional steps of the Arnoldi factorization. | c | Adjust NP since NEV might have been updated by last call | c | to the shift application routine snapps. | c %-----------------------------------------------------------% c np = kplusp - nev c if (msglvl .gt. 1) then call ivout (logfil, 1, nev, ndigit, & '_naup2: The length of the current Arnoldi factorization') call ivout (logfil, 1, np, ndigit, & '_naup2: Extend the Arnoldi factorization by') end if c c %-----------------------------------------------------------% c | Compute NP additional steps of the Arnoldi factorization. | c %-----------------------------------------------------------% c ido = 0 20 continue update = .true. c call snaitr (ido , bmat, n , nev, np , mode , resid, & rnorm, v , ldv, h , ldh, ipntr, workd, & info) c c %---------------------------------------------------% c | ido .ne. 99 implies use of reverse communication | c | to compute operations involving OP and possibly B | c %---------------------------------------------------% c if (ido .ne. 99) go to 9000 c if (info .gt. 0) then np = info mxiter = iter info = -9999 go to 1200 end if update = .false. c if (msglvl .gt. 1) then call svout (logfil, 1, rnorm, ndigit, & '_naup2: Corresponding B-norm of the residual') end if c c %--------------------------------------------------------% c | Compute the eigenvalues and corresponding error bounds | c | of the current upper Hessenberg matrix. | c %--------------------------------------------------------% c call sneigh (rnorm, kplusp, h, ldh, ritzr, ritzi, bounds, & q, ldq, workl, ierr) c if (ierr .ne. 0) then info = -8 go to 1200 end if c c %----------------------------------------------------% c | Make a copy of eigenvalues and corresponding error | c | bounds obtained from sneigh. | c %----------------------------------------------------% c call scopy(kplusp, ritzr, 1, workl(kplusp**2+1), 1) call scopy(kplusp, ritzi, 1, workl(kplusp**2+kplusp+1), 1) call scopy(kplusp, bounds, 1, workl(kplusp**2+2*kplusp+1), 1) c c %---------------------------------------------------% c | Select the wanted Ritz values and their bounds | c | to be used in the convergence test. | c | The wanted part of the spectrum and corresponding | c | error bounds are in the last NEV loc. of RITZR, | c | RITZI and BOUNDS respectively. The variables NEV | c | and NP may be updated if the NEV-th wanted Ritz | c | value has a non zero imaginary part. In this case | c | NEV is increased by one and NP decreased by one. | c | NOTE: The last two arguments of sngets are no | c | longer used as of version 2.1. | c %---------------------------------------------------% c nev = nev0 np = np0 numcnv = nev call sngets (ishift, which, nev, np, ritzr, ritzi, & bounds, workl, workl(np+1)) if (nev .eq. nev0+1) numcnv = nev0+1 c c %-------------------% c | Convergence test. | c %-------------------% c call scopy (nev, bounds(np+1), 1, workl(2*np+1), 1) call snconv (nev, ritzr(np+1), ritzi(np+1), workl(2*np+1), & tol, nconv) c if (msglvl .gt. 2) then kp(1) = nev kp(2) = np kp(3) = numcnv kp(4) = nconv call ivout (logfil, 4, kp, ndigit, & '_naup2: NEV, NP, NUMCNV, NCONV are') call svout (logfil, kplusp, ritzr, ndigit, & '_naup2: Real part of the eigenvalues of H') call svout (logfil, kplusp, ritzi, ndigit, & '_naup2: Imaginary part of the eigenvalues of H') call svout (logfil, kplusp, bounds, ndigit, & '_naup2: Ritz estimates of the current NCV Ritz values') end if c c %---------------------------------------------------------% c | Count the number of unwanted Ritz values that have zero | c | Ritz estimates. If any Ritz estimates are equal to zero | c | then a leading block of H of order equal to at least | c | the number of Ritz values with zero Ritz estimates has | c | split off. None of these Ritz values may be removed by | c | shifting. Decrease NP the number of shifts to apply. If | c | no shifts may be applied, then prepare to exit | c %---------------------------------------------------------% c nptemp = np do 30 j=1, nptemp if (bounds(j) .eq. zero) then np = np - 1 nev = nev + 1 end if 30 continue c if ( (nconv .ge. numcnv) .or. & (iter .gt. mxiter) .or. & (np .eq. 0) ) then c if (msglvl .gt. 4) then call svout(logfil, kplusp, workl(kplusp**2+1), ndigit, & '_naup2: Real part of the eig computed by _neigh:') call svout(logfil, kplusp, workl(kplusp**2+kplusp+1), & ndigit, & '_naup2: Imag part of the eig computed by _neigh:') call svout(logfil, kplusp, workl(kplusp**2+kplusp*2+1), & ndigit, & '_naup2: Ritz eistmates computed by _neigh:') end if c c %------------------------------------------------% c | Prepare to exit. Put the converged Ritz values | c | and corresponding bounds in RITZ(1:NCONV) and | c | BOUNDS(1:NCONV) respectively. Then sort. Be | c | careful when NCONV > NP | c %------------------------------------------------% c c %------------------------------------------% c | Use h( 3,1 ) as storage to communicate | c | rnorm to _neupd if needed | c %------------------------------------------% h(3,1) = rnorm c c %----------------------------------------------% c | To be consistent with sngets, we first do a | c | pre-processing sort in order to keep complex | c | conjugate pairs together. This is similar | c | to the pre-processing sort used in sngets | c | except that the sort is done in the opposite | c | order. | c %----------------------------------------------% c if (which .eq. 'LM') wprime = 'SR' if (which .eq. 'SM') wprime = 'LR' if (which .eq. 'LR') wprime = 'SM' if (which .eq. 'SR') wprime = 'LM' if (which .eq. 'LI') wprime = 'SM' if (which .eq. 'SI') wprime = 'LM' c call ssortc (wprime, .true., kplusp, ritzr, ritzi, bounds) c c %----------------------------------------------% c | Now sort Ritz values so that converged Ritz | c | values appear within the first NEV locations | c | of ritzr, ritzi and bounds, and the most | c | desired one appears at the front. | c %----------------------------------------------% c if (which .eq. 'LM') wprime = 'SM' if (which .eq. 'SM') wprime = 'LM' if (which .eq. 'LR') wprime = 'SR' if (which .eq. 'SR') wprime = 'LR' if (which .eq. 'LI') wprime = 'SI' if (which .eq. 'SI') wprime = 'LI' c call ssortc(wprime, .true., kplusp, ritzr, ritzi, bounds) c c %--------------------------------------------------% c | Scale the Ritz estimate of each Ritz value | c | by 1 / max(eps23,magnitude of the Ritz value). | c %--------------------------------------------------% c do 35 j = 1, numcnv temp = max(eps23,wslapy2(ritzr(j), & ritzi(j))) bounds(j) = bounds(j)/temp 35 continue c c %----------------------------------------------------% c | Sort the Ritz values according to the scaled Ritz | c | esitmates. This will push all the converged ones | c | towards the front of ritzr, ritzi, bounds | c | (in the case when NCONV < NEV.) | c %----------------------------------------------------% c wprime = 'LR' call ssortc(wprime, .true., numcnv, bounds, ritzr, ritzi) c c %----------------------------------------------% c | Scale the Ritz estimate back to its original | c | value. | c %----------------------------------------------% c do 40 j = 1, numcnv temp = max(eps23, wslapy2(ritzr(j), & ritzi(j))) bounds(j) = bounds(j)*temp 40 continue c c %------------------------------------------------% c | Sort the converged Ritz values again so that | c | the "threshold" value appears at the front of | c | ritzr, ritzi and bound. | c %------------------------------------------------% c call ssortc(which, .true., nconv, ritzr, ritzi, bounds) c if (msglvl .gt. 1) then call svout (logfil, kplusp, ritzr, ndigit, & '_naup2: Sorted real part of the eigenvalues') call svout (logfil, kplusp, ritzi, ndigit, & '_naup2: Sorted imaginary part of the eigenvalues') call svout (logfil, kplusp, bounds, ndigit, & '_naup2: Sorted ritz estimates.') end if c c %------------------------------------% c | Max iterations have been exceeded. | c %------------------------------------% c if (iter .gt. mxiter .and. nconv .lt. numcnv) info = 1 c c %---------------------% c | No shifts to apply. | c %---------------------% c if (np .eq. 0 .and. nconv .lt. numcnv) info = 2 c np = nconv go to 1100 c else if ( (nconv .lt. numcnv) .and. (ishift .eq. 1) ) then c c %-------------------------------------------------% c | Do not have all the requested eigenvalues yet. | c | To prevent possible stagnation, adjust the size | c | of NEV. | c %-------------------------------------------------% c nevbef = nev nev = nev + min(nconv, np/2) if (nev .eq. 1 .and. kplusp .ge. 6) then nev = kplusp / 2 else if (nev .eq. 1 .and. kplusp .gt. 3) then nev = 2 end if c %---- Scipy fix ------------------------------------------------ c | We must keep nev below this value, as otherwise we can get c | np == 0 (note that sngets below can bump nev by 1). If np == 0, c | the next call to `snaitr` will write out-of-bounds. c | if (nev .gt. kplusp - 2) then nev = kplusp - 2 end if c | c %---- Scipy fix end -------------------------------------------- c np = kplusp - nev c c %---------------------------------------% c | If the size of NEV was just increased | c | resort the eigenvalues. | c %---------------------------------------% c if (nevbef .lt. nev) & call sngets (ishift, which, nev, np, ritzr, ritzi, & bounds, workl, workl(np+1)) c end if c if (msglvl .gt. 0) then call ivout (logfil, 1, nconv, ndigit, & '_naup2: no. of "converged" Ritz values at this iter.') if (msglvl .gt. 1) then kp(1) = nev kp(2) = np call ivout (logfil, 2, kp, ndigit, & '_naup2: NEV and NP are') call svout (logfil, nev, ritzr(np+1), ndigit, & '_naup2: "wanted" Ritz values -- real part') call svout (logfil, nev, ritzi(np+1), ndigit, & '_naup2: "wanted" Ritz values -- imag part') call svout (logfil, nev, bounds(np+1), ndigit, & '_naup2: Ritz estimates of the "wanted" values ') end if end if c if (ishift .eq. 0) then c c %-------------------------------------------------------% c | User specified shifts: reverse comminucation to | c | compute the shifts. They are returned in the first | c | 2*NP locations of WORKL. | c %-------------------------------------------------------% c ushift = .true. ido = 3 go to 9000 end if c 50 continue c c %------------------------------------% c | Back from reverse communication; | c | User specified shifts are returned | c | in WORKL(1:2*NP) | c %------------------------------------% c ushift = .false. c if ( ishift .eq. 0 ) then c c %----------------------------------% c | Move the NP shifts from WORKL to | c | RITZR, RITZI to free up WORKL | c | for non-exact shift case. | c %----------------------------------% c call scopy (np, workl, 1, ritzr, 1) call scopy (np, workl(np+1), 1, ritzi, 1) end if c if (msglvl .gt. 2) then call ivout (logfil, 1, np, ndigit, & '_naup2: The number of shifts to apply ') call svout (logfil, np, ritzr, ndigit, & '_naup2: Real part of the shifts') call svout (logfil, np, ritzi, ndigit, & '_naup2: Imaginary part of the shifts') if ( ishift .eq. 1 ) & call svout (logfil, np, bounds, ndigit, & '_naup2: Ritz estimates of the shifts') end if c c %---------------------------------------------------------% c | Apply the NP implicit shifts by QR bulge chasing. | c | Each shift is applied to the whole upper Hessenberg | c | matrix H. | c | The first 2*N locations of WORKD are used as workspace. | c %---------------------------------------------------------% c call snapps (n, nev, np, ritzr, ritzi, v, ldv, & h, ldh, resid, q, ldq, workl, workd) c c %---------------------------------------------% c | Compute the B-norm of the updated residual. | c | Keep B*RESID in WORKD(1:N) to be used in | c | the first step of the next call to snaitr. | c %---------------------------------------------% c cnorm = .true. call arscnd (t2) if (bmat .eq. 'G') then nbx = nbx + 1 call scopy (n, resid, 1, workd(n+1), 1) ipntr(1) = n + 1 ipntr(2) = 1 ido = 2 c c %----------------------------------% c | Exit in order to compute B*RESID | c %----------------------------------% c go to 9000 else if (bmat .eq. 'I') then call scopy (n, resid, 1, workd, 1) end if c 100 continue c c %----------------------------------% c | Back from reverse communication; | c | WORKD(1:N) := B*RESID | c %----------------------------------% c if (bmat .eq. 'G') then call arscnd (t3) tmvbx = tmvbx + (t3 - t2) end if c if (bmat .eq. 'G') then rnorm = wsdot (n, resid, 1, workd, 1) rnorm = sqrt(abs(rnorm)) else if (bmat .eq. 'I') then rnorm = wsnrm2(n, resid, 1) end if cnorm = .false. c if (msglvl .gt. 2) then call svout (logfil, 1, rnorm, ndigit, & '_naup2: B-norm of residual for compressed factorization') call smout (logfil, nev, nev, h, ldh, ndigit, & '_naup2: Compressed upper Hessenberg matrix H') end if c go to 1000 c c %---------------------------------------------------------------% c | | c | E N D O F M A I N I T E R A T I O N L O O P | c | | c %---------------------------------------------------------------% c 1100 continue c mxiter = iter nev = numcnv c 1200 continue ido = 99 c c %------------% c | Error Exit | c %------------% c call arscnd (t1) tnaup2 = t1 - t0 c 9000 continue c c %---------------% c | End of snaup2 | c %---------------% c return end
bsd-3-clause
richardotis/scipy
scipy/special/cdflib/dzror.f
106
7759
SUBROUTINE dzror(status,x,fx,xlo,xhi,qleft,qhi) C********************************************************************** C C SUBROUTINE DZROR(STATUS, X, FX, XLO, XHI, QLEFT, QHI) C Double precision ZeRo of a function -- Reverse Communication C C C Function C C C Performs the zero finding. STZROR must have been called before C this routine in order to set its parameters. C C C Arguments C C C STATUS <--> At the beginning of a zero finding problem, STATUS C should be set to 0 and ZROR invoked. (The value C of other parameters will be ignored on this call.) C C When ZROR needs the function evaluated, it will set C STATUS to 1 and return. The value of the function C should be set in FX and ZROR again called without C changing any of its other parameters. C C When ZROR has finished without error, it will return C with STATUS 0. In that case (XLO,XHI) bound the answe C C If ZROR finds an error (which implies that F(XLO)-Y an C F(XHI)-Y have the same sign, it returns STATUS -1. In C this case, XLO and XHI are undefined. C INTEGER STATUS C C X <-- The value of X at which F(X) is to be evaluated. C DOUBLE PRECISION X C C FX --> The value of F(X) calculated when ZROR returns with C STATUS = 1. C DOUBLE PRECISION FX C C XLO <-- When ZROR returns with STATUS = 0, XLO bounds the C inverval in X containing the solution below. C DOUBLE PRECISION XLO C C XHI <-- When ZROR returns with STATUS = 0, XHI bounds the C inverval in X containing the solution above. C DOUBLE PRECISION XHI C C QLEFT <-- .TRUE. if the stepping search terminated unsucessfully C at XLO. If it is .FALSE. the search terminated C unsucessfully at XHI. C QLEFT is LOGICAL C C QHI <-- .TRUE. if F(X) .GT. Y at the termination of the C search and .FALSE. if F(X) .LT. Y at the C termination of the search. C QHI is LOGICAL C C********************************************************************** C .. Scalar Arguments .. DOUBLE PRECISION fx,x,xhi,xlo,zabstl,zreltl,zxhi,zxlo INTEGER status LOGICAL qhi,qleft C .. C .. Save statement .. SAVE C .. C .. Local Scalars .. DOUBLE PRECISION a,abstol,b,c,d,fa,fb,fc,fd,fda,fdb,m,mb,p,q, + reltol,tol,w,xxhi,xxlo,zx INTEGER ext,i99999 LOGICAL first,qrzero C .. C .. Intrinsic Functions .. INTRINSIC abs,max,sign C .. C .. Statement Functions .. DOUBLE PRECISION ftol C .. C .. Statement Function definitions .. ftol(zx) = 0.5D0*max(abstol,reltol*abs(zx)) C .. C .. Executable Statements .. IF (status.GT.0) GO TO 280 xlo = xxlo xhi = xxhi b = xlo x = xlo C GET-FUNCTION-VALUE ASSIGN 10 TO i99999 GO TO 270 10 fb = fx xlo = xhi a = xlo x = xlo C GET-FUNCTION-VALUE ASSIGN 20 TO i99999 GO TO 270 C C Check that F(ZXLO) < 0 < F(ZXHI) or C F(ZXLO) > 0 > F(ZXHI) C 20 IF (.NOT. (fb.LT.0.0D0)) GO TO 40 IF (.NOT. (fx.LT.0.0D0)) GO TO 30 status = -1 qleft = fx .LT. fb qhi = .FALSE. RETURN 30 CONTINUE 40 IF (.NOT. (fb.GT.0.0D0)) GO TO 60 IF (.NOT. (fx.GT.0.0D0)) GO TO 50 status = -1 qleft = fx .GT. fb qhi = .TRUE. RETURN 50 CONTINUE 60 fa = fx C first = .TRUE. 70 c = a fc = fa ext = 0 80 IF (.NOT. (abs(fc).LT.abs(fb))) GO TO 100 IF (.NOT. (c.NE.a)) GO TO 90 d = a fd = fa 90 a = b fa = fb xlo = c b = xlo fb = fc c = a fc = fa 100 tol = ftol(xlo) m = (c+b)*.5D0 mb = m - b IF (.NOT. (abs(mb).GT.tol)) GO TO 240 IF (.NOT. (ext.GT.3)) GO TO 110 w = mb GO TO 190 110 tol = sign(tol,mb) p = (b-a)*fb IF (.NOT. (first)) GO TO 120 q = fa - fb first = .FALSE. GO TO 130 120 fdb = (fd-fb)/ (d-b) fda = (fd-fa)/ (d-a) p = fda*p q = fdb*fa - fda*fb 130 IF (.NOT. (p.LT.0.0D0)) GO TO 140 p = -p q = -q 140 IF (ext.EQ.3) p = p*2.0D0 IF (.NOT. ((p*1.0D0).EQ.0.0D0.OR.p.LE. (q*tol))) GO TO 150 w = tol GO TO 180 150 IF (.NOT. (p.LT. (mb*q))) GO TO 160 w = p/q GO TO 170 160 w = mb 170 CONTINUE 180 CONTINUE 190 d = a fd = fa a = b fa = fb b = b + w xlo = b x = xlo C GET-FUNCTION-VALUE ASSIGN 200 TO i99999 GO TO 270 200 fb = fx IF (.NOT. ((fc*fb).GE.0.0D0)) GO TO 210 GO TO 70 210 IF (.NOT. (w.EQ.mb)) GO TO 220 ext = 0 GO TO 230 220 ext = ext + 1 230 GO TO 80 240 xhi = c qrzero = (fc.GE.0.0D0 .AND. fb.LE.0.0D0) .OR. + (fc.LT.0.0D0 .AND. fb.GE.0.0D0) IF (.NOT. (qrzero)) GO TO 250 status = 0 GO TO 260 250 status = -1 260 RETURN ENTRY dstzr(zxlo,zxhi,zabstl,zreltl) C********************************************************************** C C SUBROUTINE DSTZR( XLO, XHI, ABSTOL, RELTOL ) C Double precision SeT ZeRo finder - Reverse communication version C C C Function C C C C Sets quantities needed by ZROR. The function of ZROR C and the quantities set is given here. C C Concise Description - Given a function F C find XLO such that F(XLO) = 0. C C More Precise Description - C C Input condition. F is a double precision function of a single C double precision argument and XLO and XHI are such that C F(XLO)*F(XHI) .LE. 0.0 C C If the input condition is met, QRZERO returns .TRUE. C and output values of XLO and XHI satisfy the following C F(XLO)*F(XHI) .LE. 0. C ABS(F(XLO) .LE. ABS(F(XHI) C ABS(XLO-XHI) .LE. TOL(X) C where C TOL(X) = MAX(ABSTOL,RELTOL*ABS(X)) C C If this algorithm does not find XLO and XHI satisfying C these conditions then QRZERO returns .FALSE. This C implies that the input condition was not met. C C C Arguments C C C XLO --> The left endpoint of the interval to be C searched for a solution. C XLO is DOUBLE PRECISION C C XHI --> The right endpoint of the interval to be C for a solution. C XHI is DOUBLE PRECISION C C ABSTOL, RELTOL --> Two numbers that determine the accuracy C of the solution. See function for a C precise definition. C ABSTOL is DOUBLE PRECISION C RELTOL is DOUBLE PRECISION C C C Method C C C Algorithm R of the paper 'Two Efficient Algorithms with C Guaranteed Convergence for Finding a Zero of a Function' C by J. C. P. Bus and T. J. Dekker in ACM Transactions on C Mathematical Software, Volume 1, no. 4 page 330 C (Dec. '75) is employed to find the zero of F(X)-Y. C C********************************************************************** xxlo = zxlo xxhi = zxhi abstol = zabstl reltol = zreltl RETURN STOP '*** EXECUTION FLOWING INTO FLECS PROCEDURES ***' C TO GET-FUNCTION-VALUE 270 status = 1 RETURN 280 CONTINUE GO TO i99999 END
bsd-3-clause
richardotis/scipy
scipy/fftpack/src/fftpack/rffti1.f
98
1357
SUBROUTINE RFFTI1 (N,WA,IFAC) DIMENSION WA(*) ,IFAC(*) ,NTRYH(4) DATA NTRYH(1),NTRYH(2),NTRYH(3),NTRYH(4)/4,2,3,5/ NL = N NF = 0 J = 0 101 J = J+1 IF (J.le.4) GO TO 102 GO TO 103 102 NTRY = NTRYH(J) GO TO 104 103 NTRY = NTRYH(4)+2*(J-4) 104 NQ = NL/NTRY NR = NL-NTRY*NQ IF (NR.eq.0) GO TO 105 GO TO 101 105 NF = NF+1 IFAC(NF+2) = NTRY NL = NQ IF (NTRY .NE. 2) GO TO 107 IF (NF .EQ. 1) GO TO 107 DO 106 I=2,NF IB = NF-I+2 IFAC(IB+2) = IFAC(IB+1) 106 CONTINUE IFAC(3) = 2 107 IF (NL .NE. 1) GO TO 104 IFAC(1) = N IFAC(2) = NF TPI = 6.28318530717959 ARGH = TPI/FLOAT(N) IS = 0 NFM1 = NF-1 L1 = 1 IF (NFM1 .EQ. 0) RETURN DO 110 K1=1,NFM1 IP = IFAC(K1+2) LD = 0 L2 = L1*IP IDO = N/L2 IPM = IP-1 DO 109 J=1,IPM LD = LD+L1 I = IS ARGLD = FLOAT(LD)*ARGH FI = 0. DO 108 II=3,IDO,2 I = I+2 FI = FI+1. ARG = FI*ARGLD WA(I-1) = COS(ARG) WA(I) = SIN(ARG) 108 CONTINUE IS = IS+IDO 109 CONTINUE L1 = L2 110 CONTINUE RETURN END
bsd-3-clause
aeklant/scipy
scipy/integrate/quadpack/dqagp.f
32
10517
subroutine dqagp(f,a,b,npts2,points,epsabs,epsrel,result,abserr, * neval,ier,leniw,lenw,last,iwork,work) c***begin prologue dqagp c***date written 800101 (yymmdd) c***revision date 830518 (yymmdd) c***category no. h2a2a1 c***keywords automatic integrator, general-purpose, c singularities at user specified points, c extrapolation, globally adaptive c***author piessens,robert,appl. math. & progr. div - k.u.leuven c de doncker,elise,appl. math. & progr. div. - k.u.leuven c***purpose the routine calculates an approximation result to a given c definite integral i = integral of f over (a,b), c hopefully satisfying following claim for accuracy c break points of the integration interval, where local c difficulties of the integrand may occur (e.g. c singularities, discontinuities), are provided by the user. c***description c c computation of a definite integral c standard fortran subroutine c double precision version c c parameters c on entry c f - double precision c function subprogram defining the integrand c function f(x). the actual name for f needs to be c declared e x t e r n a l in the driver program. c c a - double precision c lower limit of integration c c b - double precision c upper limit of integration c c npts2 - integer c number equal to two more than the number of c user-supplied break points within the integration c range, npts.ge.2. c if npts2.lt.2, the routine will end with ier = 6. c c points - double precision c vector of dimension npts2, the first (npts2-2) c elements of which are the user provided break c points. if these points do not constitute an c ascending sequence there will be an automatic c sorting. c c epsabs - double precision c absolute accuracy requested c epsrel - double precision c relative accuracy requested c if epsabs.le.0 c and epsrel.lt.max(50*rel.mach.acc.,0.5d-28), c the routine will end with ier = 6. c c on return c result - double precision c approximation to the integral c c abserr - double precision c estimate of the modulus of the absolute error, c which should equal or exceed abs(i-result) c c neval - integer c number of integrand evaluations c c ier - integer c ier = 0 normal and reliable termination of the c routine. it is assumed that the requested c accuracy has been achieved. c ier.gt.0 abnormal termination of the routine. c the estimates for integral and error are c less reliable. it is assumed that the c requested accuracy has not been achieved. c error messages c ier = 1 maximum number of subdivisions allowed c has been achieved. one can allow more c subdivisions by increasing the value of c limit (and taking the according dimension c adjustments into account). however, if c this yields no improvement it is advised c to analyze the integrand in order to c determine the integration difficulties. if c the position of a local difficulty can be c determined (i.e. singularity, c discontinuity within the interval), it c should be supplied to the routine as an c element of the vector points. if necessary c an appropriate special-purpose integrator c must be used, which is designed for c handling the type of difficulty involved. c = 2 the occurrence of roundoff error is c detected, which prevents the requested c tolerance from being achieved. c the error may be under-estimated. c = 3 extremely bad integrand behaviour occurs c at some points of the integration c interval. c = 4 the algorithm does not converge. c roundoff error is detected in the c extrapolation table. c it is presumed that the requested c tolerance cannot be achieved, and that c the returned result is the best which c can be obtained. c = 5 the integral is probably divergent, or c slowly convergent. it must be noted that c divergence can occur with any other value c of ier.gt.0. c = 6 the input is invalid because c npts2.lt.2 or c break points are specified outside c the integration range or c (epsabs.le.0 and c epsrel.lt.max(50*rel.mach.acc.,0.5d-28)) c result, abserr, neval, last are set to c zero. except when leniw or lenw or npts2 is c invalid, iwork(1), iwork(limit+1), c work(limit*2+1) and work(limit*3+1) c are set to zero. c work(1) is set to a and work(limit+1) c to b (where limit = (leniw-npts2)/2). c c dimensioning parameters c leniw - integer c dimensioning parameter for iwork c leniw determines limit = (leniw-npts2)/2, c which is the maximum number of subintervals in the c partition of the given integration interval (a,b), c leniw.ge.(3*npts2-2). c if leniw.lt.(3*npts2-2), the routine will end with c ier = 6. c c lenw - integer c dimensioning parameter for work c lenw must be at least leniw*2-npts2. c if lenw.lt.leniw*2-npts2, the routine will end c with ier = 6. c c last - integer c on return, last equals the number of subintervals c produced in the subdivision process, which c determines the number of significant elements c actually in the work arrays. c c work arrays c iwork - integer c vector of dimension at least leniw. on return, c the first k elements of which contain c pointers to the error estimates over the c subintervals, such that work(limit*3+iwork(1)),..., c work(limit*3+iwork(k)) form a decreasing c sequence, with k = last if last.le.(limit/2+2), and c k = limit+1-last otherwise c iwork(limit+1), ...,iwork(limit+last) contain the c subdivision levels of the subintervals, i.e. c if (aa,bb) is a subinterval of (p1,p2) c where p1 as well as p2 is a user-provided c break point or integration limit, then (aa,bb) has c level l if abs(bb-aa) = abs(p2-p1)*2**(-l), c iwork(limit*2+1), ..., iwork(limit*2+npts2) have c no significance for the user, c note that limit = (leniw-npts2)/2. c c work - double precision c vector of dimension at least lenw c on return c work(1), ..., work(last) contain the left c end points of the subintervals in the c partition of (a,b), c work(limit+1), ..., work(limit+last) contain c the right end points, c work(limit*2+1), ..., work(limit*2+last) contain c the integral approximations over the subintervals, c work(limit*3+1), ..., work(limit*3+last) c contain the corresponding error estimates, c work(limit*4+1), ..., work(limit*4+npts2) c contain the integration limits and the c break points sorted in an ascending sequence. c note that limit = (leniw-npts2)/2. c c***references (none) c***routines called dqagpe,xerror c***end prologue dqagp c double precision a,abserr,b,epsabs,epsrel,f,points,result,work integer ier,iwork,last,leniw,lenw,limit,lvl,l1,l2,l3,l4,neval, * npts2 c dimension iwork(leniw),points(npts2),work(lenw) c external f c c check validity of limit and lenw. c c***first executable statement dqagp ier = 6 neval = 0 last = 0 result = 0.0d+00 abserr = 0.0d+00 if(leniw.lt.(3*npts2-2).or.lenw.lt.(leniw*2-npts2).or.npts2.lt.2) * go to 10 c c prepare call for dqagpe. c limit = (leniw-npts2)/2 l1 = limit+1 l2 = limit+l1 l3 = limit+l2 l4 = limit+l3 c call dqagpe(f,a,b,npts2,points,epsabs,epsrel,limit,result,abserr, * neval,ier,work(1),work(l1),work(l2),work(l3),work(l4), * iwork(1),iwork(l1),iwork(l2),last) c c call error handler if necessary. c lvl = 0 10 if(ier.eq.6) lvl = 1 if(ier.ne.0) call xerror('abnormal return from dqagp',26,ier,lvl) return end
bsd-3-clause
jiangmi/DQMC_PAM_dilute
BLAS/dger.f
73
5709
*> \brief \b DGER * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE DGER(M,N,ALPHA,X,INCX,Y,INCY,A,LDA) * * .. Scalar Arguments .. * DOUBLE PRECISION ALPHA * INTEGER INCX,INCY,LDA,M,N * .. * .. Array Arguments .. * DOUBLE PRECISION A(LDA,*),X(*),Y(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DGER performs the rank 1 operation *> *> A := alpha*x*y**T + A, *> *> where alpha is a scalar, x is an m element vector, y is an n element *> vector and A is an m by n matrix. *> \endverbatim * * Arguments: * ========== * *> \param[in] M *> \verbatim *> M is INTEGER *> On entry, M specifies the number of rows of the matrix A. *> M must be at least zero. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> On entry, N specifies the number of columns of the matrix A. *> N must be at least zero. *> \endverbatim *> *> \param[in] ALPHA *> \verbatim *> ALPHA is DOUBLE PRECISION. *> On entry, ALPHA specifies the scalar alpha. *> \endverbatim *> *> \param[in] X *> \verbatim *> X is DOUBLE PRECISION array of dimension at least *> ( 1 + ( m - 1 )*abs( INCX ) ). *> Before entry, the incremented array X must contain the m *> element vector x. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> On entry, INCX specifies the increment for the elements of *> X. INCX must not be zero. *> \endverbatim *> *> \param[in] Y *> \verbatim *> Y is DOUBLE PRECISION array of dimension at least *> ( 1 + ( n - 1 )*abs( INCY ) ). *> Before entry, the incremented array Y must contain the n *> element vector y. *> \endverbatim *> *> \param[in] INCY *> \verbatim *> INCY is INTEGER *> On entry, INCY specifies the increment for the elements of *> Y. INCY must not be zero. *> \endverbatim *> *> \param[in,out] A *> \verbatim *> A is DOUBLE PRECISION array of DIMENSION ( LDA, n ). *> Before entry, the leading m by n part of the array A must *> contain the matrix of coefficients. On exit, A is *> overwritten by the updated matrix. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> On entry, LDA specifies the first dimension of A as declared *> in the calling (sub) program. LDA must be at least *> max( 1, m ). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup double_blas_level2 * *> \par Further Details: * ===================== *> *> \verbatim *> *> Level 2 Blas routine. *> *> -- Written on 22-October-1986. *> Jack Dongarra, Argonne National Lab. *> Jeremy Du Croz, Nag Central Office. *> Sven Hammarling, Nag Central Office. *> Richard Hanson, Sandia National Labs. *> \endverbatim *> * ===================================================================== SUBROUTINE DGER(M,N,ALPHA,X,INCX,Y,INCY,A,LDA) * * -- Reference BLAS level2 routine (version 3.4.0) -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION ALPHA INTEGER INCX,INCY,LDA,M,N * .. * .. Array Arguments .. DOUBLE PRECISION A(LDA,*),X(*),Y(*) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER (ZERO=0.0D+0) * .. * .. Local Scalars .. DOUBLE PRECISION TEMP INTEGER I,INFO,IX,J,JY,KX * .. * .. External Subroutines .. EXTERNAL XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX * .. * * Test the input parameters. * INFO = 0 IF (M.LT.0) THEN INFO = 1 ELSE IF (N.LT.0) THEN INFO = 2 ELSE IF (INCX.EQ.0) THEN INFO = 5 ELSE IF (INCY.EQ.0) THEN INFO = 7 ELSE IF (LDA.LT.MAX(1,M)) THEN INFO = 9 END IF IF (INFO.NE.0) THEN CALL XERBLA('DGER ',INFO) RETURN END IF * * Quick return if possible. * IF ((M.EQ.0) .OR. (N.EQ.0) .OR. (ALPHA.EQ.ZERO)) RETURN * * Start the operations. In this version the elements of A are * accessed sequentially with one pass through A. * IF (INCY.GT.0) THEN JY = 1 ELSE JY = 1 - (N-1)*INCY END IF IF (INCX.EQ.1) THEN DO 20 J = 1,N IF (Y(JY).NE.ZERO) THEN TEMP = ALPHA*Y(JY) DO 10 I = 1,M A(I,J) = A(I,J) + X(I)*TEMP 10 CONTINUE END IF JY = JY + INCY 20 CONTINUE ELSE IF (INCX.GT.0) THEN KX = 1 ELSE KX = 1 - (M-1)*INCX END IF DO 40 J = 1,N IF (Y(JY).NE.ZERO) THEN TEMP = ALPHA*Y(JY) IX = KX DO 30 I = 1,M A(I,J) = A(I,J) + X(IX)*TEMP IX = IX + INCX 30 CONTINUE END IF JY = JY + INCY 40 CONTINUE END IF * RETURN * * End of DGER . * END
bsd-2-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/common_errors_1.f90
193
1080
! { dg-do compile } ! Tests a number of error messages relating to derived type objects ! in common blocks. Originally due to PR 33198 subroutine one type a sequence integer :: i = 1 end type a type(a) :: t ! { dg-error "Derived type variable .t. in COMMON at ... may not have default initializer" } common /c/ t end subroutine first type a integer :: i integer :: j end type a type(a) :: t ! { dg-error "Derived type variable .t. in COMMON at ... has neither the SEQUENCE nor the BIND.C. attribute" } common /c/ t end subroutine prime type a sequence integer, allocatable :: i(:) integer :: j end type a type(a) :: t ! { dg-error "Derived type variable .t. in COMMON at ... has an ultimate component that is allocatable" } common /c/ t end subroutine source parameter(x=0.) ! { dg-error "COMMON block .x. at ... is used as PARAMETER at ..." } common /x/ i ! { dg-error "COMMON block .x. at ... is used as PARAMETER at ..." } intrinsic sin common /sin/ j ! { dg-error "COMMON block .sin. at ... is also an intrinsic procedure" } end subroutine source
gpl-2.0
richardotis/scipy
scipy/linalg/src/id_dist/src/idz_sfft.f
139
5011
c this file contains the following user-callable routines: c c c routine idz_sffti initializes routine idz_sfft. c c routine idz_sfft rapidly computes a subset of the entries c of the DFT of a vector, composed with permutation matrices c both on input and on output. c c routine idz_ldiv finds the greatest integer less than or equal c to a specified integer, that is divisible by another (larger) c specified integer. c c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c c c subroutine idz_ldiv(l,n,m) c c finds the greatest integer less than or equal to l c that divides n. c c input: c l -- integer at least as great as m c n -- integer divisible by m c c output: c m -- greatest integer less than or equal to l that divides n c implicit none integer n,l,m c c m = l c 1000 continue if(m*(n/m) .eq. n) goto 2000 c m = m-1 goto 1000 c 2000 continue c c return end c c c c subroutine idz_sffti(l,ind,n,wsave) c c initializes wsave for use with routine idz_sfft. c c input: c l -- number of entries in the output of idz_sfft to compute c ind -- indices of the entries in the output of idz_sfft c to compute c n -- length of the vector to be transformed c c output: c wsave -- array needed by routine idz_sfft for processing c implicit none integer l,ind(l),n,nblock,ii,m,idivm,imodm,i,j,k real*8 r1,twopi,fact complex*16 wsave(2*l+15+3*n),ci,twopii c ci = (0,1) r1 = 1 twopi = 2*4*atan(r1) twopii = twopi*ci c c c Determine the block lengths for the FFTs. c call idz_ldiv(l,n,nblock) m = n/nblock c c c Initialize wsave for use with routine zfftf. c call zffti(nblock,wsave) c c c Calculate the coefficients in the linear combinations c needed for the direct portion of the calculation. c fact = 1/sqrt(r1*n) c ii = 2*l+15 c do j = 1,l c i = ind(j) c idivm = (i-1)/m imodm = (i-1)-m*idivm c do k = 1,m wsave(ii+m*(j-1)+k) = exp(-twopii*imodm*(k-1)/(r1*m)) 1 * exp(-twopii*(k-1)*idivm/(r1*n)) * fact enddo ! k c enddo ! j c c return end c c c c subroutine idz_sfft(l,ind,n,wsave,v) c c computes a subset of the entries of the DFT of v, c composed with permutation matrices both on input and on output, c via a two-stage procedure (routine zfftf2 is supposed c to calculate the full vector from which idz_sfft returns c a subset of the entries, when zfftf2 has the same parameter c nblock as in the present routine). c c input: c l -- number of entries in the output to compute c ind -- indices of the entries of the output to compute c n -- length of v c v -- vector to be transformed c wsave -- processing array initialized by routine idz_sffti c c output: c v -- entries indexed by ind are given their appropriate c transformed values c c _N.B._: The user has to boost the memory allocations c for wsave (and change iii accordingly) if s/he wishes c to use strange sizes of n; it's best to stick to powers c of 2. c c references: c Sorensen and Burrus, "Efficient computation of the DFT with c only a subset of input or output points," c IEEE Transactions on Signal Processing, 41 (3): 1184-1200, c 1993. c Woolfe, Liberty, Rokhlin, Tygert, "A fast randomized algorithm c for the approximation of matrices," Applied and c Computational Harmonic Analysis, 25 (3): 335-366, 2008; c Section 3.3. c implicit none integer n,m,l,k,j,ind(l),i,idivm,nblock,ii,iii real*8 r1,twopi complex*16 v(n),wsave(2*l+15+3*n),ci,sum c ci = (0,1) r1 = 1 twopi = 2*4*atan(r1) c c c Determine the block lengths for the FFTs. c call idz_ldiv(l,n,nblock) c c m = n/nblock c c c FFT each block of length nblock of v. c do k = 1,m call zfftf(nblock,v(nblock*(k-1)+1),wsave) enddo ! k c c c Transpose v to obtain wsave(2*l+15+2*n+1 : 2*l+15+3*n). c iii = 2*l+15+2*n c do k = 1,m do j = 1,nblock wsave(iii+m*(j-1)+k) = v(nblock*(k-1)+j) enddo ! j enddo ! k c c c Directly calculate the desired entries of v. c ii = 2*l+15 iii = 2*l+15+2*n c do j = 1,l c i = ind(j) c idivm = (i-1)/m c sum = 0 c do k = 1,m sum = sum + wsave(ii+m*(j-1)+k) * wsave(iii+m*idivm+k) enddo ! k c v(i) = sum c enddo ! j c c return end
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/forall_15.f90
98
1046
! { dg-do run } ! { dg-options "-ffrontend-optimize -fdump-tree-original" } ! PR 50564 - this used to ICE with front end optimization. ! Original test case by Andrew Benson. program test implicit none double precision, dimension(2) :: timeSteps, control integer :: iTime double precision :: ratio double precision :: a ratio = 0.7d0 control(1) = ratio**(dble(1)-0.5d0)-ratio**(dble(1)-1.5d0) control(2) = ratio**(dble(2)-0.5d0)-ratio**(dble(2)-1.5d0) forall(iTime=1:2) timeSteps(iTime)=ratio**(dble(iTime)-0.5d0)-ratio**(dble(iTime)-1.5d0) end forall if (any(abs(timesteps - control) > 1d-10)) call abort ! Make sure we still do the front-end optimization after a forall a = cos(ratio)*cos(ratio) + sin(ratio)*sin(ratio) if (abs(a-1.d0) > 1d-10) call abort end program test ! { dg-final { scan-tree-dump-times "__builtin_cos" 1 "original" } } ! { dg-final { scan-tree-dump-times "__builtin_sin" 1 "original" } } ! { dg-final { cleanup-tree-dump "original" } }
gpl-2.0
aeklant/scipy
scipy/optimize/minpack/lmstr.f
38
15906
recursive *subroutine lmstr(fcn,m,n,x,fvec,fjac,ldfjac,ftol,xtol,gtol, * maxfev,diag,mode,factor,nprint,info,nfev,njev, * ipvt,qtf,wa1,wa2,wa3,wa4) integer m,n,ldfjac,maxfev,mode,nprint,info,nfev,njev integer ipvt(n) logical sing double precision ftol,xtol,gtol,factor double precision x(n),fvec(m),fjac(ldfjac,n),diag(n),qtf(n), * wa1(n),wa2(n),wa3(n),wa4(m) c ********** c c subroutine lmstr c c the purpose of lmstr is to minimize the sum of the squares of c m nonlinear functions in n variables by a modification of c the levenberg-marquardt algorithm which uses minimal storage. c the user must provide a subroutine which calculates the c functions and the rows of the jacobian. c c the subroutine statement is c c subroutine lmstr(fcn,m,n,x,fvec,fjac,ldfjac,ftol,xtol,gtol, c maxfev,diag,mode,factor,nprint,info,nfev, c njev,ipvt,qtf,wa1,wa2,wa3,wa4) c c where c c fcn is the name of the user-supplied subroutine which c calculates the functions and the rows of the jacobian. c fcn must be declared in an external statement in the c user calling program, and should be written as follows. c c subroutine fcn(m,n,x,fvec,fjrow,iflag) c integer m,n,iflag c double precision x(n),fvec(m),fjrow(n) c ---------- c if iflag = 1 calculate the functions at x and c return this vector in fvec. c if iflag = i calculate the (i-1)-st row of the c jacobian at x and return this vector in fjrow. c ---------- c return c end c c the value of iflag should not be changed by fcn unless c the user wants to terminate execution of lmstr. c in this case set iflag to a negative integer. c c m is a positive integer input variable set to the number c of functions. c c n is a positive integer input variable set to the number c of variables. n must not exceed m. c c x is an array of length n. on input x must contain c an initial estimate of the solution vector. on output x c contains the final estimate of the solution vector. c c fvec is an output array of length m which contains c the functions evaluated at the output x. c c fjac is an output n by n array. the upper triangle of fjac c contains an upper triangular matrix r such that c c t t t c p *(jac *jac)*p = r *r, c c where p is a permutation matrix and jac is the final c calculated jacobian. column j of p is column ipvt(j) c (see below) of the identity matrix. the lower triangular c part of fjac contains information generated during c the computation of r. c c ldfjac is a positive integer input variable not less than n c which specifies the leading dimension of the array fjac. c c ftol is a nonnegative input variable. termination c occurs when both the actual and predicted relative c reductions in the sum of squares are at most ftol. c therefore, ftol measures the relative error desired c in the sum of squares. c c xtol is a nonnegative input variable. termination c occurs when the relative error between two consecutive c iterates is at most xtol. therefore, xtol measures the c relative error desired in the approximate solution. c c gtol is a nonnegative input variable. termination c occurs when the cosine of the angle between fvec and c any column of the jacobian is at most gtol in absolute c value. therefore, gtol measures the orthogonality c desired between the function vector and the columns c of the jacobian. c c maxfev is a positive integer input variable. termination c occurs when the number of calls to fcn with iflag = 1 c has reached maxfev. c c diag is an array of length n. if mode = 1 (see c below), diag is internally set. if mode = 2, diag c must contain positive entries that serve as c multiplicative scale factors for the variables. c c mode is an integer input variable. if mode = 1, the c variables will be scaled internally. if mode = 2, c the scaling is specified by the input diag. other c values of mode are equivalent to mode = 1. c c factor is a positive input variable used in determining the c initial step bound. this bound is set to the product of c factor and the euclidean norm of diag*x if nonzero, or else c to factor itself. in most cases factor should lie in the c interval (.1,100.). 100. is a generally recommended value. c c nprint is an integer input variable that enables controlled c printing of iterates if it is positive. in this case, c fcn is called with iflag = 0 at the beginning of the first c iteration and every nprint iterations thereafter and c immediately prior to return, with x and fvec available c for printing. if nprint is not positive, no special calls c of fcn with iflag = 0 are made. c c info is an integer output variable. if the user has c terminated execution, info is set to the (negative) c value of iflag. see description of fcn. otherwise, c info is set as follows. c c info = 0 improper input parameters. c c info = 1 both actual and predicted relative reductions c in the sum of squares are at most ftol. c c info = 2 relative error between two consecutive iterates c is at most xtol. c c info = 3 conditions for info = 1 and info = 2 both hold. c c info = 4 the cosine of the angle between fvec and any c column of the jacobian is at most gtol in c absolute value. c c info = 5 number of calls to fcn with iflag = 1 has c reached maxfev. c c info = 6 ftol is too small. no further reduction in c the sum of squares is possible. c c info = 7 xtol is too small. no further improvement in c the approximate solution x is possible. c c info = 8 gtol is too small. fvec is orthogonal to the c columns of the jacobian to machine precision. c c nfev is an integer output variable set to the number of c calls to fcn with iflag = 1. c c njev is an integer output variable set to the number of c calls to fcn with iflag = 2. c c ipvt is an integer output array of length n. ipvt c defines a permutation matrix p such that jac*p = q*r, c where jac is the final calculated jacobian, q is c orthogonal (not stored), and r is upper triangular. c column j of p is column ipvt(j) of the identity matrix. c c qtf is an output array of length n which contains c the first n elements of the vector (q transpose)*fvec. c c wa1, wa2, and wa3 are work arrays of length n. c c wa4 is a work array of length m. c c subprograms called c c user-supplied ...... fcn c c minpack-supplied ... dpmpar,enorm,lmpar,qrfac,rwupdt c c fortran-supplied ... dabs,dmax1,dmin1,dsqrt,mod c c argonne national laboratory. minpack project. march 1980. c burton s. garbow, dudley v. goetschel, kenneth e. hillstrom, c jorge j. more c c ********** integer i,iflag,iter,j,l double precision actred,delta,dirder,epsmch,fnorm,fnorm1,gnorm, * one,par,pnorm,prered,p1,p5,p25,p75,p0001,ratio, * sum,temp,temp1,temp2,xnorm,zero double precision dpmpar,enorm data one,p1,p5,p25,p75,p0001,zero * /1.0d0,1.0d-1,5.0d-1,2.5d-1,7.5d-1,1.0d-4,0.0d0/ c c epsmch is the machine precision. c epsmch = dpmpar(1) c info = 0 iflag = 0 nfev = 0 njev = 0 c c check the input parameters for errors. c if (n .le. 0 .or. m .lt. n .or. ldfjac .lt. n * .or. ftol .lt. zero .or. xtol .lt. zero .or. gtol .lt. zero * .or. maxfev .le. 0 .or. factor .le. zero) go to 340 if (mode .ne. 2) go to 20 do 10 j = 1, n if (diag(j) .le. zero) go to 340 10 continue 20 continue c c evaluate the function at the starting point c and calculate its norm. c iflag = 1 call fcn(m,n,x,fvec,wa3,iflag) nfev = 1 if (iflag .lt. 0) go to 340 fnorm = enorm(m,fvec) c c initialize levenberg-marquardt parameter and iteration counter. c par = zero iter = 1 c c beginning of the outer loop. c 30 continue c c if requested, call fcn to enable printing of iterates. c if (nprint .le. 0) go to 40 iflag = 0 if (mod(iter-1,nprint) .eq. 0) call fcn(m,n,x,fvec,wa3,iflag) if (iflag .lt. 0) go to 340 40 continue c c compute the qr factorization of the jacobian matrix c calculated one row at a time, while simultaneously c forming (q transpose)*fvec and storing the first c n components in qtf. c do 60 j = 1, n qtf(j) = zero do 50 i = 1, n fjac(i,j) = zero 50 continue 60 continue iflag = 2 do 70 i = 1, m call fcn(m,n,x,fvec,wa3,iflag) if (iflag .lt. 0) go to 340 temp = fvec(i) call rwupdt(n,fjac,ldfjac,wa3,qtf,temp,wa1,wa2) iflag = iflag + 1 70 continue njev = njev + 1 c c if the jacobian is rank deficient, call qrfac to c reorder its columns and update the components of qtf. c sing = .false. do 80 j = 1, n if (fjac(j,j) .eq. zero) sing = .true. ipvt(j) = j wa2(j) = enorm(j,fjac(1,j)) 80 continue if (.not.sing) go to 130 call qrfac(n,n,fjac,ldfjac,.true.,ipvt,n,wa1,wa2,wa3) do 120 j = 1, n if (fjac(j,j) .eq. zero) go to 110 sum = zero do 90 i = j, n sum = sum + fjac(i,j)*qtf(i) 90 continue temp = -sum/fjac(j,j) do 100 i = j, n qtf(i) = qtf(i) + fjac(i,j)*temp 100 continue 110 continue fjac(j,j) = wa1(j) 120 continue 130 continue c c on the first iteration and if mode is 1, scale according c to the norms of the columns of the initial jacobian. c if (iter .ne. 1) go to 170 if (mode .eq. 2) go to 150 do 140 j = 1, n diag(j) = wa2(j) if (wa2(j) .eq. zero) diag(j) = one 140 continue 150 continue c c on the first iteration, calculate the norm of the scaled x c and initialize the step bound delta. c do 160 j = 1, n wa3(j) = diag(j)*x(j) 160 continue xnorm = enorm(n,wa3) delta = factor*xnorm if (delta .eq. zero) delta = factor 170 continue c c compute the norm of the scaled gradient. c gnorm = zero if (fnorm .eq. zero) go to 210 do 200 j = 1, n l = ipvt(j) if (wa2(l) .eq. zero) go to 190 sum = zero do 180 i = 1, j sum = sum + fjac(i,j)*(qtf(i)/fnorm) 180 continue gnorm = dmax1(gnorm,dabs(sum/wa2(l))) 190 continue 200 continue 210 continue c c test for convergence of the gradient norm. c if (gnorm .le. gtol) info = 4 if (info .ne. 0) go to 340 c c rescale if necessary. c if (mode .eq. 2) go to 230 do 220 j = 1, n diag(j) = dmax1(diag(j),wa2(j)) 220 continue 230 continue c c beginning of the inner loop. c 240 continue c c determine the levenberg-marquardt parameter. c call lmpar(n,fjac,ldfjac,ipvt,diag,qtf,delta,par,wa1,wa2, * wa3,wa4) c c store the direction p and x + p. calculate the norm of p. c do 250 j = 1, n wa1(j) = -wa1(j) wa2(j) = x(j) + wa1(j) wa3(j) = diag(j)*wa1(j) 250 continue pnorm = enorm(n,wa3) c c on the first iteration, adjust the initial step bound. c if (iter .eq. 1) delta = dmin1(delta,pnorm) c c evaluate the function at x + p and calculate its norm. c iflag = 1 call fcn(m,n,wa2,wa4,wa3,iflag) nfev = nfev + 1 if (iflag .lt. 0) go to 340 fnorm1 = enorm(m,wa4) c c compute the scaled actual reduction. c actred = -one if (p1*fnorm1 .lt. fnorm) actred = one - (fnorm1/fnorm)**2 c c compute the scaled predicted reduction and c the scaled directional derivative. c do 270 j = 1, n wa3(j) = zero l = ipvt(j) temp = wa1(l) do 260 i = 1, j wa3(i) = wa3(i) + fjac(i,j)*temp 260 continue 270 continue temp1 = enorm(n,wa3)/fnorm temp2 = (dsqrt(par)*pnorm)/fnorm prered = temp1**2 + temp2**2/p5 dirder = -(temp1**2 + temp2**2) c c compute the ratio of the actual to the predicted c reduction. c ratio = zero if (prered .ne. zero) ratio = actred/prered c c update the step bound. c if (ratio .gt. p25) go to 280 if (actred .ge. zero) temp = p5 if (actred .lt. zero) * temp = p5*dirder/(dirder + p5*actred) if (p1*fnorm1 .ge. fnorm .or. temp .lt. p1) temp = p1 delta = temp*dmin1(delta,pnorm/p1) par = par/temp go to 300 280 continue if (par .ne. zero .and. ratio .lt. p75) go to 290 delta = pnorm/p5 par = p5*par 290 continue 300 continue c c test for successful iteration. c if (ratio .lt. p0001) go to 330 c c successful iteration. update x, fvec, and their norms. c do 310 j = 1, n x(j) = wa2(j) wa2(j) = diag(j)*x(j) 310 continue do 320 i = 1, m fvec(i) = wa4(i) 320 continue xnorm = enorm(n,wa2) fnorm = fnorm1 iter = iter + 1 330 continue c c tests for convergence. c if (dabs(actred) .le. ftol .and. prered .le. ftol * .and. p5*ratio .le. one) info = 1 if (delta .le. xtol*xnorm) info = 2 if (dabs(actred) .le. ftol .and. prered .le. ftol * .and. p5*ratio .le. one .and. info .eq. 2) info = 3 if (info .ne. 0) go to 340 c c tests for termination and stringent tolerances. c if (nfev .ge. maxfev) info = 5 if (dabs(actred) .le. epsmch .and. prered .le. epsmch * .and. p5*ratio .le. one) info = 6 if (delta .le. epsmch*xnorm) info = 7 if (gnorm .le. epsmch) info = 8 if (info .ne. 0) go to 340 c c end of the inner loop. repeat if iteration unsuccessful. c if (ratio .lt. p0001) go to 240 c c end of the outer loop. c go to 30 340 continue c c termination, either normal or user imposed. c if (iflag .lt. 0) info = iflag iflag = 0 if (nprint .gt. 0) call fcn(m,n,x,fvec,wa3,iflag) return c c last card of subroutine lmstr. c end
bsd-3-clause
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/class_allocate_12.f90
155
2165
! { dg-do run } ! ! PR fortran/51972 ! ! Contributed by Damian Rouson ! module surrogate_module type ,abstract :: surrogate end type end module module strategy_module use surrogate_module type :: strategy end type end module module integrand_module use surrogate_module use strategy_module implicit none type ,abstract, extends(surrogate) :: integrand class(strategy), allocatable :: quadrature end type end module integrand_module module lorenz_module use strategy_module use integrand_module implicit none type ,extends(integrand) :: lorenz real, dimension(:), allocatable :: state contains procedure ,public :: assign => assign_lorenz end type contains type(lorenz) function constructor(initial_state, this_strategy) real ,dimension(:) ,intent(in) :: initial_state class(strategy) ,intent(in) :: this_strategy constructor%state=initial_state allocate (constructor%quadrature, source=this_strategy) end function subroutine assign_lorenz(lhs,rhs) class(lorenz) ,intent(inout) :: lhs class(integrand) ,intent(in) :: rhs select type(rhs) class is (lorenz) allocate (lhs%quadrature, source=rhs%quadrature) lhs%state=rhs%state end select end subroutine end module lorenz_module module runge_kutta_2nd_module use surrogate_module,only : surrogate use strategy_module ,only : strategy use integrand_module,only : integrand implicit none type, extends(strategy) ,public :: runge_kutta_2nd contains procedure, nopass :: integrate end type contains subroutine integrate(this) class(surrogate) ,intent(inout) :: this class(integrand) ,allocatable :: this_half select type (this) class is (integrand) allocate (this_half, source=this) end select end subroutine end module program main use lorenz_module use runge_kutta_2nd_module ,only : runge_kutta_2nd, integrate implicit none type(runge_kutta_2nd) :: timed_lorenz_integrator type(lorenz) :: attractor attractor = constructor( [1., 1., 1.] , timed_lorenz_integrator) call integrate(attractor) end program main
gpl-2.0
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/function_optimize_5.f90
99
1288
! { dg-do compile } ! { dg-options "-ffrontend-optimize -Wfunction-elimination" } ! Check the -ffrontend-optimize (in the absence of -O) and ! -Wfunction-elimination options. program main implicit none real, dimension(2,2) :: a, b, c, d integer :: i real :: x, z character(60) :: line real, external :: ext_func interface elemental function element(x) real, intent(in) :: x real :: elem end function element pure function mypure(x) real, intent(in) :: x integer :: mypure end function mypure elemental impure function elem_impure(x) real, intent(in) :: x real :: elem_impure end function elem_impure end interface data a /2., 3., 5., 7./ data b /11., 13., 17., 23./ write (unit=line, fmt='(4F7.2)') matmul(a,b) & ! { dg-warning "Removing call to function 'matmul'" } & + matmul(a,b) z = sin(x) + 2.0 + sin(x) ! { dg-warning "Removing call to function 'sin'" } print *,z x = ext_func(a) + 23 + ext_func(a) print *,d,x z = element(x) + element(x) ! { dg-warning "Removing call to function 'element'" } print *,z i = mypure(x) - mypure(x) ! { dg-warning "Removing call to function 'mypure'" } print *,i z = elem_impure(x) - elem_impure(x) print *,z end program main
gpl-2.0
Gjacquenot/HOS-ocean
sources/PostProcessing/read_files.f90
2
6086
MODULE read_files ! ! This module contains the input related routines ! Subroutines : read_3d ! read_modes ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! Copyright (C) 2014 - LHEEA Lab., Ecole Centrale de Nantes, UMR CNRS 6598 ! ! This program is part of HOS-ocean ! ! HOS-ocean is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! USE type USE variables_3d ! IMPLICIT NONE ! ! ! CONTAINS ! ! ! SUBROUTINE init_read_3d(filename,i_unit,tecplot,n1,n2,x,y,eta,phis,dt_out) ! ! Initialize data from 3D free surface file generated by HOS-ocean ! IMPLICIT NONE ! CHARACTER(LEN=*), INTENT(IN) :: filename INTEGER, INTENT(IN) :: tecplot,i_unit ! INTEGER, INTENT(OUT) :: n1,n2 REAL(RP), INTENT(OUT) :: dt_out ! REAL(RP), ALLOCATABLE, DIMENSION(:), INTENT(OUT) :: x,y REAL(RP), ALLOCATABLE, DIMENSION(:,:), INTENT(OUT) :: eta, phis ! ! Local variables CHARACTER(LEN=20) :: test CHARACTER(LEN=4) :: test2 REAL(RP) :: time INTEGER :: i1,i2 ! ! OPEN(i_unit,file=filename,status='unknown') ! Header of the file DO i1=1,n_hdr READ(i_unit,'(1A)') ENDDO ! ! Time = 0 ! IF (tecplot == 11) THEN READ(i_unit,103) test,time,test2,n1,test2,n2 ELSE PRINT*, 'This has to be done' STOP 1 ENDIF dt_out = time ! ! Allocate x and y vectors and eta, phis ALLOCATE(x(n1),y(n2),eta(n1,n2), phis(n1,n2)) ! DO i2=1,n2 DO i1=1,n1 READ(i_unit,102) x(i1), y(i2), eta(i1,i2), phis(i1,i2) ENDDO ENDDO ! ! Next time step to evaluate dt_out ! IF (tecplot == 11) THEN READ(i_unit,'(A,F9.2)') test, time BACKSPACE(i_unit) ! Going back to previous line ELSE PRINT*, 'This has to be done' STOP 1 ENDIF ! ! Define the time step of outputs in filename dt_out = time-dt_out ! 102 FORMAT(3(ES12.5,1X),ES12.5) 103 FORMAT(A,ES12.5,A,I5,A,I5) ! END SUBROUTINE init_read_3d ! ! ! SUBROUTINE read_3d(i_unit,tecplot,time_prev,time_cur,dt_out,n1,n2,eta,phis) ! ! Read a 3D free surface file generated by HOS-ocean ! IMPLICIT NONE ! !CHARACTER(LEN=*), INTENT(IN) :: filename REAL(RP), INTENT(IN) :: time_prev,time_cur, dt_out INTEGER, INTENT(IN) :: i_unit,tecplot,n1,n2 REAL(RP), DIMENSION(n1,n2), INTENT(OUT) :: eta, phis ! ! Local variables REAL(RP) :: time CHARACTER(LEN=20) :: test INTEGER :: i1,i2,istep,nstep,ios ! ! Check that time different from zero IF (time_cur < dt_out/2.d0) THEN PRINT*, 'The CALL to this routine is useless: init_read is sufficient' STOP 1 ENDIF ! IF (tecplot /= 11) THEN PRINT*, 'Other output formats that tecplot 11 have to be done' STOP 1 ENDIF ! nstep = NINT(time_cur/dt_out)-NINT(time_prev/dt_out) !NINT((time_cur-time_prev)/dt_out) ! DO istep = 1, nstep-1 READ(i_unit,'(1A)',IOSTAT=ios) IF (ios /= 0) THEN PRINT*, 'Time is larger than maximum time in: ', file_3d PRINT*, 'time max. = ', (istep-2)*dt_out STOP 1 ENDIF DO i2=1,n2 DO i1=1,n1 READ(i_unit,'(1A)') ENDDO ENDDO ENDDO ! ! The correct time step ! READ(i_unit,'(A,F9.2)') test,time PRINT*, 'time=',time ! DO i2=1,n2 DO i1=1,n1 READ(i_unit,104) eta(i1,i2), phis(i1,i2) ENDDO ENDDO ! 104 FORMAT((ES12.5,1X),ES12.5) ! END SUBROUTINE read_3d ! ! ! SUBROUTINE init_read_mod(filename,i_unit,n1,n2,dt_out,T_stop,xlen,ylen,depth,g,L,T) ! ! Initialize data from volumic mode description generated by HOS-ocean ! IMPLICIT NONE ! CHARACTER(LEN=*), INTENT(IN) :: filename INTEGER, INTENT(IN) :: i_unit ! INTEGER, INTENT(OUT) :: n1,n2 REAL(RP), INTENT(OUT) :: dt_out,T_stop,xlen,ylen,depth,g,L,T ! ! Local variables REAL(RP) :: x1, x2 ! ! We will look at first eight variables written on 18 characters OPEN(i_unit,file=filename,status='OLD', FORM='FORMATTED', ACCESS='DIRECT',RECL=18*10) READ(i_unit,'(10(ES17.10,1X))',REC=1) x1, x2, dt_out, T_stop, xlen, ylen, depth, g, L, T ! n1 = NINT(x1) n2 = NINT(x2) ! CLOSE(i_unit) ! END SUBROUTINE init_read_mod ! ! ! SUBROUTINE read_mod(filename,i_unit,time,dt_out,n1o2p1,n2,modesspecx,modesspecy,modesspecz,modesspect,modesFS,modesFSt) ! ! Initialize data from volumic mode description generated by HOS-ocean ! ! IMPLICIT NONE ! CHARACTER(LEN=*), INTENT(IN) :: filename INTEGER, INTENT(IN) :: i_unit, n1o2p1, n2 REAL(RP), INTENT(IN) :: time, dt_out ! COMPLEX(CP), INTENT(OUT), DIMENSION(n1o2p1,n2) :: modesspecx,modesspecy,modesspecz,modesspect,modesFS,modesFSt ! ! Local variables INTEGER :: i1, i2, it ! ! We read the specific records corresponding to time ! it = NINT(time/dt_out)+1 ! OPEN(i_unit,file=filename,status='OLD', FORM='FORMATTED', ACCESS='DIRECT',RECL=18*(2*n1o2p1)) ! DO i2=1,n2 READ(i_unit,'(5000(ES17.10,1X))',REC=((it)*n2*6)+1+6*(i2-1)) (modesspecx(i1,i2), i1=1,n1o2p1) READ(i_unit,'(5000(ES17.10,1X))',REC=((it)*n2*6)+2+6*(i2-1)) (modesspecy(i1,i2), i1=1,n1o2p1) READ(i_unit,'(5000(ES17.10,1X))',REC=((it)*n2*6)+3+6*(i2-1)) (modesspecz(i1,i2), i1=1,n1o2p1) READ(i_unit,'(5000(ES17.10,1X))',REC=((it)*n2*6)+4+6*(i2-1)) (modesspect(i1,i2), i1=1,n1o2p1) READ(i_unit,'(5000(ES17.10,1X))',REC=((it)*n2*6)+5+6*(i2-1)) (modesFS(i1,i2) , i1=1,n1o2p1) READ(i_unit,'(5000(ES17.10,1X))',REC=((it)*n2*6)+6+6*(i2-1)) (modesFSt(i1,i2) , i1=1,n1o2p1) ENDDO ! CLOSE(i_unit) ! END SUBROUTINE read_mod ! ! ! END MODULE read_files
gpl-3.0
richardotis/scipy
scipy/interpolate/fitpack/fpcoco.f
148
5210
subroutine fpcoco(iopt,m,x,y,w,v,s,nest,maxtr,maxbin,n,t,c,sq,sx, * bind,e,wrk,lwrk,iwrk,kwrk,ier) c ..scalar arguments.. real*8 s,sq integer iopt,m,nest,maxtr,maxbin,n,lwrk,kwrk,ier c ..array arguments.. integer iwrk(kwrk) real*8 x(m),y(m),w(m),v(m),t(nest),c(nest),sx(m),e(nest),wrk(lwrk) * logical bind(nest) c ..local scalars.. integer i,ia,ib,ic,iq,iu,iz,izz,i1,j,k,l,l1,m1,nmax,nr,n4,n6,n8, * ji,jib,jjb,jl,jr,ju,mb,nm real*8 sql,sqmax,term,tj,xi,half c ..subroutine references.. c fpcosp,fpbspl,fpadno,fpdeno,fpseno,fpfrno c .. c set constant half = 0.5e0 c determine the maximal admissible number of knots. nmax = m+4 c the initial choice of knots depends on the value of iopt. c if iopt=0 the program starts with the minimal number of knots c so that can be guarantied that the concavity/convexity constraints c will be satisfied. c if iopt = 1 the program will continue from the point on where she c left at the foregoing call. if(iopt.gt.0) go to 80 c find the minimal number of knots. c a knot is located at the data point x(i), i=2,3,...m-1 if c 1) v(i) ^= 0 and c 2) v(i)*v(i-1) <= 0 or v(i)*v(i+1) <= 0. m1 = m-1 n = 4 do 20 i=2,m1 if(v(i).eq.0. .or. (v(i)*v(i-1).gt.0. .and. * v(i)*v(i+1).gt.0.)) go to 20 n = n+1 c test whether the required storage space exceeds the available one. if(n+4.gt.nest) go to 200 t(n) = x(i) 20 continue c find the position of the knots t(1),...t(4) and t(n-3),...t(n) which c are needed for the b-spline representation of s(x). do 30 i=1,4 t(i) = x(1) n = n+1 t(n) = x(m) 30 continue c test whether the minimum number of knots exceeds the maximum number. if(n.gt.nmax) go to 210 c main loop for the different sets of knots. c find corresponding values e(j) to the knots t(j+3),j=1,2,...n-6 c e(j) will take the value -1,1, or 0 according to the requirement c that s(x) must be locally convex or concave at t(j+3) or that the c sign of s''(x) is unrestricted at that point. 40 i= 1 xi = x(1) j = 4 tj = t(4) n6 = n-6 do 70 l=1,n6 50 if(xi.eq.tj) go to 60 i = i+1 xi = x(i) go to 50 60 e(l) = v(i) j = j+1 tj = t(j) 70 continue c we partition the working space nm = n+maxbin mb = maxbin+1 ia = 1 ib = ia+4*n ic = ib+nm*maxbin iz = ic+n izz = iz+n iu = izz+n iq = iu+maxbin ji = 1 ju = ji+maxtr jl = ju+maxtr jr = jl+maxtr jjb = jr+maxtr jib = jjb+mb c given the set of knots t(j),j=1,2,...n, find the least-squares cubic c spline which satisfies the imposed concavity/convexity constraints. call fpcosp(m,x,y,w,n,t,e,maxtr,maxbin,c,sq,sx,bind,nm,mb,wrk(ia), * * wrk(ib),wrk(ic),wrk(iz),wrk(izz),wrk(iu),wrk(iq),iwrk(ji), * iwrk(ju),iwrk(jl),iwrk(jr),iwrk(jjb),iwrk(jib),ier) c if sq <= s or in case of abnormal exit from fpcosp, control is c repassed to the driver program. if(sq.le.s .or. ier.gt.0) go to 300 c calculate for each knot interval t(l-1) <= xi <= t(l) the c sum((wi*(yi-s(xi)))**2). c find the interval t(k-1) <= x <= t(k) for which this sum is maximal c on the condition that this interval contains at least one interior c data point x(nr) and that s(x) is not given there by a straight line. 80 sqmax = 0. sql = 0. l = 5 nr = 0 i1 = 1 n4 = n-4 do 110 i=1,m term = (w(i)*(sx(i)-y(i)))**2 if(x(i).lt.t(l) .or. l.gt.n4) go to 100 term = term*half sql = sql+term if(i-i1.le.1 .or. (bind(l-4).and.bind(l-3))) go to 90 if(sql.le.sqmax) go to 90 k = l sqmax = sql nr = i1+(i-i1)/2 90 l = l+1 i1 = i sql = 0. 100 sql = sql+term 110 continue if(m-i1.le.1 .or. (bind(l-4).and.bind(l-3))) go to 120 if(sql.le.sqmax) go to 120 k = l nr = i1+(m-i1)/2 c if no such interval is found, control is repassed to the driver c program (ier = -1). 120 if(nr.eq.0) go to 190 c if s(x) is given by the same straight line in two succeeding knot c intervals t(l-1) <= x <= t(l) and t(l) <= x <= t(l+1),delete t(l) n8 = n-8 l1 = 0 if(n8.le.0) go to 150 do 140 i=1,n8 if(.not. (bind(i).and.bind(i+1).and.bind(i+2))) go to 140 l = i+4-l1 if(k.gt.l) k = k-1 n = n-1 l1 = l1+1 do 130 j=l,n t(j) = t(j+1) 130 continue 140 continue c test whether we cannot further increase the number of knots. 150 if(n.eq.nmax) go to 180 if(n.eq.nest) go to 170 c locate an additional knot at the point x(nr). j = n do 160 i=k,n t(j+1) = t(j) j = j-1 160 continue t(k) = x(nr) n = n+1 c restart the computations with the new set of knots. go to 40 c error codes and messages. 170 ier = -3 go to 300 180 ier = -2 go to 300 190 ier = -1 go to 300 200 ier = 4 go to 300 210 ier = 5 300 return end
bsd-3-clause
MALBECC/lio
lioamber/faint_cpu/subm_int3lu.f90
3
8606
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! !%% INT3LU %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! ! 2e integral gradients, 3 indexes: density fitting functions and wavefunction.! ! Calculates Coulomb elements for the Fock matrix, and 2e energy. ! ! ! ! EXTERNAL INPUT: system information. ! ! · rho(M,M): density matrix. ! ! · Fmat(M,M): Fock matrix (Fock alpha in open shell). ! ! · Fmat_b(M,M): Fock beta matrix (ignored in closed shell). ! ! · Gmat(M,M): Coulomb G matrix. ! ! · Ginv(M,M): Inverted coulomb G matrix. ! ! · Hmat(M,M): 1e matrix elements. ! ! · open_shell: boolean indicating open-shell calculation. ! ! ! ! INTERNAL INPUT: basis set information. ! ! · M: number of basis functions (without contractions) ! ! · Md: number of auxiliary basis functions (without contractions) ! ! · af(Md): variational coefficient for auxiliary function i. ! ! · MEMO: indicates if cool/kkind/kknum are stored in memory. This is not ! ! used when performing analytic integrals in GPU. ! ! · cool: precalculated 2e terms in double precision. ! ! · kkind: precalculated indexes for double precision Fock matrix elements. ! ! · kknumd: number of precalculated double precision Fock matrix elements. ! ! · cools: precalculated 2e terms in single precision. ! ! · kkinds: precalculated indexes for single precision Fock matrix elements. ! ! · kknums: number of precalculated single precision Fock matrix elements. ! ! ! ! EXTERNAL OUTPUTS: ! ! · E2: 2e coulomb energy. ! ! ! ! Original and debugged (or supposed to): Dario Estrin Jul/1992 ! ! Refactored: Federico Pedron Sep/2018 ! !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! module subm_int3lu contains subroutine int3lu(E2, rho, Fmat_b, Fmat, Gmat, Ginv, Hmat, open_shell, memo) !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! ! Integrals subroutines - 2e integrals, 3 index ! ! Wavefunction and density fitting functions are calculated using the ! ! Obara-Saika recursive method. ! ! Inputs: G, F, standard basis and density basis. ! ! F should already have the 1e part, and here the Coulomb part is added without! ! storing the integrals separately. ! ! Output: F updated with Coulomb part, also Coulomb energy. ! !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%! use basis_data, only: M, Md, cool, cools, kkind, kkinds, kknumd, kknums, & af, MM, MMd implicit none logical , intent(in) :: open_shell, memo double precision, intent(in) :: rho(:), Gmat(:), Ginv(:), Hmat(:) double precision, intent(inout) :: E2, Fmat_b(:), Fmat(:) double precision, allocatable :: Rc(:), aux(:) double precision :: Ea, Eb, term integer :: ll(3), iikk, k_ind, kk_ind, m_ind ! 16 loops for all combinations - 1-2: for wavefunction basis, 3 for the ! density fitting. ! Rc(k) is constructed adding t(i,j,k)*P(i,j), and cf(k), the variationally ! obtained fitting coefficient, is obtained by adding R(i)*G-1(i,k) ! if t(i,j,k) is not stored, they should be calculated again in order to ! evaluate the corresponding part of the Fock matrix. ! V(i,j) is obtained by adding af(k_ind) * t(i,j,k). allocate(Rc(Md), aux(md)) Ea = 0.D0 ; Eb = 0.D0 MM=M*(M+1)/2 MMd=Md*(Md+1)/2 if (MEMO) then call g2g_timer_start('int3lu - start') do k_ind = 1, 3 Ll(k_ind) = k_ind * (k_ind-1) / 2 enddo do k_ind = 1, Md Rc(k_ind) = 0.D0 enddo do kk_ind = 1, kknumd iikk = (kk_ind - 1) * Md do k_ind = 1, Md Rc(k_ind) = Rc(k_ind) + rho(kkind(kk_ind)) * cool(iikk + k_ind) enddo enddo do kk_ind = 1, kknums iikk = (kk_ind - 1) * Md do k_ind = 1, Md Rc(k_ind) = Rc(k_ind) + rho(kkinds(kk_ind)) * cools(iikk + k_ind) enddo enddo ! Calculation of variational coefficients and fitting coefficients do m_ind = 1, Md af(m_ind) = 0.0D0 do k_ind = 1, m_ind-1 af(m_ind) = af(m_ind) + & Rc(k_ind) * Ginv(m_ind + (2*Md-k_ind)*(k_ind-1)/2) enddo do k_ind = m_ind, Md af(m_ind) = af(m_ind) + & Rc(k_ind) * Ginv(k_ind + (2*Md-m_ind)*(m_ind-1)/2) enddo enddo ! Initialization of Fock matrix elements do k_ind = 1, MM Fmat(k_ind) = Hmat(k_ind) enddo if (open_shell) then do k_ind = 1, MM Fmat_b(k_ind) = Hmat(k_ind) enddo endif do m_ind = 1, Md Ea = Ea + af(m_ind) * Rc(m_ind) do k_ind = 1, m_ind Eb = Eb + af(k_ind) * af(m_ind) * & Gmat(m_ind + (2*Md-k_ind)*(k_ind-1)/2) enddo do k_ind = m_ind+1, Md Eb = Eb + af(k_ind) * af(m_ind) * & Gmat(k_ind + (2*Md-m_ind)*(m_ind-1)/2) enddo enddo ! Calculation of all integrals again, in order to build the Fock matrix. aux = 0.0D0 if (open_shell) then do k_ind = 1, Md aux(k_ind) = af(k_ind) enddo endif call g2g_timer_stop('int3lu - start') call g2g_timer_start('int3lu') if (open_shell) then do kk_ind = 1, kknumd iikk = (kk_ind - 1) * Md do k_ind = 1, Md Fmat(kkind(kk_ind)) = Fmat(kkind(kk_ind)) + & af(k_ind) * cool(iikk + k_ind) Fmat_b(kkind(kk_ind)) = Fmat_b(kkind(kk_ind)) + & aux(k_ind) * cool(iikk + k_ind) enddo enddo do kk_ind = 1, kknums iikk = (kk_ind - 1) * Md do k_ind = 1, Md Fmat(kkinds(kk_ind)) = Fmat(kkinds(kk_ind)) + & af(k_ind) * cools(iikk + k_ind) Fmat_b(kkinds(kk_ind)) = Fmat_b(kkinds(kk_ind)) + & aux(k_ind) * cools(iikk + k_ind) enddo enddo else do kk_ind = 1, kknumd iikk = (kk_ind - 1) * Md term = 0.0D0 do k_ind = 1, Md term = term + af(k_ind) * cool(iikk + k_ind) enddo Fmat(kkind(kk_ind)) = Fmat(kkind(kk_ind)) + term enddo do kk_ind = 1, kknums iikk = (kk_ind - 1) * Md term = 0.0D0 do k_ind = 1, Md term = term + af(k_ind) * cools(iikk + k_ind) enddo Fmat(kkinds(kk_ind)) = Fmat(kkinds(kk_ind)) + term enddo endif call g2g_timer_stop('int3lu') else do k_ind = 1, MM Fmat(k_ind) = Hmat(k_ind) if (open_shell) Fmat_b(k_ind) = Hmat(k_ind) enddo call aint_coulomb_fock(Ea) do m_ind = 1, Md do k_ind = 1, m_ind Eb = Eb + af(k_ind) * af(m_ind) * & Gmat(m_ind + (2*Md-k_ind)*(k_ind-1)/2) enddo do k_ind = m_ind+1, Md Eb = Eb + af(k_ind) * af(m_ind) * & Gmat(k_ind + (2*Md-m_ind)*(m_ind-1)/2) enddo enddo endif E2 = Ea - Eb / 2.D0 deallocate(Rc, aux) return end subroutine int3lu end module subm_int3lu !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%!
gpl-2.0
fercook/ForMPS
constants.f90
1
3639
!! Copyright 2010 Fernando M. Cucchietti ! ! This file is part of FortranMPS ! ! FortranMPS is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! FortranMPS is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with Foobar. If not, see <http://www.gnu.org/licenses/>. module Constants complex(8), parameter :: II=(0.0d0,1.0d0) complex(8), parameter :: one=(1.0d0,0.0d0) complex(8), parameter :: zero=(0.0d0,0.0d0) real(8),parameter :: Pi=3.141592653589793 integer, parameter :: integerOne=1 integer, parameter :: integerZero=0 integer,parameter :: SpinDimension=0 integer,parameter :: FirstDimension=1 integer,parameter :: SecondDimension=2 integer,parameter :: ThirdDimension=3 integer,parameter :: FourthDimension=4 integer,parameter :: FifthDimension=5 integer,parameter :: SixthDimension=6 integer,parameter,dimension(1) :: First = [1] integer,parameter,dimension(1) :: Second = [2] integer,parameter,dimension(1) :: Third = [3] integer,parameter,dimension(1) :: Fourth = [4] integer,parameter,dimension(1) :: Fifth = [5] integer,parameter,dimension(1) :: Sixth = [6] integer,parameter,dimension(2) :: FirstAndSecond = [1,2] integer,parameter,dimension(2) :: FirstAndThird = [1,3] integer,parameter,dimension(2) :: SecondAndFirst = [2,1] integer,parameter,dimension(2) :: SecondAndThird = [2,3] integer,parameter,dimension(2) :: ThirdAndSecond = [3,2] integer,parameter,dimension(2) :: ThirdAndFirst = [3,1] integer,parameter,dimension(2) :: FirstAndFourth = [1,4] integer,parameter,dimension(2) :: SecondAndFourth = [2,4] integer,parameter,dimension(2) :: ThirdAndFourth = [3,4] integer,parameter,dimension(2) :: FourthAndFirst = [4,1] integer,parameter,dimension(2) :: FourthAndSecond = [4,2] integer,parameter,dimension(2) :: FourthAndThird = [4,3] enum,bind(C) enumerator :: NOWHERE,LEFT, RIGHT, UP, DOWN end enum enum,bind(C) enumerator :: HORIZONTAL,VERTICAL end enum integer,parameter :: No = 0 integer,parameter :: Yes = 1 integer,parameter :: DONOTCONJUGATE=NO integer,parameter :: UNDEFINED = -999 integer,parameter :: ALLTENSORS = 1313789 integer,parameter :: NOLIMIT = 9999999 logical,parameter :: Verbose = .true. logical,parameter :: Debug = .true. interface operator (.equalvector.) module procedure AreIntVectorsEqual end interface contains logical function AreIntVectorsEqual(vector1,vector2) result(AreEqual) integer,intent(IN) :: vector1(:),vector2(:) integer n if(size(vector1).eq.size(vector2)) then AreEqual=.true. do n=1,size(vector1) AreEqual=AreEqual.and.(vector1(n).eq.vector2(n)) enddo else AreEqual=.false. endif end function integer function DirectionOppositeTo(aDirection) result(theOpposite) integer, intent(IN) :: aDirection select case (aDirection) case (UP) theOpposite=DOWN case (DOWN) theOpposite=UP case (LEFT) theOpposite=RIGHT case (RIGHT) theOpposite=LEFT end select end function DirectionOppositeTo end module Constants
gpl-3.0
iains/darwin-gcc-4-8
gcc/testsuite/gfortran.dg/init_flag_3.f90
164
1139
! { dg-do run } ! { dg-options "-finit-integer=-1 -finit-logical=false -finit-real=nan" } ! { dg-add-options ieee } ! { dg-skip-if "NaN not supported" { spu-*-* } { "*" } { "" } } program init_flag_3 call real_test call logical_test call int_test call complex_test end program init_flag_3 ! Test some initializations for both implicitly and ! explicitly declared local variables. subroutine real_test real r1 real r2(10) dimension r3(10,10) if (r1 .eq. r1) call abort if (r2(2) .eq. r2(2)) call abort if (r3(5,5) .eq. r3(5,5)) call abort if (r4 .eq. r4) call abort end subroutine real_test subroutine logical_test logical l1 logical l2(2) if (l1 .neqv. .false.) call abort if (l2(2) .neqv. .false.) call abort end subroutine logical_test subroutine int_test integer i1 integer i2(10) dimension i3(10,10) if (i1 /= -1) call abort if (i2(2) /= -1) call abort if (i3(5,5) /= -1) call abort if (i4 /= -1) call abort end subroutine int_test subroutine complex_test complex c1 complex c2(20,20) if (c1 .eq. c1) call abort if (c2(1,1) .eq. c2(1,1)) call abort end subroutine complex_test
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/interface_16.f90
155
3123
! { dg-do compile } ! This tests the fix for PR32634, in which the generic interface ! in foo_pr_mod was given the original rather than the local name. ! This meant that the original name had to be used in the calll ! in foo_sub. ! ! Contributed by Salvatore Filippone <salvatore.filippone@uniroma2.it> module foo_base_mod type foo_dmt real(kind(1.d0)), allocatable :: rv(:) integer, allocatable :: iv1(:), iv2(:) end type foo_dmt type foo_zmt complex(kind(1.d0)), allocatable :: rv(:) integer, allocatable :: iv1(:), iv2(:) end type foo_zmt type foo_cdt integer, allocatable :: md(:) integer, allocatable :: hi(:), ei(:) end type foo_cdt end module foo_base_mod module bar_prt use foo_base_mod, only : foo_dmt, foo_zmt, foo_cdt type bar_dbprt type(foo_dmt), allocatable :: av(:) real(kind(1.d0)), allocatable :: d(:) type(foo_cdt) :: cd end type bar_dbprt type bar_dprt type(bar_dbprt), allocatable :: bpv(:) end type bar_dprt type bar_zbprt type(foo_zmt), allocatable :: av(:) complex(kind(1.d0)), allocatable :: d(:) type(foo_cdt) :: cd end type bar_zbprt type bar_zprt type(bar_zbprt), allocatable :: bpv(:) end type bar_zprt end module bar_prt module bar_pr_mod use bar_prt interface bar_pwrk subroutine bar_dppwrk(pr,x,y,cd,info,trans,work) use foo_base_mod use bar_prt type(foo_cdt),intent(in) :: cd type(bar_dprt), intent(in) :: pr real(kind(0.d0)),intent(inout) :: x(:), y(:) integer, intent(out) :: info character(len=1), optional :: trans real(kind(0.d0)),intent(inout), optional, target :: work(:) end subroutine bar_dppwrk subroutine bar_zppwrk(pr,x,y,cd,info,trans,work) use foo_base_mod use bar_prt type(foo_cdt),intent(in) :: cd type(bar_zprt), intent(in) :: pr complex(kind(0.d0)),intent(inout) :: x(:), y(:) integer, intent(out) :: info character(len=1), optional :: trans complex(kind(0.d0)),intent(inout), optional, target :: work(:) end subroutine bar_zppwrk end interface end module bar_pr_mod module foo_pr_mod use bar_prt, & & foo_dbprt => bar_dbprt,& & foo_zbprt => bar_zbprt,& & foo_dprt => bar_dprt,& & foo_zprt => bar_zprt use bar_pr_mod, & & foo_pwrk => bar_pwrk end module foo_pr_mod Subroutine foo_sub(a,pr,b,x,eps,cd,info) use foo_base_mod use foo_pr_mod Implicit None !!$ parameters Type(foo_dmt), Intent(in) :: a Type(foo_dprt), Intent(in) :: pr Type(foo_cdt), Intent(in) :: cd Real(Kind(1.d0)), Intent(in) :: b(:) Real(Kind(1.d0)), Intent(inout) :: x(:) Real(Kind(1.d0)), Intent(in) :: eps integer, intent(out) :: info !!$ Local data Real(Kind(1.d0)), allocatable, target :: aux(:),wwrk(:,:) Real(Kind(1.d0)), allocatable :: p(:), f(:) info = 0 Call foo_pwrk(pr,p,f,cd,info,work=aux) ! This worked if bar_pwrk was called! return End Subroutine foo_sub
gpl-2.0
remkos/rads4
src/rads.f90
1
168901
!****h* module/rads ! SUMMARY ! RADS main module ! ! SYNOPSIS module rads use typesizes use rads_grid, only: grid ! * Parameters ! Dimensions integer(fourbyteint), parameter :: rads_var_chunk = 100, rads_varl = 40, & rads_naml = 160, rads_cmdl = 320, rads_strl = 1600, rads_hstl = 3200, & rads_cyclistl = 50, rads_optl = 50, rads_max_branches = 5 ! RADS4 data types integer(fourbyteint), parameter :: rads_type_other = 0, rads_type_sla = 1, & rads_type_flagmasks = 2, rads_type_flagvalues = 3, rads_type_time = 11, & rads_type_lat = 12, rads_type_lon = 13, rads_type_dim = 14 ! RADS4 data sources integer(fourbyteint), parameter :: rads_src_none = 0, rads_src_nc_var = 10, & rads_src_nc_att = 11, rads_src_math = 20, rads_src_grid_lininter = 30, & rads_src_grid_splinter = 31, rads_src_grid_query = 32, & rads_src_constant = 40, rads_src_flags = 50, rads_src_tpj = 60 ! RADS4 warnings integer(fourbyteint), parameter :: rads_warn_nc_file = -3 ! RADS4 errors integer(fourbyteint), parameter :: rads_noerr = 0, & rads_err_nc_file = 1, rads_err_nc_parse = 2, rads_err_nc_close = 3, rads_err_memory = 4, & rads_err_var = 5, rads_err_source = 6, rads_err_nc_var = 7, rads_err_nc_get = 8, & rads_err_xml_parse = 9, rads_err_xml_file = 10, rads_err_alias = 11, rads_err_math = 12, & rads_err_cycle = 13, rads_err_nc_create = 14, rads_err_nc_put = 15, rads_err_nophase = 16 ! Additional RADS4 helpers character(len=1), parameter :: rads_linefeed = char(10), rads_tab = char(9), rads_noedit = '_' ! RADS3 errors or incompatibilities integer(fourbyteint), parameter :: rads_err_incompat = 101, rads_err_noinit = 102 integer(twobyteint), parameter :: rads_nofield = -1 ! Math constants real(eightbytereal), parameter :: pi = 3.1415926535897932d0, rad = pi/180d0 ! I/O parameters integer, parameter :: stderr = 0, stdin = 5, stdout = 6 ! * Variables ! I/O variables integer(fourbyteint), save :: rads_verbose = 0 ! Verbosity level integer(fourbyteint), save :: rads_log_unit = stdout ! Unit number for statistics logging ! * RADS4 variable structures type :: rads_varinfo ! Information on variable used by RADS character(len=rads_varl) :: name ! Short name of variable used by RADS character(len=rads_naml) :: long_name ! Long name (description) of variable character(len=rads_naml) :: standard_name ! Optional CF 'standard' name ('' if none) character(len=rads_naml) :: source ! Optional data source ('' if none) character(len=rads_naml) :: parameters ! Optional link to model parameters ('' if none) character(len=rads_strl) :: dataname ! Name associated with data (e.g. NetCDF var name) character(len=rads_cmdl) :: flag_meanings ! Optional meaning of flag values ('' if none) character(len=rads_cmdl) :: quality_flag ! Quality flag(s) associated with var ('' if none) character(len=rads_cmdl) :: comment ! Optional comment ('' if none) character(len=rads_varl) :: units ! Optional units of variable ('' if none) character(len=rads_varl) :: format ! Fortran format for output character(len=rads_varl) :: gridx, gridy ! RADS variable names of the grid x and y coords type(grid), pointer :: grid ! Pointer to grid (if data source is grid) real(eightbytereal) :: default ! Optional default value (Inf if not set) real(eightbytereal) :: limits(2) ! Lower and upper limit for editing real(eightbytereal) :: plot_range(2) ! Suggested range for plotting real(eightbytereal) :: add_offset, scale_factor ! Offset and scale factor in case of NetCDF real(eightbytereal) :: xmin, xmax, mean, sum2 ! Minimum, maximum, mean, sum squared deviation logical :: boz_format ! Format starts with B, O or Z. integer(fourbyteint) :: ndims ! Number of dimensions of variable integer(fourbyteint) :: brid ! Branch ID (default 1) integer(fourbyteint) :: nctype, varid ! NetCDF data type (nf90_int, etc.) and input var ID integer(fourbyteint) :: datatype ! Type of data (one of rads_type_*) integer(fourbyteint) :: datasrc ! Retrieval source (one of rads_src_*) integer(fourbyteint) :: cycle, pass ! Last processed cycle and pass integer(fourbyteint) :: selected, rejected ! Number of selected or rejected measurements endtype type :: rads_var ! Information on variable or alias character(len=rads_varl), pointer :: name ! Pointer to short name of variable (or alias) character(len=rads_naml), pointer :: long_name ! Pointer to long name (description) of variable type(rads_varinfo), pointer :: info, inf1, inf2 ! Links to structs of type(rads_varinfo) logical(twobyteint) :: noedit ! .true. if editing is suspended integer(twobyteint) :: field(2) ! RADS3 field numbers (rads_nofield = none) endtype type :: rads_cyclist ! List of cycles integer(fourbyteint) :: n, i ! Number of elements in list, additional value integer(fourbyteint) :: list(rads_cyclistl) ! List of values endtype type :: rads_phase ! Information about altimeter mission phase character(len=rads_varl) :: name, mission ! Name (1-letter), and mission description integer(fourbyteint) :: cycles(2), passes ! Cycle range and maximum number of passes real(eightbytereal) :: start_time, end_time ! Start time and end time of this phase real(eightbytereal) :: ref_time, ref_lon ! Time and lon of equator crossing of "ref. pass" integer(fourbyteint) :: ref_cycle, ref_pass ! Cycle and pass number of "reference pass" integer(fourbyteint) :: ref_orbit ! Absolute orbit nr of "reference pass" (at eq.) real(eightbytereal) :: pass_seconds ! Length of pass in seconds real(eightbytereal) :: repeat_days ! Length of repeat period in days real(eightbytereal) :: repeat_shift ! Eastward shift of track pattern per cycle for near repeats integer(fourbyteint) :: repeat_nodal ! Length of repeat period in nodal days integer(fourbyteint) :: repeat_passes ! Number of passes per repeat period type(rads_cyclist), pointer :: subcycles ! Subcycle definition (if requested) endtype type :: rads_sat ! Information on altimeter mission character(len=rads_naml) :: userroot ! Root directory of current user (i.e. $HOME) character(len=rads_naml) :: dataroot ! Root directory of RADS data (i.e. $RADSDATAROOT) character(len=rads_varl) :: branch(rads_max_branches) ! Name of optional branches character(len=rads_varl) :: spec ! Temporary holding space for satellite specs character(len=rads_cmdl) :: command ! Command line character(len=rads_naml), pointer :: glob_att(:) ! Global attributes character(len=8) :: satellite ! Satellite name real(eightbytereal) :: dt1hz ! "1 Hz" sampling interval real(eightbytereal) :: frequency(2) ! Frequency (GHz) of primary and secondary channel real(eightbytereal) :: inclination ! Satellite inclination (deg) real(eightbytereal) :: eqlonlim(0:1,2) ! Equator lon limits for asc. and desc. passes real(eightbytereal) :: centroid(3) ! Lon, lat, distance (in rad) selection criteria real(eightbytereal) :: xover_params(2) ! Crossover parameters used in radsxoconv integer(fourbyteint) :: cycles(3),passes(3) ! Cycle and pass limits and steps integer(fourbyteint) :: error ! Error code (positive = fatal, negative = warning) integer(fourbyteint) :: pass_stat(7) ! Stats of rejection at start of rads_open_pass integer(fourbyteint) :: total_read, total_inside ! Total nr of measurements read and inside region integer(fourbyteint) :: nvar, nsel ! Nr of available and selected vars and aliases logical :: n_hz_output ! Produce multi-Hz output character(len=2) :: sat ! 2-Letter satellite abbreviation integer(twobyteint) :: satid ! Numerical satellite identifier type(rads_cyclist), pointer :: excl_cycles ! Excluded cycles (if requested) type(rads_var), pointer :: var(:) ! List of available variables and aliases type(rads_var), pointer :: sel(:) ! List of selected variables and aliases type(rads_var), pointer :: time, lat, lon ! Pointers to time, lat, lon variables type(rads_phase), pointer :: phases(:) ! Definitions of all mission phases type(rads_phase), pointer :: phase ! Pointer to current phase endtype type :: rads_file ! Information on RADS data file integer(fourbyteint) :: ncid ! NetCDF ID of pass file character(len=rads_cmdl) :: name ! Name of the NetCDF pass file endtype type :: rads_pass ! Pass structure character(len=rads_strl) :: original ! Name of the original (GDR) pass file(s) character(len=rads_hstl), pointer :: history ! File creation history real(eightbytereal) :: equator_time, equator_lon ! Equator time and longitude real(eightbytereal) :: start_time, end_time ! Start and end time of pass real(eightbytereal), pointer :: tll(:,:) ! Time, lat, lon matrix integer(twobyteint), pointer :: flags(:) ! Array of engineering flags logical :: rw ! NetCDF file opened for read/write integer(fourbyteint) :: cycle, pass ! Cycle and pass number integer(fourbyteint) :: nlogs ! Number of RADS3 log entries integer(fourbyteint) :: ndata ! Number of data points (1-Hz) integer(fourbyteint) :: n_hz, n_wvf ! Size second/third dimension (0=none) integer(fourbyteint) :: first_meas, last_meas ! Index of first and last point in region integer(fourbyteint) :: time_dims ! Dimensions of time/lat/lon stored integer(fourbyteint) :: trkid ! Numerical track identifiers type (rads_file) :: fileinfo(rads_max_branches) ! File information for pass files type (rads_sat), pointer :: S ! Pointer to satellite/mission structure type (rads_pass), pointer :: next ! Pointer to next pass in linked list endtype type :: rads_option ! Information on command line options character(len=rads_varl) :: opt ! Option (without the - or --) character(len=rads_cmdl) :: arg ! Option argument integer :: id ! Identifier in form 10*nsat + i endtype ! These command line options can be accessed by RADS programs type(rads_option), allocatable, target, save :: & rads_opt(:) ! List of command line options integer(fourbyteint), save :: rads_nopt = 0 ! Number of command line options saved ! ! PURPOSE ! This module provides the main functionalities for the RADS4 software. ! To use any of the following subroutines and functions, add the following ! line in your Fortran 90 (or later) code: ! use rads !----------------------------------------------------------------------- ! COPYRIGHT ! Copyright (c) 2011-2020 Remko Scharroo ! See LICENSE.TXT file for copying and redistribution conditions. ! ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU Lesser General Public License as ! published by the Free Software Foundation, either version 3 of the ! License, or (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU Lesser General Public License for more details. !****------------------------------------------------------------------- real(eightbytereal), parameter, private :: nan = transfer ((/not(0_fourbyteint),not(0_fourbyteint)/),0d0) integer(onebyteint), parameter, private :: flag_values(0:15) = & int((/0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15/), onebyteint) integer(twobyteint), parameter, private :: flag_masks (0:15) = & int((/1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,-32768/),twobyteint) integer(fourbyteint), parameter, private :: id_sat = 1, id_xml = 2, id_alias = 3, id_misc = 4, id_var = 5 include 'config.f90' ! Some private variables to keep character(len=*), parameter, private :: default_short_optlist = 'S:X:vqV:C:P:A:F:R:L:Q:Z:', & default_long_optlist = ' t: h: args: sat: xml: debug: verbose log: quiet var: sel: cycle: pass: alias:' // & ' cmp: compress: fmt: format: lat: lon: time: sla: limits: opt: mjd: sec: ymd: doy: quality-flag: quality_flag: region:' character(len=rads_strl), save, private :: rads_optlist = default_short_optlist // default_long_optlist private :: rads_traxxing, rads_free_sat_struct, rads_free_pass_struct, rads_free_var_struct, rads_set_limits_by_flagmask !****f* rads/rads_init ! SUMMARY ! Initialize RADS4 ! ! SYNTAX ! subroutine rads_init (S, sat, xml) ! type(rads_sat), intent(inout) :: S <or> S(:) ! character(len=*), intent(in), optional :: sat <or> sat(:) ! character(len=*), intent(in), optional :: xml(:) ! ! PURPOSE ! This routine initializes the <S> struct with the information pertaining ! to given satellite/mission phase <sat>, which is to be formed as 'e1', ! or 'e1g', or 'e1/g'. If no phase is specified, all mission phases will be ! queried. ! ! The <S> and <sat> arguments can either a single element or an array. In the ! latter case, one <S> struct will be initialized for each <sat>. ! To parse command line options after this, use rads_parse_cmd. ! ! Only if the <sat> argument is omitted, then the routine will parse ! the command line for arguments in the form: ! --sat=<sat> --cycle=<lo>,<hi>,<step> --pass=<lo>,<hi>,<step> ! --lim:<var>=<lo>,<hi> --lat=<lo>,<hi> --lon=<lo>,<hi> --alias:<var>=<var> ! --opt:<value>=<value> --opt=<value>,... --fmt:<var>=<value> ! or their equivalents without the = or : separators after the long name, ! or their equivalents without the initial --, or the short options -S, -C, ! -P, -L, -F ! ! The routine will read the satellite/mission specific setup XML files and ! store all the information in the stuct <S>. The XML files polled are: ! $RADSDATAROOT/conf/rads.xml ! ~/.rads/rads.xml ! rads.xml ! <xml> (from the optional array of file names) ! ! If more than one -S option is given, then all further options following ! this argument until the next -S option, plus all options prior to the ! first -S option will pertain to this mission. ! ! Execution will be halted when the dimension of <S> is insufficient to ! store information of multiple missions, or when required XML files are ! missing. ! ! The verbosity level can be controlled by setting rads_verbose before ! calling this routine (default = 0). The output unit for log info can ! be controlled by setting rads_log_unit up front (default = stdout). ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! sat : (optional) Satellite/mission abbreviation ! xml : (optional) Array of names of additional XML files to be loaded !****------------------------------------------------------------------- private :: rads_init_sat_0d, rads_init_sat_1d, & rads_init_cmd_0d, rads_init_cmd_1d, rads_load_options, rads_parse_options interface rads_init module procedure rads_init_sat_0d module procedure rads_init_sat_1d module procedure rads_init_cmd_0d module procedure rads_init_cmd_1d end interface rads_init !****f* rads/rads_end ! SUMMARY ! End RADS4 ! ! SYNTAX ! subroutine rads_end (S) ! type(rads_sat), intent(inout) :: S <or> S(:) ! ! PURPOSE ! This routine ends RADS by freeing up all <S> space and other allocated ! global arrays. ! ! ARGUMENT ! S : Satellite/mission dependent struct or array of structs !****------------------------------------------------------------------- private :: rads_end_0d, rads_end_1d interface rads_end module procedure rads_end_0d module procedure rads_end_1d end interface rads_end !****f* rads/rads_get_var ! SUMMARY ! Read variable (data) from RADS4 file ! ! SYNTAX ! recursive subroutine rads_get_var (S, P, var, data, noedit) ! type(rads_sat), intent(inout) :: S ! type(rads_pass), intent(inout) :: P ! character(len=*) :: var ! <or> integer(fourbyteint) :: var ! <or> type(rads_var), intent(in) :: var ! real(eightbytereal), intent(out) :: data(:) ! logical, intent(in), optional :: noedit ! ! PURPOSE ! This routine loads the data from a single variable <var> into the ! buffer <data>. This command must be preceeded by <rads_open_pass>. ! The variable <var> can be addressed as a variable name, a RADS3-type ! field number or a varlist item. ! ! The array <data> must be at the correct size to contain the entire ! pass of data, i.e., it must have the dimension P%ndata. ! If no data are available and no default value and no secondary aliases ! then NaN is returned in the array <data>. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass dependent structure ! var : (string) Name of the variable to be read. ! If <var> ends with % editing is skipped. ! (integer) Field number. ! (type(rads_var)) Variable struct (e.g. S%sel(i)) ! data : Data returned by this routine ! noedit : (optional) Set to .true. to skip editing on limits and/or ! quality flags; set to .false. to allow editing (default) ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var, rads_err_memory, rads_err_source !****------------------------------------------------------------------- private :: rads_get_var_by_name, rads_get_var_by_var, rads_get_var_by_number, & rads_get_var_by_name_2d, rads_get_var_helper, rads_get_var_common interface rads_get_var module procedure rads_get_var_by_name module procedure rads_get_var_by_var module procedure rads_get_var_by_number module procedure rads_get_var_by_name_2d end interface rads_get_var !****if* rads/rads_def_var ! SUMMARY ! Define variable(s) to be written to RADS data file ! ! SYNTAX ! subroutine rads_def_var (S, P, var, nctype, scale_factor, add_offset, ndims, varid) ! type(rads_sat), intent(inout) :: S ! type(rads_pass), intent(inout) :: P ! type(rads_var), intent(in) :: var <or> var(:) ! <or> character(len=*), intent(in) :: var ! integer(fourbyteint), intent(in), optional :: nctype, ndims ! real(eightbytereal), intent(in), optional :: scale_factor, add_offset ! integer(fourbyteint), intent(out), optional :: varid ! ! PURPOSE ! This routine defines the variables to be written to a RADS data file by ! the reference to the variable struct of type(rads_var), or a ! number of variables referenced by an array of structures. ! This will create the NetCDF variable and its attributes in the file ! previously opened with rads_create_pass or rads_open_pass. ! ! The optional arguments <nctype>, <scale_factor>, <add_offset>, <ndims> can ! be used to overrule those value in the <var%info> struct. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! var : Structure(s) of variable(s) of type(rads_var) or name of variable ! nctype : (optional) Data type in NetCDF file ! scale_factor : (optional) Value of the scale_factor attribute ! add_offset : (optional) Value of the add_offset attribute ! ndims : (optional) Number of dimensions of the variable ! varid : variable ID of created NetCDF variable ! ! ERROR CODE ! S%error : rads_noerr, rads_err_nc_var !****------------------------------------------------------------------- private :: rads_def_var_by_var_0d, rads_def_var_by_var_1d, rads_def_var_by_name interface rads_def_var module procedure rads_def_var_by_var_0d module procedure rads_def_var_by_var_1d module procedure rads_def_var_by_name end interface rads_def_var !****if* rads/rads_put_var ! SUMMARY ! Write data for variable to RADS file ! ! SYNTAX ! subroutine rads_put_var (S, P, var, data, start) ! use netcdf ! use rads_netcdf ! use rads_misc ! type(rads_sat), intent(inout) :: S ! type(rads_pass), intent(inout) :: P ! type(rads_var), intent(in) :: var <or> ! character(len=*), intent(in) :: varname ! real(eightbytereal), intent(in) :: data(:) <or> data(:,:) ! integer(fourbyteint), optional, intent(in) :: start(:) ! ! PURPOSE ! This routine writes the data array <data> for the variable <var> ! (referenced by the structure of type(rads_var)) to the NetCDF file ! previously opened with rads_create_pass or rads_open_pass. ! Alternatively, the variable can be referenced by name <varname>. ! ! The data in <data> are in the original SI units (like [m] or [s]) ! and will be converted to the internal units based on the values of ! <var%info%nctype>, <var%info%scale_factor>, <var%info%add_offset>. ! ! The argument <start> can be added to indicate an offset ! for storing the data from the first available position in the file. ! For example: start=101 first skips 100 records. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! var : Structure of variable of type(rads_var) ! data : Data to be written (in original (SI) units) ! start : Position of the first data point in the file ! ! ERROR CODE ! S%error : rads_noerr, rads_err_nc_put !****------------------------------------------------------------------- private :: rads_put_var_helper, & rads_put_var_by_var_0d, rads_put_var_by_name_0d, & rads_put_var_by_var_1d, rads_put_var_by_var_1d_start, rads_put_var_by_name_1d, & rads_put_var_by_var_2d, rads_put_var_by_var_2d_start, rads_put_var_by_name_2d, & rads_put_var_by_var_3d, rads_put_var_by_var_3d_start, rads_put_var_by_name_3d interface rads_put_var module procedure rads_put_var_by_var_0d module procedure rads_put_var_by_name_0d module procedure rads_put_var_by_var_1d module procedure rads_put_var_by_var_1d_start module procedure rads_put_var_by_name_1d module procedure rads_put_var_by_var_2d module procedure rads_put_var_by_var_2d_start module procedure rads_put_var_by_name_2d module procedure rads_put_var_by_var_3d module procedure rads_put_var_by_var_3d_start module procedure rads_put_var_by_name_3d end interface rads_put_var !****f* rads/rads_stat ! SUMMARY ! Print the RADS statistics for a given satellite ! ! SYNTAX ! subroutine rads_stat (S) ! type(rads_sat), intent(in) :: S <or> S(:) ! integer(fourbyteint), intent(in), optional :: unit ! ! PURPOSE ! This routine prints out the statistics of all variables that were ! processed per mission (indicated by scalar or array <S>), to the output ! on unit <rads_log_unit>. ! ! ARGUMENTS ! S : Satellite/mission dependent structure !****------------------------------------------------------------------- private :: rads_stat_0d, rads_stat_1d interface rads_stat module procedure rads_stat_0d module procedure rads_stat_1d end interface rads_stat !****if* rads/rads_parse_varlist ! SUMMARY ! Parse a string of variables ! ! SYNTAX ! subroutine rads_parse_varlist (S, string) ! type (rads_sat), intent(inout) :: S ! character(len=*), intent(in) :: string <or> string(:) ! ! PURPOSE ! Parse the string <string> of comma- or slash-separated names of variables. ! This will allocate the array S%sel and update counter S%nsel. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! string : String of variables ! ! ERROR CODE ! S%error : rads_err_var !****------------------------------------------------------------------- private :: rads_parse_varlist_0d, rads_parse_varlist_1d interface rads_parse_varlist module procedure rads_parse_varlist_0d module procedure rads_parse_varlist_1d end interface rads_parse_varlist !****if* rads/rads_set_phase ! SUMMARY ! Set the pointer to satellite phase info within the S struct ! ! SYNTAX ! subroutine rads_set_phase (S, name <or> cycle <or> time, error) ! type(rads_sat), intent(inout) :: S ! character(len=*), intent(in) :: name <or> ! integer(fourbyteint), intent(in) :: cycle <or> ! real(eightbytereal), intent(in) :: time ! logical, optional, intent(out) :: error ! ! PURPOSE ! Set the pointer <S%phase> to the proper phase definitions for the mission ! phase. The selection of the phase can be done by phase name <name>, ! cycle number <cycle> or time <time>. ! ! In matching the phase name with the database, only the first letter is ! used. However the path to the directory with NetCDF files will use the ! entire phase name. In case multiple phases have the same name, the first ! one will be pointed to. ! ! For efficiency, the routine first checks if the current phase is correct. ! ! If no matching phase can be found the outcome depends on the use of the ! optional argument <error>: ! - If <error> is present, then <error> will refurn .true. (otherwise .false.) ! - If <error> is not present, the routine prints an error message and the ! calling program stops. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! name : Name of phase ! cycle : Cycle number ! time : UTC time in seconds since 1985 !****------------------------------------------------------------------- private :: rads_set_phase_by_name, rads_set_phase_by_cycle, rads_set_phase_by_time interface rads_set_phase module procedure rads_set_phase_by_name module procedure rads_set_phase_by_cycle module procedure rads_set_phase_by_time end interface rads_set_phase contains !****if* rads/rads_init_sat_0d ! SUMMARY ! Initialize RADS4 by satellite ! ! SYNOPSIS subroutine rads_init_sat_0d (S, sat, xml) use rads_misc type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: sat character(len=*), intent(in), optional :: xml(:) ! ! PURPOSE ! This routine initializes the <S> struct with the information pertaining to satellite ! and mission phase <sat>, which is to be formed as 'e1', or 'e1g', or 'e1/g'. ! If no phase is specified, a default is assumed (usually 'a'). ! The routine will read the satellite and mission specific setup XML files and store ! all the information in the stuct <S>. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! sat : Satellite/mission abbreviation ! xml : Array of additional XML files to be loaded ! verbose : (optional) verbosity level (default = 0) ! ! ERROR CODE ! S%error : rads_noerr, rads_err_xml_file, rads_err_xml_parse, rads_err_var !****------------------------------------------------------------------- integer(fourbyteint) :: i, n logical, allocatable :: mask(:) call rads_init_sat_struct (S) ! Store satellite specification ! S%sat, S%branch, S%satellite will be populated/overwritten later by rads_read_xml ! S%spec will then be replaced by the phase name (if specified) if (len_trim(sat) < 2) call rads_exit ('Satellite/phase has fewer than 2 characters') S%spec = sat S%sat = sat(:2) S%satellite = S%sat ! Set some global variables S%dataroot = radsdataroot call checkenv ('RADSDATAROOT',S%dataroot) call checkenv ('HOME',S%userroot) call get_command (S%command, status=i) if (i < 0) S%command (len(S%command)-2:) = '...' ! Set all values in <S> struct to default allocate (S%var(rads_var_chunk)) S%var = rads_var (null(), null(), null(), null(), null(), .false., rads_nofield) ! Read the global rads.xml setup file, the one in ~/.rads and the one in the current directory call rads_read_xml (S, trim(S%dataroot)//'/conf/rads.xml') if (S%error == rads_err_xml_file) call rads_exit ('Required XML file '//trim(S%dataroot)//'/conf/rads.xml does not exist') call rads_read_xml (S, trim(S%userroot)//'/.rads/rads.xml') if (index(S%command, 'radsreconfig') > 0) return ! Premature bailing from here in radsreconfig call rads_read_xml (S, 'rads.xml') ! Now read the xml files specified on the command line, or the xml argument. ! If it is not an absolute path name, also look for it in $RADSDATAROOT/conf as well as in $HOME/.rads if (present(xml)) then do i = 1,size(xml) call rads_read_xml (S, xml(i)) if (S%error /= rads_err_xml_file) cycle if (xml(i)(1:1) == '/') call rads_exit ('Requested XML file '//trim(xml(i))//' does not exist') call rads_read_xml (S, trim(S%dataroot)//'/conf/'//xml(i)) if (S%error /= rads_err_xml_file) cycle call rads_read_xml (S, trim(S%userroot)//'/.rads/'//xml(i)) if (S%error /= rads_err_xml_file) cycle call rads_message ('Requested XML file '//trim(xml(i))//' does not exist in current directory,') call rads_exit ('nor in '//trim(S%dataroot)//'/conf, nor in '//trim(S%userroot)//'/.rads') enddo endif ! If no phases are defined, then the satellite is not known if (.not.associated(S%phases)) call rads_exit ('Satellite "'//S%sat//'" unknown') ! When NaN, set end time of a phase to the start time of the next phase ! When a phase contains only one cycle, compute the maximum pass number n = size(S%phases) do i = 1,n-1 if (isnan_(S%phases(i)%end_time)) S%phases(i)%end_time = S%phases(i+1)%start_time if (S%phases(i)%cycles(1) == S%phases(i)%cycles(2)) & S%phases(i)%passes = S%phases(i)%ref_pass + 2 * (S%phases(i+1)%ref_orbit-S%phases(i)%ref_orbit) - 1 enddo if (isnan_(S%phases(n)%end_time)) S%phases(n)%end_time = 2051222400d0 ! 2050-01-01 ! Default phase is the first mission phase S%phase => S%phases(1) ! When no phase/mission is specified: use the largest possible cycle and pass range ! When a phase/mission is specified: load the appropriate settings ! This can handle multiple "phase" specifications with the same name allocate (mask(size(S%phases))) mask = (S%spec == '' .or. S%phases%name(1:1) == S%spec(1:1)) if (S%spec /= '') call rads_set_phase (S, S%spec) S%cycles(1) = minval(S%phases%cycles(1), mask) S%cycles(2) = maxval(S%phases%cycles(2), mask) S%passes(2) = maxval(S%phases%passes, mask) deallocate (mask) ! Check if variables include the required <data> identifier do i = 1,S%nvar if (S%var(i)%info%dataname(:1) == ' ') then call rads_message ('Variable "'//trim(S%var(i)%name)// & '" has no data source specified; assuming NetCDF variable "'//trim(S%var(i)%name)//'"') S%var(i)%info%dataname = S%var(i)%name S%var(i)%info%datasrc = rads_src_nc_var endif enddo ! Link the time, lat, lon variables for later use S%time => rads_varptr (S, 'time') S%lat => rads_varptr (S, 'lat') S%lon => rads_varptr (S, 'lon') ! Limit cycles based on time range and compute equator longitude limits call rads_set_limits (S, 'time') call rads_set_limits (S, 'lon') ! List the variables if (rads_verbose >= 3) then do i = 1,S%nvar write (*,'(i3,1x,a,a,2i5,2f14.4)') i,S%var(i)%name,S%var(i)%info%name,S%var(i)%field,S%var(i)%info%limits enddo endif end subroutine rads_init_sat_0d subroutine rads_init_sat_1d (S, sat, xml) type(rads_sat), intent(inout) :: S(:) character(len=*), intent(in) :: sat(:) character(len=*), intent(in), optional :: xml(:) integer :: i if (size(S) /= size(sat)) call rads_exit ('Size of arguments "S" and "sat" in routine rads_init should be the same') if (size(S) < 1) call rads_exit ('Size of argument "S" in routine rads_init should be at least 1') do i = 1,size(S) call rads_init_sat_0d (S(i), sat(i), xml) enddo end subroutine rads_init_sat_1d subroutine rads_init_cmd_0d (S) type(rads_sat), intent(inout) :: S integer :: sopt(1), nsat ! call rads_load_options (nsat) if (nsat < 1) call rads_exit ('Failed to find any "-S" or "--sat" options on command line') if (nsat > 1) call rads_exit ('Too many "-S" or "--sat" options on command line') sopt = minloc (rads_opt%id, rads_opt%id==10+id_sat) ! Position of the first (only) -S option ! ! The next three pack functions isolate the -X option arguments, the command line ! arguments associcated with the -S option, and all -V option arguments. call rads_init_sat_0d (S, rads_opt(sopt(1))%arg, & pack(rads_opt%arg, mod(rads_opt%id,10)==id_xml)) call rads_parse_options (S, pack(rads_opt, mod(rads_opt%id,10)==id_alias)) call rads_parse_options (S, pack(rads_opt, mod(rads_opt%id,10)==id_misc)) call rads_parse_varlist (S, pack(rads_opt%arg, mod(rads_opt%id,10)==id_var)) end subroutine rads_init_cmd_0d subroutine rads_init_cmd_1d (S) type(rads_sat), intent(inout) :: S(:) integer :: i, sopt(1), nsat ! call rads_load_options (nsat) if (nsat < 1) call rads_exit ('Failed to find any "-S" or "--sat" options on command line') if (nsat > size(S)) call rads_exit ('Too many "-S" or "--sat" options on command line') ! do i = 1,nsat sopt = minloc (rads_opt%id, rads_opt%id==i*10+id_sat) ! Position of i-th -S option ! The next three pack functions isolate the -X option arguments, the command line ! arguments associcated with the i-th -S option, and all -V option arguments. call rads_init_sat_0d (S(i), rads_opt(sopt(1))%arg, & pack(rads_opt%arg, rads_opt%id==id_xml .or. rads_opt%id==i*10+id_xml)) call rads_parse_options (S(i), pack(rads_opt, rads_opt%id==id_alias .or. rads_opt%id==i*10+id_alias)) call rads_parse_options (S(i), pack(rads_opt, rads_opt%id==id_misc .or. rads_opt%id==i*10+id_misc)) call rads_parse_varlist (S(i), pack(rads_opt%arg, mod(rads_opt%id,10)==id_var)) enddo ! ! Blank out the rest do i = nsat+1,size(S) call rads_init_sat_struct (S(i)) enddo end subroutine rads_init_cmd_1d !*****f* rads/rads_init_sat_struct ! SUMMARY ! Initialize empty rads_sat struct ! ! SYNOPSIS subroutine rads_init_sat_struct (S) type(rads_sat), intent(inout) :: S ! ! PURPOSE ! This routine initializes the <S> struct with the bare minimum. ! It is later updated in rads_init_sat_0d. ! ! ARGUMENTS ! S : Satellite/mission dependent structure !****------------------------------------------------------------------- ! gfortran 4.3.4 to 4.4.1 segfault on the next line if this routine is made pure or elemental, ! so please leave it as a normal routine. S = rads_sat ('', '', '', '', '', null(), '', 1d0, (/13.8d0, nan/), 90d0, nan, nan, nan, 1, 1, rads_noerr, & 0, 0, 0, 0, 0, .false., '', 0, null(), null(), null(), null(), null(), null(), null(), null()) end subroutine rads_init_sat_struct !****if* rads/rads_free_sat_struct ! SUMMARY ! Free all allocated memory from rads_sat struct and reinitialise ! ! SYNOPSIS subroutine rads_free_sat_struct (S) type(rads_sat), intent(inout) :: S ! ! PURPOSE ! This routine frees the <S> struct of type rads_sat and all allocated ! memory in it. It then reinitialises a clean struct. ! ! ARGUMENT ! S : Satellite/mission dependent structure !****------------------------------------------------------------------- integer(fourbyteint) :: i, ios if (S%sat == '') return do i = S%nvar,1,-1 call rads_free_var_struct (S, S%var(i), .false.) enddo do i = 1,size(S%phases) deallocate (S%phases(i)%subcycles, stat=ios) enddo deallocate (S%glob_att, S%var, S%sel, S%phases, S%excl_cycles, stat=ios) call rads_init_sat_struct (S) end subroutine rads_free_sat_struct !*****f* rads/rads_init_pass_struct ! SUMMARY ! Initialize empty rads_pass struct ! ! SYNOPSIS subroutine rads_init_pass_struct (S, P) type(rads_sat), target, intent(in) :: S type(rads_pass), intent(inout) :: P ! ! PURPOSE ! This routine initializes the <P> struct with the bare minimum. ! This is only really necessary prior to calling rads_create_pass. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass dependent structure !****------------------------------------------------------------------- ! gfortran 4.4.1 segfaults on the next line if this routine is made pure or elemental, ! so please leave it as a normal routine. P = rads_pass ('', null(), nan, nan, nan, nan, null(), null(), .false., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, & rads_file (0, ''), null(), null()) P%S => S end subroutine rads_init_pass_struct !****if* rads/rads_free_pass_struct ! SUMMARY ! Free all allocated memory from rads_pass struct and reinitialise ! ! SYNOPSIS subroutine rads_free_pass_struct (S, P) type(rads_sat), intent(in) :: S type(rads_pass), intent(inout) :: P ! ! PURPOSE ! This routine frees the <P> struct of type rads_pass. ! Afterwards the routine reinitialises a clean struct. ! ! ARGUMENT ! S : Satellite/mission dependent structure ! P : Pass dependent structure !****------------------------------------------------------------------- integer(fourbyteint) :: ios deallocate (P%history, P%flags, P%tll, stat=ios) call rads_init_pass_struct (S, P) end subroutine rads_free_pass_struct !****if* rads/rads_free_var_struct ! SUMMARY ! Free all allocated memory from rads_var struct ! ! SYNOPSIS pure subroutine rads_free_var_struct (S, var, alias) use rads_grid type(rads_sat), intent(inout) :: S type(rads_var), intent(inout) :: var logical, intent(in) :: alias ! ! PURPOSE ! This routine frees the <var> struct of type rads_var and all allocated ! memory in it. Use alias = .true. when called from rads_set_alias, so ! that it prevents removing info structs used elsewhere. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! var : Variable struct to be freed ! alias : .true. if called to create alias !****------------------------------------------------------------------- integer(fourbyteint) :: i, n, ios type(rads_varinfo), pointer :: info info => var%info ! This is needed to make the associated () work later on if (.not.associated(var%info)) return if (alias .and. associated(var%name,info%name)) then ! This is an original variable. Do not alias it if it is used more than once n = 0 do i = 1,S%nvar if (associated(S%var(i)%info,var%info)) n = n + 1 if (associated(S%var(i)%info,var%inf1)) n = n + 1 if (associated(S%var(i)%info,var%inf2)) n = n + 1 enddo if (n > 1) then S%error = rads_err_alias return endif endif ! Unassociate or deallocate long_name if (associated(var%long_name,info%long_name)) then nullify (var%long_name) else deallocate (var%long_name, stat=ios) endif ! Unassociate or deallocate name and info struct if (associated(var%name,info%name)) then if (associated(var%info%grid)) call grid_free(var%info%grid) nullify (var%name) deallocate (var%info, stat=ios) else deallocate (var%name, stat=ios) nullify (var%info) endif ! Clean out rest of var nullify (var%inf1,var%inf2) end subroutine rads_free_var_struct !****f* rads/rads_set_options ! SUMMARY ! Specify the list of command specific options ! ! SYNPOSIS subroutine rads_set_options (optlist) character(len=*), intent(in), optional :: optlist ! ! PURPOSE ! Add the command specific options to the list of common RADS options. ! The argument <optlist> needs to have the same format as in the routine ! <getopt> in the <rads_misc> module. The short options will be placed ! before the common ones, the long options will be placed after them. ! ! ARGUMENT ! optlist : (optional) list of command specific short and long options !****------------------------------------------------------------------- integer :: i if (.not.present(optlist)) return ! Find first space in optlist i = index(optlist, ' ') ! Now merge it appropriately with default list if (i == 0) then ! Only short options specified in oplist rads_optlist = optlist // default_short_optlist // default_long_optlist else if (i == 1) then ! Only long options specified in optlist rads_optlist = default_short_optlist // optlist // default_long_optlist else ! Short options in front, long options in the middle rads_optlist = optlist(1:i-1) // default_short_optlist // optlist(i:) // default_long_optlist endif end subroutine rads_set_options !****if* rads/rads_load_options ! SUMMARY ! Extract options from command line ! ! SYNOPSIS subroutine rads_load_options (nsat) use rads_misc integer, intent(out) :: nsat ! ! PURPOSE ! Scan the command line for all common RADS 4 command line options ! like --cycle, --sat, -P, etc, and store only these, not any other ! command line options, in an external array <rads_option>. ! In addition any arguments from a file pointed to by the --args <file> ! option are loaded as well. ! ! The array <opt%id> will contain the identifiers of the various options. ! They are given as <nsat>*10+<type>, where <nsat> is 0 before the first ! -S option, 1 starting with the first -S option, 2 starting with the second ! -S option, etc, and <type> is 1 for -S, 2 for -X, 4 for -V, 3 for all ! other known options, 0 for all other. ! ! The external variable <rads_nopt> will be set to the number of command ! line options saved. ! ! The value <nsat> returns the total amount of -S options. ! ! ARGUMENTS ! nsat : Number of '-S' or '--sat' options !****------------------------------------------------------------------- integer :: ios, iunit, i, nopt type(rads_option), pointer :: opt(:) ! Initialize nopt = 1 nsat = 0 iunit = 0 allocate (rads_opt(rads_optl)) opt => rads_opt opt = rads_option ('!', '', 9999) call getopt_reset ! If any option is 'args=' then load the options from file ! Otherwise load the options from the command line do ! Check if there are not too many options if (nopt > size(opt)) call rads_exit ('Too many command line options') ! Get next option and its argument call getopt (rads_optlist, opt(nopt)%opt, opt(nopt)%arg, iunit) ! Now hunt for '-S', --sat', '-v', '--verbose', '--debug', '-X', and '--xml' among the command line options ! The array opt%id is filled to indicate where to find -S, -X, -v|q, -V and other options ! Also look for '--args' option to load arguments from file select case (opt(nopt)%opt) case ('!') ! End of argument list if (iunit == 0) then nopt = nopt - 1 ! Because we count always one ahead exit ! Done with command line else close (iunit) ! Done with argument file, continue with command line iunit = 0 endif ! We do not save any of the next options case (':', '::') call rads_opt_error (opt(nopt)%opt, opt(nopt)%arg) case ('q', 'quiet') rads_verbose = -1 case ('v', 'verbose') rads_verbose = rads_verbose + 1 case ('debug') read (opt(nopt)%arg, *, iostat=ios) rads_verbose if (ios /= 0) call rads_opt_error (opt(nopt)%opt, opt(nopt)%arg) case ('log') if (opt(nopt)%arg == '-' .or. opt(nopt)%arg == 'stdout') then rads_log_unit = stdout else if (opt(nopt)%arg == '+' .or. opt(nopt)%arg == 'stderr') then rads_log_unit = stderr else rads_log_unit = getlun() open (rads_log_unit, file=opt(nopt)%arg, status='replace', iostat=ios) if (ios /= 0) rads_log_unit = stdout endif case ('args') ! Open file with command line arguments. If not available, ignore iunit = getlun() open (iunit, file=opt(nopt)%arg, status='old', iostat=ios) if (ios /= 0) iunit = 0 ! The following options we memorise. They will later be parsed in the order: ! id_sat, id_xml, id_alias, id_misc, id_var case (' ') ! Non-option arguments opt(nopt)%id = nsat*10 nopt = nopt + 1 case ('S', 'sat') nsat = nsat + 1 opt(nopt)%id = nsat*10+id_sat nopt = nopt + 1 case ('X', 'xml') opt(nopt)%id = nsat*10+id_xml nopt = nopt + 1 case ('A', 'alias') opt(nopt)%id = nsat*10+id_alias nopt = nopt + 1 case ('V', 'var', 'sel') opt(nopt)%id = nsat*10+id_var nopt = nopt + 1 case default ! Here for other known options to be parsed in rads_parse_options opt(nopt)%id = nsat*10+id_misc nopt = nopt + 1 end select enddo if (rads_verbose >= 2) then write (*,'(i6,1x,a)') nopt, ' command line options:' do i = 1, nopt write (*,'(i6,5a,i6)') i,' optopt = ',trim(opt(i)%opt),'; optarg = ',trim(opt(i)%arg),'; optid = ',opt(i)%id enddo endif rads_nopt = nopt end subroutine rads_load_options !****if* rads/rads_parse_options ! SUMMARY ! Parse RADS options ! ! SYNOPSIS subroutine rads_parse_options (S, opt) use rads_time use rads_misc type(rads_sat), intent(inout) :: S type(rads_option), intent(in) :: opt(:) ! ! PURPOSE ! This routine fills the <S> struct with the information pertaining ! to a given satellite and mission as read from the options in the ! array <opt>. ! The -S or --sat option is ignored (it should be dealt with separately). ! The -V or --var option is not parsed, but a pointer is returned to the element ! of the list of variables following -V or --var. Same for --sel, and the ! backward compatible options sel= and var=. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! opt : Array of options (usually command line arguments) !****------------------------------------------------------------------- integer :: i do i = 1,size(opt) call rads_parse_option (opt(i)) enddo if (S%error /= rads_noerr) call rads_exit ('Error parsing command line arguments') contains subroutine rads_parse_option (opt) type(rads_option), intent(in) :: opt integer :: j, k0, k1, ios real(eightbytereal) :: val(2) ! Scan a single command line argument (option) val = nan j = index(opt%arg, '=') select case (opt%opt) case ('C', 'cycle') S%cycles(2) = -1 S%cycles(3) = 1 call read_val (opt%arg, S%cycles, '/-', iostat=ios) if (ios > 0) call rads_opt_error (opt%opt, opt%arg) if (S%cycles(2) < 0) S%cycles(2) = S%cycles(1) case ('P', 'pass') if (opt%arg(:1) == 'a') then ! Only ascending passes S%passes(1) = S%passes(1)/2*2+1 S%passes(3) = 2 else if (opt%arg(:1) == 'd') then ! Only descending passes S%passes(1) = (S%passes(1)+1)/2*2 S%passes(3) = 2 else S%passes(2) = -1 S%passes(3) = 1 call read_val (opt%arg, S%passes, '/-', iostat=ios) if (ios > 0) call rads_opt_error (opt%opt, opt%arg) if (S%passes(2) < 0) S%passes(2) = S%passes(1) endif case ('A', 'alias') if (opt%arg(j+1:j+1) == ',' .or. opt%arg(j+1:j+1) == '/') then ! -Aalias=,var is processed as -Aalias=alias,var call rads_set_alias (S, opt%arg(:j-1), opt%arg(:j-1) // opt%arg(j+1:)) else call rads_set_alias (S, opt%arg(:j-1), opt%arg(j+1:)) endif case ('F', 'fmt', 'format') call rads_set_format (S, opt%arg(:j-1), opt%arg(j+1:)) case ('Z', 'cmp', 'compress') call rads_set_compress (S, opt%arg(:j-1), opt%arg(j+1:)) case ('R', 'region') call rads_set_region (S, opt%arg) case ('lat', 'lon', 'sla') call rads_set_limits (S, opt%opt, string=opt%arg, iostat=ios) if (ios > 0) call rads_opt_error (opt%opt, opt%arg) case ('L', 'limits') call rads_set_limits (S, opt%arg(:j-1), string=opt%arg(j+1:), iostat=ios) if (ios > 0) call rads_opt_error (opt%opt, opt%arg) case ('Q', 'quality-flag', 'quality_flag') if (j > 0) then call rads_set_quality_flag (S, opt%arg(:j-1), opt%arg(j+1:)) else call rads_set_quality_flag (S, 'sla', opt%arg) endif ! The next are only for compatibility with RADS 3 case ('h') call rads_set_limits (S, 'sla', string=opt%arg, iostat=ios) if (ios > 0) call rads_opt_error (opt%opt, opt%arg) case ('opt') if (j > 0) then if (len_trim(opt%arg) == j+1) then call rads_set_alias (S, opt%arg(:j-1), opt%arg(:j-1)//'0'//opt%arg(j+1:)) call rads_set_quality_flag (S, 'sla', opt%arg(:j-1)//'0'//opt%arg(j+1:)) else call rads_set_alias (S, opt%arg(:j-1), opt%arg(:j-1)//opt%arg(j+1:)) call rads_set_quality_flag (S, 'sla', opt%arg(:j-1)//opt%arg(j+1:)) endif else k1 = 0 do if (.not.next_word (opt%arg, k0, k1)) exit if (k1 == k0) cycle call rads_set_alias (S, opt%arg(k0:k1-3), opt%arg(k0:k1-1)) call rads_set_quality_flag (S, 'sla', opt%arg(k0:k1-1)) enddo endif case ('time', 't:', 'sec', 'mjd', 'doy', 'ymd') ! Finally try date arguments call dateopt(opt%opt, opt%arg, val(1), val(2), iostat=ios) if (ios > 0) call rads_opt_error (opt%opt, opt%arg) call rads_set_limits (S, 'time', val(1), val(2)) end select end subroutine rads_parse_option end subroutine rads_parse_options !****if* rads/rads_parse_varlist_0d ! SUMMARY ! Parse a string of variables ! ! SYNOPSIS subroutine rads_parse_varlist_0d (S, string) use rads_misc type (rads_sat), intent(inout) :: S character(len=*), intent(in) :: string ! ! Parse the string <string> of comma- or slash-separated names of variables. ! This will allocate the array S%sel and update counter S%nsel. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! string : String of variables ! ! ERROR CODE ! S%error : rads_err_var !****------------------------------------------------------------------- integer(fourbyteint) :: i0, i1, n, noedit type(rads_var), pointer :: temp(:), var ! Count the number of words first i1 = 0 n = 0 do if (.not.next_word (string, i0, i1)) exit if (i1 == i0) cycle n = n + 1 enddo ! If no variables, exit if (n == 0) then call rads_error (S, rads_err_var, 'No variables selected') return endif ! (Re)allocate memory if (associated(S%sel)) then allocate (temp(S%nsel+n)) temp(1:S%nsel) = S%sel(1:S%nsel) deallocate (S%sel) S%sel => temp else allocate (S%sel(n)) endif ! Parse the variable list i1 = 0 do if (.not.next_word (string, i0, i1)) exit if (i1 == i0) cycle noedit = 1 if (string(i1-1:i1-1) == rads_noedit) noedit = 2 var => rads_varptr(S, string(i0:i1-noedit)) if (.not.associated(var)) then call rads_error (S, rads_err_var, 'Unknown variable "'//string(i0:i1-noedit)//'" removed from list of variables') cycle endif S%nsel = S%nsel + 1 S%sel(S%nsel) = var if (noedit == 2) S%sel(S%nsel)%noedit = .true. ! Switch on multi-Hz output when a variable is 2-dimensional if (var%info%ndims > 1) S%n_hz_output = .true. enddo end subroutine rads_parse_varlist_0d subroutine rads_parse_varlist_1d (S, string) type (rads_sat), intent(inout) :: S character(len=*), intent(in) :: string(:) integer :: i do i = 1,size(string) call rads_parse_varlist_0d (S, string(i)) enddo end subroutine rads_parse_varlist_1d !****if* rads/rads_parse_cmd !*rads_parse_cmd -- Parse command line options ! ! SYNOPSIS subroutine rads_parse_cmd (S) type(rads_sat), intent(inout) :: S ! ! PURPOSE ! After initialising RADS for a single satellite using rads_init_sat (S,sat) ! this routine can be used to update the <S> struct with information from ! the command line options. In contrast to rads_init_sat (S) this does not ! require that -S or --sat is one of the command line options. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! optlist : (optional) list of command specific short and long options !****------------------------------------------------------------------- integer :: nsat call rads_load_options (nsat) call rads_parse_options (S, rads_opt(1:rads_nopt)) call rads_parse_varlist (S, pack(rads_opt%arg, mod(rads_opt%id,10)==id_var)) end subroutine rads_parse_cmd subroutine rads_end_0d (S) type(rads_sat), intent(inout) :: S integer :: ios deallocate (rads_opt, stat=ios) call rads_free_sat_struct (S) if (rads_log_unit > stdout) close (rads_log_unit) end subroutine rads_end_0d subroutine rads_end_1d (S) type(rads_sat), intent(inout) :: S(:) integer :: ios, i deallocate (rads_opt, stat=ios) do i = 1,size(S) call rads_free_sat_struct (S(i)) enddo if (rads_log_unit > stdout) close (rads_log_unit) end subroutine rads_end_1d !****f* rads/rads_open_pass ! SUMMARY ! Open RADS pass file ! ! SYNOPSIS subroutine rads_open_pass (S, P, cycle, pass, rw, echofilepaths) use netcdf use rads_netcdf use rads_time use rads_misc use rads_geo type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P integer(fourbyteint), intent(in) :: cycle, pass logical, intent(in), optional :: rw logical, intent(in), optional :: echofilepaths ! ! PURPOSE ! This routine opens a NetCDF file for access to the RADS machinery. ! However, prior to opening the file, three tests are performed to speed ! up data selection: ! (1) All passes outside the preset cycle and pass limits are rejected. ! (2) Based on the time of the reference pass, the length of the repeat ! cycle and the number of passes per cycle, a rough estimate is ! made of the temporal extent of the pass. If this is outside the ! selected time window, then the pass is rejected. ! (3) Based on the equator longitude and the pass number of the reference ! pass, the length of the repeat cycle and the number of passes in ! the repeat cycle, an estimate is made of the equator longitude of ! the current pass. If this is outside the limits set in S%eqlonlim ! then the pass is rejected. ! ! If the pass is rejected based on the above critetia or when no NetCDF ! file exists, S%error returns the warning value rads_warn_nc_file. ! If the file cannot be read properly, rads_err_nc_parse is returned. ! Also, in both cases, P%ndata will be set to zero. ! ! By default the file is opened for reading only. Specify perm=nf90_write to ! open for reading and writing. ! The file opened with this routine should be closed by using rads_close_pass. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! cycle : Cycle number ! pass : Pass number ! rw : (optional) Set read/write permission (def: read only) ! echofilepaths : (optional) Print to standard output the file path before ! it is being checked for existence. ! ! ERROR CODE ! S%error : rads_noerr, rads_warn_nc_file, rads_err_nc_parse !****------------------------------------------------------------------- character(len=40) :: date character(len=5) :: hz character(len=rads_strl) :: string integer(fourbyteint) :: i, j1, j2, k, ascdes, ncid real(eightbytereal), pointer :: temp(:,:) logical :: error ! Initialise S%error = rads_warn_nc_file call rads_init_pass_struct (S, P) P%cycle = cycle P%pass = pass ascdes = modulo(pass,2) ! 1 if ascending, 0 if descending P%ndata = 0 if (rads_verbose >= 2) write (*,'(a,a3,2i5)') 'Checking sat/cycle/pass : ', S%sat, cycle, pass ! If the cycle is out of range for the current phase, look for a new phase call rads_set_phase (S, cycle, error) ! Do checking on cycle limits if (error) then S%pass_stat(1) = S%pass_stat(1) + 1 return endif ! Do check on excluded cycles if (associated(S%excl_cycles)) then if (any(S%excl_cycles%list(:S%excl_cycles%n) == cycle)) then S%pass_stat(1) = S%pass_stat(1) + 1 return endif endif ! Do checking on pass limits (which may include new phase limits) if (pass < S%passes(1) .or. pass > S%passes(2) .or. pass > S%phase%passes) then S%pass_stat(2) = S%pass_stat(2) + 1 return endif ! Predict equator crossing info call rads_predict_equator (S, P, cycle, pass) ! Do checking of pass ends on the time criteria (only when such are given) if (.not.all(isnan_(S%time%info%limits))) then if (P%end_time + 300d0 < S%time%info%limits(1) .or. P%start_time - 300d0 > S%time%info%limits(2)) then ! Allow 5 minute slop if (rads_verbose >= 2) write (*,'(a,4f15.3)') 'Bail out on estimated time:', S%time%info%limits, P%start_time, P%end_time S%pass_stat(3) = S%pass_stat(3) + 1 return endif endif ! Do checking of equator longitude on the longitude criteria (only when those are limiting) if (S%eqlonlim(ascdes,2) - S%eqlonlim(ascdes,1) < 360d0) then if (checklon(S%eqlonlim(ascdes,:),P%equator_lon)) then if (rads_verbose >= 2) write (*,'(a,3f12.6)') 'Bail out on estimated equator longitude:', & S%eqlonlim(ascdes,:), P%equator_lon S%pass_stat(4+ascdes) = S%pass_stat(4+ascdes) + 1 return endif endif ! Update pass opening stats S%pass_stat(6+ascdes) = S%pass_stat(6+ascdes) + 1 ! Open pass file 600 format (a,'/',a,'/',a,'/c',i3.3,'/',a2,'p',i4.4,'c',i3.3,'.nc') write (P%fileinfo(1)%name, 600) trim(S%dataroot), trim(S%branch(1)), trim(S%phase%name), cycle, S%sat, pass, cycle ! optional echo of the file in which we are looking for data ! ...intentionally do this prior to testing if file exists 601 format ('# checkfile: ',a) if (present(echofilepaths)) then if (echofilepaths) then write (*,601) trim(P%fileinfo(1)%name) endif endif if (present(rw)) then P%rw = rw else P%rw = .false. endif if (P%rw) then if (rads_verbose >= 2) write (*,'(2a)') 'Opening for read/write: ',trim(P%fileinfo(1)%name) if (nft(nf90_open(P%fileinfo(1)%name,nf90_write,ncid))) return else if (rads_verbose >= 2) write (*,'(2a)') 'Opening for read only: ',trim(P%fileinfo(1)%name) if (nft(nf90_open(P%fileinfo(1)%name,nf90_nowrite,ncid))) return endif P%fileinfo(1)%ncid = ncid ! Get the time dimension S%error = rads_err_nc_parse k = index(S%time%info%dataname, ' ') - 1 if (nft(nf90_inq_dimid(ncid,S%time%info%dataname(:k),i))) return if (nft(nf90_inquire_dimension(ncid,i,len=P%ndata))) return ! Get the optional second (n-Hz) dimension if (nf90_inq_dimid(ncid,'meas_ind',i) + nf90_inquire_dimension(ncid,i,len=P%n_hz) /= nf90_noerr) P%n_hz = 0 ! Read global attributes if (nft(nf90_get_att(ncid,nf90_global,'equator_longitude',P%equator_lon))) return P%equator_lon = S%lon%info%limits(1) + modulo (P%equator_lon - S%lon%info%limits(1), 360d0) if (nft(nf90_get_att(ncid,nf90_global,'equator_time',date))) return P%equator_time = strp1985f(date) if (nft(nf90_get_att(ncid,nf90_global,'first_meas_time',date))) return P%start_time = strp1985f(date) if (nft(nf90_get_att(ncid,nf90_global,'last_meas_time',date))) return P%end_time = strp1985f(date) if (nft(nf90_get_att(ncid,nf90_global,'cycle_number',i)) .or. i /= cycle) return if (nft(nf90_get_att(ncid,nf90_global,'pass_number',i)) .or. i /= pass) return if (rads_verbose >= 3) write (*,'(a,3f15.3,f12.6)') 'Start/end/equator time/longitude = ', & P%equator_time, P%start_time, P%end_time, P%equator_lon S%error = rads_noerr ! Return if the file is empty if (P%ndata == 0) return ! Update number of "read" measurements S%total_read = S%total_read + P%ndata ! Read history if (nff(nf90_inquire_attribute(ncid,nf90_global,'history',attnum=k))) then allocate (P%history) call nfs(nf90_get_att(ncid,nf90_global,'history',P%history)) if (nft(nf90_get_att(ncid,nf90_global,'original',P%original))) P%original = '' else if (nff(nf90_inquire_attribute(ncid,nf90_global,'log01',attnum=k))) then ! Read logs (RADS3) allocate (P%history) i = 0 do i = i + 1 write (date, '("log",i2.2)') i if (nft(nf90_get_att(ncid,nf90_global,date,string))) exit j1 = index(string, '|', .true.) ! Index of last '|' j2 = index(string, ':') ! Index of first ':' if (i == 1) then ! If log01 has original file name, save it k = index(string, 'RAW data from file') if (k > 0) then P%original = string(k+19:) else k = index(string, 'RAW data from') if (k > 0) then P%original = string(k+14:) else P%original = string(j2+1:) endif endif ! Write date and command to history P%history = string(:11) // ':' // string(j1+1:j2-1) else P%history = string(:11) // ':' // string(j1+1:j2-1) // rads_linefeed // P%history endif P%nlogs = i enddo endif ! Read time, lon, lat ! If read-only: also check their limits allocate (P%tll(P%ndata,3)) call rads_get_var_common (S, P, S%time, P%tll(:,1), P%rw) call rads_get_var_common (S, P, S%lat, P%tll(:,2), P%rw) call rads_get_var_common (S, P, S%lon, P%tll(:,3), P%rw) P%time_dims = 1 ! If requested, check for distance to centroid if (.not.P%rw .and. S%centroid(3) > 0d0) then do i = 1,P%ndata if (any(isnan_(P%tll(i,2:3)))) cycle if (sfdist(P%tll(i,2)*rad, P%tll(i,3)*rad, S%centroid(2), S%centroid(1)) > S%centroid(3)) P%tll(i,2:3) = nan enddo endif ! Look for first non-NaN measurement do i = 1, P%ndata if (.not.any(isnan_(P%tll(i,:)))) exit enddo if (i > P%ndata) then ! Got no non-NaNs P%ndata = 0 return endif P%first_meas = i ! Now look for last non-NaN measurement do i = P%ndata, P%first_meas, -1 if (.not.any(isnan_(P%tll(i,:)))) exit enddo P%last_meas = i ! Open files in other (optional) branches do i = 2, rads_max_branches if (S%branch(i) == '') exit write (P%fileinfo(i)%name, 600) & trim(S%dataroot), trim(S%branch(i)), trim(S%phase%name), cycle, S%sat, pass, cycle if (P%rw) then if (rads_verbose >= 2) write (*,'(2a)') 'Opening for read/write: ',trim(P%fileinfo(i)%name) if (nft(nf90_open(P%fileinfo(i)%name,nf90_write,ncid))) return else if (rads_verbose >= 2) write (*,'(2a)') 'Opening for read only: ',trim(P%fileinfo(i)%name) if (nft(nf90_open(P%fileinfo(i)%name,nf90_nowrite,ncid))) return endif if (nft(nf90_inquire_dimension(ncid,1,len=k))) return if (k /= P%ndata) call rads_message ('Dimension in ' // trim(P%fileinfo(i)%name) // ' does not match ' // & trim(P%fileinfo(1)%name)) P%fileinfo(i)%ncid = ncid enddo ! If subset is requested, reallocate appropriately sized time, lat, lon arrays ! If multi-Hertz data: load multi-Hertz fields i = P%last_meas - P%first_meas + 1 if (S%n_hz_output .and. P%n_hz > 0) then P%ndata = i * P%n_hz deallocate (P%tll) allocate (P%tll(P%ndata,3)) write (hz, '("_",i2.2,"hz")') P%n_hz call rads_get_var (S, P, 'time'//hz, P%tll(:,1)) call rads_get_var (S, P, 'lat' //hz, P%tll(:,2)) call rads_get_var (S, P, 'lon' //hz, P%tll(:,3)) P%time_dims = 2 else if (i /= P%ndata) then P%ndata = i allocate (temp(P%ndata,3)) temp = P%tll(P%first_meas:P%last_meas,:) deallocate (P%tll) P%tll => temp endif ! Successful ending; update number of measurements in region S%error = rads_noerr S%total_inside = S%total_inside + P%ndata end subroutine rads_open_pass !****f* rads/rads_close_pass ! SUMMARY ! Close RADS pass file ! ! SYNOPSIS subroutine rads_close_pass (S, P, keep) use netcdf use rads_netcdf type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P logical, intent(in), optional :: keep ! ! PURPOSE ! This routine closes a NetCDF file previously opened by rads_open_pass. ! The routine will reset the ncid element of the <P> structure to ! indicate that the passfile is closed. ! If <keep> is set to .true., then the history, flags, time, lat, and lon ! elements the <P> structure are kept. I.e., they are not deallocated ! but only their links are removed. Otherwise, they are deallocated along ! with the log entries. ! A second call to rads_close_pass without the keep argment can subsequently ! deallocate the time, lat and lon elements of the <P> structure. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! keep : Keep the P%tll matrix (destroy by default) ! ! ERROR CODE ! S%error : rads_noerr, rads_err_nc_close !****------------------------------------------------------------------- integer :: i integer(fourbyteint) :: ncid S%error = rads_noerr do i = 1,rads_max_branches ncid = P%fileinfo(i)%ncid if (ncid > 0 .and. nft(nf90_close(ncid))) S%error = rads_err_nc_close enddo P%fileinfo = rads_file (0, '') if (.not.present(keep) .or. .not.keep) call rads_free_pass_struct (S, P) end subroutine rads_close_pass !****if* rads/rads_get_var_by_number ! SUMMARY ! Read variable (data) from RADS4 file by integer ! ! SYNOPSIS recursive subroutine rads_get_var_by_number (S, P, field, data, noedit) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P integer(fourbyteint), intent(in) :: field real(eightbytereal), intent(out) :: data(:) logical, intent(in), optional :: noedit ! ! PURPOSE ! This routine is added for backward compatibility with the field numbers ! in RADS3. It functions the same as rads_get_var, except that it ! uses the old field number as indicator for the variable. !****------------------------------------------------------------------- character(len=4) :: name integer :: i logical :: skip_edit S%error = rads_noerr if (rads_get_var_helper (S, P, data)) return ! Check data sizes ! Do we need to skip editing? if (present(noedit)) then skip_edit = noedit else skip_edit = .false. endif ! Look for field number in variable list do i = 1,S%nvar if (any(S%var(i)%field == field)) then call rads_get_var_common (S, P, S%var(i), data(:P%ndata), skip_edit) return endif enddo write (name,'(i0)') field call rads_error (S, rads_err_var, 'No variable with field number "'//name//'" was defined for "'//trim(S%branch(1))//'"') data(:P%ndata) = nan end subroutine rads_get_var_by_number !****if* rads/rads_get_var_by_var ! SUMMARY ! Read variable (data) from RADS by type(rads_var) ! ! SYNOPSIS recursive subroutine rads_get_var_by_var (S, P, var, data, noedit) use rads_misc type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(inout) :: var real(eightbytereal), intent(out) :: data(:) logical, intent(in), optional :: noedit ! ! This routine is an alternative to rads_get_var_by_name in the sense ! that it addresses the variable by a varlist item, like S%sel(i), thus ! shortcutting the need to (re)do the search for varinfo. !****------------------------------------------------------------------- logical :: skip_edit S%error = rads_noerr if (rads_get_var_helper (S, P, data)) return ! Check data sizes ! Do we need to skip editing? if (var%noedit) then skip_edit = .true. else if (present(noedit)) then skip_edit = noedit else skip_edit = .false. endif call rads_get_var_common (S, P, var, data(:P%ndata), skip_edit) end subroutine rads_get_var_by_var !****if* rads/rads_get_var_by_name ! SUMMARY ! Read variable (data) from RADS by character ! ! SYNOPSIS recursive subroutine rads_get_var_by_name (S, P, varname, data, noedit) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname real(eightbytereal), intent(out) :: data(:) logical, intent(in), optional :: noedit ! ! PURPOSE ! This routine loads the data from a single variable <varname>, addressed ! by a character string into the buffer <data>. !****------------------------------------------------------------------- type(rads_var), pointer :: var integer(fourbyteint) :: l logical :: skip_edit S%error = rads_noerr if (rads_get_var_helper (S, P, data)) return ! Check data sizes ! If varname ends with %, suspend editing, otherwise follow noedit, or default = .false. l = len_trim(varname) if (varname(l:l) == rads_noedit) then l = l - 1 skip_edit = .true. else if (present(noedit)) then skip_edit = noedit else skip_edit = .false. endif var => rads_varptr (S, varname(:l)) if (.not.associated(var)) then data(:P%ndata) = nan return endif call rads_get_var_common (S, P, var, data(:P%ndata), skip_edit) end subroutine rads_get_var_by_name recursive subroutine rads_get_var_by_name_2d (S, P, varname, data, noedit) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname real(eightbytereal), intent(out) :: data(:,:) logical, intent(in), optional :: noedit real(eightbytereal), allocatable :: temp(:) integer(fourbyteint) :: k k = P%ndata P%ndata = P%ndata*P%n_hz allocate (temp(P%ndata)) call rads_get_var_by_name (S, P, varname, temp, noedit) data(1:P%n_hz,1:k) = reshape(temp,(/P%n_hz,k/)) deallocate(temp) P%ndata = k end subroutine rads_get_var_by_name_2d !****if* rads/rads_get_var_helper ! SUMMARY ! Helper routine for all rads_get_var_by_* routines ! ! SYNOPSIS logical function rads_get_var_helper (S, P, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(in) :: P real(eightbytereal), intent(in) :: data(:) ! ! PURPOSE ! This routine checks two things: ! - If P%ndata <= 0, then return .true. ! - If allocated memory is too small, then return .true. and print error ! - Else return .false. !****------------------------------------------------------------------- if (P%ndata <= 0) then rads_get_var_helper = .true. else if (size(data) < P%ndata) then call rads_error (S, rads_err_memory, 'Too little memory allocated to read data from file', P) rads_get_var_helper = .true. else rads_get_var_helper = .false. endif end function rads_get_var_helper !****if* rads/rads_get_var_common ! SUMMARY ! Read variable (data) from RADS database (common to all) ! ! SYNOPSIS recursive subroutine rads_get_var_common (S, P, var, data, noedit) use rads_misc type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(inout) :: var real(eightbytereal), intent(out) :: data(:) logical, intent(in) :: noedit ! ! PURPOSE ! This routine is common to all rads_get_var_* routines. It should only ! be called from those routines. !****------------------------------------------------------------------- type(rads_varinfo), pointer :: info integer :: i if (rads_verbose >= 4) write (*,'(2a)') 'rads_get_var_common: ',trim(var%name) ! Check size of array if (size(data) < P%ndata) then call rads_error (S, rads_err_memory, 'Too little memory allocated to read data from file', P) return endif ! Set pointer to info struct info => var%info do i = 1,3 ! This loop is here to allow processing of aliases S%error = rads_noerr ! Load data depending on type of data source select case (info%datasrc) case (rads_src_nc_var) call rads_get_var_nc case (rads_src_nc_att) call rads_get_var_nc_att case (rads_src_math) call rads_get_var_math case (rads_src_grid_lininter, rads_src_grid_splinter, rads_src_grid_query) call rads_get_var_grid case (rads_src_constant) call rads_get_var_constant case (rads_src_flags) call rads_get_var_flags case (rads_src_tpj) call rads_get_var_tpj case default data = nan return end select ! Error handling if (S%error == rads_noerr) then ! No error, go to editing stage exit else if (info%default /= huge(0d0)) then ! Default value data = info%default S%error = rads_noerr exit ! Look for alternative variables and run loop again else if (i == 1 .and. associated(var%inf1)) then info => var%inf1 else if (i == 2 .and. associated(var%inf2)) then info => var%inf2 ! Ran out of options else call rads_error (S, rads_err_var, 'Could not find any data for variable "'//trim(var%name)//'" in file', P) data = nan exit endif enddo ! End alias loop ! Edit this data if required and no error occurred if (.not.noedit .and. S%error == rads_noerr) then if (any(info%limits == info%limits)) call rads_check_limits if (info%quality_flag(:1) /= ' ') call rads_check_quality_flag endif call rads_update_stat ! Update statistics on variable contains include "rads_tpj.f90" recursive subroutine rads_get_var_nc ! Get data variable from RADS NetCDF file use netcdf use rads_netcdf integer(fourbyteint) :: start(2), count(2), e, i, nf_get_vara_double, ncid real(eightbytereal) :: x ! If time, lat, lon are already read, return those arrays upon request if (P%time_dims /= info%ndims) then ! Read from NetCDF file else if (info%datatype == rads_type_time) then data = P%tll(:,1) return else if (info%datatype == rads_type_lat) then data = P%tll(:,2) return else if (info%datatype == rads_type_lon) then data = P%tll(:,3) return endif ! Look for the variable name in the NetCDF file (or take the stored one) ncid = P%fileinfo(info%brid)%ncid if (P%cycle == info%cycle .and. P%pass == info%pass) then ! Keep old varid, but produce error when already tried and failed if (info%varid == 0) then S%error = rads_err_nc_var return endif else if (nff(nf90_inq_varid(ncid, info%dataname, info%varid))) then ! Read variable attributes if not yet set, or if we read/write if (P%rw .or. info%nctype == 0) e = nf90_inquire_variable (ncid, info%varid, xtype=info%nctype) if (P%rw .or. info%long_name(:1) == ' ') e = nf90_get_att(ncid, info%varid, 'long_name', info%long_name) if (P%rw .or. info%units(:1) == ' ') e = nf90_get_att(ncid, info%varid, 'units', info%units) if (P%rw .or. info%standard_name(:1) == ' ') e = nf90_get_att(ncid, info%varid, 'standard_name', info%standard_name) if (P%rw .or. info%comment(:1) == ' ') e = nf90_get_att(ncid, info%varid, 'comment', info%comment) else ! Failed to find variable S%error = rads_err_nc_var info%varid = 0 return endif e = nf90_inquire_variable (ncid, info%varid, ndims=info%ndims) ! Load the data start(1) = max(1,abs(P%first_meas)) if (info%ndims == 0) then ! Constant to be converted to 1-dimensional array if (nft(nf90_get_var(ncid, info%varid, data(1)))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF constant "'//trim(info%dataname)//'" in file', P) return endif data = data(1) info%ndims = 1 else if (info%ndims == 1 .and. S%n_hz_output .and. P%n_hz > 0 .and. P%first_meas > 0) then ! 1-dimensional array with duplicated 1-Hz values if (nft(nf90_get_var(ncid, info%varid, data(1:P%ndata:P%n_hz), start))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF array "'//trim(info%dataname)//'" in file', P) return endif forall (i = 1:P%ndata:P%n_hz) data(i+1:i+P%n_hz-1) = data(i) else if (info%ndims == 1) then ! 1-dimensional array of 1-Hz values if (nft(nf90_get_var(ncid, info%varid, data, start))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF array "'//trim(info%dataname)//'" in file', P) return endif else if (info%ndims == 2) then ! 2-dimensional array, read as single column start(2) = start(1) start(1) = 1 count(1) = P%n_hz count(2) = P%ndata / P%n_hz ! We use the Fortran 77 routine here so that we can easily read a 2D field into a 1D array if (nft(nf_get_vara_double(ncid, info%varid, start, count, data))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF array "'//trim(info%dataname)//'" in file', P) return endif else call rads_error (S, rads_err_nc_get, 'Too many dimensions for variable "'//trim(info%dataname)//'" in file', P) return endif ! Set NaN values and apply optional scale_factor and add_offset ! If we read/write, we also store the scale factor and add_offset if (nff(nf90_get_att(ncid, info%varid, '_FillValue', x))) where (data == x) data = nan if (nff(nf90_get_att(ncid, info%varid, 'scale_factor', x))) then data = data * x else x = 1d0 endif if (P%rw) info%scale_factor = x if (nff(nf90_get_att(ncid, info%varid, 'add_offset', x))) then data = data + x else x = 0d0 endif if (P%rw) info%add_offset = x end subroutine rads_get_var_nc subroutine rads_get_var_nc_att ! Get data attribute from RADS NetCDF file use netcdf use rads_netcdf use rads_time use rads_misc integer(fourbyteint) :: varid, i, ncid character(len=26) :: date ncid = P%fileinfo(info%brid)%ncid ! First locate the colon in the name i = index(info%dataname, ':') ! If name starts with colon, then we have a global attribute, else a variable attribute if (i == 1) then varid = nf90_global else if (nft(nf90_inq_varid(ncid, info%dataname(:i-1), varid))) then S%error = rads_err_nc_var return endif if (nft(nf90_inquire_attribute (ncid, varid, info%dataname(i+1:), xtype=info%nctype))) info%nctype = 0 ! Read the attribute if (info%nctype == nf90_char) then ! This is likely a date string if (nft(nf90_get_att(ncid, varid, info%dataname(i+1:), date))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF attribute "'//trim(info%dataname)//'" in file', P) return endif data = strp1985f (date) else ! Load an integer or float value if (nft(nf90_get_att(ncid, varid, info%dataname(i+1:), data(1)))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF attribute "'//trim(info%dataname)//'" in file', P) return endif data = data(1) endif end subroutine rads_get_var_nc_att subroutine rads_get_var_flags ! Get value from flag word or vice versa use netcdf use rads_netcdf integer(fourbyteint) :: start(1), i, j, k, bits(2), ncid ncid = P%fileinfo(1)%ncid if (info%dataname /= 'flags') then ! Extract single flags from flagword if (.not.associated(P%flags)) then ! Flags need to be loaded first if (nft(nf90_inq_varid (ncid, 'flags', info%varid))) then ! Failed to find variable S%error = rads_err_nc_var return endif start = max(1,P%first_meas) allocate (P%flags(P%ndata)) if (nft(nf90_get_var(ncid, info%varid, P%flags, start))) then call rads_error (S, rads_err_nc_get, 'Error reading NetCDF array "flags" in file', P) return endif endif if (info%dataname == 'surface_type') then ! Special setting to get surface type from bits 2, 4, 5 ! 0=ocean, 2=enclosed seas and lakes, 3=land, 4=continental ice ! I am keeping 1 for coastal in future do i = 1,P%ndata if (btest(P%flags(i),2)) then data(i) = 4 ! continental ice else if (btest(P%flags(i),4)) then data(i) = 3 ! land else if (btest(P%flags(i),5)) then data(i) = 2 ! enclosed sea or lake else data(i) = 0 ! ocean endif enddo else ! Just get one or more bits bits = (/0,1/) read (info%dataname, *, iostat=i) bits data = ibits(P%flags,bits(1),bits(2)) endif else if (associated(P%flags)) then ! We already have the flagswords, so just copy data = P%flags else ! Reconstrunct flagword from various flags allocate (P%flags(P%ndata)) P%flags = 0 do j = 1,S%nvar k = S%var(j)%field(1) if (k < 2501 .or. k > 2516) cycle k = modulo (k - 2500, 16) call rads_get_var_by_var (S, P, S%var(j), data, noedit=.true.) if (k == 4) then ! Surface type do i = 1,P%ndata select case (nint2(data(i))) case (4) ! ice = land = non-ocean P%flags(i) = P%flags(i) + flag_masks(2) + flag_masks(4) + flag_masks(5) case (3) ! land = non-ocean P%flags(i) = P%flags(i) + flag_masks(4) + flag_masks(5) case (2) ! enclosed seas or lakes = non-ocean P%flags(i) = P%flags(i) + flag_masks(5) end select enddo else P%flags = P%flags + nint2(data) * flag_masks(k) endif enddo data = P%flags endif end subroutine rads_get_var_flags recursive subroutine rads_get_var_math ! Get data variable from MATH statement use rads_misc use rads_math type(math_ll), pointer :: top integer(fourbyteint) :: i, i0, i1, istat ! Start with a nullified 'top' nullify(top) ! Process the math commands left to right i1 = 0 do if (.not.next_word (info%dataname, i0, i1)) exit if (i1 == i0) cycle istat = math_eval (info%dataname(i0:i1-1), P%ndata, top) if (istat /= 0) then ! No command or value, likely to be a variable call math_push (P%ndata,top) call rads_get_var_by_name (S, P, info%dataname(i0:i1-1), top%data) endif if (S%error /= rads_noerr) exit enddo ! When no error, copy top of stack to output if (S%error == rads_noerr) data = top%data ! See if we have leftovers on the stack i = -1 do while (associated(top)) i = i + 1 call math_pop(top) enddo if (i > 0) then write (stderr,*) i,' remaining items on stack' call rads_error (S, rads_noerr, 'Cleaned up') endif end subroutine rads_get_var_math subroutine rads_get_var_grid ! Get data by interpolating a grid use rads_grid real (eightbytereal) :: x(P%ndata), y(P%ndata) integer(fourbyteint) :: i ! Load grid if not yet done if (info%grid%ntype /= 0) then ! Already loaded else if (grid_load (info%grid%filenm, info%grid) /= 0) then info%datasrc = rads_src_none ! Will not attempt to read grid again S%error = rads_err_source return endif ! Get x and y coordinates call rads_get_var_by_name (S, P, info%gridx, x, .true.) if (S%error <= rads_noerr) call rads_get_var_by_name (S, P, info%gridy, y, .true.) if (S%error > rads_noerr) then S%error = rads_err_source else if (info%datasrc == rads_src_grid_lininter) then forall (i = 1:P%ndata) data(i) = grid_lininter (info%grid, x(i), y(i)) else if (info%datasrc == rads_src_grid_splinter) then forall (i = 1:P%ndata) data(i) = grid_splinter (info%grid, x(i), y(i)) else forall (i = 1:P%ndata) data(i) = grid_query (info%grid, x(i), y(i)) endif end subroutine rads_get_var_grid subroutine rads_get_var_constant integer :: ios read (info%dataname, *, iostat=ios) data(1) if (ios == 0) then S%error = rads_noerr data = data(1) else S%error = rads_err_var data = nan endif end subroutine rads_get_var_constant subroutine rads_check_limits ! Edit the data based on limits integer(fourbyteint) :: mask(2) if (info%datatype == rads_type_lon) then ! When longitude, shift the data first above the lower (west) limit data = info%limits(1) + modulo (data - info%limits(1), 360d0) ! Then only check the upper (east) limit where (data > info%limits(2)) data = nan else if (info%datatype == rads_type_flagmasks) then ! Do editing of flag based on mask mask = nint(info%limits) where (info%limits /= info%limits) mask = 0 ! Because it is not guaranteed for every compiler that nint(nan) = 0 ! Reject when any of the set bits of the lower limit are set in the data if (mask(1) /= 0) where (iand(nint(data),mask(1)) /= 0) data = nan ! Reject when any of the set bits of the upper limit are not set in the data if (mask(2) /= 0) where (iand(nint(data),mask(2)) /= mask(2)) data = nan else ! Do editing of any other variable where (data < info%limits(1) .or. data > info%limits(2)) data = nan endif end subroutine rads_check_limits recursive subroutine rads_check_quality_flag use rads_misc real(eightbytereal) :: qual(P%ndata) integer(fourbyteint) :: i0, i1 ! Process all quality checks left to right i1 = 0 do if (.not.next_word (info%quality_flag, i0, i1)) exit if (i1 == i0) cycle call rads_get_var_by_name (S, P, info%quality_flag(i0:i1-1), qual) if (S%error /= rads_noerr) exit where (isnan_(qual)) data = nan enddo end subroutine rads_check_quality_flag subroutine rads_update_stat ! Update the statistics for given var use rads_misc real(eightbytereal) :: q, r integer(fourbyteint) :: i ! If stats are already done for this cycle and pass, skip it if (P%cycle == info%cycle .and. P%pass == info%pass) return info%cycle = P%cycle info%pass = P%pass ! Count selected and rejected measurements and update pass statistics ! Use method of West (1979) do i = 1,P%ndata if (isnan_(data(i))) then info%rejected = info%rejected + 1 else info%selected = info%selected + 1 info%xmin = min(info%xmin, data(i)) info%xmax = max(info%xmax, data(i)) q = data(i) - info%mean r = q / info%selected info%mean = info%mean + r info%sum2 = info%sum2 + r * q * (info%selected - 1) endif enddo end subroutine rads_update_stat end subroutine rads_get_var_common !****f* rads/rads_read_xml ! SUMMARY ! Read RADS4 XML file ! ! SYNOPSIS subroutine rads_read_xml (S, filename) use netcdf use xmlparse use rads_time use rads_misc type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: filename ! ! PURPOSE ! This routine parses a RADS4 XML file and fills the <S> struct with ! information pertaining to the given satellite and all variable info ! encountered in that file. ! ! The execution terminates on any error, and also on any warning if ! fatal = .true. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! filename : XML file name ! fatal : If .true., then all warnings are fatal. ! ! ERROR CODE ! S%error : rads_noerr, rads_err_xml_parse, rads_err_xml_file !****------------------------------------------------------------------- type(xml_parse) :: X integer, parameter :: max_lvl = 20 character(len=rads_varl) :: tag, name, tags(max_lvl) character(len=rads_naml) :: attr(2,max_lvl), val(max_lvl) character(len=6) :: src integer :: nattr, nval, i, j, ios, skip, skip_level integer(twobyteint) :: field(2) logical :: endtag, endskip real(eightbytereal) :: node_rate type(rads_varinfo), pointer :: info, info_block type(rads_var), pointer :: var, var_block type(rads_phase), pointer :: phase ! Initialise S%error = rads_noerr endskip = .true. skip_level = 0 nullify (var_block, info_block, phase) ! Open XML file call xml_open (X, filename, .true.) ! If failed, try with ".xml" extension (if not already) if (X%error .and. index(filename,'.xml') == 0) call xml_open (X, trim(filename) // '.xml', .true.) if (X%error) then S%error = rads_err_xml_file return endif if (rads_verbose >= 2) write (*,'(2a)') 'Parsing XML file ',trim(filename) call xml_options (X, ignore_whitespace = .true.) ! Parse XML file, store information in S struct do if (X%eof) exit call xml_get (X, tag, endtag, attr, nattr, val, nval) ! Process closing tags if (endtag) then if (tag /= tags(X%level+1)) & call xmlparse_error ('Closing tag </'//trim(tag)//'> follows opening tag <'//trim(tags(X%level+1))//'>') endskip = (X%level < skip_level) if (endskip) skip_level = 0 ! Stop skipping when descended back below the starting level if (tag == 'var') nullify (var_block, info_block) ! Stop processing <var> block if (tag == 'phase') nullify (phase) ! Stop processing <phase> block cycle ! Ignore all other end tags endif ! Set var and info to the ones for the <var> block, which means that outside of the block they will be set to null var => var_block info => info_block ! Special actions for <else> and <elseif> ! These will issue a 'skip' when previous <if> was not skipped if (tag == 'else' .or. tag == 'elseif') then if (tags(X%level) /= 'if' .and. tags(X%level) /= 'elseif') & call xmlparse_error ('Opening tag <'//trim(tag)//'> follows closing tag </'//trim(tags(X%level))//'>') if (.not.endskip .and. skip_level == 0) skip_level = X%level endif ! Process opening tags tags(X%level) = tag if (skip_level > 0 .and. X%level >= skip_level) cycle ! Skip all data at level equal or larger than skip level ! Error maybe? if (X%error) then call xmlparse_error ('Error parsing xml line') S%error = rads_err_xml_parse exit endif ! Check if we need to skip this level ! This level will be skipped when all three of the following are true ! a) Tag contains attribute "sat=" ! b) The attribute value contains the satellite abbreviaton, or ! the attribute value starts with "!" and does not contain the satellite abbreviation ! (In both cases "*.r" matches all branches with extension ".r") ! c) The satellite abbreviation is not set to "??" ! ! Example 1: for original TOPEX (tx) ! sat="tx" => pass ! sat="tx.r" => skip ! sat="*.r" => skip ! sat="j1" => skip ! sat="j1 tx" => pass ! sat="!j1" => pass ! sat="!j1 tx" => skip ! ! Example 2: for TOPEX Retracked (tx.r) ! sat="tx" => pass ! sat="tx.r" => pass ! sat="*.r" => pass ! sat="!j1" => pass ! sat="!tx" => skip ! sat="!tx.r" => skip ! ! Additionally: check for var="name" option. This will temporarily overrule var and info. ! They are reset to var_block and info_block on the next cycle of the loop. skip = 0 skip_level = 0 do i = 1,nattr select case (attr(1,i)) case ('sat') if (skip == 0) skip = 1 if (S%sat == '??') then skip = -1 else if ((attr(2,i)(:1) == '!') .eqv. & (index(attr(2,i),S%sat//' ') == 0 .and. index(attr(2,i),trim(S%branch(1))//' ') == 0 & .and. index(attr(2,i),'*'//trim(S%branch(1)(3:))//' ') == 0)) then skip=-1 endif case ('var') var => rads_varptr (S, attr(2,i), null()) info => var%info end select enddo if (skip == 1 .and. skip_level == 0) then skip_level = X%level cycle endif select case (tag) case ('global_attributes') allocate (S%glob_att(nval)) S%glob_att = val(1:nval) case ('satellites') call sat_translate case ('satellite') S%satellite = val(1)(:8) case ('satid') read (val(:nval), *, iostat=ios) S%satid case ('phase') if (has_name()) then phase => rads_init_phase (S, name) phase%name = attr(2,1)(:rads_varl) endif case ('mission') phase%mission = val(1)(:rads_varl) case ('cycles') read (val(:nval), *, iostat=ios) phase%cycles case ('exclude_cycles') allocate (S%excl_cycles) S%excl_cycles%list = -1 read (val(:nval), *, iostat=ios) S%excl_cycles%list S%excl_cycles%n = count(S%excl_cycles%list /= -1) case ('subcycles') allocate (phase%subcycles) phase%subcycles%list = 0 phase%subcycles%i = 1 do i = 1,nattr if (attr(1,i) == 'start') read (attr(2,i), *, iostat=ios) phase%subcycles%i enddo read (val(:nval), *, iostat=ios) phase%subcycles%list ! Turn length of subcycles in passes into number of accumulative passes before subcycle phase%subcycles%n = count(phase%subcycles%list /= 0) phase%passes = maxval(phase%subcycles%list) do i = phase%subcycles%n, 2, -1 phase%subcycles%list(i) = sum(phase%subcycles%list(1:i-1)) enddo phase%subcycles%list(1) = 0 case ('ref_pass') ! First part is a date string, at least 19 characters long i = index(val(1),' ') ! Position of first space phase%ref_time = strp1985f(val(1)(:i-1)) phase%ref_pass = 1 phase%ref_orbit = 1 read (val(1)(i:), *, iostat=ios) phase%ref_lon, phase%ref_cycle, phase%ref_pass, phase%ref_orbit case ('start_time') phase%start_time = strp1985f(val(1)) case ('end_time') phase%end_time = strp1985f(val(1)) case ('repeat') phase%repeat_shift = 0d0 read (val(:nval), *, iostat=ios) phase%repeat_days, phase%repeat_passes, phase%repeat_shift ! Compute length of repeat in nodal days from inclination and repeat in solar days ! This assumes 1000 km altitude to get an approximate node rate (in rad/s) node_rate = -1.21306d-6 * cos(S%inclination*rad) phase%repeat_nodal = nint(phase%repeat_days * (7.292115d-5 - node_rate) / 7.272205d-5) ! Determine length in seconds of single pass phase%pass_seconds = phase%repeat_days * 86400d0 / phase%repeat_passes phase%passes = phase%repeat_passes case ('dt1hz') read (val(:nval), *, iostat=ios) S%dt1hz case ('inclination') read (val(:nval), *, iostat=ios) S%inclination case ('frequency') read (val(:nval), *, iostat=ios) S%frequency case ('xover_params') read (val(:nval), *, iostat=ios) S%xover_params case ('alias') if (associated(var)) then ! Within <var> block, we do not need "name" attribute call rads_set_alias (S, var%name, var%name // ' ' // val(1), field) else if (has_name (field)) then call rads_set_alias (S, name, val(1), field) endif case ('var') if (has_name (field)) then var_block => rads_varptr (S, name, null()) info_block => var_block%info if (any(field > rads_nofield)) var_block%field = field endif case ('long_name') call assign_or_append (info%long_name) case ('standard_name') info%standard_name = val(1)(:rads_naml) select case (val(1)) case ('time') info%datatype = rads_type_time case ('latitude') info%datatype = rads_type_lat case ('longitude') info%datatype = rads_type_lon case ('dimension') info%datatype = rads_type_dim info%standard_name = '' ! Do not use this as standard name case ('sea_surface_height_above_sea_level') info%datatype = rads_type_sla case default info%datatype = rads_type_other end select case ('source') info%source = val(1)(:rads_naml) case ('parameters') info%parameters = val(1)(:rads_naml) case ('units') info%units = val(1)(:rads_varl) case ('flag_masks') call assign_or_append (info%flag_meanings) info%datatype = rads_type_flagmasks case ('flag_values') call assign_or_append (info%flag_meanings) info%datatype = rads_type_flagvalues case ('comment') call assign_or_append (info%comment) case ('backup') call rads_message (trim(var%name)//': <backup> deprecated, use <default> for value, or <alias> for variable') case ('default') info%default = huge(0d0) ! Set to default first read (val(:nval), *, iostat=ios) info%default case ('quality_flag') call assign_or_append (info%quality_flag) case ('format') call rads_set_format (S, var%name, val(1)) case ('compress') call rads_set_compress (S, var%name, val(1)) case ('limits') ! Do not use routine rads_set_limits here! if (all(val == '')) info%limits = nan ! Reset limits to none if none given if (var%name == 'time') then i = index(val(1),' ') ! Position of first space info%limits(1) = strp1985f(val(1)(:i-1)) info%limits(2) = strp1985f(val(1)(i+1:)) else read (val(:nval), *, iostat=ios) info%limits ! If we have an old-fashioned flagword, convert it to limits of single flags if (var%name == 'flags') call rads_set_limits_by_flagmask (S, info%limits) endif case ('plot_range') read (val(:nval), *, iostat=ios) info%plot_range case ('data') call assign_or_append (info%dataname) src = '' do i = 1, nattr select case (attr(1,i)) case ('source') src = attr(2,i)(:6) case ('branch') ! 'branch' can be like '.20hz' do j = 1, rads_max_branches if (S%branch(j) == S%sat//attr(2,i)) then exit else if (S%branch(j) == '') then S%branch(j) = S%sat//attr(2,i)(:rads_varl-2) exit endif enddo if (j > rads_max_branches) call rads_exit ('Too many branches: '//trim(attr(2,i))) info%brid = j end select enddo ! Work out which data source select case (src) case ('constant') info%datasrc = rads_src_constant case ('grid', 'grid_l') info%datasrc = rads_src_grid_lininter case ('grid_s', 'grid_c') info%datasrc = rads_src_grid_splinter case ('grid_n', 'grid_q') info%datasrc = rads_src_grid_query case ('math') info%datasrc = rads_src_math case ('netcdf', 'nc_var', 'nc_att', 'nc') info%datasrc = rads_src_nc_var if (index(info%dataname,':') > 0) info%datasrc = rads_src_nc_att case ('flags') info%datasrc = rads_src_flags case ('tpj') info%datasrc = rads_src_tpj case default ! Make "educated guess" of data source if (index(info%dataname,'.nc') > 0) then info%datasrc = rads_src_grid_lininter else if (index(trim(info%dataname),' ') > 0) then info%datasrc = rads_src_math else if (index(info%dataname,':') > 0) then info%datasrc = rads_src_nc_att else if (is_number(info%dataname)) then info%datasrc = rads_src_constant else info%datasrc = rads_src_nc_var endif end select ! Additional stuff to do for grids if (info%datasrc / 10 * 10 == rads_src_grid_lininter) then info%gridx = 'lon' info%gridy = 'lat' do i = 1,nattr select case (attr(1,i)) case ('x') info%gridx = attr(2,i)(:rads_varl) case ('y') info%gridy = attr(2,i)(:rads_varl) end select enddo allocate (info%grid) call parseenv (val(1), info%grid%filenm) info%grid%ntype = 0 ! This signals that the grid was not loaded yet endif case ('dimensions') read (val(:nval), *, iostat=ios) info%ndims case ('if', 'elseif', 'else', '!--') ! Dummy and comment tags ! FOR BACKWARD COMPATIBILITY, here are tags <netcdf>, <math> and <grid> case ('netcdf') info%datasrc = rads_src_nc_var info%dataname = val(1) if (index(info%dataname, ':') > 0) info%datasrc = rads_src_nc_att case ('math') call assign_or_append (info%dataname) info%datasrc = rads_src_math case ('grid') info%datasrc = rads_src_grid_lininter info%gridx = 'lon' ; info%gridy = 'lat' do i = 1,nattr select case (attr(1,i)) case ('x') info%gridx = attr(2,i)(:rads_varl) case ('y') info%gridy = attr(2,i)(:rads_varl) case ('inter') if (attr(2,i)(:1) == 'c') info%datasrc = rads_src_grid_splinter if (attr(2,i)(:1) == 'q') info%datasrc = rads_src_grid_query end select enddo allocate (info%grid) call parseenv (val(1), info%grid%filenm) info%grid%ntype = 0 ! This signals that the grid was not loaded yet case default call xmlparse_error ('Unknown tag <'//trim(tag)//'>') end select enddo ! Close XML file call xml_close (X) if (X%level > 0) call xmlparse_error ('Did not close tag <'//trim(tags(X%level))//'>') if (S%error > rads_noerr) call rads_exit ('Fatal errors occurred while parsing XML file '//trim(filename)) contains logical function has_name (field) integer(twobyteint), optional :: field(2) integer :: i, ios name = '' if (present(field)) field = rads_nofield do i = 1,nattr if (attr(1,i) == 'name') then name = attr(2,i)(:rads_varl) else if (present(field) .and. attr(1,i) == 'field') then read (attr(2,i), *, iostat=ios) field endif enddo has_name = (name /= '') if (.not.has_name) call xmlparse_error ('Tag <'//trim(tag)//'> requires ''name'' attribute') end function has_name subroutine assign_or_append (string) ! Assign or append concatenation of val(1:nval) to string character(len=*), intent(inout) :: string integer :: i, j, l character(len=8) :: action ! Check for "action=" action = 'replace' do i = 1,nattr if (attr(1,i) == 'action') action = attr(2,i)(:8) enddo select case (action) case ('replace') ! Remove current content, then append new content string = '' case ('append') ! Append new content case ('delete') ! Delete from current content that what matches new content do i = 1,nval l = len_trim(val(i)) j = index(string, val(i)(:l)) if (j == 0) cycle if (string(j+l:j+l) == ' ') l = l + 1 ! Remove additional space string(j:) = string(j+l:) enddo return case ('merge') ! Append new content only if it is not yet in current content do i = 1,nval l = len_trim(val(i)) if (index(string, val(i)(:l)) > 0) cycle if (string == '') then string = val(i) else string = trim(string) // ' ' // val(i) endif enddo return case default call xmlparse_error ('Unknown option "action='//trim(action)//'"') end select ! Append strings val(:) if (nval == 0) return j = 1 if (string == '') then string = val(1) j = 2 endif do i = j,nval string = trim(string) // ' ' // val(i) enddo end subroutine assign_or_append subroutine xmlparse_error (string) ! Issue error message with file name and line number character(len=*), intent(in) :: string character(rads_naml) :: text write (text, 1300) trim(filename), X%lineno, string call rads_error (S, rads_err_xml_parse, text) 1300 format ('Error parsing file ',a,' at or near line ',i0,': ',a) end subroutine xmlparse_error subroutine sat_translate integer :: i, j, l ! Translate the given satellite identifier into sat, tree, phase. ! Start with S%spec given on command line. ! It will be replaced by the mission phase, if any. ! ! If three characters, this may be like "e2g". ! Check if the first two characters match the list. l = len_trim(S%spec) if (l == 3) then do i = 1,nval if (S%spec(1:2) /= val(i)(1:2)) cycle S%sat = val(i)(1:2) S%spec = S%spec(3:3) ! Phase part return enddo endif ! If we have a '/' or ':' or '.', then separate specification j = scan(S%spec,'/:.') if (j > 0) l = j - 1 ! Now scan for matching strings (beginning of string only) do i = 1,nval if (index(' '//val(i), ' '//strtolower(S%spec(:l))) == 0) cycle S%sat = val(i)(1:2) S%spec = S%spec(l+1:) ! Everything after <sat> j = scan(S%spec,'/:') if (j == 0) then ! No phase indication S%branch(1) = S%sat//S%spec(:rads_varl-2) S%spec = '' else ! With phase indication S%branch(1) = S%sat//S%spec(:j-1) S%spec = S%spec(j+1:) endif return enddo call rads_exit ('No satellite found based on specification "'//trim(S%spec)//'"') end subroutine sat_translate end subroutine rads_read_xml !****if* rads/rads_varptr ! SUMMARY ! Returns the pointer to a given variable ! ! SYNOPSIS function rads_varptr (S, varname, tgt) result (ptr) use netcdf type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: varname type(rads_var), intent(in), pointer, optional :: tgt type(rads_var), pointer :: ptr ! ! PURPOSE ! This function returns a pointer to the structure of type(rads_var) ! pointing to an element of the list of variables S%var. ! ! If the variable with the name <varname> is not available, it will either ! return a NULL pointer or create a new variable and return its pointer, ! depending on whether the optional argument <tgt> is given. ! ! The presence of <tgt> determines how the routine deals with ! non-existent variables. ! 1. When no <tgt> argument is given: ! - When <varname> exists: Return pointer to its structure ! - Otherwise: Return a NULL pointer ! 2. When <tgt> is a NULL pointer: ! - When <varname> exists: Return pointer to its structure ! - Otherwise: Initialize a new variable and return its pointer ! 3. When <tgt> is an associated pointer: ! - When <varname> exists: Remove its current info structure (unless ! it is an alias), redirect it to the info structure of <tgt>, ! and return its pointer ! - Otherwise: Initialize a new variable, copy the info pointer ! from <tgt> and return its pointer ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! varname : Name of the RADS variable ! tgt : (optional) target pointer (see above) ! rads_varptr : Pointer to the structure for <varname> ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var !****------------------------------------------------------------------- integer(fourbyteint) :: i, n type(rads_var), pointer :: temp(:) integer(twobyteint) :: field character(len=rads_varl), pointer :: name character(len=rads_naml), pointer :: long_name S%error = rads_noerr field = -999 ! If variable name is numerical, look for field number if (varname(1:1) >= '0' .and. varname(1:1) <= '9') then read (varname, *, iostat=i) field do i = 1,S%nvar if (any(S%var(i)%field == field)) exit enddo else ! Look for the matching variable name do i = 1,S%nvar if (S%var(i)%name(1:1) /= varname(1:1)) then cycle else if (S%var(i)%name == varname) then ! Match found: assign info and return exit endif enddo endif if (i <= S%nvar) then ! Match was found: return pointer ptr => S%var(i) if (.not.present(tgt)) then ! No association requested return else if (.not.associated(tgt)) then ! No association requested return else if (associated(ptr%info,tgt%info)) then ! Association is already a fact return endif ! Reassociate existing variable call rads_free_var_struct (S, ptr, .true.) else if (.not.present(tgt)) then ! No match found, and none should be created: return null pointer and error nullify (ptr) call rads_error (S, rads_err_var, 'No variable "'//trim(varname)//'" was defined for "'//trim(S%branch(1))//'"') return else ! If we got here, we need to make a new variable. Do we also need to allocate more space? n = size(S%var) if (i > n) then allocate (temp(n + rads_var_chunk)) temp(1:n) = S%var temp(n+1:n+rads_var_chunk) = rads_var (null(), null(), null(), null(), null(), .false., rads_nofield) deallocate (S%var) S%var => temp if (rads_verbose >= 3) write (*,'(a,2i5)') 'Increased S%var:',n,n+rads_var_chunk endif S%nvar = i ptr => S%var(i) endif ! Assign the info struct to that of tgt or make a new one if (associated(tgt)) then ptr%info => tgt%info allocate (name) else allocate (ptr%info) ptr%info = rads_varinfo (varname, varname, '', '', '', '', '', '', '', '', 'f0.3', '', '', null(), & huge(0d0), nan, nan, 0d0, 1d0, nan, nan, 0d0, 0d0, .false., 1, 1, nf90_double, 0, 0, 0, 0, 0, 0, 0) name => ptr%info%name endif long_name => ptr%info%long_name ! This is to avoid warning in gfortran 4.8 ! Assign name and long_name ptr%name => name ptr%long_name => long_name if (field > rads_nofield) then ! Was given field number write (ptr%name, '("f",i4.4)') field ptr%field = field else ptr%name = varname endif end function rads_varptr !****f* rads/rads_set_alias ! SUMMARY ! Set alias to an already defined variable ! ! SYNOPSIS subroutine rads_set_alias (S, alias, varname, field) use rads_misc type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: alias, varname integer(twobyteint), intent(in), optional :: field(2) ! ! PURPOSE ! This routine defines an alias to an existing variable, or up to three ! variables. When more than one variable is given as target, they will ! be addressed one after the other. ! If alias is already defined as an alias or variable, it will be overruled. ! The alias will need to point to an already existing variable or alias. ! Up to three variables can be specified, separated by spaces or commas. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! alias : New alias for (an) existing variable(s) ! varname : Existing variable name(s) ! field : (optional) new field numbers to associate with alias ! ! ERROR CODE ! S%error : rads_noerr, rads_err_alias, rads_err_var !****------------------------------------------------------------------- type(rads_var), pointer :: tgt, src integer :: i0, i1, n_alias, l0, l1, l2, i character(len=rads_naml), pointer :: long_name S%error = rads_noerr ! Check that neither alias not varname is empty if (alias == '') then call rads_error (S, rads_err_alias, 'Alias is empty') return else if (varname == '') then call rads_error (S, rads_err_var, 'Variable name is empty') return endif ! Now loop through the string <varname> to find variable names i1 = 0 n_alias = 0 nullify (src) do if (.not.next_word (varname, i0, i1)) exit n_alias = n_alias + 1 if (i1 == i0) cycle tgt => rads_varptr (S, varname(i0:i1-1)) if (.not.associated(tgt)) then call rads_error (S, rads_err_var, 'Alias target "'//varname(i0:i1-1)//'" of "'//trim(alias)//'" not found') return endif if (.not.associated(src)) src => rads_varptr (S, alias, tgt) select case (n_alias) case (1) ! First alias if (S%error == rads_err_alias) then call rads_error (S, rads_err_alias, 'Cannot alias "'//trim(alias)//'"; it is used by other variables') return endif if (present(field)) then if (any(field /= rads_nofield)) src%field = field endif nullify (src%inf1, src%inf2) case (2) ! Second alias src%inf1 => tgt%info case (3) ! Third alias src%inf2 => tgt%info case default call rads_error (S, rads_err_alias, 'Too many aliases for "'//trim(alias)//'"') return end select enddo ! Reset long_name to a mix of long_names if (n_alias < 2) return l0 = len_trim(src%info%long_name) l1 = len_trim(src%inf1%long_name) i0 = 0 do i = 0,min(l0,l1)-1 if (src%info%long_name(l0-i:l0-i) /= src%inf1%long_name(l1-i:l1-i)) exit if (src%info%long_name(l0-i:l0-i) == ' ') i0 = i + 1 enddo allocate (long_name) if (n_alias == 3) then l2 = len_trim(src%inf2%long_name) long_name = src%info%long_name(1:l0-i0) // ', ' // src%inf1%long_name(1:l1-i0) // & ', ' // src%inf2%long_name(1:l2-i0) // src%info%long_name(l0-i0+1:l0) else long_name = src%info%long_name(1:l0-i0) // ', ' // src%inf1%long_name(1:l1-i0) // & src%info%long_name(l0-i0+1:l0) endif src%long_name => long_name end subroutine rads_set_alias !****f* rads/rads_set_limits ! SUMMARY ! Set limits on given variable ! ! SYNOPSIS subroutine rads_set_limits (S, varname, lo, hi, string, iostat) use rads_misc type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: varname real(eightbytereal), intent(in), optional :: lo, hi character(len=*), intent(in), optional :: string integer(fourbyteint), intent(out), optional :: iostat ! ! PURPOSE ! This routine set the lower and upper limits for a given variable in ! RADS. ! The limits can either be set by giving the lower and upper limits ! as double floats <lo> and <hi> or as a character string <string> which ! contains the two numbers separated by whitespace, a comma or a slash. ! In case only one number is given, only the lower or higher bound ! (following the separator) is set, the other value is left unchanged. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! varname : Variable name ! lo, hi : Lower and upper limit ! string : String of up to two values, with separating whitespace ! or comma or slash. ! iostat : (optional) iostat code from reading string ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var !****------------------------------------------------------------------- type(rads_var), pointer :: var var => rads_varptr (S, varname) if (.not.associated(var)) return call rads_set_limits_info (var%info) call rads_set_limits_info (var%inf1) call rads_set_limits_info (var%inf2) contains subroutine rads_set_limits_info (info) type(rads_varinfo), pointer :: info if (.not.associated(info)) return if (present(lo)) info%limits(1) = lo if (present(hi)) info%limits(2) = hi if (.not.present(string)) then else if (string == '') then ! Reset limits to none info%limits = nan else ! Read limits (only change the ones given) call read_val (string, info%limits, '/', iostat=iostat) endif if (info%datatype == rads_type_lat .or. info%datatype == rads_type_lon) then ! If latitude or longitude limits are changed, recompute equator longitude limits call rads_traxxing (S) else if (info%datatype == rads_type_time) then ! If time limits are changed, also limit the cycles if (isan_(info%limits(1))) S%cycles(1) = max(S%cycles(1), rads_time_to_cycle (S, info%limits(1))) if (isan_(info%limits(2))) S%cycles(2) = min(S%cycles(2), rads_time_to_cycle (S, info%limits(2))) else if (var%name == 'flags') then call rads_set_limits_by_flagmask (S, info%limits) endif end subroutine rads_set_limits_info end subroutine rads_set_limits !****if* rads/rads_set_limits_by_flagmask ! SUMMARY ! Set limits based on flagmask ! ! SYNOPSIS subroutine rads_set_limits_by_flagmask (S, limits) type(rads_sat), intent(inout) :: S real(eightbytereal), intent(inout) :: limits(2) !****------------------------------------------------------------------- integer :: i, ios, mask(2), bits(2) mask = 0 where (limits == limits) mask = nint(limits) ! Because it is not guaranteed for every compiler that nint(nan)=0 ! Loop through all variables to find those with field between 2501 and 2516 do i = 1,S%nvar if (.not.any(S%var(i)%field >= 2501 .and. S%var(i)%field <= 2516)) cycle bits = (/0,1/) ! Default values read (S%var(i)%info%dataname, *, iostat=ios) bits if (S%var(i)%info%dataname == 'surface_type') then ! Special setting to get surface type from bits 2, 4, 5 ! 0=ocean, 2=enclosed seas and lakes, 3=land, 4=continental ice ! I am keeping 1 for coastal in future S%var(i)%info%limits = 0 if (btest(mask(1),5)) then S%var(i)%info%limits(2) = 1 ! ocean only else if (btest(mask(1),4)) then S%var(i)%info%limits(2) = 2 ! water only else if (btest(mask(1),2)) then S%var(i)%info%limits(2) = 3 ! anything but ice endif if (btest(mask(2),2)) then S%var(i)%info%limits(1) = 4 ! ice only else if (btest(mask(2),4)) then S%var(i)%info%limits(1) = 3 ! land or ice else if (btest(mask(2),5)) then S%var(i)%info%limits(1) = 2 ! non-ocean endif else if (S%var(i)%info%datatype == rads_type_flagmasks) then if (all(ibits(mask,bits(1),bits(2)) == 0)) cycle S%var(i)%info%limits(1) = ibits(mask(1),bits(1),bits(2)) S%var(i)%info%limits(2) = ibits(mask(2),bits(1),bits(2)) else ! rads_type_flagvalues if (all(ibits(mask,bits(1),bits(2)) == 0)) cycle S%var(i)%info%limits(2) = ibits(not(mask(1)),bits(1),bits(2)) S%var(i)%info%limits(1) = ibits(mask(2),bits(1),bits(2)) endif enddo end subroutine rads_set_limits_by_flagmask !****f* rads/rads_set_region ! SUMMARY ! Set latitude/longitude limits or distance to point ! ! SYNOPSIS subroutine rads_set_region (S, string) use rads_misc type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: string ! ! PURPOSE ! This routine set the region for data selection (after the -R option). ! The region can either be specified as a box by four values "W/E/S/N", ! or as a circular region by three values "E/N/radius". Separators ! can be commas, slashes, or whitespace. ! ! In case of a circular region, longitude and latitude limits are set ! accordingly for a rectangular box surrounding the circle. However, when ! reading pass data, the distance to the centroid is used as well to ! edit out data. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! string : String of three or four values with separating whitespace. ! For rectangular region: W/E/S/N. ! For circular region: E/N/radius (radius in degrees). ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var !****------------------------------------------------------------------- real(eightbytereal) :: r(4), x r = nan call read_val (string, r, '/') if (isnan_(r(4))) then ! Circular region r(3) = abs(r(3)) ! For longitude limits, do some trigonometry to determine furthest meridians x = sin(r(3)*rad) / cos(r(2)*rad) if (r(3) < 90d0 .and. x >= 0d0 .and. x <= 1d0) then x = asin(x)/rad else ! Circle includes either pole x = 180d0 endif S%lon%info%limits = r(1) + (/ -x, x /) ! For latitude limits, add and subtract radius from centroid latitude S%lat%info%limits(1) = max(-90d0,r(2)-r(3)) S%lat%info%limits(2) = min( 90d0,r(2)+r(3)) ! Convert longitude, latitude and radius from degrees to radians S%centroid = r(1:3)*rad else ! Rectangular region S%lon%info%limits = r(1:2) S%lat%info%limits = r(3:4) endif call rads_traxxing (S) end subroutine rads_set_region !****f* rads/rads_set_format ! SUMMARY ! Set print format for ASCII output of given variable ! ! SYNOPSIS subroutine rads_set_format (S, varname, format) type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: varname, format ! ! PURPOSE ! This routine set the FORTRAN format specifier of output of a given ! variable in RADS. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! varname : Variable name ! format : FORTRAN format specifier (e.g. 'f10.3') ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var !****------------------------------------------------------------------- type(rads_var), pointer :: var var => rads_varptr(S, varname) if (.not.associated(var)) return var%info%format = format var%info%boz_format = (index('bozBOZ',var%info%format(:1)) > 0) end subroutine rads_set_format !****if* rads/rads_set_compress ! SUMMARY ! Set format for binary storage of given variable ! ! SYNOPSIS subroutine rads_set_compress (S, varname, format) use netcdf type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: varname, format ! ! PURPOSE ! This routine set the format specification for binary storage of a ! variable in RADS. The specification has the form: type[,scale[,offset]] ! where ! - 'type' is one of: int1, byte, int2, short, int4, int, real, real4, ! dble, double ! - 'scale' is the scale to revert the binary back to a float (optional) ! - 'offset' is the offset to add to the result when unpacking (optional) ! Instead of commas, spaces or slashes can be used as separators. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! varname : Variable name ! format : Binary storage specification (e.g. int2,1e-3) ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var !****------------------------------------------------------------------- character(len=len(format)) :: temp integer :: i, ios type(rads_var), pointer :: var var => rads_varptr(S, varname) var%info%scale_factor = 1d0 var%info%add_offset = 0d0 do i = 1,len(format) if (format(i:i) == ',' .or. format(i:i) == '/') then temp(i:i) = ' ' else temp(i:i) = format(i:i) endif enddo i = index(temp, ' ') select case (temp(:i-1)) case ('int1', 'byte') var%info%nctype = nf90_int1 case ('int2', 'short') var%info%nctype = nf90_int2 case ('int4', 'int') var%info%nctype = nf90_int4 case ('real', 'real4', 'float') var%info%nctype = nf90_real case default var%info%nctype = nf90_double end select read (temp(i+1:), *, iostat=ios) var%info%scale_factor, var%info%add_offset end subroutine rads_set_compress !****if* rads/rads_set_quality_flag ! SUMMARY ! Set quality flag(s) for given variable ! ! SYNOPSIS subroutine rads_set_quality_flag (S, varname, flag) type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: varname, flag ! ! PURPOSE ! This routine set appends <flag> to the variables contained in the set ! of variables to check to allow variable <varname> to pass (if <flag> is ! not already contained in that set). ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! varname : Variable name ! flag : Name of the variable that needs to be checked to validate ! <varname>. ! ! ERROR CODE ! S%error : rads_noerr, rads_err_var !****------------------------------------------------------------------- type(rads_var), pointer :: var var => rads_varptr(S, varname) if (.not.associated(var)) then return else if (var%info%quality_flag == '') then var%info%quality_flag = flag else if (index(var%info%quality_flag,flag) == 0) then var%info%quality_flag = trim(var%info%quality_flag) // ' ' // flag endif end subroutine rads_set_quality_flag !****if* rads/rads_long_name_and_units ! SUMMARY ! Get string of long_name and units (or flag_meanings) ! ! SYNOPSIS subroutine rads_long_name_and_units (var, unit) use rads_misc type(rads_var), intent(in) :: var integer(fourbyteint), optional, intent(in) :: unit ! ! PURPOSE ! This writes to the output file attached to <unit> the long_name and units (or ! flag_meanings) of a variable. The output can be one of the following: ! long_name [units] ! long_name [bits: flag_meanings] ! long_name [values: flag_meanings] ! ! ARGUMENTS ! var : Pointer to variable ! unit : Fortran output unit (6 = stdout (default), 0 = stderr) !****------------------------------------------------------------------- integer :: iunit, i, i0, i1 iunit = stdout if (present(unit)) iunit = unit write (iunit,550,advance='no') trim(var%long_name) // ' [' if (var%info%datatype == rads_type_flagmasks) then write (iunit,550,advance='no') 'bits:' else if (var%info%datatype == rads_type_flagvalues) then write (iunit,550,advance='no') 'values:' else write (iunit,550) trim(var%info%units) // ']' return endif i1 = 0 i = 0 do if (.not.next_word (var%info%flag_meanings, i0, i1)) exit if (i1 == i0) cycle write (iunit,551,advance='no') i,var%info%flag_meanings(i0:i1-1) i = i + 1 enddo write (iunit,550) ']' 550 format (a) 551 format (1x,i0,'=',a) end subroutine rads_long_name_and_units !****if* rads/rads_stat_0d ! SUMMARY ! Print the RADS statistics for a given satellite ! ! SYNOPSIS subroutine rads_stat_0d (S) use rads_time type(rads_sat), intent(in) :: S ! ! PURPOSE ! This is the scalar version of rads_stat. !****------------------------------------------------------------------- integer(fourbyteint) :: i write (rads_log_unit, 700) write (rads_log_unit, 710) trim(S%satellite), S%sat, timestamp(), trim(S%command) write (rads_log_unit, 720) 'PASSES QUERIED', sum(S%pass_stat) write (rads_log_unit, 724) 'REJECTED','SELECTED','LOWER','UPPER','STEP' write (rads_log_unit, 730) 'Cycle number limits', S%pass_stat(1), sum(S%pass_stat(2:7)), S%cycles write (rads_log_unit, 730) 'Pass number limits' , S%pass_stat(2), sum(S%pass_stat(3:7)), S%passes write (rads_log_unit, 731) 'Time limits' , S%pass_stat(3), sum(S%pass_stat(4:7)), datestring (S%time%info%limits) write (rads_log_unit, 732) 'Equator longitude limits (asc)' , S%pass_stat(5:7:2), S%eqlonlim(1,:) write (rads_log_unit, 732) 'Equator longitude limits (des)' , S%pass_stat(4:6:2), S%eqlonlim(0,:) write (rads_log_unit, 721) 'PASSES AND MEASUREMENTS READ', sum(S%pass_stat(6:7)), S%total_read write (rads_log_unit, 724) 'REJECTED','SELECTED','LOWER','UPPER','MIN',' MAX','MEAN','STDDEV' call rads_stat_line (S%time) call rads_stat_line (S%lat) call rads_stat_line (S%lon) write (rads_log_unit, 720) 'MEASUREMENTS IN REQUESTED PERIOD AND REGION', S%total_inside write (rads_log_unit, 724) 'REJECTED','SELECTED','LOWER','UPPER','MIN',' MAX','MEAN','STDDEV' do i = 1,S%nvar if (.not.associated(S%var(i)%info)) then ! Skip undefined variables else if (S%var(i)%info%selected + S%var(i)%info%rejected == 0) then ! Skip "unused" variables else if (S%var(i)%info%datatype >= rads_type_time) then ! Skip time, lat, lon else if (S%var(i)%name /= S%var(i)%info%name) then ! Skip aliases else ! Print statistics line for whatever remains call rads_stat_line (S%var(i)) endif enddo write (rads_log_unit, 700) 700 format (134('#')) 710 format ('# Editing statistics for ',a,' (',a,')'/'# Created: ',a,' UTC: ',a) 720 format ('#'/'# ',a,t53,i10/'#') 721 format ('#'/'# ',a,t43,2i10/'#') 724 format ('#',t43,2a10,6a12) 730 format ("# ",a,t43,2i10,3i12) 731 format ("# ",a,t43,2i10,2a) 732 format ("# ",a,t43,2i10,2f12.3) contains subroutine rads_stat_line (var) type(rads_var), intent(in) :: var real(eightbytereal), parameter :: sec2000 = 473299200d0 type(rads_varinfo), pointer :: info info => var%info write (rads_log_unit, '("# ",a," [",a,"]",t43,2i10)', advance='no') trim(var%long_name), trim(info%units), & info%rejected, info%selected if (info%units(:13) /= 'seconds since') then write (rads_log_unit, '(6f12.3)') info%limits, info%xmin, info%xmax, info%mean, sqrt(info%sum2/(info%selected-1)) else if (info%units(15:18) == '1985') then write (rads_log_unit, '(5a,f12.0)') datestring (info%limits), datestring(info%xmin), datestring(info%xmax), & datestring(info%mean), sqrt(info%sum2/(info%selected-1)) else write (rads_log_unit, '(5a,f12.0)') datestring (info%limits+sec2000), datestring(info%xmin+sec2000), & datestring(info%xmax+sec2000), datestring(info%mean+sec2000), sqrt(info%sum2/(info%selected-1)) endif end subroutine rads_stat_line elemental function datestring (sec) use rads_time real(eightbytereal), intent(in) :: sec character(len=12) :: datestring integer(fourbyteint) :: yy, mm, dd, hh, mn real(eightbytereal) :: ss if (sec /= sec) then datestring = ' NaN' else call sec85ymdhms(sec, yy, mm, dd, hh, mn, ss) write (datestring, '(1x,3i2.2,"/",2i2.2)') mod(yy,100), mm, dd, hh, mn endif end function datestring end subroutine rads_stat_0d subroutine rads_stat_1d (S) type(rads_sat), intent(in) :: S(:) integer :: i do i = 1,size(S) if (S(i)%sat /= '') call rads_stat_0d (S(i)) enddo end subroutine rads_stat_1d !****if* rads/rads_exit ! SUMMARY ! Exit RADS with error message ! ! SYNOPSIS subroutine rads_exit (string) character(len=*), intent(in) :: string ! ! PURPOSE ! This routine terminates RADS after printing an error message. ! ! ARGUMENT ! string : Error message !****------------------------------------------------------------------- character(len=rads_naml) :: progname call getarg (0, progname) call rads_message (string) call rads_message ('Use "'//trim(progname)//' --help" for more info') call exit (10) end subroutine rads_exit !****if* rads/rads_error ! SUMMARY ! Print error message and store error code ! ! SYNOPSIS subroutine rads_error (S, ierr, string, P) type(rads_sat), intent(inout) :: S integer(fourbyteint), intent(in) :: ierr character(len=*), intent(in) :: string type(rads_pass), intent(in), optional :: P ! ! PURPOSE ! This routine prints an error message and sets the error code. ! The message is subpressed when -q is used (rads_verbose < 0) ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! ierr : Error code ! string : Error message ! P : If used, it will add the pass file name at the end of <string> ! ! ERROR CODE ! S%error : Will be set to ierr when not rads_noerr !****------------------------------------------------------------------- call rads_message (string, P) if (ierr /= rads_noerr) S%error = ierr end subroutine rads_error !****if* rads/rads_message ! SUMMARY ! Print warning message ! ! SYNOPSIS subroutine rads_message (string, P) use rads_netcdf character(len=*), intent(in) :: string type(rads_pass), intent(in), optional :: P ! ! PURPOSE ! This routine prints a message to standard error. ! The message is subpressed when -q is used (rads_verbose < 0) ! ! ARGUMENTS ! string : Error message ! P : If used, it will add the pass file name at the end of <string> !****------------------------------------------------------------------- if (rads_verbose < 0) then ! Remain quiet else if (present(P)) then call nf90_message (trim(string) // ' ' // P%fileinfo(1)%name) else call nf90_message (string) endif end subroutine rads_message !****if* rads/rads_opt_error ! SUMMARY ! Print error message about failed option scanning ! ! SYNOPSIS subroutine rads_opt_error (opt, arg) character(len=*), intent(in) :: opt, arg ! ! PURPOSE ! This routine prints an error message to standard error in case RADS ! failed to identify or scan an option on the command line. ! The message is subpressed when -q is used (rads_verbose < 0) ! ! ARGUMENTS ! opt : Command line option ! arg : Argument of the command line option !****------------------------------------------------------------------- if (opt == ':') then ! Unknown option call rads_message ('Unknown option '//trim(arg)//' skipped') else if (opt == '::') then ! Missing required argument call rads_exit ('Option "'//trim(arg)//'" should be followed by a required argument') else if (len_trim(opt) == 1) then ! Short option call rads_exit ('Option "-'//trim(opt)//' '//trim(arg)//'" could not be parsed') else if (len_trim(opt) == 2 .and. opt(2:2) == ':') then ! Long option call rads_exit ('Option "--'//trim(opt(1:1))//' '//trim(arg)//'" could not be parsed') else ! Long option call rads_exit ('Option "--'//trim(opt)//' '//trim(arg)//'" could not be parsed') endif end subroutine rads_opt_error !****if* rads/rads_version ! SUMMARY ! Print message about current program and version ! ! SYNOPSIS logical function rads_version (description, unit, flag) character(len=*), intent(in), optional :: description, flag integer(fourbyteint), intent(in), optional :: unit ! ! PURPOSE ! This routine prints out a message in one of the following forms, ! on the first argument on the command line or the optional argument <flag>. ! 1) When first command line argument or <flag> is --version: ! "rads_program, version <number>" ! The program then terminates here. ! 2) When no <description> is given: ! "rads_program (v<number>)" ! Return value is .true. ! 3) When first command line argument or <flag> is -? or --help: ! "rads_program (v<number>): <description>" ! Return value is .false. ! 4) When first command line argument of <flag> is --head: ! "rads_program (v<number>): <description>" ! Return value is .true. ! 5) Otherwise: ! No output ! Return value is .true. ! ! ARGUMENTS ! description : One-line description of program ! unit : Fortran output unit (6 = stdout (default), 0 = stderr) ! flag : Use string in replacement of first command line argument ! ! RETURN VALUE ! rads_version: .false. if output is of type 3, otherwise .true. !****------------------------------------------------------------------- integer :: iunit character(len=rads_naml) :: progname, arg call getarg (0, progname) call getarg (1, arg) if (present(flag) .and. arg /= '--version' .and. arg /= '--help' .and. arg /= '-?' .and. arg /= '--head') arg = flag rads_version = .true. if (present(unit)) then iunit = unit else iunit = stdout endif if (arg == '--version') then write (iunit, 1320) trim(progname), trim(rads_version_id) stop else if (.not.present(description)) then write (iunit, 1300) trim(progname), trim(rads_version_id) else if (arg == '--help' .or. arg == '-?') then write (iunit, 1310) trim(progname), trim(rads_version_id), trim(description) rads_version = .false. else if (arg == '--head') then write (iunit, 1310) trim(progname), trim(rads_version_id), trim(description) endif 1300 format (a,' (',a,')') 1310 format (a,' (',a,'): ',a) 1320 format (a,', version ',a) end function rads_version !****if* rads/rads_synopsis ! SUMMARY ! Print general usage information for all RADS programs ! ! SYNOPSIS subroutine rads_synopsis (unit) integer(fourbyteint), intent(in), optional :: unit ! ! PURPOSE ! This routine prints out the usage information that is common to all ! RADS programs. ! ! ARGUMENTS ! unit : Fortran output unit (6 = stdout (default), 0 = stderr) !****------------------------------------------------------------------- integer :: iunit character(len=rads_naml) :: progname call getarg (0, progname) if (present(unit)) then iunit = unit else iunit = stdout endif write (iunit, 1300) trim(progname) 1300 format (/ & 'Usage: ',a,' [required_arguments] [rads_dataselectors] [rads_options] [program_options]' // & 'Required argument is:'/ & ' -S, --sat SAT[/PHASE] Specify satellite [and phase] (e.g. e1/g, tx)'// & 'Optional [rads_dataselectors] are:'/ & ' -A, --alias VAR1=VAR2 Use variable VAR2 when VAR1 is requested'/ & ' -C, --cycle C0[,C1[,DC]] Specify first and last cycle and modulo'/ & ' -F, --fmt, --format VAR=FMT'/ & ' Specify Fortran format used to print VAR (for ASCII output only)'/ & ' -L, --limits VAR=MIN,MAX Specify edit data range for variable VAR'/ & ' --lon LON0,LON1 Specify longitude boundaries (deg)'/ & ' --lat LAT0,LAT1 Specify latitude boundaries (deg)'/ & ' -P, --pass P0[,P1[,DP]] Specify first and last pass and modulo; alternatively use -Pa'/ & ' (--pass asc) or -Pd (--pass des) to restrict selection to'/ & ' ascending or descending passes only'/ & ' -Q, --quality-flag VAR=FLAG'/& ' Check variable FLAG when validating variable VAR'/ & ' -R, --region LON0,LON1,LAT0,LAT1'/ & ' Specify rectangular region (deg)'/ & ' -R, --region LON0,LAT0,RADIUS'/ & ' Specify circular region (deg)' / & ' --sla SLA0,SLA1 Specify range for SLA (m)'/ & ' --time T0,T1 Specify time selection (optionally use --ymd, --doy,'/ & ' or --sec for [YY]YYMMDD[HHMMSS], [YY]YYDDD, or SEC85)'/ & ' -V, --var VAR1,... Select variables to be read'/ & ' -X, --xml XMLFILE Load configuration file XMLFILE in addition to the defaults'/ & ' -Z, --cmp, --compress VAR=TYPE[,SCALE[,OFFSET]]'/ & ' Specify binary output format for variable VAR (NetCDF only); TYPE'/ & ' is one of: int1, int2, int4, real, dble; SCALE and OFFSET are'/ & ' optional (def: 1,0)'// & 'Still working for backward compatibility with RADS3 are options:'/ & ' --h H0,H1 Specify range for SLA (m) (now --sla H0,H1)'/ & ' --opt J Use field number J when J/100 requested (now -A VAR1=VAR2)'/ & ' --opt I=J Make field I (range 1-99) and alias for field J (now -A VAR1=VAR2)'/ & ' --sel VAR1,... Select variables to read'// & 'Common [rads_options] are:'/ & ' --args FILENAME Get all command line arguments from FILENAME (1 argument per line)'/ & ' --debug LEVEL Set debug/verbosity level'/ & ' --help Print this syntax massage'/ & ' --log FILENAME Send statistics to FILENAME (default is standard output)'/ & ' -q, --quiet Suppress warning messages (but keeps fatal error messages)'/ & ' -v, --verbose Increase verbosity level'/ & ' --version Print version info only'/ & ' -- Terminates all options; all following command-line arguments are'/ & ' considered non-option arguments, even if they begin with a hyphen') end subroutine rads_synopsis !****if* rads/rads_get_phase ! SUMMARY ! Add new mission phase and get pointer to satellite phase info ! ! SYNOPSIS function rads_init_phase (S, name) result (phase) type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: name type(rads_phase), pointer :: phase ! ! PURPOSE ! Create a new phase, adding it to the <S%phases> array and create ! the array if needed. Then create pointer to the phase definitions ! for this phase. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! name : Name of phase ! ! ERROR CODE: ! S%error : rads_noerr, rads_err_nophase !****------------------------------------------------------------------- integer(fourbyteint) :: n type(rads_phase), pointer :: temp(:) nullify (phase) n = 0 if (associated(S%phases)) n = size(S%phases) ! Allocate S%phases for the first time, or reallocate more space if (n == 0) then allocate (S%phases(1)) n = 1 else allocate (temp(n+1)) temp(1:n) = S%phases(1:n) deallocate (S%phases) S%phases => temp n = n + 1 endif ! Initialize the new phase information and direct the pointer S%phases(n) = rads_phase (name(1:1), '', (/999,0/), 0, nan, nan, nan, nan, 0, 0, 0, nan, nan, nan, 0, 0, null()) phase => S%phases(n) end function rads_init_phase subroutine rads_set_phase_by_name (S, name, error) type(rads_sat), intent(inout) :: S character(len=*), intent(in) :: name logical, optional, intent(out) :: error integer :: i if (present(error)) error = .false. S%error = rads_noerr ! Check if we are already in the right mission phase if (name(1:1) == S%phase%name(1:1)) return ! Check all mission phases do i = 1,size(S%phases) if (name(1:1) == S%phases(i)%name(1:1)) then S%phase => S%phases(i) return endif enddo if (present(error)) then error = .true. S%error = rads_err_nophase else call rads_exit ('No mission phase "'//trim(name)//'" for satellite "'//S%sat//'"') endif end subroutine rads_set_phase_by_name subroutine rads_set_phase_by_cycle (S, cycle, error) type(rads_sat), intent(inout) :: S integer(fourbyteint), intent(in) :: cycle logical, optional, intent(out) :: error integer :: i character(len=3) :: name if (present(error)) error = .false. S%error = rads_noerr ! Check if we are already in the right mission phase if (cycle >= S%phase%cycles(1) .and. cycle <= S%phase%cycles(2)) return ! Check all mission phases do i = 1,size(S%phases) if (cycle >= S%phases(i)%cycles(1) .and. cycle <= S%phases(i)%cycles(2)) then S%phase => S%phases(i) return endif enddo if (present(error)) then error = .true. S%error = rads_err_nophase else write (name, '(i3.3)') cycle call rads_exit ('No cycle '//name//' for any mission phase of satellite "'//S%sat//'"') endif end subroutine rads_set_phase_by_cycle subroutine rads_set_phase_by_time (S, time, error) use rads_time type(rads_sat), intent(inout) :: S real(eightbytereal), intent(in) :: time logical, optional, intent(out) :: error integer :: i if (present(error)) error = .false. S%error = rads_noerr ! Check if we are already in the right mission phase if (time >= S%phase%start_time .and. time <= S%phase%end_time) return ! Check all mission phases do i = 1,size(S%phases) if (time >= S%phases(i)%start_time .and. time <= S%phases(i)%end_time) then S%phase => S%phases(i) return endif enddo if (present(error)) then error = .true. S%error = rads_err_nophase else call rads_exit ('Time '//strf1985f(time)//' is outside any mission phase of satellite "'//S%sat//'"') endif end subroutine rads_set_phase_by_time !****f* rads/rads_predict_equator ! SUMMARY ! Predict equator crossing time and longitude ! ! SYNOPSIS subroutine rads_predict_equator (S, P, cycle, pass) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P integer(fourbyteint), intent(in) :: cycle, pass ! ! PURPOSE ! This routine estimates the equator time and longitude, as well ! as the start and end time of a given <cycle> and <pass>. ! ! The routine works for exact repeat orbits as well as drifting ! orbits. ! ! The estimated variables (equator_time, equator_lon, start_time, end_time) ! are returned in the pass struct <P>. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! cycle : Cycle number ! pass : Pass number ! ! ERROR CODE ! S%error : rads_noerr, rads_err_nophase !****------------------------------------------------------------------- integer(fourbyteint) :: cc, pp real(eightbytereal) :: d, e logical :: error ! If the cycle is out of range for the current phase, look for a new phase call rads_set_phase (S, cycle, error) if (error) return ! For constructions with subcycles, convert first to "real" cycle/pass number if (associated(S%phase%subcycles)) then cc = cycle - S%phase%subcycles%i pp = S%phase%subcycles%list(modulo(cc,S%phase%subcycles%n)+1) + pass cc = cc / S%phase%subcycles%n + 1 else cc = cycle pp = pass endif ! Now do the estimation process d = S%phase%pass_seconds P%equator_time = S%phase%ref_time + ((cc - S%phase%ref_cycle) * S%phase%repeat_passes + (pp - S%phase%ref_pass)) * d P%start_time = P%equator_time - 0.5d0 * d P%end_time = P%equator_time + 0.5d0 * d d = -S%phase%repeat_nodal * 360d0 / S%phase%repeat_passes ! Longitude advance per pass due to precession of node and earth rotation e = S%phase%repeat_shift * (P%equator_time - S%phase%ref_time) / S%phase%pass_seconds / S%phase%repeat_passes ! Longitude shift per cycle P%equator_lon = modulo(S%phase%ref_lon + (pp - S%phase%ref_pass) * d + e + modulo(pp - S%phase%ref_pass,2) * 180d0, 360d0) if (rads_verbose >= 4) write (*,'(a,3f15.3,f12.6)') 'Estimated start/end/equator time/longitude = ', & P%start_time, P%end_time, P%equator_time, P%equator_lon S%error = rads_noerr end subroutine rads_predict_equator !****if* rads/rads_time_to_cycle_pass ! SUMMARY ! Determine cycle and pass number for given epoch ! ! SYNOPSIS subroutine rads_time_to_cycle_pass (S, time, cycle, pass, abs_orbit) type(rads_sat), intent(inout) :: S real(eightbytereal), intent(in) :: time integer(fourbyteint), intent(out) :: cycle, pass integer(fourbyteint), intent(out), optional :: abs_orbit ! ! PURPOSE ! Given an epoch <time> in seconds since 1985, determine the <cycle> ! number and <pass> number in which that epoch falls. ! Optionally, the absolute orbit number at the equator (<abs_orbit>) ! can be computed. ! ! This routine also updates the <S%phase> pointer to point to the ! appropriate structure containing the phase information. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! time : Time in seconds since 1985 ! cycle : Cycle number in which <time> falls ! pass : Pass number in which <time> falls ! abs_orbit: Absolute orbit number (optional) !****------------------------------------------------------------------- integer :: i, j, n real(eightbytereal) :: d, t0, x ! Look for the appropriate phase i = 1 S%error = rads_noerr do i = 1,size(S%phases)-1 if (time < S%phases(i+1)%start_time) exit enddo ! Link the selected phase S%phase => S%phases(i) ! Estimate the cycle from the time d = S%phase%pass_seconds t0 = S%phase%ref_time - (S%phase%ref_pass - 0.5d0) * d ! Time of start of ref_cycle x = (time - t0) / (S%phase%repeat_days * 86400d0) + S%phase%ref_cycle cycle = floor(x) pass = int((x - cycle) * S%phase%repeat_passes + 1) if (present(abs_orbit)) then ! Compute the absolute orbit number (add 2*ref_orbit first to avoid dividing negative numbers) abs_orbit = (S%phase%ref_orbit * 2 + (cycle - S%phase%ref_cycle) * S%phase%repeat_passes + (pass - S%phase%ref_pass)) / 2 endif ! When there are subcycles, compute the subcycle number if (associated(S%phase%subcycles)) then x = (time - t0) - (cycle - S%phase%ref_cycle) * (S%phase%repeat_days * 86400d0) cycle = (cycle - 1) * S%phase%subcycles%n + S%phase%subcycles%i n = floor(x / d) do j = 2,S%phase%subcycles%n if (S%phase%subcycles%list(j) > n) exit cycle = cycle + 1 enddo pass = n - S%phase%subcycles%list(j-1) + 1 endif end subroutine rads_time_to_cycle_pass !****if* rads/rads_time_to_cycle ! SUMMARY ! Determine cycle number for given epoch ! ! SYNOPSIS function rads_time_to_cycle (S, time) type(rads_sat), intent(inout) :: S real(eightbytereal), intent(in) :: time integer(fourbyteint) :: rads_time_to_cycle ! ! PURPOSE ! Given an epoch <time> in seconds since 1985, determine the cycle ! number in which that epoch falls. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! time : Time in seconds since 1985 ! ! RETURN VALUE ! rads_time_to_cycle : Cycle number in which <time> falls !****------------------------------------------------------------------- integer(fourbyteint) :: pass call rads_time_to_cycle_pass (S, time, rads_time_to_cycle, pass) end function rads_time_to_cycle !*********************************************************************** !*rads_cycle_to_time -- Determine start or end time of cycle ! ! SYNOPSIS function rads_cycle_to_time (S, cycle) type(rads_sat), intent(inout) :: S integer(fourbyteint), intent(in) :: cycle real(eightbytereal) :: rads_cycle_to_time ! ! Given a cycle number, estimate the start time of that cycle. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! cycle : Cycle number ! ! RETURN VALUE ! rads_cycle_to_time : Start time of <cycle> in seconds since 1985 !****------------------------------------------------------------------- integer :: i, cc, pp real(eightbytereal) :: d, t0 ! Find the correct phase i = 1 do i = 1,size(S%phases)-1 if (cycle < S%phases(i+1)%cycles(1)) exit enddo d = S%phases(i)%pass_seconds t0 = S%phases(i)%ref_time - (S%phases(i)%ref_pass - 0.5d0) * d ! Time of start of ref_cycle if (associated(S%phases(i)%subcycles)) then ! Convert subcycle numbering to "real" cycle numbering cc = cycle - S%phases(i)%subcycles%i pp = S%phases(i)%subcycles%list(modulo(cc,S%phases(i)%subcycles%n)+1) cc = cc / S%phases(i)%subcycles%n + 1 rads_cycle_to_time = max(S%phases(i)%start_time, & t0 + (cc - S%phases(i)%ref_cycle) * S%phases(i)%repeat_days * 86400d0 + pp * d) else rads_cycle_to_time = max(S%phases(i)%start_time, & t0 + (cycle - S%phases(i)%ref_cycle) * S%phases(i)%repeat_days * 86400d0) endif end function rads_cycle_to_time !****if* rads/rads_traxxing ! SUMMARY ! Determine which tracks cross an area ! ! SYNOPSIS subroutine rads_traxxing (S) use rads_misc type(rads_sat), intent(inout) :: S ! ! PURPOSE ! Given an area and a certain satellite in a low circular orbit with ! known inclination and orbital period, the question is: which tracks ! cross the area? ! ! The area is specified by longitude and latitude limits defined in ! <S%lon%info%limits> and <S%lat%info%limits>. ! The satellite orbit is described by the inclination inclination, ! repeat period and number of repeat passes: <S%inclination>, ! <S%phase%repeat_days>, and <S%phase%repeat_passes>. ! ! The answer to the question is returned in <S%eqlonlim>: 4 values ! representing the lower and upper bounds for the longitude of the ! equator passage for ascending and descending tracks, resp. ! ! ARGUMENT ! S : Satellite/mission dependent structure !****------------------------------------------------------------------- real(eightbytereal) :: u(2),l(2),latmax integer(fourbyteint) :: i ! If either longitude limit is NaN, set eqlonlin to NaN if (any(isnan_(S%lon%info%limits))) then S%eqlonlim = nan return endif ! Initialize latmax = min(S%inclination, 180d0-S%inclination) do i = 1,2 ! Compute argument of latitude for lower and upper latitude boundary ! This also accounts for NaNs if (abs(S%lat%info%limits(i)) <= latmax) then u(i) = asin(sin(S%lat%info%limits(i)*rad) / sin(S%inclination*rad)) / rad l(i) = asin(tan(S%lat%info%limits(i)*rad) / tan(S%inclination*rad)) / rad else u(i) = (2*i-3)*90d0 l(i) = u(i) if (S%inclination > 90d0) l(i) = -l(i) endif enddo ! Compute the longitude advance corrected for time l = l - u * 2d0 * S%phase%repeat_nodal / S%phase%repeat_passes ! Compute the equator crossing longitudes for ascending tracks ! Add 2-degree margin S%eqlonlim(1,1) = S%lon%info%limits(1) - max(l(1),l(2)) - 2d0 S%eqlonlim(1,2) = S%lon%info%limits(2) - min(l(1),l(2)) + 2d0 ! Compute the equator crossing longitudes for descending tracks ! Add 2-degree margin S%eqlonlim(0,1) = S%lon%info%limits(1) + min(l(1),l(2)) - 2d0 S%eqlonlim(0,2) = S%lon%info%limits(2) + max(l(1),l(2)) + 2d0 if (rads_verbose >= 3) write (*,'(a,4f12.6)') "Eqlonlim = ",S%eqlonlim end subroutine rads_traxxing !****if* rads/rads_progress_bar ! SUMMARY ! Print and update progress of scanning cycles/passes ! ! SYNOPSIS subroutine rads_progress_bar (S, P, nselpass) type(rads_sat), intent(in) :: S type(rads_pass), intent(in) :: P integer(fourbyteint), intent(in) :: nselpass ! ! PURPOSE ! This routine prints information on the progress of cycling through ! cycles and passes of satellite data. If used, it should preferably be ! called before every call of rads_close_pass. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! nselpass : Number of measurements selected in this pass !****------------------------------------------------------------------- integer :: pos_old = 50, lin_old = -1, cycle_old = -1, pos, lin, i ! Formats for printing progress report 700 format(79('*')// & 'Data selection for satellite ',a,' phase ',a// & 'x = pass has no data in period and area'/ & '- = pass file does not exist'/ & 'o = pass file has no valid data'/ & '# = pass file has valid data') 710 format(/'Cycle Pass ', & '....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0') 720 format(/2i5,' ') 750 format(a) if (cycle_old < 0) write (rads_log_unit,700) trim(S%satellite),trim(S%phase%name) pos = mod(P%pass-1,100)+1 lin = int((P%pass-1)/100) if (P%cycle /= cycle_old) then write (rads_log_unit,710,advance='no') ! Print header pos_old = 100 cycle_old = P%cycle endif if (pos_old == 100 .or. lin_old /= lin) then write (rads_log_unit,720,advance='no') P%cycle,int((P%pass-1)/100)*100+1 ! Start new line, print cycle nr and pass nr pos_old = 0 endif do i = pos_old+1,pos-1 write (rads_log_unit,750,advance='no') ' ' ! Fill up to current pass with ' ' enddo if (S%error /= rads_noerr) then write (rads_log_unit,750,advance='no') '-' ! Print - for non existing pass else if (P%ndata == 0) then write (rads_log_unit,750,advance='no') 'x' ! Print x for empty pass else if (nselpass == 0) then write (rads_log_unit,750,advance='no') 'o' ! Print o when no data is selected else write (rads_log_unit,750,advance='no') '#' ! Print # when data available endif pos_old = pos lin_old = lin end subroutine rads_progress_bar !****if* rads/rads_parse_r_option ! SUMMARY ! Parse the -r option ! ! SYNOPSIS subroutine rads_parse_r_option (S, opt, arg, idx) type(rads_sat), intent(in) :: S character(len=*), intent(in) :: opt, arg integer(fourbyteint), intent(out) :: idx ! ! PURPOSE ! This routine is used generally with the -r option, but can also be ! associated with any other command line option. ! The routine parses the argument of the option and returns the index ! value (position) of the associated variable on the -V option argument. ! ! The following cases are recognised ! Argument Value of idx ! 'n' or 'any' -2 ! '' or '0' or 'none' 0 ! 1 <= integer <= nsel value of integer ! name of variable on -V positional index of variable on -V option ! any other value quit program with error message ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! opt : Command line option name ('r' or 'reject-on-nan') ! arg : Command line option argument ! idx : Index value !****------------------------------------------------------------------- integer(fourbyteint) :: i select case (arg) case ('n', 'any') idx = -2 case ('', '0', 'none') idx = 0 case default if (arg(1:1) >= '0' .and. arg(1:1) <= '9') then idx = 0 read (arg, *, iostat=i) idx if (idx < 1 .or. idx > S%nsel) call rads_exit ('Option -'//trim(opt)//' NR used with invalid value') else do i = 1,S%nsel if (arg == S%sel(i)%name .or. arg == S%sel(i)%info%name) then idx = i return endif enddo call rads_exit ('Option -'//trim(opt)//' <varname> does not refer to variable specified on -V option') endif end select end subroutine rads_parse_r_option !****if* rads/rads_create_pass ! SUMMARY ! Create RADS pass (data) file ! ! SYNOPSIS subroutine rads_create_pass (S, P, ndata, n_hz, n_wvf, name) use netcdf use rads_netcdf use rads_time type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P integer(fourbyteint), intent(in), optional :: ndata, n_hz, n_wvf character(len=*), intent(in), optional :: name ! ! PURPOSE ! This routine creates a new RADS NetCDF data file. If one of the same ! file name already exists, it is removed. ! The file is initialized with the appropriate global attributes, and ! the dimensions ('time' and optionally 'meas_ind' and 'wvf_ind') will be set up. ! The primary dimension can either be fixed (ndata > 0) or unlimited (ndata == 0). ! If an unlimited dimension is selected, then the pass-related global ! attributes, like cycle, pass, equator_time, equator_lon will not be written ! to the file. ! When the <ndata> argument is omitted, the value <P%ndata> is used. ! ! The optional argument <n_hz> gives the size of the secondary dimension for ! multi-Hertz data. When <n_hz> is omitted, the value <P%n_hz> is used. ! When n_hz == 0, no secondary dimension is created. ! ! The optional argument <name> can have one of three forms: ! - Left empty it specifies the current directory ! - Ending in '/' it specifies a named directory in which to store the pass ! file of the form <sat>p<pass>c<cycle>.nc ! - Otherwise it specifies the file name in full. ! If <name> is omitted, the default file name is used: ! $RADSDATAROOT/<sat>/<phase>/c<cycle>/<sat>p<pass>c<cycle>.nc ! Any directory that does not yet exist will be created. ! ! Upon entry, the <P> structure needs to contain the relevant information on ! the pass (cycle, pass, equator_time, equator_lon). Upon return, the ! P%fileinfo will be updated. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure ! ndata : Length of the primary ('time') dimension (use 0 for unlimited) ! n_hz : Number of multi-Hertz data per second ! n_wvf : Number of waveform gates ! name : Name of directory in which to store pass file, or file name ! ! ERROR CODE ! S%error : rads_noerr, rads_err_nc_create !****------------------------------------------------------------------- integer(fourbyteint) :: i, l, e logical :: exist real(eightbytereal), parameter :: ellipsoid_axis = 6378136.3d0, ellipsoid_flattening = 1d0/298.257d0 integer(fourbyteint) :: ncid character(len=rads_cmdl) :: filename ! Initialise S%error = rads_noerr if (present(ndata)) P%ndata = ndata if (present(n_hz)) P%n_hz = n_hz if (present(n_wvf)) P%n_wvf = n_wvf ! Build the file name, make directory if needed 600 format (a,'/',a,'/',a,'/c',i3.3,'/',a2,'p',i4.4,'c',i3.3,'.nc') 610 format (a,'p',i4.4,'c',i3.3,'.nc') if (.not.present(name)) then write (filename, 600) trim(S%dataroot), trim(S%branch(1)), trim(S%phase%name), P%cycle, S%sat, P%pass, P%cycle l = len_trim(filename)-15 inquire (file = filename(:l), exist = exist) if (.not.exist) call system ('mkdir -p ' // filename(:l)) else if (name == '') then write (filename, 610) S%sat, P%pass, P%cycle else if (name(len_trim(name):) == '/') then write (filename, 610) trim(name)//S%sat, P%pass, P%cycle inquire (file = name, exist = exist) if (.not.exist) call system ('mkdir -p ' // name) else call rads_init_pass_struct (S, P) filename = name endif P%fileinfo(1)%name = filename ! Create the (new) data file if (rads_verbose >= 2) write (*,'(2a,i10)') 'Creating ',trim(filename),P%ndata if (nft(nf90_create(filename, nf90_write+nf90_nofill, ncid))) then call rads_error (S, rads_err_nc_create, 'Error creating file', P) return endif P%fileinfo(1)%ncid = ncid ! Define the principle dimension if (nft(nf90_def_dim (ncid, 'time', P%ndata, l))) then call rads_error (S, rads_err_nc_create, 'Error creating dimension "time" in file', P) return endif ! Define second and third dimension (if requested) if (P%n_hz == 0) then ! Do nothing else if (nft(nf90_def_dim (ncid, 'meas_ind', P%n_hz, l))) then call rads_error (S, rads_err_nc_create, 'Error creating dimension "meas_ind" in file', P) return endif if (P%n_wvf == 0) then ! Do nothing else if (nft(nf90_def_dim (ncid, 'wvf_ind', P%n_wvf, l))) then call rads_error (S, rads_err_nc_create, 'Error creating dimension "wvf_ind" in file', P) return endif P%rw = .true. ! Specify the global attributes e = 0 do i = 1,size(S%glob_att) l = index(S%glob_att(i),' ') e = e + nf90_put_att (ncid, nf90_global, S%glob_att(i)(:l-1), S%glob_att(i)(l+1:)) enddo e = e + nf90_put_att (ncid, nf90_global, 'ellipsoid_axis', ellipsoid_axis) + & nf90_put_att (ncid, nf90_global, 'ellipsoid_flattening', ellipsoid_flattening) l = index(filename, '/', .true.) + 1 e = e + nf90_put_att (ncid, nf90_global, 'filename', trim(filename(l:))) + & nf90_put_att (ncid, nf90_global, 'mission_name', trim(S%satellite)) + & nf90_put_att (ncid, nf90_global, 'mission_phase', S%phase%name(:1)) if (ndata > 0) call rads_put_passinfo (S, P) if (P%original /= '') e = e + nf90_put_att (ncid, nf90_global, 'original', P%original) ! Temporarily also create a 'log01' record, to support RADS3 l = index(P%original, rads_linefeed) - 1 if (l < 0) l = len_trim(P%original) e = e + nf90_put_att (ncid, nf90_global, 'log01', datestamp()//' | '//trim(S%command)//': RAW data from '//P%original(:l)) if (e /= 0) call rads_error (S, rads_err_nc_create, 'Error writing global attributes to file', P) call rads_put_history (S, P) end subroutine rads_create_pass !****if* rads/rads_put_passinfo ! SUMMARY ! Write pass info to RADS data file ! ! SYNOPSIS subroutine rads_put_passinfo (S, P) use netcdf use rads_time type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P ! ! PURPOSE ! This routine writes cycle and pass number, equator longitude and time, ! and start and end time of the pass to the global attributes in a RADS ! pass file. ! ! Equator longitude is written in the range 0-360 and is truncated after ! six decimals. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure !****------------------------------------------------------------------- integer(fourbyteint) :: e, ncid character(len=26) :: date(3) ncid = P%fileinfo(1)%ncid e = 0 date = strf1985f ((/P%equator_time,P%start_time,P%end_time/)) e = e + & nf90_put_att (ncid, nf90_global, 'cycle_number', P%cycle) + & nf90_put_att (ncid, nf90_global, 'pass_number', P%pass) + & nf90_put_att (ncid, nf90_global, 'equator_longitude', 1d-6 * nint(1d6 * modulo(P%equator_lon, 360d0))) + & nf90_put_att (ncid, nf90_global, 'equator_time', date(1)) + & nf90_put_att (ncid, nf90_global, 'first_meas_time', date(2)) + & nf90_put_att (ncid, nf90_global, 'last_meas_time', date(3)) if (e /= 0) call rads_error (S, rads_err_nc_create, 'Error writing global attributes to file', P) end subroutine rads_put_passinfo !****if* rads/rads_put_history ! SUMMARY ! Write history to RADS data file ! ! SYNOPSIS subroutine rads_put_history (S, P) use netcdf use rads_time type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P ! ! PURPOSE ! This routine writes a datestamp and the command line to the global ! attribute 'history', followed by any possible previous history. ! ! When we are dealing with a pass file that was previously created by RADS3, ! this routine removes any previous log?? attributes (except log01) and ! adds the attribute 'original'. ! ! This command is called from rads_create_pass, so it is not required to ! call this command following rads_create_pass. However, when updating a ! file after rads_open_pass, it is necessary to call this routine to update ! the history. ! ! Note that P%history will not be updated. ! ! ARGUMENTS ! S : Satellite/mission dependent structure ! P : Pass structure !****------------------------------------------------------------------- integer(fourbyteint) :: e, i, ncid character(len=8) :: log ! Make sure we are in define mode and that we can write ncid = P%fileinfo(1)%ncid if (nf90_redef (ncid) == nf90_eperm) call rads_error (S, rads_err_nc_put, 'File not opened for writing:', P) ! Write history attribute if (associated(P%history)) then e = nf90_put_att (ncid, nf90_global, 'history', trim(P%history)//rads_linefeed//timestamp()//' : '//trim(S%command)) else e = nf90_put_att (ncid, nf90_global, 'history', timestamp()//' : '//trim(S%command)) endif if (e /= 0) call rads_error (S, rads_err_nc_put, 'Error writing history attribute to file', P) ! Remove "log??" entries from RADS3 and make sure P%original is written if (P%nlogs == 0) return do i = 2,P%nlogs write (log, '("log",i2.2)') i e = nf90_del_att (ncid, nf90_global, log) enddo e = nf90_put_att (ncid, nf90_global, 'original', P%original) end subroutine rads_put_history subroutine rads_def_var_by_var_0d (S, P, var, nctype, scale_factor, add_offset, ndims, varid) use netcdf use rads_netcdf type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var integer(fourbyteint), intent(in), optional :: nctype, ndims real(eightbytereal), intent(in), optional :: scale_factor, add_offset integer(fourbyteint), intent(out), optional :: varid type(rads_varinfo), pointer :: info integer(fourbyteint) :: e, n, xtype, ncid, varid_ integer :: j=0, j0, j1! k character(len=5) :: hz S%error = rads_noerr ncid = P%fileinfo(1)%ncid ! Get some information on dimensions and scale factors info => var%info if (present(nctype)) info%nctype = nctype if (present(scale_factor)) info%scale_factor = scale_factor if (present(add_offset)) info%add_offset = add_offset if (present(ndims)) info%ndims = ndims ! Set the range of dimensions to be referenced j0 = 1 j1 = info%ndims !k = index(S%time%info%dataname, ' ') - 1 !if (nft(nf90_inq_dimid(ncid,S%time%info%dataname(:k),j1))) return !j0 = j1 - info%ndims + 1 !if (j1 .eq. 1 .and. info%ndims .eq. 2) then ! j0 = 1 ! j1 = 2 !endif if (info%datatype == rads_type_dim) j0 = j1 ! Single dimension that is not primary ! Make sure we are in define mode and that we can write if (nf90_redef (ncid) == nf90_eperm) call rads_error (S, rads_err_nc_put, 'File not opened for writing:', P) ! First check if the variable already exists if (nff(nf90_inq_varid(ncid, var%name, varid_))) then e = nf90_inquire_variable (ncid, varid_, xtype=xtype, ndims=n) if (xtype /= info%nctype .or. n /= info%ndims) then call rads_error (S, rads_err_nc_var, & 'Cannot redefine variable "'//trim(var%name)//'" with different type or dimension in file', P) return endif ! Define a constant else if (info%ndims == 0) then if (nft(nf90_def_var(ncid, var%name, info%nctype, varid_))) then call rads_error (S, rads_err_nc_var, 'Error creating variable "'//trim(var%name)//'" in file', P) return endif ! Define a 1- or 2-dimensional variable else if (nft(nf90_def_var(ncid, var%name, info%nctype, (/(j,j=j1,j0,-1)/), varid_))) then call rads_error (S, rads_err_nc_var, 'Error creating variable "'//trim(var%name)//'" in file', P) return endif ! (Re)set the attributes; they may have been changed since last write e = 0 if (info%datatype == rads_type_dim) then ! Do not write _FillValue for dimension coordinates, like meas_ind else if (info%nctype == nf90_int1) then e = e + nf90_put_att (ncid, varid_, '_FillValue', huge(0_onebyteint)) else if (info%nctype == nf90_int2) then e = e + nf90_put_att (ncid, varid_, '_FillValue', huge(0_twobyteint)) else if (info%nctype == nf90_int4) then e = e + nf90_put_att (ncid, varid_, '_FillValue', huge(0_fourbyteint)) endif e = e + nf90_put_att (ncid, varid_, 'long_name', trim(info%long_name)) if (info%standard_name /= '') e = e + nf90_put_att (ncid, varid_, 'standard_name', trim(info%standard_name)) if (info%source /= '') e = e + nf90_put_att (ncid, varid_, 'source', trim(info%source)) if (info%units /= '') e = e + nf90_put_att (ncid, varid_, 'units', trim(info%units)) if (info%datatype == rads_type_flagmasks) then n = count_spaces (info%flag_meanings) if (info%nctype == nf90_int1) then e = e + nf90_put_att (ncid, varid_, 'flag_masks', int(flag_masks(0:n),onebyteint)) else e = e + nf90_put_att (ncid, varid_, 'flag_masks', flag_masks(0:n)) endif e = e + nf90_put_att (ncid, varid_, 'flag_meanings', info%flag_meanings) else if (info%datatype == rads_type_flagvalues) then n = count_spaces (info%flag_meanings) if (info%nctype == nf90_int1) then e = e + nf90_put_att (ncid, varid_, 'flag_values', flag_values(0:n)) else e = e + nf90_put_att (ncid, varid_, 'flag_values', int(flag_values(0:n),twobyteint)) endif e = e + nf90_put_att (ncid, varid_, 'flag_meanings', info%flag_meanings) endif if (info%quality_flag /= '') e = e + nf90_put_att (ncid, varid_, 'quality_flag', info%quality_flag) if (info%scale_factor /= 1d0) e = e + nf90_put_att (ncid, varid_, 'scale_factor', info%scale_factor) if (info%add_offset /= 0d0) e = e + nf90_put_att (ncid, varid_, 'add_offset', info%add_offset) if (info%datatype >= rads_type_time .or. info%dataname(:1) == ':' .or. info%ndims < 1) then ! Do not add coordinate attribute for some data types else if (info%ndims > 1 .and. S%n_hz_output .and. P%n_hz > 1) then ! For multi-Hz data: use 'lon_#hz lat_#hz' write (hz, '("_",i2.2,"hz")') P%n_hz e = e + nf90_put_att (ncid, varid_, 'coordinates', 'lon'//hz//' lat'//hz) else ! All other types: use 'lon lat' e = e + nf90_put_att (ncid, varid_, 'coordinates', 'lon lat') endif if (var%field(1) /= rads_nofield) e = e + nf90_put_att (ncid, varid_, 'field', var%field(1)) if (info%comment /= '') e = e + nf90_put_att (ncid, varid_, 'comment', info%comment) if (e /= 0) call rads_error (S, rads_err_nc_var, & 'Error writing attributes for variable "'//trim(var%name)//'" in file', P) info%cycle = P%cycle info%pass = P%pass if (present(varid)) varid = varid_ contains pure function count_spaces (string) character(len=*), intent(in) :: string integer(fourbyteint) :: count_spaces, i count_spaces = 0 do i = 2,len_trim(string)-1 if (string(i:i) == ' ') count_spaces = count_spaces + 1 enddo end function count_spaces end subroutine rads_def_var_by_var_0d subroutine rads_def_var_by_var_1d (S, P, var, nctype, scale_factor, add_offset, ndims, varid) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var(:) integer(fourbyteint), intent(in), optional :: nctype, ndims real(eightbytereal), intent(in), optional :: scale_factor, add_offset integer(fourbyteint), intent(out), optional :: varid integer :: i do i = 1,size(var) call rads_def_var_by_var_0d (S, P, var(i), nctype, scale_factor, add_offset, ndims, varid) if (S%error /= rads_noerr) return enddo end subroutine rads_def_var_by_var_1d subroutine rads_def_var_by_name (S, P, varname, nctype, scale_factor, add_offset, ndims, varid) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname integer(fourbyteint), intent(in), optional :: nctype, ndims real(eightbytereal), intent(in), optional :: scale_factor, add_offset integer(fourbyteint), intent(out), optional :: varid type(rads_var), pointer :: var var => rads_varptr (S, varname) if (S%error /= rads_noerr) return call rads_def_var_by_var_0d (S, P, var, nctype, scale_factor, add_offset, ndims, varid) if (S%error /= rads_noerr) return end subroutine rads_def_var_by_name subroutine rads_put_var_by_var_0d (S, P, var, data) use netcdf use rads_netcdf type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data integer(fourbyteint) :: varid varid = rads_put_var_helper (S, P, var%name) if (varid == 0) return if (nft(nf90_put_var (P%fileinfo(1)%ncid, varid, data))) call rads_error (S, rads_err_nc_put, & 'Error writing data for variable "'//trim(var%name)//'" to file', P) end subroutine rads_put_var_by_var_0d subroutine rads_put_var_by_name_0d (S, P, varname, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname real(eightbytereal), intent(in) :: data type(rads_var), pointer :: var var => rads_varptr (S, varname) if (S%error /= rads_noerr) return call rads_put_var_by_var_0d (S, P, var, data) end subroutine rads_put_var_by_name_0d subroutine rads_put_var_by_var_1d (S, P, var, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data(:) call rads_put_var_by_var_1d_start (S, P, var, data, (/1/)) end subroutine rads_put_var_by_var_1d subroutine rads_put_var_by_name_1d (S, P, varname, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname real(eightbytereal), intent(in) :: data(:) type(rads_var), pointer :: var var => rads_varptr (S, varname) if (S%error /= rads_noerr) return call rads_put_var_by_var_1d_start (S, P, var, data, (/1/)) end subroutine rads_put_var_by_name_1d subroutine rads_put_var_by_var_1d_start (S, P, var, data, start) use netcdf use rads_netcdf use rads_misc type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data(:) integer(fourbyteint), intent(in) :: start(:) integer(fourbyteint) :: e, ncid, varid varid = rads_put_var_helper (S, P, var%name) if (varid == 0) return ncid = P%fileinfo(1)%ncid select case (var%info%nctype) case (nf90_int1) e = nf90_put_var (ncid, varid, nint1((data - var%info%add_offset) / var%info%scale_factor), start) case (nf90_int2) e = nf90_put_var (ncid, varid, nint2((data - var%info%add_offset) / var%info%scale_factor), start) case (nf90_int4) e = nf90_put_var (ncid, varid, nint4((data - var%info%add_offset) / var%info%scale_factor), start) case default e = nf90_put_var (ncid, varid, (data - var%info%add_offset) / var%info%scale_factor, start) end select if (e /= 0) call rads_error (S, rads_err_nc_put, & 'Error writing data for variable "'//trim(var%name)//'" to file', P) end subroutine rads_put_var_by_var_1d_start subroutine rads_put_var_by_var_2d (S, P, var, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data(:,:) call rads_put_var_by_var_2d_start (S, P, var, data, (/1,1/)) end subroutine rads_put_var_by_var_2d subroutine rads_put_var_by_name_2d (S, P, varname, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname real(eightbytereal), intent(in) :: data(:,:) type(rads_var), pointer :: var var => rads_varptr (S, varname) if (S%error /= rads_noerr) return call rads_put_var_by_var_2d_start (S, P, var, data, (/1,1/)) end subroutine rads_put_var_by_name_2d subroutine rads_put_var_by_var_2d_start (S, P, var, data, start) use netcdf use rads_netcdf use rads_misc type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data(:,:) integer(fourbyteint), intent(in) :: start(:) integer(fourbyteint) :: e, ncid, varid varid = rads_put_var_helper (S, P, var%name) if (varid == 0) return ncid = P%fileinfo(1)%ncid select case (var%info%nctype) case (nf90_int1) e = nf90_put_var (ncid, varid, nint1((data - var%info%add_offset) / var%info%scale_factor), start) case (nf90_int2) e = nf90_put_var (ncid, varid, nint2((data - var%info%add_offset) / var%info%scale_factor), start) case (nf90_int4) e = nf90_put_var (ncid, varid, nint4((data - var%info%add_offset) / var%info%scale_factor), start) case default e = nf90_put_var (ncid, varid, (data - var%info%add_offset) / var%info%scale_factor, start) end select if (e /= 0) call rads_error (S, rads_err_nc_put, & 'Error writing data for variable "'//trim(var%name)//'" to file', P) end subroutine rads_put_var_by_var_2d_start subroutine rads_put_var_by_var_3d (S, P, var, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data(:,:,:) call rads_put_var_by_var_3d_start (S, P, var, data, (/1,1,1/)) end subroutine rads_put_var_by_var_3d subroutine rads_put_var_by_name_3d (S, P, varname, data) type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname real(eightbytereal), intent(in) :: data(:,:,:) type(rads_var), pointer :: var var => rads_varptr (S, varname) if (S%error /= rads_noerr) return call rads_put_var_by_var_3d_start (S, P, var, data, (/1,1,1/)) end subroutine rads_put_var_by_name_3d subroutine rads_put_var_by_var_3d_start (S, P, var, data, start) use netcdf use rads_netcdf use rads_misc type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P type(rads_var), intent(in) :: var real(eightbytereal), intent(in) :: data(:,:,:) integer(fourbyteint), intent(in) :: start(:) integer(fourbyteint) :: e, ncid, varid varid = rads_put_var_helper (S, P, var%name) if (varid == 0) return ncid = P%fileinfo(1)%ncid select case (var%info%nctype) case (nf90_int1) e = nf90_put_var (ncid, varid, nint1((data - var%info%add_offset) / var%info%scale_factor), start) case (nf90_int2) e = nf90_put_var (ncid, varid, nint2((data - var%info%add_offset) / var%info%scale_factor), start) case (nf90_int4) e = nf90_put_var (ncid, varid, nint4((data - var%info%add_offset) / var%info%scale_factor), start) case default e = nf90_put_var (ncid, varid, (data - var%info%add_offset) / var%info%scale_factor, start) end select if (e /= 0) call rads_error (S, rads_err_nc_put, & 'Error writing data for variable "'//trim(var%name)//'" to file', P) end subroutine rads_put_var_by_var_3d_start function rads_put_var_helper (S, P, varname) use netcdf use rads_netcdf type(rads_sat), intent(inout) :: S type(rads_pass), intent(inout) :: P character(len=*), intent(in) :: varname integer(fourbyteint) :: rads_put_var_helper integer(fourbyteint) :: e, ncid, varid S%error = rads_noerr ncid = P%fileinfo(1)%ncid e = nf90_enddef (ncid) ! Make sure to get out of define mode if (.not.P%rw) then call rads_error (S, rads_err_nc_put, & 'File not opened for writing variable "'//trim(varname)//'":', P) rads_put_var_helper = 0 else if (nft(nf90_inq_varid (ncid, varname, varid))) then call rads_error (S, rads_err_nc_var, 'No variable "'//trim(varname)//'" in file', P) rads_put_var_helper = 0 else rads_put_var_helper = varid ! Use varid determined above endif end function rads_put_var_helper end module rads
lgpl-3.0
aborche/cx-919-radxa-rbox-linux-rockchip
drivers/input/touchscreen/ft5506_app.f
40
146954
0x2, 0x55,0x16,0x2, 0x59,0x84,0xca,0x79,0x7d,0x73,0x74,0x1, 0x12,0x5c,0x73,0x7d, 0x37,0x12,0x58,0x4f,0xe4,0x12,0x5c,0x73,0xda,0x79,0x22,0x2, 0x39,0x97,0x5, 0x8, 0xe5,0x8, 0xbe,0xb0,0x5, 0x28,0x3, 0x75,0x8, 0x0, 0x22,0x2, 0x58,0x8f,0x74,0x3, 0x7a,0xb3,0x29,0x68,0xe4,0x7a,0xb3,0x29,0x6f,0x74,0xff,0x7a,0xb3,0x29,0x67,0x22, 0x2, 0x5d,0x6a,0x2, 0x5d,0x5a,0x7e,0x24,0xff,0xff,0x1b,0x38,0x20,0x59,0x23,0x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,0x36,0xbe,0x18,0x0, 0x7f,0x28,0x10,0x7e,0x18, 0x0, 0x7f,0x74,0x4, 0xac,0xbf,0x59,0x35,0x23,0x38,0x59,0x25,0x23,0x36,0x74,0x4, 0xac,0xbf,0x49,0x35,0x23,0x38,0x49,0x25,0x23,0x36,0x7d,0xc6,0x2d,0xcf,0x19,0x7c, 0x0, 0x55,0x7e,0x57,0x23,0x66,0x7c,0xab,0x7e,0x71,0x23,0x74,0x7, 0xac,0x7b,0x7d, 0xc3,0x2d,0xcf,0x19,0xac,0x0, 0x56,0x5, 0x23,0xb, 0xf0,0x9, 0x7f,0x0, 0x96,0xbc, 0x7f,0x28,0x3, 0x2, 0x5, 0xed,0xe5,0x23,0x19,0xbf,0x0, 0x96,0xda,0x3b,0x22,0x2, 0x5e,0xc, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xca,0x3b,0x7a,0x5, 0x21,0x7d,0x71,0x7d,0x62,0x75,0x24,0x0, 0x6d,0x22,0x7a,0x27, 0x22,0xaa,0x7a,0x27,0x22,0xac,0x7a,0x27,0x22,0xae,0x7a,0x27,0x22,0xb0,0x75,0x25, 0x0, 0x75,0x26,0xff,0x75,0x2b,0x0, 0x75,0x2c,0x0, 0x49,0x27,0x0, 0x3, 0x7a,0x27, 0x23,0x54,0x7e,0x24,0x2a,0x10,0x7a,0x27,0x23,0x56,0x6d,0x22,0x7a,0x27,0x2a,0x1a, 0x7e,0x17,0x23,0x56,0x59,0x21,0x0, 0xc, 0x7e,0x17,0x23,0x56,0x59,0x21,0x0, 0x18, 0x7e,0x17,0x23,0x56,0x59,0x21,0x0, 0x1a,0x2e,0x34,0xd, 0x80,0x7a,0x37,0x23,0x52, 0x75,0x23,0x0, 0x2, 0xc, 0xe9,0x7e,0xa1,0x23,0x74,0x24,0xa4,0x7a,0x55,0x29,0x75, 0x24,0x0, 0x2, 0xc, 0xdb,0x7e,0x35,0x29,0x3e,0x34,0x2e,0x37,0x23,0x52,0xb, 0x38, 0x30,0x12,0x5d,0x8a,0x7e,0x27,0x23,0x56,0x49,0x12,0x0, 0xe, 0xbd,0x31,0x38,0x3, 0x2, 0x8, 0x9f,0x2e,0x24,0x0, 0xa, 0xb, 0x28,0x30,0xb, 0x34,0x1b,0x28,0x30,0x7e, 0x35,0x29,0x3e,0x34,0x2e,0x37,0x23,0x52,0xb, 0x38,0x10,0x7e,0x27,0x23,0x56,0x49, 0x32,0x0, 0x10,0xbd,0x13,0x48,0x3, 0x2, 0x8, 0xc6,0x2e,0x24,0x0, 0xc, 0xb, 0x28, 0x30,0xb, 0x34,0x1b,0x28,0x30,0x7e,0x35,0x29,0x3e,0x34,0x2e,0x37,0x23,0x52,0xb, 0x38,0x30,0x12,0x5d,0x8a,0x7e,0x27,0x23,0x56,0x9, 0x32,0x0, 0x9, 0xa, 0x13,0xbd, 0x31,0x18,0x3, 0x2, 0x8, 0xf2,0x2e,0x24,0x0, 0x18,0xb, 0x28,0x30,0xb, 0x34,0x1b, 0x28,0x30,0x7e,0x35,0x29,0x3e,0x34,0x2e,0x37,0x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0xaa, 0x18,0xab,0xe5,0x27,0xbe,0xb0,0xff,0x78,0x3, 0x2, 0xc, 0xa5,0xe5,0x26,0x1a,0x1b, 0x3e,0x14,0x9, 0x1, 0x22,0xb2,0x1e,0x0, 0x7e,0x10,0x24,0xac,0x1, 0x9, 0x71,0x22, 0xb3,0x1e,0x70,0xa, 0x37,0x2d,0x3, 0x3e,0x4, 0x2e,0x7, 0x23,0x52,0xb, 0x8, 0x20, 0x7e,0x35,0x29,0x3e,0x34,0x2e,0x37,0x23,0x52,0xb, 0x38,0x30,0xbd,0x23,0x18,0x3, 0x2, 0xb, 0xda,0x7a,0x27,0x22,0xac,0x2, 0xb, 0xde,0x7a,0x37,0x22,0xac,0x7e,0x37, 0x22,0xac,0x7d,0x23,0xe, 0x24,0xe, 0x24,0xe, 0x34,0x2d,0x32,0x7a,0x37,0x22,0xac, 0xb, 0x78,0x30,0xbe,0x37,0x22,0xac,0x38,0x3, 0x2, 0xc, 0x0, 0x7a,0x37,0x22,0xac, 0xe5,0x27,0x1a,0x1b,0xb, 0x14,0xe, 0x14,0x7e,0x44,0x0, 0x24,0xad,0x14,0x7e,0x71, 0x28,0x1e,0x70,0xa, 0x37,0x7d,0x21,0x2d,0x23,0x3e,0x24,0x2e,0x27,0x23,0x52,0xb, 0x28,0x20,0x7e,0x11,0x27,0xe, 0x10,0x1a,0x1, 0x7d,0x50,0xad,0x54,0x2d,0x35,0x3e, 0x34,0x2e,0x37,0x23,0x52,0xb, 0x38,0x30,0x2d,0x32,0x7a,0x37,0x22,0xae,0xe, 0x34, 0x7a,0x37,0x22,0xae,0xe5,0x28,0xa, 0x3b,0xb, 0x34,0xe, 0x34,0x7d,0x21,0x2d,0x23, 0x3e,0x24,0x2e,0x27,0x23,0x52,0xb, 0x28,0x20,0x7e,0x14,0x0, 0x24,0xad,0x10,0x2d, 0x31,0x3e,0x34,0x2e,0x37,0x23,0x52,0xb, 0x38,0x30,0x2d,0x32,0x7a,0x37,0x22,0xb0, 0xe, 0x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0x7a,0x37,0x22,0xaa,0x85,0x24,0x28,0x5, 0x24,0xe5,0x25,0xbe,0xb1,0x24,0x38,0xb0, 0x7e,0xa1,0x2b,0x7e,0x71,0x23,0x74,0x2, 0xac,0x7b,0x19,0xa3,0x23,0x2, 0xe5,0x2c, 0x19,0xb3,0x23,0x3, 0x7e,0xa0,0xff,0x7e,0x71,0x28,0x74,0x2, 0xac,0x7b,0x19,0xa3, 0x22,0xb2,0x5, 0x23,0xe5,0x23,0xb4,0xa, 0x2, 0x80,0x3, 0x2, 0xd, 0x1, 0x75,0x23, 0x0, 0x7e,0xa1,0x23,0x74,0x2, 0xa4,0x9, 0x75,0x23,0x2, 0x19,0x75,0x22,0xb2,0x9, 0x75,0x23,0x3, 0x19,0x75,0x22,0xb3,0x5, 0x23,0xe5,0x23,0xb4,0xa, 0xe3,0x75,0x25, 0xa, 0xe5,0x25,0xbe,0xb0,0x0, 0x38,0x3, 0x2, 0xd, 0xed,0x75,0x23,0x0, 0x2, 0xd, 0xe6,0x7e,0x71,0x23,0x74,0x2, 0xac,0x7b,0x9, 0x53,0x22,0xb2,0x2e,0x35,0x21,0x7a, 0x39,0x50,0x7e,0x51,0x23,0x74,0x2, 0xac,0x5b,0x9, 0x72,0x22,0xb3,0x2e,0x25,0x21, 0x19,0x72,0x0, 0x1, 0x5, 0x23,0xe5,0x25,0xbe,0xb1,0x23,0x38,0xd4,0xe5,0x25,0x7e, 0x35,0x21,0x19,0xb3,0x0, 0x96,0xda,0x3b,0x22,0xca,0x3b,0x7d,0x71,0x7a,0x25,0x27, 0x7a,0x35,0x25,0x9, 0xb7,0x0, 0x8e,0xf5,0x30,0x9, 0xd7,0x0, 0x8f,0x75,0x2d,0x0, 0x7e,0xa0,0xff,0x7e,0x71,0x2d,0x74,0x7, 0xac,0x7b,0x19,0xa3,0x22,0xae,0x7e,0x34, 0x7f,0xff,0x7e,0xa1,0x2d,0x74,0x7, 0xa4,0x59,0x35,0x22,0xaa,0x7e,0x34,0x7f,0x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x51,0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49, 0x22,0x0, 0x46,0x12,0x5d,0x7a,0x2d,0x36,0x7a,0x35,0x29,0x7a,0x35,0x2b,0x7e,0x35, 0x27,0x49,0x33,0x0, 0x1, 0xbe,0x35,0x29,0x28,0x3, 0x2, 0x11,0x86,0x7e,0x71,0x2f, 0x74,0x7, 0xac,0x7b,0x2e,0x35,0x25,0x49,0x33,0x0, 0x50,0x7e,0x51,0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49,0x22,0x0, 0x46,0x12,0x5d,0x7a,0x7a,0x35,0x29,0x7e,0x31, 0x2e,0x74,0x7, 0xac,0x3b,0x2d,0x17,0x49,0x21,0x0, 0x46,0x7e,0x71,0x2f,0x74,0x7, 0xac,0x7b,0x2e,0x35,0x25,0x49,0x3, 0x0, 0x50,0xbd,0x2, 0x28,0x10,0x7d,0x51,0x2e, 0x54,0x0, 0x46,0x7d,0x2, 0x2e,0x5, 0x29,0x1b,0x58,0x0, 0x80,0xa, 0x2e,0x14,0x0, 0x46,0x9e,0x25,0x29,0x1b,0x18,0x20,0x49,0x33,0x0, 0x52,0x7e,0x51,0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49,0x22,0x0, 0x48,0x12,0x5d,0x7a,0x7a,0x35,0x29,0x7e,0x51, 0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49,0x32,0x0, 0x48,0x7e,0x31,0x2f,0x74,0x7, 0xac,0x3b,0x2e,0x15,0x25,0x49,0x11,0x0, 0x52,0xbd,0x13,0x38,0x3, 0x2, 0x12,0x7e, 0x2, 0x12,0x6e,0x2, 0x12,0x7e,0x7e,0x71,0x2f,0x74,0x7, 0xac,0x7b,0x2e,0x35,0x25, 0x49,0x33,0x0, 0x50,0x7e,0x51,0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49,0x22,0x0, 0x46,0x12,0x5d,0x7a,0x7d,0xf3,0x7a,0xf5,0x29,0x7e,0x35,0x2b,0x6d,0x22,0x7c,0x56, 0x7c,0x67,0x6c,0x77,0x7e,0xe5,0x27,0x49,0x1e,0x0, 0x1, 0x12,0x4c,0x12,0x7a,0x71, 0x2d,0xa, 0x37,0x6d,0x22,0x7d,0x1f,0x12,0x4c,0x9, 0x7c,0x76,0x7c,0x65,0xa, 0x24, 0x7a,0x35,0x29,0x7e,0x31,0x2e,0x74,0x7, 0xac,0x3b,0x2d,0x17,0x49,0x21,0x0, 0x46, 0x7e,0x71,0x2f,0x74,0x7, 0xac,0x7b,0x2e,0x35,0x25,0x49,0x3, 0x0, 0x50,0xbd,0x2, 0x28,0x10,0x7d,0x51,0x2e,0x54,0x0, 0x46,0x7d,0x2, 0x2e,0x5, 0x29,0x1b,0x58,0x0, 0x80,0xa, 0x2e,0x14,0x0, 0x46,0x9e,0x25,0x29,0x1b,0x18,0x20,0x49,0x33,0x0, 0x52, 0x7e,0x51,0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49,0x22,0x0, 0x48,0x12,0x5d,0x7a, 0x7d,0xf3,0x7a,0xf5,0x29,0x7e,0x35,0x2b,0x6d,0x22,0x7c,0x56,0x7c,0x67,0x6c,0x77, 0x7e,0xe5,0x27,0x49,0x1e,0x0, 0x1, 0x12,0x4c,0x12,0x7a,0x71,0x2d,0xa, 0x37,0x6d, 0x22,0x7d,0x1f,0x12,0x4c,0x9, 0x7c,0x76,0x7c,0x65,0xa, 0x24,0x7a,0x35,0x29,0x7e, 0x51,0x2e,0x74,0x7, 0xac,0x5b,0x2d,0x27,0x49,0x32,0x0, 0x48,0x7e,0x31,0x2f,0x74, 0x7, 0xac,0x3b,0x2e,0x15,0x25,0x49,0x11,0x0, 0x52,0xbd,0x13,0x28,0x10,0x7d,0x2, 0x2e,0x4, 0x0, 0x48,0x7d,0x13,0x2e,0x15,0x29,0x1b,0x8, 0x10,0x80,0xa, 0x2e,0x24, 0x0, 0x48,0x9e,0x35,0x29,0x1b,0x28,0x30,0x5, 0x2f,0xe5,0x30,0xbe,0xb1,0x2f,0x28, 0x3, 0x2, 0x10,0x77,0x75,0x2f,0x0, 0x7e,0x51,0x2f,0x74,0x7, 0xac,0x5b,0x7d,0x32, 0x2d,0x37,0x49,0x33,0x0, 0x46,0x1e,0x34,0x1e,0x34,0x1e,0x34,0x1e,0x34,0x2e,0x25, 0x25,0x59,0x32,0x0, 0x50,0x7e,0x51,0x2f,0x74,0x7, 0xac,0x5b,0x7d,0x32,0x2d,0x37, 0x49,0x33,0x0, 0x48,0x1e,0x34,0x1e,0x34,0x1e,0x34,0x1e,0x34,0x2e,0x25,0x25,0x59, 0x32,0x0, 0x52,0x7e,0x51,0x2f,0x74,0x7, 0xac,0x5b,0x7d,0x32,0x2d,0x37,0x9, 0x73, 0x0, 0x4a,0x2e,0x25,0x25,0x19,0x72,0x0, 0x54,0x5, 0x2f,0xe5,0x2f,0xb4,0xa, 0xa7, 0x7d,0x37,0x2e,0x34,0x0, 0x92,0x7e,0x39,0xb0,0x44,0x1, 0x7a,0x39,0xb0,0xe5,0x30, 0xbe,0xb0,0x0, 0x28,0x53,0x75,0x2f,0x0, 0x7e,0x71,0x2f,0x74,0x7, 0xac,0x7b,0x2e, 0x35,0x25,0x49,0x33,0x0, 0x50,0x12,0x5b,0x5c,0x7d,0x13,0x7e,0x71,0x2f,0x74,0x7, 0xac,0x7b,0x7d,0x23,0x2d,0x27,0x1b,0x28,0x10,0x2e,0x35,0x25,0x49,0x33,0x0, 0x52, 0x12,0x5a,0xb3,0x7e,0x51,0x2f,0x74,0x7, 0xac,0x5b,0x7d,0x12,0x2d,0x17,0x59,0x31, 0x0, 0x2, 0x7d,0x32,0x2e,0x35,0x25,0x9, 0x73,0x0, 0x54,0x2d,0x27,0x19,0x72,0x0, 0x4, 0x5, 0x2f,0xe5,0x2f,0xb4,0xa, 0xb0,0xda,0x3b,0x22,0xca,0x3b,0x7d,0x73,0x75, 0x27,0x0, 0x75,0x2a,0x1, 0x75,0x25,0x0, 0x7e,0x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xbe,0xa0,0x2, 0x68,0x3, 0x2, 0x14,0x5c, 0x75,0x2c,0x5, 0x75,0x2b,0x2, 0x75,0x2a,0x14,0x2, 0x15,0x2, 0xbe,0xa0,0x3, 0x68, 0x3, 0x2, 0x14,0x70,0x75,0x2c,0x2d,0x75,0x2b,0x3, 0x75,0x2a,0x3c,0x2, 0x15,0x2, 0xbe,0xa0,0x3, 0x38,0x3, 0x2, 0x15,0x2, 0x75,0x25,0x0, 0x2, 0x14,0xf6,0x75,0x26, 0x0, 0x7e,0x71,0x26,0x74,0x2, 0xac,0x7b,0x2d,0x37,0x49,0x23,0x0, 0x6e,0x7e,0x71, 0x25,0x74,0x7, 0xac,0x7b,0x2d,0x37,0x49,0x33,0x0, 0x2, 0x9d,0x32,0x12,0x5d,0x8a, 0x7d,0x63,0x7e,0x71,0x26,0x74,0x2, 0xac,0x7b,0x2d,0x37,0x49,0x23,0x0, 0x5a,0x7e, 0x71,0x25,0x74,0x7, 0xac,0x7b,0x2d,0x37,0xb, 0x38,0x30,0x9d,0x32,0x12,0x5d,0x8a, 0x2d,0x36,0x7a,0x37,0x22,0xaa,0x7e,0x51,0x25,0x74,0x2, 0xac,0x5b,0x49,0x32,0x22, 0xac,0xbe,0x37,0x22,0xaa,0x38,0x3, 0x2, 0x14,0xed,0x7e,0xa1,0x26,0xe5,0x25,0xa, 0x3b,0x19,0xa3,0x22,0xc0,0x7e,0x37,0x22,0xaa,0x59,0x32,0x22,0xac,0x5, 0x26,0xe5, 0x26,0xb4,0xa, 0x8d,0x5, 0x25,0x9, 0x77,0x0, 0x82,0xbe,0x71,0x25,0x28,0x3, 0x2, 0x14,0x7e,0x7e,0x1c,0xff,0xff,0x7a,0x1f,0x22,0xe0,0x75,0x28,0xff,0x9, 0x77,0x0, 0x82,0xbe,0x70,0x0, 0x38,0x3, 0x2, 0x16,0xd, 0xbe,0x70,0x4, 0x40,0x3, 0x2, 0x16, 0xd, 0x2, 0x16,0x3, 0x9f,0x11,0x7a,0x1d,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be,0xb1,0x29,0x28,0x3, 0x2, 0x15,0x24,0xe5,0x28,0xbe, 0xb0,0xff,0x78,0x3, 0x2, 0x16,0x87,0xe5,0x28,0x7e,0x51,0x2b,0xac,0x5b,0xe5,0x2c, 0xa, 0x3b,0x2d,0x23,0x2e,0x24,0x27,0xa8,0x7e,0x34,0x22,0xd6,0x7e,0x14,0x0, 0xa, 0x12,0x5d,0x1b,0x7e,0xa0,0x1, 0x75,0x25,0x0, 0x2, 0x16,0x7b,0xe5,0x25,0xa, 0xfb, 0x9, 0x7f,0x22,0xd6,0xa, 0x27,0x19,0xa2,0x22,0xca,0x7e,0x51,0x25,0x74,0x7, 0xac, 0x5b,0x7d,0x12,0x2d,0x17,0xb, 0x18,0x10,0x7e,0x10,0x2, 0xac,0x17,0x7d,0x40,0x2d, 0x47,0x59,0x14,0x0, 0x5a,0x7d,0x12,0x2d,0x17,0x49,0x11,0x0, 0x2, 0x2d,0x7, 0x59, 0x10,0x0, 0x6e,0x2d,0x27,0x19,0x72,0x0, 0x4, 0x5, 0x25,0x9, 0xb7,0x0, 0x82,0xbe, 0xb1,0x25,0x38,0xb8,0x2, 0x17,0xb6,0x75,0x25,0x0, 0x2, 0x17,0x2f,0x75,0x27,0x1, 0x75,0x26,0x0, 0x2, 0x16,0xda,0xe5,0x26,0xbe,0xb1,0x25,0x78,0x3, 0x2, 0x16,0xd8, 0xe5,0x26,0xa, 0x3b,0x9, 0x63,0x22,0xc0,0xe5,0x25,0xa, 0x2b,0x9, 0x72,0x22,0xc0, 0xbc,0x76,0x68,0x3, 0x2, 0x16,0xd8,0x7e,0xa1,0x26,0x74,0x2, 0xa4,0x49,0x25,0x22, 0xac,0x7e,0xa1,0x25,0x74,0x2, 0xa4,0x49,0x35,0x22,0xac,0xbd,0x32,0x50,0x3, 0x2, 0x16,0xd8,0x75,0x27,0x0, 0x2, 0x16,0xe3,0x5, 0x26,0x9, 0x77,0x0, 0x82,0xbe,0x71, 0x26,0x38,0xb3,0xe5,0x27,0xb4,0x1, 0x2, 0x80,0x3, 0x2, 0x17,0x2d,0x7e,0x50,0x1, 0xe5,0x25,0xa, 0x4b,0x9, 0x44,0x22,0xc0,0xa, 0x34,0x19,0x53,0x22,0xca,0x7e,0x71, 0x25,0x74,0x7, 0xac,0x7b,0x7d,0x13,0x2d,0x17,0x19,0x41,0x0, 0x4, 0x7d,0x13,0x2d, 0x17,0xb, 0x18,0x10,0x7e,0x50,0x2, 0xac,0x45,0x7d,0x2, 0x2d,0x7, 0x59,0x10,0x0, 0x5a,0x2d,0x37,0x49,0x33,0x0, 0x2, 0x2d,0x27,0x59,0x32,0x0, 0x6e,0x5, 0x25,0x9, 0x77,0x0, 0x82,0xbe,0x71,0x25,0x28,0x3, 0x2, 0x16,0x8d,0x75,0x25,0x0, 0x2, 0x17, 0xad,0x7e,0x71,0x25,0x74,0x7, 0xac,0x7b,0x2d,0x37,0x9, 0xb3,0x0, 0x4, 0xb4,0xff, 0x2, 0x80,0x3, 0x2, 0x17,0xab,0x75,0x26,0x0, 0xe5,0x26,0xa, 0x3b,0x9, 0xb3,0x22, 0xca,0x60,0x3, 0x2, 0x17,0xa2,0x74,0x1, 0x19,0xb3,0x22,0xca,0x7e,0x71,0x25,0x74, 0x7, 0xac,0x7b,0x7d,0x23,0x2d,0x27,0xb, 0x28,0x20,0x7e,0x31,0x26,0x74,0x2, 0xac, 0x3b,0x7d,0x1, 0x2d,0x7, 0x59,0x20,0x0, 0x5a,0x7d,0x23,0x2d,0x27,0x49,0x22,0x0, 0x2, 0x2d,0x17,0x59,0x21,0x0, 0x6e,0xe5,0x26,0x2d,0x37,0x19,0xb3,0x0, 0x4, 0x2, 0x17,0xab,0x5, 0x26,0xe5,0x26,0xbe,0xb0,0xa, 0x40,0xae,0x5, 0x25,0x9, 0x77,0x0, 0x82,0xbe,0x71,0x25,0x38,0x8b,0x75,0x25,0x0, 0xe5,0x25,0xa, 0x3b,0x9, 0xb3,0x22, 0xca,0x60,0x3, 0x2, 0x17,0xd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x75,0x32,0x0, 0x6c,0xaa,0x7e,0x71,0x32,0x74,0x2, 0xac,0x7b,0x19,0xa3, 0x22,0xd2,0xe4,0x19,0xb3,0x22,0xd3,0x6c,0xaa,0xe5,0x32,0xa, 0x3b,0x19,0xa3,0x22, 0xaa,0x5, 0x32,0xe5,0x32,0xb4,0x28,0xdd,0xe5,0x2a,0xbe,0xb0,0x2, 0x50,0x3, 0x2, 0x1c,0xbb,0x75,0x31,0x0, 0x2, 0x1b,0x8e,0xe5,0x31,0x60,0xa, 0xe5,0x31,0xa, 0x3b, 0x9, 0xb3,0x22,0xaa,0x70,0x10,0xe5,0x31,0xa, 0x5b,0xb, 0x54,0x7c,0xab,0xe5,0x31, 0xa, 0x3b,0x19,0xa3,0x22,0xaa,0xe5,0x2a,0x14,0xbe,0xb1,0x31,0x78,0x3, 0x2, 0x1b, 0x98,0x7e,0x71,0x31,0x74,0x2, 0xac,0x7b,0x2d,0x37,0x7e,0x39,0x50,0x1e,0x50,0xa, 0x25,0x7a,0x25,0x24,0x9, 0x73,0x0, 0x1, 0x1e,0x70,0xa, 0x37,0x7a,0x35,0x22,0xe5, 0x31,0xa, 0x5b,0xb, 0x54,0xf5,0x32,0x2, 0x1b,0x82,0x75,0x37,0x0, 0x7e,0x51,0x32, 0x74,0x2, 0xac,0x5b,0x2d,0x27,0x7e,0x29,0x70,0x1e,0x70,0xa, 0x37,0x7a,0x35,0x28, 0x9, 0x52,0x0, 0x1, 0x1e,0x50,0xa, 0x55,0x7a,0x55,0x26,0x3e,0x54,0x7e,0x44,0x0, 0x48,0xad,0x34,0x7d,0x23,0x2d,0x25,0x2d,0x26,0x49,0x2, 0xd, 0x80,0x7e,0x35,0x22, 0x3e,0x34,0x7e,0x55,0x24,0xad,0x54,0x2d,0x35,0x2d,0x36,0x49,0x13,0xd, 0x80,0xbd, 0x10,0x48,0x15,0x7e,0x14,0x0, 0xc, 0xad,0x10,0x7d,0x21,0xe, 0x24,0xe, 0x24,0xe, 0x24,0xe, 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,0xbc,0xba,0x38,0x3, 0x7a, 0xa1,0x21,0x75,0x33,0x0, 0x80,0x32,0x9, 0x33,0x22,0xaa,0x9, 0xa2,0x22,0xaa,0xbc, 0xa3,0x28,0x13,0xe5,0x33,0xa, 0xb, 0x9, 0x20,0x22,0xaa,0xbe,0x21,0x21,0x78,0x17, 0x19,0x30,0x22,0xaa,0x80,0x11,0xe5,0x33,0xa, 0x1b,0x9, 0xb1,0x22,0xaa,0xbe,0xb1, 0x21,0x78,0x4, 0x19,0xa1,0x22,0xaa,0x5, 0x33,0xe5,0x2a,0xbe,0xb1,0x33,0x38,0xc7, 0x5, 0x32,0xe5,0x2a,0xbe,0xb1,0x32,0x28,0x3, 0x2, 0x19,0x2a,0x5, 0x31,0xe5,0x2a, 0xbe,0xb1,0x31,0x28,0x3, 0x2, 0x18,0xd8,0x75,0x21,0x0, 0x75,0x33,0x1, 0x80,0x19, 0xe5,0x21,0xa, 0x3b,0x9, 0x63,0x22,0xaa,0xe5,0x33,0xa, 0x2b,0x9, 0x72,0x22,0xaa, 0xbc,0x76,0x40,0x3, 0x85,0x33,0x21,0x5, 0x33,0xe5,0x2a,0xbe,0xb1,0x33,0x38,0xe0, 0xe5,0x21,0xa, 0x3b,0x9, 0xb3,0x22,0xaa,0xf5,0x21,0x75,0x36,0x0, 0x6d,0x33,0x7a, 0x35,0x34,0x7a,0x35,0x38,0x7a,0x35,0x26,0x7a,0x35,0x28,0x75,0x33,0x1, 0x2, 0x1c, 0x7e,0x75,0x31,0x0, 0x80,0x5d,0x7e,0x71,0x31,0x74,0x2, 0xac,0x7b,0x2d,0x37,0x7e, 0x39,0x50,0x1e,0x50,0xa, 0x25,0x7a,0x25,0x24,0x9, 0x73,0x0, 0x1, 0x1e,0x70,0xa, 0x37,0x7a,0x35,0x22,0xe5,0x31,0xa, 0x3b,0x9, 0x73,0x22,0xaa,0xbe,0x71,0x33,0x78, 0x30,0x7e,0x35,0x34,0xb, 0x34,0x7a,0x35,0x34,0x7e,0x25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,0xbe,0xc0,0xd3,0x50,0x3, 0x2, 0x1f,0xa2,0xbe,0xc0, 0xe6,0x28,0x3, 0x2, 0x1f,0xa2,0x74,0x14,0xac,0xbd,0xa, 0x2c,0x2d,0x25,0x19,0x72, 0x23,0x74,0xda,0x3b,0x22,0x7e,0x34,0x2, 0x21,0x7e,0x24,0x20,0xbe,0x7e,0x14,0x22, 0x9d,0x12,0x41,0x33,0x7e,0x34,0x0, 0x3c,0x12,0x45,0xa2,0x7e,0x34,0x0, 0xf2,0x7e, 0x24,0x1, 0x8b,0x12,0x52,0x33,0x7e,0x34,0x22,0x17,0x12,0x58,0xce,0xe4,0x7a,0xb3, 0x0, 0x1b,0x53,0xdb,0xf0,0x7e,0x34,0x2, 0x37,0x12,0x43,0x79,0x74,0x21,0x7a,0xb3, 0x0, 0xcc,0x7e,0x34,0x20,0xc9,0x12,0x3a,0xe8,0x7e,0x34,0x20,0xc9,0x12,0x2b,0xb3, 0x12,0x5e,0x4a,0x12,0x5d,0xdf,0x7e,0x34,0x5, 0xdc,0x7a,0x37,0x24,0x70,0x7e,0x34, 0x23,0x83,0x7e,0x24,0x0, 0x3c,0x7e,0x14,0x2, 0x9f,0x7e,0x4, 0x2, 0x37,0x12,0x29, 0x89,0x7e,0x34,0x2, 0x9f,0x12,0x5a,0xd6,0x7e,0x34,0x2, 0x9f,0x12,0x56,0xb0,0x53, 0xea,0xf8,0x43,0xea,0x5, 0x7e,0x34,0x2, 0x21,0x12,0x49,0x62,0x7e,0x34,0x22,0xa3, 0x12,0x5a,0xf8,0x6d,0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x0, 0x64,0x7a,0x37,0x23, 0x68,0x7e,0x34,0x0, 0x3c,0x7e,0x24,0x2, 0x9f,0x12,0x50,0x26,0x74,0x1, 0x7a,0xb3, 0x0, 0xca,0x7e,0x73,0x24,0x6f,0x7a,0x73,0x0, 0xcb,0x74,0x1, 0x7a,0xb3,0x29,0xef, 0x7e,0xb3,0x29,0xef,0xb4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9d,0x12,0x31, 0xc4,0x7e,0xb3,0x2, 0x1d,0x54,0xef,0x7a,0xb3,0x2, 0x1d,0x7e,0x73,0x2, 0x19,0x7a, 0x73,0x2, 0x1a,0x7e,0x34,0x0, 0xf2,0x7a,0x35,0x25,0x7e,0x34,0x1, 0x8b,0x7e,0x24, 0x20,0xbe,0x7e,0x14,0x0, 0x3c,0x7e,0x4, 0x2, 0x9f,0x12,0x35,0x4b,0x2, 0x20,0x60, 0x12,0x5e,0x16,0x60,0xfb,0x2, 0x0, 0x61,0xca,0xd8,0xca,0x79,0x7c,0x7b,0xbe,0xb0, 0x4f,0x40,0x3, 0x2, 0x23,0xde,0x7e,0xa0,0x3, 0xa4,0x90,0x22,0x6e,0x73,0x2, 0x23, 0x5b,0x2, 0x23,0x62,0x2, 0x23,0x69,0x2, 0x23,0x6e,0x2, 0x23,0x75,0x2, 0x23,0x7c, 0x2, 0x23,0x83,0x2, 0x23,0x8a,0x2, 0x23,0x91,0x2, 0x23,0x98,0x2, 0x23,0x9f,0x2, 0x23,0xa6,0x2, 0x23,0xad,0x2, 0x23,0xb4,0x2, 0x23,0xbb,0x2, 0x23,0xc5,0x2, 0x23, 0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde, 0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23, 0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde, 0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23, 0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde, 0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23, 0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde, 0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xde,0x2, 0x23,0xd0,0x2, 0x23,0xde,0x2, 0x23,0xd7,0x7e,0xb3,0x29,0x15,0x2, 0x24,0xdc,0x7e,0xb3,0x29,0x12,0x2, 0x24,0xdc,0x74,0xff,0x2, 0x24,0xdc,0x7e,0xb3, 0x23,0x83,0x2, 0x24,0xdc,0x7e,0xb3,0x23,0x84,0x2, 0x24,0xdc,0x7e,0xb3,0x23,0x85, 0x2, 0x24,0xdc,0x7e,0xb3,0x23,0x86,0x2, 0x24,0xdc,0x7e,0xb3,0x23,0x87,0x2, 0x24, 0xdc,0x7e,0x74,0x23,0x88,0x2, 0x23,0xbf,0x7e,0x74,0x23,0x88,0x2, 0x23,0xc9,0x7e, 0x74,0x23,0x8a,0x2, 0x23,0xbf,0x7e,0x74,0x23,0x8a,0x2, 0x23,0xc9,0x7e,0x74,0x23, 0x8c,0x2, 0x23,0xbf,0x7e,0x74,0x23,0x8c,0x2, 0x23,0xc9,0x7e,0x74,0x23,0x8e,0x7e, 0x79,0xb0,0x2, 0x24,0xdc,0x7e,0x74,0x23,0x8e,0x9, 0xb7,0x0, 0x1, 0x2, 0x24,0xdc, 0x7e,0xb3,0x23,0x90,0x2, 0x24,0xdc,0x7e,0xb3,0x24,0x6f,0x2, 0x24,0xdc,0x7e,0xb3, 0x29,0x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,0xd4,0x19,0x74,0x0, 0x96, 0xda,0x79,0x22,0xca,0x3b,0x7d,0x72,0x6d,0x22,0x7a,0x27,0x22,0xaa,0x75,0x25,0x0, 0x75,0x26,0x0, 0x9, 0xb7,0x0, 0x96,0xf5,0x23,0x2e,0x34,0xd, 0x80,0x7a,0x37,0x22, 0xac,0x75,0x21,0x0, 0x2, 0x27,0x92,0x7e,0xa1,0x21,0x74,0x2, 0xa4,0x7d,0x45,0x2d, 0x47,0x7e,0x49,0x70,0x19,0x75,0x22,0xae,0x9, 0x74,0x0, 0x1, 0x19,0x75,0x22,0xaf, 0x5, 0x21,0xe5,0x23,0xbe,0xb1,0x21,0x38,0xde,0xe5,0x23,0xbe,0xb0,0xa, 0x38,0x3, 0x2, 0x29,0x21,0x75,0x24,0x0, 0x75,0x21,0x0, 0x2, 0x28,0x64,0x7e,0x34,0x3, 0xff, 0x7a,0x35,0x27,0x75,0x26,0x0, 0x75,0x22,0x0, 0x2, 0x28,0x13,0x7e,0xa1,0x22,0x74, 0x2, 0xa4,0x9, 0x75,0x22,0xaf,0xa, 0x27,0x7e,0xa1,0x21,0x74,0x2, 0xa4,0x9, 0x75, 0x29,0x79,0xa, 0x37,0x9d,0x32,0x12,0x5d,0x8a,0x7d,0x63,0x7e,0xa1,0x22,0x74,0x2, 0xa4,0x9, 0x75,0x22,0xae,0xa, 0x27,0x7e,0xa1,0x21,0x74,0x2, 0xa4,0x9, 0x75,0x29, 0x78,0xa, 0x37,0x9d,0x32,0x12,0x5d,0x8a,0x2d,0x36,0x7a,0x35,0x29,0x7e,0x35,0x27, 0xbe,0x35,0x29,0x38,0x3, 0x2, 0x28,0x11,0x7e,0x35,0x29,0x7a,0x35,0x27,0x85,0x22, 0x26,0x5, 0x22,0xe5,0x23,0xbe,0xb1,0x22,0x38,0xa2,0x7e,0x71,0x26,0x74,0x2, 0xac, 0x7b,0x9, 0x33,0x22,0xae,0x7c,0x43,0x1e,0x40,0x7e,0x50,0x24,0xac,0x45,0x9, 0xa3, 0x22,0xaf,0x7c,0x2a,0x1e,0x20,0xa, 0x2, 0x2d,0x20,0x3e,0x24,0x2e,0x27,0x22,0xac, 0xb, 0x28,0x20,0xbe,0x24,0x0, 0x50,0x58,0x3, 0x2, 0x28,0x62,0xe5,0x24,0x1a,0x2b, 0x3e,0x24,0x19,0x32,0x22,0xfe,0x19,0xa2,0x22,0xff,0x74,0xff,0x19,0xb3,0x22,0xae, 0x5, 0x24,0x5, 0x21,0xe5,0x13,0xbe,0xb1,0x21,0x28,0x3, 0x2, 0x27,0xac,0x85,0x24, 0x21,0x2, 0x28,0xf4,0x6d,0x33,0x7a,0x37,0x22,0xaa,0x6c,0xaa,0x75,0x22,0x0, 0x2, 0x28,0xcb,0x7e,0x51,0x22,0x74,0x2, 0xac,0x5b,0x9, 0x62,0x22,0xae,0xbe,0x60,0xff, 0x78,0x3, 0x2, 0x28,0xc9,0x7c,0x76,0x1e,0x70,0x7e,0x30,0x24,0xac,0x37,0x9, 0x72, 0x22,0xaf,0x7c,0xb7,0x1e,0xb0,0xa, 0xb, 0x2d,0x10,0x3e,0x14,0x2e,0x17,0x22,0xac, 0xb, 0x18,0x40,0xbe,0x47,0x22,0xaa,0x18,0x3, 0x2, 0x28,0xc9,0x7a,0x61,0x25,0x7a, 0x71,0x26,0x7a,0x47,0x22,0xaa,0x7e,0xa1,0x22,0x5, 0x22,0xe5,0x23,0xbe,0xb1,0x22, 0x38,0xb0,0x7e,0x71,0x25,0x7e,0x91,0x21,0x74,0x2, 0xac,0x9b,0x19,0x74,0x22,0xfe, 0xe5,0x26,0x19,0xb4,0x22,0xff,0x7e,0x70,0xff,0x7e,0x50,0x2, 0xac,0x5a,0x19,0x72, 0x22,0xae,0x5, 0x21,0xe5,0x21,0xbe,0xb0,0xa, 0x50,0x3, 0x2, 0x28,0x74,0x75,0x21, 0x0, 0x7e,0xa1,0x21,0x74,0x2, 0xa4,0x9, 0x75,0x22,0xfe,0x19,0x75,0x22,0xae,0x9, 0x75,0x22,0xff,0x19,0x75,0x22,0xaf,0x5, 0x21,0xe5,0x21,0xb4,0xa, 0xe3,0x75,0x23, 0xa, 0x75,0x21,0x0, 0x7e,0xa0,0xff,0x7e,0x71,0x21,0x74,0x2, 0xac,0x7b,0x19,0xa3, 0x29,0x78,0x74,0xff,0x19,0xb3,0x29,0x79,0x5, 0x21,0xe5,0x21,0xb4,0xa, 0xe5,0xe5, 0x23,0xbe,0xb0,0x0, 0x38,0x3, 0x2, 0x29,0x7d,0x75,0x21,0x0, 0x2, 0x29,0x76,0x7e, 0xa1,0x21,0x74,0x2, 0xa4,0x9, 0x65,0x22,0xae,0x7d,0x45,0x2d,0x47,0x7a,0x49,0x60, 0x9, 0x75,0x22,0xaf,0x7d,0x25,0x2d,0x27,0x19,0x72,0x0, 0x1, 0x19,0x65,0x29,0x78, 0x19,0x75,0x29,0x79,0x5, 0x21,0xe5,0x23,0xbe,0xb1,0x21,0x38,0xd2,0x85,0x23,0x13, 0xe5,0x23,0x19,0xb7,0x0, 0x96,0xda,0x3b,0x22,0xca,0x3b,0x7a,0x5, 0x23,0x7a,0x15, 0x21,0x7d,0x72,0x7d,0x63,0x9, 0x77,0x0, 0x8e,0x7a,0x73,0x23,0x3a,0xe4,0x19,0xb7, 0x0, 0x8e,0x75,0x28,0x0, 0x75,0x25,0x0, 0xe5,0x25,0xa, 0x3b,0x2d,0x36,0x9, 0xb3, 0x0, 0x94,0xbe,0xb1,0x28,0x50,0x3, 0x2, 0x29,0xbc,0xf5,0x28,0x5, 0x25,0xe5,0x25, 0xb4,0x20,0xe5,0xe5,0x28,0xbe,0xb0,0x3f,0x40,0x3, 0x2, 0x29,0xdc,0xe5,0x28,0xa, 0x4b,0x7e,0x54,0x0, 0x3f,0x9d,0x54,0xf5,0x28,0x2, 0x29,0xdf,0x75,0x28,0x0, 0x85, 0x28,0x27,0x2, 0x2b,0x74,0x6d,0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x0, 0x64,0x7a, 0x37,0x23,0x68,0x12,0x7, 0x7f,0x12,0x5e,0x16,0x60,0xfb,0x7d,0x37,0x7e,0x25,0x21, 0x12,0x4d,0x35,0x75,0x25,0x0, 0x2, 0x2a,0x75,0x75,0x26,0x0, 0x2, 0x2a,0x6a,0xe5, 0x25,0x60,0x3, 0x2, 0x2a,0x2c,0x6c,0xaa,0xe5,0x26,0xa, 0x3b,0x19,0xa3,0x23,0xa, 0x6d,0x33,0x7e,0xa1,0x26,0x74,0x2, 0xa4,0x59,0x35,0x22,0xaa,0x7e,0x71,0x25,0x74, 0x48,0xac,0x7b,0x7e,0x51,0x26,0x74,0x2, 0xac,0x5b,0x2d,0x32,0x2e,0x35,0x21,0x49, 0x13,0xd, 0x80,0xe, 0x14,0xe, 0x14,0xe, 0x14,0xe, 0x14,0xe, 0x14,0x2e,0x24,0x22, 0xaa,0xb, 0x28,0x30,0x2d,0x31,0x1b,0x28,0x30,0xe5,0x26,0xa, 0x3b,0x2e,0x34,0x23, 0xa, 0x7e,0x39,0xb0,0x4, 0x7a,0x39,0xb0,0x5, 0x26,0x9, 0x77,0x0, 0x1, 0xbe,0x71, 0x26,0x38,0x9c,0x5, 0x25,0x7e,0x79,0x70,0xbe,0x71,0x25,0x38,0x8c,0x75,0x29,0x0, 0x75,0x25,0x0, 0x2, 0x2b,0x45,0xe5,0x25,0xa, 0x2b,0x9, 0x72,0x23,0xa, 0xa5,0xbf, 0x0, 0x2, 0x80,0x3, 0x2, 0x2a,0xa9,0x7e,0x14,0x21,0x34,0x7e,0x61,0x25,0x74,0x2, 0xac,0xb6,0x59,0x15,0x22,0xaa,0x2, 0x2a,0xd0,0x7e,0x31,0x25,0x74,0x2, 0xac,0x3b, 0x49,0x51,0x22,0xaa,0xa, 0x47,0x8d,0x54,0x59,0x51,0x22,0xaa,0x2e,0x14,0x22,0xaa, 0xb, 0x18,0x30,0x3e,0x34,0x3e,0x34,0x3e,0x34,0x3e,0x34,0x3e,0x34,0x1b,0x18,0x30, 0x7e,0x91,0x25,0x74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,0xe5,0x27,0x1a,0x1b,0x7d,0x21,0x3e,0x24,0x59,0x32,0x27,0x8a,0x74,0xff, 0x7e,0x34,0x0, 0x7, 0xad,0x31,0x19,0xb3,0x27,0x48,0x74,0x2, 0x19,0xb1,0x27,0x9e, 0x5, 0x27,0xe5,0x27,0xb4,0xa, 0xd9,0x75,0x27,0x0, 0x2, 0x31,0xa2,0xe5,0x27,0x1a, 0x2b,0x7e,0x34,0x0, 0x7, 0xad,0x32,0x7d,0x13,0x2d,0x17,0x9, 0x71,0x0, 0x4, 0xbe, 0x70,0xff,0x78,0x3, 0x2, 0x31,0xa0,0xa, 0x37,0x2d,0x37,0x9, 0xb3,0x0, 0x46,0x60, 0x8, 0xb4,0x2, 0x2, 0x80,0x3, 0x2, 0x31,0xa0,0x75,0x28,0x0, 0x7e,0x51,0x28,0x74, 0x7, 0xac,0x5b,0x9, 0x22,0x27,0x48,0xe5,0x27,0x1a,0x4b,0x7e,0x54,0x0, 0x7, 0xad, 0x54,0x7d,0x35,0x2d,0x37,0x9, 0x33,0x0, 0x4, 0xbc,0x32,0x68,0x3, 0x2, 0x31,0x94, 0x49,0x22,0x27,0x46,0x49,0x33,0x0, 0x2, 0x9d,0x32,0x12,0x5d,0x8a,0x7d,0x63,0x7e, 0xa1,0x28,0x74,0x7, 0xa4,0x49,0x25,0x27,0x44,0xe5,0x27,0x1a,0xb, 0x7e,0x14,0x0, 0x7, 0xad,0x10,0x7d,0x31,0x2d,0x37,0xb, 0x38,0x30,0x9d,0x32,0x12,0x5d,0x8a,0x7d, 0x3, 0x2d,0x6, 0x7e,0x91,0x28,0x74,0x7, 0xac,0x9b,0x9, 0xa4,0x27,0x48,0xa, 0x1a, 0x9, 0x71,0x27,0x9e,0xbe,0x70,0x0, 0x28,0x16,0x7e,0x50,0x2, 0xac,0x5a,0x59,0x2, 0x27,0x8a,0x2e,0x14,0x27,0x9e,0x7c,0xb7,0x14,0x7a,0x19,0xb0,0x2, 0x31,0xa0,0x74, 0x2, 0xa4,0x49,0x15,0x27,0x8a,0xbe,0x14,0x0, 0x64,0x28,0x9, 0xbe,0x4, 0x0, 0x64, 0x28,0x3, 0x2, 0x31,0x8e,0x7d,0x31,0x2e,0x34,0x0, 0x32,0xbd,0x30,0x50,0x9, 0xbe, 0x14,0x0, 0x32,0x28,0x3, 0x2, 0x31,0x8e,0x3e,0x14,0x3e,0x14,0x3e,0x14,0x3e,0x14, 0xbd,0x10,0x28,0x3, 0x2, 0x31,0x8e,0x7e,0x15,0x25,0x49,0x11,0x0, 0x4, 0xbd,0x10, 0x40,0x3, 0x2, 0x31,0x81,0xe5,0x27,0x1a,0x2b,0x7e,0x34,0x0, 0x7, 0xad,0x32,0x7d, 0x13,0x2d,0x17,0x9, 0x51,0x0, 0x4, 0xa, 0x25,0x2d,0x27,0x9, 0xb2,0x0, 0x46,0x70, 0x4, 0x74,0x3, 0x80,0x2, 0x74,0x1, 0x19,0xb2,0x0, 0x46,0x74,0x3, 0x7d,0x23,0x2d, 0x27,0x9, 0xa2,0x0, 0x4, 0xa, 0x2a,0x2d,0x27,0x19,0xb2,0x0, 0x50,0x2d,0x37,0x7e, 0x14,0x22,0xaa,0x74,0x7, 0x12,0x4c,0x65,0xe5,0x29,0xbe,0xb0,0x0, 0x28,0x32,0x15, 0x29,0x7e,0x71,0x29,0x74,0x7, 0xac,0x7b,0x2d,0x37,0xe5,0x27,0x1a,0x4b,0x7e,0x54, 0x0, 0x7, 0xad,0x54,0x7d,0x15,0x2d,0x17,0x74,0x7, 0x12,0x4c,0x65,0x7e,0x34,0x22, 0xaa,0x7e,0x31,0x29,0x74,0x7, 0xac,0x3b,0x2d,0x17,0x74,0x7, 0x12,0x4c,0x65,0x15, 0x27,0x7e,0xa1,0x28,0x74,0x7, 0xa4,0x9, 0xa5,0x27,0x48,0x74,0x2, 0xa4,0x59,0x5, 0x27,0x8a,0x80,0xc, 0x5, 0x28,0xe5,0x28,0xbe,0xb0,0xa, 0x50,0x3, 0x2, 0x30,0x3c, 0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2,0xb2,0x0, 0x74,0x1, 0x12, 0x5e,0x33,0x9, 0xb6,0x0, 0x92,0x30,0xe2,0x7, 0x7e,0x37,0x22,0xaa,0x12,0x58,0xce, 0x7d,0x36,0x2e,0x34,0x0, 0x92,0x7e,0x39,0xb0,0x54,0xfe,0x7a,0x39,0xb0,0x7d,0x36, 0x2e,0x34,0x0, 0x92,0x7e,0x39,0xb0,0x54,0xfb,0x7a,0x39,0xb0,0x7d,0x36,0x2e,0x34, 0x0, 0x92,0x7e,0x39,0xb0,0x54,0xfd,0x7a,0x39,0xb0,0x80,0x4, 0xe4,0x12,0x5e,0x33, 0xda,0x3b,0x22,0xca,0x3b,0x7d,0x73,0x6d,0x33,0x7a,0x35,0x25,0x9, 0xb2,0x0, 0x96, 0x60,0x6, 0x9, 0xb2,0x0, 0x97,0x60,0x4, 0xe4,0x2, 0x35,0x48,0x7e,0x29,0xb0,0x1e, 0xb0,0xf5,0x22,0x9, 0xb2,0x0, 0x1, 0x1e,0xb0,0xf5,0x23,0x75,0x24,0x0, 0x75,0x21, 0x0, 0x7e,0x51,0x22,0x74,0x48,0xac,0x5b,0x7e,0x71,0x21,0x74,0x2, 0xac,0x7b,0x2d, 0x32,0x2d,0x37,0x49,0x33,0xd, 0x80,0x12,0x5d,0x8a,0xbe,0x34,0x0, 0x32,0x8, 0x2, 0x5, 0x24,0x5, 0x21,0xe5,0x21,0xb4,0x14,0xd8,0xe5,0x24,0xbe,0xb0,0x10,0x28,0x14, 0xe5,0x24,0xa, 0x2b,0x9e,0x24,0x0, 0x10,0x7e,0x34,0x0, 0x5, 0xad,0x32,0x2e,0x35, 0x25,0x7a,0x35,0x25,0x75,0x24,0x0, 0xe5,0x22,0xbe,0xb0,0x0, 0x28,0x44,0x75,0x21, 0x0, 0x7e,0x51,0x22,0x74,0x48,0xac,0x5b,0x7e,0x71,0x21,0x74,0x2, 0xac,0x7b,0x2d, 0x32,0x2d,0x37,0x49,0x33,0xd, 0x38,0x12,0x5d,0x8a,0x7d,0x63,0x7e,0x51,0x22,0x74, 0x48,0xac,0x5b,0x7e,0x71,0x21,0x74,0x2, 0xac,0x7b,0x2d,0x32,0x2d,0x37,0x49,0x33, 0xd, 0x80,0x12,0x5d,0x8a,0xbd,0x36,0x8, 0x2, 0x5, 0x24,0x5, 0x21,0xe5,0x21,0xb4, 0x14,0xbf,0xe5,0x24,0xbe,0xb0,0x10,0x28,0x14,0xe5,0x24,0xa, 0x2b,0x9e,0x24,0x0, 0x10,0x7e,0x34,0x0, 0x5, 0xad,0x32,0x2e,0x35,0x25,0x7a,0x35,0x25,0x75,0x24,0x0, 0xe5,0x22,0xbe,0xb0,0x1f,0x50,0x44,0x75,0x21,0x0, 0x7e,0x51,0x22,0x74,0x48,0xac, 0x5b,0x7e,0x71,0x21,0x74,0x2, 0xac,0x7b,0x2d,0x32,0x2d,0x37,0x49,0x33,0xd, 0xc8, 0x12,0x5d,0x8a,0x7d,0x63,0x7e,0x51,0x22,0x74,0x48,0xac,0x5b,0x7e,0x71,0x21,0x74, 0x2, 0xac,0x7b,0x2d,0x32,0x2d,0x37,0x49,0x33,0xd, 0x80,0x12,0x5d,0x8a,0xbd,0x36, 0x8, 0x2, 0x5, 0x24,0x5, 0x21,0xe5,0x21,0xb4,0x14,0xbf,0xe5,0x24,0xbe,0xb0,0x10, 0x28,0x14,0xe5,0x24,0xa, 0x2b,0x9e,0x24,0x0, 0x10,0x7e,0x34,0x0, 0x5, 0xad,0x32, 0x2e,0x35,0x25,0x7a,0x35,0x25,0xe5,0x23,0xbe,0xb0,0x0, 0x28,0x26,0x7e,0x51,0x22, 0x74,0x48,0xac,0x5b,0x7e,0x71,0x23,0x74,0x2, 0xac,0x7b,0x2d,0x32,0x2d,0x37,0x49, 0x33,0xd, 0x7e,0xbe,0x34,0xff,0xb0,0x58,0xa, 0x7e,0x35,0x25,0x2e,0x34,0x0, 0x5, 0x7a,0x35,0x25,0xe5,0x23,0xa, 0x3b,0xb, 0x34,0xbe,0x34,0x0, 0x20,0x58,0x26,0x7e, 0x51,0x22,0x74,0x48,0xac,0x5b,0x7e,0x71,0x23,0x74,0x2, 0xac,0x7b,0x2d,0x32,0x2d, 0x37,0x49,0x33,0xd, 0x82,0xbe,0x34,0xff,0xb0,0x58,0xa, 0x7e,0x35,0x25,0x2e,0x34, 0x0, 0x5, 0x7a,0x35,0x25,0x7e,0x55,0x25,0xda,0x3b,0x22,0xca,0x3b,0x7a,0x5, 0x23, 0x7a,0x15,0x21,0x7d,0x62,0x7d,0x73,0xe5,0xcc,0xf5,0x27,0xb, 0x68,0x30,0x4d,0x33, 0x78,0x38,0x9, 0x57,0x0, 0x8e,0xbe,0x50,0x0, 0x28,0x6, 0x75,0x9, 0x0, 0x2, 0x36, 0x82,0x9, 0xb6,0x0, 0x2, 0x20,0xe0,0x3, 0x2, 0x36,0x82,0x9, 0x56,0x0, 0x8, 0xbe, 0x51,0x9, 0x28,0x3, 0x2, 0x36,0x82,0x75,0x9, 0x0, 0x7e,0x24,0x0, 0x1, 0x1b,0x68, 0x20,0x74,0x1, 0x7a,0xb3,0x29,0xed,0x2, 0x36,0x82,0xbe,0x34,0x0, 0x1, 0x78,0x1c, 0x9, 0xb7,0x0, 0x8e,0x70,0x3, 0x2, 0x36,0x82,0x6d,0x22,0x1b,0x68,0x20,0xe4,0x7a, 0xb3,0x29,0xed,0x75,0xb, 0x29,0x75,0xa, 0x1, 0x2, 0x36,0x82,0xbe,0x34,0x0, 0x3, 0x68,0x3, 0x2, 0x36,0x82,0x6d,0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x4, 0x8f,0x7a, 0x37,0x23,0x68,0x12,0x7, 0x7f,0xa9,0xd6,0xeb,0xa9,0xc6,0xac,0xa9,0xc6,0xec,0xc2, 0x96,0xc2,0x89,0xd2,0xb8,0xa9,0xd0,0xb7,0xd2,0xa8,0x12,0x5e,0x16,0x60,0xfb,0x20, 0x93,0xfd,0x43,0x87,0x2, 0x0, 0x0, 0x0, 0xc2,0xaf,0x75,0x28,0x0, 0xe5,0xa8,0xb4, 0x1, 0x8, 0x75,0xa8,0x0, 0x75,0x28,0x0, 0x80,0x2, 0x5, 0x28,0xe5,0x28,0xbe,0xb0, 0xfa,0x38,0x13,0x6d,0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x4, 0x8f,0x7a,0x37,0x23, 0x68,0x12,0x7, 0x7f,0x80,0xd7,0xd2,0xaf,0xc2,0xa8,0xc2,0x95,0xa9,0xc6,0xeb,0xa9, 0xd6,0xac,0xa9,0xd6,0xec,0xd2,0x86,0x6d,0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x4, 0x8f,0x7a,0x37,0x23,0x68,0x12,0x7, 0x7f,0x53,0xdb,0xf0,0x12,0x5d,0xdf,0x7e,0x35, 0x25,0x7d,0x27,0x12,0x52,0x33,0x6d,0x33,0x1b,0x68,0x30,0xe4,0x7a,0xb3,0x29,0xed, 0x7e,0x35,0x23,0x12,0x56,0xb0,0x7e,0x34,0x0, 0x14,0x7a,0x37,0x27,0x42,0x7e,0x37, 0x27,0x42,0x4d,0x33,0x78,0xf8,0x7e,0x35,0x21,0x7e,0x25,0x23,0x12,0x50,0x26,0x75, 0x11,0x0, 0x6c,0xdd,0xc2,0xcc,0x80,0x15,0xe4,0x12,0x5d,0x48,0xa9,0x31,0xdb,0xd, 0x4c,0xdd,0x78,0x9, 0x7e,0xd0,0x1, 0x53,0xcc,0xfc,0x43,0xcc,0x3, 0xe5,0xa, 0x60, 0xe7,0xd2,0xcc,0x75,0xb, 0x0, 0x75,0xa, 0x0, 0x7d,0x37,0x2e,0x34,0x0, 0x92,0x7e, 0x39,0xb0,0x54,0xef,0x7a,0x39,0xb0,0x9, 0x77,0x0, 0x8e,0x19,0x77,0x0, 0x8f,0x85, 0x27,0xcc,0xda,0x3b,0x22,0xca,0x3b,0xf5,0x21,0x7d,0x72,0x7d,0x63,0x6d,0x33,0x7a, 0x37,0x20,0xef,0xe4,0x7e,0x37,0x20,0xef,0x19,0xb3,0x24,0x72,0x7e,0x37,0x20,0xef, 0xb, 0x34,0x7a,0x37,0x20,0xef,0xbe,0x34,0x2, 0x80,0x78,0xe7,0x12,0x5b,0xbe,0x12, 0x5d,0xdf,0x7d,0x36,0x7d,0x27,0x12,0x4d,0x35,0xbe,0xb0,0xaa,0x68,0xf4,0x7d,0x37, 0x2e,0x34,0xd, 0x80,0x7a,0x37,0x29,0x1b,0x6d,0x33,0x7a,0x35,0x22,0x6c,0xaa,0x7e, 0x25,0x22,0x4d,0x22,0x68,0x3, 0x2, 0x37,0x24,0x6d,0x44,0x7e,0x30,0x2, 0xac,0x3a, 0x59,0x41,0x20,0xc7,0x7e,0x14,0x0, 0x24,0xad,0x12,0x7d,0x1, 0x3e,0x4, 0x7e,0x30, 0x2, 0xac,0x3a,0x2d,0x10,0x2e,0x17,0x29,0x1b,0xb, 0x18,0x40,0x7e,0x30,0x2, 0xac, 0x3a,0x49,0x1, 0x20,0xc7,0xbd,0x40,0x38,0x3, 0x2, 0x37,0x59,0xbe,0x44,0x23,0x28, 0x40,0x3, 0x2, 0x37,0x59,0x59,0x41,0x20,0xc7,0xb, 0xa0,0xbe,0xa0,0x14,0x78,0xaf, 0xb, 0x24,0x7a,0x25,0x22,0xbe,0x24,0x0, 0x20,0x78,0xa2,0x7d,0x43,0x7a,0x35,0x22, 0x6c,0xaa,0x7e,0x25,0x22,0x7e,0x34,0x0, 0x24,0xad,0x32,0x7d,0x23,0x3e,0x24,0x7e, 0x70,0x2, 0xac,0x7a,0x2d,0x32,0x2e,0x37,0x29,0x1b,0xb, 0x38,0x20,0xbe,0x24,0x23, 0x28,0x38,0x3, 0x2, 0x37,0x9b,0xb, 0x44,0x2, 0x37,0xd3,0x7e,0x70,0x2, 0xac,0x7a, 0x49,0x33,0x20,0xc7,0x9d,0x32,0x7a,0x37,0x20,0xef,0x1e,0x34,0x1e,0x34,0x1e,0x34, 0x7a,0x37,0x20,0xef,0xbe,0x34,0x0, 0xff,0x38,0x3, 0x2, 0x37,0xc5,0x7e,0x34,0x0, 0xff,0x7a,0x37,0x20,0xef,0x7e,0x37,0x20,0xef,0x7c,0xb7,0x7d,0x34,0xb, 0x44,0x19, 0xb3,0x24,0x72,0xb, 0xa0,0xbe,0xa0,0x14,0x78,0x98,0x7e,0x35,0x22,0xb, 0x34,0x7a, 0x35,0x22,0xbe,0x34,0x0, 0x20,0x78,0x88,0x7e,0x64,0x23,0x83,0x6c,0xff,0x6d,0x33, 0x7a,0x35,0x22,0x7e,0x69,0x70,0x6c,0xf7,0xe5,0x21,0xa, 0x3b,0x2e,0x35,0x22,0x7d, 0x26,0xb, 0x64,0x7e,0x29,0xb0,0x12,0x5b,0x3b,0x7e,0x35,0x22,0xb, 0x34,0x7a,0x35, 0x22,0xbe,0x34,0x3, 0x6f,0x40,0xdc,0x7e,0x34,0x7, 0xf0,0x7c,0xbf,0x12,0x5b,0x3b, 0x7e,0x34,0x7, 0xf1,0x74,0xff,0x9c,0xbf,0x12,0x5b,0x3b,0x74,0x1, 0xda,0x3b,0x22, 0xca,0x3b,0x75,0x22,0x0, 0x75,0x23,0x0, 0x75,0x24,0x0, 0x6c,0xff,0x7d,0x63,0x2e, 0x64,0xd, 0x80,0x75,0x25,0x1, 0x6c,0xee,0x2, 0x38,0xd2,0x74,0x24,0xac,0xbe,0x7a, 0x57,0x22,0xaa,0x75,0x21,0x0, 0x2, 0x38,0xc7,0x7e,0x37,0x22,0xaa,0x3e,0x34,0x2d, 0x36,0xb, 0x38,0x30,0x12,0x5d,0x8a,0xbe,0x37,0x2a,0x1e,0x38,0x3, 0x2, 0x38,0xbb, 0xe5,0x25,0x70,0x3, 0x2, 0x38,0x88,0x85,0x21,0x22,0x85,0x21,0x23,0x7a,0xe1,0x24, 0x7c,0xfe,0x75,0x25,0x0, 0x2, 0x38,0xbb,0xe5,0x21,0xbe,0xb1,0x22,0x40,0x3, 0x2, 0x38,0x98,0x85,0x21,0x22,0x2, 0x38,0xa5,0xe5,0x21,0xbe,0xb1,0x23,0x38,0x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x2a,0x2d,0x23,0x19, 0xb2,0x0, 0xdb,0xa, 0x2a,0x2e,0x24,0x4e,0x98,0x7a,0x51,0x82,0x7a,0x41,0x83,0xe4, 0x93,0xa, 0x2a,0x2d,0x23,0x19,0xb2,0x0, 0xe3,0xb, 0xa0,0xbe,0xa0,0x0, 0x40,0xa1, 0x22,0xca,0x3b,0x6d,0x0, 0x7a,0x7, 0x22,0xaa,0x7a,0x37,0x22,0xac,0x2e,0x34,0xd, 0x80,0x7a,0x37,0x22,0xae,0x7a,0x27,0x22,0xb0,0x75,0x26,0x0, 0x7e,0x19,0x60,0x1e, 0x60,0x7a,0x61,0x25,0x9, 0x71,0x0, 0x1, 0x1e,0x70,0x7a,0x71,0x24,0x7e,0xf0,0x24, 0xac,0xf6,0xa, 0x47,0x2d,0x74,0x7e,0x73,0x2a,0x11,0xac,0x67,0x2d,0x34,0x7a,0x35, 0x22,0x7d,0x52,0x2e,0x55,0x22,0x7e,0x59,0x70,0xa, 0x57,0x7a,0x57,0x22,0xb2,0x3e, 0x54,0x3e,0x54,0x3e,0x54,0x7a,0x57,0x22,0xb2,0x7d,0x27,0x3e,0x24,0x7d,0x32,0x2e, 0x37,0x22,0xae,0xb, 0x38,0x30,0x2e,0x27,0x22,0xac,0xb, 0x28,0x50,0x2d,0x53,0x2e, 0x57,0x22,0xb2,0x7a,0x57,0x22,0xb4,0x7e,0xa3,0x2a,0x32,0x7e,0xf0,0x24,0xac,0xfa, 0x2d,0x74,0x7a,0xa1,0x21,0x2, 0x3d,0x30,0xe5,0x21,0xbe,0xb1,0x25,0x68,0x3, 0x2, 0x3c,0xc5,0x2, 0x3d,0x2a,0x7e,0x63,0x2a,0x11,0x7e,0x71,0x21,0xac,0x76,0xe5,0x24, 0xa, 0x2b,0x2d,0x32,0x7a,0x35,0x22,0x7e,0x37,0x22,0xb0,0x2e,0x35,0x22,0x7e,0x39, 0x70,0xa, 0x37,0x7a,0x37,0x22,0xb2,0x3e,0x34,0x3e,0x34,0x3e,0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x83, 0x74,0x14,0x7a,0xb3,0x23,0x84,0x74,0x3, 0x7a,0xb3,0x23,0x85,0x74,0x13,0x7a,0xb3, 0x24,0x6f,0xe4,0x7a,0xb3,0x23,0x86,0x74,0x6d,0x7a,0xb3,0x23,0x87,0x7e,0x34,0x21, 0x34,0x7a,0x37,0x23,0x91,0x7e,0x34,0x5, 0xdc,0x7a,0x37,0x24,0x70,0x75,0x27,0x8a, 0x7e,0x14,0x48,0x98,0x7e,0x4, 0x0, 0xff,0x7e,0x18,0x23,0x93,0x74,0x20,0x12,0x53, 0x1b,0x6c,0xdd,0x7e,0x73,0x23,0x83,0xbc,0x7d,0x28,0x3, 0x2, 0x40,0xb6,0x74,0xff, 0xa, 0x3d,0x19,0xb3,0x23,0x93,0xa, 0x3d,0x2e,0x34,0x49,0xe, 0x7a,0x71,0x82,0x7a, 0x61,0x83,0xe4,0x93,0xa, 0x3d,0x19,0xb3,0x23,0xc3,0x2e,0x34,0x48,0xba,0x7a,0x71, 0x82,0x7a,0x61,0x83,0xe4,0x93,0xa, 0x3d,0x19,0xb3,0x24,0x17,0xb, 0xd0,0xbe,0xd0, 0x30,0x78,0xc0,0x6c,0xdd,0xa, 0x3d,0x2e,0x34,0x48,0xea,0x7a,0x71,0x82,0x7a,0x61, 0x83,0xe4,0x93,0xa, 0x3d,0x19,0xb3,0x23,0xf3,0x2e,0x34,0x49,0x3e,0x7a,0x71,0x82, 0x7a,0x61,0x83,0xe4,0x93,0xa, 0x3d,0x19,0xb3,0x24,0x47,0xb, 0xd0,0xbe,0xd0,0x24, 0x78,0xd3,0x6d,0x77,0xe4,0x19,0xb7,0x24,0x72,0xb, 0x74,0xbe,0x74,0x2, 0x80,0x78, 0xf4,0xe5,0x26,0xbe,0xb0,0xff,0x78,0x3, 0x2, 0x41,0x30,0x74,0x4, 0x12,0x51,0xb4, 0xda,0x3b,0x22,0x7e,0xb3,0x2a,0x8, 0x54,0xfe,0x7a,0xb3,0x2a,0x8, 0x74,0x14,0x7a,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 0x2d,0x31,0x7a,0x37,0x22,0xaa,0x6d,0x33, 0x75,0x21,0x0, 0x75,0x22,0x0, 0x75,0x23,0x0, 0x75,0x24,0x0, 0x2e,0x24,0xd, 0x80, 0x7a,0x27,0x22,0xac,0x6d,0x66,0x9, 0x57,0x0, 0x30,0xa, 0x25,0xbd,0x12,0x28,0x4, 0x7e,0x34,0x0, 0x1, 0xbe,0x34,0x0, 0x1, 0x68,0x3, 0x2, 0x45,0x83,0x75,0x21,0x0, 0x2, 0x45,0x78,0x7e,0xd1,0x21,0x74,0x24,0xac,0xdb,0x75,0x22,0x0, 0x80,0x60,0x7d, 0x36,0x3e,0x34,0x2e,0x37,0x22,0xac,0xb, 0x38,0x30,0xbe,0x34,0x0, 0x0, 0x8, 0x1e, 0x49,0x27,0x0, 0xe, 0xbd,0x32,0x28,0x16,0x7e,0xa1,0x23,0x7c,0xba,0x4, 0xf5,0x23, 0xa, 0x1a,0x9, 0x57,0x0, 0x31,0xa, 0x25,0xbd,0x12,0x50,0x3c,0x80,0x3, 0x75,0x23, 0x0, 0xbe,0x34,0x0, 0x0, 0x58,0x21,0x12,0x5d,0x8a,0x49,0x27,0x0, 0xe, 0xbd,0x32, 0x28,0x16,0x7e,0xa1,0x24,0x7c,0xba,0x4, 0xf5,0x24,0xa, 0x2a,0x9, 0x77,0x0, 0x31, 0xa, 0x37,0xbd,0x23,0x50,0x12,0x80,0x3, 0x75,0x24,0x0, 0xb, 0x64,0x5, 0x22,0x9, 0x77,0x0, 0x1, 0xbe,0x71,0x22,0x38,0x97,0x9, 0x77,0x0, 0x31,0xbe,0x71,0x23,0x28, 0x5, 0xbe,0x71,0x24,0x38,0xa, 0x7e,0x34,0x0, 0x1, 0x59,0x37,0x0, 0x1e,0x80,0x13, 0x75,0x23,0x0, 0x75,0x24,0x0, 0x5, 0x21,0x7e,0x79,0x70,0xbe,0x71,0x21,0x28,0x3, 0x2, 0x44,0xe3,0x49,0x37,0x0, 0x1e,0xbe,0x34,0x0, 0x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x58,0x58, 0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x58,0x28,0x28, 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28, 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x2d,0x28,0x28, 0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0xa, 0x7d,0x43,0x74,0x20,0x7a,0xb3,0x2a,0x10,0x74,0x14,0x7a,0xb3,0x2a,0x11, 0xe4,0x7a,0xb3,0x2a,0x12,0x7a,0xb3,0x2a,0x13,0x7a,0xb3,0x2a,0x14,0x7a,0xb3,0x2a, 0x15,0x7a,0xb3,0x2a,0x16,0x74,0x3, 0x7a,0xb3,0x2a,0x17,0x6d,0x22,0x7a,0x27,0x2a, 0x2e,0x6d,0x33,0x7a,0x37,0x2a,0x1c,0x7a,0x37,0x2a,0x1a,0x7a,0x27,0x2a,0x30,0x7e, 0x54,0x0, 0x64,0x7a,0x57,0x2a,0x1e,0x7e,0x54,0xff,0x9c,0x7a,0x57,0x2a,0x20,0x7e, 0x54,0x0, 0x46,0x7a,0x57,0x2a,0x22,0x7e,0x54,0x0, 0x14,0x7a,0x57,0x2a,0x24,0x7e, 0x54,0x0, 0x1e,0x7a,0x57,0x2a,0x26,0x7a,0x37,0x2a,0x28,0xb, 0x48,0x0, 0x7e,0x14, 0x0, 0x3, 0xad,0x10,0x1e,0x14,0x1e,0x14,0x7a,0x33,0x2a,0x19,0x7a,0x33,0x2a,0x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0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19, 0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29, 0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0xc2,0xd5,0x7c,0xb4,0x30,0xe7,0x8, 0xb2,0xd5,0x6e, 0x24,0xff,0xff,0xb, 0x24,0x7c,0xb6,0x30,0xe7,0x12,0xb2,0xd5,0x6e,0x34,0xff,0xff, 0xb, 0x34,0x8d,0x32,0x6e,0x24,0xff,0xff,0xb, 0x24,0x80,0x2, 0x8d,0x32,0x30,0xd5, 0x6, 0x6e,0x34,0xff,0xff,0xb, 0x34,0x22,0x7d,0x51,0xad,0x3, 0x7d,0x2, 0x7d,0x21, 0xad,0x5, 0x2d,0x12,0xad,0x35,0x2d,0x21,0x22,0x7d,0x2, 0xad,0x31,0xad,0x10,0x2d, 0x21,0x22,0x6d,0x0, 0x74,0x10,0x4d,0x0, 0x78,0xb, 0x4d,0x22,0x78,0x27,0x8d,0x31, 0x7d,0x12,0x6d,0x22,0x22,0x7d,0x43,0x7d,0x32,0x6d,0x22,0x2f,0x11,0x2d,0x44,0x50, 0x2, 0xa5,0xf, 0xbf,0x10,0x40,0x4, 0x9f,0x10,0xb, 0x90,0x14,0x78,0xed,0x7f,0x1, 0x6d,0x22,0x7d,0x34,0x22,0x7d,0x41,0x7d,0x13,0x8d,0x24,0x7d,0x2, 0x2f,0x0, 0x40, 0x4, 0xbd,0x4, 0x40,0x4, 0x9d,0x4, 0xb, 0x14,0x14,0x78,0xf1,0x7d,0x23,0x7d,0x31, 0x7d,0x10,0x6d,0x0, 0x22,0x6c,0xaa,0x4d,0x11,0x68,0x1a,0x1e,0x54,0x68,0xe, 0xb, 0x38,0x20,0x1b,0x18,0x20,0xb, 0x35,0xb, 0x15,0x1b,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b, 0x2e,0x37,0x29,0x17,0x9, 0xb3,0x0, 0x2, 0x22,0x1b,0xb1,0x68,0x1d,0x4, 0x78,0x34, 0x30,0x0, 0x6, 0x7e,0x34,0x28,0x89,0x80,0x4, 0x7e,0x34,0x28,0xcb,0x7a,0x37,0x29, 0x17,0x7e,0x37,0x29,0x17,0x9, 0xb3,0x0, 0x4, 0x22,0x30,0x0, 0x6, 0x7e,0x34,0x28, 0x89,0x80,0x4, 0x7e,0x34,0x28,0xcb,0x7a,0x37,0x29,0x17,0x7e,0x37,0x29,0x17,0x9, 0xb3,0x0, 0x3, 0x22,0xe4,0x22,0xca,0x3b,0x7d,0x62,0x7d,0x73,0x9, 0x77,0x0, 0x8e, 0x7a,0x73,0x22,0xae,0xe4,0x19,0xb7,0x0, 0x8e,0x7d,0x36,0x2e,0x34,0xd, 0x80,0x7a, 0x37,0x22,0xac,0x7a,0x67,0x22,0xaa,0x75,0x29,0x1, 0x12,0x5e,0x16,0x60,0xfb,0x7d, 0x37,0x7d,0x26,0x12,0x4d,0x35,0x12,0x5d,0xdf,0x6d,0x33,0x7a,0x35,0x2c,0x75,0x2a, 0x0, 0x75,0x2b,0x0, 0x7e,0x25,0x2c,0x3e,0x24,0x7d,0x32,0x2e,0x37,0x22,0xac,0xb, 0x38,0x10,0xe, 0x14,0xe, 0x14,0x2e,0x27,0x22,0xaa,0xb, 0x28,0x30,0x2d,0x31,0x1b, 0x28,0x30,0x7e,0x35,0x2c,0xb, 0x34,0x7a,0x35,0x2c,0x5, 0x2b,0xe5,0x2b,0xb4,0x24, 0xd3,0x5, 0x2a,0xe5,0x2a,0xb4,0x30,0xc9,0x5, 0x29,0xe5,0x29,0xbe,0xb0,0x4, 0x28, 0xa9,0x7e,0x73,0x22,0xae,0x19,0x77,0x0, 0x8e,0xda,0x3b,0x22,0xca,0x3b,0x7d,0x72, 0x7d,0x63,0x75,0x2d,0x0, 0xe4,0x7e,0xa1,0x2d,0xa, 0x3a,0x2d,0x36,0x7e,0x39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,0x7c,0x65,0xa, 0x24,0x7f,0x71,0xa, 0x3a,0x6d,0x22,0xbf,0x71,0x50,0x4, 0xa, 0xfa,0x6d,0xee,0x7d,0x3f,0x7a,0x37,0x0, 0x15,0xda,0x3b,0x22,0xca,0x69,0xca,0xf8,0x7c,0xfb,0x7e,0x34,0x24,0x47,0x7a,0x35, 0x27,0x7e,0x34,0x23,0x83,0x7a,0x35,0x29,0x7e,0x34,0x24,0x47,0x9e,0x35,0x29,0x7a, 0x35,0x29,0x6d,0x66,0xa, 0x3f,0x2d,0x36,0x2e,0x35,0x29,0x12,0x5e,0x43,0x7e,0x35, 0x27,0x7a,0x39,0xb0,0x7e,0x35,0x27,0xb, 0x34,0x7a,0x35,0x27,0xb, 0x64,0xbe,0x64, 0x0, 0x24,0x78,0xe0,0x7e,0x34,0x24,0x72,0x7a,0x35,0x27,0x7e,0x34,0x23,0x83,0x7a, 0x35,0x29,0x7e,0x34,0x24,0x72,0x9e,0x35,0x29,0x7a,0x35,0x29,0x6d,0x66,0xa, 0x3f, 0x2d,0x36,0x2e,0x35,0x29,0x12,0x5e,0x43,0x7e,0x35,0x27,0x7a,0x39,0xb0,0x7e,0x35, 0x27,0xb, 0x34,0x7a,0x35,0x27,0xb, 0x64,0xbe,0x64,0x2, 0x80,0x40,0xe0,0xda,0xf8, 0xda,0x69,0x22,0x7d,0x12,0x7d,0x3, 0x6d,0x44,0xe4,0x7a,0x39,0xb0,0xb, 0x34,0xb, 0x44,0xbe,0x44,0x0, 0x99,0x78,0xf2,0x7d,0x31,0x6d,0x44,0xe4,0x7a,0x39,0xb0,0xb, 0x34,0xb, 0x44,0xbe,0x44,0x0, 0x96,0x78,0xf2,0x6d,0x44,0x7e,0x34,0x0, 0x7, 0xad, 0x34,0x2d,0x30,0x2e,0x34,0x0, 0x50,0x12,0x0, 0x46,0x7e,0x34,0x0, 0x7, 0xad,0x34, 0x2d,0x31,0x12,0x0, 0x46,0x7e,0x34,0x0, 0x7, 0xad,0x34,0x2d,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0xbe,0x71,0x12,0x50,0x1c,0x75,0x12,0x0, 0x7d,0x37,0x12,0x56,0xb0,0x7d,0x36, 0x7d,0x27,0x12,0x50,0x26,0xe5,0x11,0xb4,0x2, 0x8, 0x75,0x11,0x1, 0x80,0x3, 0x75, 0x12,0x0, 0xda,0x3b,0x22,0x6d,0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x4, 0x8f,0x7a, 0x37,0x23,0x68,0x53,0xdb,0xf0,0x7e,0x34,0x0, 0x3c,0x12,0x45,0xa2,0x7e,0x34,0x1f, 0x11,0x12,0x43,0x79,0x7e,0x34,0x1f,0x79,0x12,0x3a,0xe8,0x7e,0x34,0x1f,0x79,0x12, 0x2b,0xb3,0x12,0x5e,0x4a,0x12,0x5d,0xdf,0x7e,0x34,0x1, 0x2c,0x7a,0x37,0x24,0x70, 0x7e,0x34,0x23,0x83,0x7e,0x24,0x0, 0x3c,0x7e,0x14,0x0, 0xf2,0x7e,0x4, 0x1f,0x11, 0x12,0x29,0x89,0x12,0x5e,0x16,0x60,0xfb,0x74,0x1, 0x7a,0xb3,0x29,0xef,0x7e,0xb3, 0x29,0x15,0x54,0x8f,0x7a,0xb3,0x29,0x15,0x22,0xca,0xf8,0x6d,0x33,0x7a,0x37,0x29, 0x13,0xe4,0x7a,0xb3,0x29,0xd, 0x7e,0xb3,0x29,0x15,0xc4,0x54,0xf, 0x7c,0xfb,0x5e, 0xf0,0x7, 0x78,0xb, 0x7e,0xb3,0x29,0x19,0x12,0x4f,0x9b,0xf5,0x91,0x80,0x13,0xbe, 0xf0,0x4, 0x40,0xe, 0xbe,0xf0,0x5, 0x68,0x9, 0x7e,0xb3,0x29,0x19,0x12,0x22,0x58, 0xf5,0x91,0xe4,0x7a,0xb3,0x29,0xf, 0x7a,0xb3,0x29,0xe, 0x74,0xaa,0x7a,0xb3,0x28, 0x89,0x74,0xaa,0x7a,0xb3,0x28,0x8a,0x74,0xaa,0x7a,0xb3,0x28,0xcb,0x74,0xaa,0x7a, 0xb3,0x28,0xcc,0xda,0xf8,0x22,0x75,0x84,0x1, 0x7e,0x44,0x4, 0x1f,0xe4,0x7a,0x49, 0xb0,0x1b,0x44,0x78,0xf9,0x7e,0xf8,0x2a,0x44,0x75,0x13,0x0, 0x75,0x14,0x0, 0x75, 0x8, 0x0, 0xc2,0x0, 0x75,0xd, 0x0, 0x75,0xe, 0x0, 0xc2,0x1, 0x75,0x11,0x0, 0x75, 0x12,0x0, 0x7e,0x4, 0x0, 0xff,0x7e,0x14,0x5e,0x6d,0xb, 0xa, 0x40,0x5d,0x44,0x68, 0x1a,0x69,0x20,0x0, 0x2, 0xb, 0xe, 0xb, 0x44,0x80,0xa, 0x7e,0xb, 0xb0,0x7a,0x29, 0xb0,0xb, 0x24,0xb, 0xc, 0x1b,0x44,0x78,0xf2,0x80,0xdf,0x2, 0x4d,0xe0,0xca,0x3b, 0x7a,0x5, 0x23,0x7a,0x15,0x21,0x7d,0x72,0x7d,0x63,0x12,0x5a,0x66,0x9, 0x76,0x0, 0x96,0x19,0x77,0x0, 0x8e,0x7d,0x37,0x12,0x59,0x4a,0x7d,0x37,0x12,0x58,0xd, 0x9, 0x77,0x0, 0x8e,0x19,0x76,0x0, 0x96,0x7e,0x35,0x21,0x7e,0x25,0x23,0x59,0x32,0x0, 0x84,0x7e,0x35,0x23,0x7d,0x26,0x12,0x56,0x65,0x7e,0x35,0x23,0x59,0x37,0x0, 0x93, 0x9, 0x76,0x0, 0x96,0x19,0x77,0x0, 0x8e,0x7d,0x36,0x7e,0x25,0x21,0x7d,0x17,0x12, 0xd, 0xf9,0xda,0x3b,0x22,0xca,0x3b,0x7d,0x60,0x7a,0x15,0x23,0x7a,0x25,0x21,0x7d, 0x73,0x12,0x5b,0xbe,0x53,0xdb,0xf0,0x12,0x3f,0xf9,0x7d,0x37,0x12,0x45,0xa2,0x7e, 0x35,0x21,0x12,0x43,0x79,0x74,0x21,0x19,0xb7,0x0, 0x90,0x7d,0x36,0x12,0x3a,0xe8, 0x12,0x2b,0xb3,0x12,0x5e,0x4a,0x12,0x5d,0xdf,0x7e,0x35,0x23,0x12,0x56,0xb0,0x6d, 0x33,0x7a,0x37,0x23,0x80,0x7e,0x34,0x4, 0x8f,0x7a,0x37,0x23,0x68,0x7d,0x37,0x7e, 0x25,0x23,0x12,0x50,0x26,0xda,0x3b,0x22,0xca,0x3b,0x7d,0x71,0x7d,0x62,0x9, 0xb3, 0x0, 0x96,0x70,0x6, 0x74,0x1, 0x7a,0xb3,0x2a,0x9, 0x7e,0xb3,0x2a,0x9, 0x70,0x2c, 0x7e,0x37,0x2a,0x38,0x7d,0x23,0xb, 0x24,0x7a,0x27,0x2a,0x38,0xbe,0x37,0x2a,0x3a, 0x28,0x20,0x6d,0x33,0x7a,0x37,0x2a,0x38,0x74,0x1, 0x7a,0xb3,0x2a,0x9, 0x7d,0x37, 0x12,0x56,0xb0,0x7d,0x36,0x7d,0x27,0x12,0x50,0x26,0x80,0x6, 0x6d,0x33,0x7a,0x37, 0x2a,0x38,0xda,0x3b,0x22,0xca,0x3b,0x7d,0x72,0x7d,0x63,0x9, 0x77,0x0, 0x96,0x19, 0x76,0x0, 0x82,0x2e,0x24,0x0, 0x50,0x7d,0x36,0x7e,0x14,0x0, 0x46,0x12,0x5d,0x1b, 0x7d,0x36,0x12,0x13,0x5b,0x7d,0x36,0x49,0x26,0x0, 0x84,0x12,0x2f,0xcd,0x7d,0x26, 0x7d,0x37,0x2e,0x34,0x0, 0x50,0x7e,0x14,0x0, 0x46,0x12,0x5d,0x1b,0x9, 0x76,0x0, 0x82,0x19,0x76,0x0, 0x83,0x9, 0x76,0x0, 0x82,0x19,0x77,0x0, 0x96,0xda,0x3b,0x22, 0x7d,0x23,0x2e,0x24,0x1d,0x40,0x6d,0x11,0x7e,0xa0,0x30,0x6c,0x11,0x6d,0xff,0x7d, 0x41,0x3e,0x44,0x2d,0x43,0x1b,0x48,0xf0,0x7d,0x41,0x5e,0x44,0x0, 0x7, 0x2e,0x44, 0x5e,0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 0x4, 0x1, 0x3, 0x4, 0x2, 0x4, 0x0, 0x1, 0x4, 0x0, 0x2, 0x4, 0x0, 0x3, 0x4, 0x1, 0x0, 0x4, 0x1, 0x2, 0x4, 0x1, 0x3, 0x4, 0x2, 0x0, 0x4, 0x2, 0x1, 0x4, 0x2, 0x3, 0x4, 0x3, 0x0, 0x4, 0x3, 0x1, 0x4, 0x3, 0x2, 0x0, 0x1, 0x2a,0x9, 0x0, 0x0, 0x2, 0x2a,0x43,0x0, 0x0, 0x0, 0x2, 0x0, 0x17, 0x0, 0x0, 0x0, 0x0, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0xe8,0x90,0x17,0x87,0x78, 0x4, 0x5c,
gpl-2.0
alexurba/cftb
src/constants.f90
1
1995
module constants !--------------------------------------------------------------------! ! just the library of constants used in the TB tools ! !--------------------------------------------------------------------! implicit none !---------------------- OS dependent constants ----------------------! ! CURDIR : OS dependent symbol for the current directory ! ! DIRSEP : OS dependent symbol for the directory deparator ! !--------------------------------------------------------------------! character, parameter :: CURDIR = '.' character, parameter :: DIRSEP = '/' !---------------------- fortran 90 type kinds -----------------------! ! DP : double precision kind ! !--------------------------------------------------------------------! integer, parameter :: DP = kind(1.0d0) !----------------- mathematical/numerical constants -----------------! ! see below for explanations ! !--------------------------------------------------------------------! double precision, parameter :: PI = 3.141592653589793d0 double precision, parameter :: SQRT_PI = 1.772453850905516d0 double precision, parameter :: PI_INV = 1.0d0/PI double precision, parameter :: SQRT_PI_INV = 1.0d0/SQRT_PI double precision, parameter :: PI2 = 2.0d0*PI double precision, parameter :: PI2_INV = 1.0d0/PI2 double precision, parameter :: SQRT2 = 1.4142135623731d0 double precision, parameter :: SQRT2_INV = 1.0d0/SQRT2 !------------------------- unit conversion --------------------------! double precision, parameter :: eV2Ha = 0.0367493089d0 double precision, parameter :: Ha2eV = 27.2113961d0 double precision, parameter :: Ry2Ha = 0.5d0 double precision, parameter :: Ha2Ry = 2.0d0 double precision, parameter :: Ang2Bohr = 1.88972598501d0 end module constants
mit
mogrodnik/piernik
src/grid/cg_cost_stats.F90
3
5926
! ! PIERNIK Code Copyright (C) 2006 Michal Hanasz ! ! This file is part of PIERNIK code. ! ! PIERNIK is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! PIERNIK is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with PIERNIK. If not, see <http://www.gnu.org/licenses/>. ! ! Initial implementation of PIERNIK code was based on TVD split MHD code by ! Ue-Li Pen ! see: Pen, Arras & Wong (2003) for algorithm and ! http://www.cita.utoronto.ca/~pen/MHD ! for original source code "mhd.f90" ! ! For full list of developers see $PIERNIK_HOME/license/pdt.txt ! #include "piernik.h" !> \brief This module provides a structure for calculating basic statistics of computational costs of a bunch of cg module cg_cost_stats use cg_cost_data, only: cg_cost_data_t implicit none private public :: cg_stats_t, stat_labels, I_MIN, I_MAX, I_AVG, I_SIGMA, I_SUM, I_SUM2 type :: cg_stats_t type(cg_cost_data_t), private :: min !< element-wise minimum type(cg_cost_data_t), private :: max !< element-wise maximum type(cg_cost_data_t), private :: w_sum !< sum of elements type(cg_cost_data_t), private :: w_sum2 !< sum of squares ! type(cg_cost_data_t), private :: bias !< bias for improved accuracy of the mean integer, private :: n !< number of elements contains procedure :: reset !< initialize procedure :: add !< add sample procedure :: get_minimum !< return maxima procedure :: get_maximum !< return minima procedure :: get_average !< return average procedure :: get_sigma !< return standard deviation procedure :: get !< return minimum, maximum mean, sigma and sum for selected accumulator procedure :: get_sum !< return total accumulated time end type cg_stats_t enum, bind(C) enumerator :: I_MIN = 1, I_MAX, I_AVG, I_SIGMA, I_SUM, I_SUM2 end enum character(len=*), dimension(I_MIN:I_SUM2), parameter :: stat_labels = & [ "minimum ", & & "maximum ", & & "average ", & & "deviation", & & "sum ", & & "sum^2 " ] contains !> \brief Initialize subroutine reset(this) implicit none class(cg_stats_t), intent(inout) :: this this%min%wtime = huge(1.) this%max%wtime = -huge(1.) this%w_sum%wtime = 0. this%w_sum2%wtime = 0. this%n = 0 end subroutine reset !> \brief Add sample subroutine add(this, data) implicit none class(cg_stats_t), intent(inout) :: this class(cg_cost_data_t), intent(in) :: data if (any(data%wtime > 0.)) then this%min%wtime = min(this%min%wtime, data%wtime) this%max%wtime = max(this%max%wtime, data%wtime) this%w_sum%wtime = this%w_sum%wtime + data%wtime this%w_sum2%wtime = this%w_sum2%wtime + data%wtime**2 this%n = this%n + 1 endif end subroutine add !> \brief Return minima type(cg_cost_data_t) function get_minimum(this) implicit none class(cg_stats_t), intent(in) :: this get_minimum = this%min end function get_minimum !> \brief Return maxima type(cg_cost_data_t) function get_maximum(this) implicit none class(cg_stats_t), intent(in) :: this get_maximum = this%max end function get_maximum !> \brief Return average type(cg_cost_data_t) function get_average(this) implicit none class(cg_stats_t), intent(in) :: this if (this%n /= 0) then get_average%wtime = this%w_sum%wtime / this%n else get_average%wtime = 0. ! this should be safe value endif end function get_average !> \brief Return standard deviation type(cg_cost_data_t) function get_sigma(this) implicit none class(cg_stats_t), intent(in) :: this if (this%n /= 0) then get_sigma%wtime = sqrt(abs(this%w_sum2%wtime / this%n - (this%w_sum%wtime / this%n)**2)) ! abs() is required for safety else get_sigma%wtime = 0. ! this should be safe value endif end function get_sigma !> \brief Return minimum, maximum mean and sigma for selected accumulator function get(this, ind) use dataio_pub, only: die implicit none class(cg_stats_t), intent(in) :: this integer(kind=4), intent(in) :: ind real, dimension(lbound(stat_labels,1):ubound(stat_labels,1)) :: get if (ind >= lbound(this%min%wtime, 1) .and. ind <= ubound(this%min%wtime, 1)) then if (this%n /= 0) then ! Beware: formulas repeated from this%get_average and this%get_sigma get = [ this%min%wtime(ind), & & this%max%wtime(ind), & & this%w_sum%wtime(ind) / this%n, & & sqrt(abs(this%w_sum2%wtime(ind) / this%n - (this%w_sum%wtime(ind) / this%n)**2)), & ! abs() is required for safety & this%w_sum%wtime(ind) , & & this%w_sum2%wtime(ind) ] else get = 0. endif else call die("[cg_cost_stats:get] invalid index") get = 0. endif end function get !> \brief Return total accumulated time real function get_sum(this) implicit none class(cg_stats_t), intent(in) :: this get_sum = sum(this%w_sum%wtime) end function get_sum end module cg_cost_stats
gpl-3.0
henriasv/lammps
lib/linalg/dsymv.f
57
9413
*> \brief \b DSYMV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE DSYMV(UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) * * .. Scalar Arguments .. * DOUBLE PRECISION ALPHA,BETA * INTEGER INCX,INCY,LDA,N * CHARACTER UPLO * .. * .. Array Arguments .. * DOUBLE PRECISION A(LDA,*),X(*),Y(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DSYMV performs the matrix-vector operation *> *> y := alpha*A*x + beta*y, *> *> where alpha and beta are scalars, x and y are n element vectors and *> A is an n by n symmetric matrix. *> \endverbatim * * Arguments: * ========== * *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> On entry, UPLO specifies whether the upper or lower *> triangular part of the array A is to be referenced as *> follows: *> *> UPLO = 'U' or 'u' Only the upper triangular part of A *> is to be referenced. *> *> UPLO = 'L' or 'l' Only the lower triangular part of A *> is to be referenced. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> On entry, N specifies the order of the matrix A. *> N must be at least zero. *> \endverbatim *> *> \param[in] ALPHA *> \verbatim *> ALPHA is DOUBLE PRECISION. *> On entry, ALPHA specifies the scalar alpha. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION array of DIMENSION ( LDA, n ). *> Before entry with UPLO = 'U' or 'u', the leading n by n *> upper triangular part of the array A must contain the upper *> triangular part of the symmetric matrix and the strictly *> lower triangular part of A is not referenced. *> Before entry with UPLO = 'L' or 'l', the leading n by n *> lower triangular part of the array A must contain the lower *> triangular part of the symmetric matrix and the strictly *> upper triangular part of A is not referenced. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> On entry, LDA specifies the first dimension of A as declared *> in the calling (sub) program. LDA must be at least *> max( 1, n ). *> \endverbatim *> *> \param[in] X *> \verbatim *> X is DOUBLE PRECISION array of dimension at least *> ( 1 + ( n - 1 )*abs( INCX ) ). *> Before entry, the incremented array X must contain the n *> element vector x. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> On entry, INCX specifies the increment for the elements of *> X. INCX must not be zero. *> \endverbatim *> *> \param[in] BETA *> \verbatim *> BETA is DOUBLE PRECISION. *> On entry, BETA specifies the scalar beta. When BETA is *> supplied as zero then Y need not be set on input. *> \endverbatim *> *> \param[in,out] Y *> \verbatim *> Y is DOUBLE PRECISION array of dimension at least *> ( 1 + ( n - 1 )*abs( INCY ) ). *> Before entry, the incremented array Y must contain the n *> element vector y. On exit, Y is overwritten by the updated *> vector y. *> \endverbatim *> *> \param[in] INCY *> \verbatim *> INCY is INTEGER *> On entry, INCY specifies the increment for the elements of *> Y. INCY must not be zero. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup double_blas_level2 * *> \par Further Details: * ===================== *> *> \verbatim *> *> Level 2 Blas routine. *> The vector and matrix arguments are not referenced when N = 0, or M = 0 *> *> -- Written on 22-October-1986. *> Jack Dongarra, Argonne National Lab. *> Jeremy Du Croz, Nag Central Office. *> Sven Hammarling, Nag Central Office. *> Richard Hanson, Sandia National Labs. *> \endverbatim *> * ===================================================================== SUBROUTINE DSYMV(UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) * * -- Reference BLAS level2 routine (version 3.4.0) -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION ALPHA,BETA INTEGER INCX,INCY,LDA,N CHARACTER UPLO * .. * .. Array Arguments .. DOUBLE PRECISION A(LDA,*),X(*),Y(*) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE,ZERO PARAMETER (ONE=1.0D+0,ZERO=0.0D+0) * .. * .. Local Scalars .. DOUBLE PRECISION TEMP1,TEMP2 INTEGER I,INFO,IX,IY,J,JX,JY,KX,KY * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX * .. * * Test the input parameters. * INFO = 0 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN INFO = 1 ELSE IF (N.LT.0) THEN INFO = 2 ELSE IF (LDA.LT.MAX(1,N)) THEN INFO = 5 ELSE IF (INCX.EQ.0) THEN INFO = 7 ELSE IF (INCY.EQ.0) THEN INFO = 10 END IF IF (INFO.NE.0) THEN CALL XERBLA('DSYMV ',INFO) RETURN END IF * * Quick return if possible. * IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN * * Set up the start points in X and Y. * IF (INCX.GT.0) THEN KX = 1 ELSE KX = 1 - (N-1)*INCX END IF IF (INCY.GT.0) THEN KY = 1 ELSE KY = 1 - (N-1)*INCY END IF * * Start the operations. In this version the elements of A are * accessed sequentially with one pass through the triangular part * of A. * * First form y := beta*y. * IF (BETA.NE.ONE) THEN IF (INCY.EQ.1) THEN IF (BETA.EQ.ZERO) THEN DO 10 I = 1,N Y(I) = ZERO 10 CONTINUE ELSE DO 20 I = 1,N Y(I) = BETA*Y(I) 20 CONTINUE END IF ELSE IY = KY IF (BETA.EQ.ZERO) THEN DO 30 I = 1,N Y(IY) = ZERO IY = IY + INCY 30 CONTINUE ELSE DO 40 I = 1,N Y(IY) = BETA*Y(IY) IY = IY + INCY 40 CONTINUE END IF END IF END IF IF (ALPHA.EQ.ZERO) RETURN IF (LSAME(UPLO,'U')) THEN * * Form y when A is stored in upper triangle. * IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN DO 60 J = 1,N TEMP1 = ALPHA*X(J) TEMP2 = ZERO DO 50 I = 1,J - 1 Y(I) = Y(I) + TEMP1*A(I,J) TEMP2 = TEMP2 + A(I,J)*X(I) 50 CONTINUE Y(J) = Y(J) + TEMP1*A(J,J) + ALPHA*TEMP2 60 CONTINUE ELSE JX = KX JY = KY DO 80 J = 1,N TEMP1 = ALPHA*X(JX) TEMP2 = ZERO IX = KX IY = KY DO 70 I = 1,J - 1 Y(IY) = Y(IY) + TEMP1*A(I,J) TEMP2 = TEMP2 + A(I,J)*X(IX) IX = IX + INCX IY = IY + INCY 70 CONTINUE Y(JY) = Y(JY) + TEMP1*A(J,J) + ALPHA*TEMP2 JX = JX + INCX JY = JY + INCY 80 CONTINUE END IF ELSE * * Form y when A is stored in lower triangle. * IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN DO 100 J = 1,N TEMP1 = ALPHA*X(J) TEMP2 = ZERO Y(J) = Y(J) + TEMP1*A(J,J) DO 90 I = J + 1,N Y(I) = Y(I) + TEMP1*A(I,J) TEMP2 = TEMP2 + A(I,J)*X(I) 90 CONTINUE Y(J) = Y(J) + ALPHA*TEMP2 100 CONTINUE ELSE JX = KX JY = KY DO 120 J = 1,N TEMP1 = ALPHA*X(JX) TEMP2 = ZERO Y(JY) = Y(JY) + TEMP1*A(J,J) IX = JX IY = JY DO 110 I = J + 1,N IX = IX + INCX IY = IY + INCY Y(IY) = Y(IY) + TEMP1*A(I,J) TEMP2 = TEMP2 + A(I,J)*X(IX) 110 CONTINUE Y(JY) = Y(JY) + ALPHA*TEMP2 JX = JX + INCX JY = JY + INCY 120 CONTINUE END IF END IF * RETURN * * End of DSYMV . * END
gpl-2.0
mogrodnik/piernik
src/gravity/multigrid_gravity.F90
1
51501
! ! PIERNIK Code Copyright (C) 2006 Michal Hanasz ! ! This file is part of PIERNIK code. ! ! PIERNIK is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! PIERNIK is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with PIERNIK. If not, see <http://www.gnu.org/licenses/>. ! ! Initial implementation of PIERNIK code was based on TVD split MHD code by ! Ue-Li Pen ! see: Pen, Arras & Wong (2003) for algorithm and ! http://www.cita.utoronto.ca/~pen/MHD ! for original source code "mhd.f90" ! ! For full list of developers see $PIERNIK_HOME/license/pdt.txt ! #include "piernik.h" !> !! \brief Multigrid Poisson solver !! !! \details This module contains routines and variables specific for multigrid self-gravity solver. !! !! Some code pieces (low-level FFT routines) here are not really gravity-related, !! but these are not needed for implicit CR-diffusion solver either. !! These parts of code can be moved to other multigrid files when any other multigrid solver uses them. !! !! If you ever want to use FFT solver in serial run (much like it was possible via poissonsolver.F90) set level_depth = 0 in MULTIGRID namelist. !< module multigrid_gravity ! pulled by MULTIGRID && SELF_GRAV use constants, only: cbuff_len use multigrid_vstats, only: vcycle_stats use multigrid_old_soln, only: soln_history implicit none private public :: multigrid_grav_par, init_multigrid_grav, cleanup_multigrid_grav, multigrid_solve_grav, init_multigrid_grav_ext, unmark_oldsoln, recover_sgpm, recover_sgp #ifdef HDF5 public :: write_oldsoln_to_restart, read_oldsoln_from_restart #endif /* HDF5 */ #ifndef NO_FFT include "fftw3.f" #endif /* !NO_FFT */ ! constants from fftw3.f ! integer, parameter :: FFTW_MEASURE=0, FFTW_PATIENT=32, FFTW_ESTIMATE=64 ! integer, parameter :: FFTW_RODFT01=8, FFTW_RODFT10=9 ! namelist parameters real :: norm_tol !< stop V-cycle iterations when the ratio of norms ||residual||/||source|| is below this value real :: vcycle_abort !< abort the V-cycle when lhs norm raises by this factor real :: vcycle_giveup !< exit the V-cycle when convergence ratio drops below that level integer(kind=4) :: max_cycles !< Maximum allowed number of V-cycles logical :: base_no_fft !< Deny solving the coarsest level with FFT. Can be very slow. logical :: fft_patient !< Spend more time in init_multigrid to find faster fft plan character(len=cbuff_len) :: grav_bnd_str !< Type of gravitational boundary conditions. logical :: require_FFT !< .true. if we use FFT solver anywhere (and need face prolongation) #ifndef NO_FFT integer :: fftw_flags = FFTW_MEASURE !< or FFTW_PATIENT on request #endif /* !NO_FFT */ ! solution recycling type(soln_history), target :: inner, outer !< storage for recycling the inner and outer potentials ! miscellaneous type(vcycle_stats) :: vstat !< V-cycle statistics logical :: something_in_particles !< A flag indicating that some mass may be hidden in particles wandering outside the computational domain enum, bind(C) enumerator :: SGP, SGPM end enum contains !> !! \brief Routine to set parameters values from namelist MULTIGRID_GRAVITY !! !! \n \n !! @b MULTIGRID_GRAVITY !! \n \n !! <table border="+1"> !! <tr><td width="150pt"><b>parameter</b></td><td width="135pt"><b>default value</b></td><td width="200pt"><b>possible values</b></td><td width="315pt"> <b>description</b></td></tr> !! <tr><td>norm_tol </td><td>1.e-6 </td><td>real value </td><td>\copydoc multigrid_gravity::norm_tol </td></tr> !! <tr><td>coarsest_tol </td><td>1.e-2 </td><td>real value </td><td>\copydoc multigrid_gravity::coarsest_tol </td></tr> !! <tr><td>vcycle_abort </td><td>2.0 </td><td>real value </td><td>\copydoc multigrid_gravity::vcycle_abort </td></tr> !! <tr><td>vcycle_giveup </td><td>1.5 </td><td>real value </td><td>\copydoc multigrid_gravity::vcycle_giveup </td></tr> !! <tr><td>max_cycles </td><td>20 </td><td>integer value </td><td>\copydoc multigrid_gravity::max_cycles </td></tr> !! <tr><td>nsmool </td><td>dom%nb </td><td>integer value </td><td>\copydoc multigridvars::nsmool </td></tr> !! <tr><td>nsmoob </td><td>100 </td><td>integer value </td><td>\copydoc multigrid_gravity_helper::nsmoob </td></tr> !! <tr><td>overrelax </td><td>1. </td><td>real value </td><td>\copydoc multigrid_gravity::overrelax </td></tr> !! <tr><td>L4_strength </td><td>1.0 </td><td>real value </td><td>\copydoc multigrid_Laplace4::L4_strength </td></tr> !! <tr><td>ord_laplacian </td><td>-4 </td><td>integer value </td><td>\copydoc multigrid_Laplace::ord_laplacian </td></tr> !! <tr><td>ord_laplacian_outer </td><td>2 </td><td>integer value </td><td>\copydoc multigrid_Laplace::ord_laplacian_outer </td></tr> !! <tr><td>ord_time_extrap </td><td>1 </td><td>integer value </td><td>\copydoc multigrid_gravity::ord_time_extrap </td></tr> !! <tr><td>base_no_fft </td><td>.false.</td><td>logical </td><td>\copydoc multigrid_gravity::base_no_fft </td></tr> !! <tr><td>fft_patient </td><td>.false.</td><td>logical </td><td>\copydoc multigrid_gravity::fft_patient </td></tr> !! <tr><td>lmax </td><td>16 </td><td>integer value </td><td>\copydoc multipole::lmax </td></tr> !! <tr><td>mmax </td><td>-1 </td><td>integer value </td><td>\copydoc multipole::mmax </td></tr> !! <tr><td>mpole_solver </td><td>.false.</td><td>logical </td><td>\copydoc multipole::mpole_solver </td></tr> !! <tr><td>res_factor </td><td>0.5 </td><td>real value </td><td>\copydoc multipole_array::res_factor </td></tr> !! <tr><td>size_factor </td><td>1. </td><td>real value </td><td>\copydoc multipole_array::size_factor </td></tr> !! <tr><td>mpole_level </td><td>1 </td><td>integer value </td><td>\copydoc multipole_array::mpole_level </td></tr> !! <tr><td>multidim_code_3D </td><td>.false.</td><td>logical </td><td>\copydoc multigridvars::multidim_code_3d </td></tr> !! <tr><td>use_CG </td><td>.false.</td><td>logical </td><td>\copydoc multigrid_gravity::use_CG </td></tr> !! <tr><td>use_CG_outer </td><td>.false.</td><td>logical </td><td>\copydoc multigrid_gravity::use_CG_outer </td></tr> !! <tr><td>grav_bnd_str </td><td>"periodic"/"dirichlet"</td><td>string of chars</td><td>\copydoc multigrid_gravity::grav_bnd_str </td></tr> !! <tr><td>preconditioner </td><td>"HG_V-cycle"</td><td>string of chars</td><td>\copydoc multigrid_gravity::preconditioner </td></tr> !! </table> !! The list is active while \b "SELF_GRAV" and \b "MULTIGRID" are defined. !! \n \n !< subroutine multigrid_grav_par use constants, only: GEO_XYZ, GEO_RPZ, BND_PER, O_LIN, O_I2, O_D4, I_ONE, INVALID use dataio_pub, only: msg, die, warn, nh use domain, only: dom, is_multicg !, is_uneven use func, only: operator(.notequals.) use mpisetup, only: master, slave, ibuff, cbuff, rbuff, lbuff, piernik_MPI_Bcast use multigridvars, only: single_base, bnd_invalid, bnd_isolated, bnd_periodic, bnd_dirichlet, grav_bnd, multidim_code_3D, nsmool, & & overrelax, coarsest_tol use multigrid_gravity_helper, only: nsmoob use multigrid_Laplace, only: ord_laplacian, ord_laplacian_outer use multigrid_Laplace4, only: L4_strength use multigrid_old_soln, only: nold_max, ord_time_extrap use multipole, only: mpole_solver, lmax, mmax, singlepass, init_multipole use multipole_array, only: res_factor, size_factor, mpole_level, mpole_level_auto use pcg, only: use_CG, use_CG_outer, preconditioner, default_preconditioner, pcg_init implicit none integer :: periodic_bnd_cnt !< counter of periodic boundaries in existing directions logical, save :: frun = .true. !< First run flag namelist /MULTIGRID_GRAVITY/ norm_tol, coarsest_tol, vcycle_abort, vcycle_giveup, max_cycles, nsmool, nsmoob, use_CG, use_CG_outer, & & overrelax, L4_strength, ord_laplacian, ord_laplacian_outer, ord_time_extrap, & & base_no_fft, fft_patient, & & lmax, mmax, mpole_solver, mpole_level, res_factor, size_factor, & & multidim_code_3D, grav_bnd_str, preconditioner if (.not.frun) call die("[multigrid_gravity:multigrid_grav_par] Called more than once.") frun = .false. ! Default values for namelist variables norm_tol = 1.e-6 coarsest_tol = 1.e-3 overrelax = 1. vcycle_abort = 2. vcycle_giveup = 1.5 L4_strength = 1.0 res_factor = 0.5 size_factor = 1. lmax = 16 mmax = -1 ! will be automatically set to lmax unless explicitly limited in problem.par mpole_level = mpole_level_auto max_cycles = 20 nsmool = -1 ! best to set it to dom%nb or its multiply nsmoob = 10000 select case (dom%geometry_type) case (GEO_XYZ) ord_laplacian = O_D4 case (GEO_RPZ) ord_laplacian = O_I2 case default ord_laplacian = INVALID end select ord_laplacian_outer = ord_laplacian ord_time_extrap = O_LIN mpole_solver = "img_mass" base_no_fft = .false. fft_patient = .false. multidim_code_3D = .false. use_CG = .false. use_CG_outer = .false. periodic_bnd_cnt = count(dom%periodic(:) .and. dom%has_dir(:)) if (periodic_bnd_cnt == dom%eff_dim) then grav_bnd_str = "periodic" else grav_bnd_str = "dirichlet" endif preconditioner = default_preconditioner if (master) then if (.not.nh%initialized) call nh%init() open(newunit=nh%lun, file=nh%tmp1, status="unknown") write(nh%lun,nml=MULTIGRID_GRAVITY) close(nh%lun) open(newunit=nh%lun, file=nh%par_file) nh%errstr="" read(unit=nh%lun, nml=MULTIGRID_GRAVITY, iostat=nh%ierrh, iomsg=nh%errstr) close(nh%lun) call nh%namelist_errh(nh%ierrh, "MULTIGRID_GRAVITY") read(nh%cmdl_nml,nml=MULTIGRID_GRAVITY, iostat=nh%ierrh) call nh%namelist_errh(nh%ierrh, "MULTIGRID_GRAVITY", .true.) open(newunit=nh%lun, file=nh%tmp2, status="unknown") write(nh%lun,nml=MULTIGRID_GRAVITY) close(nh%lun) call nh%compare_namelist() if (nsmool < 0) nsmool = -nsmool * dom%nb ! FIXME when ready select case (dom%geometry_type) case (GEO_XYZ) ! do nothing case (GEO_RPZ) ! switch off FFT-related bits base_no_fft = .true. if (any([ ord_laplacian, ord_laplacian_outer ] /= O_I2) .and. master) call warn("[multigrid_gravity:multigrid_grav_par] Laplacian order forced to 2]") ord_laplacian = O_I2 ord_laplacian_outer = ord_laplacian L4_strength = 0. case default call die("[multigrid_gravity:multigrid_grav_par] Unsupported geometry.") end select if (is_multicg .and. .not. base_no_fft) then call warn("[multigrid_gravity:multigrid_grav_par] base_no_fft forced to .true. for multicg configuration") base_no_fft = .true. endif if (ord_laplacian_outer /= ord_laplacian) call warn("[multigrid_gravity:multigrid_grav_par] ord_laplacian_outer /= ord_laplacian") rbuff(1) = norm_tol rbuff(2) = overrelax rbuff(3) = vcycle_abort rbuff(4) = vcycle_giveup rbuff(5) = L4_strength rbuff(6) = coarsest_tol rbuff(7) = res_factor rbuff(8) = size_factor ibuff( 1) = mpole_level ibuff( 2) = lmax ibuff( 3) = mmax ibuff( 4) = max_cycles ibuff( 5) = nsmool ibuff( 6) = nsmoob ibuff( 7) = ord_laplacian ibuff( 9) = ord_time_extrap ibuff(10) = ord_laplacian_outer lbuff(2) = base_no_fft lbuff(3) = fft_patient lbuff(6) = multidim_code_3D lbuff(7) = use_CG lbuff(8) = use_CG_outer cbuff(1) = grav_bnd_str cbuff(2) = preconditioner cbuff(3) = mpole_solver endif call piernik_MPI_Bcast(cbuff, cbuff_len) call piernik_MPI_Bcast(ibuff) call piernik_MPI_Bcast(rbuff) call piernik_MPI_Bcast(lbuff) if (slave) then norm_tol = rbuff(1) overrelax = rbuff(2) vcycle_abort = rbuff(3) vcycle_giveup = rbuff(4) L4_strength = rbuff(5) coarsest_tol = rbuff(6) res_factor = rbuff(7) size_factor = rbuff(8) mpole_level = ibuff( 1) lmax = ibuff( 2) mmax = ibuff( 3) max_cycles = ibuff( 4) nsmool = ibuff( 5) nsmoob = ibuff( 6) ord_laplacian = ibuff( 7) ord_time_extrap = ibuff( 9) ord_laplacian_outer = ibuff(10) base_no_fft = lbuff(2) fft_patient = lbuff(3) multidim_code_3D = lbuff(6) use_CG = lbuff(7) use_CG_outer = lbuff(8) grav_bnd_str = cbuff(1)(1:len(grav_bnd_str)) preconditioner = cbuff(2)(1:len(preconditioner)) mpole_solver = cbuff(3)(1:len(mpole_solver)) endif ! boundaries grav_bnd = bnd_invalid select case (grav_bnd_str) case ("isolated", "iso") grav_bnd = bnd_isolated case ("periodic", "per") if (any(dom%bnd(:,:) /= BND_PER)) & call die("[multigrid_gravity:multigrid_grav_par] cannot enforce periodic boundaries for gravity on a not fully periodic domain") grav_bnd = bnd_periodic case ("dirichlet", "dir") grav_bnd = bnd_dirichlet case default call die("[multigrid_gravity:multigrid_grav_par] Non-recognized boundary description.") end select if (periodic_bnd_cnt == dom%eff_dim) then ! fully periodic domain if (grav_bnd /= bnd_periodic .and. master) & call warn("[multigrid_gravity:multigrid_grav_par] Ignoring non-periodic boundary conditions for gravity on a fully periodic domain.") grav_bnd = bnd_periodic !> \warning the above statement is highly suspicious else if (periodic_bnd_cnt > 0 .and. periodic_bnd_cnt < dom%eff_dim) then if (grav_bnd == bnd_isolated) call die("[multigrid_gravity:multigrid_grav_par] Isolated grav boundaries implemented only for fully periodic domain") if (.not. base_no_fft .and. master) & call warn("[multigrid_gravity:multigrid_grav_par] Mixing periodic and non-periodic boundary conditions for gravity disables FFT base-level solver.") ! This would require more careful set up of the Green's function and FFT type base_no_fft = .true. endif !!$ select case (grav_bnd) !!$ case (bnd_periodic) !!$ grav_extbnd_mode = BND_NONE !!$ case (bnd_isolated, bnd_dirichlet, bnd_givenval) !!$ grav_extbnd_mode = BND_NEGREF !!$ case default !!$ call die("[multigrid_gravity:multigrid_grav_par] Unsupported grav_bnd.") !!$ !grav_extbnd_mode = BND_NONE !!$ end select if (.not. (grav_bnd == bnd_periodic .or. grav_bnd == bnd_dirichlet .or. grav_bnd == bnd_isolated) .and. .not. base_no_fft) then base_no_fft = .true. if (master) call warn("[multigrid_gravity:multigrid_grav_par] Use of FFT not allowed by current boundary type/combination.") endif single_base = .not. base_no_fft if (master .and. (overrelax.notequals.1.0)) then write(msg, '(a,f8.5)')"[multigrid_gravity:multigrid_grav_par] Overrelaxation factor = ", overrelax call warn(msg) if (any([ord_laplacian, ord_laplacian_outer] /= O_I2)) call warn("[multigrid_gravity:multigrid_grav_par] Overrelaxation is implemented only for RBGS relaxation") endif #ifndef NO_FFT if (fft_patient) fftw_flags = FFTW_PATIENT #endif /* !NO_FFT */ if (grav_bnd == bnd_isolated) call init_multipole ! solution recycling ord_time_extrap = min(nold_max-I_ONE, max(-I_ONE, ord_time_extrap)) associate (nold => ord_time_extrap + 1) call inner%init_history(nold, "i") if (grav_bnd == bnd_isolated .and. .not. singlepass) call outer%init_history(nold, "o") end associate call vstat%init(max_cycles) call pcg_init ! Conjugate gradients end subroutine multigrid_grav_par !> \brief Initialization - continued after allocation of everything interesting subroutine init_multigrid_grav use cg_leaves, only: leaves use cg_level_coarsest, only: coarsest use cg_level_connected, only: cg_level_connected_t use cg_list, only: cg_list_element use constants, only: GEO_XYZ, sgp_n, fft_none, fft_dst, fft_rcr, dsetnamelen, pMAX use dataio_pub, only: die, warn, printinfo, msg use domain, only: dom use mpisetup, only: master, FIRST, LAST, piernik_MPI_Allreduce use multigridvars, only: bnd_periodic, bnd_dirichlet, bnd_isolated, grav_bnd use named_array_list, only: qna implicit none type(cg_level_connected_t), pointer :: curl character(len=dsetnamelen) :: FFTn logical, save :: firstcall = .true. type(cg_list_element), pointer :: cgl integer :: p, cnt, cnt_max if (firstcall) call leaves%set_q_value(qna%ind(sgp_n), 0.) !Initialize all the guardcells, even those which does not impact the solution if (.not. allocated(coarsest%level%dot%gse)) call die("[multigrid_gravity:init_multigrid_grav] cannot determine number of pieces on coaarsest level") cnt = 0 do p = FIRST, LAST if (allocated(coarsest%level%dot%gse)) cnt = cnt + size(coarsest%level%dot%gse(p)%c(:)) enddo if (base_no_fft .and. (cnt /= 1) .and. master) call warn("[multigrid_gravity:init_multigrid_grav] Cannot use FFT solver on coarsest level") base_no_fft = base_no_fft .or. (cnt /= 1) #ifdef NO_FFT if (.not. base_no_fft) then call warn("[multigrid_gravity:init_multigrid_grav] Forced base_no_fft due to NO_FFT") base_no_fft = .true. endif #endif /* NO_FFT */ cnt_max = cnt call piernik_MPI_Allreduce(cnt_max, pMAX) if (cnt /= cnt_max) call die("[multigrid_gravity:init_multigrid_grav] Inconsistent number of pieces on coaarsest level") ! data related to local and global base-level FFT solver if (base_no_fft) then coarsest%level%fft_type = fft_none else select case (grav_bnd) case (bnd_periodic) coarsest%level%fft_type = fft_rcr FFTn="RCR" case (bnd_dirichlet, bnd_isolated) coarsest%level%fft_type = fft_dst FFTn="DST" case default coarsest%level%fft_type = fft_none FFTn="none" if (master) call warn("[multigrid_gravity:init_multigrid_grav] base_no_fft unset but no suitable boundary conditions found. Reverting to relaxation.") end select if (trim(FFTn) /= "none" .and. master) then write(msg,'(a,i3,2a)')"[multigrid_gravity:init_multigrid_grav] Coarsest level (",coarsest%level%l%id,"), FFT solver: ", trim(FFTn) call printinfo(msg) endif endif if (coarsest%level%fft_type == fft_none .and. master) then write(msg,'(a,i3,a)')"[multigrid_gravity:init_multigrid_grav] Coarsest level (",coarsest%level%l%id,"), relaxation solver" call printinfo(msg) endif require_FFT = .false. ! FFT solver storage and data curl => coarsest%level do while (associated(curl)) if (curl%fft_type /= fft_none) then require_FFT = .true. if (dom%geometry_type /= GEO_XYZ) call die("[multigrid_gravity:init_multigrid_grav] FFT is not allowed in non-cartesian coordinates.") endif curl => curl%finer enddo if (require_FFT) then #ifdef NO_FFT call die("[multigrid_gravity:init_multigrid_grav] require_FFT conflicts with NO_FFT") #endif /* NO_FFT */ curl => coarsest%level do while (associated(curl)) cgl => curl%first do while (associated(cgl)) call mgg_cg_init(cgl%cg) ! allocate FFT arrays on cg that are already created (dirty hack) cgl => cgl%nxt enddo curl => curl%finer enddo endif firstcall = .false. end subroutine init_multigrid_grav !> \brief Cleanup subroutine cleanup_multigrid_grav use multipole, only: cleanup_multipole implicit none #ifndef NO_FFT call dfftw_cleanup #endif /* !NO_FFT */ call cleanup_multipole call vstat%cleanup call inner%cleanup_history call outer%cleanup_history end subroutine cleanup_multigrid_grav !> set up pointers for cg%mg initialization subroutine init_multigrid_grav_ext(after_label) use grid_container_ext, only: cg_ext, cg_extptrs implicit none character(len=*), intent(in) :: after_label procedure(cg_ext), pointer :: mgg_cg_init_p, mgg_cg_cleanup_p mgg_cg_init_p => mgg_cg_init mgg_cg_cleanup_p => mgg_cg_cleanup call cg_extptrs%extend(mgg_cg_init_p, mgg_cg_cleanup_p, "multigrid_gravity", after_label) end subroutine init_multigrid_grav_ext !> \brief Allocate some multigrid-specific arrays subroutine mgg_cg_init(cg) use cg_level_connected, only: cg_level_connected_t use constants, only: fft_none use dataio_pub, only: die use find_lev, only: find_level use func, only: operator(.notequals.) use grid_cont, only: grid_container use multigridvars, only: overrelax #ifndef NO_FFT use constants, only: fft_rcr, fft_dst, pi, dpi, zero, half, one use domain, only: dom #endif /* !NO_FFT */ implicit none type(grid_container), pointer, intent(inout) :: cg type(cg_level_connected_t), pointer :: curl #ifndef NO_FFT real, allocatable, dimension(:) :: kx, ky, kz !< FFT kernel directional components for convolution integer :: i, j #endif /* !NO_FFT */ ! this should work correctly also when dom%eff_dim < 3 cg%mg%r = overrelax / 2. cg%mg%rx = cg%dvol**2 * cg%idx2 cg%mg%ry = cg%dvol**2 * cg%idy2 cg%mg%rz = cg%dvol**2 * cg%idz2 cg%mg%r = cg%mg%r / (cg%mg%rx + cg%mg%ry + cg%mg%rz) cg%mg%rx = cg%mg%r * cg%mg%rx cg%mg%ry = cg%mg%r * cg%mg%ry cg%mg%rz = cg%mg%r * cg%mg%rz cg%mg%r = cg%mg%r * cg%dvol**2 ! FFT solver storage and data curl => find_level(cg%l%id) if (.not. associated(curl)) call die("[multigrid_gravity:mgg_cg_init] level not found") if (cg%l%id /= curl%l%id) call die("[multigrid_gravity:mgg_cg_init] wrong level found") cg%mg%planf = 0 cg%mg%plani = 0 if (curl%fft_type /= fft_none) then #ifdef NO_FFT call die("[multigrid_gravity:mgg_cg_init] NO_FFT") #else /* !NO_FFT */ select case (curl%fft_type) case (fft_rcr) cg%mg%nxc = cg%nxb / 2 + 1 case (fft_dst) cg%mg%nxc = cg%nxb case default call die("[multigrid_gravity:mgg_cg_init] Unknown FFT type.") end select if (allocated(cg%mg%Green3D) .or. allocated(cg%mg%src)) call die("[multigrid_gravity:mgg_cg_init] Green3D or src arrays already allocated") allocate(cg%mg%Green3D(cg%mg%nxc, cg%nyb, cg%nzb)) allocate(cg%mg%src (cg%nxb, cg%nyb, cg%nzb)) allocate(kx(cg%mg%nxc), ky(cg%nyb), kz(cg%nzb)) select case (curl%fft_type) ! cg%mg%fft_norm is set such that the following sequence gives identity: ! call dfftw_execute(cg%mg%planf); cg%mg%fftr(:, :, :) = cg%mg%fftr(:, :, :) * cg%mg%fft_norm ; call dfftw_execute(cg%mg%plani) case (fft_rcr) if (allocated(cg%mg%fft)) call die("[multigrid_gravity:mgg_cg_init] fft or Green3D array already allocated") allocate(cg%mg%fft(cg%mg%nxc, cg%nyb, cg%nzb)) cg%mg%fft_norm = one / real( product(cg%n_b(:), mask=dom%has_dir(:)) ) ! No 4 pi G factor here because the source was already multiplied by it ! FFT local solver initialization for 2nd order (3-point) Laplacian ! sin(k*x-d) - 2.*sin(k*x) + sin(k*x+d) = 2 * (cos(d)-1) * sin(k*x) = -4 * sin(d/2)**2 * sin(k*x) ! For 4th order: a*sin(k*x) + b*(sin(k*x-d) + sin(k*x+d)) + c*(sin(k*x-2*d) + sin(k*x+2*d)), a+2*b+2*c == 0 it would be: ! 4*(a+b+(a+2*b)*cos(d)) * sin(d/2)**2 * sin(k*x) ! For 6th order: a*sin(k*x) + b*(sin(k*x-d) + sin(k*x+d)) + c*(sin(k*x-2*d) + sin(k*x+2*d)) + e*(sin(k*x-3*d) + sin(k*x+3*d)), a+2*b+2*c+2*e == 0 it would be: ! 2*(3*a+4*b+2*c+4*(a+2*b+c)*cos(d)+2*(a+2*(b+c))*cos(2*d)) * sin(d/2)**2 * sin(k*x) ! asymptotically: -d**2/2 for d<pi kx(:) = cg%idx2 * (cos(dpi/cg%nxb*[( j, j=0, cg%mg%nxc-1 )]) - one) ky(:) = cg%idy2 * (cos(dpi/cg%nyb*[( j, j=0, cg%nyb-1 )]) - one) kz(:) = cg%idz2 * (cos(dpi/cg%nzb*[( j, j=0, cg%nzb-1 )]) - one) call dfftw_plan_dft_r2c_3d(cg%mg%planf, cg%nxb, cg%nyb, cg%nzb, cg%mg%src, cg%mg%fft, fftw_flags) call dfftw_plan_dft_c2r_3d(cg%mg%plani, cg%nxb, cg%nyb, cg%nzb, cg%mg%fft, cg%mg%src, fftw_flags) case (fft_dst) if (allocated(cg%mg%fftr)) call die("[multigrid_gravity:mgg_cg_init] fftr array already allocated") allocate(cg%mg%fftr(cg%mg%nxc, cg%nyb, cg%nzb)) cg%mg%fft_norm = one / (8. * real( product(cg%n_b(:), mask=dom%has_dir(:)) )) kx(:) = cg%idx2 * (cos(pi/cg%nxb*[( j, j=1, cg%mg%nxc )]) - one) ky(:) = cg%idy2 * (cos(pi/cg%nyb*[( j, j=1, cg%nyb )]) - one) kz(:) = cg%idz2 * (cos(pi/cg%nzb*[( j, j=1, cg%nzb )]) - one) call dfftw_plan_r2r_3d(cg%mg%planf, cg%nxb, cg%nyb, cg%nzb, cg%mg%src, cg%mg%fftr, FFTW_RODFT10, FFTW_RODFT10, FFTW_RODFT10, fftw_flags) call dfftw_plan_r2r_3d(cg%mg%plani, cg%nxb, cg%nyb, cg%nzb, cg%mg%fftr, cg%mg%src, FFTW_RODFT01, FFTW_RODFT01, FFTW_RODFT01, fftw_flags) case default call die("[multigrid_gravity:mgg_cg_init] Unknown FFT type.") end select ! compute Green's function for 7-point 3D discrete laplacian do i = 1, cg%mg%nxc do j = 1, cg%nyb where ((kx(i) + ky(j) + kz(:)).notequals.zero) cg%mg%Green3D(i,j,:) = half * cg%mg%fft_norm / (kx(i) + ky(j) + kz(:)) elsewhere cg%mg%Green3D(i,j,:) = zero endwhere enddo enddo #endif /* !NO_FFT */ endif end subroutine mgg_cg_init !> \brief Deallocate what was allocated in mg_cg_init subroutine mgg_cg_cleanup(cg) use grid_cont, only: grid_container implicit none type(grid_container), pointer, intent(inout) :: cg if (allocated(cg%mg%fft)) deallocate(cg%mg%fft) if (allocated(cg%mg%fftr)) deallocate(cg%mg%fftr) if (allocated(cg%mg%src)) deallocate(cg%mg%src) if (allocated(cg%mg%Green3D)) deallocate(cg%mg%Green3D) #ifndef NO_FFT if (cg%mg%planf /= 0) call dfftw_destroy_plan(cg%mg%planf) if (cg%mg%plani /= 0) call dfftw_destroy_plan(cg%mg%plani) #endif /* !NO_FFT */ end subroutine mgg_cg_cleanup !> !! \brief Make a local copy of source (density) and multiply by 4 pi G !! !! \details Typically i_sg_dens is a copy of fluidindex::iarr_all_sg. !! Passing this as an argument allows for independent computation of the potential for several density fields if necessary. !! Pass an empty array when there are no selfgravitating fluids but we have particles !! Omit i_sg_dens when calculating "outer potential" for isolated gravity boundaries. !! !! \todo compact the following more (if possible) !< subroutine init_source(i_sg_dens) use cg_cost_data, only: I_MULTIGRID use cg_leaves, only: leaves use cg_list, only: cg_list_element use cg_list_global, only: all_cg use constants, only: GEO_RPZ, LO, HI, xdim, ydim, zdim, O_I4, zero, dirtyH1, PPP_GRAV, PPP_MG use dataio_pub, only: die use domain, only: dom use func, only: operator(.notequals.), operator(.equals.) use grid_cont, only: grid_container use multigridvars, only: source, bnd_periodic, bnd_dirichlet, bnd_givenval, grav_bnd use multigrid_Laplace, only: ord_laplacian_outer use ppp, only: ppp_main use units, only: fpiG #ifdef JEANS_PROBLEM use problem_pub, only: jeans_d0, jeans_mode ! hack for tests #endif /* JEANS_PROBLEM */ #ifdef NBODY_MULTIGRID use particle_maps, only: map_particles #endif /* NBODY_MULTIGRID */ implicit none integer(kind=4), dimension(:), optional, intent(in) :: i_sg_dens !< indices to selfgravitating fluids real :: fac integer :: i, side type(cg_list_element), pointer :: cgl type(grid_container), pointer :: cg logical :: apply_src_Mcorrection character(len=*), parameter :: mgi_label = "grav_MG_init_source" call ppp_main%start(mgi_label, PPP_GRAV + PPP_MG) call all_cg%set_dirty(source, 0.979*dirtyH1) something_in_particles = .false. if (present(i_sg_dens)) then if (size(i_sg_dens) > 0) then cgl => leaves%first do while (associated(cgl)) cg => cgl%cg call cg%costs%start cgl%cg%q(source)%arr(RNG) = fpiG * sum(cg%u(i_sg_dens, RNG), dim=1) call cg%costs%stop(I_MULTIGRID) cgl => cgl%nxt enddo else call leaves%set_q_value(source, 0.) ! no selfgravitating fluids => vacuum unless we have particles endif #ifdef NBODY_MULTIGRID call map_particles(source, fpiG) something_in_particles = .true. #endif /* NBODY_MULTIGRID */ else call leaves%set_q_value(source, 0.) ! empty domain for "outer potential" calculation endif select case (grav_bnd) case (bnd_periodic) ! probably also bnd_neumann call leaves%subtract_average(source) case (bnd_dirichlet) #ifdef JEANS_PROBLEM if (jeans_mode == 1) call leaves%q_add_val(source, - fpiG * jeans_d0) ! remove density bias #endif /* JEANS_PROBLEM */ case (bnd_givenval) ! convert potential into a layer of imaginary mass (subtract second derivative normal to computational domain boundary) cgl => leaves%first do while (associated(cgl)) cg => cgl%cg apply_src_Mcorrection = any(cg%ext_bnd(:,:)) .and. (ord_laplacian_outer == -O_I4) ! an improvement for Mehrstellen Laplace operator if (apply_src_Mcorrection) cg%wa(RNG) = 0. do side = LO, HI if (cg%ext_bnd(xdim, side)) then fac = 2. * cg%idx2 / fpiG if (dom%geometry_type == GEO_RPZ .and. (cg%x(cg%ijkse(xdim,side)).notequals.zero)) & & fac = fac - 1./(cg%dx * cg%x(cg%ijkse(xdim,side)) * fpiG) !> BEWARE is it cg%x(ie), cg%x(ie+1) or something in the middle? cgl%cg%q(source)%arr (cg%ijkse(xdim,side), cg%js:cg%je, cg%ks:cg%ke) = & & cgl%cg%q(source)%arr(cg%ijkse(xdim,side), cg%js:cg%je, cg%ks:cg%ke) - & & cg%mg%bnd_x( cg%js:cg%je, cg%ks:cg%ke, side) * fac if (apply_src_Mcorrection) cg%wa(cg%ijkse(xdim,side), cg%js:cg%je, cg%ks:cg%ke) = cg%wa(cg%ijkse(xdim,side), cg%js:cg%je, cg%ks:cg%ke) + 1 endif enddo do side = LO, HI if (cg%ext_bnd(ydim, side)) then if (dom%geometry_type == GEO_RPZ) then do i = cg%is, cg%ie if (cg%x(i).notequals.zero) cg%q(source)%arr(i, cg%ijkse(ydim,side), cg%ks:cg%ke) = & & cg%q(source)%arr(i, cg%ijkse(ydim,side), cg%ks:cg%ke) - & & cg%mg%bnd_y (i, cg%ks:cg%ke, side) * 2. * cg%idy2 / fpiG / cg%x(i)**2 enddo else cg%q(source)%arr (cg%is:cg%ie, cg%ijkse(ydim,side), cg%ks:cg%ke) = & & cg%q(source)%arr(cg%is:cg%ie, cg%ijkse(ydim,side), cg%ks:cg%ke) - & & cg%mg%bnd_y (cg%is:cg%ie, cg%ks:cg%ke, side) * 2. * cg%idy2 / fpiG endif if (apply_src_Mcorrection) cg%wa(cg%is:cg%ie, cg%ijkse(ydim,side), cg%ks:cg%ke) = cg%wa(cg%is:cg%ie, cg%ijkse(ydim,side), cg%ks:cg%ke) + 1 endif enddo do side = LO, HI if (cg%ext_bnd(zdim, side)) then cg%q(source)%arr (cg%is:cg%ie, cg%js:cg%je, cg%ijkse(zdim,side)) = & & cg%q(source)%arr(cg%is:cg%ie, cg%js:cg%je, cg%ijkse(zdim,side)) - & & cg%mg%bnd_z (cg%is:cg%ie, cg%js:cg%je, side) * 2. * cg%idz2 / fpiG if (apply_src_Mcorrection) cg%wa(cg%is:cg%ie, cg%js:cg%je, cg%ijkse(zdim,side)) = cg%wa(cg%is:cg%ie, cg%js:cg%je, cg%ijkse(zdim,side)) + 1 endif enddo if (apply_src_Mcorrection) then where (cg%wa(RNG).equals.2.0) & cg%q(source)%arr(RNG) = cg%q(source)%arr(RNG) * 5./6. where (cg%wa(RNG).equals.3.0) & cg%q(source)%arr(RNG) = cg%q(source)%arr(RNG) * 2./3. endif cgl => cgl%nxt enddo case default call die("[multigrid_gravity:init_source] Unknown boundary type") end select call leaves%check_dirty(source, "init_src") call ppp_main%stop(mgi_label, PPP_GRAV + PPP_MG) end subroutine init_source !> !! \brief Multigrid gravity driver. This is the only multigrid routine intended to be called from the gravity module. !! This routine is also responsible for communicating the solution to the rest of world via sgp array. !< subroutine multigrid_solve_grav(i_sg_dens) use cg_leaves, only: leaves use constants, only: sgp_n, tmr_mg use multigrid_helpers, only: all_dirty use multigridvars, only: solution, tot_ts, ts, grav_bnd, bnd_dirichlet, bnd_givenval, bnd_isolated use multipole, only: multipole_solver, singlepass use named_array_list, only: qna use timer, only: set_timer implicit none integer(kind=4), dimension(:), intent(in) :: i_sg_dens !< indices to selfgravitating fluids integer :: grav_bnd_global ts = set_timer(tmr_mg, .true.) call all_dirty grav_bnd_global = grav_bnd if (grav_bnd_global == bnd_isolated) then grav_bnd = bnd_dirichlet vstat%cprefix = "Gi-" else #ifdef COSM_RAYS vstat%cprefix = "G-" #else /* !COSM_RAYS */ vstat%cprefix = "" #endif /* !COSM_RAYS */ endif call init_source(i_sg_dens) if (grav_bnd_global == bnd_isolated .and. singlepass) then call multipole_solver grav_bnd = bnd_givenval call init_source(i_sg_dens) vstat%cprefix = "Gm-" endif call poisson_solver(inner) call leaves%q_copy(solution, qna%ind(sgp_n)) if (grav_bnd_global == bnd_isolated .and. .not. singlepass) then grav_bnd = bnd_givenval vstat%cprefix = "Go-" call multipole_solver call init_source call poisson_solver(outer) call leaves%q_add(solution, qna%ind(sgp_n)) ! add solution to sgp endif grav_bnd = grav_bnd_global ts = set_timer(tmr_mg) tot_ts = tot_ts + ts end subroutine multigrid_solve_grav !> \brief Recover sgp field from history logical function recover_sgp() use constants, only: sgp_n use named_array_list, only: qna implicit none recover_sgp = recover_sg(qna%ind(sgp_n), SGP) end function recover_sgp !> \brief Recover sgpm field from history logical function recover_sgpm() use constants, only: sgpm_n use named_array_list, only: qna implicit none recover_sgpm = recover_sg(qna%ind(sgpm_n), SGPM) end function recover_sgpm !> \brief Recover a potential field from history logical function recover_sg(ind, how_old) result(initialized) use cg_leaves, only: leaves use dataio_pub, only: warn use global, only: nstep use mpisetup, only: master use multigridvars, only: grav_bnd, bnd_isolated use multipole, only: singlepass implicit none integer(kind=4), intent(in) :: ind integer(kind=4), intent(in) :: how_old integer(kind=4) :: i_hist initialized = .false. if (associated(inner%old%latest)) then i_hist = which_history(inner) call leaves%q_copy(i_hist, ind) initialized = .true. if (grav_bnd == bnd_isolated .and. .not. singlepass) then if (associated(outer%old%latest)) then i_hist = which_history(outer) call leaves%q_add(i_hist, ind) else initialized = .false. if (master) call warn("[multigrid_gravity:recover_sg] i-history without o-history available. Ignoring.") endif endif else if (master .and. nstep > 0) call warn("[multigrid_gravity:recover_sg] no i-history available") endif call leaves%leaf_arr3d_boundaries(ind) contains integer(kind=4) function which_history(hist) result(ih) use constants, only: INVALID use dataio_pub, only: die implicit none type(soln_history) :: hist select case (how_old) case (SGP) ih = hist%old%latest%i_hist case (SGPM) if (associated(hist%old%latest%earlier)) then ih = hist%old%latest%earlier%i_hist else ih = hist%old%latest%i_hist call warn("[multigrid_gravity:recover_sg:which_history] not enough historic fields for SGPM, using latest") endif case default call die("[multigrid_gravity:recover_sg:which_history] such old history not implemented yet") ih = INVALID end select end function which_history end function recover_sg !> \brief Chose the desired poisson solver subroutine poisson_solver(history) use cg_level_finest, only: finest use cg_list_global, only: all_cg use constants, only: fft_none, dirtyH1 use dataio_pub, only: printinfo use mpisetup, only: nproc use multigrid_gravity_helper, only: fft_solve_level use multigrid_old_soln, only: soln_history use multigridvars, only: grav_bnd, bnd_givenval, stdout, source, solution use pcg, only: mgpcg, use_CG, use_CG_outer implicit none type(soln_history), intent(inout) :: history !< inner or outer potential history used for initializing first guess logical :: fft_solved fft_solved = .false. ! On single CPU use FFT if possible because it is faster. if (nproc == 1 .and. finest%level%fft_type /= fft_none) then call all_cg%set_dirty(solution, 0.978*dirtyH1) call fft_solve_level(finest%level, source, solution) call printinfo("[multigrid_gravity:poisson_solver] FFT solve on finest level, Skipping V-cycles.", stdout) fft_solved = .true. else call history%init_solution(vstat%cprefix) endif if (.not. fft_solved) then if (grav_bnd == bnd_givenval) then if (use_CG_outer) then call mgpcg(max_cycles, norm_tol) else call vcycle_hg endif else if (use_CG) then call mgpcg(max_cycles, norm_tol) else call vcycle_hg endif endif endif call history%store_solution end subroutine poisson_solver !> !! \brief The solver. Here we choose an adaptation of the Huang-Greengard V-cycle. !! For more difficult problems, like variable coefficient diffusion equation a more sophisticated V-cycle may be more effective. !< subroutine vcycle_hg use cg_leaves, only: leaves use cg_level_coarsest, only: coarsest use cg_level_connected, only: cg_level_connected_t use cg_level_finest, only: finest use cg_list_global, only: all_cg use constants, only: cbuff_len, tmr_mg, dirtyH1, PPP_GRAV, PPP_MG use dataio_pub, only: msg, die, warn, printinfo use global, only: do_ascii_dump use mpisetup, only: master use multigridvars, only: source, solution, correction, defect, verbose_vcycle, stdout, tot_ts, ts, grav_bnd, bnd_periodic use multigrid_gravity_helper, only: approximate_solution use multigrid_Laplace, only: residual use ppp, only: ppp_main use timer, only: set_timer implicit none integer :: v real :: norm_rhs, norm_lhs, norm_old, norm_lowest logical :: dump_every_step, dump_result logical, save :: norm_was_zero = .false. real, parameter :: suspicious_factor = 1.05 !> \deprecated If the norm decreases too slowly then dump diagnostic output (BEWARE: this option is for tests only) integer, parameter :: fmtlen = 32 character(len=fmtlen) :: fmt character(len=cbuff_len) :: dname integer(kind=4), dimension(4) :: mg_fields type(cg_level_connected_t), pointer :: curl integer, parameter :: some_warm_up_cycles = 1 character(len=*), parameter :: mgv_label = "grav_MG_V-cycles", mgc_label = "V-cycle " character(len=cbuff_len) :: label call ppp_main%start(mgv_label, PPP_GRAV + PPP_MG) #ifdef DEBUG inquire(file = "_dump_every_step_", EXIST=dump_every_step) ! use for debug only inquire(file = "_dump_result_", EXIST=dump_result) #else /* !DEBUG */ dump_every_step = .false. dump_result = .false. #endif /* DEBUG */ write(dname,'(2a)')trim(vstat%cprefix),"mdump" mg_fields = [ source, solution, defect, correction ] do_ascii_dump = do_ascii_dump .or. dump_every_step .or. dump_result norm_lhs = 0. norm_rhs = leaves%norm_sq(source) norm_old = norm_rhs norm_lowest = norm_rhs if (abs(norm_rhs) > 0.) then ! empty domain => potential == 0. if (master .and. norm_was_zero) call warn("[multigrid_gravity:vcycle_hg] Spontaneous mass creation detected!") norm_was_zero = .false. else call leaves%set_q_value(solution, 0.) if (.not. something_in_particles) then if (master .and. .not. norm_was_zero) call warn("[multigrid_gravity:vcycle_hg] No gravitational potential for an empty space.") norm_was_zero = .true. endif call ppp_main%stop(mgv_label, PPP_GRAV + PPP_MG) return endif ! iterations do v = 0, max_cycles write(label, '(i8)') v call all_cg%set_dirty(defect, 0.977*dirtyH1) call residual(leaves, source, solution, defect) call leaves%check_dirty(defect, "residual") if (grav_bnd == bnd_periodic) call leaves%subtract_average(defect) norm_lhs = leaves%norm_sq(defect) ts = set_timer(tmr_mg) tot_ts = tot_ts + ts if (master .and. verbose_vcycle) then if (norm_old/norm_lhs < 1.e5) then fmt='(3a,i3,a,f12.9,a,f8.2,a,f7.3)' else fmt='(3a,i3,a,f12.9,a,es8.2,a,f7.3)' endif write(msg, fmt)"[multigrid_gravity] ", trim(vstat%cprefix), "Cycle:", v, " norm/rhs= ", norm_lhs/norm_rhs, " reduction factor= ", norm_old/norm_lhs, " dt_wall= ", ts call printinfo(msg, stdout) endif vstat%count = v if (abs(norm_lhs) > 0.) then vstat%factor(vstat%count) = norm_old/norm_lhs else vstat%factor(vstat%count) = huge(1.0) endif vstat%time(vstat%count) = ts if (v>0 .and. norm_old/norm_lhs <= suspicious_factor) call all_cg%numbered_ascii_dump(mg_fields, dname, v) if (dump_result .and. norm_lhs/norm_rhs <= norm_tol) call all_cg%numbered_ascii_dump(mg_fields, dname) if (norm_lhs/norm_rhs <= norm_tol) exit call ppp_main%start(mgc_label // adjustl(label), PPP_GRAV + PPP_MG) if (v<1) then ! forgive poor convergence in some first V-cycles norm_lowest = norm_lhs else if (norm_lhs < norm_lowest) then norm_lowest = norm_lhs else if (v > some_warm_up_cycles .and. norm_lhs/norm_lowest > vcycle_abort) then vstat%norm_final = norm_lhs/norm_rhs if (.not. verbose_vcycle) call vstat%brief_v_log call die("[multigrid_gravity:vcycle_hg] Serious nonconvergence detected.") !In such case one may increase nsmool, decrease refinement depth or use FFT endif endif endif if (v > some_warm_up_cycles .and. norm_old/norm_lhs <= vcycle_giveup) then if (master) then write(msg, '(a,g8.1)')"[multigrid_gravity:vcycle_hg] Poor convergence detected. Giving up. norm_tol missed by a factor of ",norm_lhs/norm_rhs/merge(norm_tol, tiny(1.), norm_tol > 0.) call warn(msg) endif exit endif norm_old = norm_lhs ! the Huang-Greengard V-cycle call finest%level%restrict_to_floor_q_1var(defect) call all_cg%set_dirty(correction, 0.976*dirtyH1) curl => coarsest%level do while (associated(curl)) call approximate_solution(curl, defect, correction) call curl%check_dirty(correction, "Vup relax+") curl => curl%finer enddo call leaves%q_add(correction, solution) call finest%level%restrict_to_base_q_1var(solution) if (dump_every_step) call all_cg%numbered_ascii_dump(mg_fields, dname, v) call ppp_main%stop(mgc_label // adjustl(label), PPP_GRAV + PPP_MG) enddo #ifdef DEBUG call residual(leaves, source, solution, defect) #endif /* DEBUG */ if (v > max_cycles) then if (master .and. norm_lhs/norm_rhs > norm_tol) call warn("[multigrid_gravity:vcycle_hg] Not enough V-cycles to achieve convergence.") v = max_cycles endif vstat%norm_final = norm_lhs/norm_rhs if (.not. verbose_vcycle) call vstat%brief_v_log call ppp_main%stop(mgv_label, PPP_GRAV + PPP_MG) call leaves%check_dirty(solution, "final_solution") end subroutine vcycle_hg !> !! \brief Mark which old potential fields should be put into restart and dump appropriate attributes !< subroutine unmark_oldsoln use multigridvars, only: grav_bnd, bnd_isolated implicit none call inner%unmark if (grav_bnd == bnd_isolated) call outer%unmark end subroutine unmark_oldsoln #ifdef HDF5 subroutine write_oldsoln_to_restart(file_id) use hdf5, only: HID_T use multigridvars, only: grav_bnd, bnd_isolated use multipole, only: singlepass implicit none integer(HID_T), intent(in) :: file_id !< File identifier call inner%mark_and_create_attribute(file_id) if (grav_bnd == bnd_isolated .and. .not. singlepass) call outer%mark_and_create_attribute(file_id) end subroutine write_oldsoln_to_restart subroutine read_oldsoln_from_restart(file_id) use hdf5, only: HID_T use multigridvars, only: grav_bnd, bnd_isolated use multipole, only: singlepass implicit none integer(HID_T), intent(in) :: file_id !< File identifier call inner%read_os_attribute(file_id) if (grav_bnd == bnd_isolated .and. .not. singlepass) call outer%read_os_attribute(file_id) end subroutine read_oldsoln_from_restart #endif /* HDF5 */ end module multigrid_gravity
gpl-3.0
mreverdy/A-GCM
A-GCM_calmdz.f90
2
492383
!****************************************************************************! ! ! ! GOECP 1.00 ! ! ! ! ! ! Mathieu Reverdy / LMD / ESA ! ! last update **/**/**** ! ! ! ! ! ! 1) Purpose : compute instantaneous and daily mean profiles of Scattering ! ! Ration (SR), Color Ratio (CR) & Depolarization Ratio (DR) ! ! over a model grid. ! ! ! ! Compute various daily/monthly cloudiness over a model grid : ! ! - Map of Low Mid High cloud cover ! ! - 3D Cloud Fraction ! ! - 3D Cloud Phase ! ! - SR Histograms ! ! ! ! 2) Input : SDS & META variables from CALIPSO hdf level1 Data files. ! ! ! ! 3) Output : - 3D_CloudFraction : ! ! clcalipso(lon,lat,alt,time) ! ! clrcalipso(lon,lat,alt,time) ! ! uncalipso(lon,lat,alt,time) ! ! ! ! - Map of Low Mid High : ! ! cllcalipso(lon,lat,time) ! ! clmcalipso(lon,lat,time) ! ! clhcalipso(lon,lat,time) ! ! cltcalipso(lon,lat,time) ! ! clccalipso(lon,lat,time) ! ! ! ! - SR_Histo : ! ! cfad_lidarsr532_Occ(lon,lat,alt,box,time) ! ! cfad_lidarsr532_Occ2(lon,lat,alt,box2,time) ! ! ! ! - 3D_CloudPhase : ! ! ice_cloud(lon,lat,alt,time) ! ! water_cloud(lon,lat,alt,time) ! ! ! ! - instant_SR_CR_DR ! ! longitude(it) ! ! latitude(it) ! ! altitude(it) ! ! time(it) ! ! SE(it) ! ! instant_SR(it,alt) ! ! instant_CR(it,alt) ! ! instant_DR(it,alt) ! ! ! ! 4) Grid : ! ! -CFMIP2 : 2° x 2° x 40levels from 0 to 19.2km ! ! (180,90,40) ! ! -CFMIP1 : 1° x 1° x 40levels from 0 to 19.2km ! ! (360,180,40) ! ! -CFMIP2.5 : 2.5° x 2.5° x 40levels from 0 to 19.2km ! ! (144,72,40) ! ! -CFMIP : 3.75° x 2.5° x 40levels from 0 to 19.2km ! ! (96,72,40) ! ! -LMDZ : 3.75° x 2.5° x 19levels from 0 to 40.4823km ! ! (96,72,19) ! ! -LMDZ40 : 3.75° x 2.5° x 40levels from 0 to 40.4823km ! ! (96,72,40) ! ! -NASA : 5° x 5° x 40levels each 480m from 0 to 19.2km ! ! (73,37,41) ! ! ! ! 5) Compilation : use the makefile "makefiles.sh" ! ! makefiles.sh $1 ! ! ifort $1.f90 -I/usr/include/hdf -L/usr/lib64/hdf -lmfhdf -ldf -ljpeg ! ! -lz -I/opt/netcdf-3.6.0-p1-ifort-64/include ! ! -L/opt/netcdf-3.6.0-p1-ifort-64/lib -lnetcdf -o $1.e ! ! ! ! 6) Last updates & bug fix : ! ! - 15/11/13 Draft ! ! ! ! ! !****************************************************************************! !************************* SUBROUTINE SCHEME ********************************! ! ! ! sdsread8 : x2 for time ! ! sdsread : x8 for atb,atb1064,mol,perp,temp,lat,lon,SE ! ! metaread : x2 for altl & altm ! ! ! !----------------------------------------------------------------------------! ! ! ! interp : x4 for Pressure and molecular ! ! atb_mol : x4 for normalized ratio & molecular calculation ! ! atb_mol_interp : x2 for molecular extrapolation ! ! SE_alt_chim : x4 for adding the SE to atb & mol ! ! ! !----------------------------------------------------------------------------! ! ! ! vertical_mean : x6 for the average of atb, mol, perp, temp ! ! zero_detect : x8 for the detection of empty boxes ! ! Surf_detect2 : x8 for adding the Surface Elevation ! ! SE_km_2_pres2 : x2 for adding the Surface Elevation ! ! SR_CR_DEPOL_mean : x16 for the SR CR & DR calculation ! ! filtre_2lvl : x4 for the SR calculation with a filter up to 21km ! ! (over 21kilometers grid such as LMDZ/LMDZ40 grid) ! ! ! !----------------------------------------------------------------------------! ! ! ! SR_CR_DR_2nc : x1 for the recording of instant_SR instant_CR and ! ! instant_DR variables in netcdf files ! ! ! !----------------------------------------------------------------------------! ! ! ! fraction_subgrid2_8km : x1 for cloud,clear,uncertain flags calculation ! ! ! !----------------------------------------------------------------------------! ! ! ! create_mapnc : x1 for the creation of the MapLowMidHigh file ! ! create_mapnc2 : x1 for the creation of the GEWEX MapLowMidHigh file ! ! map_recvar2nc2 : x1 for the recording of map variables ! ! map_recvar2nc7 : x1 for the recording of GEWEX map variables ! ! create_diagnc : x1 for the creation of the SR_histograms file ! ! diag_recvar2nc3 : x1 for the recording of the SR_histograms variables ! ! create_profnc : x1 for the creation of the 3D_CloudFraction files ! ! prof_recvar2nc : x1 for the recording of the 3D_CloudFraction var ! ! create_depolnc3D : x1 for the creation of the 3D_CloudPhase files ! ! depol_recvar2nc : x1 for the recording of the 3D_CloudPhase var ! ! ! !----------------------------------------------------------------------------! program A-GCM use netcdf implicit none !****************************************************************************! !*!!!!!!!!!!!! DEFINITIONS & DECLARATIONS OF VARIABLES !!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !----------------------------------------------------------------------------! ! Date and time variable ! !----------------------------------------------------------------------------! ! variables used in subroutine DATE_AND_TIME() ! !****************************************************************************! ! value : 8 dimension value which contains the year,month,day,hour, ! ! minute, seconds and milliseconds of the real-time. ! ! datenc : date from the real-system clock, format: yyyymmdd. ! ! timenc : time from the real-system clock, format: hhmmss.sss. ! ! zone : represente the difference with respect to Coordinated ! ! Universal Time (UTC), format: (+-)hhmm. ! ! ! !----------------------------------------------------------------------------! ! variables used all along the program ! !****************************************************************************! ! date : first value of the variable time in the CALIPSO hdf file. ! ! year : year of the CALIPSO hdf file (derived from date var). ! ! month : month of the CALIPSO hdf file (derived from date var). ! ! day : day of the CALIPSO hd file (derived from date & month var). ! ! jour : day of the CALIPSO hd file (derived from date & month var). ! ! resd : number of days since 2000/01/01 for the trimonth period. ! ! resh : number of hour since 2000/01/01 for the trimonth period. ! ! ! !----------------------------------------------------------------------------! ! variables used in the function interdat() ! !****************************************************************************! ! interdat : routine which allow to perform the calculation of the number ! ! of days since the 2000/01/01 to the middle of the period ! ! looked by the routine. ! ! date1 : input of the routine interdat. It is the date of the midle ! ! on the period looked by the routine, format: yyyymmddhh ! ! date2 : input of the routine interdat. It is the date of the ! ! first day since the year 2000, format: yyyymmddhh. ! ! ! !----------------------------------------------------------------------------! integer,dimension(8) :: value character :: datenc*8, timenc*10, zone*5 character :: blanks*15,forme*15 character(len=15),parameter :: version="Num_version" integer :: date, year, month, day, jour integer :: date1, date2, resh integer :: interdat, ret1 real :: resd, test !----------------------------------------------------------------------------! ! Calculation of time elpased ! !----------------------------------------------------------------------------! integer :: t1, t2, ir real :: t_cpu, t_cpu_0, t_cpu_1, tempstot !----------------------------------------------------------------------------! ! Name of keyboarding data and some char variables ! !----------------------------------------------------------------------------! ! input files ! !****************************************************************************! ! file2 : path and name of hdf CALIPSO input file ! ! file3 : path and name of the file which lists all the hdf CALIPSO ! ! file name and path (=file2) ! ! ! !----------------------------------------------------------------------------! ! output files ! !****************************************************************************! ! file4 : instant_SR_CR_DR output file name ! ! file5 : 3D_CloudFraction output file name ! ! file6 : MapLowMidHigh output file name ! ! file7 : SR_histo output file name ! ! file10 : 3D_CloudFraction_Phase output file name ! ! file11 : MapLowMidHigh_Phase output file name ! ! ! !----------------------------------------------------------------------------! ! model grid ! !****************************************************************************! ! model : name of model selected (at that time only lmdz is available) ! ! gcm : name of the grid selected description in section 4) ! ! ! !----------------------------------------------------------------------------! ! switch variables ! !****************************************************************************! ! sauve : = "chim" "wrf" or "off" to record output files in ASCII ! ! switch : = "night" or "day" to select day or night mode ! ! switch2 : = "sat" or "cloudy" to select sat or cloudy mode ! ! alt_pres : = "altitude" or "pressure" to select altitude or pressure ! ! mode. ! ! ! !----------------------------------------------------------------------------! ! other char variables ! !****************************************************************************! ! metal : name of lidar altitude variable metadata over 583lvl ! ! metam : name of meteo altitude variable metadata over 33lvl ! ! sds_varname : name of SDS variables from hdf CALIPSO files ! ! datec : date in characters converted from date ! ! numfichc : number of hdf files read in characters, converted from ! ! numfich ! ! ! !----------------------------------------------------------------------------! character :: file2*1024, file3*132, file4*132 , file5*132 character :: file6*132, file7*132, file8*132, file9*132 character :: file10*132, file11*132, file12*132,file13*132 character :: file66*132 character :: model*30, filetmp*1024, filetmp2*1024,instantname*1024 character :: metal*30,metam*30 character :: command*1024, command2*1024, command3*1024,command4*1024 character :: sauve*3,gcm*8, idiagc*2, idepc*2 character :: sds_varname*100 character :: switch*5, alt_pres*8, switch2*6,instant_switch*8 character :: datec*6, numfichc*4, yearc*4 character :: grid*8, altfile*10, lonfile*18, latfile*17 100 format(A200) !----------------------------------------------------------------------------! ! id used in netcdf output files with subroutine create_*nc() ! !----------------------------------------------------------------------------! ! dimidsp : dimension id of the MaP3D variables recorded in the ncdf ! ! files ! ! dimidsm : dimension id of the MaPLowMidHigh variables recorded in the ! ! ncdf files ! ! dimidsd : dimension id of diagSR variable recorded in the ncdf file ! ! nan : nan is the NaN value in the ncdf files ! ! ! !----------------------------------------------------------------------------! real,parameter :: nan=-9999. real*4,parameter :: SeuilMol1km = 0.00015 , SeuilTemp1km = 6.5 real*4 :: seuilatb, deltatb integer :: dimidsp(4),dimidsp2(5), dimidsm(3), dimidsm2(4),dimidphase(4),dimidsd(5),dimidsdb(5) integer :: dimidhist3(4), dimidsd2(4),dimidsd3(5),dimidsd4(6),dimidpha(6) integer :: dimidhist(4),dimidhist2(4) !----------------------------------------------------------------------------! ! Output variable dimensions ! !----------------------------------------------------------------------------! ! latmax : number of the latitude boxes, according to the model chosen ! ! CFMIP=181, LMDZ=72, NASA=37 ! ! lonmax : number of the longitude boxes, CFMIP=361, LMDZ=96, NASA=73 ! ! altmax : number of the altitude boxes, CFMIP=41, LMDZ=19, NASA=41 ! ! diagmax : number of the diagSR boxes, always equal to 15 ! ! daymax : maximum number of day in a month (for the daily var) ! ! ! !----------------------------------------------------------------------------! integer :: latmax, lonmax, altmax, altmax2 integer, parameter :: diagmax = 19 , diagmax2 = 11, depolmax = 21 integer, parameter :: daymax = 31, pr2max=301, permax=241, tempmax=39 integer :: toplowl,topmidl,tophighl,toplvlsat1,toplvlsat2 integer :: altstart,altend,nol !----------------------------------------------------------------------------! ! Loop variables ! !----------------------------------------------------------------------------! ! obs & model variables ! !****************************************************************************! ! i : loop index of the number of profil in the hdf file read ! ! iz : loop index of the altitude boxes ! ! altitude : number of level of the lidar variables ! ! ! !----------------------------------------------------------------------------! ! obs variables ! !****************************************************************************! ! ilid : loop index of the lidar altitude (583) ! ! altitude2 : number of level of the meteo variables ! ! ! !----------------------------------------------------------------------------! ! CHIMERE & WRF variables ! !****************************************************************************! ! j : loop index of the latitude boxes ! ! k : loop index of the longitude boxes ! ! ! !----------------------------------------------------------------------------! ! model variables (daily/monthly) ! !****************************************************************************! ! ilon : loop index of the longitude boxes in the daily/monthly var ! ! ilat : loop index of the latitude boxes in the daily/monthly var ! ! idiag : loop index of the diagSR boxes in the daily/monthly var ! ! ! !----------------------------------------------------------------------------! ! Unspecific variables ! !****************************************************************************! ! numfich : number of hdf file read, = number of line in file3 ! ! comptpf : number of boxes crossed by the satellite ! ! box : number total of boxes in the WRF or CHIMERE grid ! ! ! !----------------------------------------------------------------------------! integer :: iz, i, j, k, ilat, ilon, ialt, ilid, idiag, idep, ipr2,iperp,itemp integer(kind=2),parameter :: altitude2 = 33 integer(kind=2),parameter :: altitude = 583 integer :: numfich, comptpf, box , nphase !----------------------------------------------------------------------------! ! Status variables ! !----------------------------------------------------------------------------! ! err : return 0 if the file could be opened ! ! OK_buffer : return 0 if the allocation is OK ! ! ! !----------------------------------------------------------------------------! integer :: err , OK_buffer !----------------------------------------------------------------------------! ! Input variable dimensions ! !----------------------------------------------------------------------------! ! it : number of profil (=nprof) in the hdf file read (about 60000) ! ! ! !----------------------------------------------------------------------------! integer :: it integer*4,dimension(:,:),allocatable :: indretmean, indtotmean, indtot integer*4,dimension(:,:),allocatable :: indretlowmean,indretmidmean integer*4,dimension(:,:),allocatable :: indrethighmean integer*4,dimension(:),allocatable :: indret, indretlow, indretmid integer*4,dimension(:),allocatable :: indrethigh !----------------------------------------------------------------------------! ! SDS variables from CALIPSO hdf files, extracted by routine sdsread (1bit) &! ! sdsread8 (8bit) ! !----------------------------------------------------------------------------! ! atb : Total_Attenuated_Backscatter_532 per meter per steradian ! ! has dimension (altitude,nprof) ! ! mol : Molecular_Number_Density in count numerical CN has dimension ! ! (altitude2,nprof) ! ! pres : Pressure in hPa has dimension (altitude2) ! ! temps : Profil_UTC_time has format yymmdd.ffffffff, has dimension ! ! (nprof) ! ! vartmp8 : Temporal var for the time reading, has dimension (nprof) ! ! vartmp : Temporal var for the lat,lon,SE reading, has dimension ! ! (nprof) ! ! temps2 : Time converted in UTC fractionned hour of a day (ex : 1.5 = ! ! 1h30 am), has dimension (nprof) ! ! lat : Latitude in degrees, has dimension (nprof) ! ! lon : Longitude in degrees, has dimension (nprof) ! ! SE : Surface_Elevation in kilometers, has dimension (nprof) ! ! ! !----------------------------------------------------------------------------! real,dimension(:,:),allocatable :: atb, mol, pres, atb2, perp, temp real*8,dimension(:),allocatable :: temps, temps2,temps2wrf real*8,dimension(:,:),allocatable :: vartmp8 real,dimension(:,:),allocatable :: vartmp real,dimension(:),allocatable :: lat, lon real,dimension(:),allocatable :: SE,SEwrf real,dimension(:),allocatable :: latwrf,lonwrf !----------------------------------------------------------------------------! ! SDS variables interpolated verticaly from CALIPSO variables ! !----------------------------------------------------------------------------! ! mol2 : Molecular interpolated from 33lvl to 583lvl in CN ! ! dim=(altitude,nprof) ! ! pres2 : Pressure interpolated from 33lvl to 583lvl in hPa ! ! dim=(altitude,nprof) ! ! mol3 : Molecular converted from mol2(CN) in km-1 sr-1 ! ! dim=(altitude,nprof) ! ! SEp : Surface_Elevation in hPa derived from SE(km), dim=(nprof) ! ! ! !----------------------------------------------------------------------------! real,dimension(:,:),allocatable :: mol2, pres2, mol3, mol4, temp2 real,dimension(:),allocatable :: SEp !----------------------------------------------------------------------------! ! Output & Grid variables ! !----------------------------------------------------------------------------! ! latmod : values of model latitude from 90 to -90 ! ! dimension : CFMIP=181, LMDZ=72, NASA=37 ! ! lonmod : values of model longitude from 180 to -180 ! ! dimension : CFMIP=361, LMDZ=96, NASA=73 ! ! altmod : values of model altitude from 0 to 19.2km (CFMIP) or 40.5km ! ! (LMDZ) ! ! dimension : CFMIP=41, LMDZ=19, NASA=41 ! ! model, has dimension 41 or 19 ! ! prestop : same var as altmod in pressure mod ! ! srmod : values of diagSR, dimension always equal to 15 ! ! values : -1,0,0.01,1.2,2,3,5,10,20,30,40,50,60,80,100 ! ! pr2moy : observed atb averaged on altmod lvl with the routine ! ! vertical_mean,following the satellite, ! ! dim=(altmax,nprof) ! ! molmoy : mol3 averaged on altmod lvl with the routine vertical_mean, ! ! following the satellite, dim=(altmax,nprof) ! ! srmoy : scattering ratio calculated with pr2moy and molmoy, ! ! dim=(altmax,nprof) ! ! indice : number of atb iteration in an altitude box ! ! indicem : number of mol iteration in an altitude box ! ! indiceh : number of time iteration in a lat/lon/alt box with CHIM/WRF ! ! model ! ! mheure : time averaged on lon/lat/alt grid with CHIM/WRF model ! ! ! !----------------------------------------------------------------------------! real*4,dimension(:),allocatable :: latmod, lonmod, srmod, prestop, depolmod, pr2mod, srdepmod,atbrmod, tempmod!, crmod real*4,dimension(:),allocatable :: latmid, lonmid real,dimension(:),allocatable :: altmod, altmid,tempmid real,dimension(:,:),allocatable :: altmod_bound, tempmod_bound real,dimension(:,:),allocatable :: pr2moy, molmoy, srmoy,depolmoy, pr2moy2,crmoy,perpmoy,parmoy, tempmoy real,dimension(:,:),allocatable :: indice, indicem, indiceh, indice2,indicep,indicep2,indicetemp real*4,dimension(:,:),allocatable :: mheure real*4,dimension(:,:),allocatable :: SRwrf,CRwrf,DEPOLwrf !----------------------------------------------------------------------------! ! LMDZ output variables ! !----------------------------------------------------------------------------! ! instantaneous fraction : dim=(altmax,nprof) ! !****************************************************************************! ! uncertfraction : uncertain fraction flag 0/1 for each profil and each ! ! altitude, calculated with routine fraction_subgrid2 ! ! satfraction : fully attenuated flag 0/1 ! ! cloudfraction : cloudy fraction flag 0/1 ! ! clearfraction : clear fraction flag 0/1 ! ! nanfraction : NaN fraction flag 0/1 ! ! sefraction : Surface_Elevation fraction flag 0/1 ! ! fractot : all 6 fraction unified in a single var, by flag 1,2,3,! ! 4,5,6 used in the routine fraction_subgrid3 : ! ! 1=sat, 2=clear, 3=uncert, 4=nan, 5=SE, 6=cloud ! ! ! !----------------------------------------------------------------------------! ! daily fraction : dim=(lonmax,latmax,altmax,day) ! !****************************************************************************! ! uncertfractday : uncertfraction averaged on LMDZ/CFMIP/NASA grid day by! ! day. ! ! satfractday : satfraction averaged on LMDZ/CFMIP/NASA grid ! ! cloudfractday : cloudfraction averaged on LMDZ/CFMIP/NASA grid ! ! clearfractday : clearfraction averaged on LMDZ/CFMIP/NASA grid ! ! nanfractday : nanfraction averaged on LMDZ/CFMIP/NASA grid ! ! sefractday : sefraction averaged on LMDZ/CFMIP/NASA grid ! ! indday : number of sat/cloud/clear/uncert values on ! ! lon/lat/alt/day boxes ! ! inddaytot : number of sat/cloud/clear/uncert/nan/se values on ! ! lon/lat/alt/day boxes ! ! ! !----------------------------------------------------------------------------! ! monthly fraction : dim=(lonmax,latmax,altmax) ! !****************************************************************************! ! monthuncertfract : uncertfractday averaged on all days of the month ! ! monthsatfract : satfractday averaged on all days of the month ! ! monthcloudfract : cloudfractday on all days of the month ! ! monthclearfract : clearfractday on all days of the month ! ! monthnanfract : nanfractday averaged on all days of the month ! ! monthsefract : sefractday averaged on all days of the month ! ! indpermonth : number of sat/cloud/clear/uncert fractday on ! ! lon/lat/alt boxes ! ! indpermonthtot : number of sat/cloud/clear/uncert/nan/se fractday on ! ! lon/lat/alt boxes ! ! ! !----------------------------------------------------------------------------! ! instantaneous isccp : dim=(nprof) ! !****************************************************************************! ! isccplow : isccp low cloud flag 0/1 for each profil ! ! isccpmid : isccp mid cloud flag 0/1 for each profil ! ! isccphigh : isccp high cloud flag 0/1 for each profil ! ! colcloud : isccp column cloud flag 0/1 for each profil ! ! colclear : isccp column clear flag 0/1 for each profil ! ! ! !----------------------------------------------------------------------------! ! daily isccp : dim=(lonmax,latmax,daymax) ! !****************************************************************************! ! isccplowday : isccplow averaged on LMDZ/CFMIP/NASA grid ! ! isccpmidday : isccpmid averaged on LMDZ/CFMIP/NASA grid ! ! isccphighday : isccphigh averaged on LMDZ/CFMIP/NASA grid ! ! colcloudday : colcloud averaged on LMDZ/CFMIP/NASA grid ! ! colclearday : colclear averaged on LMDZ/CFMIP/NASA grid ! ! isccpindday : number of isccp low/mid/high on a lon/lat/day box ! ! ! !----------------------------------------------------------------------------! ! monthly isccp : dim=(lonmax,latmax) ! !****************************************************************************! ! monthisccplow : isccplowday averaged on all days of the month ! ! monthisccpmid : isccpmidday averaged on all days of the month ! ! monthisccphigh : isccphighday averaged on all days of the month ! ! monthcolcloud : colcloudday averaged on all days of the month ! ! monthcolclear : colclearday averaged on all days of the month ! ! isccpdaypermonth: number of monthisccp low/mid/high on a lon/lat box ! ! ! !----------------------------------------------------------------------------! ! diagSR variables ! !****************************************************************************! ! diagSR : number of occurence of a SR value in one of the 15 ! ! different interval defined with srmod ! ! dim=(lonmax,latmax,altmax,daymax,diagmax) ! ! monthdiagSR : diagSR averaged on all days of the month ! ! dim=(lonmax,latmax,altmax,diagmax) ! ! sumdiag : sum of diagSR at an altitude ! ! ! !----------------------------------------------------------------------------! real,dimension(:,:),allocatable :: uncertfraction,satfraction, & cloudfraction,clearfraction, & nanfraction,sefraction, & rejfraction,fractot,cloudfraction2 real,dimension(:,:,:,:),allocatable :: cloudfractday, clearfractday, & ! satfractday, sefractday , & uncertfractday, &! nanfractday, & indday!,inddaytot real,dimension(:,:,:),allocatable :: monthcloudfract,monthclearfract,& monthuncertfract, &!monthnanfract, & ! monthsatfract, monthsefract, & indpermonth,indphasepermonth integer,dimension(:,:,:),allocatable :: indnan integer,dimension(:),allocatable :: isccplow, isccpmid, isccphigh, & colcloud!, colclear integer,dimension(:,:),allocatable :: isccpliq, isccpice integer,dimension(:,:,:),allocatable :: isccpun integer :: indbase real,dimension(:,:,:),allocatable :: heightday2 real,dimension(:),allocatable :: height2 real,dimension(:,:),allocatable :: monthheight2 real,dimension(:,:,:),allocatable :: heightday,indheight real,dimension(:,:),allocatable :: monthheight,indmonthheight real,dimension(:),allocatable :: heightmod integer,dimension(:,:,:),allocatable :: hlow,hmid,hhigh,hcol real,dimension(:,:,:),allocatable :: hheight real,dimension(:),allocatable :: height integer :: iheight, ihist, ihisttemp, icat integer,parameter :: heightmax=41, catmax=5 integer,parameter :: histmax=11, histmax2=41, histtempmax=29,histtempmax2=28 integer,dimension(histmax2) :: histmod2 real,dimension(histmax) :: histmod real,dimension(histtempmax) :: histtempmod real,dimension(histtempmax2) :: histtempmod2 integer,dimension(:,:,:),allocatable :: hcoltemp,hlowtemp,hmidtemp,hhightemp real,dimension(:,:,:),allocatable :: coltemp,lowtemp,midtemp,hightemp real,dimension(:,:,:),allocatable :: indcoltemp,indlowtemp,indmidtemp,indhightemp real,dimension(:,:),allocatable :: monthlowtemp,monthmidtemp,monthhightemp,monthcoltemp real,dimension(:,:),allocatable :: indmonthlowtemp,indmonthmidtemp,indmonthhightemp,indmonthcoltemp real,dimension(:,:,:),allocatable :: isccplowday, isccpmidday, & isccphighday, isccpindday, & isccpinddaylow, isccpinddaymid, & colcloudday real*8 :: colclearres real :: isccptemp real,dimension(:,:,:,:),allocatable :: isccpiceday, isccpliqday real,dimension(:,:,:,:,:),allocatable :: isccpunday real,dimension(:,:,:,:),allocatable :: isccpphaseday real,dimension(:,:,:),allocatable :: isccpdustday real,dimension(:,:,:),allocatable :: monthisccpice, monthisccpliq real,dimension(:,:,:,:),allocatable :: monthisccpun real,dimension(:,:,:),allocatable :: monthisccpphase,indmonthphase real,dimension(:,:,:),allocatable :: indmonthphase2 integer,dimension(:,:,:),allocatable :: indmonthphase3D real,dimension(:,:),allocatable :: monthisccplow, monthisccpmid, & monthisccphigh, isccpdaypermonth, & isccpdaypermonthlow, & isccpdaypermonthmid, & monthcolcloud, monthcolclear real,dimension(:,:,:,:),allocatable :: diagSR real,dimension(:,:,:,:,:),allocatable :: diagSRpha real,dimension(:,:,:,:,:),allocatable :: diagPHA integer*4 :: sumdiag !----------------------------------------------------------------------------! ! META variables ! !----------------------------------------------------------------------------! ! altl : altitude of lidar lvl in kilometer, dim=(altitude) ! ! altm : altitude of meteo lvl in kilometer, dim=(altitude2) ! ! ! !----------------------------------------------------------------------------! real*4,dimension(:),allocatable :: altl, altm integer :: seuilsnrlow, seuilsnrhigh integer :: nanprof, nansat, nanmid, nanlow integer :: icewaterres real,parameter :: alpha=0.0028, beta=0.0458, alpha1=3., beta1=0.0576 real,parameter :: alpha50=9.0322e+03, beta50=-2.1358e+03, gamma50=173.3963, delta50=-3.9514, epsilon50=0.2559, zeta50=-9.4776e-04 real,parameter :: Ahoi=0.1667, Bhoi=-0.01 real :: depoltmp, perptmp1, perptmp2 real,dimension(:,:),allocatable :: icecloud, watercloud,phasecloud real,dimension(:,:,:),allocatable :: uncloud real,dimension(:,:,:,:),allocatable :: icecloudfractday, watercloudfractday,indphaseday real,dimension(:,:,:,:),allocatable :: phasefractday,inddayphase real,dimension(:,:,:,:,:),allocatable :: uncloudfractday real,dimension(:,:,:,:),allocatable :: indphasefractday real,dimension(:,:,:,:,:),allocatable :: indphaseunday real,dimension(:,:,:),allocatable :: monthicecloud, monthwatercloud real,dimension(:,:,:),allocatable :: indphasemonth real,dimension(:,:,:,:),allocatable :: monthuncloud real,dimension(:,:,:),allocatable :: monthphasecloud real,dimension(:,:,:),allocatable :: monthcftemp,monthcftempice real,dimension(:,:,:),allocatable :: monthcftempliq real,dimension(:,:,:),allocatable :: monthcftempphase,indmonthphasetemp real,dimension(:,:,:),allocatable :: indcftemppermonth real,dimension(:,:,:,:),allocatable :: indcftempphase,indcftemp real,dimension(:,:,:,:),allocatable :: cftempday,cftempphaseday real,dimension(:,:,:,:),allocatable :: cftempiceday,cftempliqday real,dimension(:,:),allocatable :: cftemp,cftempliq,cftempice real :: cfsumtemp ! variable pour fichier phase occurrences real*4,dimension(:,:,:),allocatable :: tot_ind,cloud_ind,ice_ind,water_ind real*4,dimension(:,:,:,:),allocatable :: un_ind metal='Lidar_Data_Altitudes' ! name of meta var metam='Met_Data_Altitudes' !****************************************************************************! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !****************************************************************************! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* SELECTION OF INPUT/OUPUT PARAMETER *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !------------------- Open output grid file -----------------------! ! ! ! The format you have to enter is : ! ! "Map3D330m_",period,day/night,grid,version ! ! ex : "Map3D330m_200701_night_CFMIP_1.0" ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'output Prof file name = ' read *, file5 if (err==0) exit enddo !------------------- Open input data file ------------------------! ! ! ! You have to enter the path and the name of the file which ! ! lists all the hdf CALIPSO ! ! ex : "/homedata/mreverdy/GOCCP/Liste/200701_night" ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'input file name = ' read *, file3 open(unit=1,file=file3,iostat=err,status='OLD') if (err==0) exit print *,'--- input file not found' enddo !--------------------- Select the model --------------------------! ! ! ! model = "lmdz" "chim" or "wrf" to select the LMDZ CHIMERE or ! ! WRF model ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'Enter the model : ' read *, model if (err==0) exit enddo !----------------- Select the day or night -----------------------! ! ! ! Select day or night Data version, because the process is not ! ! the same during night and day ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'Enter night or day : ' read *, switch if (err==0) exit enddo !-------------------- Select the grid ----------------------------! ! ! ! - "CFMIP" : 1° x 1° x 41levels each 480m from 0 to 19.2km ! ! (361,181,41) ! ! - "LMDZ" : 3.75° x 2.53° x 19levels from 0 to 40.4823km ! ! (96,72,19) ! ! - "NASA" : 5° x 5° x 41levels each 480m from 0 to 19.2km ! ! (73,37,41) ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'Enter the grid : ' read *, gcm if (err==0) exit enddo !----------------- Select pressure or altitude -------------------! ! ! ! Select "pressure" or "altitude" version of ouput data ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'Enter vertical unit : ' read *, alt_pres if (err==0) exit enddo !----------------- Select sat or cloudy mode ---------------------! ! ! ! Select "sat" or "cloudy" mode in order to count the first ! ! fully attenuated point as a cloudy point in the cloudfraction ! ! if "cloudy" mode is selected, and as a fully attenuated point ! ! if "sat" mode is selected. This change appears in the routine ! ! subgrid_fraction2. ! ! ! !-----------------------------------------------------------------! do write (*,'(a)',advance='no') 'Enter sat or cloudy mode : ' read *, switch2 if (err==0) exit enddo print *, 'input parameters entered' !****************************************************************************! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !****************************************************************************! !_____________________________________________________________________________ ! ! Temps CPU de calcul initial. call cpu_time(t_cpu_0) ! Temps elapsed de reference. call system_clock(count=t1, count_rate=ir) !_____________________________________________________________________________ ! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* LOADING LON-LAT-ALT-SR-DEPOL-PR2 GRID VECTORS *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! ! Read parameter file open(5,file='/homedata/mreverdy/GOCCP/'//trim(gcm)//'.p') read(5,*)grid, altmax2, altmax, latmax, lonmax, toplowl, topmidl, tophighl, altfile, latfile, lonfile close(5) print *, 'Grid parameter file read' allocate(heightmod(heightmax)) allocate(latmod(latmax),lonmod(lonmax),prestop(altmax),altmod(altmax2),srmod(diagmax),pr2mod(pr2max),atbrmod(permax), tempmod(tempmax), & altmid(altmax),latmid(latmax-1),lonmid(lonmax-1), depolmod(depolmax), srdepmod(pr2max),altmod_bound(altmax,2)) allocate(tempmod_bound(tempmax-1,2),tempmid(tempmax-1)) heightmod(:)=0; prestop(:)=0;latmod(:)=0;lonmod(:)=0; altmod(:)=0;srmod(:)=0; depolmod(:)=0; pr2mod(:)=0;atbrmod(:)=0;tempmod(:)=0; altmid(:)=0; latmid(:)=0; lonmid(:)=0; srdepmod(:)=0; altmod_bound(:,:)=0; tempmod_bound(:,:)=0;tempmid(:)=0; ! loading the grid of the diagSR boxes value open(17,file='/homedata/mreverdy/GOCCP/grilles_lmdz/srmod10') !print *, 'open the file' do idiag=1,diagmax read(17,*)srmod(idiag) enddo close(17) ! loading the grid of the DepolSR boxes value open(6,file='/homedata/mreverdy/GOCCP/grilles_lmdz/depolmod') do idep=1,depolmax read(6,*)depolmod(idep) enddo close(6) ! loading the grid of the pr2 boxes value open(18,file='/homedata/mreverdy/GOCCP/grilles_lmdz/atbmod301') do ipr2=1,pr2max read(18,*)pr2mod(ipr2) enddo close(18) open(23,file='/homedata/mreverdy/GOCCP/grilles_lmdz/atbrmod241') do ipr2=1,permax read(23,*)atbrmod(ipr2) enddo close(23) ! loading the grid of the DepolSR boxes value open(20,file='/homedata/mreverdy/GOCCP/grilles_lmdz/tempmod39') do itemp=1,tempmax read(20,*)tempmod(itemp) enddo close(20) do itemp=1,tempmax-1 tempmid(itemp) = (tempmod(itemp)+tempmod(itemp+1))/2 tempmod_bound(itemp,1)=tempmod(itemp); tempmod_bound(itemp,2)=tempmod(itemp+1); enddo ! Computing the Height grid do iheight=1,heightmax-1 heightmod(iheight+1)=heightmod(iheight)+0.5 enddo ! loading the level grid (altitude or pressure) if(alt_pres=='altitude')then open(15,file='/homedata/mreverdy/GOCCP/grilles_lmdz/'//altfile) do iz=1,altmax2 read(15,*)altmod(iz) enddo do iz=1,altmax altmid(iz) = (altmod(iz)+altmod(iz+1))/2 altmod_bound(iz,1)=altmod(iz); altmod_bound(iz,2)=altmod(iz+1); enddo do iz=1,altmax if(altmod(iz+1).GE.8.64)then seuilsnrhigh=iz exit endif enddo do iz=altmax,1,-1 if(altmod(iz+1).LE.2.4)then seuilsnrlow=iz exit endif enddo elseif(alt_pres=='pressure')then if(trim(gcm).eq.'LMDZ')then open(15,file='/homedata/mreverdy/GOCCP/grilles_lmdz/pression_lmdz2.txt') else if(trim(gcm).eq.'CFMIP')then open(15,file='/homedata/mreverdy/GOCCP/grilles_lmdz/pres_cfmip') elseif(trim(gcm).eq.'NASA')then open(15,file='/homedata/mreverdy/GOCCP/grilles_lmdz/pres_cfmip') endif do iz=1,altmax read(15,*)prestop(iz) ! lmdz milieu de la couche enddo endif close(15) open(10,file='/homedata/mreverdy/GOCCP/grilles_lmdz/'//lonfile) do ilon=1,lonmax read(10,*)lonmod(ilon) !lmdz enddo do ilon=1,lonmax-1 lonmid(ilon)=(lonmod(ilon)+lonmod(ilon+1))/2 enddo close(10) open(21,file='/homedata/mreverdy/GOCCP/grilles_lmdz/'//latfile) do ilat=1,latmax read(21,*)latmod(ilat) ! lmdz enddo do ilat=1,latmax-1 latmid(ilat)=(latmod(ilat)+latmod(ilat+1))/2 enddo close(21) print *, 'latmod lonmod altmod srmod depolmod pr2mod ok' !****************************************************************************! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !****************************************************************************! !____________________________________________________________________________ ! ! Initialization of box and numfich box=0 numfich=0 ! Reading the list of hdf files 888 read(1,100,end=999)file2 print *, 'Processing with ',trim(file2) numfich=numfich+1 print *, 'lecture du fichier numero ',numfich ! initialization of var it=0; comptpf=0; date=0; year=0; month=0; day=0; filetmp2=trim(file2) !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* BEGINING OF THE READING OF THE SDS/META VAR *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! print *, 'Read the Calipso file data ...' !****************************** READING SDS VAR ****************************! call nprof(filetmp2,20,it) ! find the number of profil it ! empty file checking if(it.lt.500)then goto 887 endif ! Allocation of interpolated variables allocate(lat(it),lon(it),SE(it),temps(it),temps2(it), & mol2(altitude,it), & mol3(altitude, it), temp2(altitude, it), stat = OK_buffer) if(alt_pres=='pressure')then allocate(pres2(altitude, it)) pres2(:,:)=0 endif ! check the allocation if (OK_buffer/=0) print *,'--- buffer allocation error ' ! Initialization of interpolated variables temps2(:)=0; temps(:)=0; mol2(:,:)=0; mol3(:,:)=0; temp2(:,:)=0;!mol4(:,:)=0; lat(:)=0;lon(:)=0;SE(:)=0;! indtot(:)=0; indret(:)=0; !---------------- Select the type of hdf file ( prov/launch )----------------! ! ! ! Depending on the version of the hdf files (prov or launch), the time ! ! variable is different. That's why, the process isn't the same in the 2cases! ! ! !----------------------------------------------------------------------------! if(file2(67:70)/="Laun")then ! Retrieve data for time variable. sds_varname='Profile_UTC_Time' call sdsread8(vartmp8,filetmp2,sds_varname,ret1) if(ret1.eq.-1)then deallocate(vartmp8) deallocate(lat,lon,SE,temps,temps2,mol2, mol3, mol4,indtot, indret, stat = OK_buffer) deallocate(indretlow,indretmid,indrethigh) command3='echo '//trim(file2)//' >> /homedata/mreverdy/GOCCP/cal_corrompu' call system(trim(command3)) goto 887 endif temps(:)=vartmp8(1,:); deallocate(vartmp8) !------------------ Calculation of the date : type Prov ---------------------! ! ! ! temps(nprof) is in International Atomic Time in UTC : yymmdd.ffffffff ! ! ! ! yy = Last two digits of year where 07 represents 2007 ! ! mm = Month in two-character subfield with values 01-12 ! ! dd = Day of month in two-character subfield with values 01-28, -29,.. ! ! "." = Period as a separator ! ! ffffffff = Fractional part of day ! ! ! !----------------------------------------------------------------------------! date=int(temps(1)) ! date of the read file year=2000+int(date/10000) ! year month=int((date-int(date/10000)*10000)/100) ! month day=date-int(date/10000)*10000-month*100 ! day jour=day print *, 'Processing for the ',day,'/',month,'/',year print *, 'File type = Prov' else !------------ Calculation of the date : type Launch (old data) --------------! ! ! ! If the file is a launch one then, the UTC time is calculated from the TAI ! ! time in seconds. ! ! This calculation is necessary for the June July and August months period. ! ! ! !----------------------------------------------------------------------------! sds_varname='Profile_Time' call sdsread8(vartmp8,filetmp2,sds_varname,ret1) temps(:)=vartmp8(1,:); deallocate(vartmp8) date=int(temps(1)) year=2006 if(date.lt.425865606)then ! first value of the time in June month=6 day=int((date-423273606)/86400)+1 elseif(date.lt.428544006)then ! first value of time in July month=7 day=int((date-425865606)/86400)+1 else month=8 day=int((date-428544006)/86400)+1 ! first value of time in August endif print *, 'Processing for the ',day,'/',month,'/',year print *, 'Fichier Launch' endif ! end selection of file type !---------------- Time in day for the output netcdf files -------------------! ! ! ! Select the number of days since 2000-01-01 00:00:00 to the mid of the run ! ! period. ! ! ! ! ex : for monthly period, date is set to the 15th of the month ! ! for a trimonthly period date is set to the 15th of the second month ! ! ! !----------------------------------------------------------------------------! if(numfich.eq.1)then print *, file3(25:30) date1=((year*100+month)*100+15)*100 date2=2000010100 print *, date1 print *, date2 resh=interdat(date2,date1) ! calculation of time between the 2 period print *, resh ! in hour resd=resh/24 ! converted in days print *, resd endif ! Retrieving data for atb variable. sds_varname='Total_Attenuated_Backscatter_532' call sdsread(atb,filetmp2,sds_varname) ! Retrieving data for atb variable. sds_varname='Attenuated_Backscatter_1064' call sdsread(atb2,filetmp2,sds_varname) ! Retrieving data for atb variable. sds_varname='Perpendicular_Attenuated_Backscatter_532' call sdsread(perp,filetmp2,sds_varname) ! Retrieving data for lat variable. sds_varname='Latitude' call sdsread(vartmp,filetmp2,sds_varname) lat(:)=vartmp(1,:); deallocate(vartmp) ! Retrieving data for lon variable. sds_varname='Longitude' call sdsread(vartmp,filetmp2,sds_varname) lon(:)=vartmp(1,:); deallocate(vartmp) ! Retrieving data for mol variable. sds_varname='Molecular_Number_Density' call sdsread(mol,filetmp2,sds_varname) ! Retrieve data for temp variable. sds_varname='Temperature' call sdsread(temp,filetmp2,sds_varname) ! Retrieving data for surf_elevation !! sds_varname='Surface_Elevation' call sdsread(vartmp,filetmp2,sds_varname) SE(:)=vartmp(1,:); deallocate(vartmp) !***************************** READING META VAR *****************************! ! Retrieving data for altitude variable. call metaread(altl,metal,filetmp2) ! Retrieving data for altitude variable. call metaread(altm,metam,filetmp2) print *, 'HDF Calipso File read' print *, 'Input variables read' print *, '' !_____________________________________________________________________________ ! print *, 'Interpolation of data & molecular calculation start ...' !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* BEGINNING OF CALCULATION ON THE INPUT VARIABLES *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !************** CONVERTION OF THE UTC FRACTION IN UT HOUR *******************! !******************************* WRF MODE *********************************! if(model.eq.'wrf')then do i=1,it !!!! loop on each profil if((file2(67:70)=="Prov").or.(file2(67:70)=="AL_L"))then ! Calculation of hour UT with UTC time fraction temps2(i)=(temps(i)-date)*24 ! temps = fraction of hour in prov file type else ! Calculation of hour UT with TAI time if(file2(67:70)=="Laun")then if(date.lt.425865606)then temps2(i)=(((temps(i)-423273606)/86400+1)-day)*24 elseif(date.lt.428544006)then temps2(i)=(((temps(i)-425865606)/86400+1)-day)*24 else temps2(i)=(((temps(i)-428544006)/86400+1)-day)*24 endif endif endif enddo !else ! deallocate(temps) endif !_____________________________________________________________________________ ! !****************************** LAUNCH FILE *********************************! if(file2(67:70)=="Laun")then do i=1,it !!!! loop on each profil jour=day date=60000+day+100*month enddo endif !_____________________________________________________________________________ ! ! INTERPOLATION OF PRESSURE TEMPERATURE AND MOLECULAR FROM 33LVL TO 583LVL ! if(alt_pres=='pressure')then do i=1,it !!!! loop on each profil call interp(pres,pres2,altm,altl,i,it) call interp(mol,mol2,altm,altl,i,it) ! atb molecular without dimension enddo !!!! end of profil loop else do i=1,it !!!! loop on each profil temps2(i)=(temps(i)-date)*24 ! temps = fraction of hour in prov file type call interp(mol,mol2,altm,altl,i,it) ! atb molecular without dimension call interp(temp,temp2,altm,altl,i,it) call atb_temp_interp(temp2,altl,i,it,SeuilTemp1km,SE) ! molecular extrapolation call SE_alt_mol(SE,altl,temp2,altitude,it,i)! add the SE to mol3 enddo !!!! end of profil loop endif deallocate(temps) !************************ CALCULATION OF ATB-MOLECULAR **********************! !---------------------------- day or night mode -----------------------------! ! ! ! The calculation of normalized ratio is calculated at different altitude ! ! levels whether it is day or night time. ! ! This difference appears in the "atb_mol" routine: ! ! - between 20km and 25km during day time ! ! - between 22km and 25km during night time ! ! ! !----------------------------------------------------------------------------! !-------------------------------- PSC filter --------------------------------! ! ! ! During the polar winter, the cloud could appear up to 20km altitude at ! ! latitude higher than 60° south. That's why from June to October, the ! ! altitude calculation of the normalized ratio must be higher at these ! ! latitudes. ! ! The calculation altitude is ranged : ! ! - between 28.5km and 35km during day time ! ! - between 28.5km and 33km during night time ! ! ! !----------------------------------------------------------------------------! if(switch.eq.'day')then !!! DAY mode !!! do i=1,it !!!! loop on each profil ! PSC filter during the polar winter if((lat(i).le.-60).and.(month.ge.6).and.(month.le.10))then ! normalized ratio betwen 28.5 & 35km & molecr calculation in km-1 sr-1 call atb_mol(atb,mol2,mol3,i,it,17,42) ! Antarctic PSCs season elseif((lat(i).ge.60).and.((month.eq.12).or.(month.eq.1).or.(month.eq.2)))then call atb_mol(atb,mol2,mol3,i,it,17,42) ! Arctic PSCs season Pitts et al 2011 else ! normalized ratio betwen 20 & 25km & molecular calculation in km-1 sr-1 call atb_mol(atb,mol2,mol3,i,it,62,92) endif call atb_mol_interp(mol3,altl,i,it,SeuilMol1km,SE) ! molecular extrapolation call SE_alt_mol(SE,altl,mol3,altitude,it,i)! add the SE to mol3 call SE_alt_atb(SE,altl,atb,altitude,it,i) ! add the SE to atb enddo !!!! end of profil loop elseif(switch.eq.'night')then !!! NIGHT mode !!! do i=1,it !!!! loop on each profil ! PSC filter during the polar winter if((lat(i).le.-60).and.(month.ge.6).and.(month.le.10))then ! normalized ratio betwen 28.5 & 33km & molecr calculation in km-1 sr-1 call atb_mol(atb,mol2,mol3,i,it,24,42) elseif((lat(i).ge.60).and.((month.eq.12).or.(month.eq.1).or.(month.eq.2)))then call atb_mol(atb,mol2,mol3,i,it,24,42) ! Arctic PSCs season Pitts et al 2011 else ! normalized ratio betwen 22& 25km & molecular calculation in km-1 sr-1 call atb_mol(atb,mol2,mol3,i,it,62,78) endif !mol4(:,i)=mol3(:,i); ! keep the mol3 before extrapolation in order to count the retrieval call atb_mol_interp(mol3,altl,i,it,SeuilMol1km,SE) ! molecular extrapolation call SE_alt_mol(SE,altl,mol3,altitude,it,i) ! add the SE to mol3 call SE_alt_atb(SE,altl,atb,altitude,it,i) ! add the SE to atb enddo !!!! end of profil loop endif ! end of day/night loop print *, 'Interpolation of data & molecular calculation done' !_____________________________________________________________________________ ! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* SELECTION OF THE MODEL GRID CFMIP / LMDZ / NASA *! !* AND ALLOCATION OF THE OUTPUTS VARIABLES *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! file6='MapLowMidHigh'//trim(file5(17:))//trim(version) ! Output Map file name file66='MapHigh'//trim(file5(17:))//trim(version) ! Output Map file name file7='SR_histo'//trim(file5(17:)) //trim(version) ! Output diagSR file name file12='SR_histo_Phase'//trim(file5(17:)) //trim(version) ! Output diagSR file name file10='3D_CloudFraction_Phase'//trim(file5(17:))//trim(version) ! Output depolSR file name file13='3D_CloudFraction_Temp'//trim(file5(17:))//trim(version) file11='MapLowMidHigh_Phase'//trim(file5(17:))//trim(version) ! Output Map file name ! file12='Phase_histo'//trim(file5(17:))//trim(version) ! Output Map file name print *, 'altmax=',altmax ! Allocation / initialization of variable print *, 'Allocation / Initialization of variables...' allocate(indicep(altmax,it),indicep2(altmax,it),pr2moy2(altmax,it),indice2(altmax,it),crmoy(altmax,it)) allocate(pr2moy(altmax,it),molmoy(altmax,it),srmoy(altmax,it),depolmoy(altmax,it),perpmoy(altmax,it),parmoy(altmax,it),tempmoy(altmax,it)) allocate(indice(altmax,it),indicem(altmax,it),indicetemp(altmax,it)) if(numfich.eq.1)then ! Allocation of monthly variables allocate(indday(latmax-1,lonmax-1,altmax,daymax)) allocate(cloudfractday(latmax-1,lonmax-1,altmax,daymax), & clearfractday(latmax-1,lonmax-1,altmax,daymax)) allocate(uncertfractday(latmax-1,lonmax-1,altmax,daymax)) allocate(icecloudfractday(latmax-1,lonmax-1,altmax,daymax), & phasefractday(latmax-1,lonmax-1,altmax,daymax), & watercloudfractday(latmax-1,lonmax-1,altmax,daymax)) allocate(uncloudfractday(latmax-1,lonmax-1,altmax,daymax,catmax)) allocate(indphaseday(latmax-1,lonmax-1,altmax,daymax)) allocate(indphaseunday(latmax-1,lonmax-1,altmax,daymax,catmax)) allocate(isccplowday(latmax-1,lonmax-1,daymax), & isccpmidday(latmax-1,lonmax-1,daymax), & isccphighday(latmax-1,lonmax-1,daymax)) allocate(heightday(latmax-1,lonmax-1,daymax), & indheight(latmax-1,lonmax-1,daymax)) allocate(heightday2(latmax-1,lonmax-1,daymax)) allocate(colcloudday(latmax-1,lonmax-1,daymax), & isccpinddaylow(latmax-1,lonmax-1,daymax), & isccpinddaymid(latmax-1,lonmax-1,daymax), & isccpindday(latmax-1,lonmax-1,daymax)) allocate(cftempday(latmax-1,lonmax-1,tempmax-1,daymax), & cftempiceday(latmax-1,lonmax-1,tempmax-1,daymax), & cftempliqday(latmax-1,lonmax-1,tempmax-1,daymax), & indcftemp(latmax-1,lonmax-1,tempmax-1,daymax), & indcftempphase(latmax-1,lonmax-1,tempmax-1,daymax)) allocate(lowtemp(latmax-1,lonmax-1,daymax), & midtemp(latmax-1,lonmax-1,daymax), & hightemp(latmax-1,lonmax-1,daymax), & coltemp(latmax-1,lonmax-1,daymax)) allocate(indlowtemp(latmax-1,lonmax-1,daymax), & indmidtemp(latmax-1,lonmax-1,daymax), & indhightemp(latmax-1,lonmax-1,daymax), & indcoltemp(latmax-1,lonmax-1,daymax)) allocate(diagSR(lonmax-1,latmax-1,altmax,diagmax-1)) allocate(diagSRpha(lonmax-1,latmax-1,altmax,diagmax-8,3)) allocate(diagPHA(lonmax-1,latmax-1,altmax,tempmax-1,3)) allocate(indnan(latmax-1,lonmax-1,altmax)) allocate(indtotmean(lonmax-1,latmax-1),indtot(lonmax-1,latmax-1)) allocate(isccpliqday(latmax-1,lonmax-1,daymax,4),isccpiceday(latmax-1,lonmax-1,daymax,4)) allocate(isccpunday(latmax-1,lonmax-1,daymax,4,catmax), & isccpphaseday(latmax-1,lonmax-1,daymax,4)) endif if(alt_pres=='pressure')then allocate(SEp(it)) SEp(:)=0 endif pr2moy(:,:)=0; molmoy(:,:)=0;tempmoy(:,:)=0; srmoy(:,:)=0; depolmoy(:,:)=0; indice(:,:)=0; indicem(:,:)=0; pr2moy2(:,:)=0;indice2(:,:)=0;crmoy(:,:)=0; indicep2(:,:)=0; indicep(:,:)=0; indicetemp(:,:)=0; if(numfich.eq.1)then indday(:,:,:,:)=0; cloudfractday(:,:,:,:)=0;clearfractday(:,:,:,:)=0; uncertfractday(:,:,:,:)=0; icecloudfractday(:,:,:,:)=0; watercloudfractday(:,:,:,:)=0 uncloudfractday(:,:,:,:,:)=0; phasefractday(:,:,:,:)=0; indcftempphase(:,:,:,:)=0 indcftemp(:,:,:,:)=0 cftempday(:,:,:,:)=0 cftempiceday(:,:,:,:)=0 cftempliqday(:,:,:,:)=0 indphaseday(:,:,:,:)=0; indphaseunday(:,:,:,:,:)=0; heightday(:,:,:)=0; indheight(:,:,:)=0; heightday2(:,:,:)=0; isccplowday(:,:,:)=0;isccpmidday(:,:,:)=0;isccphighday(:,:,:)=0; colcloudday(:,:,:)=0;isccpindday(:,:,:)=0; isccpinddaylow(:,:,:)=0;isccpinddaymid(:,:,:)=0; diagSR(:,:,:,:)=0; diagSRpha(:,:,:,:,:)=0; diagPHA(:,:,:,:,:)=0; isccpliqday(:,:,:,:)=0;isccpiceday(:,:,:,:)=0; isccpunday(:,:,:,:,:)=0; isccpphaseday(:,:,:,:)=0; lowtemp(:,:,:)=0;midtemp(:,:,:)=0;hightemp(:,:,:)=0;coltemp(:,:,:)=0; indlowtemp(:,:,:)=0;indmidtemp(:,:,:)=0;indhightemp(:,:,:)=0;indcoltemp(:,:,:)=0; indtotmean(:,:)=0; indtot(:,:)=0; endif print *, '' !_____________________________________________________________________________ ! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* AVERAGING OF OBSERVATIONS DATA OVER THE VERTICAL MODEL BOXES *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! print *, 'Begin of vertical average' !**************** VERTICAL AVERAGE OF OBSERVATIONS DATA *********************! if(alt_pres=='altitude')then do i=1, it !!! BEGIN OF IT LOOP do iz=altmax,1,-1 do ilid=1,altitude if ( (altl(ilid).ge.altmod(iz)).and.(altl(ilid).lt.altmod(iz+1)))& then call vertical_mean(temp2,tempmoy,atb,indicetemp,i,iz,ilid,it,altmax,& altitude,4) call vertical_mean(atb,pr2moy,atb,indice,i,iz,ilid,it,altmax, & altitude,1) call vertical_mean(mol3,molmoy,atb,indicem,i,iz,ilid,it,altmax,& altitude,3) call vertical_mean(atb2,pr2moy2,atb,indice2,i,iz,ilid,it,altmax,& altitude,3) call vertical_mean(perp,perpmoy,atb,indicep,i,iz,ilid,it,altmax,& altitude,3) call vertical_mean(perp,parmoy,atb,indicep2,i,iz,ilid,it,altmax,& altitude,2) endif enddo enddo do iz=altmax,1,-1 call zero_detect(pr2moy,i,iz,it,altmax) call zero_detect(molmoy,i,iz,it,altmax) call zero_detect(tempmoy,i,iz,it,altmax) call zero_detect(pr2moy2,i,iz,it,altmax) call zero_detect(parmoy,i,iz,it,altmax) call zero_detect(perpmoy,i,iz,it,altmax) enddo call Surf_detect2(SE,altmod,pr2moy,altmax,it,i,alt_pres) call Surf_detect2(SE,altmod,molmoy,altmax,it,i,alt_pres) call Surf_detect2(SE,altmod,tempmoy,altmax,it,i,alt_pres) call Surf_detect2(SE,altmod,pr2moy2,altmax,it,i,alt_pres) call Surf_detect2(SE,altmod,parmoy,altmax,it,i,alt_pres) call Surf_detect2(SE,altmod,perpmoy,altmax,it,i,alt_pres) do iz=altmax,1,-1 if((trim(gcm).eq.'LMDZ').or.(trim(gcm).eq.'WRF'))then if((lat(i).le.-60).and.(month.ge.6).and.(month.le.10))then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) call SR_CR_DEPOL_mean(pr2moy2,pr2moy,crmoy,indice2,indice,i,iz,it, & altmax) call SR_CR_DEPOL_mean(parmoy,perpmoy,depolmoy,indicep2,indicep,i,iz,it, & altmax) else call filtre_2lvl(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax,gcm) call SR_CR_DEPOL_mean(pr2moy2,pr2moy,crmoy,indice2,indice,i,iz,it, & altmax) call SR_CR_DEPOL_mean(perpmoy,parmoy,depolmoy,indicep,indicep2,i,iz,it, & altmax) endif elseif(trim(gcm).eq.'LMDZ40')then if((lat(i).le.-60).and.(month.ge.6).and.(month.le.10))then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) else call filtre_2lvl(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax,gcm) endif elseif((trim(gcm).eq.'CFMIP').or.(trim(gcm).eq.'CFMIP1').or.(trim(gcm)& .eq.'CFMIP2.5').or.(trim(gcm).eq.'CFMIP80').or.(trim(gcm).eq.'CFMIP2').or.(trim(gcm).eq.'CFMIP160').or.(trim(gcm).eq.'CFMIP320'))then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) call SR_CR_DEPOL_mean(pr2moy2,pr2moy,crmoy,indice2,indice,i,iz,it, & altmax) call SR_CR_DEPOL_mean(perpmoy,parmoy,depolmoy,indicep2,indicep,i,iz,it, & altmax) elseif(trim(gcm).eq.'NASA')then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) !call filtre_2lvl(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it,altmax) endif enddo ! Detection of the Surface Elevation & set -888 for value under this ! threshold call Surf_detect(SE,altmod,srmoy,altmax,it,i) call Surf_detect(SE,altmod,crmoy,altmax,it,i) call Surf_detect(SE,altmod,depolmoy,altmax,it,i) enddo !!! END OF IT LOOP elseif(alt_pres=='pressure')then do i=1, it !!! BEGIN OF IT LOOP do iz=altmax,1,-1 do ilid=1,altitude if ( (pres2(ilid,i).gt.prestop(iz)).and.(pres2(ilid,i).lt. & prestop(iz-1)) )then call vertical_mean(atb,pr2moy,atb,indice,i,iz,ilid,it,altmax, & altitude,1) call vertical_mean(mol3,molmoy,atb,indicem,i,iz,ilid,it,altmax,& altitude,3) endif enddo enddo do iz=altmax,1,-1 call zero_detect(pr2moy,i,iz,it,altmax) call zero_detect(molmoy,i,iz,it,altmax) enddo call SE_km_2_Pres2(SE,SEp,altl,pres2,prestop,pr2moy,altmax,it,i) call SE_km_2_Pres2(SE,SEp,altl,pres2,prestop,molmoy,altmax,it,i) do iz=altmax,1,-1 if((trim(gcm).eq.'LMDZ').or.(trim(gcm).eq.'WRF'))then if((lat(i).le.-60).and.(month.ge.6).and.(month.le.10))then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) else call filtre_2lvl(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax,gcm) endif elseif(trim(gcm).eq.'LMDZ40')then if((lat(i).le.-60).and.(month.ge.6).and.(month.le.10))then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) else call filtre_2lvl(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax,gcm) endif elseif((trim(gcm).eq.'CFMIP').or.(trim(gcm).eq.'CFMIP1').or.(trim(gcm)& .eq.'CFMIP2.5').or.(trim(gcm).eq.'CFMIP80').or.(trim(gcm).eq.'CFMIP2').or.(trim(gcm).eq.'CFMIP160').or.(trim(gcm).eq.'CFMIP320'))then if ((pr2moy(iz,i).eq.(-9999)).or.(molmoy(iz,i).eq.(-9999))) & then continue else do ilid=1,altitude if ( (altl(ilid).gt.altmod(iz)).and.(altl(ilid).lt.altmod(iz+1)))& then if(mol4(ilid,i).ne.-9999)then indret(i)=indret(i)+1 endif endif enddo if (iz.lt.toplowl) then do ilid=1,altitude if ( (altl(ilid).gt.altmod(iz)).and.(altl(ilid).lt.altmod(iz+1)))& then if(mol4(ilid,i).ne.-9999)then indretlow(i)=indretlow(i)+1 endif endif enddo endif if ((iz.ge.toplowl).and.(iz.le.topmidl))then do ilid=1,altitude if ( (altl(ilid).gt.altmod(iz)).and.(altl(ilid).lt.altmod(iz+1)))& then if(mol4(ilid,i).ne.-9999)then indretmid(i)=indretmid(i)+1 endif endif enddo endif if(iz.gt.topmidl) then do ilid=1,altitude if ( (altl(ilid).gt.altmod(iz)).and.(altl(ilid).lt.altmod(iz+1)))& then if(mol4(ilid,i).ne.-9999)then indrethigh(i)=indrethigh(i)+1 endif endif enddo endif test=indretlow(i)+indretmid(i)+indrethigh(i) if(test.ne.indret(i))print *, 'error indice retrieval', indret endif call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) call SR_CR_DEPOL_mean(pr2moy2,pr2moy,crmoy,indice2,indice,i,iz,it, & altmax) call SR_CR_DEPOL_mean(parmoy,perpmoy,depolmoy,indicep2,indicep,i,iz,it, & altmax) elseif(trim(gcm).eq.'NASA')then call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, & altmax) endif enddo call SE_km_2_Pres(SE,SEp,altl,pres2,prestop,srmoy,altmax,it,i) enddo endif !!! END OF IT LOOP ! Mode wrf model if(model.eq.'wrf')goto 622 print *, 'deallocate input var' ! Deallocate SDS/META variables deallocate(atb,stat = OK_buffer) deallocate(atb2,stat = OK_buffer) deallocate(perp,stat = OK_buffer) deallocate(mol,stat = OK_buffer) deallocate(mol2,stat = OK_buffer) deallocate(mol3,stat = OK_buffer) deallocate(temp,stat = OK_buffer) deallocate(temp2,stat = OK_buffer) if(alt_pres=='pressure')deallocate(pres2,stat = OK_buffer) deallocate(altl,stat = OK_buffer) deallocate(altm,stat = OK_buffer) !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* CLOUD DIAGNOSTICS FOR ONE PROFIL *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! print *, 'allocate flag var' ! Allocation / initialization of instantaneous fraction variables allocate(cloudfraction(altmax,it),clearfraction(altmax,it),satfraction & (altmax,it), uncertfraction(altmax,it),rejfraction(altmax,it)) allocate(nanfraction(altmax,it),sefraction(altmax,it))!,fractot(altmax,it)) cloudfraction(:,:)=0; clearfraction(:,:)=0; satfraction(:,:)=0; uncertfraction(:,:)=0; nanfraction(:,:)=0;sefraction(:,:)=0;! fractot(:,:)=0 rejfraction(:,:)=0; print *, 'plop' !****************************************************************************! !******************** INSTANTANEOUS FRACTION DIAGNOSTIC *********************! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* RECORD INSTANTANEOUS SR FILES *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! seuilatb=2.5e-03 deltatb=0 ! select the instant file type: ! - on = instant classic file activated ! - off = desactivated ! - fraction = instant fraction file with GOCCP cloud mask !instant_switch='on' SELECTCASE('instant_switch') !****************************************************************************! !****************************************************************************! !****************************************************************************! !* RECORD ON *! !****************************************************************************! !****************************************************************************! !****************************************************************************! ! instant classic file with SR value CASE('on') allocate(cloudfraction2(altmax,it)) cloudfraction2(:,:)=0; write(numfichc,'(i4)')numfich write(datec,'(I6)')date write(yearc,'(I4)')year command4='echo '//trim(file2)//'| cut -d/ -f8 | cut -d. -f2 > /homedata/mreverdy/GOCCP/src/instantname'//yearc//datec(3:6)//'_'//trim(switch)//'_'//trim(gcm) CALL SYSTEM(trim(command4)) open(10,file='/homedata/mreverdy/GOCCP/src/instantname'//yearc//datec(3:6)//'_'//trim(switch)//'_'//trim(gcm)) read(10,*)instantname close(10) !print *, 'avant routine',srmoy(7,49261) !print *, molmoy(7,49261),pr2moy(7,49261) do i=1,it !!!!! BEGIN OF IT LOOP ! flag 0/1 call fraction_subgrid2_8km(seuilsnrlow,seuilsnrhigh,srmoy,pr2moy,indice, & molmoy,indicem,satfraction, & cloudfraction,clearfraction,uncertfraction, & nanfraction,sefraction,rejfraction,i,altmax,it, & toplowl,topmidl,switch,switch2) call fraction_subgrid3_8km(seuilsnrlow,seuilsnrhigh,altmod,srmoy,pr2moy, & indice,molmoy,indicem,cloudfraction2,i,altmax,it, & switch,switch2) enddo !!! END OF IT LOOP where(rejfraction.eq.1) srmoy=-777. crmoy=-777. depolmoy=-777. pr2moy=-777. molmoy=-777. parmoy=-777. perpmoy=-777. !tempmoy=-777. endwhere where(nanfraction.eq.1) srmoy=-9999. crmoy=-9999. depolmoy=-9999. pr2moy=-9999. molmoy=-9999. parmoy=-9999. perpmoy=-9999. !tempmoy=-9999. endwhere where(sefraction.eq.1) srmoy=-888. crmoy=-888. depolmoy=-888. pr2moy=-888. molmoy=-888. parmoy=-888. perpmoy=-888. tempmoy=-888. endwhere where((srmoy.ne.-9999.).and.(srmoy.ne.-777.).and.(srmoy.ne.-888.)) pr2moy=pr2moy/indice molmoy= molmoy/indicem parmoy= parmoy/indicep2 perpmoy= perpmoy/indicep endwhere where(tempmoy.ne.-888.) tempmoy= tempmoy/indicetemp endwhere print *, 'recording instant SR CR DR file' !!!!! RECORD INSTANT SR FILES WITH ATB ATBper ATBpar ATBmol file4='instant_SR_CR_DR_'//trim(instantname)//'_'//trim(switch)//'_'//trim(gcm)//'_'//trim(version)//'.nc' print *, file4 call SR_CR_DR_ATB_nc(file4,altmid,altmod_bound,resd,altmax,switch,gcm,it,lat,lon,SE,temps2,& srmoy,crmoy,depolmoy,pr2moy,molmoy,perpmoy,parmoy,tempmoy,cloudfraction2) deallocate(cloudfraction2) !****************************************************************************! !****************************************************************************! !****************************************************************************! !* RECORD OFF *! !****************************************************************************! !****************************************************************************! !****************************************************************************! ! Do not record any instant file CASE('off') do i=1,it !!!!! BEGIN OF IT LOOP ! flag 0/1 call fraction_subgrid2_8km(seuilsnrlow,seuilsnrhigh,srmoy,pr2moy,indice, & molmoy,indicem,satfraction, & cloudfraction,clearfraction,uncertfraction, & nanfraction,sefraction,rejfraction,i,altmax,it, & toplowl,topmidl,switch,switch2) !*************** instant SR corrected by delta atb ****************! enddo !!! END OF IT LOOP where(rejfraction.eq.1) srmoy=-777. crmoy=-777. depolmoy=-777. pr2moy=-777. molmoy=-777. parmoy=-777. perpmoy=-777. !tempmoy=-777. endwhere where(nanfraction.eq.1) srmoy=-9999. crmoy=-9999. depolmoy=-9999. pr2moy=-9999. molmoy=-9999. parmoy=-9999. perpmoy=-9999. !tempmoy=-9999. endwhere where(sefraction.eq.1) srmoy=-888. crmoy=-888. depolmoy=-888. pr2moy=-888. molmoy=-888. parmoy=-888. perpmoy=-888. tempmoy=-888. endwhere where((srmoy.ne.-9999.).and.(srmoy.ne.-777.).and.(srmoy.ne.-888.)) pr2moy=pr2moy/indice molmoy= molmoy/indicem parmoy= parmoy/indicep2 perpmoy= perpmoy/indicep endwhere where(tempmoy.ne.-888.) tempmoy= tempmoy/indicetemp endwhere ENDSELECT if(allocated(temps2)) deallocate(temps2,stat = OK_buffer) deallocate(SE,stat = OK_buffer) !************** INSTANTANEOUS ISCCP LOW MID HIGH FRACTION ******************! !!!!!!!!!!!!!!!!!! DEFINITION OF TOP AND BASE LAYER !!!!!!!!!!!!!!!!!!!!!!!!! ! low level < 3.2km ! 3.2 <= mid level < 6.5km ! high level >= 6.5km ! 680 hPa ===> 3.5km avec équilibre hydrostatique ! P=P0.exp(-z/H) , H=8.5 ! 440 hPa ===> 7.2km ! top lvl of isccp print *, 'diagnostic fraction nuage subgrid' ! Allocate / initialization of instantaneous isccp variables allocate(isccplow(it),isccpmid(it),isccphigh(it),colcloud(it))!, colclear(it)) allocate(watercloud(altmax,it),icecloud(altmax,it),uncloud(altmax,it,catmax),phasecloud(altmax,it)) allocate(cftemp(tempmax-1,it),cftempliq(tempmax-1,it),cftempice(tempmax-1,it)) !cftempice allocate(height(it),height2(it),isccpliq(4,it),isccpice(4,it),isccpun(4,it,catmax)) height(:)=0; height2(:)=0; icecloud(:,:)=0; watercloud(:,:)=0; uncloud(:,:,:)=0;phasecloud(:,:)=0; isccplow(:)=0; isccpmid(:)=0; isccphigh(:)=0; colcloud(:)=0; !colclear(:)=0; isccpice(:,:)=0; isccpliq(:,:)=0; isccpun(:,:,:)=0; cftemp(:,:)=0; cftempliq(:,:)=0; cftempice(:,:)=0; !! looking for limit before the 2 different SNR do iz=altmax,1,-1 if(altmod(iz).lt.8.16)then toplvlsat1=iz+1 exit endif enddo !print *, "toto1" !nol=nol_switch do i=1,it !!!!! BEGIN OF IT LOOP nanprof=0 perptmp1 =0 ! CLoud Phase diagnostic with the equation of the liquid relation between ATB ! and ATBr: ATBr = 1.3919 * ATB² + 0.0176 * ATB do iz=altmax,toplvlsat1,-1 if(cloudfraction(iz,i).gt.0.)then if(perpmoy(iz,i).gt.parmoy(iz,i))then ! noisy point = unphysical value uncloud(iz,i,5)=uncloud(iz,i,5)+1. phasecloud(iz,i)=7. else !! Curve for discrimination between ice & liquid particles perptmp1 = (pr2moy(iz,i)**5)*alpha50 + (pr2moy(iz,i)**4)*beta50 + (pr2moy(iz,i)**3)*gamma50 + (pr2moy(iz,i)**2)*delta50 + pr2moy(iz,i)*epsilon50 + zeta50 !! Curve for discrimination between ho particles & other perptmp2 = pr2moy(iz,i)*Ahoi + Bhoi if( (perpmoy(iz,i)-perptmp1).ge.0. )then if (tempmoy(iz,i).gt.0 ) then uncloud(iz,i,3)=uncloud(iz,i,3)+1. !fake ice particles watercloud(iz,i)=watercloud(iz,i)+1. !fake ice particles phasecloud(iz,i)=5. else icecloud(iz,i)=icecloud(iz,i)+1. ! ice particles phasecloud(iz,i)=2. endif elseif( (perpmoy(iz,i)-perptmp2).ge.0. )then if (tempmoy(iz,i).gt.-42 ) then watercloud(iz,i)=watercloud(iz,i)+1. phasecloud(iz,i)=1. else icecloud(iz,i)=icecloud(iz,i)+1. ! fakeliq particles uncloud(iz,i,2)=uncloud(iz,i,2)+1. !fakeliq particles phasecloud(iz,i)=4. !fakeliq particles endif else uncloud(iz,i,4)=uncloud(iz,i,4)+1. !! horizontally oriented particles phasecloud(iz,i)=6. !! horizontally oriented particles endif endif endif enddo do iz=toplvlsat1-1,1,-1 if(cloudfraction(iz,i).gt.0.)then if(perpmoy(iz,i).gt.parmoy(iz,i))then ! noisy point = unphysical value uncloud(iz,i,5)=uncloud(iz,i,5)+1. phasecloud(iz,i)=7. else !! Curve for discrimination between ice & liquid particles perptmp1 = (pr2moy(iz,i)**5)*alpha50 + (pr2moy(iz,i)**4)*beta50 + (pr2moy(iz,i)**3)*gamma50 + (pr2moy(iz,i)**2)*delta50 + pr2moy(iz,i)*epsilon50 + zeta50 !! Curve for discrimination between ho particles & other perptmp2 = pr2moy(iz,i)*Ahoi + Bhoi if( (perpmoy(iz,i)-perptmp1).ge.0. )then if (tempmoy(iz,i).gt.0 ) then uncloud(iz,i,3)=uncloud(iz,i,3)+1. !fake ice particles watercloud(iz,i)=watercloud(iz,i)+1. !fake ice particles phasecloud(iz,i)=5. else icecloud(iz,i)=icecloud(iz,i)+1. phasecloud(iz,i)=2. endif elseif( (perpmoy(iz,i)-perptmp2).ge.0. )then if (tempmoy(iz,i).gt.-42 ) then watercloud(iz,i)=watercloud(iz,i)+1. phasecloud(iz,i)=1. else icecloud(iz,i)=icecloud(iz,i)+1. ! fakeliq particles uncloud(iz,i,2)=uncloud(iz,i,2)+1. !fake liq particles phasecloud(iz,i)=4. !fake liq particles endif else uncloud(iz,i,4)=uncloud(iz,i,4)+1. !! horizontally oriented particles phasecloud(iz,i)=6. !! horizontally oriented particles endif toplvlsat2=0 if( srmoy(iz,i).gt.30)then toplvlsat2=iz if(toplvlsat2.gt.altmax-2)then print *, toplvlsat2 endif goto 99 endif endif endif enddo 99 continue if(toplvlsat2.ne.0)then ! Other level below cloud with SR>30 phase = undefined do iz=toplvlsat2-1,1,-1 if(cloudfraction(iz,i).gt.0.)then uncloud(iz,i,1)=uncloud(iz,i,1)+1. phasecloud(iz,i)=3. !! undefined cloud endif enddo toplvlsat2=0 endif do iz=1,altmax if(cloudfraction(iz,i).gt.0.)then icewaterres=watercloud(iz,i)+icecloud(iz,i)+uncloud(iz,i,1)+uncloud(iz,i,4)+uncloud(iz,i,5) if((icewaterres.gt.1.).or.(icewaterres.eq.0.))then print *, 'error sum phase=',icewaterres print *, watercloud(iz,i),icecloud(iz,i),uncloud(iz,i,:) stop endif endif enddo altend=0 altstart=0 if(nol.eq.1)then !print *, "Non Over Lap MODE" !!! NON OVERLAP MODE !!! select only clouds in the highest isccp layer !!! if isccpmid=1 then isccphigh must be 0 !!! A isccp layer can not have a cloud above B34: do iz=altmax,1,-1 if(cloudfraction(iz,i).gt.0.)then ! Search the isscp high cloud fraction if (iz.ge.topmidl) then altstart=altmax altend=topmidl exit B34 endif ! Search the isscp mid cloud fraction if ((iz.ge.toplowl).and.(iz.lt.topmidl)) then altstart=topmidl-1 altend=toplowl exit B34 endif ! Search the isscp low cloud fraction if (iz.lt.toplowl) then altstart=toplowl-1 altend=1 exit B34 endif endif enddo B34 else !print *, "Over Lap MODE" altend=1 altstart=altmax endif if(altend.ne.0)then ! to avoid clear sky profil error indbase=0 do iz=altend,altstart if(cloudfraction(iz,i).gt.0.)then ! Calculation of cloudfraction as a function of the temperature do itemp=1,tempmax-1 if ( (tempmoy(iz,i).gt.tempmod(itemp)).and. & (tempmoy(iz,i) .le.tempmod(itemp+1)) )then cftemp(itemp,i)=cftemp(itemp,i)+1 ! cf tot if( watercloud(iz,i).ne.0 )then cftempliq(itemp,i)=cftempliq(itemp,i)+1 ! cf liquid elseif( icecloud(iz,i).ne.0 )then cftempice(itemp,i)=cftempice(itemp,i)+1 ! cf ice endif endif enddo ! Indice de depolarisation (indices: 0=clear-sky, 1=liquid only; 2=mixte; 3=ice only) depoltmp=0 icewaterres=0 ! Search the isscp low cloud fraction if (iz.lt.toplowl) then isccplow(i)=1 if( icecloud(iz,i).gt.0 )then isccpice(1,i)=1 endif if( watercloud(iz,i).gt.0 )then isccpliq(1,i)=1 endif do icat=1,catmax if(uncloud(iz,i,icat).gt.0)then isccpun(1,i,icat)=1 endif enddo endif ! Search the isscp mid cloud fraction if ((iz.ge.toplowl).and.(iz.lt.topmidl)) then isccpmid(i)=1 if(icecloud(iz,i).gt.0)then isccpice(2,i)=1 endif if(watercloud(iz,i).gt.0)then isccpliq(2,i)=1 endif do icat=1,catmax if(uncloud(iz,i,icat).gt.0)then isccpun(2,i,icat)=1 endif enddo endif ! Search the isscp high cloud fraction if (iz.ge.topmidl) then isccphigh(i)=1 height(i)=altmid(iz)+0.24 indbase=indbase+1 if(indbase.eq.1)then height2(i)=altmid(iz)-0.24 endif if(icecloud(iz,i).gt.0)then isccpice(3,i)=1 endif if(watercloud(iz,i).gt.0)then isccpliq(3,i)=1 endif do icat=1,catmax if(uncloud(iz,i,icat).gt.0)then isccpun(3,i,icat)=1 endif enddo endif ! Search cloud fraction on the column colcloud(i)=1 if(icecloud(iz,i).gt.0)then isccpice(4,i)=1 endif if(watercloud(iz,i).gt.0)then isccpliq(4,i)=1 endif do icat=1,catmax if(uncloud(iz,i,icat).gt.0)then isccpun(4,i,icat)=1 endif enddo endif !! endif cloudfraction > 0 if((nanfraction(iz,i).eq.1.).or.(rejfraction(iz,i).eq.1.).or.(sefraction(iz,i).eq.1.))then nanprof=nanprof+1 endif enddo endif !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* DAILY AVERAGE OF CLOUD DIAGNOSTICS *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !******************* READING THE LAT LON MODEL GRID FILES *******************! !---------------------------- lat lon grid file -----------------------------! ! ! ! There is 3 grid in this program : ! ! ! ! -CFMIP : 1° x 1° x 41levels each 480m from 0 to 19.2km ! ! (361,181,41) ! ! -LMDZ : 3.75° x 2.53° x 19levels from 0 to 40.4823km ! ! (96,72,19) ! ! -NASA : 5° x 5° x 41levels each 480m from 0 to 19.2km ! ! (73,37,41) ! ! ! !----------------------------------------------------------------------------! !************************** BEGIN THE DAILY AVERAGE *************************! !---------------------------- lat lon grid file -----------------------------! ! ! ! increase the daily variables over the lat/lon (& alt & diag) grid ! ! ! !----------------------------------------------------------------------------! ! First level always equal to 0 because the average is perfomed between the ! level i and i-1. !print *, "toto3" do ilon=1,lonmax-1 !longitude if( (lon(i).ge.lonmod(ilon)) .and. (lon(i).lt.lonmod(ilon+1)) )then do ilat=1,latmax-1 !latitude if ( (lat(i).ge.latmod(ilat)) .and. (lat(i).lt.latmod(ilat+1)) )then indtot(ilon,ilat)=indtot(ilon,ilat)+1 nanprof=0 do ialt=1,altmax if((nanfraction(ialt,i).eq.1.).or.(sefraction(ialt,i).eq.1.) & .or.(rejfraction(ialt,i).eq.1.))then nanprof=nanprof+1 endif enddo nansat=0 nanlow=0 do ialt=1,toplowl-1 if(satfraction(ialt,i).eq.1.)then nansat=nansat+1 ! fully att layer endif if(sefraction(ialt,i).eq.1.)then nanlow=nanlow+1 ! under SE layer endif enddo nanmid=0 do ialt=toplowl,topmidl-1 if(satfraction(ialt,i).eq.1.)then nanmid=nanmid+1 endif enddo ! Cloudtop Height average (GEWEX option) heightday(ilat,ilon,jour)=heightday(ilat,ilon,jour)+height(i) heightday2(ilat,ilon,jour)=heightday2(ilat,ilon,jour)+height2(i) if( height(i).gt.0)then indheight(ilat,ilon,jour)=indheight(ilat,ilon,jour)+1 endif do nphase = 1,4 isccpliqday(ilat,ilon,jour,nphase)=isccpliqday(ilat,ilon,jour,nphase)+isccpliq(nphase,i) isccpiceday(ilat,ilon,jour,nphase)=isccpiceday(ilat,ilon,jour,nphase)+isccpice(nphase,i) do icat=1,catmax isccpunday(ilat,ilon,jour,nphase,icat)=isccpunday(ilat,ilon,jour,nphase,icat)+isccpun(nphase,i,icat) enddo enddo !!!! A RAJOUTER LES ISCCPblablaDAY !!!! ENREGISTRER LES 2 TYPE DE ISCCP en occurrence ? ! colclearday(ilat,ilon,jour)=colclearday(ilat,ilon,jour)+colclear(i) ! select only the profil .ne. NaN & Low layer not fully attenuated if( (nanprof.le.(altmax-4)).and.(nansat.lt.(toplowl-1)).and. & (nanlow.lt.(toplowl-1)) )then isccplowday(ilat,ilon,jour)=isccplowday(ilat,ilon,jour)+isccplow(i) isccpinddaylow(ilat,ilon,jour)=isccpinddaylow(ilat,ilon,jour)+1 endif ! select only the profil .ne. NaN & Mid layer not fully attenuated if((nanprof.le.(altmax-4)).and.(nanmid.lt.(topmidl-toplowl)))then isccpinddaymid(ilat,ilon,jour)=isccpinddaymid(ilat,ilon,jour)+1 isccpmidday(ilat,ilon,jour)=isccpmidday(ilat,ilon,jour)+isccpmid(i) endif ! select only the profil .ne. NaN if(nanprof.le.(altmax-4))then isccpindday(ilat,ilon,jour)=isccpindday(ilat,ilon,jour)+1 isccphighday(ilat,ilon,jour)=isccphighday(ilat,ilon,jour)+ & isccphigh(i) colcloudday(ilat,ilon,jour)=colcloudday(ilat,ilon,jour)+colcloud(i) endif if( (isccplowday(ilat,ilon,jour)/isccpinddaylow(ilat,ilon,jour)) .gt. 1.00001)then print *, file6 print *, i,lon(i),lat(i),nansat print *, isccplowday(ilat,ilon,jour),isccpinddaylow(ilat,ilon,jour) endif do iz=1,altmax if(cloudfraction(iz,i).gt.0.)then if(indicetemp(iz,i).gt.0)then coltemp(ilat,ilon,jour)=coltemp(ilat,ilon,jour)+(tempmoy(iz,i)/indicetemp(iz,i)) indcoltemp(ilat,ilon,jour)=indcoltemp(ilat,ilon,jour)+1 ! Search the isscp low cloud fraction if (iz.lt.toplowl) then lowtemp(ilat,ilon,jour)=lowtemp(ilat,ilon,jour)+(tempmoy(iz,i)/indicetemp(iz,i)) indlowtemp(ilat,ilon,jour)=indlowtemp(ilat,ilon,jour)+1 endif ! Search the isscp mid cloud fraction if ((iz.ge.toplowl).and.(iz.lt.topmidl)) then midtemp(ilat,ilon,jour)=midtemp(ilat,ilon,jour)+(tempmoy(iz,i)/indicetemp(iz,i)) indmidtemp(ilat,ilon,jour)=indmidtemp(ilat,ilon,jour)+1 endif ! Search the isscp high cloud fraction if (iz.ge.topmidl) then hightemp(ilat,ilon,jour)=hightemp(ilat,ilon,jour)+(tempmoy(iz,i)/indicetemp(iz,i)) indhightemp(ilat,ilon,jour)=indhightemp(ilat,ilon,jour)+1 endif endif endif enddo ! cloudfraction day as a function of temperature do itemp=1,tempmax-1 cftempday(ilat,ilon,itemp,jour)=cftempday(ilat,ilon,itemp,jour)+cftemp(itemp,i) cftempliqday(ilat,ilon,itemp,jour)=cftempliqday(ilat,ilon,itemp,jour)+ & cftempliq(itemp,i) cftempiceday(ilat,ilon,itemp,jour)=cftempiceday(ilat,ilon,itemp,jour)+ & cftempice(itemp,i) enddo do ialt=altmax,1,-1 indnan(ilat,ilon,ialt)=indnan(ilat,ilon,ialt)+1 cloudfractday(ilat,ilon,ialt,jour)= & cloudfractday(ilat,ilon,ialt,jour)+cloudfraction(ialt,i) clearfractday(ilat,ilon,ialt,jour)= & clearfractday(ilat,ilon,ialt,jour)+clearfraction(ialt,i) uncertfractday(ilat,ilon,ialt,jour)= & uncertfractday(ilat,ilon,ialt,jour)+uncertfraction(ialt,i) icecloudfractday(ilat,ilon,ialt,jour)= & icecloudfractday(ilat,ilon,ialt,jour)+icecloud(ialt,i) watercloudfractday(ilat,ilon,ialt,jour)= & watercloudfractday(ilat,ilon,ialt,jour)+watercloud(ialt,i) do icat=1,catmax uncloudfractday(ilat,ilon,ialt,jour,icat)= & uncloudfractday(ilat,ilon,ialt,jour,icat)+uncloud(ialt,i,icat) enddo if((nanfraction(ialt,i).ne.1).and.(sefraction(ialt,i).ne.1).and.(satfraction(ialt,i).ne.1).and.(rejfraction(ialt,i).ne.1))then indday(ilat,ilon,ialt,jour)=indday(ilat,ilon,ialt,jour)+1 do itemp=1,tempmax-1 if ( (tempmoy(ialt,i).gt.tempmod(itemp)).and. & (tempmoy(ialt,i) .le.tempmod(itemp+1)) )then indcftemp(ilat,ilon,itemp,jour)=indcftemp(ilat,ilon,itemp,jour)+1 endif enddo ! indice of cloudfraction day as a function of temperature if(indday(ilat,ilon,ialt,jour).lt.sum(uncloudfractday(ilat,ilon,ialt,jour,:)))then print *, 'error indice < un_cloud',i,ialt stop endif endif if(srmoy(ialt,i).eq.srmod(1))then diagSR(ilon,ilat,ialt,1)=diagSR(ilon,ilat,ialt,1)+1 endif if(srmoy(ialt,i).eq.srmod(2))then diagSR(ilon,ilat,ialt,2)=diagSR(ilon,ilat,ialt,2)+1 endif ! if( (srmoy(ialt,i).ge.srmod(1)) .and. (srmoy(ialt,i).lt.srmod(diagmax)) )then do idiag=3,diagmax-1 if ( (srmoy(ialt,i).ge.srmod(idiag)).and. & (srmoy(ialt,i).lt.srmod(idiag+1)) )then diagSR(ilon,ilat,ialt,idiag)= & diagSR(ilon,ilat,ialt,idiag)+1 endif enddo do idiag=8,diagmax-1 if ( (srmoy(ialt,i).ge.srmod(idiag)).and. & (srmoy(ialt,i).lt.srmod(idiag+1)) )then if(icecloud(ialt,i).ne.0)then diagSRpha(ilon,ilat,ialt,idiag-7,2)= & diagSRpha(ilon,ilat,ialt,idiag-7,2)+1 elseif(watercloud(ialt,i).ne.0)then diagSRpha(ilon,ilat,ialt,idiag-7,1)= & diagSRpha(ilon,ilat,ialt,idiag-7,1)+1 elseif(uncloud(ialt,i,1).ne.0)then diagSRpha(ilon,ilat,ialt,idiag-7,3)= & diagSRpha(ilon,ilat,ialt,idiag-7,3)+1 endif endif enddo enddo endif enddo endif enddo enddo !!!!!!!!!! END IT LOOP !print *, "toto4" !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* RECORD INSTANTANEOUS PHASE FILE *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! if('instant_switch'.eq.'on')then call instant_phase(file4,altmax,it,phasecloud) endif do ilon=1,lonmax-1 !latitude do ilat=1,latmax-1 !longitude ! print *, indtotmean(ilon,ilat) if(indtot(ilon,ilat).gt.0)then indtotmean(ilon,ilat)=indtotmean(ilon,ilat)+1 endif enddo enddo indtot(:,:)=0; !CASE DEFAULT !print *, "The model you entered doesn't match, try another" ! !ENDSELECT !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* WRITE OUTPUT FILES *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !----------------------------- Save output file -----------------------------! ! ! ! Sauve = "wrf" when model WRF is used, then the data are saved in ASCII ! ! format, and for every hdf calipso file. Only the matching WRF grid values ! ! are saved. ! ! - Lat : 199values between 15° to 55° ! ! - Lon : 179values between -18° to 36° ! ! - alt : 48levels from 0 to 35.5km ! ! ! ! Sauve = "chim" when model CHIMERE is used, then the data are saved in ASCII ! ! format, and for every hdf calipso file. Only the matching CHIMERE grid ! ! values are saved. ! ! - Lat : 71values between -5° to 65° (every 1°) ! ! - Lon : 181values between -100° to 80° (every 1°) ! ! - alt : 281levels from 0 to 14km (every 50m) ! ! ! ! Sauve = "lmdz" when LMDZ is used, the data are saved in a single netcdf file ! ! when the last hdf calipso file of the period have been read ! ! ! !----------------------------------------------------------------------------! 622 continue sauve=model SELECT CASE (sauve) !**************************** WRF OUTPUT FORMAT *****************************! CASE ("wrf") comptpf=0 do i=1,it if ((lat(i).gt.15.0).and.(lat(i).lt.55.0))then if((lon(i).gt.-18.0).and.(lon(i).lt.36.0))then comptpf=comptpf+1 endif endif enddo allocate(latwrf(comptpf),lonwrf(comptpf),SRwrf(altmax,comptpf),DEPOLwrf(altmax,comptpf),CRwrf(altmax,comptpf),SEwrf(comptpf),temps2wrf(comptpf)) if(comptpf.eq.0)then goto 624 !track out from the domain else comptpf=0 do i=1,it if ((lat(i).gt.15.0).and.(lat(i).lt.55.0))then if((lon(i).gt.-18.0).and.(lon(i).lt.36.0))then comptpf=comptpf+1 SEwrf(comptpf)=SE(i) temps2wrf(comptpf)=temps2(i) latwrf(comptpf)=lat(i) lonwrf(comptpf)=lon(i) do j=1,altmax SRwrf(j,comptpf)=srmoy(j,i) CRwrf(j,comptpf)=crmoy(j,i) DEPOLwrf(j,comptpf)=depolmoy(j,i) enddo endif endif enddo write(numfichc,'(i4)')numfich write(datec,'(I5)')date ! Name of instantaneous file, one by hdf calipso file file4='SR_CR_DEPOL_200'//datec//'_'//trim(switch)//'_'//trim(gcm)//'_'// & trim(ADJUSTL(numfichc))//'.nc' call SR_CR_DR_2nc(file4,altmid,altmod,resd,altmax,switch,gcm,comptpf,latwrf,lonwrf,SEwrf,temps2wrf,& SRwrf,CRwrf,DEPOLwrf) endif 624 continue ! Deallocate SDS/META variables deallocate(atb,stat = OK_buffer) deallocate(atb2,stat = OK_buffer) deallocate(perp,stat = OK_buffer) deallocate(mol,stat = OK_buffer) deallocate(pres,stat = OK_buffer) deallocate(SE,SEwrf,stat = OK_buffer) deallocate(mol2,stat = OK_buffer) deallocate(mol3,stat = OK_buffer) deallocate(mol4) deallocate(temp,stat = OK_buffer) deallocate(temp2,stat = OK_buffer) if(alt_pres=='pressure')then deallocate(pres2,stat = OK_buffer) endif deallocate(altl,stat = OK_buffer) deallocate(altm,stat = OK_buffer) deallocate(temps2,temps2wrf,stat = OK_buffer) deallocate(lonwrf,latwrf,SRwrf,CRwrf,DEPOLwrf) !continue !************************** CHIMERE OUTPUT FORMAT ***************************! CASE ("chim") print *, 'Regrid of data Done' print *, '' print *, 'Save the data' do k=1,lonmax do j=1,latmax if(mheure(j,k).ne.0)then box=box+1 if(lonmod(k)==12)then ! print *, k endif write(11,'(4(2x,I6),2(2x,F10.2),(2x,E13.6))'),numfich,box,month,day, & lonmod(k),latmod(j),mheure(j,k)/indiceh(j,k) do iz=1,altmax ! write(11,103),altmod(iz),srmoy(j,k,iz),crmoy(j,k,iz),depolmoy(j,k,iz),tempmoy(j,k,iz) & ! /indicet(j,k,iz),molmoy(j,k,iz)/indicem(j,k,iz) enddo endif enddo enddo !**************************** LMDZ OUTPUT FORMAT ****************************! CASE ("lmdz") goto 666 CASE DEFAULT print *, "error" ENDSELECT 666 continue 647 continue !***** DEALLOCATE SDS OUTPUT AND INSTANT LMDZ OUTPUT VAR AND CLOSE FILES ****! deallocate(pr2moy,molmoy, stat = OK_buffer)! deallocate(srmoy) deallocate(lat,stat = OK_buffer) deallocate(lon,stat = OK_buffer) !deallocate(indtot,indret) !deallocate(indretlow,indretmid,indrethigh) deallocate(indice,indicem,indice2) deallocate(indicep,indicep2,depolmoy,parmoy,perpmoy,pr2moy2,crmoy) deallocate(tempmoy,indicetemp) if(model=='wrf')then deallocate(indice,indicem,indice2) deallocate(indicep,indicep2,crmoy,depolmoy,parmoy,perpmoy,pr2moy2) ! deallocate(altmod,stat=OK_buffer) endif if(model=='chimere')then deallocate(latmod,lonmod,altmod,stat = OK_buffer) deallocate(mheure,stat = OK_buffer) deallocate(indiceh,stat = OK_buffer) deallocate(indice,indicem,indice2,stat = OK_buffer) endif if(model=='lmdz')then ! deallocate(indice,indicem)!,indice2,indicep,indicep2 if(alt_pres=='pressure')then deallocate(SEp, stat = OK_buffer) endif deallocate(isccplow,isccpmid,isccphigh,colcloud)!,colclear, stat = OK_buffer) deallocate(cloudfraction,clearfraction,satfraction,uncertfraction, & nanfraction,sefraction,rejfraction)!,fractot) deallocate(icecloud,watercloud,uncloud,phasecloud) deallocate(isccpliq,isccpice,isccpun) deallocate(cftemp,cftempliq,cftempice) deallocate(height,height2) endif print *, 'Deallocate buffers done' 887 continue !print *, 'rm the file' !command2='rm -f /tmp/'//trim(filetmp) !call system(command2) print *, '' print *, 'go to the next file' ! Temps elapsed final call system_clock(count=t2, count_rate=ir) tempstot=real(t2 - t1,kind=4)/real(ir,kind=4) ! Temps CPU de calcul final call cpu_time(t_cpu_1) t_cpu = t_cpu_1 - t_cpu_0 print '(//,3X,"Temps elapsed : ",1PE10.3," sec.",/, & & 3X,"Temps CPU : ",1PE10.3," sec.",/,//)', & tempstot,t_cpu goto 888 ! next Calipso file 999 continue ! empty file list checking if(file2(1:1).gt.' ')then continue else print *, 'hdf file list empty' print *, file2(1:1) stop endif !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* MONTHLY AVERAGE CLOUD DIAGNOSTICS *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !----------------------------- monthly average ------------------------------! ! ! ! If there is no more hdf CALIPSO file to read, then the monthly average ! ! can begin. This module is operating only in the lmdz case, that is to say ! ! when we have to save the monthly diagnostic. ! ! In the other case (chimere & wrf), the program ends here. ! ! ! !----------------------------------------------------------------------------! SELECT CASE (model) CASE ("lmdz") !****************************************************************************! !*!!!!!!!!!!!!!! PART I : CLOUDY LOW MID HIGH MAP FILES !!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! ! Allocation / initialization of isscp monthly variables print *, 'allocation / initialization of isccp monthly variables' allocate(monthheight(lonmax-1,latmax-1),indmonthheight(lonmax-1,latmax-1), & monthheight2(lonmax-1,latmax-1)) allocate(monthisccplow(lonmax-1,latmax-1),monthisccpmid(lonmax-1,latmax-1), & monthisccphigh(lonmax-1,latmax-1)) allocate(monthcolcloud(lonmax-1,latmax-1), monthcolclear(lonmax-1,latmax-1), & isccpdaypermonthlow(lonmax-1,latmax-1), & isccpdaypermonthmid(lonmax-1,latmax-1), & isccpdaypermonth(lonmax-1,latmax-1)) allocate(hlow(lonmax-1,latmax-1,histmax-1),hmid(lonmax-1,latmax-1,histmax-1), & hhigh(lonmax-1,latmax-1,histmax-1),hcol(lonmax-1,latmax-1,histmax-1),& hheight(lonmax-1,latmax-1,histmax2-1)) allocate(hlowtemp(lonmax-1,latmax-1,histtempmax2),hmidtemp(lonmax-1,latmax-1,histtempmax2), & hhightemp(lonmax-1,latmax-1,histtempmax2),hcoltemp(lonmax-1,latmax-1,histtempmax2)) allocate(monthlowtemp(lonmax-1,latmax-1),indmonthlowtemp(lonmax-1,latmax-1), & monthmidtemp(lonmax-1,latmax-1),indmonthmidtemp(lonmax-1,latmax-1), & monthhightemp(lonmax-1,latmax-1),indmonthhightemp(lonmax-1,latmax-1), & monthcoltemp(lonmax-1,latmax-1),indmonthcoltemp(lonmax-1,latmax-1)) allocate(monthisccpliq(lonmax-1,latmax-1,4),monthisccpice(lonmax-1,latmax-1,4)) allocate(monthisccpun(lonmax-1,latmax-1,4,catmax)) allocate(monthisccpphase(lonmax-1,latmax-1,4)) allocate(indmonthphase(lonmax-1,latmax-1,4),indmonthphase2(lonmax-1,latmax-1,4)) allocate(inddayphase(latmax-1,lonmax-1,daymax,4)) inddayphase(:,:,:,:)=0; monthisccpliq(:,:,:)=0; monthisccpice(:,:,:)=0; monthisccpun(:,:,:,:)=0; monthisccpphase(:,:,:)=0;indmonthphase(:,:,:)=0;indmonthphase2(:,:,:)=0 histmod(:)=0; histmod2(:)=0; hlow(:,:,:)=0;hmid(:,:,:)=0;hhigh(:,:,:)=0;hcol(:,:,:)=0;hheight(:,:,:)=0; monthheight(:,:)=0; monthheight2(:,:)=0; indmonthheight(:,:)=0; monthisccplow(:,:)=0;monthisccpmid(:,:)=0;monthisccphigh(:,:)=0; monthcolcloud(:,:)=0;isccpdaypermonth(:,:)=0;monthcolclear(:,:)=0 isccpdaypermonthlow(:,:)=0;isccpdaypermonthmid(:,:)=0; histtempmod(:)=0; histtempmod2(:)=0; hlowtemp(:,:,:)=0;monthlowtemp(:,:)=0;indmonthlowtemp(:,:)=0; hmidtemp(:,:,:)=0;monthmidtemp(:,:)=0;indmonthmidtemp(:,:)=0; hhightemp(:,:,:)=0;monthhightemp(:,:)=0;indmonthhightemp(:,:)=0; hcoltemp(:,:,:)=0;monthcoltemp(:,:)=0;indmonthcoltemp(:,:)=0; histtempmod(1)=150 histtempmod(2)=180 histtempmod(histtempmax)=320 do ihisttemp=2,histtempmax-2 histtempmod(ihisttemp+1)=histtempmod(ihisttemp)+5 enddo do ihisttemp=1,histtempmax2 histtempmod2(ihisttemp)=(histtempmod(ihisttemp)+histtempmod(ihisttemp+1))/2 enddo !print *, 'histtempmod',histtempmod !print *, 'histtempmod2',histtempmod2 do ihist=1,histmax-2 histmod(ihist+1)=histmod(ihist)+0.1 enddo histmod(histmax)=1.01 do ihist=1,histmax2-1 histmod2(ihist+1)=histmod2(ihist)+1 enddo !!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! ! changement à rajouter ! ! normaliser le calcul de la phase par jour !********* CALCULATION OF DAILY DIAGNOSTIC WITH MATCHING INDEXES ************! ! moyenne journalière effectuée avant la moyenne mensuelle pour donner le même ! poid à tous les jours malgré la quantité variable de donnée d'un jour à ! l'autre. do jour=1,31 do ilon=1,lonmax-1 do ilat=1,latmax-1 if ( indlowtemp(ilat,ilon,jour).gt.0 ) then lowtemp(ilat,ilon,jour)= & (lowtemp(ilat,ilon,jour)/indlowtemp(ilat,ilon,jour))+273.15 endif if ( indmidtemp(ilat,ilon,jour).gt.0 ) then midtemp(ilat,ilon,jour)= & (midtemp(ilat,ilon,jour)/indmidtemp(ilat,ilon,jour))+273.15 endif if ( indhightemp(ilat,ilon,jour).gt.0 ) then hightemp(ilat,ilon,jour)= & (hightemp(ilat,ilon,jour)/indhightemp(ilat,ilon,jour))+273.15 endif if ( indcoltemp(ilat,ilon,jour).gt.0 ) then coltemp(ilat,ilon,jour)= & (coltemp(ilat,ilon,jour)/indcoltemp(ilat,ilon,jour))+273.15 endif if ( isccpindday(ilat,ilon,jour).gt.0 ) then isccphighday(ilat,ilon,jour)= & isccphighday(ilat,ilon,jour)/isccpindday(ilat,ilon,jour) colcloudday(ilat,ilon,jour)= & colcloudday(ilat,ilon,jour)/isccpindday(ilat,ilon,jour) if (isccpiceday(ilat,ilon,jour,3)+isccpliqday(ilat,ilon,jour,3)+ & +sum(isccpunday(ilat,ilon,jour,3,4:5))+isccpunday(ilat,ilon,jour,3,1).gt.0)then isccptemp=isccpiceday(ilat,ilon,jour,3)+isccpliqday(ilat,ilon,jour,3)+ & isccpunday(ilat,ilon,jour,3,1)+ sum(isccpunday(ilat,ilon,jour,3,4:5)) isccpliqday(ilat,ilon,jour,3)= isccpliqday(ilat,ilon,jour,3)/ & isccptemp * isccphighday(ilat,ilon,jour) isccpiceday(ilat,ilon,jour,3)= isccpiceday(ilat,ilon,jour,3)/ & isccptemp * isccphighday(ilat,ilon,jour) do icat=1,catmax isccpunday(ilat,ilon,jour,3,icat)= isccpunday(ilat,ilon,jour,3,icat)/ & isccptemp * isccphighday(ilat,ilon,jour) enddo endif if (isccpiceday(ilat,ilon,jour,4)+isccpliqday(ilat,ilon,jour,4)+ & +sum(isccpunday(ilat,ilon,jour,4,4:5))+isccpunday(ilat,ilon,jour,4,1).gt.0)then isccptemp=isccpiceday(ilat,ilon,jour,4)+isccpliqday(ilat,ilon,jour,4)+ & isccpunday(ilat,ilon,jour,4,1)+ sum(isccpunday(ilat,ilon,jour,4,4:5)) isccpliqday(ilat,ilon,jour,4)= isccpliqday(ilat,ilon,jour,4)/ & isccptemp * colcloudday(ilat,ilon,jour) isccpiceday(ilat,ilon,jour,4)= isccpiceday(ilat,ilon,jour,4)/ & isccptemp * colcloudday(ilat,ilon,jour) do icat=1,catmax isccpunday(ilat,ilon,jour,4,icat)= isccpunday(ilat,ilon,jour,4,icat)/ & isccptemp * isccphighday(ilat,ilon,jour) enddo endif endif if ( indheight(ilat,ilon,jour).gt.0 ) then heightday(ilat,ilon,jour)= & heightday(ilat,ilon,jour)/indheight(ilat,ilon,jour) heightday2(ilat,ilon,jour)= & heightday2(ilat,ilon,jour)/indheight(ilat,ilon,jour) endif if ( isccpinddaylow(ilat,ilon,jour).gt.0 ) then isccplowday(ilat,ilon,jour)= & isccplowday(ilat,ilon,jour)/isccpinddaylow(ilat,ilon,jour) if (isccpiceday(ilat,ilon,jour,1)+isccpliqday(ilat,ilon,jour,1)+ & +sum(isccpunday(ilat,ilon,jour,1,4:5))+isccpunday(ilat,ilon,jour,1,1).gt.0)then isccptemp=isccpiceday(ilat,ilon,jour,1)+isccpliqday(ilat,ilon,jour,1)+ & isccpunday(ilat,ilon,jour,1,1)+ sum(isccpunday(ilat,ilon,jour,1,4:5)) isccpliqday(ilat,ilon,jour,1)= isccpliqday(ilat,ilon,jour,1)/ & isccptemp * isccplowday(ilat,ilon,jour) isccpiceday(ilat,ilon,jour,1)= isccpiceday(ilat,ilon,jour,1)/ & isccptemp * isccplowday(ilat,ilon,jour) do icat=1,catmax isccpunday(ilat,ilon,jour,1,icat)= isccpunday(ilat,ilon,jour,1,icat)/ & isccptemp * isccplowday(ilat,ilon,jour) enddo endif endif if ( isccpinddaymid(ilat,ilon,jour).gt.0 ) then isccpmidday(ilat,ilon,jour)= & isccpmidday(ilat,ilon,jour)/isccpinddaymid(ilat,ilon,jour) if (isccpiceday(ilat,ilon,jour,2)+isccpliqday(ilat,ilon,jour,2)+ & +sum(isccpunday(ilat,ilon,jour,2,4:5))+isccpunday(ilat,ilon,jour,2,1).gt.0)then isccptemp=isccpiceday(ilat,ilon,jour,2)+isccpliqday(ilat,ilon,jour,2)+ & isccpunday(ilat,ilon,jour,2,1)+ sum(isccpunday(ilat,ilon,jour,2,4:5)) isccpliqday(ilat,ilon,jour,2)= isccpliqday(ilat,ilon,jour,2)/ & isccptemp * isccpmidday(ilat,ilon,jour) isccpiceday(ilat,ilon,jour,2)= isccpiceday(ilat,ilon,jour,2)/ & isccptemp * isccpmidday(ilat,ilon,jour) do icat=1,catmax isccpunday(ilat,ilon,jour,2,icat)= isccpunday(ilat,ilon,jour,2,icat)/ & isccptemp * isccpmidday(ilat,ilon,jour) enddo endif if ((isccpiceday(ilat,ilon,jour,2)+isccpliqday(ilat,ilon,jour,2)).gt.isccpmidday(ilat,ilon,jour))then print *, isccpmidday(ilat,ilon,jour),isccpiceday(ilat,ilon,jour,2)+isccpliqday(ilat,ilon,jour,2) endif endif if ( isccplowday(ilat,ilon,jour) .gt. colcloudday(ilat,ilon,jour) )then print *, ilon,ilat,jour print *, isccplowday(ilat,ilon,jour),colcloudday(ilat,ilon,jour) endif do nphase=1,4 isccptemp=isccpiceday(ilat,ilon,jour,nphase)+isccpliqday(ilat,ilon,jour,nphase) if(isccptemp.gt.0.)then inddayphase(ilat,ilon,jour,nphase)=inddayphase(ilat,ilon,jour,nphase)+1. isccpphaseday(ilat,ilon,jour,nphase)=isccpiceday(ilat,ilon,jour,nphase)/isccptemp endif enddo enddo enddo enddo !************* INCREMENTING THE MONTHLY DIAGNOSTIC AND INDEXES **************! do jour=1,31 do ilon=1,lonmax-1 do ilat=1,latmax-1 if ( indlowtemp(ilat,ilon,jour).gt.0 ) then do ihisttemp=1,histtempmax-1 if( (lowtemp(ilat,ilon,jour).ge.histtempmod(ihisttemp)) .and. & (lowtemp(ilat,ilon,jour).lt.histtempmod(ihisttemp+1)) ) then hlowtemp(ilon,ilat,ihisttemp)= & hlowtemp(ilon,ilat,ihisttemp)+1 endif enddo monthlowtemp(ilon,ilat)=monthlowtemp(ilon,ilat)+ & lowtemp(ilat,ilon,jour) indmonthlowtemp(ilon,ilat)=indmonthlowtemp(ilon,ilat)+1 endif if ( indmidtemp(ilat,ilon,jour).gt.0 ) then do ihisttemp=1,histtempmax-1 if( (midtemp(ilat,ilon,jour).ge.histtempmod(ihisttemp)) .and. & (midtemp(ilat,ilon,jour).lt.histtempmod(ihisttemp+1)) ) then hmidtemp(ilon,ilat,ihisttemp)= & hmidtemp(ilon,ilat,ihisttemp)+1 endif enddo monthmidtemp(ilon,ilat)=monthmidtemp(ilon,ilat)+ & midtemp(ilat,ilon,jour) indmonthmidtemp(ilon,ilat)=indmonthmidtemp(ilon,ilat)+1 endif if ( indhightemp(ilat,ilon,jour).gt.0 ) then do ihisttemp=1,histtempmax-1 if( (hightemp(ilat,ilon,jour).ge.histtempmod(ihisttemp)) .and. & (hightemp(ilat,ilon,jour).lt.histtempmod(ihisttemp+1)) ) then hhightemp(ilon,ilat,ihisttemp)= & hhightemp(ilon,ilat,ihisttemp)+1 endif enddo monthhightemp(ilon,ilat)=monthhightemp(ilon,ilat)+ & hightemp(ilat,ilon,jour) indmonthhightemp(ilon,ilat)=indmonthhightemp(ilon,ilat)+1 endif if ( indcoltemp(ilat,ilon,jour).gt.0 ) then do ihisttemp=1,histtempmax-1 if( (coltemp(ilat,ilon,jour).ge.histtempmod(ihisttemp)) .and. & (coltemp(ilat,ilon,jour).lt.histtempmod(ihisttemp+1)) ) then hcoltemp(ilon,ilat,ihisttemp)= & hcoltemp(ilon,ilat,ihisttemp)+1 endif enddo monthcoltemp(ilon,ilat)=monthcoltemp(ilon,ilat)+ & coltemp(ilat,ilon,jour) indmonthcoltemp(ilon,ilat)=indmonthcoltemp(ilon,ilat)+1 endif if ( indheight(ilat,ilon,jour).gt.0 ) then do ihist=1,histmax2-1 if( (heightday(ilat,ilon,jour).ge.histmod2(ihist)) .and.& (heightday(ilat,ilon,jour).lt.histmod2(ihist+1)) ) then hheight(ilon,ilat,ihist)=hheight(ilon,ilat,ihist)+1 endif enddo monthheight(ilon,ilat)=monthheight(ilon,ilat)+ & heightday(ilat,ilon,jour) monthheight2(ilon,ilat)=monthheight2(ilon,ilat)+ & heightday2(ilat,ilon,jour) indmonthheight(ilon,ilat)=indmonthheight(ilon,ilat)+1 endif if ( isccpindday(ilat,ilon,jour).gt.0 ) then do ihist=1,histmax-1 if( (isccphighday(ilat,ilon,jour).ge.histmod(ihist)) .and. & (isccphighday(ilat,ilon,jour).lt.histmod(ihist+1)) ) then hhigh(ilon,ilat,ihist)=hhigh(ilon,ilat,ihist)+1 endif if( (colcloudday(ilat,ilon,jour).ge.histmod(ihist)) .and. & (colcloudday(ilat,ilon,jour).lt.histmod(ihist+1)) )then hcol(ilon,ilat,ihist)=hcol(ilon,ilat,ihist)+1 endif enddo monthisccphigh(ilon,ilat)=monthisccphigh(ilon,ilat)+ & isccphighday(ilat,ilon,jour) monthisccpliq(ilon,ilat,3)=monthisccpliq(ilon,ilat,3)+ & isccpliqday(ilat,ilon,jour,3) monthisccpliq(ilon,ilat,4)=monthisccpliq(ilon,ilat,4)+ & isccpliqday(ilat,ilon,jour,4) monthisccpice(ilon,ilat,3)=monthisccpice(ilon,ilat,3)+ & isccpiceday(ilat,ilon,jour,3) monthisccpice(ilon,ilat,4)=monthisccpice(ilon,ilat,4)+ & isccpiceday(ilat,ilon,jour,4) do icat=1,catmax monthisccpun(ilon,ilat,3,icat)=monthisccpun(ilon,ilat,3,icat)+ & isccpunday(ilat,ilon,jour,3,icat) monthisccpun(ilon,ilat,4,icat)=monthisccpun(ilon,ilat,4,icat)+ & isccpunday(ilat,ilon,jour,4,icat) enddo monthcolcloud(ilon,ilat)=monthcolcloud(ilon,ilat)+ & colcloudday(ilat,ilon,jour) ! monthcolclear(ilon,ilat)=monthcolclear(ilon,ilat)+ & ! colclearday(ilat,ilon,jour) !isccpdaypermonth(ilon,ilat)=isccpdaypermonth(ilon,ilat)+isccpindday(ilat,ilon,jour) isccpdaypermonth(ilon,ilat)=isccpdaypermonth(ilon,ilat)+1 endif if ( isccpinddaylow(ilat,ilon,jour).gt.0 ) then do ihist=1,histmax-1 if( (isccplowday(ilat,ilon,jour).ge.histmod(ihist)) .and. & (isccplowday(ilat,ilon,jour).lt.histmod(ihist+1)) )then hlow(ilon,ilat,ihist)=hlow(ilon,ilat,ihist)+1 endif enddo monthisccpliq(ilon,ilat,1)=monthisccpliq(ilon,ilat,1)+ & isccpliqday(ilat,ilon,jour,1) monthisccpice(ilon,ilat,1)=monthisccpice(ilon,ilat,1)+ & isccpiceday(ilat,ilon,jour,1) do icat=1,catmax monthisccpun(ilon,ilat,1,icat)=monthisccpun(ilon,ilat,1,icat)+ & isccpunday(ilat,ilon,jour,1,icat) enddo monthisccplow(ilon,ilat)=monthisccplow(ilon,ilat)+ & isccplowday(ilat,ilon,jour) isccpdaypermonthlow(ilon,ilat)=isccpdaypermonthlow(ilon,ilat)+ 1 !isccpinddaylow(ilat,ilon,jour) endif if ( isccpinddaymid(ilat,ilon,jour).gt.0 ) then do ihist=1,histmax-1 if( (isccpmidday(ilat,ilon,jour).ge.histmod(ihist)) .and. & (isccpmidday(ilat,ilon,jour).lt.histmod(ihist+1)) )then hmid(ilon,ilat,ihist)=hmid(ilon,ilat,ihist)+1 endif enddo monthisccpliq(ilon,ilat,2)=monthisccpliq(ilon,ilat,2)+ & isccpliqday(ilat,ilon,jour,2) monthisccpice(ilon,ilat,2)=monthisccpice(ilon,ilat,2)+ & isccpiceday(ilat,ilon,jour,2) do icat=1,catmax monthisccpun(ilon,ilat,2,icat)=monthisccpun(ilon,ilat,2,icat)+ & isccpunday(ilat,ilon,jour,2,icat) enddo monthisccpmid(ilon,ilat)=monthisccpmid(ilon,ilat)+ & isccpmidday(ilat,ilon,jour) isccpdaypermonthmid(ilon,ilat)=isccpdaypermonthmid(ilon,ilat)+ 1 !isccpinddaymid(ilat,ilon,jour) endif do nphase=1,4 isccptemp=isccpiceday(ilat,ilon,jour,nphase)+isccpliqday(ilat,ilon,jour,nphase) if(inddayphase(ilat,ilon,jour,nphase).gt.0.)then monthisccpphase(ilon,ilat,nphase)=monthisccpphase(ilon,ilat,nphase)+ & isccpphaseday(ilat,ilon,jour,nphase) indmonthphase(ilon,ilat,nphase)=indmonthphase(ilon,ilat,nphase)+1 else isccptemp=sum(isccpunday(ilat,ilon,jour,nphase,:)) if(isccptemp.gt.0.)then indmonthphase2(ilon,ilat,nphase)=indmonthphase2(ilon,ilat,nphase)+1 endif endif enddo enddo enddo enddo !******** CALCULATION OF MONTHLY DIAGNOSTIC WITH MATCHING INDEXES ***********! do ilat=1,latmax-1 do ilon=1,lonmax-1 if ( indmonthcoltemp(ilon,ilat).ne.0 ) then monthcoltemp(ilon,ilat)= & monthcoltemp(ilon,ilat)/indmonthcoltemp(ilon,ilat) else monthcoltemp(ilon,ilat)=-999 do ihisttemp=1,histmax-1 hcoltemp(ilon,ilat,ihisttemp)=-999 enddo endif if ( indmonthhightemp(ilon,ilat).ne.0 ) then monthhightemp(ilon,ilat)= & monthhightemp(ilon,ilat)/indmonthhightemp(ilon,ilat) else monthhightemp(ilon,ilat)=-999 do ihisttemp=1,histmax-1 hhightemp(ilon,ilat,ihisttemp)=-999 enddo endif if ( indmonthmidtemp(ilon,ilat).ne.0 ) then monthmidtemp(ilon,ilat)= & monthmidtemp(ilon,ilat)/indmonthmidtemp(ilon,ilat) else monthmidtemp(ilon,ilat)=-999 do ihisttemp=1,histmax-1 hmidtemp(ilon,ilat,ihisttemp)=-999 enddo endif if ( indmonthlowtemp(ilon,ilat).ne.0 ) then monthlowtemp(ilon,ilat)= & monthlowtemp(ilon,ilat)/indmonthlowtemp(ilon,ilat) else monthlowtemp(ilon,ilat)=-999 do ihisttemp=1,histmax-1 hlowtemp(ilon,ilat,ihisttemp)=-999 enddo endif if ( isccpdaypermonth(ilon,ilat).ne.0 ) then monthisccphigh(ilon,ilat)= & monthisccphigh(ilon,ilat)/isccpdaypermonth(ilon,ilat) monthisccpliq(ilon,ilat,3)= & monthisccpliq(ilon,ilat,3)/isccpdaypermonth(ilon,ilat) monthisccpice(ilon,ilat,3)= & monthisccpice(ilon,ilat,3)/isccpdaypermonth(ilon,ilat) monthisccpliq(ilon,ilat,4)= & monthisccpliq(ilon,ilat,4)/isccpdaypermonth(ilon,ilat) monthisccpice(ilon,ilat,4)= & monthisccpice(ilon,ilat,4)/isccpdaypermonth(ilon,ilat) monthcolcloud(ilon,ilat)= & monthcolcloud(ilon,ilat)/isccpdaypermonth(ilon,ilat) monthcolclear(ilon,ilat)= & 1-monthcolcloud(ilon,ilat) do icat=1,catmax monthisccpun(ilon,ilat,3,icat)= & monthisccpun(ilon,ilat,3,icat)/isccpdaypermonth(ilon,ilat) monthisccpun(ilon,ilat,4,icat)= & monthisccpun(ilon,ilat,4,icat)/isccpdaypermonth(ilon,ilat) enddo if (indmonthheight(ilon,ilat).ne.0) then monthheight(ilon,ilat)= & monthheight(ilon,ilat)/indmonthheight(ilon,ilat) monthheight2(ilon,ilat)= & monthheight2(ilon,ilat)/indmonthheight(ilon,ilat) else monthheight(ilon,ilat)=-9999. monthheight2(ilon,ilat)=-9999. endif else ! monthisccplow(ilon,ilat)=-9999 ! monthisccpmid(ilon,ilat)=-9999 monthisccpliq(ilon,ilat,4)=-9999. monthisccpice(ilon,ilat,4)=-9999. monthisccpun(ilon,ilat,4,:)=-9999. monthisccpliq(ilon,ilat,3)=-9999. monthisccpice(ilon,ilat,3)=-9999. monthisccpun(ilon,ilat,3,:)=-9999. monthisccphigh(ilon,ilat)=-9999. monthcolcloud(ilon,ilat)=-9999. monthcolclear(ilon,ilat)=-9999. monthheight(ilon,ilat)=-9999. monthheight2(ilon,ilat)=-9999. indtotmean(ilon,ilat)=-999. do ihist=1,histmax2-1 hheight(ilon,ilat,ihist)=-999. enddo do ihist=1,histmax-1 hhigh(ilon,ilat,ihist)=-999. enddo endif ! if ( isccpdaypermonthlow(ilon,ilat).eq.0 ) then if ( isccpdaypermonthlow(ilon,ilat).gt.0 ) then monthisccplow(ilon,ilat)= & monthisccplow(ilon,ilat)/isccpdaypermonthlow(ilon,ilat) monthisccpliq(ilon,ilat,1)= & monthisccpliq(ilon,ilat,1)/isccpdaypermonthlow(ilon,ilat) monthisccpice(ilon,ilat,1)= & monthisccpice(ilon,ilat,1)/isccpdaypermonthlow(ilon,ilat) do icat=1,catmax monthisccpun(ilon,ilat,1,icat)= & monthisccpun(ilon,ilat,1,icat)/isccpdaypermonthlow(ilon,ilat) enddo else monthisccpice(ilon,ilat,1)=-9999. monthisccpliq(ilon,ilat,1)=-9999. monthisccpun(ilon,ilat,1,:)=-9999. monthisccplow(ilon,ilat)=-9999. do ihist=1,histmax-1 hlow(ilon,ilat,ihist)=-999. enddo endif ! if ( isccpdaypermonthmid(ilon,ilat).eq.0 ) then if ( isccpdaypermonthmid(ilon,ilat).gt.0 ) then monthisccpmid(ilon,ilat)= & monthisccpmid(ilon,ilat)/isccpdaypermonthmid(ilon,ilat) monthisccpliq(ilon,ilat,2)= & monthisccpliq(ilon,ilat,2)/isccpdaypermonthmid(ilon,ilat) monthisccpice(ilon,ilat,2)= & monthisccpice(ilon,ilat,2)/isccpdaypermonthmid(ilon,ilat) do icat=1,catmax monthisccpun(ilon,ilat,2,icat)= & monthisccpun(ilon,ilat,2,icat)/isccpdaypermonthmid(ilon,ilat) enddo else monthisccpice(ilon,ilat,2)=-9999. monthisccpliq(ilon,ilat,2)=-9999. monthisccpun(ilon,ilat,2,:)=-9999. monthisccpmid(ilon,ilat)=-9999. do ihist=1,histmax-1 hmid(ilon,ilat,ihist)=-999. enddo endif do nphase=1,4 if ( indmonthphase(ilon,ilat,nphase).gt.0)then monthisccpphase(ilon,ilat,nphase)= & monthisccpphase(ilon,ilat,nphase)/indmonthphase(ilon,ilat,nphase) else if (indmonthphase2(ilon,ilat,nphase).gt.0)then monthisccpphase(ilon,ilat,nphase)=-777. else monthisccpphase(ilon,ilat,nphase)=-9999. endif endif enddo enddo enddo !***************************** SAVE THE MAP FILES ***************************! file8=trim(file6)//'.nc' ! name of output ncdf map file file9=trim(file3(25:55)) ! period of map file (description of ncdf file) !print *, 'titi' call create_mapnc(file8,file9,lonmid,latmid,resd,dimidsm,gcm,lonmax-1,latmax-1) call map_recvar2nc2(monthisccplow,monthisccpmid,monthisccphigh,monthcolcloud,& monthcolclear,dimidsm,file8,lonmax-1,latmax-1) file8=trim(file66)//'.nc' ! name of output ncdf map file file9=trim(file3(25:55)) ! period of map file (description of ncdf file) call create_maphighnc(file8,file9,lonmid,latmid,resd,dimidsm,gcm,lonmax-1,latmax-1) call maphigh(monthisccphigh,monthheight,monthheight2,dimidsm,file8,lonmax-1,latmax-1) !print *, 'titi2' ! Change NaN value from -9999 to -999 to fit with the GEWEX standard forall(ilon=1:lonmax-1, ilat=1:latmax-1, monthisccplow(ilon,ilat)==-9999.) monthisccplow(ilon,ilat)=-999 endforall forall(ilon=1:lonmax-1, ilat=1:latmax-1, monthisccpmid(ilon,ilat)==-9999.) monthisccpmid(ilon,ilat)=-999 endforall forall(ilon=1:lonmax-1, ilat=1:latmax-1, monthisccphigh(ilon,ilat)==-9999.) monthisccphigh(ilon,ilat)=-999 endforall forall(ilon=1:lonmax-1, ilat=1:latmax-1, monthcolcloud(ilon,ilat)==-9999.) monthcolcloud(ilon,ilat)=-999 endforall file8=trim(file11)//'.nc' ! name of output ncdf map file !print *, 'titi3' call create_mapnc_phase(file8,file9,lonmid,latmid,resd,dimidsm,dimidsm2,gcm,lonmax-1,latmax-1) ! print *, 'titi4' call map_recvar2nc2phaseocc2(monthisccpliq,monthisccpice,monthisccpun, & monthisccpphase,dimidsm,dimidsm2,file8, & lonmax-1,latmax-1) !print *, 'titi5' !subroutine map_recvar2nc2phaseocc2(liq,ice,ho,un,dust,dim,fname,nlon,nlat) ! monthlowtemp,monthmidtemp,monthhightemp, & ! monthcoltemp,hlowtemp,hmidtemp,hhightemp,hcoltemp,dimidhist3) ! Deallocate daily & monthly map variables print *, 'deallocate daily & monthly map variables' if(model=='lmdz')then deallocate(hlow,hmid,hhigh,hcol,hheight) deallocate(monthisccplow,monthisccpmid,monthisccphigh) deallocate(monthcolcloud,isccpdaypermonth)!,monthcolclear deallocate(monthisccpliq,monthisccpice,monthisccpun) deallocate(indmonthphase,monthisccpphase) deallocate(indmonthphase2) deallocate(inddayphase) deallocate(isccplowday,isccpmidday,isccphighday) deallocate(isccpliqday,isccpiceday,isccpunday) deallocate(colcloudday,isccpindday)!,colclearday deallocate(isccpinddaylow,isccpinddaymid) deallocate(isccpdaypermonthlow,isccpdaypermonthmid) deallocate(indtotmean,indtot) deallocate(indmonthheight,monthheight,indheight,heightday) deallocate(monthheight2,heightday2) deallocate(lowtemp,midtemp,hightemp,coltemp) deallocate(indlowtemp,indmidtemp,indhightemp,indcoltemp) deallocate(hlowtemp,hmidtemp,hhightemp,hcoltemp) ! deallocate(indtotmean,indretmean) ! deallocate(indretlowmean,indretmidmean,indrethighmean) endif print *, 'map file recorded' !goto 621 !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!! PART III : CLOUDY MAP3D FILES !!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! ! Allocation / initialization of MAP3D monthly variables print *, 'allocation / initialization of MAP3D monthly variables' allocate(indphasepermonth(lonmax-1,latmax-1,altmax))!, & allocate(indpermonth(lonmax-1,latmax-1,altmax))!, & ! indpermonthtot(lonmax-1,latmax-1,altmax)) allocate(monthcloudfract(lonmax-1,latmax-1,altmax), & monthclearfract(lonmax-1,latmax-1,altmax)) ! allocate(monthsatfract(lonmax-1,latmax-1,altmax)) allocate(monthuncertfract(lonmax-1,latmax-1,altmax))!, & ! monthnanfract(lonmax-1,latmax-1,altmax), & ! monthsefract(lonmax-1,latmax-1,altmax)) allocate(monthicecloud(lonmax-1,latmax-1,altmax), & monthwatercloud(lonmax-1,latmax-1,altmax), & indphasemonth(lonmax-1,latmax-1,altmax)) allocate(monthuncloud(lonmax-1,latmax-1,altmax,catmax)) allocate(monthphasecloud(lonmax-1,latmax-1,altmax)) allocate(indmonthphase3D(lonmax-1,latmax-1,altmax)) allocate(indphasefractday(latmax-1,lonmax-1,altmax,daymax)) allocate(monthcftemp(lonmax-1,latmax-1,tempmax-1)) allocate(monthcftempice(lonmax-1,latmax-1,tempmax-1)) allocate(monthcftempliq(lonmax-1,latmax-1,tempmax-1)) allocate(monthcftempphase(lonmax-1,latmax-1,tempmax-1)) allocate(indmonthphasetemp(lonmax-1,latmax-1,tempmax-1)) allocate(indcftemppermonth(lonmax-1,latmax-1,tempmax-1)) allocate(cftempphaseday(latmax-1,lonmax-1,tempmax-1,daymax)) !allocate(indtest(lonmax-1,latmax-1,tempmax-1)) !indtest(:,:,:)=0; cftempphaseday(:,:,:,:)=0; indpermonth(:,:,:)=0;indphasepermonth(:,:,:)=0; indmonthphase3D(:,:,:)=0; monthphasecloud(:,:,:)=0; monthcloudfract(:,:,:)=0;monthclearfract(:,:,:)=0;!monthsatfract(:,:,:)=0; monthuncertfract(:,:,:)=0;!monthnanfract(:,:,:)=0;monthsefract(:,:,:)=0; indphasemonth(:,:,:)=0;monthicecloud(:,:,:)=0;monthwatercloud(:,:,:)=0; monthuncloud(:,:,:,:)=0; indphasefractday(:,:,:,:)=0; monthcftemp(:,:,:)=0 monthcftempice(:,:,:)=0 monthcftempliq(:,:,:)=0 monthcftempphase(:,:,:)=0 indmonthphasetemp(:,:,:)=0 indcftemppermonth(:,:,:)=0 !! OCCURRENCES FILE IN 3D WITH TEMPERATURE do jour=1,31 do itemp=1,tempmax-1 do ilon=1,lonmax-1 do ilat=1,latmax-1 if (indcftemp(ilat,ilon,itemp,jour).gt.0) then indcftemppermonth(ilon,ilat,itemp) = indcftemppermonth(ilon,ilat,itemp)+indcftemp(ilat,ilon,itemp,jour) monthcftemp(ilon,ilat,itemp)=monthcftemp(ilon,ilat,itemp) & +cftempday(ilat,ilon,itemp,jour) monthcftempice(ilon,ilat,itemp)=monthcftempice(ilon,ilat,itemp) & +cftempiceday(ilat,ilon,itemp,jour) monthcftempliq(ilon,ilat,itemp)=monthcftempliq(ilon,ilat,itemp) & +cftempliqday(ilat,ilon,itemp,jour) endif enddo enddo enddo enddo file8=trim(file13)//'_occ.nc' ! name of output netcdf MAP3D file file9=trim(file3(25:55)) ! period of MAP3D file (description of ncdf file) print *, 'MAP3D PHASE files recorded' call create_temp3d(file8,file9,lonmid,latmid,tempmid,tempmod_bound,resd, & dimidsp,tempmax-1,lonmax-1,latmax-1) print *, 'MAP3D create temp' call temp_recvar2nc(monthcftemp,monthcftempliq,monthcftempice, & indcftemppermonth,dimidsp,file8,tempmax-1,lonmax-1,latmax-1) monthcftemp(:,:,:)=0 monthcftempice(:,:,:)=0 monthcftempliq(:,:,:)=0 indcftemppermonth(:,:,:)=0 !print *, 'tata1' !********* CALCULATION OF DAILY DIAGNOSTIC WITH MATCHING INDEXES ************! ! do ilat=1,latmax-1 !! do ilon=1,lonmax-1 ! do jour=1,31 ! do ialt=1,altmax cfsumtemp=0. do jour=1,31 do itemp=1,tempmax-1 do ilon=1,lonmax-1 do ilat=1,latmax-1 if (indcftemp(ilat,ilon,itemp,jour).gt.0) then !indtest(ilon,ilat,itemp)=indtest(ilon,ilat,itemp)+indcftemp(ilat,ilon,itemp,jour) cfsumtemp=cftempliqday(ilat,ilon,itemp,jour)+ & cftempiceday(ilat,ilon,itemp,jour) if(cfsumtemp.gt.0)then if(cftempiceday(ilat,ilon,itemp,jour).eq.0.)then cftempphaseday(ilat,ilon,itemp,jour)=0. indcftempphase(ilat,ilon,itemp,jour)= & indcftempphase(ilat,ilon,itemp,jour)+1 else cftempphaseday(ilat,ilon,itemp,jour)= & cftempiceday(ilat,ilon,itemp,jour)/cfsumtemp indcftempphase(ilat,ilon,itemp,jour)= & indcftempphase(ilat,ilon,itemp,jour)+1 endif endif cftempday(ilat,ilon,itemp,jour)= & cftempday(ilat,ilon,itemp,jour)/indcftemp(ilat,ilon,itemp,jour) cftempliqday(ilat,ilon,itemp,jour)= & cftempliqday(ilat,ilon,itemp,jour)/indcftemp(ilat,ilon,itemp,jour) cftempiceday(ilat,ilon,itemp,jour)= & cftempiceday(ilat,ilon,itemp,jour)/indcftemp(ilat,ilon,itemp,jour) if(cftempday(ilat,ilon,itemp,jour).gt.1.)then print *, ilat,ilon,itemp,jour print *, cftempday(ilat,ilon,itemp,jour) print *, cftempliqday(ilat,ilon,itemp,jour) print *, cftempiceday(ilat,ilon,itemp,jour) endif endif enddo enddo enddo enddo allocate(tot_ind(lonmax-1,latmax-1,altmax), & cloud_ind(lonmax-1,latmax-1,altmax), & ice_ind(lonmax-1,latmax-1,altmax), & water_ind(lonmax-1,latmax-1,altmax), & un_ind(lonmax-1,latmax-1,altmax,catmax)) print *, 'test' do ialt=1,altmax do ilon=1,lonmax-1 do ilat=1,latmax-1 cloud_ind(ilon,ilat,ialt)=sum(cloudfractday(ilat,ilon,ialt,:)) tot_ind(ilon,ilat,ialt)=sum(indday(ilat,ilon,ialt,:)) ice_ind(ilon,ilat,ialt)=sum(icecloudfractday(ilat,ilon,ialt,:)) water_ind(ilon,ilat,ialt)=sum(watercloudfractday(ilat,ilon,ialt,:)) do icat=1,catmax un_ind(ilon,ilat,ialt,icat)=sum(uncloudfractday(ilat,ilon,ialt,:,icat)) enddo enddo enddo enddo file8=trim(file10)//'_occ.nc' ! name of output netcdf MAP3D file file9=trim(file3(25:55)) ! period of MAP3D file (description of ncdf file) print *, 'titi' call create_ind3d(file8,file9,lonmid,latmid,altmid,altmod_bound,resd, & dimidsp,dimidsp2,altmax,lonmax-1,latmax-1) print *, 'titi2' call record_ind3d(cloud_ind,tot_ind,ice_ind,water_ind,un_ind, & dimidsp,dimidsp2,file8,altmax,lonmax-1,latmax-1) print *, 'titi3' deallocate(tot_ind,cloud_ind,ice_ind,water_ind,un_ind) isccptemp=0. do jour=1,31 do ialt=1,altmax do ilon=1,lonmax-1 do ilat=1,latmax-1 if (indday(ilat,ilon,ialt,jour).gt.0) then ! Cloud fraction / Clear fraction / Saturated fraction, daily cloudfractday(ilat,ilon,ialt,jour) = & cloudfractday(ilat,ilon,ialt,jour)/indday(ilat,ilon,ialt,jour) clearfractday(ilat,ilon,ialt,jour) = & clearfractday(ilat,ilon,ialt,jour)/indday(ilat,ilon,ialt,jour) ! satfractday(ilat,ilon,ialt,jour) = & ! satfractday(ilat,ilon,ialt,jour)/indday(ilat,ilon,ialt,jour) uncertfractday(ilat,ilon,ialt,jour) = & uncertfractday(ilat,ilon,ialt,jour)/indday(ilat,ilon,ialt,jour) !nanfractday(ilat,ilon,ialt,jour) = & ! nanfractday(ilat,ilon,ialt,jour)/inddaytot(ilat,ilon,ialt,jour) ! sefractday(ilat,ilon,ialt,jour) = & ! sefractday(ilat,ilon,ialt,jour)/inddaytot(ilat,ilon,ialt,jour) ! endif ! if (indphaseday(ilat,ilon,ialt,jour).gt.0) then isccptemp=icecloudfractday(ilat,ilon,ialt,jour)+ & watercloudfractday(ilat,ilon,ialt,jour) if(isccptemp.gt.0)then if(icecloudfractday(ilat,ilon,ialt,jour).eq.0)then phasefractday(ilat,ilon,ialt,jour) = 0. indphasefractday(ilat,ilon,ialt,jour) = indphasefractday(ilat,ilon,ialt,jour)+1 else indphasefractday(ilat,ilon,ialt,jour) = indphasefractday(ilat,ilon,ialt,jour)+1 phasefractday(ilat,ilon,ialt,jour) = & icecloudfractday(ilat,ilon,ialt,jour)/isccptemp endif else isccptemp=sum(uncloudfractday(ilat,ilon,ialt,jour,:)) if(isccptemp.gt.0)then phasefractday(ilat,ilon,ialt,jour)=-777. endif endif icecloudfractday(ilat,ilon,ialt,jour) = & icecloudfractday(ilat,ilon,ialt,jour)/indday(ilat,ilon,ialt,jour) watercloudfractday(ilat,ilon,ialt,jour) = & watercloudfractday(ilat,ilon,ialt,jour)/indday(ilat,ilon,ialt,jour) do icat=1,catmax uncloudfractday(ilat,ilon,ialt,jour,icat) = & uncloudfractday(ilat,ilon,ialt,jour,icat)/indday(ilat,ilon,ialt,jour) enddo endif enddo enddo enddo enddo !************ INCREMENTING THE MONTHLY DIAGNOSTIC AND INDEXES **************! do jour=1,31 do itemp=1,tempmax-1 do ilon=1,lonmax-1 do ilat=1,latmax-1 if (indcftemp(ilat,ilon,itemp,jour).gt.0) then indcftemppermonth(ilon,ilat,itemp) = indcftemppermonth(ilon,ilat,itemp)+1 monthcftemp(ilon,ilat,itemp)=monthcftemp(ilon,ilat,itemp) & +cftempday(ilat,ilon,itemp,jour) monthcftempice(ilon,ilat,itemp)=monthcftempice(ilon,ilat,itemp) & +cftempiceday(ilat,ilon,itemp,jour) monthcftempliq(ilon,ilat,itemp)=monthcftempliq(ilon,ilat,itemp) & +cftempliqday(ilat,ilon,itemp,jour) !indcftempphase if(indcftempphase(ilat,ilon,itemp,jour).gt.0.)then monthcftempphase(ilon,ilat,itemp) = monthcftempphase(ilon,ilat,itemp)+ & cftempphaseday(ilat,ilon,itemp,jour) indmonthphasetemp(ilon,ilat,itemp) = indmonthphasetemp(ilon,ilat,itemp)+1 endif endif enddo enddo enddo enddo do jour=1,31 do ialt=1,altmax do ilat=1,latmax-1 do ilon=1,lonmax-1 if (indday(ilat,ilon,ialt,jour).gt.0) then indpermonth(ilon,ilat,ialt) = indpermonth(ilon,ilat,ialt)+1 indphasepermonth(ilon,ilat,ialt) = indphasepermonth(ilon,ilat,ialt)+ & indday(ilat,ilon,ialt,jour) ! Monthly Fraction monthcloudfract(ilon,ilat,ialt) = monthcloudfract(ilon,ilat,ialt) + & cloudfractday(ilat,ilon,ialt,jour) monthclearfract(ilon,ilat,ialt) = monthclearfract(ilon,ilat,ialt) + & clearfractday(ilat,ilon,ialt,jour) ! monthsatfract(ilon,ilat,ialt) = monthsatfract(ilon,ilat,ialt) + & ! satfractday(ilat,ilon,ialt,jour) monthuncertfract(ilon,ilat,ialt) = monthuncertfract(ilon,ilat,ialt) + & uncertfractday(ilat,ilon,ialt,jour) monthicecloud(ilon,ilat,ialt) = monthicecloud(ilon,ilat,ialt) + & icecloudfractday(ilat,ilon,ialt,jour) monthwatercloud(ilon,ilat,ialt) = monthwatercloud(ilon,ilat,ialt) + & watercloudfractday(ilat,ilon,ialt,jour) do icat=1,catmax monthuncloud(ilon,ilat,ialt,icat) = monthuncloud(ilon,ilat,ialt,icat) + & uncloudfractday(ilat,ilon,ialt,jour,icat) enddo !!! changement ici !! a terminer la phase 3D if(indphasefractday(ilat,ilon,ialt,jour).gt.0.)then monthphasecloud(ilon,ilat,ialt) = monthphasecloud(ilon,ilat,ialt) + & phasefractday(ilat,ilon,ialt,jour) indmonthphase3D(ilon,ilat,ialt) = indmonthphase3D(ilon,ilat,ialt)+1 endif endif enddo enddo enddo enddo !print *, 'tata3' do ialt=1,altmax do ilat=1,latmax-1 do ilon=1,lonmax-1 if (indphasepermonth(ilon,ilat,ialt).lt.sum(monthuncloud(ilon,ilat,ialt,:))) then print *, ilon,ilat,ialt,indphasepermonth(ilon,ilat,ialt),monthuncloud(ilon,ilat,ialt,:) endif enddo enddo enddo ! Deallocate daily MAP3D variables print *, 'deallocate daily MAP3D variables' if(model=='lmdz')then deallocate(indday)!,inddaytot) deallocate(cloudfractday, clearfractday,uncertfractday) deallocate(indphaseday,icecloudfractday,watercloudfractday) deallocate(uncloudfractday) deallocate(cftempday,cftempliqday,cftempiceday,indcftemp,indcftempphase) ! deallocate(satfractday, nanfractday,sefractday) endif !******** CALCULATION OF MONTHLY DIAGNOSTIC WITH MATCHING INDEXES ***********! do ilat=1,latmax-1 do ilon=1,lonmax-1 do itemp=1,tempmax-1 if(indmonthphasetemp(ilon,ilat,itemp).gt.0)then monthcftempphase(ilon,ilat,itemp)= & monthcftempphase(ilon,ilat,itemp)/indmonthphasetemp(ilon,ilat,itemp) else monthcftempphase(ilon,ilat,itemp)=-9999. endif if(indcftemppermonth(ilon,ilat,itemp).gt.0 )then monthcftemp(ilon,ilat,itemp)= & monthcftemp(ilon,ilat,itemp)/indcftemppermonth(ilon,ilat,itemp) monthcftempice(ilon,ilat,itemp)= & monthcftempice(ilon,ilat,itemp)/indcftemppermonth(ilon,ilat,itemp) monthcftempliq(ilon,ilat,itemp)= & monthcftempliq(ilon,ilat,itemp)/indcftemppermonth(ilon,ilat,itemp) else monthcftemp(ilon,ilat,itemp)=-9999. monthcftempliq(ilon,ilat,itemp)=-9999. monthcftempice(ilon,ilat,itemp)=-9999. endif enddo do ialt=1,altmax if ( indmonthphase3D(ilon,ilat,ialt).gt.0 ) then monthphasecloud(ilon,ilat,ialt)= & monthphasecloud(ilon,ilat,ialt)/indmonthphase3D(ilon,ilat,ialt) else monthphasecloud(ilon,ilat,ialt)=-9999. do jour = 1,31 if(phasefractday(ilat,ilon,ialt,jour).eq.-777.)then monthphasecloud(ilon,ilat,ialt)=-777. endif enddo endif if ( indpermonth(ilon,ilat,ialt).gt.0 ) then monthcloudfract(ilon,ilat,ialt)= & monthcloudfract(ilon,ilat,ialt)/indpermonth(ilon,ilat,ialt) monthclearfract(ilon,ilat,ialt)= & monthclearfract(ilon,ilat,ialt)/indpermonth(ilon,ilat,ialt) ! monthsatfract(ilon,ilat,ialt)= & ! monthsatfract(ilon,ilat,ialt)/indpermonth(ilon,ilat,ialt) monthuncertfract(ilon,ilat,ialt)= & monthuncertfract(ilon,ilat,ialt)/indpermonth(ilon,ilat,ialt) monthicecloud(ilon,ilat,ialt)= & monthicecloud(ilon,ilat,ialt)/indpermonth(ilon,ilat,ialt) monthwatercloud(ilon,ilat,ialt)= & monthwatercloud(ilon,ilat,ialt)/indpermonth(ilon,ilat,ialt) do icat=1,catmax monthuncloud(ilon,ilat,ialt,icat)= & monthuncloud(ilon,ilat,ialt,icat)/indpermonth(ilon,ilat,ialt) enddo else monthcloudfract(ilon,ilat,ialt)=-9999. monthclearfract(ilon,ilat,ialt)=-9999. ! monthsatfract(ilon,ilat,ialt)=-9999 monthuncertfract(ilon,ilat,ialt)=-9999. monthuncloud(ilon,ilat,ialt,:)=-9999. monthwatercloud(ilon,ilat,ialt)=-9999. monthicecloud(ilon,ilat,ialt)=-9999. indphasepermonth(ilon,ilat,ialt)=-9999. endif enddo enddo enddo deallocate(phasefractday,indphasefractday) ! Deallocate monthly indexes !**************************** SAVE THE MAP3D FILES **************************! file8=trim(file5)//trim(version)//'.nc' ! name of output netcdf MAP3D file file9=trim(file3(25:55)) ! period of MAP3D file (description of ncdf file) call create_profnc(file8,file9,lonmid,latmid,altmid,altmod_bound,resd, & dimidsp,altmax,lonmax-1,latmax-1) call prof_recvar2nc(monthcloudfract,monthclearfract,monthuncertfract, & dimidsp,file8,altmax,lonmax-1,latmax-1) print *, 'MAP3D files recorded' file8=trim(file10)//'.nc' ! name of output netcdf MAP3D file file9=trim(file3(25:55)) ! period of MAP3D file (description of ncdf file) call create_depolnc3d(file8,file9,lonmid,latmid,altmid,altmod_bound,resd, & dimidsp,dimidsp2,altmax,lonmax-1,latmax-1) !!$ call depol_recvar2nc(monthicecloud,monthwatercloud, & !indphasemonth, &!,monthsatfract, &,monthnanfract,monthsefract !!$ dimidsp, & !!$ file8,altmax,lonmax-1,latmax-1) !subroutine depol_recvar2ncocc(ice,water,un,ho,dust,ind,dim,fname,alt,nlon,nlat)!nan,se,sat call depol_recvar2ncocc(monthicecloud,monthwatercloud,monthuncloud, & monthphasecloud,indphasepermonth,dimidsp,dimidsp2, & file8,altmax,lonmax-1,latmax-1) ! check the allocation if (OK_buffer/=0) print *,'--- buffer allocation error ' !print *, 'tutu' deallocate(monthphasecloud,stat = OK_buffer) if (OK_buffer/=0) print *,'--- buffer allocation error ' !print *, 'tutu2' ! deallocate(indmonthphase3D,stat = OK_buffer) !if (OK_buffer/=0) print *,'--- buffer allocation error ' !print *, 'tutu3' deallocate(indphasepermonth,stat = OK_buffer) if (OK_buffer/=0) print *,'--- buffer allocation error ' file8=trim(file13)//'.nc' ! name of output netcdf MAP3D file file9=trim(file3(25:55)) ! period of MAP3D file (description of ncdf file) print *, 'MAP3D PHASE files recorded' call create_temp3d(file8,file9,lonmid,latmid,tempmid,tempmod_bound,resd, & dimidsp,tempmax-1,lonmax-1,latmax-1) print *, 'MAP3D create temp' call temp_recvar2nc(monthcftemp,monthcftempliq,monthcftempice, & monthcftempphase,dimidsp,file8,tempmax-1,lonmax-1,latmax-1) print *, 'MAP3D record temp' ! Deallocate daily & monthly diagSR variables print *, 'deallocate daily & monthly MAP3D variables' if(model=='lmdz')then deallocate(monthcloudfract,monthclearfract,monthuncertfract) deallocate(monthicecloud,monthwatercloud,indphasemonth,indpermonth) deallocate(monthuncloud) !print *, 'titi' ! deallocate(monthsatfract,monthnanfract,monthsefract) !print *, 'titi' !print *, 'titi' deallocate(indcftemppermonth) deallocate(indmonthphasetemp) deallocate(monthcftempphase) !print *, 'titi' deallocate(monthcftemp) deallocate(monthcftempliq) deallocate(monthcftempice) !print *, 'titi' endif !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!! PART II : DIAGSR FILES !!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! ! Allocation / initialization of diagSR monthly variables print *, 'allocation / initialization of diagSR monthly variables' file8=trim(file7)//'.nc' ! name of output netcdf diagSR file file9=trim(file3(25:55)) ! period of diagSR file (description of ncdf file) !!$ call create_diagnc2(trim(file7)//'.tmp',file9,lonmid,latmid,altmid,srmod,resd,dimidsd2, &!dimidsd2, & !!$ altmax,lonmax-1,latmax-1) !!$ !!$ !!$ !!$!************ CALCULATION OF MONTHLY DIAGNOSTIC WITH DAILY VAR **************! print *, 'allocation monthdiagSR terminé' print *, sum(sum(sum(sum(diagSRpha(:,:,:,:,1),4),3),2),1) print *, sum(sum(sum(sum(diagSRpha(:,:,:,:,2),4),3),2),1) print *, sum(sum(sum(sum(diagSRpha(:,:,:,:,3),4),3),2),1) forall(ilon=1:lonmax-1, ilat=1:latmax-1, ialt=1:altmax, indnan(ilat,ilon,ialt) == 0) diagSR(ilon,ilat,ialt,1:diagmax-1)=-9999. diagSRpha(ilon,ilat,ialt,1:diagmax-8,:)=-9999. endforall call create_diagnc(file8,file9,lonmid,latmid,altmid,altmod_bound,srmod,resd,dimidsd,dimidsdb, &!dimidsd2, & altmax,lonmax-1,latmax-1) print *, 'creation fichier diag final' call diag_recvar2nc3(diagSR,dimidsd,dimidsdb,file8,altmax,lonmax-1,latmax-1) ! call diag_recvar2nc(monthdiagSR15,monthdiagSR1,dimidsd,dimidsd2,file8,altmax,lonmax-1,latmax-1) file8=trim(file12)//'.nc' ! name of output netcdf diagSR file file9=trim(file3(25:55)) ! period of diagSR file (description of ncdf file) print *, sum(sum(sum(sum(diagSRpha(:,:,:,:,1),4),3),2),1) print *, sum(sum(sum(sum(diagSRpha(:,:,:,:,2),4),3),2),1) print *, sum(sum(sum(sum(diagSRpha(:,:,:,:,3),4),3),2),1) call create_diagncpha(file8,file9,lonmid,latmid,altmid,altmod_bound,srmod,resd,dimidsd,dimidsdb, &!dimidsd2, & altmax,lonmax-1,latmax-1) print *, 'creation fichier diag final' call diag_recvar2nc3pha(diagSRpha,dimidsd,dimidsdb,file8,altmax,lonmax-1,latmax-1) print *, 'deallocate daily & monthly diagSR variables' if(model=='lmdz')then deallocate(diagSR,diagSRpha)!,monthdiagSR15,monthdiagSR1) endif ! Deallocate daily & monthly diagSR variables print *, 'deallocate daily & monthly diagSR variables' 621 continue if(model=='lmdz')then deallocate(latmod,lonmod,prestop,altmod,srmod,pr2mod,atbrmod,srdepmod,depolmod,lonmid,latmid,altmid,tempmod,stat = OK_buffer) !crmod endif close(1) CASE ("chimere") continue CASE ("wrf") deallocate(latmod,lonmod,prestop,altmod,srmod,lonmid,latmid,altmid,stat = OK_buffer) !crmod close(1) ! close(35) CASE DEFAULT print *, "error" ENDSELECT 102 format(f10.2,3e13.5) 103 format((2x,f10.2),5(2x,e13.5)) 104 format(2(2x,I5),(2x,e13.5),4(2x,f8.2)) 106 format(3(f8.3,1x),2(e12.5,1x),7(f8.3,1x)) 107 format(9(f8.2,1x)) 108 format(4(f8.3,1x),(1x,e13.6)) print *, 'END OF PROGRAM' print *, '-----------------------------------------------------------------------' print *, '-----------------------------------------------------------------------' contains !****************************************************************************! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !****************************************************************************! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !* *! !* END OF PROGRAM *! !* *! !*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !****************************************************************************! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !****************************************************************************! !****************************************************************************! !****************************************************************************! !************************** SUBROUTINE LIST ***************************! !****************************************************************************! !****************************************************************************! !----------------------------------------------------------------------------! ! **** SDSREAD8 **** This routine allows to read 8-bit SDS-variable on hdf ! ! files ! !----------------------------------------------------------------------------! ! filename : calipso file name ! varname : SDS 8-bit name variable to extract from calipso file !----------------------------------------------------------------------------! ! var : SDS 8-bit variable to extract from calipso file !----------------------------------------------------------------------------! ! i : loop on the indice of calipso variables ! name : SDS 8-bit name variable to extract from calipso file ! ret : ! start : ! stride : ! edges : ! sd_id : some id ! sds_id : some id ! OK_buffer : ! npts : value of one dimension of the read var ! nprofs : value of one dimension of the read var ! nb : some loop index ! index : ! rank : ! istat : ! attributes: ! num_type : ! ! !----------------------------------------------------------------------------! subroutine sdsread8(var,filename,varname,ret) implicit none include "hdf.f90" include "dffunc.f90" integer :: i, ret, start(2) = 0, stride(2) = 1 ,edges(2) integer :: sd_id, sds_id, OK_buffer integer :: npts, nprofs, nb real*8,dimension(:,:),allocatable :: var integer*4 :: index, rank, istat, attributes, num_type integer*4 :: dim_sizes (32) character(len=232) :: name, filename character :: varname*100 sd_id = sfstart (filename, DFACC_READ) ! loop on the variables number (<100) do i=0,100 nb=i ! Select and read the var sds_id = sfselect (sd_id, nb) istat = sfginfo (sds_id, name, rank, dim_sizes, num_type, attributes) if(name==trim(varname))exit enddo ! Retrieving the dimesions & allocating memorie npts = dim_sizes(1) nprofs = dim_sizes(2) allocate(var(npts, nprofs),stat = OK_buffer) if (OK_buffer/=0) print *,'--- buffer allocation of ',trim(name),'error' edges = [npts, nprofs] ret = sfrdata (sds_id, start, stride, edges, var) ! Do something with the data if (ret.eq.-1) then print *,'ERROR' goto 555 end if ! Close the crap ret = sfendacc(sds_id) ret = sfend(sd_id) 555 continue end subroutine sdsread8 !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! **** SDSREAD **** This routine allows to read a 2dim SDS-variable on hdf ! ! files ! !----------------------------------------------------------------------------! subroutine sdsread(var,filename,varname) implicit none include "hdf.f90" include "dffunc.f90" integer :: i, ret, start(2) = 0, stride(2) = 1 ,edges(2) integer :: sd_id, sds_id integer :: npts, nprofs, nb, OK_buffer real,dimension(:,:),allocatable :: var integer*4 :: index, rank, istat, attributes, num_type integer*4 :: dim_sizes (32) character(len=232) :: name, filename character :: varname*100 ! print *,'Reading HDF file...' sd_id = sfstart (filename, DFACC_READ) do i=2,100 nb=i ! Select and read the var sds_id = sfselect (sd_id, nb) istat = sfginfo (sds_id, name, rank, dim_sizes, num_type, attributes) if(name==trim(varname))exit enddo ! print *, name,'dimensions : ', dim_sizes(1:2) npts = dim_sizes(1) nprofs = dim_sizes(2) allocate(var(npts, nprofs),stat = OK_buffer) if (OK_buffer/=0) print *,'--- buffer allocation of ',trim(name),'error' edges = [npts, nprofs] ret = sfrdata (sds_id, start, stride, edges, var) ! print *,'Reading : ', name ! Do something with the data if (ret.eq.-1) then print *,'ERROR' end if ! Close the crap ret = sfendacc(sds_id) ret = sfend(sd_id) end subroutine sdsread !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! !***** METAREAD ***** This routine allows to read a Meta-variable on hdf ! ! files ! !----------------------------------------------------------------------------! subroutine metaread(var,varname,filename) implicit none include "hdf.f90" include "dffunc.f90" integer :: ret, istat, OK_buffer integer :: file_id, vdata_ref, vdata_id ! integer :: interlace, vdata_size ,n_rec character :: varname*30 character :: filename*1024 ! character :: fields*550, vdata_name*30 real*4,dimension(:),allocatable :: var ! Allocate var size if(varname=='Lidar_Data_Altitudes')then allocate(var(583), stat=OK_buffer) if (OK_buffer/=0) print *,'--- buffer allocation of ',trim(varname),'error' else allocate(var(33), stat=OK_buffer) if (OK_buffer/=0) print *,'--- buffer allocation of ',trim(varname),'error' endif !print *,'Reading HDF file...' file_id = hopen (filename, DFACC_READ, 0) ! initialize vdata interface,find vdata called 'metadata ' ! attach to this vdata istat = vfstart (file_id) vdata_ref = vsffnd (file_id, 'metadata') vdata_id = vsfatch (file_id, vdata_ref, 'r') ! reads Varname !print *, varname,' exists : ', vsfex (vdata_id, varname) istat = vsfsfld (vdata_id, varname) ret = vsfread (vdata_id, var, 1, FULL_INTERLACE) if (ret.ne.-1) then continue else ! print *, 'ERROR READING METAVAR' end if ! TRES IMPORTANT : il faut appeler vsfseek entre chaque vsfsfld ! sinon la lecture ne fonctionne pas ! ret = vsfseek (vdata_id, 0) ! Close all the crap istat = vsfdtch(vdata_id) istat = vfend (file_id) istat = hclose (file_id) if (istat.eq.0) then print *,'Reading HDF File OK.' else print *,'ERROR READING HDF' endif end subroutine metaread !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! ***** NPROF ***** This routine find the hdf file number of profiles ! !----------------------------------------------------------------------------! subroutine nprof(filename,nb,nprofs) implicit none include "hdf.f90" include "dffunc.f90" integer :: ret integer :: sd_id, sds_id integer :: npts, nprofs, nb integer*4 :: rank, istat, attributes, num_type !index integer*4 :: dim_sizes (32) character(len=232) :: name, filename sd_id = sfstart (filename, DFACC_READ) ! Select and read the var sds_id = sfselect (sd_id, nb) istat = sfginfo (sds_id, name, rank, dim_sizes, num_type, attributes) ! Rtrieving the dimesions npts = dim_sizes(1) nprofs = dim_sizes(2) print *, 'le nombre de profil du fichier est :', nprofs ! Close the crap ret = sfendacc(sds_id) ret = sfend(sd_id) end subroutine nprof !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! ***** INTERP ***** This routine proceed a linear interpolation of variables! ! entered ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! var : non interpolated variable dim=33,nprofs ! ! fvar : altitude of meteo lvl in kilometer, = altm ! ! fvar2 : altitude of lidar lvl in kilometer = altl ! ! nprofs : number of profil ! !----------------------------------------------------------------------------! ! var2 : interpolated variable dim=583,nprofs ! !----------------------------------------------------------------------------! ! a,b : coefficient for the interpolation equation ! ! imol : loop index of the meteo altitude (33) ! ! ilid : loop index of the lidar altitude (583) ! ! altitude : number of level for the lidar variables ! ! altitude2: number of level for the meteo variables ! !----------------------------------------------------------------------------! ! ! ! ex : call interp(pres,pres2,altm,altl,i,it) ! !----------------------------------------------------------------------------! subroutine interp(var,var2,fvar,fvar2,i,nprofs) implicit none ! Indexes & parameters real :: a,b integer :: i integer :: ilid integer :: imol integer(kind=2),parameter :: altitude2 = 33 integer(kind=2),parameter :: altitude = 583 integer ::nprofs ! META variables real*4,dimension(583) :: fvar2 real*4,dimension(33) :: fvar real,dimension(33,nprofs) :: var real,dimension(583,nprofs) :: var2 do imol=2,altitude2 ! exclude the nan value if( ( (var(imol,i).lt.1E+16).and.(var(imol,i).gt.1E+13).or. & (var(imol,i).eq.-9999.) ).or.( (var(imol-1,i).lt.1E+16).and. & (var(imol-1,i).gt.1E+13).or.(var(imol-1,i).eq.-9999.) ) )then do ilid=1,altitude if ((fvar2(ilid).ge.fvar(imol)).and.(fvar2(ilid).lt.fvar(imol-1)))then var2(ilid,i)=-9999. endif enddo else ! calculation of coefficient a=(var(imol,i)-var(imol-1,i))/(fvar(imol)-fvar(imol-1)) b=var(imol,i)-a*fvar(imol) ! calculation of new interpolated variable do ilid=1,altitude if ((fvar2(ilid).ge.fvar(imol)).and.(fvar2(ilid).lt.fvar(imol-1)))then var2(ilid,i)=a*fvar2(ilid)+b endif enddo endif enddo end subroutine interp !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! ***** ATB_MOL_INTERP ***** This subroutine extrapolate the atbmol from the ! ! last atbmol known value to the Surface Elevation! ! in the limit of the 5 first kilometers ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! nprofs : number of profil ! ! alt : altitude of lidar lvl in kilometer = altl ! !----------------------------------------------------------------------------! ! var3 : molecular interpolated in km-1 sr-1 ! !----------------------------------------------------------------------------! ! l : loop index on alt3 altitude levels ! ! alt3 : selection of value of alt the nearest to 0 1 2 3 4 & 5km ! ! a,b : coefficient for the interpolation equation ! ! ilid : loop index of the lidar altitude (583) ! ! SeuilMol1km : treshold to add to the molecular to get the value of ! ! molecular 1kilometer lower (this treshold is available under ! ! 5km altitude) ! !----------------------------------------------------------------------------! ! ! ! ex : call atb_mol_interp(mol3,altl,i,it) ! ! ! !----------------------------------------------------------------------------! ! Purpose : When the molecular value is missing close to the ground (e.g. ! ! under 5km), this routine extrapolate this value with the tresh- ! ! old "SeuilMol1km" applied to the last known value of molecular ! ! at 5 4 3 2 or 1 km. Then we have 2 values of molecular distant ! ! from 1km. At this moment the routine perform the interpolation ! ! between this 2 values at the other altitude. This process ! ! don't stop until reaching the surface elevation. ! !----------------------------------------------------------------------------! subroutine atb_mol_interp(var3,alt,i,nprofs,seuil,SE) implicit none integer :: ilid, l, i, n ! real*4,parameter :: SeuilMol1km = 0.00015 , SeuilTemp1km = -6.5 real*4 :: seuil real*8 :: a,b integer :: nprofs integer,dimension(10) :: alt3 real,dimension(583,nprofs) :: var3 real,dimension(583) :: alt,SE ! altitude of 5 level from 0 to 5km each km (made from altl) alt3(1)=275; alt3(2)=296; alt3(3)=329; alt3(4)=362; alt3(5)=395; alt3(6)=429; alt3(7)=462; alt3(8)=495; alt3(9)=529; alt3(10)=562; if( sum(var3(1:275,i)).lt.0. )then ! Exclude entiere NaN profile var3(:,i)=-777. else do ilid=275,563 ! Exclude the nan value if( (var3(ilid,i).eq.(-9999.)) .or. (var3(ilid,i).eq.(-777.)))then do l=1,9 if( (ilid.gt.alt3(l)).and.(ilid.le.alt3(l+1)) ) then ! calculation of extrapolated value var3(alt3(l+1),i)=var3(alt3(l)-1,i)+seuil ! Calculation of the parameter to interpolate the value between the ! extrapolated value and the last known value a=(alt(alt3(l+1))-alt(alt3(l)-1))/(var3(alt3(l+1),i)-var3(alt3(l)-1,i)) b=alt(alt3(l+1))-a*var3(alt3(l+1),i) ! Calculation of the new interpolated variable do k=alt3(l),alt3(l+1) var3(k,i)=(alt(k)-b)/a enddo endif enddo endif enddo endif endsubroutine atb_mol_interp !----------------------------------------------------------------------------! subroutine atb_temp_interp(var3,alt,i,nprofs,seuil,SE) implicit none integer :: ilid, l, i, n ! real*4,parameter :: SeuilMol1km = 0.00015 , SeuilTemp1km = -6.5 real*4 :: seuil real*8 :: a,b integer :: nprofs integer,dimension(10) :: alt3 real,dimension(583,nprofs) :: var3 real,dimension(583) :: alt,SE ! altitude of 5 level from 0 to 5km each km (made from altl) alt3(1)=275; alt3(2)=296; alt3(3)=329; alt3(4)=362; alt3(5)=395; alt3(6)=429; alt3(7)=462; alt3(8)=495; alt3(9)=529; alt3(10)=562; if ( ((var3(150,i).eq.(-9999.)).and.(var3(200,i).eq.(-9999.)).and. & (var3(250,i).eq.(-9999.)).and.(var3(329,i).eq.(-9999.)).and. & (var3(429,i).eq.(-9999.)).and.(var3(529,i).eq.(-9999.))) .or. & ((var3(150,i).eq.(-777.)).and.(var3(200,i).eq.(-777.)).and. & (var3(250,i).eq.(-777.)).and.(var3(329,i).eq.(-777.)).and. & (var3(429,i).eq.(-777.)).and.(var3(529,i).eq.(-777.))) )then !print *, i,var3(250,i),var3(495,i) continue else do ilid=275,563 ! Exclude the nan value if( (var3(ilid,i).eq.(-9999.)) .or. (var3(ilid,i).eq.(-777.)))then do l=1,9 if( (ilid.gt.alt3(l)).and.(ilid.le.alt3(l+1)) ) then ! calculation of extrapolated value var3(alt3(l+1),i)=var3(alt3(l)-1,i)+seuil ! Calculation of the parameter to interpolate the value between the ! extrapolated value and the last known value a=(alt(alt3(l+1))-alt(alt3(l)-1))/(var3(alt3(l+1),i)-var3(alt3(l)-1,i)) b=alt(alt3(l+1))-a*var3(alt3(l+1),i) ! Calculation of the new interpolated variable do k=alt3(l),alt3(l+1) var3(k,i)=(alt(k)-b)/a enddo endif enddo endif enddo endif !if((i==49261).and.(seuil==0.00015))then !do ilid=1,583 !print *, 'atb_mol_interp',var3(ilid,i) !enddo !endif !print *, var3(495,i), "exit" endsubroutine atb_temp_interp !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! ***** ATB_MOL ***** This routine calculate the atbmol from 33lvl to 583lvl ! ! including the calculation of the rapport ! !----------------------------------------------------------------------------! ! alt1 : top calculation altitude level of the normalized ratio ! ! alt2 : toplow calculation altitude level of the normalized ratio ! ! nprofs : number of profil ! ! i : loop index on the profil ! ! var : attenuated backscatter (=atb(583,nprof)) ! ! var2 : molecular from 33lvl to 583lvl in CN (=mol2(583,nprof)) ! !----------------------------------------------------------------------------! ! var3 : molecular in km-1 sr-1 from mol2 (=mol3(583,nprof)) ! !----------------------------------------------------------------------------! ! n : loop index of the sliding average ! ! ilid : loop index of the lidar altitude (583) ! ! matb : sum of the atb ! ! mmol : sum of the molecular ! ! rapport3 : normalized ratio for each profil dim=(nprof) ! !----------------------------------------------------------------------------! ! ! ! ex : call atb_mol(atb,mol2,mol3,i,it,62,92) ! ! ! !----------------------------------------------------------------------------! ! Purpose : In order to caculate the scattering ratio, we need to estimate ! ! the molecular in sr-1 km-1 because : ! ! SR = atb(km-1 sr-1) / mol(km-1 sr-1) ! ! and we already know the atb value. ! ! The calculation is a sliding average of 66 profils on 20km ! ! (1profil every 330m, 66*330m = 20km). This operation allows to ! ! refine the molecular. ! !----------------------------------------------------------------------------! subroutine atb_mol(var,var2,var3,i,nprofs,alt1,alt2) implicit none integer :: ilid, i , n ,alt1, alt2 real :: matb, mmol !,rcompt integer :: nprofs real,dimension(583,nprofs) :: var, var2, var3 real,dimension(nprofs) :: rapport3 matb=0 mmol=0 rapport3(i)=0 ! rcompt=0 ! Average for the first profils if(i.lt.34)then !!!!! loop on profil matb=0 mmol=0 do n=0,65 ! average between 22-25km or 20-25km do ilid=alt1,alt2 ! exclude the nan values if ((var(ilid,i).ne.(-9999)).and.(var(ilid,i).lt.1).and. & (var2(ilid,i).ne.-9999))then matb=matb+var(ilid,1+n) mmol=mmol+var2(ilid,1+n) ! else ! rcompt=rcompt+1 !! check this process & the value rcompt endif enddo enddo ! calculation of the ratio rapport3(i)=matb/mmol ! Average for other profils else if( (i.gt.32).and.(i.lt.(it-32)) )then matb=0 mmol=0 do n=0,65 ! average between 22-25km or 20-25km do ilid=alt1,alt2 ! exclude the nan values if ((var(ilid,i).ne.(-9999)).and.(var(ilid,i).lt.1).and. & (var2(ilid,i).ne.-9999))then matb=matb+var(ilid,i-32+n) mmol=mmol+var2(ilid,i-32+n) ! else ! rcompt=rcompt+1 !! check this process & the value rcompt endif enddo enddo rapport3(i)=matb/mmol ! Average for the last profils else matb=0 mmol=0 do n=0,65 ! average between 22-25km or 20-25km do ilid=alt1,alt2 ! exclude the nan values if ((var(ilid,i).ne.(-9999)).and.(var(ilid,i).lt.1).and. & (var2(ilid,i).ne.-9999))then matb=matb+var(ilid,it-65+n); mmol=mmol+var2(ilid,it-65+n) ; endif enddo enddo rapport3(i)=matb/mmol endif endif !!!!! END loop on profil ! Calculation of the new molecular in km-1 sr-1 do ilid=1,583 if((var2(ilid,i).ne.(-9999)).and.(rapport3(i).ge.0.25e-28).and.(rapport3(i).le.0.97e-28))then var3(ilid,i)=rapport3(i)*var2(ilid,i) elseif(var2(ilid,i).eq.(-9999.))then var3(ilid,i)=-9999. ! allocation of nan values else var3(ilid,i)=-777. endif !if(i==49261)then !print *, 'atb_mol',var3(ilid,i) !endif enddo end subroutine atb_mol !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! **** ZERO_DETECT **** This routine detect the 0 values and substitute them ! ! by -777 ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! iz : loop index on the altitude grid ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! !----------------------------------------------------------------------------! ! var : verticaly averaged observed variables ! !----------------------------------------------------------------------------! ! ! ! ex : call zero_detect(pr2moy,i,iz,it,altmax) ! !----------------------------------------------------------------------------! subroutine zero_detect(var,i,iz,nprofs,alt) implicit none integer :: i,iz,nprofs,alt real*4,dimension(alt,nprofs) :: var if(var(iz,i).eq.0)then ! if no value is detected then allocate -9999 var(iz,i)=-9999. endif end subroutine zero_detect !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! **** ZERO_DETECT_CHIM **** This routine detect the 0 values and substitute ! ! them by -9999 ! !----------------------------------------------------------------------------! ! j : loop index on latitude grid ! ! k : loop index on longitude grid ! ! lat : number of the latitude boxes ! ! lon : number of the longitude boxes ! ! iz : loop index on the altitude grid ! ! alt : number of the altitude boxes ! !----------------------------------------------------------------------------! ! var : verticaly averaged observed variables ! !----------------------------------------------------------------------------! ! ! ! ex : call zero_detect_chim(pr2moy,iz,altmax,j,k,latmax,lonmax) ! !----------------------------------------------------------------------------! subroutine zero_detect_chim(var,iz,alt,j,k,lat,lon) implicit none integer :: iz,alt,j,k,lat,lon real*4,dimension(lat,lon,alt) :: var if(var(j,k,iz).eq.0)then ! if no value is detected then allocate -9999 var(j,k,iz)=-9999 endif end subroutine zero_detect_chim !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SR_CR_DEPOL_chim *** This routine do the SR CR & DEPOL average except ! ! for the -9999 values ! !----------------------------------------------------------------------------! ! j : loop index on latitude grid ! ! k : loop index on longitude grid ! ! lat : number of the latitude boxes ! ! lon : number of the longitude boxes ! ! iz : loop index on the altitude grid ! ! alt : number of the altitude boxes ! ! num : index to select the method of calculation ! ! var1, var2 : verticaly averaged observed variables ! ! var4 : scattering ratio vertically averaged ! ! ind1 : number of occurence of obs variables contained in var1 ! ! ind2 : number of occurence of obs variables contained in var2 ! !----------------------------------------------------------------------------! ! var3 : result of var1/var2 ! !----------------------------------------------------------------------------! ! ! ! ex : call SR_CR_DEPOL_chim(pr2moy,molmoy,srmoy,indice,indicem,iz,altmax, ! ! j,k,latmax,lonmax,1,srmoy) ! !----------------------------------------------------------------------------! subroutine SR_CR_DEPOL_chim(var1,var2,var3,ind1,ind2,iz,alt,j,k,lat,lon,num, & var4) implicit none integer :: iz,alt,j,k,lat,lon,num real*4,dimension(lat,lon,alt) :: var1,var2,var3,var4,ind1,ind2 if(num.eq.1)then ! calculation if var3 = srmoy if ((var1(j,k,iz).eq.(-9999)).or.(var2(j,k,iz).EQ.(-9999))) then var3(j,k,iz) = -9999 else var3(j,k,iz) = (var1(j,k,iz)*ind2(j,k,iz))/(var2(j,k,iz)*ind1(j,k,iz)) endif else ! calculation if var3 is different than srmoy if(var4(j,k,iz).eq.(-9999))then var3(j,k,iz) = -9999 else if ((var1(j,k,iz).eq.(-9999)).or.(var2(j,k,iz).EQ.(-9999))) then var3(j,k,iz) = -9999 else var3(j,k,iz) = (var1(j,k,iz)*ind2(j,k,iz))/(var2(j,k,iz)*ind1(j,k,iz)) endif endif endif end subroutine SR_CR_DEPOL_chim !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SR_CR_DEPOL_mean *** This routine do the SR CR & DEPOL average except ! ! for the -9999 values ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! iz : loop index on the altitude grid ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1, var2 : verticaly averaged observed variables ! ! ind1 : number of occurence of obs variables contained in var1 ! ! ind2 : number of occurence of obs variables contained in var2 ! !----------------------------------------------------------------------------! ! var3 : result of var1/var2 ! !----------------------------------------------------------------------------! ! ! ! ex : call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, ! ! altmax) ! !----------------------------------------------------------------------------! subroutine SR_CR_DEPOL_mean(var1,var2,var3,ind1,ind2,i,iz,nprofs,alt) ! call SR_CR_DEPOL_mean(parmoy,perpmoy,depolmoy,indicep2,indicep,i,iz,it, & ! altmax) ! call SR_CR_DEPOL_mean(parmoy,perpmoy,depolmoy,indicep2,indicep,i,iz,it, & ! altmax) implicit none integer :: i,iz,nprofs,alt real,dimension(alt,nprofs) :: var1,var2,var3 real,dimension(alt,nprofs) :: ind1,ind2 if ((var1(iz,i).eq.(-9999.)).or.(var2(iz,i).EQ.(-9999.))) then var3(iz,i) = -9999. elseif ((var1(iz,i).eq.(-888.)).or.(var2(iz,i).EQ.(-888.))) then var3(iz,i) = -888. elseif ((var1(iz,i).eq.(-777.)).or.(var2(iz,i).EQ.(-777.))) then var3(iz,i) = -777. else var3(iz,i) = (var1(iz,i)*ind2(iz,i)) / (var2(iz,i)*ind1(iz,i)) endif end subroutine SR_CR_DEPOL_mean !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** FILTRE_2LVL *** This routine delete the cloud over 21km and do the ! ! the SR average execpt for the nan values. ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! iz : loop index on the altitude grid ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1, var2 : verticaly averaged observed variables ! ! ind1 : number of occurence of obs variables contained in var1 ! ! ind2 : number of occurence of obs variables contained in var2 ! !----------------------------------------------------------------------------! ! var3 : result of var1/var2 ! !----------------------------------------------------------------------------! ! ! ! ex : call SR_CR_DEPOL_mean(pr2moy,molmoy,srmoy,indice,indicem,i,iz,it, ! ! altmax) ! !----------------------------------------------------------------------------! ! Purpose : noise could be interprated as cloudy point in the program so, ! ! we have built this routine to filter this phenomena over 21km ! ! because cloud couldn't appear in this area execpt during the ! ! polar winter. ! !----------------------------------------------------------------------------! subroutine filtre_2lvl(var1,var2,var3,ind1,ind2,i,iz,nprofs,alt,grid) implicit none integer :: i,iz,nprofs,alt,lvl real*4,dimension(alt,nprofs) :: var1,var2,var3 real*4,dimension(alt,nprofs) :: ind1,ind2 character :: grid*8 if(gcm.eq.'LMDZ')then lvl=15 ! level to go past in order to apply the filter = 20.8km elseif(gcm.eq.'LMDZ40')then lvl=30 ! level to go past in order to apply the filter = 21.1km elseif(gcm.eq.'WRF')then lvl=46 ! level to go past in order to apply the filter = 21.7km endif if (iz.ge.lvl) then ! filter the cloud over 21km + nan values if((((var1(iz,i)*ind2(iz,i))/(var2(iz,i)*ind1(iz,i))).ge.5.) .or.& (var1(iz,i).eq.(-9999)).or.(var2(iz,i).EQ.(-9999)).or.& ((var1(iz,i).eq.(-777)).or.(var2(iz,i).EQ.(-777))))then var3(iz,i) = -777 else ! calculation of the average var3(iz,i) = (var1(iz,i)*ind2(iz,i))/(var2(iz,i)*ind1(iz,i)) endif elseif((var1(iz,i).eq.(-9999)).or.(var2(iz,i).EQ.(-9999))) then ! filter the nan values var3(iz,i) = -9999 elseif ((var1(iz,i).eq.(-888)).or.(var2(iz,i).EQ.(-888))) then var3(iz,i) = -888 elseif ((var1(iz,i).eq.(-777)).or.(var2(iz,i).EQ.(-777))) then var3(iz,i) = -777 else ! calculation of the average var3(iz,i) = (var1(iz,i)*ind2(iz,i))/(var2(iz,i)*ind1(iz,i)) endif end subroutine filtre_2lvl !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** FRACTION_SUBGRID2 *** This routine calculate the cloudy,clear, ! ! saturated... fraction flag(0/1) ! !----------------------------------------------------------------------------! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! i : loop index on the profil ! ! switch : switch to chose cloudy or sat mode ! ! var : vertically averaged SR ! ! var1, var2 : verticaly averaged observed variables (atb & mol moy) ! ! ind1 : number of occurence of obs variables contained in var1 ! ! ind2 : number of occurence of obs variables contained in var2 ! !----------------------------------------------------------------------------! ! frac1 : fully attenuated fraction ! ! frac2 : cloudy fraction ! ! frac3 : clear fraction ! ! frac4 : uncertain fraction ! ! frac5 : NaN fraction ! ! frac6 : Surface_elevation fraction ! !----------------------------------------------------------------------------! ! iz : loop index on the altitude grid ! ! fracttot : sum of all the fraction (=1) ! ! toplvlcloud : first cloudy point encountered from the top to the ground ! ! toplvlsat : first fully attenuated point encountered from the top to ! ! the ground ! ! SeuilClearSr : clear treshold detection = 1.2 ! ! SeuilSatSr : fully attenuated treshold detection = 0.01 ! ! SeuilSrCloud : cloudy treshold detection = 5 ! ! SeuilDeltAtb : delta atb treshold = 1.4e-03 km-1 sr-1 ! ! delta : atb - mol ! !----------------------------------------------------------------------------! ! ! ! ex : call fraction_subgrid2(srmoy,pr2moy,indice,molmoy,indicem,satfraction,! ! cloudfraction,clearfraction,uncertfraction, ! ! nanfraction,sefraction,i,altmax,it,switch2) ! !----------------------------------------------------------------------------! subroutine fraction_subgrid2(var,var1,ind1,var2,ind2,frac1,frac2,frac3,frac4,& frac5,frac6,frac7,i,alt,nprofs,switch)!frac7,& ! frac8,i,alt,nprofs)!frac1bis,frac2bis implicit none integer :: i,iz,nprofs,alt real*4 :: fracttot real :: toplvlcloud,toplvlsat real, parameter :: SeuilClearSr = 1.2 real, parameter :: SeuilSatSr = 0.01 real, parameter :: SeuilSrCloud = 5. real,parameter :: SeuilDeltAtb = 2.5e-03 real*4 :: delta ! delta atb = atb-atbmol character :: switch*6 real*4,dimension(alt,nprofs) :: var real*4,dimension(alt,nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: ind1,ind2 real*4,dimension(alt,nprofs) :: frac1,frac2,frac3,frac4,frac5,frac6,frac7!,frac8!,frac2bis,frac1bis delta = 0 toplvlcloud=0; toplvlsat=0 B1 : do iz=alt,1,-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb) ) then toplvlcloud=iz ! lvl from first cloudy point exit B1 endif enddo B1 B2 : do iz=alt,1,-1 if(iz.lt.toplvlcloud)then if ((var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr))) then toplvlsat=iz ! lvl from first saturated point exit B2 endif endif enddo B2 do iz=1,alt delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! pts nuageux endif elseif(trim(switch).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).gt.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud).and.(var(iz,i).gt.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud).and. & (delta.lt.SeuilDeltAtb))) then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).lt.SeuilSrCloud).and.(var(iz,i).gt.SeuilClearSr).and.& (delta.gt.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo do iz=1,alt fracttot=frac1(iz,i)+frac2(iz,i)+frac3(iz,i)+frac4(iz,i)+frac5(iz,i)+ & frac6(iz,i)+frac7(iz,i) !check = 1 if (fracttot.ne.1) then print *, "fraction error" print *, 'instant',fracttot,frac1(iz,i),frac2(iz,i),frac3(iz,i), & frac4(iz,i),frac5(iz,i),frac6(iz,i),frac7(iz,i) endif enddo end subroutine fraction_subgrid2 !----------------------------------------------------------------------------! subroutine fraction_subgrid2_8km(seuilsnrlow,seuilsnrhigh,var,var1,ind1,var2,ind2,frac1,frac2,frac3,frac4,& frac5,frac6,frac7,i,alt,nprofs,toplow,topmid,switch,switch2)!frac7,& ! frac8,i,alt,nprofs)!frac1bis,frac2bis implicit none integer :: i,iz,nprofs,alt,toplow,topmid,seuilsnrhigh,seuilsnrlow real*4 :: fracttot real :: toplvlcloud,toplvlsat real, parameter :: SeuilStrat = 30. real, parameter :: SeuilClearSr = 1.2 real, parameter :: SeuilSatSr = 0.01 real, parameter :: SeuilSrCloud = 5. real, parameter :: SeuilSrCloud2 = 15 real :: SeuilSrCloud3 real,parameter :: SeuilDeltAtb = 2.5e-03 real*4 :: delta ! delta atb = atb-atbmol character :: switch*5,switch2*6 real*4,dimension(alt,nprofs) :: var real*4,dimension(alt,nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: ind1,ind2 real*4,dimension(alt,nprofs) :: frac1,frac2,frac3,frac4,frac5,frac6,frac7!,frac8!,frac2bis,frac1bis delta = 0 toplvlcloud=0; toplvlsat=0 B1 : do iz=alt,1,-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb) ) then toplvlcloud=iz ! lvl from first cloudy point exit B1 endif enddo B1 B2 : do iz=alt,1,-1 if(iz.lt.toplvlcloud)then if ((var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr))) then toplvlsat=iz ! lvl from first saturated point exit B2 endif endif enddo B2 !print *, 'switch2',trim(switch2) if(trim(switch).eq.'day')then SeuilSrCloud3 = SeuilSrCloud !print *, 'test' do iz=seuilsnrhigh,alt delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ))then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).ge.SeuilSrCloud3).and.(delta.lt.SeuilDeltAtb)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -777 (surface elevation) endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo do iz=1,seuilsnrlow delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ))then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).ge.SeuilSrCloud3).and.(delta.lt.SeuilDeltAtb)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -777 (surface elevation) endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo B3: do iz=1,toplow-1 if(var(iz,i).gt.SeuilStrat)then SeuilSrCloud3 = SeuilSrCloud2 exit B3 endif enddo B3 do iz=seuilsnrlow+1,seuilsnrhigh-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ))then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).ge.SeuilSrCloud3).and.(delta.lt.SeuilDeltAtb)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -777 (surface elevation) endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo ! elseif(trim(switch).eq.'night')then do iz=1,alt SeuilSrCloud3 = SeuilSrCloud delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -777 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ))then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).ge.SeuilSrCloud3).and.(delta.lt.SeuilDeltAtb)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -777 (surface elevation) endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo endif !print *, frac1(iz,i),frac2(iz,i),frac3(iz,i), & ! frac4(iz,i),frac5(iz,i),frac6(iz,i),frac7(iz,i) do iz=1,alt fracttot=frac1(iz,i)+frac2(iz,i)+frac3(iz,i)+frac4(iz,i)+frac5(iz,i)+ & frac6(iz,i)+frac7(iz,i) !check = 1 if (fracttot.ne.1) then print *, "fraction error" print *, 'instant',fracttot,frac1(iz,i),frac2(iz,i),frac3(iz,i), & frac4(iz,i),frac5(iz,i),frac6(iz,i),frac7(iz,i), i,iz,var(iz,i) ! stop endif enddo end subroutine fraction_subgrid2_8km !----------------------------------------------------------------------------! subroutine fraction_subgrid2_8km_delta(var,var1,ind1,var2,ind2,frac1,frac2,frac3,frac4,& frac5,frac6,frac7,i,alt,nprofs,toplow,topmid,switch,switch2)!frac7,& ! frac8,i,alt,nprofs)!frac1bis,frac2bis implicit none integer :: i,iz,nprofs,alt,toplow,topmid real*4 :: fracttot real :: toplvlcloud,toplvlsat real, parameter :: SeuilStrat = 30. real, parameter :: SeuilClearSr = 1.2 real, parameter :: SeuilSatSr = 0.01 real, parameter :: SeuilSrCloud = 5. real, parameter :: SeuilSrCloud2 = 15 real :: SeuilSrCloud3 real,parameter :: SeuilDeltAtb = 2.5e-03 real*4 :: delta ! delta atb = atb-atbmol character :: switch*5,switch2*6 real*4,dimension(alt,nprofs) :: var real*4,dimension(alt,nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: ind1,ind2 real*4,dimension(alt,nprofs) :: frac1,frac2,frac3,frac4,frac5,frac6,frac7!,frac8!,frac2bis,frac1bis delta = 0 toplvlcloud=0; toplvlsat=0 B1 : do iz=alt,1,-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb) ) then toplvlcloud=iz ! lvl from first cloudy point exit B1 endif enddo B1 B2 : do iz=alt,1,-1 if(iz.lt.toplvlcloud)then if ((var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr))) then toplvlsat=iz ! lvl from first saturated point exit B2 endif endif enddo B2 !print *, 'switch2',trim(switch2) if(trim(switch).eq.'day')then SeuilSrCloud3 = SeuilSrCloud !print *, 'test' do iz=18,alt delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3))then !.and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then!.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then!.and.& ! (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo do iz=1,5 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then !.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then!.and.& ! (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo B3: do iz=1,toplow-1 if(var(iz,i).gt.SeuilStrat)then SeuilSrCloud3 = SeuilSrCloud2 exit B3 endif enddo B3 do iz=6,17 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then !.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then !.and.& ! (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo ! elseif(trim(switch).eq.'night')then do iz=1,alt SeuilSrCloud3 = SeuilSrCloud delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac5(iz,i)=frac5(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac6(iz,i)=frac6(iz,i)+1 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac7(iz,i)=frac7(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac2(iz,i)=frac2(iz,i)+1 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac2(iz,i)=frac2(iz,i)+1 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac1(iz,i)=frac1(iz,i)+1 ! elseif(iz.gt.toplvlsat)then frac3(iz,i)=frac3(iz,i)+1 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then !.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac3(iz,i)=frac3(iz,i)+1 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then !.and.& ! (delta.ge.SeuilDeltAtb))then frac4(iz,i)=frac4(iz,i)+1 ! indice nb de points incertain endif enddo endif !print *, frac1(iz,i),frac2(iz,i),frac3(iz,i), & ! frac4(iz,i),frac5(iz,i),frac6(iz,i),frac7(iz,i) do iz=1,alt fracttot=frac1(iz,i)+frac2(iz,i)+frac3(iz,i)+frac4(iz,i)+frac5(iz,i)+ & frac6(iz,i)+frac7(iz,i) !check = 1 if (fracttot.ne.1) then print *, "fraction error" print *, 'instant',fracttot,frac1(iz,i),frac2(iz,i),frac3(iz,i), & frac4(iz,i),frac5(iz,i),frac6(iz,i),frac7(iz,i), i,iz,var(iz,i) ! stop endif enddo end subroutine fraction_subgrid2_8km_delta !----------------------------------------------------------------------------! subroutine fraction_subgrid3_8km(seuilsnrlow,seuilsnrhigh,altvar,var,var1,ind1,var2,ind2,frac,i,alt,nprofs,switch,switch2) implicit none integer :: i,iz,nprofs,alt,toplow,topmid,seuilsnrhigh,seuilsnrlow real*4 :: fracttot real :: toplvlcloud,toplvlsat real, parameter :: SeuilStrat = 30. real, parameter :: SeuilClearSr = 1.2 real, parameter :: SeuilSatSr = 0.01 real, parameter :: SeuilSrCloud = 5. real, parameter :: SeuilSrCloud2 = 15 real :: SeuilSrCloud3 real,parameter :: SeuilDeltAtb = 2.5e-03 real*4 :: delta ! delta atb = atb-atbmol character :: switch*5,switch2*6 real*4,dimension(alt+1) :: altvar real*4,dimension(alt,nprofs) :: var real*4,dimension(alt,nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: ind1,ind2 real*4,dimension(alt,nprofs) :: frac ! uncert+4 nan+1 surf+6 rejec+7 clear+2 cld+3 sat+8 delta = 0 toplvlcloud=0; toplvlsat=0 B1 : do iz=alt,1,-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb) ) then toplvlcloud=iz ! lvl from first cloudy point exit B1 endif enddo B1 B2 : do iz=alt,1,-1 if(iz.lt.toplvlcloud)then if ((var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr))) then toplvlsat=iz ! lvl from first saturated point exit B2 endif endif enddo B2 !print *, 'switch2',trim(switch2) if(trim(switch).eq.'day')then SeuilSrCloud3 = SeuilSrCloud !print *, 'test' ! uncert+4 nan+1 surf+6 rejec+7 clear+2 cld+3 sat+8 do iz=seuilsnrhigh,alt !=18 for cfmip2 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo do iz=1,seuilsnrlow ! =5 for cfmip2 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo B3: do iz=1,toplow-1 if(var(iz,i).gt.SeuilStrat)then SeuilSrCloud3 = SeuilSrCloud2 exit B3 endif enddo B3 do iz=seuilsnrlow+1,seuilsnrhigh-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo ! elseif(trim(switch).eq.'night')then do iz=1,alt SeuilSrCloud3 = SeuilSrCloud delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -777 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3).and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ))then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).ge.SeuilSrCloud3).and.(delta.lt.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -777 (surface elevation) endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo endif end subroutine fraction_subgrid3_8km !----------------------------------------------------------------------------! subroutine fraction_subgrid3_8km_delta(var,var1,ind1,var2,ind2,frac,i,alt,nprofs,switch,switch2) implicit none integer :: i,iz,nprofs,alt,toplow,topmid real*4 :: fracttot real :: toplvlcloud,toplvlsat real, parameter :: SeuilStrat = 30. real, parameter :: SeuilClearSr = 1.2 real, parameter :: SeuilSatSr = 0.01 real, parameter :: SeuilSrCloud = 5. real, parameter :: SeuilSrCloud2 = 15 real :: SeuilSrCloud3 real,parameter :: SeuilDeltAtb = 2.5e-03 real*4 :: delta ! delta atb = atb-atbmol character :: switch*5,switch2*6 real*4,dimension(alt,nprofs) :: var real*4,dimension(alt,nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: ind1,ind2 real*4,dimension(alt,nprofs) :: frac ! uncert+4 nan+1 surf+6 rejec+7 clear+2 cld+3 sat+8 delta = 0 toplvlcloud=0; toplvlsat=0 B1 : do iz=alt,1,-1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb) ) then toplvlcloud=iz ! lvl from first cloudy point exit B1 endif enddo B1 B2 : do iz=alt,1,-1 if(iz.lt.toplvlcloud)then if ((var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr))) then toplvlsat=iz ! lvl from first saturated point exit B2 endif endif enddo B2 !print *, 'switch2',trim(switch2) if(trim(switch).eq.'day')then SeuilSrCloud3 = SeuilSrCloud !print *, 'test' ! uncert+4 nan+1 surf+6 rejec+7 clear+2 cld+3 sat+8 do iz=18,alt delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then !.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then !.and.& ! (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo do iz=1,5 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then !.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then !.and.& ! (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo B3: do iz=1,toplow-1 if(var(iz,i).gt.SeuilStrat)then SeuilSrCloud3 = SeuilSrCloud2 exit B3 endif enddo B3 do iz=6,17 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then !.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then !.and.& ! (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo ! elseif(trim(switch).eq.'night')then do iz=1,alt SeuilSrCloud3 = SeuilSrCloud delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+7 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud3) )then !.and.(delta.ge.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch2).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! pts fully attenuated elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts fully attenuated over the cloud ==> clear elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! 1st pt fully attenuated ==> cloud endif elseif(trim(switch2).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).ge.(SeuilSatSr)) )then!.or. & ! ((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr).and.& ! (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud3).and. & ! (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud3).and.(var(iz,i).ge.SeuilClearSr) )then!.and.& ! (delta.ge.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif enddo endif end subroutine fraction_subgrid3_8km_delta !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** FRACTION_SUBGRID3 *** This routine calculate the cloudy,clear, ! ! saturated... fraction in order to be used by ! ! matlab (flag 1/2/3/4/5/6) ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1, var2 : verticaly averaged observed variables (atb & mol moy) ! ! var : vertically averaged SR ! ! ind1 : number of occurence of obs variables contained in var1 ! ! ind2 : number of occurence of obs variables contained in var2 ! !----------------------------------------------------------------------------! ! frac : fraction of fully, cloudy, clear, uncert, nan, se point ! ! cloud=6, clear=2, fully_att=1, uncert=3, nan=4, SE=5 ! !----------------------------------------------------------------------------! ! iz : loop index on the altitude grid ! ! toplvlcloud : first cloudy point encountered from the top to the ground ! ! toplvlsat : first fully attenuated point encountered from the top to ! ! the ground ! ! SeuilClearSr : clear treshold detection = 1.2 ! ! SeuilSatSr : fully attenuated treshold detection = 0.01 ! ! SeuilSrCloud : cloudy treshold detection = 3 ! ! SeuilDeltAtb : delta atb treshold = 1.4e-03 km-1 sr-1 ! ! delta : atb - mol ! !----------------------------------------------------------------------------! ! ! ! ex : call fraction_subgrid3(srmoy,pr2moy,indice,molmoy,indicem,fractot,i, ! ! altmax,it) ! !----------------------------------------------------------------------------! subroutine fraction_subgrid3(var,var1,ind1,var2,ind2,frac,i,alt,nprofs,switch) implicit none integer :: i,iz,nprofs,alt character :: switch*6 real, parameter :: SeuilClearSr = 1.2 ! Seuil de saturation en atb en attendant flag real, parameter :: SeuilSatSr = 0.01 ! seuil de saturation en ATB=valeur ATBmol à 30km real, parameter :: SeuilSrCloud = 5. ! seuil detection nuageuse sr real,parameter :: SeuilCrCloud = 0. ! seuil detection nuageuse cr>0.6, ne filtre pas les gros aerosols (atbd calipso) real,parameter :: SeuilDeltAtb = 2.5e-03 ! seuil détection unclassify real*4 :: delta ! delta atb = atb-atbmol integer :: toplvlcloud,toplvlsat real*4,dimension(alt,nprofs) :: var real*4,dimension(alt,nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: ind1,ind2 real*4,dimension(alt,nprofs) :: frac!,frac7 !flag 1= satfraction, 2=clear, 3=uncert, 5=nan, 4=SE, 6=cloud delta = 0 toplvlcloud=0; toplvlsat=0 B1 : do iz=alt,1,-1 if((var1(iz,i).eq.(-9999)).or.(var(iz,i).eq.(-888)).or.(var(iz,i).eq.(-777))) exit B1 delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) if ( (var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb) ) then toplvlcloud=iz ! lvl from first cloudy point exit B1 endif enddo B1 B2 : do iz=alt,1,-1 if(iz.lt.toplvlcloud)then if((var1(iz,i).eq.(-9999)).or.(var(iz,i).eq.(-888)).or.(var(iz,i).eq.(-777))) exit B2 if ((var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr))) then toplvlsat=iz ! lvl from first saturated point exit B2 endif endif enddo B2 do iz=1,alt if((var1(iz,i).eq.(-9999)).or.(var(iz,i).eq.(-888)).or.(var(iz,i).eq.(-777)))then delta=0 else delta= (var1(iz,i)/ind1(iz,i)) - (var2(iz,i)/ind2(iz,i)) endif if ( (var(iz,i).eq.(-9999) ) )then! .or.((var(1,iz,i).ne.(-888)).and.(var(1,iz,i).lt.(SeuilSatSr2))) ) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -9999 endif if (var(iz,i).eq.(-888)) then frac(iz,i)=frac(iz,i)+6 ! indice nb de -888 (surface elevation) endif if (var(iz,i).eq.(-777)) then frac(iz,i)=frac(iz,i)+1 ! indice nb de -888 (surface elevation) endif if ((var(iz,i).ge.SeuilSrCloud).and.(delta.gt.SeuilDeltAtb)) then frac(iz,i)=frac(iz,i)+3 ! indice nb de points nuageux ds boite endif if ( (var(iz,i).ne.(-9999)).and.(var(iz,i).ne.(-888)).and.(var(iz,i).ne.(-777)).and. & (var(iz,i).lt.(SeuilSatSr)) ) then if(trim(switch).eq.'cloudy')then if(iz.lt.toplvlsat)then frac(iz,i)=frac(iz,i)+8 elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair elseif(iz.eq.toplvlsat)then frac(iz,i)=frac(iz,i)+3 ! pts nuageux endif elseif(trim(switch).eq.'sat')then if(iz.le.toplvlsat)then frac(iz,i)=frac(iz,i)+8 ! elseif(iz.gt.toplvlsat)then frac(iz,i)=frac(iz,i)+2 ! pts clair endif endif endif if((var(iz,i).lt.SeuilClearSr).and.(var(iz,i).gt.(SeuilSatSr)).or. & ((var(iz,i).lt.SeuilSrCloud).and.(var(iz,i).gt.SeuilClearSr).and.& (delta.lt.SeuilDeltAtb) ).or.((var(iz,i).ge.SeuilSrCloud).and. & (delta.lt.SeuilDeltAtb))) then frac(iz,i)=frac(iz,i)+2 endif if((var(iz,i).lt.SeuilSrCloud).and.(var(iz,i).gt.SeuilClearSr).and.& (delta.gt.SeuilDeltAtb))then frac(iz,i)=frac(iz,i)+4 ! indice nb de points incertain endif !!$if((i.ge.35618).and.(i.le.35629))then !!$print *,i !!$if(iz.lt.4)then !!$ print *, iz,i, delta,toplvlcloud,toplvlsat !!$ print *, var(iz,i),frac(iz,i) !!$endif !!$ !!$endif enddo end subroutine fraction_subgrid3 !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** VERTICAL_MEAN_CHIM *** This routine calculate the vertical mean for ! ! the CHIMERE grid ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! ilid : loop index of the lidar altitude (583) ! ! nprofs : number of profil ! ! j : loop index on latitude grid ! ! k : loop index on longitude grid ! ! lat : number of the latitude boxes ! ! lon : number of the longitude boxes ! ! iz : loop index on the altitude grid ! ! alt : number of the altitude boxes ! ! nvar : switch to chose cloudy or sat mode ! ! var3 : attenuated backscatter ! ! var1 : observed variable to average ! ! ind : number of occurence of obs variables contained in var1 ! !----------------------------------------------------------------------------! ! var2 : averaged variable ! !----------------------------------------------------------------------------! ! ! ! ex call vertical_mean_chim(atb,pr2moy,atb,indice,i,iz,ilid,it,altmax, ! ! altitude,j,k,latmax,lonmax,1) ! !----------------------------------------------------------------------------! subroutine vertical_mean_chim(var1,var2,var3,ind,i,iz,ilid,nprofs,alt,alt2,j,& k,lat,lon,nvar) implicit none integer :: nvar integer :: i,nprofs,j,k,iz,alt,ilid,lat,lon integer(kind=2) :: alt2 real*4,dimension(alt2,nprofs) :: var1,var3 real*4,dimension(lat,lon,alt) :: var2 real*4,dimension(lat,lon,alt) :: ind if (nvar==1) then ! Vertical average for atb if ( (var1(ilid,i).ne.(-9999)).and.(var1(ilid,i).lt.1) ) then var2(j,k,iz)=var2(j,k,iz)+var1(ilid,i) ind(j,k,iz)=ind(j,k,iz)+1 endif else ! Vertical average for perp if(nvar==2) then if ( (var1(ilid,i).ne.(-9999)).and.(var3(ilid,i).ne.(-9999)) .and. & (var3(ilid,i).lt.1) )then var2(j,k,iz)=var2(j,k,iz)+(var3(ilid,i)-var1(ilid,i)) ind(j,k,iz)=ind(j,k,iz)+1 endif else ! Other vertical average if ( var1(ilid,i).ne.(-9999) ) then var2(j,k,iz)=var2(j,k,iz)+var1(ilid,i) ind(j,k,iz)=ind(j,k,iz)+1 endif endif endif end subroutine vertical_mean_chim !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** VERTICAL_MEAN *** This routine calculate the vertical mean for other ! ! grid ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! ilid : loop index of the lidar altitude (583) ! ! nprofs : number of profil ! ! iz : loop index on the altitude grid ! ! alt : number of the altitude boxes ! ! alt2 : number of level of the lidar variables ! ! nvar : switch to chose cloudy or sat mode ! ! var3 : attenuated backscatter ! ! var1 : observed variable to average ! ! ind : number of occurence of obs variables contained in var1 ! !----------------------------------------------------------------------------! ! var2 : averaged variable ! !----------------------------------------------------------------------------! ! ! ! ex : call vertical_mean(atb,pr2moy,atb,indice,i,iz,ilid,it,altmax, ! ! altitude,1) ! !----------------------------------------------------------------------------! subroutine vertical_mean(var1,var2,var3,ind,i,iz,ilid,nprofs,alt,alt2,nvar) ! call vertical_mean(temp2,tempmoy,atb,indicetemp,i,iz,ilid,it,altmax,& ! altitude,3) implicit none integer :: nvar integer :: i,iz,nprofs,alt,ilid integer(kind=2) :: alt2 real*4,dimension(alt2,nprofs) :: var1,var3 real*4,dimension(alt,nprofs) :: var2 real*4,dimension(alt,nprofs) :: ind if (nvar==1) then ! Vertical average for atb if ( (var1(ilid,i).ne.(-9999.)).and.(var1(ilid,i).lt.1).and.(var1(ilid,i).ne.(-888.)).and.(var1(ilid,i).ne.(-777.))) then var2(iz,i)=var2(iz,i)+var1(ilid,i) ind(iz,i)=ind(iz,i)+1 endif elseif(nvar==2) then ! Vertical average for perp if ( (var1(ilid,i).ne.(-9999.)).and.(var3(ilid,i).ne.(-9999.)) .and. & (var3(ilid,i).lt.1).and.(var1(ilid,i).ne.(-888.)) .and. & (var1(ilid,i).ne.(-777.)) )then var2(iz,i)=var2(iz,i)+(var3(ilid,i)-var1(ilid,i)) ind(iz,i)=ind(iz,i)+1 endif elseif(nvar==3) then ! Other vertical average if (( var1(ilid,i).ne.(-9999.).and.(var1(ilid,i).ne.(-888.)) ) .and. & (var3(ilid,i).lt.1).and.(var3(ilid,i).ne.(-9999.)).and. & (var1(ilid,i).ne.(-777.)) ) then var2(iz,i)=var2(iz,i)+var1(ilid,i) ind(iz,i)=ind(iz,i)+1 endif elseif(nvar==4) then ! TEMP vertical average if (( var1(ilid,i).ne.(-9999.).and.(var1(ilid,i).ne.(-888.)) ) .and. & (var1(ilid,i).ne.(-777.)) ) then var2(iz,i)=var2(iz,i)+var1(ilid,i) ind(iz,i)=ind(iz,i)+1 endif endif end subroutine vertical_mean !----------------------------------------------------------------------------! subroutine vertical_mean_hori(var1,var2,var3,ind,i,iz,ilid,nprofs,alt,alt2,nvar,profavg,profmax) implicit none integer :: nvar, n integer :: i,iz,nprofs,alt,ilid,profavg,profmax integer(kind=2) :: alt2 real*4 :: var2m, indm real*4,dimension(alt2,nprofs) :: var1,var3 real*4,dimension(alt,nprofs) :: var2 real*4,dimension(alt,nprofs) :: ind if (nvar==1) then if (i.le.profavg)then var2m=0 indm=0 do n = 0,profmax ! Vertical average for atb if ( (var1(ilid,1+n).ne.(-9999)).and.(var1(ilid,1+n).lt.1) ) then var2m=var2m+var1(ilid,1+n) indm=indm+1 endif enddo if (var2m.gt.0) then var2(iz,i)=var2(iz,i)+(var2m/indm) ind(iz,i)=ind(iz,i)+1 endif elseif ( (i.gt.profavg).and.(i.le.(it-(profavg+1))) ) then var2m=0 indm=0 do n = 0,profmax ! Vertical average for atb if ( (var1(ilid,i-profavg+n).ne.(-9999)).and.(var1(ilid,i-profavg+n).lt.1) ) then var2m=var2m+var1(ilid,i-profavg+n) indm=indm+1 endif enddo if (var2m.gt.0) then var2(iz,i)=var2(iz,i)+(var2m/indm) ind(iz,i)=ind(iz,i)+1 endif else var2m=0 indm=0 do n = 0,profmax ! Vertical average for atb if ( (var1(ilid,it-profmax+n).ne.(-9999)).and.(var1(ilid,it-profmax+n).lt.1) ) then var2m=var2m+var1(ilid,it-profmax+n) indm=indm+1 endif enddo if (var2m.gt.0) then var2(iz,i)=var2(iz,i)+(var2m/indm) ind(iz,i)=ind(iz,i)+1 endif endif else ! Vertical average for perp if(nvar==2) then if ( (var1(ilid,i).ne.(-9999)).and.(var3(ilid,i).ne.(-9999)) .and. & (var3(ilid,i).lt.1) )then var2(iz,i)=var2(iz,i)+(var3(ilid,i)-var1(ilid,i)) ind(iz,i)=ind(iz,i)+1 endif else if (i.le.profavg)then var2m=0 indm=0 do n = 0,profmax ! Vertical average for atb if ( (var1(ilid,1+n).ne.(-9999)) ) then var2m=var2m+var1(ilid,1+n) indm=indm+1 endif enddo if (var2m.gt.0) then var2(iz,i)=var2(iz,i)+(var2m/indm) ind(iz,i)=ind(iz,i)+1 endif elseif ( (i.gt.profavg).and.(i.le.(it-(profavg+1))) ) then var2m=0 indm=0 do n = 0,profmax ! Vertical average for atb if ( (var1(ilid,i-profavg+n).ne.(-9999)) ) then var2m=var2m+var1(ilid,i-profavg+n) indm=indm+1 endif enddo if (var2m.gt.0) then var2(iz,i)=var2(iz,i)+(var2m/indm) ind(iz,i)=ind(iz,i)+1 endif else var2m=0 indm=0 do n = 0,profmax ! Vertical average for atb if ( (var1(ilid,it-profmax+n).ne.(-9999)) ) then var2m=var2m+var1(ilid,it-profmax+n) indm=indm+1 endif enddo if (var2m.gt.0) then var2(iz,i)=var2(iz,i)+(var2m/indm) ind(iz,i)=ind(iz,i)+1 endif endif endif endif end subroutine vertical_mean_hori !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SE_KM_2_PRES *** This subroutine convert the SE from km to hPa and ! ! allocate -888 to the variable below this threshold ! !----------------------------------------------------------------------------! ! nprofs : number of profil ! ! i : loop index on the profil ! ! alt : number of the altitude boxes ! ! var1 : Surface_elevation (nprofs) ! ! var3 : altitude of lidar lvl in kilometer, (583) ! ! var4 : Pressure interpolated from 33lvl to 583lvl in hPa (583,nprofs) ! ! var5 : pressure of model boxes ! !----------------------------------------------------------------------------! ! var2 : Surface_elevation in hPa (nprofs) ! ! var6 : add the surface_elevation to this variable ! !----------------------------------------------------------------------------! ! iz : loop index on the altitude grid ! ! j : loop index on Surface Elevation level ! ! ilid : loop index of the lidar altitude (583) ! ! alt2 : number of level of the lidar variables ! ! a,b : coefficient for the interpolation equation ! !----------------------------------------------------------------------------! ! ! ! ex : call SE_km_2_Pres(SE,SEp,altl,pres2,prestop,srmoy,altmax,it,i) ! !----------------------------------------------------------------------------! subroutine SE_km_2_Pres(var1,var2,var3,var4,var5,var6,alt,nprofs,i) implicit none integer :: ilid, iz, alt, nprofs,i,j integer,parameter :: altitude=583 real*4 :: a,b real*4,dimension(altitude,nprofs) :: var4 real*4,dimension(alt) :: var5 real,dimension(nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: var6 real*4,dimension(altitude) :: var3 ! var1 = SE, var2 = SEp, var3 = altl, var4 = pres2, var5 = prestop, var6 = srmoy do ilid=1,altitude ! print *, var1(1,i), var3(ilid) if( var1(i).eq.var3(ilid) )then var2(i)=var4(ilid,i) else if( var1(i).eq.var3(ilid+1) )then var2(i)=var4(ilid+1,i) else if((var1(i).lt.var3(ilid)).and.(var1(i).gt.var3(ilid+1)))then if( var4(ilid,i).ne.-9999 )then a=(var4(ilid,i)-var4(ilid+1,i))/(var3(ilid)-var3(ilid+1)) b=var4(ilid,i)-a*var3(ilid) var2(i)=a*var1(i)+b else var2(i)=-9999 endif endif endif endif enddo do iz=alt,2,-1 if ( (var2(i).gt.var5(iz)).and.(var2(i).lt.var5(iz-1)) )then do j=1,iz var6(j,i)=-888 enddo endif enddo end subroutine SE_km_2_Pres !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SE_KM_2_PRES *** This subroutine convert the SE from km to hPa and ! ! allocate -9999 to the variable below this threshold ! !----------------------------------------------------------------------------! ! nprofs : number of profil ! ! i : loop index on the profil ! ! alt : number of the altitude boxes ! ! var1 : Surface_elevation (nprofs) ! ! var3 : altitude of lidar lvl in kilometer, (583) ! ! var4 : Pressure interpolated from 33lvl to 583lvl in hPa (583,nprofs) ! ! var5 : pressure of model boxes ! !----------------------------------------------------------------------------! ! var2 : Surface_elevation in hPa (nprofs) ! ! var6 : add the surface_elevation to this variable ! !----------------------------------------------------------------------------! ! iz : loop index on the altitude grid ! ! j : loop index on Surface Elevation level ! ! ilid : loop index of the lidar altitude (583) ! ! alt2 : number of level of the lidar variables ! ! a,b : coefficient for the interpolation equation ! !----------------------------------------------------------------------------! ! ! ! ex : call SE_km_2_Pres(SE,SEp,altl,pres2,prestop,srmoy,altmax,it,i) ! !----------------------------------------------------------------------------! subroutine SE_km_2_Pres2(var1,var2,var3,var4,var5,var6,alt,nprofs,i) implicit none integer :: ilid, iz, alt, nprofs,i,j integer,parameter :: altitude=583 real*4 :: a,b real*4,dimension(altitude,nprofs) :: var4 real*4,dimension(alt) :: var5 real,dimension(nprofs) :: var1,var2 real*4,dimension(alt,nprofs) :: var6 real*4,dimension(altitude) :: var3 ! var1 = SE, var2 = SEp, var3 = altl, var4 = pres2, var5 = prestop, var6 = srmoy do ilid=1,altitude ! print *, var1(1,i), var3(ilid) if( var1(i).eq.var3(ilid) )then var2(i)=var4(ilid,i) else if( var1(i).eq.var3(ilid+1) )then var2(i)=var4(ilid+1,i) else if((var1(i).lt.var3(ilid)).and.(var1(i).gt.var3(ilid+1)))then if( var4(ilid,i).ne.-9999 )then a=(var4(ilid,i)-var4(ilid+1,i))/(var3(ilid)-var3(ilid+1)) b=var4(ilid,i)-a*var3(ilid) var2(i)=a*var1(i)+b else var2(i)=-9999 endif endif endif endif enddo do iz=alt,2,-1 if ( (var2(i).gt.var5(iz)).and.(var2(i).lt.var5(iz-1)) )then do j=1,iz var6(j,i)=-9999 enddo endif enddo end subroutine SE_km_2_Pres2 !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SURF_DETECT *** This subroutine detect the surface elevation and ! ! allocate -888 to the variable below this threshold ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1 : Surface Elevation ! ! var2 : altitude of model boxes ! !----------------------------------------------------------------------------! ! var3 : varically averaged variable ! !----------------------------------------------------------------------------! ! j : loop index on Surface Elevation level ! ! iz : loop index on the altitude grid ! !----------------------------------------------------------------------------! ! ! ! ex : call Surf_detect(SE,altmod,pr2moy,altmax,it,i) ! !----------------------------------------------------------------------------! subroutine Surf_detect(var1,var2,var3,alt,nprofs,i) implicit none integer :: iz, alt, nprofs, i,j real*4,dimension(alt+1) :: var2 real,dimension(nprofs) :: var1 real*4,dimension(alt,nprofs) :: var3 B1: do iz=1,alt-1 if ( (var1(i).gt.var2(iz)).and.(var1(i).le.var2(iz+1)) )then B2: do j=1,iz var3(j,i)=-888 enddo B2 exit B1 endif enddo B1 end subroutine Surf_detect !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SURF_DETECT2 *** This subroutine detect the surface elevation and ! ! allocate -9999 to the variable below this threshold ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1 : Surface Elevation ! ! var2 : altitude of model boxes ! !----------------------------------------------------------------------------! ! var3 : varically averaged variable ! !----------------------------------------------------------------------------! ! j : loop index on Surface Elevation level ! ! iz : loop index on the altitude grid ! !----------------------------------------------------------------------------! ! ! ! ex : call Surf_detect2(SE,altmod,pr2moy,altmax,it,i) ! !----------------------------------------------------------------------------! subroutine Surf_detect2(var1,var2,var3,alt,nprofs,i,mod) implicit none integer :: iz, alt, nprofs, i,j character :: mod*8 real*4,dimension(alt+1) :: var2 real,dimension(nprofs) :: var1 real*4,dimension(alt,nprofs) :: var3 if(mod=='altitude')then B11: do iz=1,alt-1 if ( (var1(i).gt.var2(iz)).and.(var1(i).le.var2(iz+1)) )then B22: do j=1,iz var3(j,i)=-888 enddo B22 exit B11 endif enddo B11 elseif(mod=='pressure')then B12: do iz=1,alt-1 if ( (var1(i).lt.var2(iz)).and.(var1(i).gt.var2(iz+1)) )then B21: do j=1,iz var3(j,i)=-888 enddo B21 exit B12 endif enddo B12 endif end subroutine Surf_detect2 !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SE_ALT_CHIM *** This subroutine detect the surface elevation and ! ! allocate -9999 to the variable below this threshold for! ! the CHIMERE grid ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1 : Surface Elevation ! ! var2 : altitude of model boxes ! !----------------------------------------------------------------------------! ! var3 : varically averaged variable ! !----------------------------------------------------------------------------! ! l : loop index on Surface Elevation level ! ! ilid : loop index on the lidar altitude (583) ! !----------------------------------------------------------------------------! ! ! ! ex : call SE_alt_atb(SE,altl,mol3,altitude,it,i) ! !----------------------------------------------------------------------------! subroutine SE_alt_atb(var1,var2,var3,alt,nprofs,i) implicit none integer :: ilid, i, nprofs,ilid2,k,iSEdown,iSEup integer(kind=2) :: alt real :: echothres real*4,dimension(alt) :: var2 real,dimension(nprofs) :: var1 real*4,dimension(alt,nprofs) :: var3 iSEdown=0 ! Control of SE value ! if SE=NaN ==> Forced SE to 0 if(var1(i).eq.-9999.)then var1(i)=0 endif ! Put values below the Surface Elevation threshold to -9999. ! Find the lidar level called "iSEdown" matching with the Surface elevation b2 :do ilid=2,alt if ( (var1(i).ge.var2(ilid)) )then iSEdown=ilid b1: do ilid2=583,ilid,-1 var3(ilid2,i)=-9999. enddo b1 exit b2 endif enddo b2 echothres=1. if(var1(i).gt.0.)then b4 :do ilid=2,iSEdown-33 if(var3(ilid,i).gt.0.15)then echothres=0.4 exit b4 endif enddo b4 endif iSEup=-9999 ! Find the highest lidar ATB value of the lidar ground echo called "iSEup" if(any(var3(iSEdown-30:iSEdown,i).ge.echothres))then b3: do ilid=iSEdown-30,iSEdown iSEup=ilid if(var3(ilid,i).eq.maxval(var3(iSEdown-30:iSEdown,i)))exit b3 enddo b3 endif if(iSEup.ne.-9999)then ! Put values from the ground to 3 levels above the iSEup level to -9999. do ilid=iSEup-3,iSEdown var3(ilid,i)=-9999. enddo endif end subroutine SE_alt_atb !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** SE_ALT_CHIM *** This subroutine detect the surface elevation and ! ! allocate -9999 to the variable below this threshold for! ! the CHIMERE grid ! !----------------------------------------------------------------------------! ! i : loop index on the profil ! ! nprofs : number of profil ! ! alt : number of the altitude boxes ! ! var1 : Surface Elevation ! ! var2 : altitude of model boxes ! !----------------------------------------------------------------------------! ! var3 : varically averaged variable ! !----------------------------------------------------------------------------! ! l : loop index on Surface Elevation level ! ! ilid : loop index on the lidar altitude (583) ! !----------------------------------------------------------------------------! ! ! ! ex : call SE_alt_atb(SE,altl,mol3,altitude,it,i) ! !----------------------------------------------------------------------------! subroutine SE_alt_mol(var1,var2,var3,alt,nprofs,i) implicit none integer :: ilid, i, nprofs,l integer(kind=2) :: alt real*4,dimension(alt) :: var2 real,dimension(nprofs) :: var1 real*4,dimension(alt,nprofs) :: var3 b2 :do ilid=2,alt if ( (var1(i).gt.var2(ilid)) )then b1: do l=583,(ilid+1),-1 var3(l,i)=-9999 enddo b1 exit b2 endif enddo b2 end subroutine SE_alt_mol !----------------------------------------------------------------------------! !****************************************************************************! !****************************************************************************! !*!!!!!!!!!!!!!!!!!!!!!!! NETCDF RECORDING SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!*! !****************************************************************************! !----------------------------------------------------------------------------! ! *** CHECK *** This subroutine check the status of the nf90 command ! !----------------------------------------------------------------------------! subroutine check(status) integer, intent ( in) :: status if(status /= nf90_noerr) then print *, trim(nf90_strerror(status)) stop "Stopped" end if end subroutine check !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** CREATE_PROFNC *** This routine create a netcdf prof file, and its ! ! dimensions ! !----------------------------------------------------------------------------! ! fname : name of output netcdf MAP3D file ! ! dname : period of MAP3D file (description of ncdf file) ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! alt : number of the altitude boxes ! ! vlon : values of model longitude from 180 to -180 ! ! vlat : values of model latitude from 90 to -90 ! ! vpres : values of model altitude from 0 to 19.2km or 40.5km ! ! vtime : number of days since 2000/01/01 for the trimonthly perdiod, ! ! in day. ! ! dim : dimension id of the MaP3D variables recorded in the ncdf ! ! files ! !----------------------------------------------------------------------------! ! date : date from the real-system clock and has form yyyymmdd. ! ! time : time from the real-system clock and has form hhmmss.sss. ! ! zone : represente the difference with respect to Coordinated ! ! Universal Time (UTC), and has form (+-)hhmm. ! ! value : 8 dimension value which contains the year,month,day,hour, ! ! minute, seconds and milliseconds of the real-time. ! ! ndims : dimension of dim (=4 : lon,lat,alt,time) ! ! nc_id : netcdf file id ! ! lon_varid : variable id of longitude ! ! lat_varid : variable id of latitude ! ! pres_varid : variable id of altitude ! ! time_varid : variable id of time ! ! lon_dimid : dimension id of longitude ! ! lat_dimid : dimension id of latitude ! ! pres_dimid : dimension id of altitude ! ! time_dimid : dimension id of time ! !----------------------------------------------------------------------------! ! ! ! ex create_profnc(file8,file9,lonmod,latmod,altmod,resd,dimidsp,altmax, ! ! lonmax,latmax) ! ! ! !----------------------------------------------------------------------------! subroutine create_profnc(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound,vtime,dim,alt,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer, parameter :: ndims = 4, nv=2 integer,dimension(8) :: value integer :: nlon , nlat ,dim(ndims), alt,dim2(nv) integer :: lon_varid,lat_varid,alt_varid, time_varid, nc_id,alt_varid2 integer :: lon_dimid,lat_dimid,alt_dimid,time_dimid, nv_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_Three-dimensionnal_Cloud_Fraction_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, time_dimid/) dim2 = (/alt_dimid, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim2, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_profnc !----------------------------------------------------------------------------! subroutine create_temp3d(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound, & vtime,dim,alt,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer, parameter :: ndims = 4, nv=2 integer,dimension(8) :: value integer :: nlon , nlat ,dim(ndims), alt,dim2(nv) integer :: lon_varid,lat_varid,alt_varid, time_varid, nc_id,alt_varid2 integer :: lon_dimid,lat_dimid,alt_dimid,time_dimid, nv_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_Three-dimensionnal_Cloud_Fraction_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'temp', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, time_dimid/) dim2 = (/alt_dimid, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'temp_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the temperature bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'temp_bound', NF90_FLOAT, dim2, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the temperature bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_temp3d !----------------------------------------------------------------------------! subroutine create_depolnc3d(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound,vtime,dim,dim2,alt,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer, parameter :: ndims = 4, nv=2, ncat1=5,ncat2=25 integer,dimension(8) :: value integer :: nlon , nlat ,dim(ndims), alt,dim3(nv),dim2(5),dim4(2) integer :: lon_varid,lat_varid,alt_varid, time_varid, nc_id,alt_varid2,cat_varid integer :: lon_dimid,lat_dimid,alt_dimid,time_dimid, nv_dimid,cat_dimid1,cat_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound character(len=25),dimension(ncat1,ncat2) :: vcat vcat(1,:)='UNDEFINED' vcat(2,:)='FALSE LIQ' vcat(3,:)='FALSE ICE' vcat(4,:)='Horizontally Oriented' vcat(5,:)='Unphysical value (NOISE)' call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_Three-dimensionnal_CloudFraction_Phase_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'cat1', ncat1, cat_dimid1)) call check(nf90_def_dim(nc_id, 'cat2', ncat2, cat_dimid2)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, time_dimid/) dim2 = (/lon_dimid, lat_dimid, alt_dimid, cat_dimid1, time_dimid/) dim3 = (/alt_dimid, nv_dimid/) dim4 = (/cat_dimid2, cat_dimid1/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim3, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'category', NF90_CHAR, dim4, cat_varid)) call check(nf90_put_att(nc_id, cat_varid, 'lon_name','Category')) call check(nf90_put_att(nc_id, cat_varid, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, cat_varid, vcat)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_depolnc3d !----------------------------------------------------------------------------! subroutine create_ind3d(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound,vtime,dim,dim2,alt,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer, parameter :: ndims = 4, nv=2, ncat1=5,ncat2=25 integer,dimension(8) :: value integer :: nlon , nlat ,dim(ndims), alt,dim3(nv),dim2(5),dim4(2) integer :: lon_varid,lat_varid,alt_varid, time_varid, nc_id,alt_varid2,cat_varid integer :: lon_dimid,lat_dimid,alt_dimid,time_dimid, nv_dimid,cat_dimid1,cat_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound character(len=25),dimension(ncat1,ncat2) :: vcat vcat(1,:)='UNDEFINED' vcat(2,:)='FALSE LIQ' vcat(3,:)='FALSE ICE' vcat(4,:)='Horizontally Oriented' vcat(5,:)='Unphysical value (NOISE)' call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_Three-dimensionnal_CloudFraction_Phase_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'cat1', ncat1, cat_dimid1)) call check(nf90_def_dim(nc_id, 'cat2', ncat2, cat_dimid2)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, time_dimid/) dim2 = (/lon_dimid, lat_dimid, alt_dimid, cat_dimid1, time_dimid/) dim3 = (/alt_dimid, nv_dimid/) dim4 = (/cat_dimid2, cat_dimid1/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim3, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'category', NF90_CHAR, dim4, cat_varid)) call check(nf90_put_att(nc_id, cat_varid, 'lon_name','Category')) call check(nf90_put_att(nc_id, cat_varid, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, cat_varid, vcat)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_ind3d !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** INSTANTSR2NC *** This routine create & record a netcdf instant_SR file,! ! and its dimensions ! !----------------------------------------------------------------------------! ! fname : name of output netcdf instant_SR file ! ! daynight : switch which allow to select day or night mode ! ! mod : name of the grid selected ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! alt : number of the altitude boxes ! ! longi : Longitude in degrees, has dimension (nprof) ! ! lati : Latitude in degrees, has dimension (nprof) ! ! vprestop : values of model altitude from 0 to 19.2km or 40.5km ! ! SEi : Surface_Elevation in kilometers, has dimension (nprof) ! ! timei : Time converted in UTC fractionned hour of a day ! ! SR : scattering ratio calculated, dim=(altmax,nprof) ! ! vtime : number of days since 2000/01/01 for the trimonthly perdiod, ! ! in day. ! !----------------------------------------------------------------------------! ! fname2 : period of instant_SR file (description of ncdf file) ! ! date : date from the real-system clock and has form yyyymmdd. ! ! time : time from the real-system clock and has form hhmmss.sss. ! ! zone : represente the difference with respect to Coordinated ! ! Universal Time (UTC), and has form (+-)hhmm. ! ! value : 8 dimension value which contains the year,month,day,hour, ! ! minute, seconds and milliseconds of the real-time. ! ! dim : dimension id of the SR ! ! ndims : dimension of dim (= 2 : alt,nprof) ! ! nc_id : netcdf file id ! ! varid3 : variable id of longitude ! ! varid2 : variable id of latitude ! ! alt_varid : variable id of altitude ! ! varid5 : variable id of time ! ! varid6 : variable id of SE ! ! varid1 : variable id of instant_SR ! ! alt_dimid : dimension id of altitude ! ! it_dimid : dimension id of nprof ! !----------------------------------------------------------------------------! ! ! ! ex : instantSR2nc(file4,altmod,resd,altmax,switch,gcm,it,lat,lon,SE,temps2,! ! srmoy) ! ! ! !----------------------------------------------------------------------------! subroutine instantSR2nc(fname,vprestop_mid,vprestop_bound,vtime,alt,daynight,mod,nprof,lati, & longi,SEi,timei,SR) use netcdf implicit none character(LEN=*) :: fname character :: fname2*14 character :: date*8,time*10,zone*5,daynight*5,mod*8 integer, parameter :: ndims = 2, nv=2 integer,dimension(8) :: value integer :: dim(ndims), alt, nprof,dim2(ndims) integer :: alt_varid, varid1, varid2, varid3, varid5, varid6, nc_id,alt_varid2 integer :: alt_dimid, it_dimid, nv_dimid, cat_varid real :: vtime real*8, dimension(nprof) :: timei real, dimension(nprof) :: SEi real, dimension(nprof) :: longi real, dimension(nprof) :: lati real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound real*4,dimension(alt,nprof) :: SR real,parameter :: nan=-9999. , rej=-777. , se=-888. fname2=fname(12:25) call date_and_time(date,time,zone,value) call check(nf90_create('/bdd/CFMIP/GOCCP/instant_SR/temp/'//fname, & NF90_CLOBBER, nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_instant_SR_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',fname2)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'it', nprof, it_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/alt_dimid, it_dimid/) dim2 = (/alt_dimid, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, it_dimid, varid3)) call check(nf90_put_att(nc_id, varid3, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, varid3, 'units','degrees_east')) call check(nf90_put_att(nc_id, varid3, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, it_dimid, varid2)) call check(nf90_put_att(nc_id, varid2, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, varid2, 'units','degrees_north')) call check(nf90_put_att(nc_id, varid2, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim2, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, it_dimid, varid5)) call check(nf90_put_att(nc_id, varid5, 'lon_name','Time')) call check(nf90_put_att(nc_id, varid5, 'units','Fractionned UTC hour')) call check(nf90_put_att(nc_id, varid5, 'axis','T')) call check(nf90_def_var(nc_id, 'SE', NF90_FLOAT, it_dimid, varid6)) call check(nf90_put_att(nc_id, varid6, 'lon_name','Surface_Elevation')) call check(nf90_put_att(nc_id, varid6, 'units','kilometer')) call check(nf90_def_var(nc_id, 'instant_SR', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(nc_id, varid1, 'lon_name', & 'instantaneous Scattering Ratio')) call check(nf90_put_att(nc_id, varid1, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid1, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid1, 'rejected_value',rej)) call check(nf90_put_att(nc_id, varid1, 'Surface_value',se)) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, varid2, lati)) call check(nf90_put_var(nc_id, varid3, longi)) call check(nf90_put_var(nc_id, varid5, timei)) call check(nf90_put_var(nc_id, varid6, SEi)) call check(nf90_put_var(nc_id, varid1, SR)) call check(nf90_close(nc_id)) end subroutine instantSR2nc !----------------------------------------------------------------------------! subroutine SR_CR_DR_2nc(fname,vprestop_mid,vprestop_bound,vtime,alt,daynight,mod,nprof,lati, & longi,SEi,timei,SR,CR,DEPOL) use netcdf implicit none character(LEN=*) :: fname character :: fname2*14 character :: date*8,time*10,zone*5,daynight*5,mod*4 integer, parameter :: ndims = 2, nv = 2 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer,dimension(8) :: value integer :: dim(ndims), alt, nprof, dim2(ndims) integer :: alt_varid, alt_varid2, varid1, varid2, varid3, varid5, varid6,varid7,varid8, nc_id integer :: alt_dimid, it_dimid, nv_dimid real :: vtime real*8, dimension(nprof) :: timei real, dimension(nprof) :: SEi real, dimension(nprof) :: longi real, dimension(nprof) :: lati real*4,dimension(alt,nprof) :: SR,CR,DEPOL real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound fname2=fname(18:39) call date_and_time(date,time,zone,value) call check(nf90_create('/bdd/CFMIP/GOCCP/instant_SR_CR_DR/temp/'//fname, & NF90_CLOBBER, nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_instant_SR_DR_CR_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',trim(fname2))) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'it', nprof, it_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/alt_dimid, it_dimid/) dim2 = (/alt_dimid, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, it_dimid, varid3)) call check(nf90_put_att(nc_id, varid3, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, varid3, 'units','degrees_east')) call check(nf90_put_att(nc_id, varid3, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, it_dimid, varid2)) call check(nf90_put_att(nc_id, varid2, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, varid2, 'units','degrees_north')) call check(nf90_put_att(nc_id, varid2, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim2, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, it_dimid, varid5)) call check(nf90_put_att(nc_id, varid5, 'lon_name','Time')) call check(nf90_put_att(nc_id, varid5, 'units','Fractionned UTC hour')) call check(nf90_put_att(nc_id, varid5, 'axis','T')) call check(nf90_def_var(nc_id, 'SE', NF90_FLOAT, it_dimid, varid6)) call check(nf90_put_att(nc_id, varid6, 'lon_name','Surface_Elevation')) call check(nf90_put_att(nc_id, varid6, 'units','kilometer')) call check(nf90_def_var(nc_id, 'instant_SR', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(nc_id, varid1, 'lon_name', & 'instantaneous Scattering Ratio')) call check(nf90_put_att(nc_id, varid1, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid1, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid1, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid1, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'instant_CR', NF90_FLOAT, dim, varid7)) call check(nf90_put_att(nc_id, varid7, 'lon_name', & 'instantaneous Color Ratio')) call check(nf90_put_att(nc_id, varid7, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid7, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid7, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid7, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'instant_DR', NF90_FLOAT, dim, varid8)) call check(nf90_put_att(nc_id, varid8, 'lon_name', & 'instantaneous Depolarization Ratio')) call check(nf90_put_att(nc_id, varid8, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid8, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid8, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid8, 'Surface_value',se)) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, varid2, lati)) call check(nf90_put_var(nc_id, varid3, longi)) call check(nf90_put_var(nc_id, varid5, timei)) call check(nf90_put_var(nc_id, varid6, SEi)) call check(nf90_put_var(nc_id, varid1, SR)) call check(nf90_put_var(nc_id, varid7, CR)) call check(nf90_put_var(nc_id, varid8, DEPOL)) call check(nf90_close(nc_id)) end subroutine SR_CR_DR_2nc !----------------------------------------------------------------------------! ! Same routine as SR_CR_DR_2nc including the record of ATB & ATBmol variables subroutine SR_CR_DR_ATB_nc(fname,vprestop_mid,vprestop_bound,vtime,alt, & daynight,mod,nprof,lati,longi,SEi,timei,SR,CR, & DEPOL,atb,atbm,atbr,atbl,temp,cloudfrac) use netcdf implicit none character(LEN=*) :: fname character :: fname2*21 character :: date*8,time*10,zone*5,daynight*5,mod*4 integer, parameter :: ndims = 2, nv = 2 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer,dimension(8) :: value integer :: dim(ndims), alt, nprof, dim2(ndims) integer :: alt_varid, alt_varid2, varid1, varid2, varid3, varid5, varid6,varid7,varid8,varid9,varid10, nc_id,varid11,varid12,varid13, varid14 integer :: alt_dimid, it_dimid, nv_dimid real :: vtime real*8, dimension(nprof) :: timei real, dimension(nprof) :: SEi real, dimension(nprof) :: longi real, dimension(nprof) :: lati real,dimension(alt,nprof) :: SR,CR,DEPOL,atb,atbm,atbl,atbr,temp,cloudfrac real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound fname2=fname(18:39) call date_and_time(date,time,zone,value) call check(nf90_create('/bdd/CFMIP/GOCCP/instant_SR_CR_DR/temp/'//fname, & NF90_CLOBBER, nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_instant_SR_DR_CR_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',trim(fname2))) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'it', nprof, it_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) dim = (/alt_dimid, it_dimid/) dim2 = (/alt_dimid, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, it_dimid, varid3)) call check(nf90_put_att(nc_id, varid3, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, varid3, 'units','degrees_east')) call check(nf90_put_att(nc_id, varid3, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, it_dimid, varid2)) call check(nf90_put_att(nc_id, varid2, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, varid2, 'units','degrees_north')) call check(nf90_put_att(nc_id, varid2, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim2, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, it_dimid, varid5)) call check(nf90_put_att(nc_id, varid5, 'lon_name','Time')) call check(nf90_put_att(nc_id, varid5, 'units','Fractionned UTC hour')) call check(nf90_put_att(nc_id, varid5, 'axis','T')) call check(nf90_def_var(nc_id, 'SE', NF90_FLOAT, it_dimid, varid6)) call check(nf90_put_att(nc_id, varid6, 'lon_name','Surface_Elevation')) call check(nf90_put_att(nc_id, varid6, 'units','kilometer')) call check(nf90_def_var(nc_id, 'instant_SR', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(nc_id, varid1, 'lon_name', & 'instantaneous Scattering Ratio')) call check(nf90_put_att(nc_id, varid1, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid1, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid1, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid1, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'instant_Cloud', NF90_FLOAT, dim, varid14)) call check(nf90_put_att(nc_id, varid14, 'lon_name', & 'instantaneous Cloud Mask')) call check(nf90_put_att(nc_id, varid14, 'Legend','1=NaN, 2=Clear, 3=Cloud, 4=Uncertain, 6=Surface, 7=Rejected, 8=Fully Attenuated' )) call check(nf90_put_att(nc_id, varid14, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'instant_CR', NF90_FLOAT, dim, varid7)) call check(nf90_put_att(nc_id, varid7, 'lon_name', & 'instantaneous Color Ratio')) call check(nf90_put_att(nc_id, varid7, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid7, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid7, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid7, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'instant_DR', NF90_FLOAT, dim, varid8)) call check(nf90_put_att(nc_id, varid8, 'lon_name', & 'instantaneous Depolarization Ratio')) call check(nf90_put_att(nc_id, varid8, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid8, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid8, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid8, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'ATB', NF90_FLOAT, dim, varid9)) call check(nf90_put_att(nc_id, varid9, 'lon_name', & 'Attenuated Total Backscatter')) call check(nf90_put_att(nc_id, varid9, 'units','km-1 sr-1')) call check(nf90_put_att(nc_id, varid9, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid9, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid9, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'ATB_mol', NF90_FLOAT, dim, varid10)) call check(nf90_put_att(nc_id, varid10, 'lon_name', & 'ATB of Molecular')) call check(nf90_put_att(nc_id, varid10, 'units','km-1 sr-1')) call check(nf90_put_att(nc_id, varid10, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid10, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid10, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'ATB_per', NF90_FLOAT, dim, varid11)) call check(nf90_put_att(nc_id, varid11, 'lon_name', & 'Attenuated Perpendicular Backscatter')) call check(nf90_put_att(nc_id, varid11, 'units','km-1 sr-1')) call check(nf90_put_att(nc_id, varid11, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid11, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid11, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'ATB_par', NF90_FLOAT, dim, varid12)) call check(nf90_put_att(nc_id, varid12, 'lon_name', & 'Attenuated Parallel Backscatter')) call check(nf90_put_att(nc_id, varid12, 'units','km-1 sr-1')) call check(nf90_put_att(nc_id, varid12, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid12, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid12, 'Surface_value',se)) call check(nf90_def_var(nc_id, 'TEMP', NF90_FLOAT, dim, varid13)) call check(nf90_put_att(nc_id, varid13, 'lon_name', & 'Temperature')) call check(nf90_put_att(nc_id, varid13, 'units','Celcius degree')) call check(nf90_put_att(nc_id, varid13, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid13, 'Rejected_value',rej)) call check(nf90_put_att(nc_id, varid13, 'Surface_value',se)) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, varid2, lati)) call check(nf90_put_var(nc_id, varid3, longi)) call check(nf90_put_var(nc_id, varid5, timei)) call check(nf90_put_var(nc_id, varid6, SEi)) call check(nf90_put_var(nc_id, varid1, SR)) call check(nf90_put_var(nc_id, varid14, cloudfrac)) call check(nf90_put_var(nc_id, varid7, CR)) call check(nf90_put_var(nc_id, varid8, DEPOL)) call check(nf90_put_var(nc_id, varid9, atb)) call check(nf90_put_var(nc_id, varid10, atbm)) call check(nf90_put_var(nc_id, varid11, atbr)) call check(nf90_put_var(nc_id, varid12, atbl)) call check(nf90_put_var(nc_id, varid13, temp)) call check(nf90_close(nc_id)) end subroutine SR_CR_DR_ATB_nc !----------------------------------------------------------------------------! subroutine instant_phase(fname,nalt,nprof,phase) implicit none character(len=*) :: fname integer,dimension(2) :: dimm integer :: ncid,varid, alt_dimid,it_dimid,ndims integer :: nalt,nprof real*4 :: phase(nalt,nprof) !print *, 'instant phase routine' !print *, trim(fname) !print *, '/bdd/CFMIP/GOCCP/instant_SR_CR_DR/temp/'//trim(fname) call check(NF90_OPEN('/bdd/CFMIP/GOCCP/instant_SR_CR_DR/temp/'//trim(fname),NF90_WRITE,ncid)) call check(NF90_REDEF(ncid)) call check(nf90_inq_dimid(ncid, 'altitude', alt_dimid)) call check(nf90_inq_dimid(ncid, 'it', it_dimid)) dimm = (/alt_dimid, it_dimid/) call check(nf90_def_var(ncid, 'instant_Phase', NF90_FLOAT, dimm, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'instantaneous Cloud Phase Mask')) call check(nf90_put_att(ncid, varid, 'Legend','1=LIQ, 2=ICE, 3=UNDEFINED, 4=FALSE LIQ, 5=FALSE ICE, 6=Horizontally Oriented, 7=Unphysical value (NOISE)' )) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_put_att(ncid, varid, 'Surface_value','-888')) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, phase)) call check(nf90_close(ncid)) endsubroutine instant_phase subroutine SR_DEPOL_2nc(fname,vprestop,vtime,alt,daynight,mod,nprof,lati, & longi,SEi,timei,SR,DEPOL) !!$ call SR_DEPOL_2nc(file4,altmod,resd,altmax,switch,gcm,it,lat,lon,SE,temps2,& !!$ srmoy,depolmoy) use netcdf implicit none character(LEN=*) :: fname character :: fname2*13 character :: date*8,time*10,zone*5,daynight*5,mod*8 integer, parameter :: ndims = 2 integer,dimension(8) :: value integer :: dim(ndims), alt, nprof integer :: alt_varid, varid1, varid2, varid3, varid5, varid6,varid7,varid8, nc_id integer :: alt_dimid, it_dimid real :: vtime real*8, dimension(nprof) :: timei real, dimension(nprof) :: SEi real, dimension(nprof) :: longi real, dimension(nprof) :: lati real,dimension(alt) :: vprestop real*4,dimension(alt,nprof) :: SR,DEPOL fname2=fname(12:26) call date_and_time(date,time,zone,value) call check(nf90_create('/bdd/CFMIP_TEMP/DEPOL/'//fname, & NF90_CLOBBER, nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description', & 'GOCCP_instant_SR_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',fname2)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'it', nprof, it_dimid)) dim = (/alt_dimid, it_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, it_dimid, varid3)) call check(nf90_put_att(nc_id, varid3, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, varid3, 'units','degrees_east')) call check(nf90_put_att(nc_id, varid3, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, it_dimid, varid2)) call check(nf90_put_att(nc_id, varid2, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, varid2, 'units','degrees_north')) call check(nf90_put_att(nc_id, varid2, 'axis','Y')) call check(nf90_def_var(nc_id, 'altitude', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Altitude')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, it_dimid, varid5)) call check(nf90_put_att(nc_id, varid5, 'lon_name','Time')) call check(nf90_put_att(nc_id, varid5, 'units','Fractionned UTC hour')) call check(nf90_put_att(nc_id, varid5, 'axis','T')) call check(nf90_def_var(nc_id, 'SE', NF90_FLOAT, it_dimid, varid6)) call check(nf90_put_att(nc_id, varid6, 'lon_name','Surface_Elevation')) call check(nf90_put_att(nc_id, varid6, 'units','kilometer')) call check(nf90_def_var(nc_id, 'instant_SR', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(nc_id, varid1, 'lon_name', & 'instantaneous Scattering Ratio')) call check(nf90_put_att(nc_id, varid1, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid1, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid1, 'Surface_value','-888')) call check(nf90_def_var(nc_id, 'instant_DEPOL', NF90_FLOAT, dim, varid8)) call check(nf90_put_att(nc_id, varid8, 'lon_name', & 'instantaneous Depolarization')) call check(nf90_put_att(nc_id, varid8, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, varid8, '_FillValue',nan)) call check(nf90_put_att(nc_id, varid8, 'Surface_value','-888')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, alt_varid, vprestop)) call check(nf90_put_var(nc_id, varid2, lati)) call check(nf90_put_var(nc_id, varid3, longi)) call check(nf90_put_var(nc_id, varid5, timei)) call check(nf90_put_var(nc_id, varid6, SEi)) call check(nf90_put_var(nc_id, varid1, SR)) call check(nf90_put_var(nc_id, varid8, DEPOL)) call check(nf90_close(nc_id)) end subroutine SR_DEPOL_2nc !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** PROF_RECVAR2NC *** This routine record the prof variables in the netcdf! ! prof file ! !----------------------------------------------------------------------------! ! fname : name of output netcdf MAP3D file ! ! dim : dimension id of the SR ! ! cloud : fraction of cloudy point ! ! clear : fraction of clear point ! ! sat : fraction of fully attenuated point ! ! uncer : fraction of unclassify point ! ! nan : fraction of nan point ! ! se : fraction of se point ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! alt : number of the altitude boxes ! !----------------------------------------------------------------------------! ! nanb : Not a Number value ! ! ndims : dimension of dim (= 4 : lon,lat,alt,time) ! ! ncid : netcdf file id ! ! varid3 : variable id of cloud fraction ! ! varid4 : variable id of clear fraction ! ! varid5 : variable id of fully attenuated fraction ! ! varid6 : variable id of unclassify fraction ! ! varid7 : variable id of nan fraction ! ! varid8 : variable id of se fraction ! !----------------------------------------------------------------------------! ! ! ! ex : prof_recvar2nc(monthcloudfract,monthclearfract,monthsatfract, ! ! monthuncertfract,monthnanfract,monthsefract,dimidsp, ! ! file8,altmax,lonmax,latmax) ! ! ! !----------------------------------------------------------------------------! subroutine prof_recvar2nc(cloud,clear,uncer,dim,fname,alt,nlon,nlat)!nan,se,sat use netcdf implicit none integer, parameter :: ndims=4 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer :: nlon , nlat,dim(ndims),alt integer :: varid3,varid4,varid5,varid6,varid7,varid8, ncid character(LEN=*) :: fname real*4,dimension(nlon,nlat,alt) :: cloud,clear,uncer!,sat,nan,se call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'clcalipso', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO 3D Cloud fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clrcalipso', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO 3D Clear fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) ! call check(nf90_def_var(ncid, 'monthsatfract', NF90_FLOAT, dim, varid5)) ! call check(nf90_put_att(ncid, varid5, 'lon_name', & ! 'Full Attenuated fraction monthly mean')) ! call check(nf90_put_att(ncid, varid5, 'units','1 fraction')) ! call check(nf90_put_att(ncid, varid5, '_FillValue',nanb)) call check(nf90_def_var(ncid, 'uncalipso', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO 3D Undefined fraction')) call check(nf90_put_att(ncid, varid6, 'units','1 fraction')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) ! call check(nf90_def_var(ncid, 'monthnanfract', NF90_FLOAT, dim, varid7)) ! call check(nf90_put_att(ncid, varid7, 'lon_name', & ! 'Missing value fraction monthly mean')) ! call check(nf90_put_att(ncid, varid7, 'units','1 fraction')) ! call check(nf90_put_att(ncid, varid7, '_FillValue',nanb)) ! call check(nf90_def_var(ncid, 'monthsefract', NF90_FLOAT, dim, varid8)) ! call check(nf90_put_att(ncid, varid8, 'lon_name', & ! 'Surface Elevation fraction monthly mean')) ! call check(nf90_put_att(ncid, varid8, 'units','1 fraction')) ! call check(nf90_put_att(ncid, varid8, '_FillValue',nanb)) !!$ call check(nf90_def_var(ncid, 'monthindphase', NF90_FLOAT, dim, varid9)) !!$ call check(nf90_put_att(ncid, varid9, 'lon_name','indice of water Phase monthly mean')) !!$ call check(nf90_put_att(ncid, varid9, 'units','1 fraction')) !!$ call check(nf90_put_att(ncid, varid9, '_FillValue',nanb)) !!$ !!$ call check(nf90_def_var(ncid, 'monthatbmoy', NF90_FLOAT, dim, varid1)) !!$ call check(nf90_put_att(ncid, varid1, 'lon_name','Total Attenuated Backscatter 532 monthly mean')) !!$ call check(nf90_put_att(ncid, varid1, 'units','per kilometer per steradian')) !!$ call check(nf90_put_att(ncid, varid1, '_FillValue',nanb)) !!$ !!$ call check(nf90_def_var(ncid, 'monthatbmolmoy', NF90_FLOAT, dim, varid2)) !!$ call check(nf90_put_att(ncid, varid2, 'lon_name','Molecular Total Attenuated Backscatter monthly mean')) !!$ call check(nf90_put_att(ncid, varid2, 'units','per kilometer per steradian')) !!$ call check(nf90_put_att(ncid, varid2, '_FillValue',nanb)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid3, cloud)) call check(nf90_put_var(ncid, varid4, clear)) ! call check(nf90_put_var(ncid, varid5, sat)) call check(nf90_put_var(ncid, varid6, uncer)) ! call check(nf90_put_var(ncid, varid7, nan)) ! call check(nf90_put_var(ncid, varid8, se)) !!$ call check(nf90_put_var(ncid, varid1, pr2moy)) !!$ call check(nf90_put_var(ncid, varid2, molmoy)) !!$ call check(nf90_put_var(ncid, varid9, phase)) call check(nf90_close(ncid)) endsubroutine prof_recvar2nc !----------------------------------------------------------------------------! subroutine temp_recvar2nc(cloud,liq,ice,phase,dim,fname,alt,nlon,nlat)!nan,se,sat use netcdf implicit none integer, parameter :: ndims=4 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer :: nlon , nlat,dim(ndims),alt integer :: varid3,varid4,varid5,varid6,varid7,varid8, ncid character(LEN=*) :: fname real*4,dimension(nlon,nlat,alt) :: cloud,ice,liq,phase !,sat,nan,se call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cltemp', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO 3D Cloud fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltemp_liq', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO 3D Liquid fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltemp_ice', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO 3D Ice fraction')) call check(nf90_put_att(ncid, varid6, 'units','1 fraction')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltemp_phase', NF90_FLOAT, dim, varid7)) call check(nf90_put_att(ncid, varid7, 'lon_name', & 'CALIPSO 3D Ratio fraction')) call check(nf90_put_att(ncid, varid7, 'units','1 fraction')) call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid3, cloud)) call check(nf90_put_var(ncid, varid4, liq)) call check(nf90_put_var(ncid, varid6, ice)) call check(nf90_put_var(ncid, varid7, phase)) call check(nf90_close(ncid)) endsubroutine temp_recvar2nc !----------------------------------------------------------------------------! subroutine depol_recvar2nc(ice,water,dim,fname,alt,nlon,nlat)!nan,se,sat use netcdf implicit none integer, parameter :: ndims=4 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer :: nlon , nlat,dim(ndims),alt integer :: varid3,varid4,varid5,varid6,varid7,varid8, ncid character(LEN=*) :: fname real*4,dimension(nlon,nlat,alt) :: ice,water!,ind !,sat,nan,se call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'ice_cloud', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO 3D Ice Cloud Phase fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'water_cloud', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO 3D Water Cloud Phase fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) !!$ call check(nf90_def_var(ncid, 'ind_phase', NF90_FLOAT, dim, varid5)) !!$ call check(nf90_put_att(ncid, varid5, 'lon_name', & !!$ 'CALIPSO 3D Indice Phase fraction')) !!$ call check(nf90_put_att(ncid, varid5, 'units','1 fraction')) !!$ call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid3, ice)) call check(nf90_put_var(ncid, varid4, water)) ! call check(nf90_put_var(ncid, varid5, ind)) call check(nf90_close(ncid)) endsubroutine depol_recvar2nc !----------------------------------------------------------------------------! subroutine depol_recvar2ncocc(ice,water,un,phase,ind,dim,dim2,fname,alt,nlon,nlat)!nan,se,sat use netcdf implicit none integer, parameter :: ndims=4, ncat=5 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer :: nlon , nlat,dim(ndims),alt,dim2(ncat) integer :: varid3,varid4,varid5,varid6,varid7,varid8, varid9, ncid character(LEN=*) :: fname real*4,dimension(nlon,nlat,alt) :: ice,water,phase,ind real*4,dimension(nlon,nlat,alt,ncat) :: un call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'clcalipso_ice', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO 3D Ice Cloud Phase fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clcalipso_liq', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO 3D Liquid Cloud Phase fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clcalipso_un', NF90_FLOAT, dim2, varid5)) call check(nf90_put_att(ncid, varid5, 'lon_name', & 'CALIPSO 3D UNCLASS Cloud Phase fraction')) call check(nf90_put_att(ncid, varid5, 'units','1 fraction')) call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clcalipso_RPIC', NF90_FLOAT, dim, varid9)) call check(nf90_put_att(ncid, varid9, 'lon_name', & 'CALIPSO 3D Relative Percentage of Ice in Cloud')) call check(nf90_put_att(ncid, varid9, 'units','1 fraction')) call check(nf90_put_att(ncid, varid9, '_FillValue',nan)) call check(nf90_put_att(ncid, varid9, 'Other_Phase',rej)) !!$ call check(nf90_def_var(ncid, 'ind', NF90_FLOAT, dim, varid8)) !!$ call check(nf90_put_att(ncid, varid8, 'lon_name', & !!$ 'CALIPSO 3D Indice Phase fraction')) !!$ call check(nf90_put_att(ncid, varid8, 'units','1 fraction')) !!$ call check(nf90_put_att(ncid, varid8, '_FillValue',nan)) !!$ call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid3, ice)) call check(nf90_put_var(ncid, varid4, water)) call check(nf90_put_var(ncid, varid5, un)) call check(nf90_put_var(ncid, varid9, phase)) !!$ call check(nf90_put_var(ncid, varid8, ind)) call check(nf90_close(ncid)) endsubroutine depol_recvar2ncocc !----------------------------------------------------------------------------! ! call record_ind3d(sum(cloudfractday,4),sum(indday,4),sum(icecloudfractday,4), & ! sum(watercloudfractday,4),sum(uncloudfractday,4), & ! dimidsp,dimidsp2,file8,altmax,lonmax-1,latmax-1) subroutine record_ind3d(cloud,tot,ice,water,un,dim,dim2,fname,alt,nlon,nlat)!nan,se,sat use netcdf implicit none integer, parameter :: ndims=4, ncat=5 real,parameter :: nan=-9999. , rej=-777. , se=-888. integer :: nlon , nlat,dim(ndims),alt,dim2(ncat) integer :: varid2,varid1,varid3,varid4,varid5,varid6,varid7,varid8, varid9, ncid character(LEN=*) :: fname real*4,dimension(nlon,nlat,alt) :: tot,cloud,ice,water,phase real*4,dimension(nlon,nlat,alt,ncat) :: un call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'clcalipso', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO 3D Cloud')) call check(nf90_put_att(ncid, varid2, 'units','1')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'sample', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO 3D Sample')) call check(nf90_put_att(ncid, varid1, 'units','1')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clcalipso_ice', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO 3D Ice Cloud Phase occurrences')) call check(nf90_put_att(ncid, varid3, 'units','1')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clcalipso_liq', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO 3D Liquid Cloud Phase occurrences')) call check(nf90_put_att(ncid, varid4, 'units','1 occurrences')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clcalipso_un', NF90_FLOAT, dim2, varid5)) call check(nf90_put_att(ncid, varid5, 'lon_name', & 'CALIPSO 3D UNCLASS Cloud Phase occurrences')) call check(nf90_put_att(ncid, varid5, 'units','1')) call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) !!$ call check(nf90_def_var(ncid, 'ind', NF90_FLOAT, dim, varid8)) !!$ call check(nf90_put_att(ncid, varid8, 'lon_name', & !!$ 'CALIPSO 3D Indice Phase occurrences')) !!$ call check(nf90_put_att(ncid, varid8, 'units','1 fraction')) !!$ call check(nf90_put_att(ncid, varid8, '_FillValue',nan)) !!$ call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid2, cloud)) call check(nf90_put_var(ncid, varid1, tot)) call check(nf90_put_var(ncid, varid3, ice)) call check(nf90_put_var(ncid, varid4, water)) call check(nf90_put_var(ncid, varid5, un)) call check(nf90_close(ncid)) endsubroutine record_ind3d !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** CREATE_MAPNC *** This routine create a netcdf map file, and its ! ! dimensions ! !----------------------------------------------------------------------------! ! fname : name of output netcdf MapLowMidHigh file ! ! dname : period of MapLowMidHigh file (description of ncdf file) ! ! grid : name of the grid selected (cfmip/lmdz/nasa) ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! vlon : values of model longitude from 180 to -180 ! ! vlat : values of model latitude from 90 to -90 ! ! vtime : number of days since 2000/01/01 for the trimonthly perdiod, ! ! in day. ! ! dim : dimension id of the MaPLowMidHigh var recorded in the ncdf ! !----------------------------------------------------------------------------! ! toplvl : values of isccp top levels ! ! files ! ! ndims : dimension of dim (=3 : lon,lat,time) ! ! nc_id : netcdf file id ! ! lon_varid : variable id of longitude ! ! lat_varid : variable id of latitude ! ! pres_varid : variable id of toplvl ! ! time_varid : variable id of time ! ! lon_dimid : dimension id of longitude ! ! lat_dimid : dimension id of latitude ! ! pres_dimid : dimension id of toplvl ! ! time_dimid : dimension id of time ! ! date : date from the real-system clock and has form yyyymmdd. ! ! time : time from the real-system clock and has form hhmmss.sss. ! ! zone : represente the difference with respect to Coordinated ! ! Universal Time (UTC), and has form (+-)hhmm. ! ! value : 8 dimension value which contains the year,month,day,hour, ! ! minute, seconds and milliseconds of the real-time. ! !----------------------------------------------------------------------------! ! ! ! ex : create_mapnc(file8,file9,lonmod,latmod,resd,dimidsm,gcm,lonmax,latmax)! ! ! !----------------------------------------------------------------------------! subroutine create_mapnc(fname,dname,vlon,vlat,vtime,dim,grid,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5,grid*8 integer, parameter :: ndims = 3 integer,dimension(8) :: value integer :: nlon , nlat,dim(ndims) integer :: lon_varid,lat_varid,pres_varid, time_varid,nc_id integer :: lon_dimid,lat_dimid,pres_dimid,time_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(3) :: toplvl if(trim(grid).eq.'CFMIP')then toplvl(1)=3.36 toplvl(2)=6.72 toplvl(3)=19.2 elseif(trim(grid).eq.'NASA')then toplvl(1)=3.36 toplvl(2)=6.72 toplvl(3)=19.2 elseif(trim(grid).eq.'LMDZ40')then toplowl = 14; topmidl = 18; tophighl = 40 elseif(trim(grid).eq.'LMDZ')then toplowl = 7; topmidl = 9 tophighl = 19 ! endif call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Map_Low_Mid_High_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'toplvl', 3, pres_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, time_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'toplvl', NF90_FLOAT,pres_dimid,pres_varid)) call check(nf90_put_att(nc_id, pres_varid,'lon_name','Top Altitude Level')) call check(nf90_put_att(nc_id, pres_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, pres_varid, 'positive','up')) call check(nf90_put_att(nc_id, pres_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, pres_varid, toplvl)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_mapnc !----------------------------------------------------------------------------! subroutine create_mapnc_phase(fname,dname,vlon,vlat,vtime,dim,dim2,grid,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5,grid*8 integer, parameter :: ndims = 3, ndims2 = 4, ncat1=5, ncat2=25 integer,dimension(8) :: value integer :: nlon , nlat,dim(ndims), dim2(ndims2),dim3(2) integer :: lon_varid,lat_varid,pres_varid, time_varid,nc_id,cat_varid integer :: lon_dimid,lat_dimid,pres_dimid,time_dimid, cat_dimid1,cat_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(3) :: toplvl character(len=25),dimension(ncat1,ncat2) :: vcat ! character(len=10),dimension(ncat) :: vcat vcat(1,:)='UNDEFINED' vcat(2,:)='FALSE LIQ' vcat(3,:)='FALSE ICE' vcat(4,:)='Horizontally Oriented' vcat(5,:)='Unphysical Value (NOISE)' if(trim(grid).eq.'CFMIP')then toplvl(1)=3.36 toplvl(2)=6.72 toplvl(3)=19.2 elseif(trim(grid).eq.'NASA')then toplvl(1)=3.36 toplvl(2)=6.72 toplvl(3)=19.2 elseif(trim(grid).eq.'LMDZ40')then toplowl = 14; topmidl = 18; tophighl = 40 elseif(trim(grid).eq.'LMDZ')then toplowl = 7; topmidl = 9 tophighl = 19 ! endif call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Map_Low_Mid_High_Phase_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'cat1', ncat1, cat_dimid1)) call check(nf90_def_dim(nc_id, 'cat2', ncat2, cat_dimid2)) call check(nf90_def_dim(nc_id, 'toplvl', 3, pres_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, time_dimid/) dim2 = (/lon_dimid, lat_dimid, cat_dimid1, time_dimid/) dim3=(/cat_dimid2,cat_dimid1 /) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'category', NF90_CHAR, dim3, cat_varid)) call check(nf90_put_att(nc_id, cat_varid, 'lon_name','Category')) call check(nf90_put_att(nc_id, cat_varid, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'toplvl', NF90_FLOAT,pres_dimid,pres_varid)) call check(nf90_put_att(nc_id, pres_varid,'lon_name','Top Altitude Level')) call check(nf90_put_att(nc_id, pres_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, pres_varid, 'positive','up')) call check(nf90_put_att(nc_id, pres_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, cat_varid, vcat)) call check(nf90_put_var(nc_id, pres_varid, toplvl)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_mapnc_phase !----------------------------------------------------------------------------! subroutine create_mapnc2(fname,dname,vlon,vlat,vtime,dim,dim2,dim3,dim4,grid,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5,grid*5 integer, parameter :: ndims = 3, ndims2=4, histmax=10, histmax2=40,histmax3=28 integer,dimension(8) :: value integer :: nlon , nlat,dim(ndims), dim2(ndims2),dim3(ndims2),dim4(ndims2) integer :: lon_varid,lat_varid,pres_varid, time_varid,nc_id integer :: lon_dimid,lat_dimid,pres_dimid,time_dimid,hist_dimid,hist2_dimid,hist3_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real,dimension(3) :: toplvl if(trim(grid).eq.'CFMIP')then toplvl(1)=3.36 toplvl(2)=6.72 toplvl(3)=19.2 elseif(trim(grid).eq.'NASA')then toplvl(1)=3.36 toplvl(2)=6.72 toplvl(3)=19.2 elseif(trim(grid).eq.'LMDZ40')then toplowl = 14; topmidl = 18; tophighl = 40 elseif(trim(grid).eq.'LMDZ')then toplowl = 7; topmidl = 9 tophighl = 19 ! endif call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Map_Low_Mid_High_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'hist', histmax, hist_dimid)) call check(nf90_def_dim(nc_id, 'hist2', histmax2, hist2_dimid)) call check(nf90_def_dim(nc_id, 'hist3', histmax3, hist3_dimid)) call check(nf90_def_dim(nc_id, 'toplvl', 3, pres_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, time_dimid/) dim2 = (/lon_dimid, lat_dimid, hist_dimid, time_dimid/) dim3 = (/lon_dimid, lat_dimid, hist2_dimid, time_dimid/) dim4 = (/lon_dimid, lat_dimid, hist3_dimid, time_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'toplvl', NF90_FLOAT,pres_dimid,pres_varid)) call check(nf90_put_att(nc_id, pres_varid,'lon_name','Top Altitude Level')) call check(nf90_put_att(nc_id, pres_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, pres_varid, 'positive','up')) call check(nf90_put_att(nc_id, pres_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, pres_varid, toplvl)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_mapnc2 !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** MAP_RECVAR2NC *** This routine record the map variables in the netcdf ! ! prof file ! !----------------------------------------------------------------------------! ! fname : name of output netcdf MaPLowMidHigh file ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! dim : dimension id of the isccp variables ! ! low : isccp low cloud flag ! ! mid : isccp mid cloud flag ! ! high : isccp high cloud flag ! ! colcloud : isccp column cloud flag ! ! colclear : isccp column clear flag ! !----------------------------------------------------------------------------! ! nan : Not a Number value ! ! ndims : dimension of dim (= 3 : lon,lat,time) ! ! ncid : netcdf file id ! ! varid1 : variable id of cloud fraction ! ! varid2 : variable id of clear fraction ! ! varid3 : variable id of fully attenuated fraction ! ! varid4 : variable id of unclassify fraction ! ! varid5 : variable id of nan fraction ! !----------------------------------------------------------------------------! ! ! ! ex : map_recvar2nc(monthisccplow,monthisccpmid,monthisccphigh,monthcolcloud! ! monthcolclear,dimidsm,file8,lonmax,latmax) ! ! ! !----------------------------------------------------------------------------! subroutine map_recvar2nc2(low,mid,high,colcloud,colclear, & dim,fname,nlon,nlat) use netcdf implicit none integer, parameter :: ndims=3 real,parameter :: nan=-9999 integer :: nlon , nlat ,dim(ndims) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: low, mid, high real*4,dimension(nlon,nlat) :: colcloud, colclear call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cllcalipso', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid1, 'units','1 fraction')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clmcalipso', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid2, 'units','1 fraction')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clhcalipso', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltcalipso', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clccalipso', NF90_FLOAT, dim, varid5)) call check(nf90_put_att(ncid, varid5, 'lon_name', & 'CALIPSO Total Clear Fraction')) call check(nf90_put_att(ncid, varid5, 'units','1 fraction')) call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid1, low)) call check(nf90_put_var(ncid, varid2, mid)) call check(nf90_put_var(ncid, varid3, high)) call check(nf90_put_var(ncid, varid4, colcloud)) call check(nf90_put_var(ncid, varid5, colclear)) call check(nf90_close(ncid)) endsubroutine map_recvar2nc2 !----------------------------------------------------------------------------! subroutine create_maphighnc(fname,dname,vlon,vlat,vtime,dim,grid,nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5,grid*8 integer, parameter :: ndims = 3 integer,dimension(8) :: value integer :: nlon , nlat,dim(ndims) integer :: lon_varid,lat_varid,pres_varid, time_varid,nc_id integer :: lon_dimid,lat_dimid,pres_dimid,time_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Map_High_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'lon', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'lat', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, time_dimid/) call check(nf90_def_var(nc_id, 'lon', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'lat', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_maphighnc !----------------------------------------------------------------------------! subroutine maphigh(high,top,base,dim,fname,nlon,nlat) use netcdf implicit none integer, parameter :: ndims=3 real,parameter :: nan=-9999 integer :: nlon , nlat ,dim(ndims) integer :: varid3,varid5, varid6, ncid ! character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: high,top,base call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'clhcalipso', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'topcalipso', NF90_FLOAT, dim, varid5)) call check(nf90_put_att(ncid, varid5, 'lon_name', & 'CALIPSO Top Cloud Height')) call check(nf90_put_att(ncid, varid5, 'units','Kilometer')) call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) call check(nf90_def_var(ncid, 'bascalipso', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO Base Cloud Height')) call check(nf90_put_att(ncid, varid6, 'units','Kilometer')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid3, high)) call check(nf90_put_var(ncid, varid5, top)) call check(nf90_put_var(ncid, varid6, base)) call check(nf90_close(ncid)) endsubroutine maphigh ! call map_recvar2nc2phase(monthisccpliq,monthisccpice,monthisccpho,monthisccpun,monthisccpdust, & ! isccpdaypermonthlow,isccpdaypermonthmid,isccpdaypermonth,dimidsm, & ! file8,lonmax-1,latmax-1) subroutine map_recvar2nc2phase(liq,ice,dim,fname,nlon,nlat) use netcdf implicit none integer, parameter :: ndims=3 real,parameter :: nan=-9999 integer :: nlon , nlat ,dim(ndims) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat,4) :: liq,ice call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cll_liq', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid1, 'units','1 fraction')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clm_liq', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid2, 'units','1 fraction')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clh_liq', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clt_liq', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cll_ice', NF90_FLOAT, dim, varid5)) call check(nf90_put_att(ncid, varid5, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid5, 'units','1 fraction')) call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clm_ice', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid6, 'units','1 fraction')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clh_ice', NF90_FLOAT, dim, varid7)) call check(nf90_put_att(ncid, varid7, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid7, 'units','1 fraction')) call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clt_ice', NF90_FLOAT, dim, varid8)) call check(nf90_put_att(ncid, varid8, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid8, 'units','1 fraction')) call check(nf90_put_att(ncid, varid8, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid1, liq(:,:,1))) call check(nf90_put_var(ncid, varid2, liq(:,:,2))) call check(nf90_put_var(ncid, varid3, liq(:,:,3))) call check(nf90_put_var(ncid, varid4, liq(:,:,4))) call check(nf90_put_var(ncid, varid5, ice(:,:,1))) call check(nf90_put_var(ncid, varid6, ice(:,:,2))) call check(nf90_put_var(ncid, varid7, ice(:,:,3))) call check(nf90_put_var(ncid, varid8, ice(:,:,4))) call check(nf90_close(ncid)) endsubroutine map_recvar2nc2phase !----------------------------------------------------------------------------! subroutine map_recvar2nc2phaseocc(liq,ice,indlow,indmid,indtot,dim,fname,nlon,nlat) use netcdf implicit none integer, parameter :: ndims=3 real,parameter :: nan=-9999 integer :: nlon , nlat ,dim(ndims) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10,varid11 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat,4) :: liq,ice real*4,dimension(nlon,nlat) :: indtot,indlow,indmid call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cll_liq', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid1, 'units','Occurrence')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clm_liq', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid2, 'units','Occurrence')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clh_liq', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','Occurrence')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clt_liq', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid4, 'units','Occurrence')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cll_ice', NF90_FLOAT, dim, varid5)) call check(nf90_put_att(ncid, varid5, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid5, 'units','Occurrence')) call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clm_ice', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid6, 'units','Occurrence')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clh_ice', NF90_FLOAT, dim, varid7)) call check(nf90_put_att(ncid, varid7, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid7, 'units','Occurrence')) call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clt_ice', NF90_FLOAT, dim, varid8)) call check(nf90_put_att(ncid, varid8, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid8, 'units','Occurrence')) call check(nf90_put_att(ncid, varid8, '_FillValue',nan)) call check(nf90_def_var(ncid, 'ind_low', NF90_FLOAT, dim, varid9)) call check(nf90_put_att(ncid, varid9, 'lon_name', & 'indice low')) call check(nf90_put_att(ncid, varid9, 'units','Occurrence')) call check(nf90_put_att(ncid, varid9, '_FillValue',nan)) call check(nf90_def_var(ncid, 'ind_mid', NF90_FLOAT, dim, varid10)) call check(nf90_put_att(ncid, varid10, 'lon_name', & 'indice mid')) call check(nf90_put_att(ncid, varid10, 'units','Occurrence')) call check(nf90_put_att(ncid, varid10, '_FillValue',nan)) call check(nf90_def_var(ncid, 'ind_tot', NF90_FLOAT, dim, varid11)) call check(nf90_put_att(ncid, varid11, 'lon_name', & 'indice high/tot')) call check(nf90_put_att(ncid, varid11, 'units','Occurrence')) call check(nf90_put_att(ncid, varid11, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid1, liq(:,:,1))) call check(nf90_put_var(ncid, varid2, liq(:,:,2))) call check(nf90_put_var(ncid, varid3, liq(:,:,3))) call check(nf90_put_var(ncid, varid4, liq(:,:,4))) call check(nf90_put_var(ncid, varid5, ice(:,:,1))) call check(nf90_put_var(ncid, varid6, ice(:,:,2))) call check(nf90_put_var(ncid, varid7, ice(:,:,3))) call check(nf90_put_var(ncid, varid8, ice(:,:,4))) call check(nf90_put_var(ncid, varid9, indlow(:,:))) call check(nf90_put_var(ncid, varid10, indmid(:,:))) call check(nf90_put_var(ncid, varid11, indtot(:,:))) call check(nf90_close(ncid)) endsubroutine map_recvar2nc2phaseocc !----------------------------------------------------------------------------! subroutine map_recvar2nc2phaseocc2(liq,ice,un2,phase,dim,dim2,fname,nlon,nlat) !call map_recvar2nc2phaseocc2(monthisccpho,monthisccpun,monthisccpdust,isccpdaypermonthlow, & ! isccpdaypermonthmid,isccpdaypermonth,dimidsm, & ! file8,lonmax-1,latmax-1) ! use netcdf implicit none integer, parameter :: ndims=3, ndims2=4 real,parameter :: nan=-9999. integer :: nlon , nlat ,dim(ndims),dim2(ndims2) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid21,varid22,varid23,varid24,varid25, varid26,varid27, varid28 integer :: varid8,varid9,varid10,varid11, varid12,varid13,varid14,varid15,varid16 character(LEN=*) :: fname real*4,dimension(nlon,nlat,4) :: ice,liq,phase real*4,dimension(nlon,nlat,4,catmax) :: un2 call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cllcalipso_liq', NF90_FLOAT, dim, varid21)) call check(nf90_put_att(ncid, varid21, 'lon_name', & 'Low Level liquid Cloud')) call check(nf90_put_att(ncid, varid21, 'units','Fraction')) call check(nf90_put_att(ncid, varid21, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clmcalipso_liq', NF90_FLOAT, dim, varid22)) call check(nf90_put_att(ncid, varid22, 'lon_name', & 'Middle Level liq Cloud')) call check(nf90_put_att(ncid, varid22, 'units','Fraction')) call check(nf90_put_att(ncid, varid22, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clhcalipso_liq', NF90_FLOAT, dim, varid23)) call check(nf90_put_att(ncid, varid23, 'lon_name', & 'High Level liq Cloud')) call check(nf90_put_att(ncid, varid23, 'units','Fraction')) call check(nf90_put_att(ncid, varid23, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltcalipso_liq', NF90_FLOAT, dim, varid24)) call check(nf90_put_att(ncid, varid24, 'lon_name', & 'Total Column Level liq Cloud')) call check(nf90_put_att(ncid, varid24, 'units','Fraction')) call check(nf90_put_att(ncid, varid24, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cllcalipso_ice', NF90_FLOAT, dim, varid25)) call check(nf90_put_att(ncid, varid25, 'lon_name', & 'Low-level ice Cloud')) call check(nf90_put_att(ncid, varid25, 'units','Fraction')) call check(nf90_put_att(ncid, varid25, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clmcalipso_ice', NF90_FLOAT, dim, varid26)) call check(nf90_put_att(ncid, varid26, 'lon_name', & 'CALIPSO Mid-level ice Cloud')) call check(nf90_put_att(ncid, varid26, 'units','Fraction')) call check(nf90_put_att(ncid, varid26, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clhcalipso_ice', NF90_FLOAT, dim, varid27)) call check(nf90_put_att(ncid, varid27, 'lon_name', & 'CALIPSO High-level ice Cloud')) call check(nf90_put_att(ncid, varid27, 'units','Fraction')) call check(nf90_put_att(ncid, varid27, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltcalipso_ice', NF90_FLOAT, dim, varid28)) call check(nf90_put_att(ncid, varid28, 'lon_name', & 'CALIPSO Total ice Cloud')) call check(nf90_put_att(ncid, varid28, 'units','Fraction')) call check(nf90_put_att(ncid, varid28, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cllcalipso_un', NF90_FLOAT, dim2, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'Low Level unclassified Cloud')) call check(nf90_put_att(ncid, varid1, 'units','Fraction')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clmcalipso_un', NF90_FLOAT, dim2, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'Middle Level unclassified Cloud')) call check(nf90_put_att(ncid, varid2, 'units','Fraction')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clhcalipso_un', NF90_FLOAT, dim2, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'High Level unclassified Cloud')) call check(nf90_put_att(ncid, varid3, 'units','Fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltcalipso_un', NF90_FLOAT, dim2, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'Total Column Level unclassified Cloud')) call check(nf90_put_att(ncid, varid4, 'units','Fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) !!$ call check(nf90_def_var(ncid, 'cll_ho', NF90_FLOAT, dim, varid5)) !!$ call check(nf90_put_att(ncid, varid5, 'lon_name', & !!$ 'Low-level HO Cloud')) !!$ call check(nf90_put_att(ncid, varid5, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid5, '_FillValue',nan)) !!$ !!$ call check(nf90_def_var(ncid, 'clm_ho', NF90_FLOAT, dim, varid6)) !!$ call check(nf90_put_att(ncid, varid6, 'lon_name', & !!$ 'CALIPSO Mid-level HO Cloud')) !!$ call check(nf90_put_att(ncid, varid6, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) !!$ !!$ call check(nf90_def_var(ncid, 'clh_ho', NF90_FLOAT, dim, varid7)) !!$ call check(nf90_put_att(ncid, varid7, 'lon_name', & !!$ 'CALIPSO High-level HO Cloud')) !!$ call check(nf90_put_att(ncid, varid7, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) !!$ !!$ call check(nf90_def_var(ncid, 'clt_ho', NF90_FLOAT, dim, varid8)) !!$ call check(nf90_put_att(ncid, varid8, 'lon_name', & !!$ 'CALIPSO Total HO Cloud')) !!$ call check(nf90_put_att(ncid, varid8, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid8, '_FillValue',nan)) !!$ !!$ call check(nf90_def_var(ncid, 'cll_dust', NF90_FLOAT, dim, varid12)) !!$ call check(nf90_put_att(ncid, varid12, 'lon_name', & !!$ 'CALIPSO Low-level dust Cloud')) !!$ call check(nf90_put_att(ncid, varid12, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid12, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cllcalipso_RPIC', NF90_FLOAT, dim, varid13)) call check(nf90_put_att(ncid, varid13, 'lon_name', & 'CALIPSO Low-level Relative Percentage of Ice in Cloud')) call check(nf90_put_att(ncid, varid13, 'units','Fraction')) call check(nf90_put_att(ncid, varid13, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clmcalipso_RPIC', NF90_FLOAT, dim, varid14)) call check(nf90_put_att(ncid, varid14, 'lon_name', & 'CALIPSO Mid-level Relative Percentage of Ice in Cloud')) call check(nf90_put_att(ncid, varid14, 'units','Fraction')) call check(nf90_put_att(ncid, varid14, '_FillValue',nan)) call check(nf90_def_var(ncid, 'clhcalipso_RPIC', NF90_FLOAT, dim, varid15)) call check(nf90_put_att(ncid, varid15, 'lon_name', & 'CALIPSO High-level Relative Percentage of Ice in Cloud')) call check(nf90_put_att(ncid, varid15, 'units','Fraction')) call check(nf90_put_att(ncid, varid15, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cltcalipso_RPIC', NF90_FLOAT, dim, varid16)) call check(nf90_put_att(ncid, varid16, 'lon_name', & 'CALIPSO Total Relative Percentage of Ice in Cloud')) call check(nf90_put_att(ncid, varid16, 'units','Fraction')) call check(nf90_put_att(ncid, varid16, '_FillValue',nan)) !!$ call check(nf90_def_var(ncid, 'ind_low', NF90_FLOAT, dim, varid9)) !!$ call check(nf90_put_att(ncid, varid9, 'lon_name', & !!$ 'indice low')) !!$ call check(nf90_put_att(ncid, varid9, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid9, '_FillValue',nan)) !!$ !!$ call check(nf90_def_var(ncid, 'ind_mid', NF90_FLOAT, dim, varid10)) !!$ call check(nf90_put_att(ncid, varid10, 'lon_name', & !!$ 'indice mid')) !!$ call check(nf90_put_att(ncid, varid10, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid10, '_FillValue',nan)) !!$ !!$ call check(nf90_def_var(ncid, 'ind_tot', NF90_FLOAT, dim, varid11)) !!$ call check(nf90_put_att(ncid, varid11, 'lon_name', & !!$ 'indice high/tot')) !!$ call check(nf90_put_att(ncid, varid11, 'units','Fraction')) !!$ call check(nf90_put_att(ncid, varid11, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid21, liq(:,:,1))) call check(nf90_put_var(ncid, varid22, liq(:,:,2))) call check(nf90_put_var(ncid, varid23, liq(:,:,3))) call check(nf90_put_var(ncid, varid24, liq(:,:,4))) call check(nf90_put_var(ncid, varid25, ice(:,:,1))) call check(nf90_put_var(ncid, varid26, ice(:,:,2))) call check(nf90_put_var(ncid, varid27, ice(:,:,3))) call check(nf90_put_var(ncid, varid28, ice(:,:,4))) call check(nf90_put_var(ncid, varid1, un2(:,:,1,:))) call check(nf90_put_var(ncid, varid2, un2(:,:,2,:))) call check(nf90_put_var(ncid, varid3, un2(:,:,3,:))) call check(nf90_put_var(ncid, varid4, un2(:,:,4,:))) call check(nf90_put_var(ncid, varid13, phase(:,:,1))) call check(nf90_put_var(ncid, varid14, phase(:,:,2))) call check(nf90_put_var(ncid, varid15, phase(:,:,3))) call check(nf90_put_var(ncid, varid16, phase(:,:,4))) ! call check(nf90_put_var(ncid, varid9, indlow(:,:))) ! call check(nf90_put_var(ncid, varid10, indmid(:,:))) ! call check(nf90_put_var(ncid, varid11, indtot(:,:))) call check(nf90_close(ncid)) endsubroutine map_recvar2nc2phaseocc2 !----------------------------------------------------------------------------! subroutine map_recvar2nc3(low,mid,high,colcloud,colclear,height,indtot,& hlow,hmid,hhigh,hcol,hheight,dim,dim2,dim3,fname,nlon,nlat) ! h_CA utile car 31 valeur au max... use netcdf implicit none integer, parameter :: ndims=3,histmax=10,histmax2=40,ndims2=4 real,parameter :: nan=-999 integer :: nlon , nlat ,dim(ndims),ihist,dim2(ndims2),dim3(ndims2) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10,varid11,varid12,varid13,varid14 integer :: varid15,varid16,varid17 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: low, mid, high real*4,dimension(nlon,nlat) :: colcloud, colclear, height integer,dimension(nlon,nlat) :: indtot,f_CA,f_CAL,f_CAM,f_CAH,f_CZ integer,dimension(nlon,nlat,histmax) :: hlow,hmid,hhigh,hcol real*4,dimension(nlon,nlat,histmax2) :: hheight integer,dimension(histmax2) :: histmod2 real,dimension(histmax) :: histmod histmod(:)=0; do ihist=1,histmax histmod(ihist+1)=histmod(ihist)+0.1 enddo histmod2(:)=0; do ihist=1,histmax2 histmod2(ihist+1)=histmod2(ihist)+1 enddo !print *, tot(5,5),ret(5,5) do ilon=1,nlon do ilat=1,nlat if (colcloud(ilon,ilat).eq.0)then f_CA(ilon,ilat)=0 elseif(colcloud(ilon,ilat).eq.-999)then f_CA(ilon,ilat)=-999 else f_CA(ilon,ilat)=100 endif if (low(ilon,ilat).eq.0)then f_CAL(ilon,ilat)=0 elseif(low(ilon,ilat).eq.-999)then f_CAL(ilon,ilat)=-999 else f_CAL(ilon,ilat)=100 endif if (mid(ilon,ilat).eq.0)then f_CAM(ilon,ilat)=0 elseif(mid(ilon,ilat).eq.-999)then f_CAM(ilon,ilat)=-999 else f_CAM(ilon,ilat)=100 endif if (high(ilon,ilat).eq.0)then f_CAH(ilon,ilat)=0 elseif(high(ilon,ilat).eq.-999)then f_CAH(ilon,ilat)=-999 else f_CAH(ilon,ilat)=100 endif if (height(ilon,ilat).eq.0)then f_CZ(ilon,ilat)=0 elseif(height(ilon,ilat).eq.-999)then f_CZ(ilon,ilat)=-999 else f_CZ(ilon,ilat)=100 endif enddo enddo !!$do ilon=1,nlon !!$ do ilat=1,nlat !!$ do ihist=1,ihistmax-1 !!$ !!$ if(h_CA(ilon,ilat,ihist) !!$enddo !!$enddo !!$enddo call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'n_tot', NF90_INT4, dim, varid7)) call check(nf90_put_att(ncid, varid7, 'lon_name', & 'Number of orbit passages')) call check(nf90_put_att(ncid, varid7, 'units','Arbitrary Unit')) call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAL', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid1, 'units','1 fraction')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAM', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid2, 'units','1 fraction')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAH', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CA', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CZ', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO Cloud Top Height level')) call check(nf90_put_att(ncid, varid6, 'units','1-40')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_def_var(ncid, 'f_CAL', NF90_INT4, dim, varid8)) call check(nf90_def_var(ncid, 'f_CAM', NF90_INT4, dim, varid9)) call check(nf90_def_var(ncid, 'f_CAH', NF90_INT4, dim, varid10)) call check(nf90_def_var(ncid, 'f_CA', NF90_INT4, dim, varid11)) call check(nf90_def_var(ncid, 'f_CZ', NF90_INT4, dim, varid12)) call check(nf90_def_var(ncid, 'h_CAL', NF90_INT4, dim2, varid13)) call check(nf90_def_var(ncid, 'h_CAM', NF90_INT4, dim2, varid14)) call check(nf90_def_var(ncid, 'h_CAH', NF90_INT4, dim2, varid15)) call check(nf90_def_var(ncid, 'h_CA', NF90_INT4, dim2, varid16)) call check(nf90_def_var(ncid, 'h_CZ', NF90_FLOAT, dim3, varid17)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid1, low)) call check(nf90_put_var(ncid, varid2, mid)) call check(nf90_put_var(ncid, varid3, high)) call check(nf90_put_var(ncid, varid4, colcloud)) ! call check(nf90_put_var(ncid, varid5, colclear)) call check(nf90_put_var(ncid, varid6, height)) call check(nf90_put_var(ncid, varid7, indtot)) call check(nf90_put_var(ncid, varid8, f_CAL)) call check(nf90_put_var(ncid, varid9, f_CAM)) call check(nf90_put_var(ncid, varid10, f_CAH)) call check(nf90_put_var(ncid, varid11, f_CA)) call check(nf90_put_var(ncid, varid12, f_CZ)) call check(nf90_put_var(ncid, varid13, hlow )) call check(nf90_put_var(ncid, varid14, hmid )) call check(nf90_put_var(ncid, varid15, hhigh)) call check(nf90_put_var(ncid, varid16, hcol)) call check(nf90_put_var(ncid, varid17, hheight)) call check(nf90_close(ncid)) endsubroutine map_recvar2nc3 !----------------------------------------------------------------------------! subroutine map_recvar2nc7(low,mid,high,colcloud,height,indtot,& hlow,hmid,hhigh,hcol,hheight,dim,dim2,dim3,dim4,fname,nlon,nlat, & lowtemp,midtemp,hightemp,coltemp,hlowtemp,hmidtemp,hhightemp, & hcoltemp) ! h_CA utile car 31 v!aleur au max... use netcdf implicit none integer, parameter :: ndims=3,histmax=10,histmax2=40,ndims2=4, histmax3=28 real,parameter :: nan=-999 integer :: nlon , nlat ,dim(ndims),ihist,dim2(ndims2),dim3(ndims2),dim4(ndims2) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10,varid11,varid12,varid13,varid14 integer :: varid15,varid16,varid17 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: low, mid, high real*4,dimension(nlon,nlat) :: colcloud, height integer,dimension(nlon,nlat) :: indtot,f_CA,f_CAL,f_CAM,f_CAH,f_CZ integer,dimension(nlon,nlat) :: f_CT,f_CTL,f_CTM,f_CTH integer,dimension(nlon,nlat,histmax) :: hlow,hmid,hhigh,hcol real*4,dimension(nlon,nlat,histmax2) :: hheight integer,dimension(histmax2) :: histmod2 real,dimension(histmax) :: histmod integer,dimension(nlon,nlat,histmax3) :: hlowtemp,hmidtemp,hhightemp,hcoltemp real*4,dimension(nlon,nlat) :: lowtemp,midtemp,hightemp,coltemp integer :: varid27, varid28, varid29, varid30, varid18, varid19, varid20, varid21 integer :: varid31, varid32, varid33, varid34 histmod(:)=0; do ihist=1,histmax histmod(ihist+1)=histmod(ihist)+0.1 enddo histmod2(:)=0; do ihist=1,histmax2 histmod2(ihist+1)=histmod2(ihist)+1 enddo do ilon=1,nlon do ilat=1,nlat if (colcloud(ilon,ilat).eq.0)then f_CA(ilon,ilat)=0 elseif(colcloud(ilon,ilat).eq.-999)then f_CA(ilon,ilat)=-999 else f_CA(ilon,ilat)=100 endif if (low(ilon,ilat).eq.0)then f_CAL(ilon,ilat)=0 elseif(low(ilon,ilat).eq.-999)then f_CAL(ilon,ilat)=-999 else f_CAL(ilon,ilat)=100 endif if (mid(ilon,ilat).eq.0)then f_CAM(ilon,ilat)=0 elseif(mid(ilon,ilat).eq.-999)then f_CAM(ilon,ilat)=-999 else f_CAM(ilon,ilat)=100 endif if (high(ilon,ilat).eq.0)then f_CAH(ilon,ilat)=0 elseif(high(ilon,ilat).eq.-999)then f_CAH(ilon,ilat)=-999 else f_CAH(ilon,ilat)=100 endif if (height(ilon,ilat).eq.0)then f_CZ(ilon,ilat)=0 elseif(height(ilon,ilat).eq.-999)then f_CZ(ilon,ilat)=-999 else f_CZ(ilon,ilat)=100 endif if (lowtemp(ilon,ilat).gt.0)then f_CTL(ilon,ilat)=100 else f_CTL(ilon,ilat)=0 endif if (midtemp(ilon,ilat).gt.0)then f_CTM(ilon,ilat)=100 else f_CTM(ilon,ilat)=0 endif if (hightemp(ilon,ilat).gt.0)then f_CTH(ilon,ilat)=100 else f_CTH(ilon,ilat)=0 endif if (coltemp(ilon,ilat).gt.0)then f_CT(ilon,ilat)=100 else f_CT(ilon,ilat)=0 endif enddo enddo !!$do ilon=1,nlon !!$ do ilat=1,nlat !!$ do ihist=1,ihistmax-1 !!$ !!$ if(h_CA(ilon,ilat,ihist) !!$enddo !!$enddo !!$enddo call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'n_tot', NF90_INT4, dim, varid7)) call check(nf90_put_att(ncid, varid7, 'lon_name', & 'Number of orbit passages')) call check(nf90_put_att(ncid, varid7, 'units','Arbitrary Unit')) call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAL', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid1, 'units','1 fraction')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAM', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid2, 'units','1 fraction')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAH', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CA', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CZ', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO Cloud Top Height level')) call check(nf90_put_att(ncid, varid6, 'units','1-40')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_def_var(ncid, 'f_CAL', NF90_INT4, dim, varid8)) call check(nf90_def_var(ncid, 'f_CAM', NF90_INT4, dim, varid9)) call check(nf90_def_var(ncid, 'f_CAH', NF90_INT4, dim, varid10)) call check(nf90_def_var(ncid, 'f_CA', NF90_INT4, dim, varid11)) call check(nf90_def_var(ncid, 'f_CZ', NF90_INT4, dim, varid12)) call check(nf90_def_var(ncid, 'h_CAL', NF90_INT4, dim2, varid13)) call check(nf90_def_var(ncid, 'h_CAM', NF90_INT4, dim2, varid14)) call check(nf90_def_var(ncid, 'h_CAH', NF90_INT4, dim2, varid15)) call check(nf90_def_var(ncid, 'h_CA', NF90_INT4, dim2, varid16)) call check(nf90_def_var(ncid, 'h_CZ', NF90_FLOAT, dim3, varid17)) call check(nf90_def_var(ncid, 'a_CTL', NF90_FLOAT, dim, varid27)) call check(nf90_def_var(ncid, 'a_CTM', NF90_FLOAT, dim, varid28)) call check(nf90_def_var(ncid, 'a_CTH', NF90_FLOAT, dim, varid29)) call check(nf90_def_var(ncid, 'a_CT', NF90_FLOAT, dim, varid30)) call check(nf90_def_var(ncid, 'f_CTL', NF90_INT4, dim, varid18)) call check(nf90_def_var(ncid, 'f_CTM', NF90_INT4, dim, varid19)) call check(nf90_def_var(ncid, 'f_CTH', NF90_INT4, dim, varid20)) call check(nf90_def_var(ncid, 'f_CT', NF90_INT4, dim, varid21)) call check(nf90_def_var(ncid, 'h_CTL', NF90_INT4, dim4, varid31)) call check(nf90_def_var(ncid, 'h_CTM', NF90_INT4, dim4, varid32)) call check(nf90_def_var(ncid, 'h_CTH', NF90_INT4, dim4, varid33)) call check(nf90_def_var(ncid, 'h_CT', NF90_INT4, dim4, varid34)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid1, low)) call check(nf90_put_var(ncid, varid2, mid)) call check(nf90_put_var(ncid, varid3, high)) call check(nf90_put_var(ncid, varid4, colcloud)) call check(nf90_put_var(ncid, varid6, height)) call check(nf90_put_var(ncid, varid7, indtot)) call check(nf90_put_var(ncid, varid8, f_CAL)) call check(nf90_put_var(ncid, varid9, f_CAM)) call check(nf90_put_var(ncid, varid10, f_CAH)) call check(nf90_put_var(ncid, varid11, f_CA)) call check(nf90_put_var(ncid, varid12, f_CZ)) call check(nf90_put_var(ncid, varid13, hlow )) call check(nf90_put_var(ncid, varid14, hmid )) call check(nf90_put_var(ncid, varid15, hhigh)) call check(nf90_put_var(ncid, varid16, hcol)) call check(nf90_put_var(ncid, varid17, hheight)) call check(nf90_put_var(ncid, varid18, f_CTL)) call check(nf90_put_var(ncid, varid19, f_CTM)) call check(nf90_put_var(ncid, varid20, f_CTH)) call check(nf90_put_var(ncid, varid21, f_CT)) call check(nf90_put_var(ncid, varid27, lowtemp)) call check(nf90_put_var(ncid, varid28, midtemp)) call check(nf90_put_var(ncid, varid29, hightemp)) call check(nf90_put_var(ncid, varid30, coltemp)) call check(nf90_put_var(ncid, varid31, hlowtemp)) call check(nf90_put_var(ncid, varid32, hmidtemp)) call check(nf90_put_var(ncid, varid33, hhightemp)) call check(nf90_put_var(ncid, varid34, hcoltemp)) call check(nf90_close(ncid)) endsubroutine map_recvar2nc7 subroutine map_recvar2nc6(low,mid,high,colcloud,height,indtot,& hlow,hmid,hhigh,hcol,hheight,dim,dim2,dim3,fname,nlon,nlat)!,& ! lowtemp,midtemp! & ! hightemp,coltemp,hlowtemp,hmidtemp,hhightemp, & ! hcoltemp,dim4) ! h_CA utile car 31 valeur au max... use netcdf implicit none integer, parameter :: ndims=3,histmax=10,histmax2=40,ndims2=4,histmax3=28 real,parameter :: nan=-999 integer :: nlon , nlat ,dim(ndims),ihist,dim2(ndims2),dim3(ndims2),dim4(ndims2) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10,varid11,varid12,varid13,varid14 integer :: varid15,varid16,varid17 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: low, mid, high real*4,dimension(nlon,nlat) :: colcloud, height integer,dimension(nlon,nlat) :: indtot,f_CA,f_CAL,f_CAM,f_CAH,f_CZ integer,dimension(nlon,nlat,histmax) :: hlow,hmid,hhigh,hcol integer,dimension(nlon,nlat,histmax2) :: hheight integer,dimension(histmax2) :: histmod2 real,dimension(histmax) :: histmod real*4,dimension(nlon,nlat) :: lowtemp,midtemp,hightemp,coltemp integer,dimension(nlon,nlat) :: f_CT,f_CTL,f_CTM,f_CTH integer,dimension(nlon,nlat,histmax3) :: hlowtemp,hmidtemp,hhightemp,hcoltemp integer,dimension(histmax3) :: histmod3 histmod(:)=0; do ihist=1,histmax histmod(ihist+1)=histmod(ihist)+0.1 enddo histmod2(:)=0; do ihist=1,histmax2 histmod2(ihist+1)=histmod2(ihist)+1 enddo !print *, tot(5,5),ret(5,5) do ilon=1,nlon do ilat=1,nlat if (colcloud(ilon,ilat).eq.0)then f_CA(ilon,ilat)=0 elseif(colcloud(ilon,ilat).eq.-999)then f_CA(ilon,ilat)=-999 else f_CA(ilon,ilat)=100 endif if (low(ilon,ilat).eq.0)then f_CAL(ilon,ilat)=0 elseif(low(ilon,ilat).eq.-999)then f_CAL(ilon,ilat)=-999 else f_CAL(ilon,ilat)=100 endif if (mid(ilon,ilat).eq.0)then f_CAM(ilon,ilat)=0 elseif(mid(ilon,ilat).eq.-999)then f_CAM(ilon,ilat)=-999 else f_CAM(ilon,ilat)=100 endif if (high(ilon,ilat).eq.0)then f_CAH(ilon,ilat)=0 elseif(high(ilon,ilat).eq.-999)then f_CAH(ilon,ilat)=-999 else f_CAH(ilon,ilat)=100 endif if (height(ilon,ilat).eq.0)then f_CZ(ilon,ilat)=0 elseif(height(ilon,ilat).eq.-999)then f_CZ(ilon,ilat)=-999 else f_CZ(ilon,ilat)=100 endif enddo enddo !!$do ilon=1,nlon !!$ do ilat=1,nlat !!$ do ihist=1,ihistmax-1 !!$ !!$ if(h_CA(ilon,ilat,ihist) !!$enddo !!$enddo !!$enddo call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'n_tot', NF90_INT4, dim, varid7)) call check(nf90_put_att(ncid, varid7, 'lon_name', & 'Number of orbit passages')) call check(nf90_put_att(ncid, varid7, 'units','Arbitrary Unit')) call check(nf90_put_att(ncid, varid7, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAL', NF90_FLOAT, dim, varid1)) call check(nf90_put_att(ncid, varid1, 'lon_name', & 'CALIPSO Low-level Cloud Fraction')) call check(nf90_put_att(ncid, varid1, 'units','1 fraction')) call check(nf90_put_att(ncid, varid1, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAM', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'CALIPSO Mid-level Cloud Fraction')) call check(nf90_put_att(ncid, varid2, 'units','1 fraction')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CAH', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'CALIPSO High-level Cloud Fraction')) call check(nf90_put_att(ncid, varid3, 'units','1 fraction')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CA', NF90_FLOAT, dim, varid4)) call check(nf90_put_att(ncid, varid4, 'lon_name', & 'CALIPSO Total Cloud Fraction')) call check(nf90_put_att(ncid, varid4, 'units','1 fraction')) call check(nf90_put_att(ncid, varid4, '_FillValue',nan)) call check(nf90_def_var(ncid, 'a_CZ', NF90_FLOAT, dim, varid6)) call check(nf90_put_att(ncid, varid6, 'lon_name', & 'CALIPSO Cloud Top Height level')) call check(nf90_put_att(ncid, varid6, 'units','1-40')) call check(nf90_put_att(ncid, varid6, '_FillValue',nan)) call check(nf90_def_var(ncid, 'f_CAL', NF90_INT4, dim, varid8)) call check(nf90_def_var(ncid, 'f_CAM', NF90_INT4, dim, varid9)) call check(nf90_def_var(ncid, 'f_CAH', NF90_INT4, dim, varid10)) call check(nf90_def_var(ncid, 'f_CA', NF90_INT4, dim, varid11)) call check(nf90_def_var(ncid, 'f_CZ', NF90_INT4, dim, varid12)) call check(nf90_def_var(ncid, 'h_CAL', NF90_INT4, dim2, varid13)) call check(nf90_def_var(ncid, 'h_CAM', NF90_INT4, dim2, varid14)) call check(nf90_def_var(ncid, 'h_CAH', NF90_INT4, dim2, varid15)) call check(nf90_def_var(ncid, 'h_CA', NF90_INT4, dim2, varid16)) call check(nf90_def_var(ncid, 'h_CZ', NF90_INT4, dim3, varid17)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid1, low)) call check(nf90_put_var(ncid, varid2, mid)) call check(nf90_put_var(ncid, varid3, high)) call check(nf90_put_var(ncid, varid4, colcloud)) call check(nf90_put_var(ncid, varid6, height)) call check(nf90_put_var(ncid, varid7, indtot)) call check(nf90_put_var(ncid, varid8, f_CAL)) call check(nf90_put_var(ncid, varid9, f_CAM)) call check(nf90_put_var(ncid, varid10, f_CAH)) call check(nf90_put_var(ncid, varid11, f_CA)) call check(nf90_put_var(ncid, varid12, f_CZ)) call check(nf90_put_var(ncid, varid13, hlow )) call check(nf90_put_var(ncid, varid14, hmid )) call check(nf90_put_var(ncid, varid15, hhigh)) call check(nf90_put_var(ncid, varid16, hcol)) call check(nf90_put_var(ncid, varid17, hheight)) call check(nf90_close(ncid)) endsubroutine map_recvar2nc6 !----------------------------------------------------------------------------! subroutine map_recvar2nc4(low,mid,high,colcloud,colclear,height,indtot,& hlow,hmid,hhigh,hcol,hheight,lowtemp,midtemp, & hightemp,coltemp,hlowtemp,hmidtemp,hhightemp, & hcoltemp,dim,dim2,dim3,dim4,fname,nlon,nlat) ! h_CA utile car 31 valeur au max... use netcdf implicit none integer, parameter :: ndims=3,histmax=10,histmax2=40,ndims2=4,histmax3=28 real,parameter :: nan=-999 integer :: nlon , nlat ,dim(ndims),ihist,dim2(ndims2),dim3(ndims2),dim4(ndims2) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10,varid11,varid12,varid13,varid14 integer :: varid15,varid16,varid17,varid18,varid19,varid20,varid21,varid22,varid23,varid24,varid25,varid26,varid27,varid28,varid29,varid30 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: low, mid, high real*4,dimension(nlon,nlat) :: colcloud, colclear, height real*4,dimension(nlon,nlat) :: lowtemp,midtemp,hightemp,coltemp integer,dimension(nlon,nlat) :: indtot,f_CA,f_CAL,f_CAM,f_CAH,f_CZ integer,dimension(nlon,nlat) :: f_CT,f_CTL,f_CTM,f_CTH integer,dimension(nlon,nlat,histmax) :: hlow,hmid,hhigh,hcol integer,dimension(nlon,nlat,histmax2) :: hheight integer,dimension(nlon,nlat,histmax3) :: hlowtemp,hmidtemp,hhightemp,hcoltemp integer,dimension(histmax2) :: histmod2 real,dimension(histmax) :: histmod integer,dimension(histmax3) :: histmod3 histmod(:)=0; do ihist=1,histmax histmod(ihist+1)=histmod(ihist)+0.1 enddo histmod2(:)=0; do ihist=1,histmax2 histmod2(ihist+1)=histmod2(ihist)+1 enddo print *, 'f_ begin' !print *, tot(5,5),ret(5,5) do ilon=1,nlon do ilat=1,nlat if (colcloud(ilon,ilat).eq.0)then f_CA(ilon,ilat)=0 elseif(colcloud(ilon,ilat).eq.-999)then f_CA(ilon,ilat)=-999 else f_CA(ilon,ilat)=100 endif if (low(ilon,ilat).eq.0)then f_CAL(ilon,ilat)=0 elseif(low(ilon,ilat).eq.-999)then f_CAL(ilon,ilat)=-999 else f_CAL(ilon,ilat)=100 endif if (mid(ilon,ilat).eq.0)then f_CAM(ilon,ilat)=0 elseif(mid(ilon,ilat).eq.-999)then f_CAM(ilon,ilat)=-999 else f_CAM(ilon,ilat)=100 endif if (high(ilon,ilat).eq.0)then f_CAH(ilon,ilat)=0 elseif(high(ilon,ilat).eq.-999)then f_CAH(ilon,ilat)=-999 else f_CAH(ilon,ilat)=100 endif if (height(ilon,ilat).eq.0)then f_CZ(ilon,ilat)=0 elseif(height(ilon,ilat).eq.-999)then f_CZ(ilon,ilat)=-999 else f_CZ(ilon,ilat)=100 endif if (lowtemp(ilon,ilat).gt.0)then f_CTL(ilon,ilat)=100 else f_CTL(ilon,ilat)=0 endif if (midtemp(ilon,ilat).gt.0)then f_CTM(ilon,ilat)=100 else f_CTM(ilon,ilat)=0 endif if (hightemp(ilon,ilat).gt.0)then f_CTH(ilon,ilat)=100 else f_CTH(ilon,ilat)=0 endif if (coltemp(ilon,ilat).gt.0)then f_CT(ilon,ilat)=100 else f_CT(ilon,ilat)=0 endif enddo enddo print *, 'f_ ok' call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'a_CTL', NF90_FLOAT, dim, varid27)) call check(nf90_def_var(ncid, 'a_CTM', NF90_FLOAT, dim, varid28)) call check(nf90_def_var(ncid, 'a_CTH', NF90_FLOAT, dim, varid29)) call check(nf90_def_var(ncid, 'a_CT', NF90_FLOAT, dim, varid30)) call check(nf90_def_var(ncid, 'f_CTL', NF90_INT4, dim, varid18)) call check(nf90_def_var(ncid, 'f_CTM', NF90_INT4, dim, varid19)) call check(nf90_def_var(ncid, 'f_CTH', NF90_INT4, dim, varid20)) call check(nf90_def_var(ncid, 'f_CT', NF90_INT4, dim, varid21)) call check(nf90_def_var(ncid, 'h_CTL', NF90_INT4, dim4, varid23)) call check(nf90_def_var(ncid, 'h_CTM', NF90_INT4, dim4, varid24)) call check(nf90_def_var(ncid, 'h_CTH', NF90_INT4, dim4, varid25)) call check(nf90_def_var(ncid, 'h_CT', NF90_INT4, dim4, varid26)) print *, 'def var ok' call check(nf90_enddef(ncid)) print *, 'f_ ok' call check(nf90_put_var(ncid, varid18, f_CTL)) call check(nf90_put_var(ncid, varid19, f_CTM)) call check(nf90_put_var(ncid, varid20, f_CTH)) call check(nf90_put_var(ncid, varid21, f_CT)) print *, 'f_ ok' call check(nf90_put_var(ncid, varid23, hlowtemp )) call check(nf90_put_var(ncid, varid24, hmidtemp )) call check(nf90_put_var(ncid, varid25, hhightemp)) call check(nf90_put_var(ncid, varid26, hcoltemp)) print *, 'f_ ok' call check(nf90_put_var(ncid, varid27, lowtemp)) call check(nf90_put_var(ncid, varid28, midtemp)) call check(nf90_put_var(ncid, varid29, hightemp)) call check(nf90_put_var(ncid, varid30, coltemp)) print *, 'f_ ok' call check(nf90_close(ncid)) endsubroutine map_recvar2nc4 !----------------------------------------------------------------------------! subroutine map_recvar2nc5(low,mid,high,colcloud,height,indtot,& hlow,hmid,hhigh,hcol,hheight,lowtemp,midtemp, & hightemp,coltemp,hlowtemp,hmidtemp,hhightemp, & hcoltemp,dim,dim2,dim3,dim4,fname,nlon,nlat) ! h_CA utile car 31 valeur au max... use netcdf implicit none integer, parameter :: ndims=3,histmax=10,histmax2=40,ndims2=4,histmax3=28 real,parameter :: nan=-999 integer :: nlon , nlat ,dim(ndims),ihist,dim2(ndims2),dim3(ndims2),dim4(ndims2) integer :: varid1,varid2,varid3,varid4,varid5, varid6,varid7, ncid ! integer :: varid8,varid9,varid10,varid11,varid12,varid13,varid14 integer :: varid15,varid16,varid17 character(LEN=*) :: fname !integer*4,dimension(nlon,nlat) :: tot,ret,retlow,retmid,rethigh real*4,dimension(nlon,nlat) :: low, mid, high real*4,dimension(nlon,nlat) :: colcloud, height integer,dimension(nlon,nlat) :: indtot,f_CA,f_CAL,f_CAM,f_CAH,f_CZ integer,dimension(nlon,nlat,histmax) :: hlow,hmid,hhigh,hcol integer,dimension(nlon,nlat,histmax2) :: hheight integer,dimension(histmax2) :: histmod2 real,dimension(histmax) :: histmod integer :: varid18,varid19,varid20,varid21,varid22,varid23,varid24,varid25,varid26,varid27,varid28,varid29,varid30 real*4,dimension(nlon,nlat) :: lowtemp,midtemp,hightemp,coltemp integer,dimension(nlon,nlat) :: f_CT,f_CTL,f_CTM,f_CTH integer,dimension(nlon,nlat,histmax3) :: hlowtemp,hmidtemp,hhightemp,hcoltemp histmod(:)=0; do ihist=1,histmax histmod(ihist+1)=histmod(ihist)+0.1 enddo histmod2(:)=0; do ihist=1,histmax2 histmod2(ihist+1)=histmod2(ihist)+1 enddo !print *, tot(5,5),ret(5,5) do ilon=1,nlon do ilat=1,nlat if (colcloud(ilon,ilat).eq.0)then f_CA(ilon,ilat)=0 elseif(colcloud(ilon,ilat).eq.-999)then f_CA(ilon,ilat)=-999 else f_CA(ilon,ilat)=100 endif if (low(ilon,ilat).eq.0)then f_CAL(ilon,ilat)=0 elseif(low(ilon,ilat).eq.-999)then f_CAL(ilon,ilat)=-999 else f_CAL(ilon,ilat)=100 endif if (mid(ilon,ilat).eq.0)then f_CAM(ilon,ilat)=0 elseif(mid(ilon,ilat).eq.-999)then f_CAM(ilon,ilat)=-999 else f_CAM(ilon,ilat)=100 endif if (high(ilon,ilat).eq.0)then f_CAH(ilon,ilat)=0 elseif(high(ilon,ilat).eq.-999)then f_CAH(ilon,ilat)=-999 else f_CAH(ilon,ilat)=100 endif if (height(ilon,ilat).eq.0)then f_CZ(ilon,ilat)=0 elseif(height(ilon,ilat).eq.-999)then f_CZ(ilon,ilat)=-999 else f_CZ(ilon,ilat)=100 endif if (height(ilon,ilat).eq.0)then f_CZ(ilon,ilat)=0 elseif(height(ilon,ilat).eq.-999)then f_CZ(ilon,ilat)=-999 else f_CZ(ilon,ilat)=100 endif if (lowtemp(ilon,ilat).gt.0)then f_CTL(ilon,ilat)=100 else f_CTL(ilon,ilat)=0 endif if (midtemp(ilon,ilat).gt.0)then f_CTM(ilon,ilat)=100 else f_CTM(ilon,ilat)=0 endif if (hightemp(ilon,ilat).gt.0)then f_CTH(ilon,ilat)=100 else f_CTH(ilon,ilat)=0 endif if (coltemp(ilon,ilat).gt.0)then f_CT(ilon,ilat)=100 else f_CT(ilon,ilat)=0 endif enddo enddo print *, 'creation fichier' call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'n_tot', NF90_INT4, dim, varid7)) call check(nf90_def_var(ncid, 'a_CAL', NF90_FLOAT, dim, varid1)) call check(nf90_def_var(ncid, 'a_CAM', NF90_FLOAT, dim, varid2)) call check(nf90_def_var(ncid, 'a_CAH', NF90_FLOAT, dim, varid3)) call check(nf90_def_var(ncid, 'a_CA', NF90_FLOAT, dim, varid4)) call check(nf90_def_var(ncid, 'a_CZ', NF90_FLOAT, dim, varid6)) call check(nf90_def_var(ncid, 'f_CAL', NF90_INT4, dim, varid8)) call check(nf90_def_var(ncid, 'f_CAM', NF90_INT4, dim, varid9)) call check(nf90_def_var(ncid, 'f_CAH', NF90_INT4, dim, varid10)) call check(nf90_def_var(ncid, 'f_CA', NF90_INT4, dim, varid11)) call check(nf90_def_var(ncid, 'f_CZ', NF90_INT4, dim, varid12)) call check(nf90_def_var(ncid, 'h_CAL', NF90_INT4, dim2, varid13)) call check(nf90_def_var(ncid, 'h_CAM', NF90_INT4, dim2, varid14)) call check(nf90_def_var(ncid, 'h_CAH', NF90_INT4, dim2, varid15)) call check(nf90_def_var(ncid, 'h_CA', NF90_INT4, dim2, varid16)) call check(nf90_def_var(ncid, 'h_CZ', NF90_INT4, dim3, varid17)) !!$call check(nf90_def_var(ncid, 'f_CTL', NF90_INT4, dim, varid18)) !!$call check(nf90_def_var(ncid, 'f_CTM', NF90_INT4, dim, varid19)) !!$call check(nf90_def_var(ncid, 'f_CTH', NF90_INT4, dim, varid20)) !!$call check(nf90_def_var(ncid, 'f_CT', NF90_INT4, dim, varid21)) !!$call check(nf90_def_var(ncid, 'h_CTL', NF90_INT4, dim4, varid23)) !!$call check(nf90_def_var(ncid, 'h_CTM', NF90_INT4, dim4, varid24)) !!$call check(nf90_def_var(ncid, 'h_CTH', NF90_INT4, dim4, varid25)) !!$call check(nf90_def_var(ncid, 'h_CT', NF90_INT4, dim4, varid26)) !!$ !!$call check(nf90_def_var(ncid, 'a_CTL', NF90_FLOAT, dim, varid27)) !!$call check(nf90_def_var(ncid, 'a_CTM', NF90_FLOAT, dim, varid28)) !!$call check(nf90_def_var(ncid, 'a_CTH', NF90_FLOAT, dim, varid29)) !!$call check(nf90_def_var(ncid, 'a_CT', NF90_FLOAT, dim, varid30)) call check(nf90_enddef(ncid)) print *, 'end def' call check(nf90_put_var(ncid, varid1, low)) call check(nf90_put_var(ncid, varid2, mid)) call check(nf90_put_var(ncid, varid3, high)) print *, 'file gewex1' call check(nf90_put_var(ncid, varid4, colcloud)) call check(nf90_put_var(ncid, varid6, height)) call check(nf90_put_var(ncid, varid7, indtot)) call check(nf90_put_var(ncid, varid8, f_CAL)) print *, 'file gewex1' call check(nf90_put_var(ncid, varid9, f_CAM)) call check(nf90_put_var(ncid, varid10, f_CAH)) call check(nf90_put_var(ncid, varid11, f_CA)) call check(nf90_put_var(ncid, varid12, f_CZ)) print *, 'file gewex1' call check(nf90_put_var(ncid, varid13, hlow )) call check(nf90_put_var(ncid, varid14, hmid )) call check(nf90_put_var(ncid, varid15, hhigh)) call check(nf90_put_var(ncid, varid16, hcol)) print *, 'file gewex1' call check(nf90_put_var(ncid, varid17, hheight)) print *, 'file gewex1' !!$ call check(nf90_put_var(ncid, varid18, f_CTL)) !!$ call check(nf90_put_var(ncid, varid19, f_CTM)) !!$ call check(nf90_put_var(ncid, varid20, f_CTH)) !!$ call check(nf90_put_var(ncid, varid21, f_CT)) ! call check(nf90_put_var(ncid, varid23, hlowtemp )) ! call check(nf90_put_var(ncid, varid24, hmidtemp )) ! call check(nf90_put_var(ncid, varid25, hhightemp)) ! call check(nf90_put_var(ncid, varid26, hcoltemp)) ! call check(nf90_put_var(ncid, varid27, lowtemp)) ! call check(nf90_put_var(ncid, varid28, midtemp)) ! call check(nf90_put_var(ncid, varid29, hightemp)) ! call check(nf90_put_var(ncid, varid30, coltemp)) call check(nf90_close(ncid)) endsubroutine map_recvar2nc5 !----------------------------------------------------------------------------! !----------------------------------------------------------------------------! ! *** CREATE_MAPNC *** This routine create a netcdf diag file, and its ! ! dimensions ! !----------------------------------------------------------------------------! ! fname : name of output netcdf diagSR file ! ! dname : period of diagSR file (description of ncdf file) ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! vlon : values of model longitude from 180 to -180 ! ! vlat : values of model latitude from 90 to -90 ! ! vprestop : values of model altitude ! ! vsrmod : values of model diag boxes ! ! alt : values of model altitude ! ! dim : dimension id of the diagSR var recorded in the ncdf ! ! files ! ! vtime : number of days since 2000/01/01 for the trimonthly perdiod, ! ! in day. ! !----------------------------------------------------------------------------! ! date : date from the real-system clock and has form yyyymmdd. ! ! time : time from the real-system clock and has form hhmmss.sss. ! ! zone : represente the difference with respect to Coordinated ! ! Universal Time (UTC), and has form (+-)hhmm. ! ! value : 8 dimension value which contains the year,month,day,hour, ! ! minute, seconds and milliseconds of the real-time. ! ! diagmax : values of SR diagbox ! ! ndims : dimension of dim (=5 : lon,lat,alt,diag,time) ! ! nc_id : netcdf file id ! ! lon_varid : variable id of longitude ! ! lat_varid : variable id of latitude ! ! pres_varid : variable id of altitude ! ! srmod_varid: variable id of diagsr ! ! time_varid : variable id of time ! ! lon_dimid : dimension id of longitude ! ! lat_dimid : dimension id of latitude ! ! pres_dimid : dimension id of altitude ! ! srmod_dimid: dimension id of srbox ! ! time_dimid : dimension id of time ! !----------------------------------------------------------------------------! ! ! ! ex : create_diagnc(file8,file9,lonmod,latmod,altmod,srmod,resd,dimidsd, ! ! altmax,lonmax,latmax) ! ! ! !----------------------------------------------------------------------------! subroutine create_diagnc(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound,vsrmod,vtime,dim,dim2,alt,& nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer :: nlon , nlat integer, parameter :: diagmax = 19, ndims = 5, nv=2 integer,dimension(8) :: value integer :: dim(ndims),dim2(ndims),alt,dim3(nv),dim4(nv),dim5(nv) integer :: lon_varid,lat_varid,alt_varid, srmod_varid,time_varid,srmod_varid2,srmod_varid3,srmod_varid4,nc_id,alt_varid2,srmod_varid33,srmod_varid44 integer :: lon_dimid,lat_dimid,alt_dimid,srmod_dimid,time_dimid,srmod_dimid2,srmod_dimid3,srmod_dimid4, nv_dimid,sr_dimid,sr_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real, dimension(diagmax) :: vsrmod real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound real, dimension(diagmax-1) :: vsrmod2 real, dimension(diagmax-1,2) :: vsrmod_bound vsrmod2(:)=0; vsrmod_bound(:,:)=0; vsrmod2(1)=-888 vsrmod2(2)=-777 do iz=3,diagmax-1 vsrmod2(iz) = (vsrmod(iz)+vsrmod(iz+1))/2 enddo vsrmod_bound(1,:)=-888 vsrmod_bound(2,:)=-777 vsrmod_bound(3,1)=-776 vsrmod_bound(3,2)=0 do iz=4,diagmax-1 vsrmod_bound(iz,1)=vsrmod(iz) vsrmod_bound(iz,2)=vsrmod(iz+1) enddo call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Histogram_of_Scattering_Ratio')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) call check(nf90_def_dim(nc_id, 'box', diagmax-4, srmod_dimid2 )) call check(nf90_def_dim(nc_id, 'box2', 3, srmod_dimid4 )) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, srmod_dimid2, time_dimid/) dim2 = (/lon_dimid, lat_dimid, alt_dimid, srmod_dimid4, time_dimid/) dim3 = (/alt_dimid, nv_dimid/) dim4 = (/srmod_dimid2, nv_dimid/) dim5 = (/srmod_dimid4, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim3, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'srbox_mid', NF90_FLOAT, srmod_dimid2, & srmod_varid2)) call check(nf90_put_att(nc_id, srmod_varid2, 'lon_name', & 'Middle Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, srmod_varid2, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, srmod_varid2, 'axis','I')) call check(nf90_def_var(nc_id, 'srbox_mid2', NF90_FLOAT, srmod_dimid4, & srmod_varid4)) call check(nf90_put_att(nc_id, srmod_varid4, 'lon_name', & 'Middle Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, srmod_varid4, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'srbox_bound', NF90_FLOAT, dim4, & srmod_varid33)) call check(nf90_put_att(nc_id, srmod_varid33, 'lon_name', & 'Boundarie Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, srmod_varid33, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'srbox_bound2', NF90_FLOAT, dim5, & srmod_varid44)) call check(nf90_put_att(nc_id, srmod_varid44, 'lon_name', & 'Boundarie Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, srmod_varid44, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, srmod_varid2, vsrmod2(4:18))) call check(nf90_put_var(nc_id, srmod_varid4, vsrmod2(1:3))) call check(nf90_put_var(nc_id, srmod_varid33, vsrmod_bound(4:18,:))) call check(nf90_put_var(nc_id, srmod_varid44, vsrmod_bound(1:3,:))) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_diagnc !----------------------------------------------------------------------------! subroutine create_diagncpha(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound,vsrmod,vtime,dim,dim2,alt,& nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer :: nlon , nlat integer, parameter :: diagmax = 19, ndims = 5, nv=2 integer,dimension(8) :: value integer :: dim(ndims),dim2(ndims),alt,dim3(nv),dim4(nv),dim5(nv) integer :: lon_varid,lat_varid,alt_varid, srmod_varid,time_varid,srmod_varid2,srmod_varid3,srmod_varid4,nc_id,alt_varid2,srmod_varid33,srmod_varid44 integer :: lon_dimid,lat_dimid,alt_dimid,srmod_dimid,time_dimid,srmod_dimid2,srmod_dimid3,srmod_dimid4, nv_dimid,sr_dimid,sr_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real, dimension(diagmax) :: vsrmod real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound real, dimension(diagmax-8) :: vsrmod2 real, dimension(diagmax-8,2) :: vsrmod_bound vsrmod2(:)=0; vsrmod_bound(:,:)=0; do iz=8,diagmax-1 vsrmod2(iz-7) = (vsrmod(iz)+vsrmod(iz+1))/2 enddo do iz=8,diagmax-1 vsrmod_bound(iz-7,1)=vsrmod(iz) vsrmod_bound(iz-7,2)=vsrmod(iz+1) enddo print *, "srmod creer" call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Phase_Histogram_of_Scattering_Ratio')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) call check(nf90_def_dim(nc_id, 'box', diagmax-8, srmod_dimid2 )) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, srmod_dimid2, time_dimid/) dim3 = (/alt_dimid, nv_dimid/) dim4 = (/srmod_dimid2, nv_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim3, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'srbox_mid', NF90_FLOAT, srmod_dimid2, & srmod_varid2)) call check(nf90_put_att(nc_id, srmod_varid2, 'lon_name', & 'Middle Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, srmod_varid2, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, srmod_varid2, 'axis','I')) call check(nf90_def_var(nc_id, 'srbox_bound', NF90_FLOAT, dim4, & srmod_varid33)) call check(nf90_put_att(nc_id, srmod_varid33, 'lon_name', & 'Boundarie Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, srmod_varid33, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) print *, 'titi' call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) print *, 'titi' call check(nf90_put_var(nc_id, srmod_varid2, vsrmod2)) call check(nf90_put_var(nc_id, srmod_varid33, vsrmod_bound)) print *, 'titi' call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_diagncpha !----------------------------------------------------------------------------! subroutine create_diagnc2(fname,dname,vlon,vlat,vprestop,vsrmod,vtime,dim2,alt,& nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer :: nlon , nlat integer, parameter :: diagmax = 19, ndims = 4 integer,dimension(8) :: value integer :: dim2(ndims),alt integer :: lon_varid,lat_varid,pres_varid, srmod_varid,time_varid,nc_id integer :: lon_dimid,lat_dimid,pres_dimid,srmod_dimid,time_dimid,srmod_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real, dimension(diagmax) :: vsrmod real,dimension(alt) :: vprestop real, dimension(diagmax-1) :: vsrmod2 vsrmod2=vsrmod(2:19) call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Histogram_of_Scattering_Ratio')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, pres_dimid)) call check(nf90_def_dim(nc_id, 'box2', diagmax-1, srmod_dimid2 )) call check(nf90_def_dim(nc_id, 'box', diagmax, srmod_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) ! dim = (/lon_dimid, lat_dimid, pres_dimid, srmod_dimid, time_dimid/) dim2 = (/lon_dimid, lat_dimid, pres_dimid, time_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'altitude', NF90_FLOAT, pres_dimid, pres_varid)) call check(nf90_put_att(nc_id, pres_varid, 'lon_name','Altitude')) call check(nf90_put_att(nc_id, pres_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, pres_varid, 'positive','up')) call check(nf90_put_att(nc_id, pres_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'srbox', NF90_FLOAT, srmod_dimid, & srmod_varid)) call check(nf90_put_att(nc_id, srmod_varid, 'lon_name', & 'Scattering Ratio Value')) call check(nf90_put_att(nc_id, srmod_varid, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, srmod_varid, 'axis','I')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, pres_varid, vprestop)) call check(nf90_put_var(nc_id, srmod_varid, vsrmod)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_diagnc2 !----------------------------------------------------------------------------! subroutine create_depolnc2(fname,dname,vlon,vlat,vprestop,vsrmod,vdepolmod,vtime,dim2,alt,& nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer :: nlon , nlat integer, parameter :: diagmax = 17, ndims = 5, depolmax = 21 integer,dimension(8) :: value integer :: dim2(ndims),alt integer :: lon_varid,lat_varid,pres_varid, srmod_varid,time_varid,nc_id, depolmod_varid integer :: lon_dimid,lat_dimid,pres_dimid,srmod_dimid,time_dimid,srmod_dimid2, depolmod_dimid, depolmod_dimid2 real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real, dimension(diagmax) :: vsrmod real, dimension(depolmax) :: vdepolmod real,dimension(alt) :: vprestop real, dimension(diagmax-1) :: vsrmod2 real, dimension(depolmax-1) :: vdepolmod2 vsrmod2=vsrmod(2:17) vdepolmod2=vdepolmod(2:21) call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Histogram_of_Depolarization_Ratio')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, pres_dimid)) call check(nf90_def_dim(nc_id, 'srbox2', diagmax-1, srmod_dimid2 )) call check(nf90_def_dim(nc_id, 'srbox', diagmax, srmod_dimid)) call check(nf90_def_dim(nc_id, 'depolbox2', depolmax-1, depolmod_dimid2 )) call check(nf90_def_dim(nc_id, 'depolbox', depolmax, depolmod_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) ! dim = (/lon_dimid, lat_dimid, pres_dimid, srmod_dimid, time_dimid/) dim2 = (/lon_dimid, lat_dimid, pres_dimid, srmod_dimid, time_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'altitude', NF90_FLOAT, pres_dimid, pres_varid)) call check(nf90_put_att(nc_id, pres_varid, 'lon_name','Altitude')) call check(nf90_put_att(nc_id, pres_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, pres_varid, 'positive','up')) call check(nf90_put_att(nc_id, pres_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'srbox', NF90_FLOAT, srmod_dimid, & srmod_varid)) call check(nf90_put_att(nc_id, srmod_varid, 'lon_name', & 'Scattering Ratio Value')) call check(nf90_put_att(nc_id, srmod_varid, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, srmod_varid, 'axis','I')) call check(nf90_def_var(nc_id, 'depolbox', NF90_FLOAT, depolmod_dimid, & depolmod_varid)) call check(nf90_put_att(nc_id, depolmod_varid, 'lon_name', & 'Depolarization Ratio Value')) call check(nf90_put_att(nc_id, depolmod_varid, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, depolmod_varid, 'axis','I')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, pres_varid, vprestop)) call check(nf90_put_var(nc_id, srmod_varid, vsrmod)) call check(nf90_put_var(nc_id, depolmod_varid, vdepolmod)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_depolnc2 !----------------------------------------------------------------------------! subroutine create_depolnc(fname,dname,vlon,vlat,vprestop,vsrmod,vdepolmod,vtime,dim,alt,& nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer :: nlon , nlat integer, parameter :: diagmax = 17, ndims = 6, depolmax = 21 integer,dimension(8) :: value integer :: dim(ndims),dim2(ndims-1),alt integer :: lon_varid,lat_varid,pres_varid, srmod_varid,time_varid,nc_id, depolmod_varid integer :: lon_dimid,lat_dimid,pres_dimid,srmod_dimid,time_dimid,srmod_dimid2, depolmod_dimid2, depolmod_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real, dimension(diagmax) :: vsrmod real, dimension(depolmax) :: vdepolmod real,dimension(alt) :: vprestop real, dimension(diagmax-1) :: vsrmod2 real, dimension(depolmax-1) :: vdepolmod2 vsrmod2=vsrmod(2:17) vdepolmod2=vdepolmod(2:21) call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Histogram_of_Depolarization_Ratio')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, pres_dimid)) call check(nf90_def_dim(nc_id, 'srbox2', diagmax-1, srmod_dimid2 )) call check(nf90_def_dim(nc_id, 'srbox', diagmax, srmod_dimid)) call check(nf90_def_dim(nc_id, 'depolbox2', depolmax-1, depolmod_dimid2 )) call check(nf90_def_dim(nc_id, 'depolbox', depolmax, depolmod_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, pres_dimid, srmod_dimid2, depolmod_dimid2, time_dimid/) ! dim2 = (/lon_dimid, lat_dimid, pres_dimid, time_dimid/) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'altitude', NF90_FLOAT, pres_dimid, pres_varid)) call check(nf90_put_att(nc_id, pres_varid, 'lon_name','Altitude')) call check(nf90_put_att(nc_id, pres_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, pres_varid, 'positive','up')) call check(nf90_put_att(nc_id, pres_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'srbox', NF90_FLOAT, srmod_dimid, & srmod_varid)) call check(nf90_put_att(nc_id, srmod_varid, 'lon_name', & 'Scattering Ratio Value')) call check(nf90_put_att(nc_id, srmod_varid, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, srmod_varid, 'axis','I')) call check(nf90_def_var(nc_id, 'depolbox', NF90_FLOAT, depolmod_dimid, & depolmod_varid)) call check(nf90_put_att(nc_id, depolmod_varid, 'lon_name', & 'Depolarization Ratio Value')) call check(nf90_put_att(nc_id, depolmod_varid, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, depolmod_varid, 'axis','I')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, pres_varid, vprestop)) call check(nf90_put_var(nc_id, srmod_varid, vsrmod)) call check(nf90_put_var(nc_id, depolmod_varid, vdepolmod)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_depolnc !----------------------------------------------------------------------------! subroutine create_diagPHAnc(fname,dname,vlon,vlat,vprestop_mid,vprestop_bound,vtempmod,vtime,dim,alt,& nlon,nlat) use netcdf implicit none character(LEN=*) :: fname,dname character :: date*8,time*10,zone*5 integer :: nlon , nlat, iz integer, parameter :: tempmax = 35, ndims = 6, nv=2, ncat=3 integer,dimension(8) :: value integer :: dim(ndims),alt,dim3(nv),dim4(nv),dim5(nv) integer :: lon_varid,lat_varid,alt_varid, tempmod_varid,time_varid,tempmod_varid2,srmod_varid3,srmod_varid4,nc_id,alt_varid2,srmod_varid33,srmod_varid44,cat_varid integer :: lon_dimid,lat_dimid,alt_dimid,tempmod_dimid,time_dimid,tempmod_dimid2,srmod_dimid3,srmod_dimid4, nv_dimid,sr_dimid,sr_dimid2, cat_dimid real :: vtime real*4, dimension(nlon) :: vlon real*4, dimension(nlat) :: vlat real, dimension(tempmax-1) :: vtempmid real, dimension(tempmax) :: vtempmod real, dimension(tempmax-1,2) :: vtempmod2 real,dimension(alt) :: vprestop_mid real,dimension(alt,2) :: vprestop_bound character(len=3),dimension(ncat,ncat) :: vcat vcat(1,:)='LIQ' vcat(2,:)='ICE' vcat(3,:)='VAP' do iz=1,tempmax-1 vtempmod2(iz,1)=vtempmod(iz) vtempmod2(iz,2)=vtempmod(iz+1) vtempmid(iz)=(vtempmod(iz)+vtempmod(iz+1))/2 enddo call date_and_time(date,time,zone,value) call check(nf90_create('/homedata/mreverdy/GOCCP/'//fname, NF90_CLOBBER, & nc_id)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Description','GOCCP_Histogram_of_Phase_file')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Date',dname)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Version','Prog_version')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Author', & 'Gregory CESANA, Helene CHEPFER, LMD/IPSL')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Scientific_contact', & 'helene.chepfer@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Technical_support', & 'gregory.cesana@lmd.polytechnique.fr')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Creationdate',date)) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'Website', & 'http://climserv.ipsl.polytechnique.fr/cfmip-obs.html')) call check(nf90_put_att(nc_id, NF90_GLOBAL, 'References', & 'Chepfer et al, 2010, The GCM Oriented CALIPSO Cloud Product (CALIPSO-GOCCP), JGR, 105')) call check(nf90_def_dim(nc_id, 'longitude', nlon, lon_dimid)) call check(nf90_def_dim(nc_id, 'latitude', nlat, lat_dimid)) call check(nf90_def_dim(nc_id, 'altitude', alt, alt_dimid)) call check(nf90_def_dim(nc_id, 'tempbox', tempmax-1, tempmod_dimid )) call check(nf90_def_dim(nc_id, 'cat', ncat, cat_dimid)) call check(nf90_def_dim(nc_id, 'nv', nv, nv_dimid)) call check(nf90_def_dim(nc_id, 'time', NF90_UNLIMITED, time_dimid)) dim = (/lon_dimid, lat_dimid, alt_dimid, tempmod_dimid, cat_dimid, time_dimid/) dim3 = (/alt_dimid, nv_dimid/) dim4 = (/tempmod_dimid, nv_dimid/) dim5 = (/cat_dimid, cat_dimid /) call check(nf90_def_var(nc_id, 'longitude', NF90_FLOAT, lon_dimid, lon_varid)) call check(nf90_put_att(nc_id, lon_varid, 'lon_name','Longitude')) call check(nf90_put_att(nc_id, lon_varid, 'units','degrees_east')) call check(nf90_put_att(nc_id, lon_varid, 'axis','X')) call check(nf90_def_var(nc_id, 'latitude', NF90_FLOAT, lat_dimid, lat_varid)) call check(nf90_put_att(nc_id, lat_varid, 'lon_name','Latitude')) call check(nf90_put_att(nc_id, lat_varid, 'units','degrees_north')) call check(nf90_put_att(nc_id, lat_varid, 'axis','Y')) call check(nf90_def_var(nc_id, 'alt_mid', NF90_FLOAT, alt_dimid, alt_varid)) call check(nf90_put_att(nc_id, alt_varid, 'lon_name','Middle of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid, 'units','kilometer')) call check(nf90_put_att(nc_id, alt_varid, 'positive','up')) call check(nf90_put_att(nc_id, alt_varid, 'axis','Z')) call check(nf90_def_var(nc_id, 'alt_bound', NF90_FLOAT, dim3, alt_varid2)) call check(nf90_put_att(nc_id, alt_varid2, 'lon_name','Boundaries of the altitude bin')) call check(nf90_put_att(nc_id, alt_varid2, 'units','kilometer')) call check(nf90_def_var(nc_id, 'temp_mid', NF90_FLOAT, tempmod_dimid, & tempmod_varid)) call check(nf90_put_att(nc_id, tempmod_varid, 'lon_name', & 'Middle Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, tempmod_varid, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, tempmod_varid, 'axis','I')) call check(nf90_def_var(nc_id, 'temp_bound', NF90_FLOAT, dim4, & tempmod_varid2)) call check(nf90_put_att(nc_id, tempmod_varid2, 'lon_name', & 'Middle Value of Scattering Ratio Boxes')) call check(nf90_put_att(nc_id, tempmod_varid2, 'units','Arbitrary unit')) call check(nf90_put_att(nc_id, tempmod_varid2, 'axis','I')) call check(nf90_def_var(nc_id, 'category', NF90_CHAR, dim5, cat_varid)) call check(nf90_put_att(nc_id, cat_varid, 'lon_name','Category')) call check(nf90_put_att(nc_id, cat_varid, 'units','Arbitrary unit')) call check(nf90_def_var(nc_id, 'time', NF90_FLOAT, time_dimid, time_varid)) call check(nf90_put_att(nc_id, time_varid, 'lon_name','Time')) call check(nf90_put_att(nc_id, time_varid, 'units', & 'days since 2000-01-01 00:00:00')) call check(nf90_put_att(nc_id, time_varid, 'axis','T')) call check(nf90_put_att(nc_id, time_varid, 'comment', & 'monthly means: date is set to the 15th of the month')) call check(nf90_enddef(nc_id)) call check(nf90_put_var(nc_id, lon_varid, vlon)) call check(nf90_put_var(nc_id, lat_varid, vlat)) call check(nf90_put_var(nc_id, alt_varid, vprestop_mid)) call check(nf90_put_var(nc_id, alt_varid2, vprestop_bound)) call check(nf90_put_var(nc_id, tempmod_varid, vtempmid)) call check(nf90_put_var(nc_id, tempmod_varid2, vtempmod2)) call check(nf90_put_var(nc_id, cat_varid, vcat)) call check(nf90_put_var(nc_id, time_varid, vtime)) call check(nf90_close(nc_id)) end subroutine create_diagPHAnc !----------------------------------------------------------------------------! subroutine diagPHA_recvar2nc3(diagpha,dim,fname,alt,nlon,nlat) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: tempmax = 34, ndims = 6 integer :: dim(ndims),alt integer :: varid, varid2, ncid character(LEN=*) :: fname real,dimension(nlon,nlat,alt,tempmax,3) :: diagpha call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidarPHASE', NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar ICE/LIQUID/VAPOR Phase occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diagpha(:,:,:,:,:))) call check(nf90_close(ncid)) end subroutine diagPHA_recvar2nc3 !----------------------------------------------------------------------------! ! *** DIAG_RECVAR2NC *** This routine record the diag variables in the netcdf! ! prof file ! !----------------------------------------------------------------------------! ! fname : name of output netcdf diagSR file ! ! diag : diagSR variable ! ! dim : dimension id of the isccp variables ! ! nlon : number of the longitude boxes ! ! nlat : number of the latitude boxes ! ! alt : number of model altitude ! !----------------------------------------------------------------------------! ! nan : Not a Number value ! ! diagmax : number of SR diagbox ! ! ndims : dimension of dim (= 5 : lon,lat,alt,diagbox,time) ! ! ncid : netcdf file id ! ! varid : variable id of diagSR ! !----------------------------------------------------------------------------! ! ! ! ex : diag_recvar2nc(monthdiagSR,dimidsd,file8,altmax,lonmax,latmax) ! ! ! !----------------------------------------------------------------------------! subroutine diag_recvar2nc(diag,diag1,dim,dim2,fname,alt,nlon,nlat) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: diagmax = 15, ndims = 5 integer :: dim(ndims), dim2(ndims-1),alt integer :: varid,varid2, ncid character(LEN=*) :: fname real*4,dimension(nlon,nlat,alt,diagmax) :: diag real*4,dimension(nlon,nlat,alt) :: diag1 call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_Occ', NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Number of Scattering Ratio occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_def_var(ncid, 'negdiagSR_Occ', NF90_FLOAT, dim2, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'Number of Scattering Ratio occurence accumulated over a month')) call check(nf90_put_att(ncid, varid2, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag)) call check(nf90_put_var(ncid, varid2, diag1)) call check(nf90_close(ncid)) end subroutine diag_recvar2nc !----------------------------------------------------------------------------! subroutine diag_recvar2nc2(diag,dim,fname,alt,nlon,nlat) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: diagmax = 16, ndims = 5 integer :: dim(ndims), alt integer :: varid, ncid character(LEN=*) :: fname real*8,dimension(nlon,nlat,alt,diagmax) :: diag ! real*4,dimension(nlon,nlat,alt) :: diag1 call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_Frac', NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) Fraction of occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','1 fraction')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag)) call check(nf90_close(ncid)) end subroutine diag_recvar2nc2 !----------------------------------------------------------------------------! subroutine diag_recvar2nc3(diag,dim,dim2,fname,alt,nlon,nlat) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: diagmax = 18, ndims = 5 integer :: dim(ndims),dim2(ndims),alt integer :: varid, varid2, ncid character(LEN=*) :: fname real,dimension(nlon,nlat,alt,diagmax) :: diag call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_Occ', NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_Occ2', NF90_FLOAT, dim2, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid2, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag(:,:,:,4:18))) call check(nf90_put_var(ncid, varid2, diag(:,:,:,1:3))) call check(nf90_close(ncid)) end subroutine diag_recvar2nc3 !----------------------------------------------------------------------------! subroutine diag_recvar2nc3pha(diag,dim,dim2,fname,alt,nlon,nlat) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999. integer, parameter :: diagmax = 11, ndims = 5 integer :: dim(ndims),dim2(ndims),alt integer :: varid, varid2, varid3, ncid character(LEN=*) :: fname real,dimension(nlon,nlat,alt,diagmax,3) :: diag call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_liq', NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_ice', NF90_FLOAT, dim, varid2)) call check(nf90_put_att(ncid, varid2, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid2, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid2, '_FillValue',nan)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_un', NF90_FLOAT, dim, varid3)) call check(nf90_put_att(ncid, varid3, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid3, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid3, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag(:,:,:,:,1))) call check(nf90_put_var(ncid, varid2, diag(:,:,:,:,2))) call check(nf90_put_var(ncid, varid3, diag(:,:,:,:,3))) call check(nf90_close(ncid)) end subroutine diag_recvar2nc3pha !----------------------------------------------------------------------------! subroutine depol_recvar2nc3(diag,dim,fname,alt,nlon,nlat) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: diagmax = 17, ndims = 6, depolmax = 21 integer :: dim(ndims),alt integer :: varid, ncid character(LEN=*) :: fname real*8,dimension(nlon,nlat,alt,diagmax-1,depolmax-1) :: diag call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidardepol532_Occ', NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar Depolarization Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag)) call check(nf90_close(ncid)) end subroutine depol_recvar2nc3 !----------------------------------------------------------------------------! subroutine diag_recvar2nc4(diag,dim,fname,alt,nlon,nlat,ndiag) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: diagmax = 18, ndims = 4 integer :: dim(ndims),alt integer :: varid, ncid character(LEN=*) :: fname character :: ndiag*2 integer,dimension(nlon,nlat,alt) :: diag print *, 'monthdiagSR_Occ'// trim(ADJUSTL(ndiag)) call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidarsr532_Occ'//trim(ADJUSTL(ndiag)), NF90_INT4, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar Scattering Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag)) call check(nf90_close(ncid)) end subroutine diag_recvar2nc4 !----------------------------------------------------------------------------! subroutine depol_recvar2nc4(diag,dim,fname,alt,nlon,nlat,ndiag) use netcdf implicit none integer :: nlon , nlat real,parameter :: nan=-9999 integer, parameter :: diagmax = 16, ndims = 5 integer :: dim(ndims),alt integer :: varid, ncid character(LEN=*) :: fname character :: ndiag*2 real*8,dimension(nlon,nlat,alt,diagmax) :: diag print *, 'monthdepolSR_Occ'// trim(ADJUSTL(ndiag)) call check(nf90_open('/homedata/mreverdy/GOCCP/'//fname,NF90_WRITE,ncid)) call check(nf90_redef(ncid)) call check(nf90_def_var(ncid, 'cfad_lidardepol532_Occ'//trim(ADJUSTL(ndiag)), NF90_FLOAT, dim, varid)) call check(nf90_put_att(ncid, varid, 'lon_name', & 'Lidar Depolarization Ratio CFAD (532nm) occurence accumulated over a month')) call check(nf90_put_att(ncid, varid, 'units','Arbitrary unit')) call check(nf90_put_att(ncid, varid, '_FillValue',nan)) call check(nf90_enddef(ncid)) call check(nf90_put_var(ncid, varid, diag)) call check(nf90_close(ncid)) end subroutine depol_recvar2nc4 !----------------------------------------------------------------------------! subroutine rdnc3(fname,var,alt,nlon,nlat,nvar) use netcdf implicit none character(len=*) :: nvar, fname integer :: ncid,varid integer :: nlon , nlat, alt integer,dimension(nlon,nlat,alt) :: var print *, nvar call check(NF90_OPEN(fname,NF90_NOWRITE,ncid)) call check(NF90_inq_varid(ncid,nvar,varid)) call check(NF90_get_var(ncid,varid,var)) call check(NF90_CLOSE(ncid)) ! call rdnc3('/homedata/mreverdy/GOCCP/'//trim(file7)//'.tmp',monthdiagSR1,'monthdiagSR_Occ'//trim(adjustl(idiagc))) end subroutine rdnc3 subroutine rdnc4(fname,var,alt,nlon,nlat,nvar) use netcdf implicit none character(len=*) :: nvar, fname integer :: ncid,varid integer, parameter :: diagmax = 17 integer :: nlon , nlat, alt real*8,dimension(nlon,nlat,alt,diagmax-1) :: var print *, nvar call check(NF90_OPEN(fname,NF90_NOWRITE,ncid)) call check(NF90_inq_varid(ncid,nvar,varid)) call check(NF90_get_var(ncid,varid,var)) call check(NF90_CLOSE(ncid)) ! call rdnc3('/homedata/mreverdy/GOCCP/'//trim(file7)//'.tmp',monthdiagSR1,'monthdiagSR_Occ'//trim(adjustl(idiagc))) end subroutine rdnc4 !****************************************************************************! end program A-GCM !****************************************************************************! ! ! ! END PROGRAM ! ! ! !****************************************************************************!
bsd-2-clause
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/function_types_2.f90
155
1574
! { dg-do compile } ! Tests the fix for PR34431 in which function TYPEs that were ! USE associated would cause an error. ! ! Contributed by Tobias Burnus <burnus@gcc.gnu.org> ! module m1 integer :: hh type t real :: r end type t end module m1 module m2 type t integer :: k end type t end module m2 module m3 contains type(t) function func() use m2 func%k = 77 end function func end module m3 type(t) function a() use m1, only: hh type t2 integer :: j end type t2 type t logical :: b end type t a%b = .true. end function a type(t) function b() use m1, only: hh use m2 use m3 b = func () b%k = 5 end function b type(t) function c() use m1, only: hh type t2 integer :: j end type t2 type t logical :: b end type t c%b = .true. end function c program main type t integer :: m end type t contains type(t) function a1() use m1, only: hh type t2 integer :: j end type t2 type t logical :: b end type t a1%b = .true. end function a1 type(t) function b1() use m1, only: hh use m2, only: t ! NAG f95 believes that the host-associated type(t) ! should be used: ! b1%m = 5 ! However, I (Tobias Burnus) believe that the use-associated one should ! be used: b1%k = 5 end function b1 type(t) function c1() use m1, only: hh type t2 integer :: j end type t2 type t logical :: b end type t c1%b = .true. end function c1 type(t) function d1() d1%m = 55 end function d1 end program main
gpl-2.0
allr/r-instrumented
src/appl/dqrutl.f
48
1909
c dqr Utilities: Interface to the different "switches" of dqrsl(). c subroutine dqrqty(x, n, k, qraux, y, ny, qty) integer n, k, ny double precision x(n,k), qraux(k), y(n,ny), qty(n,ny) integer info, j double precision dummy(1) do 10 j = 1,ny call dqrsl(x, n, n, k, qraux, y(1,j), dummy, qty(1,j), & dummy, dummy, dummy, 1000, info) 10 continue return end c subroutine dqrqy(x, n, k, qraux, y, ny, qy) integer n, k, ny double precision x(n,k), qraux(k), y(n,ny), qy(n,ny) integer info, j double precision dummy(1) do 10 j = 1,ny call dqrsl(x, n, n, k, qraux, y(1,j), qy(1,j), & dummy, dummy, dummy, dummy, 10000, info) 10 continue return end c subroutine dqrcf(x, n, k, qraux, y, ny, b, info) integer n, k, ny, info double precision x(n,k), qraux(k), y(n,ny), b(k,ny) integer j double precision dummy(1) do 10 j = 1,ny call dqrsl(x, n, n, k, qraux, y(1,j), dummy, & y(1,j), b(1,j), dummy, dummy, 100, info) 10 continue return end c subroutine dqrrsd(x, n, k, qraux, y, ny, rsd) integer n, k, ny double precision x(n,k), qraux(k), y(n,ny), rsd(n,ny) integer info, j double precision dummy(1) do 10 j = 1,ny call dqrsl(x, n, n, k, qraux, y(1,j), dummy, & y(1,j), dummy, rsd(1,j), dummy, 10, info) 10 continue return end c subroutine dqrxb(x, n, k, qraux, y, ny, xb) integer n, k, ny double precision x(n,k), qraux(k), y(n,ny), xb(n,ny) integer info, j double precision dummy(1) do 10 j = 1,ny call dqrsl(x, n, n, k, qraux, y(1,j), dummy, & y(1,j), dummy, dummy, xb(1,j), 1, info) 10 continue return end
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/read_no_eor.f90
166
1468
! { dg-do run } ! Handle eor and eof conditions with missing eor in file. ! Test case modified from case presented by Ian Harvey on clf. program eieio_stat use, intrinsic :: iso_fortran_env, only: iostat_end, iostat_eor implicit none integer, parameter :: unit=10 integer :: ios1, ios2, ios3 character(25) :: buffer character(100) :: themessage !**** open(10,file="eieio", form="unformatted", access="stream", status="replace") write(10) "Line-1" // char(10) write(10) "Line-2" close(10) open(10,file="eieio") buffer = 'abcdefg' read (unit,"(a)",advance="no",iostat=ios1, pad="yes") buffer if (ios1 /= iostat_eor .and. buffer /= "Line-1") call abort buffer = '<' read (unit,"(a)",advance="no",iostat=ios2,pad="yes") buffer if (ios2 /= iostat_eor .and. buffer /= "Line-2") call abort buffer = '5678' read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer if (ios3 /= iostat_end .and. buffer /= "5678") call abort rewind(10) buffer = "abcdefg" read (unit,"(a)",advance="no",iostat=ios1, pad="no") buffer if (ios1 /= iostat_eor .and. buffer /= "abcdefg") call abort buffer = '<' read (unit,"(a)",advance="no",iostat=ios2,pad="no") buffer if (ios2 /= iostat_eor .and. buffer /= "<") call abort buffer = '1234' read (unit,"(a)",advance="no",iostat=ios3, iomsg=themessage) buffer if (ios3 <= 0 .and. buffer /= "1234") call abort close(unit, status="delete") end program eieio_stat
gpl-2.0
scrim-network/BRICK
fortran/src/mt19937ar.f90
2
10196
! A C-program for MT19937, with initialization improved 2002/1/26. ! Coded by Takuji Nishimura and Makoto Matsumoto. ! Code converted to Fortran 95 by Josi Rui Faustino de Sousa ! Date: 2002-02-01 ! Before using, initialize the state by using init_genrand(seed) ! or init_by_array(init_key, key_length). ! This library is free software. ! This library is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! Copyright (C) 1997, 2002 Makoto Matsumoto and Takuji Nishimura. ! Any feedback is very welcome. ! http://www.math.keio.ac.jp/matumoto/emt.html ! email: matumoto@math.keio.ac.jp module mt19937 implicit none intrinsic :: bit_size private public :: init_genrand, init_by_array public :: genrand_int32, genrand_int31 public :: genrand_real1, genrand_real2, genrand_real3, genrand_res53 integer, parameter :: intg = selected_int_kind( 9 ) integer, parameter :: long = selected_int_kind( 18 ) integer, parameter :: flot = selected_real_kind( 6, 37 ) integer, parameter :: dobl = selected_real_kind( 15, 307 ) integer, public, parameter :: wi = intg integer, public, parameter :: wl = long integer, public, parameter :: wr = dobl ! Period parameters integer( kind = wi ), parameter :: n = 624_wi integer( kind = wi ), parameter :: m = 397_wi integer( kind = wi ), parameter :: hbs = bit_size( n ) / 2_wi integer( kind = wi ), parameter :: qbs = hbs / 2_wi integer( kind = wi ), parameter :: tbs = 3_wi * qbs integer( kind = wi ) :: mt(n) ! the array for the state vector logical( kind = wi ) :: mtinit = .false._wi ! means mt[N] is not initialized integer( kind = wi ) :: mti = n + 1_wi ! mti==N+1 means mt[N] is not initialized contains elemental function uiadd( a, b ) result( c ) implicit none intrinsic :: ibits, ior, ishft integer( kind = wi ), intent( in ) :: a, b integer( kind = wi ) :: c integer( kind = wi ) :: a1, a2, b1, b2, s1, s2 a1 = ibits( a, 0, hbs ) a2 = ibits( a, hbs, hbs ) b1 = ibits( b, 0, hbs ) b2 = ibits( b, hbs, hbs ) s1 = a1 + b1 s2 = a2 + b2 + ibits( s1, hbs, hbs ) c = ior( ishft( s2, hbs ), ibits( s1, 0, hbs ) ) end function uiadd elemental function uisub( a, b ) result( c ) implicit none intrinsic :: ibits, ior, ishft integer( kind = wi ), intent( in ) :: a, b integer( kind = wi ) :: c integer( kind = wi ) :: a1, a2, b1, b2, s1, s2 a1 = ibits( a, 0, hbs ) a2 = ibits( a, hbs, hbs ) b1 = ibits( b, 0, hbs ) b2 = ibits( b, hbs, hbs ) s1 = a1 - b1 s2 = a2 - b2 + ibits( s1, hbs, hbs ) c = ior( ishft( s2, hbs ), ibits( s1, 0, hbs ) ) end function uisub elemental function uimlt( a, b ) result( c ) implicit none intrinsic :: ibits, ior, ishft integer( kind = wi ), intent( in ) :: a, b integer( kind = wi ) :: c integer( kind = wi ) :: a0, a1, a2, a3 integer( kind = wi ) :: b0, b1, b2, b3 integer( kind = wi ) :: p0, p1, p2, p3 a0 = ibits( a, 0, qbs ) a1 = ibits( a, qbs, qbs ) a2 = ibits( a, hbs, qbs ) a3 = ibits( a, tbs, qbs ) b0 = ibits( b, 0, qbs ) b1 = ibits( b, qbs, qbs ) b2 = ibits( b, hbs, qbs ) b3 = ibits( b, tbs, qbs ) p0 = a0 * b0 p1 = a1 * b0 + a0 * b1 + ibits( p0, qbs, tbs ) p2 = a2 * b0 + a1 * b1 + a0 * b2 + ibits( p1, qbs, tbs ) p3 = a3 * b0 + a2 * b1 + a1 * b2 + a0 * b3 + ibits( p2, qbs, tbs ) c = ior( ishft( p1, qbs ), ibits( p0, 0, qbs ) ) c = ior( ishft( p2, hbs ), ibits( c, 0, hbs ) ) c = ior( ishft( p3, tbs ), ibits( c, 0, tbs ) ) end function uimlt ! initializes mt[N] with a seed subroutine init_genrand( s ) implicit none intrinsic :: iand, ishft, ieor, ibits integer( kind = wi ), intent( in ) :: s integer( kind = wi ) :: i, mult_a data mult_a /z'6C078965'/ mtinit = .true._wi mt(1) = ibits( s, 0, 32 ) do i = 2, n, 1 mt(i) = ieor( mt(i-1), ishft( mt(i-1), -30 ) ) mt(i) = uimlt( mt(i), mult_a ) mt(i) = uiadd( mt(i), uisub( i, 1_wi ) ) ! See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. ! In the previous versions, MSBs of the seed affect ! only MSBs of the array mt[]. ! 2002/01/09 modified by Makoto Matsumoto mt(i) = ibits( mt(i), 0, 32 ) ! for >32 bit machines end do end subroutine init_genrand ! initialize by an array with array-length ! init_key is the array for initializing keys ! key_length is its length subroutine init_by_array( init_key ) implicit none intrinsic :: iand, ishft, ieor integer( kind = wi ), intent( in ) :: init_key(:) integer( kind = wi ) :: i, j, k, tp, key_length integer( kind = wi ) :: seed_d, mult_a, mult_b, msb1_d data seed_d /z'12BD6AA'/ data mult_a /z'19660D'/ data mult_b /z'5D588B65'/ data msb1_d /z'80000000'/ key_length = size( init_key, dim = 1 ) call init_genrand( seed_d ) i = 2_wi j = 1_wi do k = max( n, key_length ), 1, -1 tp = ieor( mt(i-1), ishft( mt(i-1), -30 ) ) tp = uimlt( tp, mult_a ) mt(i) = ieor( mt(i), tp ) mt(i) = uiadd( mt(i), uiadd( init_key(j), uisub( j, 1_wi ) ) ) !non linear mt(i) = ibits( mt(i), 0, 32 ) ! for WORDSIZE > 32 machines i = i + 1_wi j = j + 1_wi if ( i > n ) then mt(1) = mt(n) i = 2_wi end if if ( j > key_length) j = 1_wi end do do k = n-1, 1, -1 tp = ieor( mt(i-1), ishft( mt(i-1), -30 ) ) tp = uimlt( tp, mult_b ) mt(i) = ieor( mt(i), tp ) mt(i) = uisub( mt(i), uisub( i, 1_wi ) ) ! non linear mt(i) = ibits( mt(i), 0, 32 ) ! for WORDSIZE > 32 machines i = i + 1_wi if ( i > n ) then mt(1) = mt(n) i = 2_wi end if end do mt(1) = msb1_d ! MSB is 1; assuring non-zero initial array end subroutine init_by_array ! generates a random number on [0,0xffffffff]-interval function genrand_int32( ) result( y ) implicit none intrinsic :: iand, ishft, ior, ieor, btest, ibset, mvbits integer( kind = wi ) :: y integer( kind = wi ) :: kk integer( kind = wi ) :: seed_d, matrix_a, matrix_b, temper_a, temper_b data seed_d /z'5489'/ data matrix_a /z'9908B0DF'/ data matrix_b /z'0'/ data temper_a /z'9D2C5680'/ data temper_b /z'EFC60000'/ if ( mti > n ) then ! generate N words at one time if ( .not. mtinit ) call init_genrand( seed_d ) ! if init_genrand() has not been called, a default initial seed is used do kk = 1, n-m, 1 y = ibits( mt(kk+1), 0, 31 ) call mvbits( mt(kk), 31, 1, y, 31 ) if ( btest( y, 0 ) ) then mt(kk) = ieor( ieor( mt(kk+m), ishft( y, -1 ) ), matrix_a ) else mt(kk) = ieor( ieor( mt(kk+m), ishft( y, -1 ) ), matrix_b ) end if end do do kk = n-m+1, n-1, 1 y = ibits( mt(kk+1), 0, 31 ) call mvbits( mt(kk), 31, 1, y, 31 ) if ( btest( y, 0 ) ) then mt(kk) = ieor( ieor( mt(kk+m-n), ishft( y, -1 ) ), matrix_a ) else mt(kk) = ieor( ieor( mt(kk+m-n), ishft( y, -1 ) ), matrix_b ) end if end do y = ibits( mt(1), 0, 31 ) call mvbits( mt(n), 31, 1, y, 31 ) if ( btest( y, 0 ) ) then mt(kk) = ieor( ieor( mt(m), ishft( y, -1 ) ), matrix_a ) else mt(kk) = ieor( ieor( mt(m), ishft( y, -1 ) ), matrix_b ) end if mti = 1_wi end if y = mt(mti) mti = mti + 1_wi ! Tempering y = ieor( y, ishft( y, -11) ) y = ieor( y, iand( ishft( y, 7 ), temper_a ) ) y = ieor( y, iand( ishft( y, 15 ), temper_b ) ) y = ieor( y, ishft( y, -18 ) ) end function genrand_int32 ! generates a random number on [0,0x7fffffff]-interval function genrand_int31( ) result( i ) implicit none intrinsic :: ishft integer( kind = wi ) :: i i = ishft( genrand_int32( ), -1 ) end function genrand_int31 ! generates a random number on [0,1]-real-interval function genrand_real1( ) result( r ) implicit none real( kind = wr ) :: r integer( kind = wi ) :: a, a1, a0 a = genrand_int32( ) a0 = ibits( a, 0, hbs ) a1 = ibits( a, hbs, hbs ) r = real( a0, kind = wr ) / 4294967295.0_wr r = real( a1, kind = wr ) * ( 65536.0_wr / 4294967295.0_wr ) + r ! divided by 2^32-1 end function genrand_real1 ! generates a random number on [0,1)-real-interval function genrand_real2( ) result( r ) implicit none intrinsic :: ibits real( kind = wr ) :: r integer( kind = wi ) :: a, a1, a0 a = genrand_int32( ) a0 = ibits( a, 0, hbs ) a1 = ibits( a, hbs, hbs ) r = real( a0, kind = wr ) / 4294967296.0_wr r = real( a1, kind = wr ) / 65536.0_wr + r ! divided by 2^32 end function genrand_real2 ! generates a random number on (0,1)-real-interval function genrand_real3( ) result( r ) implicit none real( kind = wr ) :: r integer( kind = wi ) :: a, a1, a0 a = genrand_int32( ) a0 = ibits( a, 0, hbs ) a1 = ibits( a, hbs, hbs ) r = ( real( a0, kind = wr ) + 0.5_wr ) / 4294967296.0_wr r = real( a1, kind = wr ) / 65536.0_wr + r ! divided by 2^32 end function genrand_real3 ! generates a random number on [0,1) with 53-bit resolution function genrand_res53( ) result( r ) implicit none intrinsic :: ishft real( kind = wr ) :: r integer( kind = wi ) :: a, a0, a1 integer( kind = wi ) :: b, b0, b1 a = ishft( genrand_int32( ), -5 ) a0 = ibits( a, 0, hbs ) a1 = ibits( a, hbs, hbs ) b = ishft( genrand_int32( ), -6 ) b0 = ibits( b, 0, hbs ) b1 = ibits( b, hbs, hbs ) r = real( a1, kind = wr ) / 2048.0_wr r = real( a0, kind = wr ) / 134217728.0_wr + r r = real( b1, kind = wr ) / 137438953472.0_wr + r r = real( b0, kind = wr ) / 9007199254740992.0_wr + r end function genrand_res53 ! These real versions are due to Isaku Wada, 2002/01/09 added end module mt19937
gpl-3.0
alexurba/cftb
src/libsrc/lapack/SRC/zlaset.f
6
3144
SUBROUTINE ZLASET( UPLO, M, N, ALPHA, BETA, A, LDA ) * * -- LAPACK auxiliary routine (version 3.2) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2006 * * .. Scalar Arguments .. CHARACTER UPLO INTEGER LDA, M, N COMPLEX*16 ALPHA, BETA * .. * .. Array Arguments .. COMPLEX*16 A( LDA, * ) * .. * * Purpose * ======= * * ZLASET initializes a 2-D array A to BETA on the diagonal and * ALPHA on the offdiagonals. * * Arguments * ========= * * UPLO (input) CHARACTER*1 * Specifies the part of the matrix A to be set. * = 'U': Upper triangular part is set. The lower triangle * is unchanged. * = 'L': Lower triangular part is set. The upper triangle * is unchanged. * Otherwise: All of the matrix A is set. * * M (input) INTEGER * On entry, M specifies the number of rows of A. * * N (input) INTEGER * On entry, N specifies the number of columns of A. * * ALPHA (input) COMPLEX*16 * All the offdiagonal array elements are set to ALPHA. * * BETA (input) COMPLEX*16 * All the diagonal array elements are set to BETA. * * A (input/output) COMPLEX*16 array, dimension (LDA,N) * On entry, the m by n matrix A. * On exit, A(i,j) = ALPHA, 1 <= i <= m, 1 <= j <= n, i.ne.j; * A(i,i) = BETA , 1 <= i <= min(m,n) * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,M). * * ===================================================================== * * .. Local Scalars .. INTEGER I, J * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. Intrinsic Functions .. INTRINSIC MIN * .. * .. Executable Statements .. * IF( LSAME( UPLO, 'U' ) ) THEN * * Set the diagonal to BETA and the strictly upper triangular * part of the array to ALPHA. * DO 20 J = 2, N DO 10 I = 1, MIN( J-1, M ) A( I, J ) = ALPHA 10 CONTINUE 20 CONTINUE DO 30 I = 1, MIN( N, M ) A( I, I ) = BETA 30 CONTINUE * ELSE IF( LSAME( UPLO, 'L' ) ) THEN * * Set the diagonal to BETA and the strictly lower triangular * part of the array to ALPHA. * DO 50 J = 1, MIN( M, N ) DO 40 I = J + 1, M A( I, J ) = ALPHA 40 CONTINUE 50 CONTINUE DO 60 I = 1, MIN( N, M ) A( I, I ) = BETA 60 CONTINUE * ELSE * * Set the array to BETA on the diagonal and ALPHA on the * offdiagonal. * DO 80 J = 1, N DO 70 I = 1, M A( I, J ) = ALPHA 70 CONTINUE 80 CONTINUE DO 90 I = 1, MIN( M, N ) A( I, I ) = BETA 90 CONTINUE END IF * RETURN * * End of ZLASET * END
mit
mogrodnik/piernik
src/base/procnames.F90
3
9725
! ! PIERNIK Code Copyright (C) 2006 Michal Hanasz ! ! This file is part of PIERNIK code. ! ! PIERNIK is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! PIERNIK is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with PIERNIK. If not, see <http://www.gnu.org/licenses/>. ! ! Initial implementation of PIERNIK code was based on TVD split MHD code by ! Ue-Li Pen ! see: Pen, Arras & Wong (2003) for algorithm and ! http://www.cita.utoronto.ca/~pen/MHD ! for original source code "mhd.f90" ! ! For full list of developers see $PIERNIK_HOME/license/pdt.txt ! #include "piernik.h" !> !! \brief Collect names of nodes. Provide structures that allow for quick translation between rank and node name. !! !! To be used in load balancing and possibly in MPI-3 (shared memory parallelism). !! !! To allow usage in IO routines do not use entities from dataio_pub. !< module procnames use MPIF, only: MPI_MAX_PROCESSOR_NAME implicit none private public :: pnames ! all MPI rank associated with particular node name type nodeproc_t character(len=MPI_MAX_PROCESSOR_NAME) :: nodename !< local $HOSTNAME integer(kind=4), allocatable, dimension(:) :: proc !< list of MPI ranks that belong to this%nodename real :: wtime !< estimated average execution time per cg of group of local MPI processes end type nodeproc_t ! all connections between MPI ranks and nodes type procnamelist_t character(len=MPI_MAX_PROCESSOR_NAME), allocatable, dimension(:) :: procnames !< node names associated with MPI ranks real, allocatable, dimension(:) :: wtime !< estimated execution time per cg of MPI ranks logical, allocatable, dimension(:) :: exclude !< When .true. then exclude given thread from computations type(nodeproc_t), allocatable, dimension(:) :: proc_on_node !< array of nodes and MPI ranks integer, allocatable, dimension(:) :: hostindex !< index in proc_on_node for each MPI rank integer(kind=4) :: maxnamelen !< length of longest hostname logical :: speed_avail !< .true. after host speeds were calculated at least once contains procedure :: init !< Initialize the pnames structure procedure :: cleanup !< Clean up the pnames structure procedure :: calc_hostspeed !< Compute this%proc_on_node(:)%wtime from this%wtime procedure :: mark_for_exclusion !< Mark underperforming processes for exclusion procedure :: enable_all !< Unmark any exclusions end type procnamelist_t type(procnamelist_t) :: pnames contains !< \brief Initialize the pnames structure subroutine init(this) use constants, only: I_ZERO use mpisetup, only: FIRST, LAST, err_mpi use MPIF, only: MPI_COMM_WORLD, MPI_CHARACTER, MPI_Get_processor_name use MPIFUN, only: MPI_Allgather implicit none class(procnamelist_t), intent(inout) :: this !< an object invoking the type-bound procedure character(len=MPI_MAX_PROCESSOR_NAME) :: myname integer(kind=4) :: mynamelen character(len=MPI_MAX_PROCESSOR_NAME), allocatable, dimension(:) :: nodenames !< aux array for unique node names this%speed_avail = .false. allocate(this%procnames(FIRST:LAST), & & this%wtime (FIRST:LAST), & & this%exclude (FIRST:LAST), & & this%hostindex(FIRST:LAST)) call this%enable_all this%maxnamelen = I_ZERO call MPI_Get_processor_name(myname, mynamelen, err_mpi) call MPI_Allgather(myname, MPI_MAX_PROCESSOR_NAME, MPI_CHARACTER, & & this%procnames, MPI_MAX_PROCESSOR_NAME, MPI_CHARACTER, & & MPI_COMM_WORLD, err_mpi) call find_unique call fill_proc_on_node deallocate(nodenames) contains !> \brief Find unique node names subroutine find_unique use constants, only: I_ONE implicit none integer :: i, j logical :: found allocate(nodenames(I_ONE)) nodenames(I_ONE) = this%procnames(FIRST) do i = lbound(this%procnames, 1), ubound(this%procnames, 1) found = .false. do j = lbound(nodenames, 1), ubound(nodenames, 1) found = found .or. (this%procnames(i) == nodenames(j)) ! longer loop perhaps would benefit from use of exit statement enddo if (.not. found) nodenames = [ nodenames, this%procnames(i) ] ! lhs reallocation enddo do j = lbound(nodenames, 1), ubound(nodenames, 1) this%maxnamelen = max(this%maxnamelen, len_trim(nodenames(j), kind=4)) enddo end subroutine find_unique !> Connect unique node names with MPI ranks subroutine fill_proc_on_node use constants, only: INVALID implicit none integer(kind=4) :: i, j allocate(this%proc_on_node(size(nodenames))) do i = lbound(nodenames, 1, kind=4), ubound(nodenames, 1, kind=4) this%proc_on_node(i)%nodename = nodenames(i) allocate(this%proc_on_node(i)%proc(0)) enddo do j = lbound(this%proc_on_node, 1, kind=4), ubound(this%proc_on_node, 1, kind=4) do i = lbound(this%procnames, 1, kind=4), ubound(this%procnames, 1, kind=4) if (this%procnames(i) == this%proc_on_node(j)%nodename) & & this%proc_on_node(j)%proc = [ this%proc_on_node(j)%proc, i ] ! lhs reallocation enddo enddo ! Set up this%hostindex to be able to quickly refer to node properties knowing own MPI rank (mpisetup::proc) this%hostindex = INVALID do j = lbound(this%proc_on_node, 1, kind=4), ubound(this%proc_on_node, 1, kind=4) do i = lbound(this%proc_on_node(j)%proc, 1, kind=4), ubound(this%proc_on_node(j)%proc, 1, kind=4) this%hostindex(this%proc_on_node(j)%proc(i)) = j enddo enddo end subroutine fill_proc_on_node end subroutine init !< \brief Clean up the pnames structure subroutine cleanup(this) implicit none class(procnamelist_t), intent(inout) :: this !< an object invoking the type-bound procedure integer :: i if (.not. allocated(this%procnames)) return !< in case it wasn't ever initialized do i = lbound(this%proc_on_node, 1), ubound(this%proc_on_node, 1) deallocate(this%proc_on_node(i)%proc) enddo deallocate(this%proc_on_node) deallocate(this%procnames) deallocate(this%wtime) deallocate(this%exclude) deallocate(this%hostindex) end subroutine cleanup !< \brief Compute this%proc_on_node(:)%wtime from this%wtime subroutine calc_hostspeed(this) implicit none class(procnamelist_t), intent(inout) :: this !< an object invoking the type-bound procedure integer :: host real :: avg do host = lbound(this%proc_on_node, 1), ubound(this%proc_on_node, 1) associate (h => this%proc_on_node(host)) avg = 0. ! Don't average on unoccupied/excluded threads if (count(this%wtime(h%proc(:)) > 0.) > 0) avg = sum(this%wtime(h%proc(:))) / count(this%wtime(h%proc(:)) > 0.) h%wtime = avg end associate enddo this%speed_avail = .true. end subroutine calc_hostspeed !< \brief Mark underperforming processes for exclusion subroutine mark_for_exclusion(this, threshold) implicit none class(procnamelist_t), intent(inout) :: this !< an object invoking the type-bound procedure real, intent(in) :: threshold !< mark for exclusion when a process is that much slower than average real, parameter :: fast_enough = 1.2 ! count slightly slower threads in the average but reject marauders real :: avg, fast_avg if (count(.not. this%exclude .and. this%wtime(:) > 0.) <= 0) return ! this may occur right after restart ! average MHD cost per cg on active threads avg = sum(this%wtime(:), mask = .not. this%exclude .and. this%wtime(:) > 0.) / & & count(.not. this%exclude .and. this%wtime(:) > 0.) ! average MHD cost per cg on active threads that aren't lagging too much behind average fast_avg = sum(this%wtime(:), mask = (.not. this%exclude .and. this%wtime(:) > 0. .and. this%wtime(:) <= fast_enough * avg)) / & & count(.not. this%exclude .and. this%wtime(:) > 0. .and. this%wtime(:) <= fast_enough * avg) this%exclude = this%exclude .or. this%wtime(:) > fast_avg * threshold end subroutine mark_for_exclusion !< \brief Unmark any exclusions subroutine enable_all(this) implicit none class(procnamelist_t), intent(inout) :: this !< an object invoking the type-bound procedure this%exclude = .false. end subroutine enable_all end module procnames
gpl-3.0
tsung1029/dpic2
dpic2_c.f90
1
18077
!----------------------------------------------------------------------- ! Skeleton 2-1/2D Darwin PIC code ! written by Viktor K. Decyk, UCLA program dpic2 ! #include "dpush2.h" implicit none ! indx/indy = exponent which determines grid points in x/y direction: ! nx = 2**indx, ny = 2**indy. integer, parameter :: indx = 9, indy = 9 ! npx/npy = number of electrons distributed in x/y direction. integer, parameter :: npx = 3072, npy = 3072 ! ndim = number of velocity coordinates = 3 integer, parameter :: ndim = 3 ! tend = time at end of simulation, in units of plasma frequency. ! dt = time interval between successive calculations. ! qme = charge on electron, in units of e. real, parameter :: tend = 10.0, dt = 0.1, qme = -1.0 ! vtx/vty = thermal velocity of electrons in x/y direction ! vx0/vy0 = drift velocity of electrons in x/y direction. real, parameter :: vtx = 1.0, vty = 1.0, vx0 = 0.0, vy0 = 0.0 ! vtx/vz0 = thermal/drift velocity of electrons in z direction real, parameter :: vtz = 1.0, vz0 = 0.0 ! ax/ay = smoothed particle size in x/y direction ! ci = reciprocal of velocity of light. real :: ax = .912871, ay = .912871, ci = 0.1 ! idimp = number of particle coordinates = 5 ! ipbc = particle boundary condition: 1 = periodic ! sortime = number of time steps between standard electron sorting integer :: idimp = 5, ipbc = 1, sortime = 50 ! omx/omy/omz = magnetic field electron cyclotron frequency in x/y/z real :: omx = 0.4, omy = 0.0, omz = 0.0 ! ndc = number of corrections in darwin iteration integer :: ndc = 1 ! wke/we = particle kinetic/electrostatic field energy ! wf/wm/wt = magnetic field/transverse electric field/total energy real :: wke = 0.0, we = 0.0, wf = 0.0, wm = 0.0, wt = 0.0 real :: zero = 0.0 ! declare scalars for standard code integer :: k integer :: np, nx, ny, nxh, nyh, nxe, nye, nxeh, nxyh, nxhy integer :: mdim, ny1, ntime, nloop, isign real :: qbme, affp, q2m0, wpm, wpmax, wpmin ! ! declare arrays for standard code: ! part, part2 = particle arrays real, dimension(:,:), pointer :: part, part2, tpart ! qe = electron charge density with guard cells real, dimension(:,:), pointer :: qe ! cue = electron current density with guard cells ! dcu = acceleration density with guard cells ! cus = transverse electric field ! amu = momentum flux with guard cells real, dimension(:,:,:), pointer :: cue, dcu, cus, amu ! exyze = transverse electric field with guard cells ! fxyze/bxyze = smoothed electric/magnetic field with guard cells real, dimension(:,:,:), pointer :: fxyze, exyze, bxyze ! ffc, ffe = form factor arrays for poisson solvers complex, dimension(:,:), pointer :: ffc, ffe ! mixup = bit reverse table for FFT integer, dimension(:), pointer :: mixup ! sct = sine/cosine table for FFT complex, dimension(:), pointer :: sct ! npicy = scratch array for reordering particles integer, dimension(:), pointer :: npicy ! ss = scratch array for WFFT2RN complex, dimension(:,:), pointer :: ss ! ! declare and initialize timing data real :: time integer, dimension(4) :: itime real :: tdpost = 0.0, tguard = 0.0, tfft = 0.0, tfield = 0.0 real :: tdjpost = 0.0, tdcjpost = 0.0, tpush = 0.0, tsort = 0.0 double precision :: dtime ! ! initialize scalars for standard code ! np = total number of particles in simulation ! nx/ny = number of grid points in x/y direction np = npx*npy; nx = 2**indx; ny = 2**indy; nxh = nx/2; nyh = ny/2 nxe = nx + 2; nye = ny + 1; nxeh = nxe/2 nxyh = max(nx,ny)/2; nxhy = max(nxh,ny); ny1 = ny + 1 ! nloop = number of time steps in simulation ! ntime = current time step nloop = tend/dt + .0001; ntime = 0 ! mdim = dimension of amu array mdim = 2*ndim - 2 qbme = qme affp = real(nx*ny)/real(np) ! ! allocate data for standard code allocate(part(idimp,np)) if (sortime > 0) allocate(part2(idimp,np)) allocate(qe(nxe,nye),fxyze(ndim,nxe,nye),exyze(ndim,nxe,nye)) allocate(cue(ndim,nxe,nye),dcu(ndim,nxe,nye),cus(ndim,nxe,nye)) allocate(amu(mdim,nxe,nye),bxyze(ndim,nxe,nye)) allocate(ffc(nxh,nyh),ffe(nxh,nyh),mixup(nxhy),sct(nxyh)) allocate(npicy(ny1),ss(mdim,nxeh)) ! ! prepare fft tables call CWFFT2RINIT(mixup,sct,indx,indy,nxhy,nxyh) ! calculate form factor: ffc isign = 0 call CPOIS23(qe,fxyze,isign,ffc,ax,ay,affp,we,nx,ny,nxeh,nye,nxh, & &nyh) ! initialize electrons call CDISTR2H(part,vtx,vty,vtz,vx0,vy0,vz0,npx,npy,idimp,np,nx,ny,& &ipbc) ! ! find maximum and minimum initial electron density qe = 0.0 call CGPOST2L(part,qe,qme,np,idimp,nxe,nye) call CAGUARD2L(qe,nx,ny,nxe,nye) call CFWPMINMX2(qe,qbme,wpmax,wpmin,nx,ny,nxe,nye) wpm = 0.5*(wpmax + wpmin)*affp ! accelerate convergence: update wpm if (wpm <= 10.0) wpm = 0.75*wpm write (*,*) 'wpm=',wpm q2m0 = wpm/affp ! calculate form factor: ffe isign = 0 call CEPOIS23(dcu,cus,isign,ffe,ax,ay,affp,wpm,ci,wf,nx,ny,nxeh, & &nye,nxh,nyh) ! ! initialize transverse electric field cus = 0.0 ! ! * * * start main iteration loop * * * ! 500 if (nloop <= ntime) go to 2000 ! write (*,*) 'ntime = ', ntime ! ! deposit current with standard procedure: updates cue call dtimer(dtime,itime,-1) cue = 0.0 call CGJPOST2L(part,cue,qme,zero,np,idimp,nx,ny,nxe,nye,ipbc) call dtimer(dtime,itime,1) time = real(dtime) tdjpost = tdjpost + time ! ! deposit charge with standard procedure: updates qe call dtimer(dtime,itime,-1) qe = 0.0 call CGPOST2L(part,qe,qme,np,idimp,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tdpost = tdpost + time ! ! add guard cells with standard procedure: updates qe, cue call dtimer(dtime,itime,-1) call CAGUARD2L(qe,nx,ny,nxe,nye) call CACGUARD2L(cue,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tguard = tguard + time ! ! transform charge to fourier space with standard procedure: updates qe call dtimer(dtime,itime,-1) isign = -1 call CWFFT2RX(qe,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! calculate longitudinal force/charge in fourier space with standard ! procedure: updates fxyze, we call dtimer(dtime,itime,-1) isign = -1 call CPOIS23(qe,fxyze,isign,ffc,ax,ay,affp,we,nx,ny,nxeh,nye,nxh, & &nyh) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! transform longitudinal electric force to real space with standard ! procedure: updates fxyze call dtimer(dtime,itime,-1) isign = 1 call CWFFT2R3(fxyze,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! transform current to fourier space with standard procedure: update cue call dtimer(dtime,itime,-1) isign = -1 call CWFFT2R3(cue,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! take transverse part of current with standard procedure: updates cue call dtimer(dtime,itime,-1) call CCUPERP2(cue,nx,ny,nxeh,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! calculate magnetic field in fourier space with standard procedure: ! updates bxyze, wm call dtimer(dtime,itime,-1) call CBBPOIS23(cue,bxyze,ffc,ci,wm,nx,ny,nxeh,nye,nxh,nyh) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! transform magnetic force to real space with standard procedure: ! updates bxyze call dtimer(dtime,itime,-1) isign = 1 call CWFFT2R3(bxyze,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! add constant to magnetic field with standard procedure: updates bxyze call dtimer(dtime,itime,-1) call CBADDEXT2(bxyze,omx,omy,omz,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! copy guard cells with standard procedure: updates fxyze, bxyze, cus call dtimer(dtime,itime,-1) call CBGUARD2L(fxyze,nx,ny,nxe,nye) call CBGUARD2L(bxyze,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tguard = tguard + time ! ! add longitudinal and old transverse electric fields with standard ! procedure: updates exyze call dtimer(dtime,itime,-1) call CADDVRFIELD2(exyze,cus,fxyze,ndim,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! deposit electron acceleration density and momentum flux with standard ! procedure: updates dcu, amu call dtimer(dtime,itime,-1) dcu = 0.0; amu = 0.0 call CGDJPOST2L(part,exyze,bxyze,dcu,amu,qme,qbme,dt,idimp,np,nxe,& &nye) ! add old scaled electric field with standard procedure: updates dcu call CASCFGUARD2L(dcu,cus,q2m0,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tdcjpost = tdcjpost + time ! ! add guard cells with standard procedure: updates dcu, amu call dtimer(dtime,itime,-1) call CACGUARD2L(dcu,nx,ny,nxe,nye) call CAMCGUARD2L(amu,nx,ny,nxe,nye,mdim) call dtimer(dtime,itime,1) time = real(dtime) tguard = tguard + time ! ! transform acceleration density and momentum flux to fourier space ! with standard procedure: updates dcu, amu call dtimer(dtime,itime,-1) isign = -1 call CWFFT2R3(dcu,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call CWFFT2RN(amu,ss,isign,mixup,sct,indx,indy,nxeh,nye,mdim,nxhy,& &nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! take transverse part of time derivative of current with standard ! procedure: updates dcu call dtimer(dtime,itime,-1) call CADCUPERP23(dcu,amu,nx,ny,nxeh,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! calculate convective part of transverse electric field with standard ! procedure: updates cus, wf call dtimer(dtime,itime,-1) isign = -1 call CEPOIS23(dcu,cus,isign,ffe,ax,ay,affp,wpm,ci,wf,nx,ny,nxeh, & &nye,nxh,nyh) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! transform transverse electric field to real space with standard ! procedure: updates cus call dtimer(dtime,itime,-1) isign = 1 call CWFFT2R3(cus,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! copy guard cells with standard procedure: updates cus call dtimer(dtime,itime,-1) call CBGUARD2L(cus,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tguard = tguard + time ! ! add longitudinal and transverse electric fields with standard ! procedure: exyze = cus + fxyze, updates exyze ! cus needs to be retained for next time step call dtimer(dtime,itime,-1) call CADDVRFIELD2(exyze,cus,fxyze,ndim,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! inner iteration loop do k = 1, ndc ! ! deposit electron current and acceleration density and momentum flux ! with standard procedure: updates cue, dcu, amu call dtimer(dtime,itime,-1) cue = 0.0; dcu = 0.0; amu = 0.0 call CGDCJPOST2L(part,exyze,bxyze,cue,dcu,amu,qme,qbme,dt,idimp,np& &,nxe,nye) ! add scaled electric field with standard procedure: updates dcu call CASCFGUARD2L(dcu,cus,q2m0,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tdcjpost = tdcjpost + time ! ! add guard cells for current, acceleration density, and momentum flux ! with standard procedure: updates cue, dcu, amu call dtimer(dtime,itime,-1) call CACGUARD2L(cue,nx,ny,nxe,nye) call CACGUARD2L(dcu,nx,ny,nxe,nye) call CAMCGUARD2L(amu,nx,ny,nxe,nye,mdim) call dtimer(dtime,itime,1) time = real(dtime) tguard = tguard + time ! ! transform current to fourier space with standard procedure: update cue call dtimer(dtime,itime,-1) isign = -1 call CWFFT2R3(cue,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! take transverse part of current with standard procedure: updates cue call dtimer(dtime,itime,-1) call CCUPERP2(cue,nx,ny,nxeh,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! calculate magnetic field in fourier space with standard procedure: ! updates bxyze, wm call dtimer(dtime,itime,-1) call CBBPOIS23(cue,bxyze,ffc,ci,wm,nx,ny,nxeh,nye,nxh,nyh) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! transform magnetic force to real space with standard procedure: ! updates bxyze call dtimer(dtime,itime,-1) isign = 1 call CWFFT2R3(bxyze,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! add constant to magnetic field with standard procedure: updates bxzye call dtimer(dtime,itime,-1) call CBADDEXT2(bxyze,omx,omy,omz,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! transform acceleration density and momentum flux to fourier space ! with standard procedure: updates dcu and amu call dtimer(dtime,itime,-1) isign = -1 call CWFFT2R3(dcu,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call CWFFT2RN(amu,ss,isign,mixup,sct,indx,indy,nxeh,nye,mdim,nxhy,& &nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! take transverse part of time derivative of current with standard ! procedure: updates dcu call dtimer(dtime,itime,-1) call CADCUPERP23(dcu,amu,nx,ny,nxeh,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! calculate transverse electric field with standard procedure: ! updates cus, wf call dtimer(dtime,itime,-1) isign = -1 call CEPOIS23(dcu,cus,isign,ffe,ax,ay,affp,wpm,ci,wf,nx,ny,nxeh, & &nye,nxh,nyh) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! ! transform transverse electric field to real space with standard ! procedure: updates cus call dtimer(dtime,itime,-1) isign = 1 call CWFFT2R3(cus,isign,mixup,sct,indx,indy,nxeh,nye,nxhy,nxyh) call dtimer(dtime,itime,1) time = real(dtime) tfft = tfft + time ! ! copy guard cells with standard procedure: updates bxyze, cus call dtimer(dtime,itime,-1) call CBGUARD2L(bxyze,nx,ny,nxe,nye) call CBGUARD2L(cus,nx,ny,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tguard = tguard + time ! ! add longitudinal and transverse electric fields with standard ! procedure: exyze = cus + fxyze, updates exyze ! cus needs to be retained for next time step call dtimer(dtime,itime,-1) call CADDVRFIELD2(exyze,cus,fxyze,ndim,nxe,nye) call dtimer(dtime,itime,1) time = real(dtime) tfield = tfield + time ! enddo ! ! push particles with standard procedure: updates part, wke wke = 0.0 call dtimer(dtime,itime,-1) call CGBPUSH23L(part,exyze,bxyze,qbme,dt,dt,wke,idimp,np,nx,ny,nxe& &,nye,ipbc) call dtimer(dtime,itime,1) time = real(dtime) tpush = tpush + time ! ! sort particles by cell for standard procedure if (sortime > 0) then if (mod(ntime,sortime)==0) then call dtimer(dtime,itime,-1) call CDSORTP2YL(part,part2,npicy,idimp,np,ny1) ! exchange pointers tpart => part part => part2 part2 => tpart call dtimer(dtime,itime,1) time = real(dtime) tsort = tsort + time endif endif ! if (ntime==0) then wt = we + wm write (*,*) 'Initial Total Field, Kinetic and Total Energies:' write (*,'(3e14.7)') wt, wke, wke + wt write (*,*) 'Initial Electrostatic, Transverse Electric and Mag& &netic Field Energies:' write (*,'(3e14.7)') we, wf, wm endif ! ntime = ntime + 1 go to 500 2000 continue ! ! * * * end main iteration loop * * * ! write (*,*) 'ntime, ndc = ', ntime, ndc wt = we + wm write (*,*) 'Final Total Field, Kinetic and Total Energies:' write (*,'(3e14.7)') wt, wke, wke + wt write (*,*) 'Final Electrostatic, Transverse Electric and Magnetic& & Field Energies:' write (*,'(3e14.7)') we, wf, wm ! write (*,*) write (*,*) 'deposit time = ', tdpost write (*,*) 'current deposit time = ', tdjpost write (*,*) 'current derivative deposit time = ', tdcjpost tdpost = tdpost + tdjpost + tdcjpost write (*,*) 'total deposit time = ', tdpost write (*,*) 'guard time = ', tguard write (*,*) 'solver time = ', tfield write (*,*) 'fft time = ', tfft write (*,*) 'push time = ', tpush write (*,*) 'sort time = ', tsort tfield = tfield + tguard + tfft write (*,*) 'total solver time = ', tfield time = tdpost + tpush + tsort write (*,*) 'total particle time = ', time wt = time + tfield write (*,*) 'total time = ', wt write (*,*) ! wt = 1.0e+09/(real(nloop)*real(np)) write (*,*) 'Push Time (nsec) = ', tpush*wt write (*,*) 'Deposit Time (nsec) = ', tdpost*wt write (*,*) 'Sort Time (nsec) = ', tsort*wt write (*,*) 'Total Particle Time (nsec) = ', time*wt ! stop end program
bsd-2-clause
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/interface_14.f90
155
1777
! { dg-do compile } ! Checks the fix for a regression PR32526, which was caused by ! the patch for PR31494. The problem here was that the symbol ! 'new' was determined to be ambiguous. ! ! Contributed by Michael Richmond <michael.a.richmond@nasa.gov> ! module P_Class implicit none private :: init_Personnel interface new module procedure init_Personnel end interface contains subroutine init_Personnel(this) integer, intent (in) :: this print *, "init personnel", this end subroutine init_Personnel end module P_Class module S_Class use P_Class implicit none private :: init_Student type Student private integer :: personnel = 1 end type Student interface new module procedure init_Student end interface contains subroutine init_Student(this) type (Student), intent (in) :: this call new(this%personnel) end subroutine init_Student end module S_Class module T_Class use P_Class implicit none private :: init_Teacher type Teacher private integer :: personnel = 2 end type Teacher interface new module procedure init_Teacher end interface contains subroutine init_Teacher(this) type (Teacher), intent (in) :: this call new(this%personnel) end subroutine init_Teacher end module T_Class module poly_Class use S_Class use T_Class end module poly_Class module D_Class use poly_Class end module D_Class use D_Class type (Teacher) :: a type (Student) :: b call new (a) call new (b) end
gpl-2.0
optimsoc/gzll-gcc
libgfortran/generated/_sign_r10.F90
35
1462
! Copyright (C) 2002-2014 Free Software Foundation, Inc. ! Contributed by Paul Brook <paul@nowt.org> ! !This file is part of the GNU Fortran 95 runtime library (libgfortran). ! !GNU libgfortran is free software; you can redistribute it and/or !modify it under the terms of the GNU General Public !License as published by the Free Software Foundation; either !version 3 of the License, or (at your option) any later version. !GNU libgfortran is distributed in the hope that it will be useful, !but WITHOUT ANY WARRANTY; without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !GNU General Public License for more details. ! !Under Section 7 of GPL version 3, you are granted additional !permissions described in the GCC Runtime Library Exception, version !3.1, as published by the Free Software Foundation. ! !You should have received a copy of the GNU General Public License and !a copy of the GCC Runtime Library Exception along with this program; !see the files COPYING3 and COPYING.RUNTIME respectively. If not, see !<http://www.gnu.org/licenses/>. ! !This file is machine generated. #include "config.h" #include "kinds.inc" #include "c99_protos.inc" #if defined (HAVE_GFC_REAL_10) elemental function _gfortran_specific__sign_r10 (p1, p2) real (kind=10), intent (in) :: p1, p2 real (kind=10) :: _gfortran_specific__sign_r10 _gfortran_specific__sign_r10 = sign (p1, p2) end function #endif
gpl-2.0
henriasv/lammps
lib/linalg/dsygst.f
53
11008
*> \brief \b DSYGST * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download DSYGST + dependencies *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dsygst.f"> *> [TGZ]</a> *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dsygst.f"> *> [ZIP]</a> *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dsygst.f"> *> [TXT]</a> *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE DSYGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO ) * * .. Scalar Arguments .. * CHARACTER UPLO * INTEGER INFO, ITYPE, LDA, LDB, N * .. * .. Array Arguments .. * DOUBLE PRECISION A( LDA, * ), B( LDB, * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DSYGST reduces a real symmetric-definite generalized eigenproblem *> to standard form. *> *> If ITYPE = 1, the problem is A*x = lambda*B*x, *> and A is overwritten by inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T) *> *> If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or *> B*A*x = lambda*x, and A is overwritten by U*A*U**T or L**T*A*L. *> *> B must have been previously factorized as U**T*U or L*L**T by DPOTRF. *> \endverbatim * * Arguments: * ========== * *> \param[in] ITYPE *> \verbatim *> ITYPE is INTEGER *> = 1: compute inv(U**T)*A*inv(U) or inv(L)*A*inv(L**T); *> = 2 or 3: compute U*A*U**T or L**T*A*L. *> \endverbatim *> *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> = 'U': Upper triangle of A is stored and B is factored as *> U**T*U; *> = 'L': Lower triangle of A is stored and B is factored as *> L*L**T. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the matrices A and B. N >= 0. *> \endverbatim *> *> \param[in,out] A *> \verbatim *> A is DOUBLE PRECISION array, dimension (LDA,N) *> On entry, the symmetric matrix A. If UPLO = 'U', the leading *> N-by-N upper triangular part of A contains the upper *> triangular part of the matrix A, and the strictly lower *> triangular part of A is not referenced. If UPLO = 'L', the *> leading N-by-N lower triangular part of A contains the lower *> triangular part of the matrix A, and the strictly upper *> triangular part of A is not referenced. *> *> On exit, if INFO = 0, the transformed matrix, stored in the *> same format as A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> The leading dimension of the array A. LDA >= max(1,N). *> \endverbatim *> *> \param[in] B *> \verbatim *> B is DOUBLE PRECISION array, dimension (LDB,N) *> The triangular factor from the Cholesky factorization of B, *> as returned by DPOTRF. *> \endverbatim *> *> \param[in] LDB *> \verbatim *> LDB is INTEGER *> The leading dimension of the array B. LDB >= max(1,N). *> \endverbatim *> *> \param[out] INFO *> \verbatim *> INFO is INTEGER *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup doubleSYcomputational * * ===================================================================== SUBROUTINE DSYGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO ) * * -- LAPACK computational routine (version 3.4.0) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, ITYPE, LDA, LDB, N * .. * .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ) * .. * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, HALF PARAMETER ( ONE = 1.0D0, HALF = 0.5D0 ) * .. * .. Local Scalars .. LOGICAL UPPER INTEGER K, KB, NB * .. * .. External Subroutines .. EXTERNAL DSYGS2, DSYMM, DSYR2K, DTRMM, DTRSM, XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. * .. External Functions .. LOGICAL LSAME INTEGER ILAENV EXTERNAL LSAME, ILAENV * .. * .. Executable Statements .. * * Test the input parameters. * INFO = 0 UPPER = LSAME( UPLO, 'U' ) IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN INFO = -1 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN INFO = -2 ELSE IF( N.LT.0 ) THEN INFO = -3 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN INFO = -5 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN INFO = -7 END IF IF( INFO.NE.0 ) THEN CALL XERBLA( 'DSYGST', -INFO ) RETURN END IF * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * * Determine the block size for this environment. * NB = ILAENV( 1, 'DSYGST', UPLO, N, -1, -1, -1 ) * IF( NB.LE.1 .OR. NB.GE.N ) THEN * * Use unblocked code * CALL DSYGS2( ITYPE, UPLO, N, A, LDA, B, LDB, INFO ) ELSE * * Use blocked code * IF( ITYPE.EQ.1 ) THEN IF( UPPER ) THEN * * Compute inv(U**T)*A*inv(U) * DO 10 K = 1, N, NB KB = MIN( N-K+1, NB ) * * Update the upper triangle of A(k:n,k:n) * CALL DSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA, $ B( K, K ), LDB, INFO ) IF( K+KB.LE.N ) THEN CALL DTRSM( 'Left', UPLO, 'Transpose', 'Non-unit', $ KB, N-K-KB+1, ONE, B( K, K ), LDB, $ A( K, K+KB ), LDA ) CALL DSYMM( 'Left', UPLO, KB, N-K-KB+1, -HALF, $ A( K, K ), LDA, B( K, K+KB ), LDB, ONE, $ A( K, K+KB ), LDA ) CALL DSYR2K( UPLO, 'Transpose', N-K-KB+1, KB, -ONE, $ A( K, K+KB ), LDA, B( K, K+KB ), LDB, $ ONE, A( K+KB, K+KB ), LDA ) CALL DSYMM( 'Left', UPLO, KB, N-K-KB+1, -HALF, $ A( K, K ), LDA, B( K, K+KB ), LDB, ONE, $ A( K, K+KB ), LDA ) CALL DTRSM( 'Right', UPLO, 'No transpose', $ 'Non-unit', KB, N-K-KB+1, ONE, $ B( K+KB, K+KB ), LDB, A( K, K+KB ), $ LDA ) END IF 10 CONTINUE ELSE * * Compute inv(L)*A*inv(L**T) * DO 20 K = 1, N, NB KB = MIN( N-K+1, NB ) * * Update the lower triangle of A(k:n,k:n) * CALL DSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA, $ B( K, K ), LDB, INFO ) IF( K+KB.LE.N ) THEN CALL DTRSM( 'Right', UPLO, 'Transpose', 'Non-unit', $ N-K-KB+1, KB, ONE, B( K, K ), LDB, $ A( K+KB, K ), LDA ) CALL DSYMM( 'Right', UPLO, N-K-KB+1, KB, -HALF, $ A( K, K ), LDA, B( K+KB, K ), LDB, ONE, $ A( K+KB, K ), LDA ) CALL DSYR2K( UPLO, 'No transpose', N-K-KB+1, KB, $ -ONE, A( K+KB, K ), LDA, B( K+KB, K ), $ LDB, ONE, A( K+KB, K+KB ), LDA ) CALL DSYMM( 'Right', UPLO, N-K-KB+1, KB, -HALF, $ A( K, K ), LDA, B( K+KB, K ), LDB, ONE, $ A( K+KB, K ), LDA ) CALL DTRSM( 'Left', UPLO, 'No transpose', $ 'Non-unit', N-K-KB+1, KB, ONE, $ B( K+KB, K+KB ), LDB, A( K+KB, K ), $ LDA ) END IF 20 CONTINUE END IF ELSE IF( UPPER ) THEN * * Compute U*A*U**T * DO 30 K = 1, N, NB KB = MIN( N-K+1, NB ) * * Update the upper triangle of A(1:k+kb-1,1:k+kb-1) * CALL DTRMM( 'Left', UPLO, 'No transpose', 'Non-unit', $ K-1, KB, ONE, B, LDB, A( 1, K ), LDA ) CALL DSYMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ), $ LDA, B( 1, K ), LDB, ONE, A( 1, K ), LDA ) CALL DSYR2K( UPLO, 'No transpose', K-1, KB, ONE, $ A( 1, K ), LDA, B( 1, K ), LDB, ONE, A, $ LDA ) CALL DSYMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ), $ LDA, B( 1, K ), LDB, ONE, A( 1, K ), LDA ) CALL DTRMM( 'Right', UPLO, 'Transpose', 'Non-unit', $ K-1, KB, ONE, B( K, K ), LDB, A( 1, K ), $ LDA ) CALL DSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA, $ B( K, K ), LDB, INFO ) 30 CONTINUE ELSE * * Compute L**T*A*L * DO 40 K = 1, N, NB KB = MIN( N-K+1, NB ) * * Update the lower triangle of A(1:k+kb-1,1:k+kb-1) * CALL DTRMM( 'Right', UPLO, 'No transpose', 'Non-unit', $ KB, K-1, ONE, B, LDB, A( K, 1 ), LDA ) CALL DSYMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ), $ LDA, B( K, 1 ), LDB, ONE, A( K, 1 ), LDA ) CALL DSYR2K( UPLO, 'Transpose', K-1, KB, ONE, $ A( K, 1 ), LDA, B( K, 1 ), LDB, ONE, A, $ LDA ) CALL DSYMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ), $ LDA, B( K, 1 ), LDB, ONE, A( K, 1 ), LDA ) CALL DTRMM( 'Left', UPLO, 'Transpose', 'Non-unit', KB, $ K-1, ONE, B( K, K ), LDB, A( K, 1 ), LDA ) CALL DSYGS2( ITYPE, UPLO, KB, A( K, K ), LDA, $ B( K, K ), LDB, INFO ) 40 CONTINUE END IF END IF END IF RETURN * * End of DSYGST * END
gpl-2.0
hjmjohnson/ITK
Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/single/slartg.f
46
3909
SUBROUTINE SLARTG( F, G, CS, SN, R ) * * -- LAPACK auxiliary routine (version 3.0) -- * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., * Courant Institute, Argonne National Lab, and Rice University * September 30, 1994 * * .. Scalar Arguments .. REAL CS, F, G, R, SN * .. * * Purpose * ======= * * SLARTG generate a plane rotation so that * * [ CS SN ] . [ F ] = [ R ] where CS**2 + SN**2 = 1. * [ -SN CS ] [ G ] [ 0 ] * * This is a slower, more accurate version of the BLAS1 routine SROTG, * with the following other differences: * F and G are unchanged on return. * If G=0, then CS=1 and SN=0. * If F=0 and (G .ne. 0), then CS=0 and SN=1 without doing any * floating point operations (saves work in SBDSQR when * there are zeros on the diagonal). * * If F exceeds G in magnitude, CS will be positive. * * Arguments * ========= * * F (input) REAL * The first component of vector to be rotated. * * G (input) REAL * The second component of vector to be rotated. * * CS (output) REAL * The cosine of the rotation. * * SN (output) REAL * The sine of the rotation. * * R (output) REAL * The nonzero component of the rotated vector. * * ===================================================================== * * .. Parameters .. REAL ZERO PARAMETER ( ZERO = 0.0E0 ) REAL ONE PARAMETER ( ONE = 1.0E0 ) REAL TWO PARAMETER ( TWO = 2.0E0 ) * .. * .. Local Scalars .. LOGICAL FIRST INTEGER COUNT, I REAL EPS, F1, G1, SAFMIN, SAFMN2, SAFMX2, SCALE * .. * .. External Functions .. REAL SLAMCH EXTERNAL SLAMCH * .. * .. Intrinsic Functions .. INTRINSIC ABS, INT, LOG, MAX, SQRT * .. * .. Save statement .. SAVE FIRST, SAFMX2, SAFMIN, SAFMN2 * .. * .. Data statements .. DATA FIRST / .TRUE. / * .. * .. Executable Statements .. * IF( FIRST ) THEN FIRST = .FALSE. SAFMIN = SLAMCH( 'S' ) EPS = SLAMCH( 'E' ) SAFMN2 = SLAMCH( 'B' )**INT( LOG( SAFMIN / EPS ) / $ LOG( SLAMCH( 'B' ) ) / TWO ) SAFMX2 = ONE / SAFMN2 END IF IF( G.EQ.ZERO ) THEN CS = ONE SN = ZERO R = F ELSE IF( F.EQ.ZERO ) THEN CS = ZERO SN = ONE R = G ELSE F1 = F G1 = G SCALE = MAX( ABS( F1 ), ABS( G1 ) ) IF( SCALE.GE.SAFMX2 ) THEN COUNT = 0 10 CONTINUE COUNT = COUNT + 1 F1 = F1*SAFMN2 G1 = G1*SAFMN2 SCALE = MAX( ABS( F1 ), ABS( G1 ) ) IF( SCALE.GE.SAFMX2 ) $ GO TO 10 R = SQRT( F1**2+G1**2 ) CS = F1 / R SN = G1 / R DO 20 I = 1, COUNT R = R*SAFMX2 20 CONTINUE ELSE IF( SCALE.LE.SAFMN2 ) THEN COUNT = 0 30 CONTINUE COUNT = COUNT + 1 F1 = F1*SAFMX2 G1 = G1*SAFMX2 SCALE = MAX( ABS( F1 ), ABS( G1 ) ) IF( SCALE.LE.SAFMN2 ) $ GO TO 30 R = SQRT( F1**2+G1**2 ) CS = F1 / R SN = G1 / R DO 40 I = 1, COUNT R = R*SAFMN2 40 CONTINUE ELSE R = SQRT( F1**2+G1**2 ) CS = F1 / R SN = G1 / R END IF IF( ABS( F ).GT.ABS( G ) .AND. CS.LT.ZERO ) THEN CS = -CS SN = -SN R = -R END IF END IF RETURN * * End of SLARTG * END
apache-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/namelist_18.f90
166
1101
!{ dg-do run } !{ dg-options "-std=legacy" } ! ! Tests character delimiters for namelist write ! provided by Paul Thomas - pault@gcc.gnu.org program namelist_18 character*3 :: ch = "foo" character*80 :: buffer namelist /mynml/ ch open (10, status = "scratch") write (10, mynml) rewind (10) read (10, '(a)', iostat = ier) buffer read (10, '(a)', iostat = ier) buffer if (ier .ne. 0) call abort () close (10) If ((buffer(6:6) /= "f") .or. (buffer(9:9) /= """")) call abort () open (10, status = "scratch", delim ="quote") write (10, mynml) rewind (10) read (10, '(a)', iostat = ier) buffer read (10, '(a)', iostat = ier) buffer if (ier .ne. 0) call abort () close (10) If ((buffer(5:5) /= """") .or. (buffer(9:9) /= """")) call abort () open (10, status = "scratch", delim ="apostrophe") write (10, mynml) rewind (10) read (10, '(a)', iostat = ier) buffer read (10, '(a)', iostat = ier) buffer if (ier .ne. 0) call abort () close (10) If ((buffer(5:5) /= "'") .or. (buffer(9:9) /= "'")) call abort () end program namelist_18
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/entry_17.f90
181
1157
function test1(n) integer :: n character(n) :: test1 character(n) :: bar1 test1 = "" return entry bar1() bar1 = "" end function test1 function test2() character(1) :: test2 character(1) :: bar2 test2 = "" return entry bar2() bar2 = "" end function test2 function test3() ! { dg-warning "Obsolescent feature" } character(*) :: test3 character(*) :: bar3 ! { dg-warning "Obsolescent feature" } test3 = "" return entry bar3() bar3 = "" end function test3 function test4(n) ! { dg-warning "returning variables of different string lengths" } integer :: n character(n) :: test4 character(*) :: bar4 ! { dg-warning "Obsolescent feature" } test4 = "" return entry bar4() bar4 = "" end function test4 function test5() ! { dg-warning "returning variables of different string lengths" } character(1) :: test5 character(2) :: bar5 test5 = "" return entry bar5() bar5 = "" end function test5 function test6() ! { dg-warning "Obsolescent feature|returning variables of different string lengths" } character(*) :: test6 character(2) :: bar6 test6 = "" return entry bar6() bar6 = "" end function test6
gpl-2.0
hjmjohnson/ITK
Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/complex16/zlaswp.f
40
3330
SUBROUTINE ZLASWP( N, A, LDA, K1, K2, IPIV, INCX ) * * -- LAPACK auxiliary routine (version 3.2) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2006 * * .. Scalar Arguments .. INTEGER INCX, K1, K2, LDA, N * .. * .. Array Arguments .. INTEGER IPIV( * ) COMPLEX*16 A( LDA, * ) * .. * * Purpose * ======= * * ZLASWP performs a series of row interchanges on the matrix A. * One row interchange is initiated for each of rows K1 through K2 of A. * * Arguments * ========= * * N (input) INTEGER * The number of columns of the matrix A. * * A (input/output) COMPLEX*16 array, dimension (LDA,N) * On entry, the matrix of column dimension N to which the row * interchanges will be applied. * On exit, the permuted matrix. * * LDA (input) INTEGER * The leading dimension of the array A. * * K1 (input) INTEGER * The first element of IPIV for which a row interchange will * be done. * * K2 (input) INTEGER * The last element of IPIV for which a row interchange will * be done. * * IPIV (input) INTEGER array, dimension (K2*abs(INCX)) * The vector of pivot indices. Only the elements in positions * K1 through K2 of IPIV are accessed. * IPIV(K) = L implies rows K and L are to be interchanged. * * INCX (input) INTEGER * The increment between successive values of IPIV. If IPIV * is negative, the pivots are applied in reverse order. * * Further Details * =============== * * Modified by * R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA * * ===================================================================== * * .. Local Scalars .. INTEGER I, I1, I2, INC, IP, IX, IX0, J, K, N32 COMPLEX*16 TEMP * .. * .. Executable Statements .. * * Interchange row I with row IPIV(I) for each of rows K1 through K2. * IF( INCX.GT.0 ) THEN IX0 = K1 I1 = K1 I2 = K2 INC = 1 ELSE IF( INCX.LT.0 ) THEN IX0 = 1 + ( 1-K2 )*INCX I1 = K2 I2 = K1 INC = -1 ELSE RETURN END IF * N32 = ( N / 32 )*32 IF( N32.NE.0 ) THEN DO 30 J = 1, N32, 32 IX = IX0 DO 20 I = I1, I2, INC IP = IPIV( IX ) IF( IP.NE.I ) THEN DO 10 K = J, J + 31 TEMP = A( I, K ) A( I, K ) = A( IP, K ) A( IP, K ) = TEMP 10 CONTINUE END IF IX = IX + INCX 20 CONTINUE 30 CONTINUE END IF IF( N32.NE.N ) THEN N32 = N32 + 1 IX = IX0 DO 50 I = I1, I2, INC IP = IPIV( IX ) IF( IP.NE.I ) THEN DO 40 K = N32, N TEMP = A( I, K ) A( I, K ) = A( IP, K ) A( IP, K ) = TEMP 40 CONTINUE END IF IX = IX + INCX 50 CONTINUE END IF * RETURN * * End of ZLASWP * END
apache-2.0
henriasv/lammps
lib/linalg/drot.f
55
2334
*> \brief \b DROT * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE DROT(N,DX,INCX,DY,INCY,C,S) * * .. Scalar Arguments .. * DOUBLE PRECISION C,S * INTEGER INCX,INCY,N * .. * .. Array Arguments .. * DOUBLE PRECISION DX(*),DY(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DROT applies a plane rotation. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup double_blas_level1 * *> \par Further Details: * ===================== *> *> \verbatim *> *> jack dongarra, linpack, 3/11/78. *> modified 12/3/93, array(1) declarations changed to array(*) *> \endverbatim *> * ===================================================================== SUBROUTINE DROT(N,DX,INCX,DY,INCY,C,S) * * -- Reference BLAS level1 routine (version 3.4.0) -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION C,S INTEGER INCX,INCY,N * .. * .. Array Arguments .. DOUBLE PRECISION DX(*),DY(*) * .. * * ===================================================================== * * .. Local Scalars .. DOUBLE PRECISION DTEMP INTEGER I,IX,IY * .. IF (N.LE.0) RETURN IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN * * code for both increments equal to 1 * DO I = 1,N DTEMP = C*DX(I) + S*DY(I) DY(I) = C*DY(I) - S*DX(I) DX(I) = DTEMP END DO ELSE * * code for unequal increments or equal increments not equal * to 1 * IX = 1 IY = 1 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 DO I = 1,N DTEMP = C*DX(IX) + S*DY(IY) DY(IY) = C*DY(IY) - S*DX(IX) DX(IX) = DTEMP IX = IX + INCX IY = IY + INCY END DO END IF RETURN END
gpl-2.0
optimsoc/gzll-gcc
libgomp/testsuite/libgomp.fortran/vla3.f90
202
7527
! { dg-do run } call test contains subroutine check (x, y, l) integer :: x, y logical :: l l = l .or. x .ne. y end subroutine check subroutine foo (c, d, e, f, g, h, i, j, k, n) use omp_lib integer :: n character (len = *) :: c character (len = n) :: d integer, dimension (2, 3:5, n) :: e integer, dimension (2, 3:n, n) :: f character (len = *), dimension (5, 3:n) :: g character (len = n), dimension (5, 3:n) :: h real, dimension (:, :, :) :: i double precision, dimension (3:, 5:, 7:) :: j integer, dimension (:, :, :) :: k logical :: l integer :: p, q, r character (len = n) :: s integer, dimension (2, 3:5, n) :: t integer, dimension (2, 3:n, n) :: u character (len = n), dimension (5, 3:n) :: v character (len = 2 * n + 24) :: w integer :: x, z character (len = 1) :: y s = 'PQRSTUV' forall (p = 1:2, q = 3:5, r = 1:7) t(p, q, r) = -10 + p - q + 2 * r forall (p = 1:2, q = 3:7, r = 1:7) u(p, q, r) = 30 - p + q - 2 * r forall (p = 1:5, q = 3:7, p + q .le. 8) v(p, q) = '_+|/Oo_' forall (p = 1:5, q = 3:7, p + q .gt. 8) v(p, q) = '///|||!' l = .false. !$omp parallel default (none) shared (c, d, e, f, g, h, i, j, k) & !$omp & shared (s, t, u, v) reduction (.or.:l) num_threads (6) & !$omp private (p, q, r, w, x, y) l = l .or. c .ne. 'abcdefghijkl' l = l .or. d .ne. 'ABCDEFG' l = l .or. s .ne. 'PQRSTUV' do 100, p = 1, 2 do 100, q = 3, 7 do 100, r = 1, 7 if (q .lt. 6) l = l .or. e(p, q, r) .ne. 5 + p + q + 2 * r l = l .or. f(p, q, r) .ne. 25 + p + q + 2 * r if (r .lt. 6 .and. q + r .le. 8) l = l .or. g(r, q) .ne. '0123456789AB' if (r .lt. 6 .and. q + r .gt. 8) l = l .or. g(r, q) .ne. '9876543210ZY' if (r .lt. 6 .and. q + r .le. 8) l = l .or. h(r, q) .ne. '0123456' if (r .lt. 6 .and. q + r .gt. 8) l = l .or. h(r, q) .ne. '9876543' if (q .lt. 6) l = l .or. t(p, q, r) .ne. -10 + p - q + 2 * r l = l .or. u(p, q, r) .ne. 30 - p + q - 2 * r if (r .lt. 6 .and. q + r .le. 8) l = l .or. v(r, q) .ne. '_+|/Oo_' if (r .lt. 6 .and. q + r .gt. 8) l = l .or. v(r, q) .ne. '///|||!' 100 continue do 101, p = 3, 5 do 101, q = 2, 6 do 101, r = 1, 7 l = l .or. i(p - 2, q - 1, r) .ne. 7.5 * p * q * r l = l .or. j(p, q + 3, r + 6) .ne. 9.5 * p * q * r 101 continue do 102, p = 1, 5 do 102, q = 4, 6 l = l .or. k(p, 1, q - 3) .ne. 19 + p + 7 + 3 * q 102 continue do 110 z = 0, omp_get_num_threads () - 1 !$omp barrier x = omp_get_thread_num () w = '' if (z .eq. 0) w = 'thread0thr_number_0THREAD0THR_NUMBER_0' if (z .eq. 1) w = 'thread1thr_number_1THREAD1THR_NUMBER_1' if (z .eq. 2) w = 'thread2thr_number_2THREAD2THR_NUMBER_2' if (z .eq. 3) w = 'thread3thr_number_3THREAD3THR_NUMBER_3' if (z .eq. 4) w = 'thread4thr_number_4THREAD4THR_NUMBER_4' if (z .eq. 5) w = 'thread5thr_number_5THREAD5THR_NUMBER_5' if (x .eq. z) then c = w(8:19) d = w(1:7) forall (p = 1:2, q = 3:5, r = 1:7) e(p, q, r) = 5 * x + p + q + 2 * r forall (p = 1:2, q = 3:7, r = 1:7) f(p, q, r) = 25 * x + p + q + 2 * r forall (p = 1:5, q = 3:7, p + q .le. 8) g(p, q) = w(8:19) forall (p = 1:5, q = 3:7, p + q .gt. 8) g(p, q) = w(27:38) forall (p = 1:5, q = 3:7, p + q .le. 8) h(p, q) = w(1:7) forall (p = 1:5, q = 3:7, p + q .gt. 8) h(p, q) = w(20:26) forall (p = 3:5, q = 2:6, r = 1:7) i(p - 2, q - 1, r) = (7.5 + x) * p * q * r forall (p = 3:5, q = 2:6, r = 1:7) j(p, q + 3, r + 6) = (9.5 + x) * p * q * r forall (p = 1:5, q = 7:7, r = 4:6) k(p, q - 6, r - 3) = 19 + x + p + q + 3 * r s = w(20:26) forall (p = 1:2, q = 3:5, r = 1:7) t(p, q, r) = -10 + x + p - q + 2 * r forall (p = 1:2, q = 3:7, r = 1:7) u(p, q, r) = 30 - x - p + q - 2 * r forall (p = 1:5, q = 3:7, p + q .le. 8) v(p, q) = w(1:7) forall (p = 1:5, q = 3:7, p + q .gt. 8) v(p, q) = w(20:26) end if !$omp barrier x = z y = '' if (x .eq. 0) y = '0' if (x .eq. 1) y = '1' if (x .eq. 2) y = '2' if (x .eq. 3) y = '3' if (x .eq. 4) y = '4' if (x .eq. 5) y = '5' l = l .or. w(7:7) .ne. y l = l .or. w(19:19) .ne. y l = l .or. w(26:26) .ne. y l = l .or. w(38:38) .ne. y l = l .or. c .ne. w(8:19) l = l .or. d .ne. w(1:7) l = l .or. s .ne. w(20:26) do 103, p = 1, 2 do 103, q = 3, 7 do 103, r = 1, 7 if (q .lt. 6) l = l .or. e(p, q, r) .ne. 5 * x + p + q + 2 * r l = l .or. f(p, q, r) .ne. 25 * x + p + q + 2 * r if (r .lt. 6 .and. q + r .le. 8) l = l .or. g(r, q) .ne. w(8:19) if (r .lt. 6 .and. q + r .gt. 8) l = l .or. g(r, q) .ne. w(27:38) if (r .lt. 6 .and. q + r .le. 8) l = l .or. h(r, q) .ne. w(1:7) if (r .lt. 6 .and. q + r .gt. 8) l = l .or. h(r, q) .ne. w(20:26) if (q .lt. 6) l = l .or. t(p, q, r) .ne. -10 + x + p - q + 2 * r l = l .or. u(p, q, r) .ne. 30 - x - p + q - 2 * r if (r .lt. 6 .and. q + r .le. 8) l = l .or. v(r, q) .ne. w(1:7) if (r .lt. 6 .and. q + r .gt. 8) l = l .or. v(r, q) .ne. w(20:26) 103 continue do 104, p = 3, 5 do 104, q = 2, 6 do 104, r = 1, 7 l = l .or. i(p - 2, q - 1, r) .ne. (7.5 + x) * p * q * r l = l .or. j(p, q + 3, r + 6) .ne. (9.5 + x) * p * q * r 104 continue do 105, p = 1, 5 do 105, q = 4, 6 l = l .or. k(p, 1, q - 3) .ne. 19 + x + p + 7 + 3 * q 105 continue 110 continue call check (size (e, 1), 2, l) call check (size (e, 2), 3, l) call check (size (e, 3), 7, l) call check (size (e), 42, l) call check (size (f, 1), 2, l) call check (size (f, 2), 5, l) call check (size (f, 3), 7, l) call check (size (f), 70, l) call check (size (g, 1), 5, l) call check (size (g, 2), 5, l) call check (size (g), 25, l) call check (size (h, 1), 5, l) call check (size (h, 2), 5, l) call check (size (h), 25, l) call check (size (i, 1), 3, l) call check (size (i, 2), 5, l) call check (size (i, 3), 7, l) call check (size (i), 105, l) call check (size (j, 1), 4, l) call check (size (j, 2), 5, l) call check (size (j, 3), 7, l) call check (size (j), 140, l) call check (size (k, 1), 5, l) call check (size (k, 2), 1, l) call check (size (k, 3), 3, l) call check (size (k), 15, l) !$omp end parallel if (l) call abort end subroutine foo subroutine test character (len = 12) :: c character (len = 7) :: d integer, dimension (2, 3:5, 7) :: e integer, dimension (2, 3:7, 7) :: f character (len = 12), dimension (5, 3:7) :: g character (len = 7), dimension (5, 3:7) :: h real, dimension (3:5, 2:6, 1:7) :: i double precision, dimension (3:6, 2:6, 1:7) :: j integer, dimension (1:5, 7:7, 4:6) :: k integer :: p, q, r c = 'abcdefghijkl' d = 'ABCDEFG' forall (p = 1:2, q = 3:5, r = 1:7) e(p, q, r) = 5 + p + q + 2 * r forall (p = 1:2, q = 3:7, r = 1:7) f(p, q, r) = 25 + p + q + 2 * r forall (p = 1:5, q = 3:7, p + q .le. 8) g(p, q) = '0123456789AB' forall (p = 1:5, q = 3:7, p + q .gt. 8) g(p, q) = '9876543210ZY' forall (p = 1:5, q = 3:7, p + q .le. 8) h(p, q) = '0123456' forall (p = 1:5, q = 3:7, p + q .gt. 8) h(p, q) = '9876543' forall (p = 3:5, q = 2:6, r = 1:7) i(p, q, r) = 7.5 * p * q * r forall (p = 3:6, q = 2:6, r = 1:7) j(p, q, r) = 9.5 * p * q * r forall (p = 1:5, q = 7:7, r = 4:6) k(p, q, r) = 19 + p + q + 3 * r call foo (c, d, e, f, g, h, i, j, k, 7) end subroutine test end
gpl-2.0
jchristopherson/linalg
examples/linalg_svd_example.f90
1
1091
! linalg_svd_example.f90 program example use iso_fortran_env, only : int32, real64 use linalg_core implicit none ! Variables real(real64) :: a(3,2), s(2), u(3,3), vt(2,2), ac(3,2) integer(int32) :: i ! Initialize the 3-by-2 matrix A ! | 2 1 | ! A = |-3 1 | ! |-1 1 | a = reshape([2.0d0, -3.0d0, -1.0d0, 1.0d0, 1.0d0, 1.0d0], [3, 2]) ! Compute the singular value decomposition of A. Notice, V**T is returned ! instead of V. Also note, A is overwritten. call svd(a, s, u, vt) ! Display the results print '(A)', "U =" do i = 1, size(u, 1) print *, u(i,:) end do print '(A)', "S =" print '(F9.5)', (s(i), i = 1, size(a, 2)) print '(A)', "V**T =" do i = 1, size(vt, 1) print *, vt(i,:) end do ! Compute U * S * V**T, but first establish S in full form call diag_mtx_mult(.true., 1.0d0, s, vt) ! Compute: VT = S * V**T ac = matmul(u(:,1:2), vt) print '(A)', "U * S * V**T =" do i = 1, size(ac, 1) print *, ac(i,:) end do end program
gpl-3.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/function_optimize_10.f90
133
1371
! { dg-do run } ! PR 51858 - this used to generate wrong code. ! Original test case by Don Simons. program main implicit none logical :: test1_ok logical :: test2_ok logical :: test3_ok character(len=1):: charq charq = 'c' test1_ok = .true. test2_ok = .false. if (charq .eq. ' ') then test1_ok = .false. else if ((my_ichar(charq).ge.97 .and. my_ichar(charq).le.103)) then test2_OK = .true. end if if ((.not. test1_ok) .or. (.not. test2_ok)) call abort test1_ok = .true. test2_ok = .true. test3_ok = .false. if (charq .eq. ' ') then test1_ok = .false. else if ((my_ichar(charq).lt.97 .or. my_ichar(charq).gt.103)) then test2_ok = .false. else if ((my_ichar(charq).ge.97 .and. my_ichar(charq).le.103)) then test3_ok = .true. end if if ((.not. test1_ok) .or. (.not. test2_ok) .or. (.not. test3_ok)) call abort test1_ok = .true. test2_ok = .true. test3_ok = .false. if (charq .eq. ' ') then test1_ok = .false. else if ((my_ichar(charq).lt.97 .or. my_ichar(charq).gt.103)) then test2_ok = .false. else test3_ok = .true. end if if ((.not. test1_ok) .or. (.not. test2_ok) .or. (.not. test3_ok)) call abort contains pure function my_ichar(c) integer :: my_ichar character(len=1), intent(in) :: c my_ichar = ichar(c) end function my_ichar end program main
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/g77/970125-0.f
202
1528
c { dg-do compile } c c Following line added on transfer to gfortran testsuite c { dg-excess-errors "" } c C JCB comments: C g77 doesn't accept the added line "integer(kind=7) ..." -- C it crashes! C C It's questionable that g77 DTRT with regarding to passing C %LOC() as an argument (thus by reference) and the new global C analysis. I need to look into that further; my feeling is that C passing %LOC() as an argument should be treated like passing an C INTEGER(KIND=7) by reference, and no more specially than that C (and that INTEGER(KIND=7) should be permitted as equivalent to C INTEGER(KIND=1), INTEGER(KIND=2), or whatever, depending on the C system's pointer size). C C The back end *still* has a bug here, which should be fixed, C because, currently, what g77 is passing to it is, IMO, correct. C No options: C ../../egcs/gcc/f/info.c:259: failed assertion `ffeinfo_types_[basictype][kindtype] != NULL' C -fno-globals -O: C ../../egcs/gcc/expr.c:7291: Internal compiler error in function expand_expr c Frontend bug fixed by JCB 1998-06-01 com.c &c changes. integer i4 integer(kind=8) i8 integer(kind=8) max4 data max4/2147483647/ i4 = %loc(i4) i8 = %loc(i8) print *, max4 print *, i4, %loc(i4) print *, i8, %loc(i8) call foo(i4, %loc(i4), i8, %loc(i8)) end subroutine foo(i4, i4a, i8, i8a) integer(kind=7) i4a, i8a integer(kind=8) i8 print *, i4, i4a print *, i8, i8a end
gpl-2.0
luckti/barostat
src/AddBC.f90
1
11615
!This file is used to add some special Boundary condition !----------------------------------------------------- ! Extract a pipe from an original cuboid !----------------------------------------------------- subroutine PipeAdd implicit none include 'dpdflow.h' integer n, k integer pnf,nDf,nCf integer nwall, nfluid,nDfluid,nCfluid real*8 prad, prdw, prad2, prdw2, pryz, pryz2 real*8,dimension(:,:), allocatable :: trw,twn,trf,trv,tra, tDrf, tDrv, tDra,tCrf, tCrv, tCra pnf=nAtom-nChainend+nWallAtom+1 nDf=nDpEnd-nWallAtom+1 nCf=nChainend-nDpEnd+1 allocate(trw(pnf, NDIM), twn(pnf, NDIM), trf(pnf, NDIM), trv(pnf, NDIM), tra(pnf, NDIM)) allocate(tDrf(nDf, NDIM), tDrv(nDf, NDIM), tDra(nDf, NDIM)) allocate(tCrf(nCf, NDIM), tCrv(nCf, NDIM), tCra(nCf, NDIM)) prad=(min(region(2),region(3)))/2.-2.*gap(1) prdw = prad + 2.0*gap(1) prad2 = prad**2 prdw2 = prdw**2 nwall = 0 nfluid = 0 nDfluid = 0 nCfluid = 0 do n = 1, nAtom pryz2 = r(n,2)**2 + r(n,3)**2 if(pryz2 .ge. prad2 .and. pryz2 .le. prdw2) then if(n .gt. nWallAtom .and.n .lt. nDpEnd+1) then print*,'error: the droplet contained in the pipe so that switched into wall ' print*,' n = ', n print*, 'r(n) = ', (r(n,k), k = 1, 3) pause elseif(n .gt. nDpEnd .and.n .lt. nChainend+1)then print*,'error: the chain contained in the pipe so that switched into wall ' print*,' n = ', n print*, 'r(n) = ', (r(n,k), k = 1, 3) pause endif nwall = nwall + 1 pryz = sqrt(pryz2) do k = 1, NDIM trw(nwall,k) = r(n,k) enddo twn(nWall, 1) = 0. twn(nWall, 2) = -trw(nwall, 2)/pryz twn(nwall, 3) = -trw(nwall, 3)/pryz elseif(pryz2 .lt. prad2.and.(n .gt. nWallAtom .and. n.lt. nDpEnd+1)) then nDfluid = nDfluid + 1 do k = 1, NDIM tDrf(nDfluid,k) = r(n,k) tDrv(nDfluid,k) = rv(n,k) tDra(nDfluid,k) = ra(n,k) enddo elseif(pryz2 .lt. prad2 .and.(n .gt. nDpEnd .and. n.lt. nChainend+1)) then nCfluid = nCfluid + 1 do k = 1, NDIM tCrf(nCfluid,k) = r(n,k) tCrv(nCfluid,k) = rv(n,k) tCra(nCfluid,k) = ra(n,k) enddo elseif(pryz2 .lt. prad2.and. n.gt.nChainend) then nfluid = nfluid + 1 do k = 1, NDIM trf(nfluid,k) = r(n,k) trv(nfluid,k) = rv(n,k) tra(nfluid,k) = ra(n,k) enddo endif enddo nWallAtom=nwall nDpEnd=nWallAtom+nDfluid nChainend=nDpEnd+nCfluid nAtom=nChainend+nfluid do n =1, nAtom do k = 1, NDIM if (n.le.nWallAtom)then r(n, k) = trw(n,k) wn(n, k) = twn(n,k) rv(n, k) = 0. ra(n, k) = 0. elseif(n.gt.nWallAtom.and.n.le.nDpEnd)then r(n, k) = tDrf(n-nWallAtom,k) rv(n, k) = tDrv(n-nWallAtom,k) ra(n, k) = tDra(n-nWallAtom,k) elseif(n.gt.nDpEnd.and.n.le.nChainend)then r(n, k) = tCrf(n-nDpEnd,k) rv(n, k) = tCrv(n-nDpEnd,k) ra(n, k) = tCra(n-nDpEnd,k) else r(n, k) = trf(n-nChainend,k) rv(n, k) = trv(n-nChainend,k) ra(n, k) = tra(n-nChainend,k) endif enddo enddo nStartAtom = 1 PNDIM = 1 ! call ouptParticleSituation ! nDpEnd = nWallAtom ! nChainend = nWallAtom ! write(30,'(//'' Coordinates of Wall Particles'')') ! write(30,'(2x, ''n'', 6x,''x'', 8x, ''y'', 8x, ''z'', 8x, & ! ''nx'', 7x, ''ny'', 7x, ''nz'')') ! do n = 1, nWallAtom ! enddo ! write(30,'(//'' Coordinates of Simple Particles''/)') ! do n = nChainend + 1, nAtom ! write(30,'(i6, 3f9.4)') n, (r(n,i), i = 1,3) !enddo deallocate(trw, twn, trf, trv, tra) deallocate(tDrf, tDrv, tDra) deallocate(tCrf, tCrv, tCra) end !---------------------------------------------------------------------------------------------------------- subroutine MidPlaneAdd implicit none include 'dpdflow.h' integer n, k integer pnf,nDf,nCf integer nwall, nfluid,nDfluid,nCfluid real*8 prad, prdw, prad2, prdw2, pryz, pryz2, bdp real*8,dimension(:,:), allocatable :: trw,twn,trf,trv,tra, tDrf, tDrv, tDra,tCrf, tCrv, tCra pnf=nAtom-nChainend+nWallAtom+1 nDf=nDpEnd-nWallAtom+1 nCf=nChainend-nDpEnd+1 allocate(trw(pnf, NDIM), twn(pnf, NDIM), trf(pnf, NDIM), trv(pnf, NDIM), tra(pnf, NDIM)) allocate(tDrf(nDf, NDIM), tDrv(nDf, NDIM), tDra(nDf, NDIM)) allocate(tCrf(nCf, NDIM), tCrv(nCf, NDIM), tCra(nCf, NDIM)) bdp=2 prad=RdsDp+bdp prdw = prad + 2.0*gap(3) prad2 = prad**2 prdw2 = prdw**2 nwall = 0 nfluid = 0 nDfluid = 0 nCfluid = 0 do n = 1, nAtom pryz2 = r(n,3)**2 if(pryz2 .ge. prad2 .and. pryz2 .le. prdw2 .and.r(n,3) > 0) then if(n .gt. nWallAtom .and.n .lt. nDpEnd+1) then print*,'error: the droplet contained in the pipe so that switched into wall ' print*,' n = ', n print*, 'r(n) = ', (r(n,k), k = 1, 3) pause elseif(n .gt. nDpEnd .and.n .lt. nChainend+1)then print*,'error: the chain contained in the pipe so that switched into wall ' print*,' n = ', n print*, 'r(n) = ', (r(n,k), k = 1, 3) pause endif nwall = nwall + 1 pryz = sqrt(pryz2) do k = 1, NDIM trw(nwall,k) = r(n,k) enddo twn(nWall, 1) = 0. twn(nWall, 2) = -trw(nwall, 2)/pryz twn(nwall, 3) = -trw(nwall, 3)/pryz elseif(n .gt. nWallAtom .and. n.lt. nDpEnd+1) then nDfluid = nDfluid + 1 do k = 1, NDIM tDrf(nDfluid,k) = r(n,k) tDrv(nDfluid,k) = rv(n,k) tDra(nDfluid,k) = ra(n,k) enddo elseif(n .gt. nDpEnd .and. n.lt. nChainend+1) then nCfluid = nCfluid + 1 do k = 1, NDIM tCrf(nCfluid,k) = r(n,k) tCrv(nCfluid,k) = rv(n,k) tCra(nCfluid,k) = ra(n,k) enddo elseif(n.gt.nChainend) then nfluid = nfluid + 1 do k = 1, NDIM trf(nfluid,k) = r(n,k) trv(nfluid,k) = rv(n,k) tra(nfluid,k) = ra(n,k) enddo endif enddo nWallAtom=nwall nDpEnd=nWallAtom+nDfluid nChainend=nDpEnd+nCfluid nAtom=nChainend+nfluid do n =1, nAtom do k = 1, NDIM if (n.le.nWallAtom)then r(n, k) = trw(n,k) wn(n, k) = twn(n,k) rv(n, k) = 0. ra(n, k) = 0. elseif(n.gt.nWallAtom.and.n.le.nDpEnd)then r(n, k) = tDrf(n-nWallAtom,k) rv(n, k) = tDrv(n-nWallAtom,k) ra(n, k) = tDra(n-nWallAtom,k) elseif(n.gt.nDpEnd.and.n.le.nChainend)then r(n, k) = tCrf(n-nDpEnd,k) rv(n, k) = tCrv(n-nDpEnd,k) ra(n, k) = tCra(n-nDpEnd,k) else r(n, k) = trf(n-nChainend,k) rv(n, k) = trv(n-nChainend,k) ra(n, k) = tra(n-nChainend,k) endif enddo enddo nStartAtom = 1 PNDIM = 3 ! call ouptParticleSituation deallocate(trw, twn, trf, trv, tra) deallocate(tDrf, tDrv, tDra) deallocate(tCrf, tCrv, tCra) end !---------------------------------------------------------------------------------------------------------- subroutine DigCentreBubbleGap implicit none include 'dpdflow.h' integer n, k integer pnf,nDf,nCf,dbf integer nfluid,nDfluid,nCfluid real*8 bubbleR,pxyz2 logical fexist real*8,dimension(:,:), allocatable :: trf,trv,tra, tDrf, tDrv, tDra,tCrf, tCrv, tCra pnf=nAtom-nChainend+1 nDf=nDpEnd-nWallAtom+1 nCf=nChainend-nDpEnd+1 allocate(trf(pnf, NDIM), trv(pnf, NDIM), tra(pnf, NDIM)) allocate(tDrf(nDf, NDIM), tDrv(nDf, NDIM), tDra(nDf, NDIM)) allocate(tCrf(nCf, NDIM), tCrv(nCf, NDIM), tCra(nCf, NDIM)) 1 nfluid = 0 nDfluid = 0 nCfluid = 0 dbf = 41 inquire(file= './data/digBubbleRadius.dat',exist=fexist) if(fexist) then open(dbf,file= './data/digBubbleRadius.dat') read(dbf,*) read(dbf,*) bubbleR print*,'The bubble radius is:', bubbleR else write(*,*) 'please input the bubble radius which you want to dig :' read(*,*) bubbleR open(dbf,file= './data/digBubbleRadius.dat') write(dbf,*) 'Bubble radius' write(dbf,*) bubbleR endif do n = 1, nAtom pxyz2 = r(n,3)**2+r(n,2)**2+r(n,1)**2 if(n .le. nChainend .and. pxyz2 .le. bubbleR*bubbleR) then close(dbf) print*,'The bubble radius so big that contain the no fluid atom.' write(*,*) 'please input the bubble radius which you want to dig :' open(dbf,file= './data/digBubbleRadius.dat') read(*,*) bubbleR write(dbf,*) 'Bubble radius' write(dbf,*) bubbleR goto 1 elseif(n .gt. nWallAtom .and. n.lt. nDpEnd+1) then nDfluid = nDfluid + 1 do k = 1, NDIM tDrf(nDfluid,k) = r(n,k) tDrv(nDfluid,k) = rv(n,k) tDra(nDfluid,k) = ra(n,k) enddo elseif(n .gt. nDpEnd .and. n.lt. nChainend+1) then nCfluid = nCfluid + 1 do k = 1, NDIM tCrf(nCfluid,k) = r(n,k) tCrv(nCfluid,k) = rv(n,k) tCra(nCfluid,k) = ra(n,k) enddo elseif(pxyz2 .ge. bubbleR*bubbleR .and. n.gt.nChainend) then nfluid = nfluid + 1 do k = 1, NDIM trf(nfluid,k) = r(n,k) trv(nfluid,k) = rv(n,k) tra(nfluid,k) = ra(n,k) enddo endif enddo nDpEnd=nWallAtom+nDfluid nChainend=nDpEnd+nCfluid nAtom=nChainend+nfluid do n =1, nAtom do k = 1, NDIM if(n.gt.nWallAtom.and.n.le.nDpEnd)then r(n, k) = tDrf(n-nWallAtom,k) rv(n, k) = tDrv(n-nWallAtom,k) ra(n, k) = tDra(n-nWallAtom,k) elseif(n.gt.nDpEnd.and.n.le.nChainend)then r(n, k) = tCrf(n-nDpEnd,k) rv(n, k) = tCrv(n-nDpEnd,k) ra(n, k) = tCra(n-nDpEnd,k) elseif(n.gt.nChainend) then r(n, k) = trf(n-nChainend,k) rv(n, k) = trv(n-nChainend,k) ra(n, k) = tra(n-nChainend,k) endif enddo enddo nStartAtom = nWallAtom PNDIM = 0 ! call ouptParticleSituation deallocate(trf, trv, tra) deallocate(tDrf, tDrv, tDra) deallocate(tCrf, tCrv, tCra) close(dbf) end
gpl-3.0
jeffrey-newman/Inundate-landscape-fluvial-bathtub
v1/eigen/blas/sspmv.f
184
7974
SUBROUTINE SSPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY) * .. Scalar Arguments .. REAL ALPHA,BETA INTEGER INCX,INCY,N CHARACTER UPLO * .. * .. Array Arguments .. REAL AP(*),X(*),Y(*) * .. * * Purpose * ======= * * SSPMV performs the matrix-vector operation * * y := alpha*A*x + beta*y, * * where alpha and beta are scalars, x and y are n element vectors and * A is an n by n symmetric matrix, supplied in packed form. * * Arguments * ========== * * UPLO - CHARACTER*1. * On entry, UPLO specifies whether the upper or lower * triangular part of the matrix A is supplied in the packed * array AP as follows: * * UPLO = 'U' or 'u' The upper triangular part of A is * supplied in AP. * * UPLO = 'L' or 'l' The lower triangular part of A is * supplied in AP. * * Unchanged on exit. * * N - INTEGER. * On entry, N specifies the order of the matrix A. * N must be at least zero. * Unchanged on exit. * * ALPHA - REAL . * On entry, ALPHA specifies the scalar alpha. * Unchanged on exit. * * AP - REAL array of DIMENSION at least * ( ( n*( n + 1 ) )/2 ). * Before entry with UPLO = 'U' or 'u', the array AP must * contain the upper triangular part of the symmetric matrix * packed sequentially, column by column, so that AP( 1 ) * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) * and a( 2, 2 ) respectively, and so on. * Before entry with UPLO = 'L' or 'l', the array AP must * contain the lower triangular part of the symmetric matrix * packed sequentially, column by column, so that AP( 1 ) * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) * and a( 3, 1 ) respectively, and so on. * Unchanged on exit. * * X - REAL array of dimension at least * ( 1 + ( n - 1 )*abs( INCX ) ). * Before entry, the incremented array X must contain the n * element vector x. * Unchanged on exit. * * INCX - INTEGER. * On entry, INCX specifies the increment for the elements of * X. INCX must not be zero. * Unchanged on exit. * * BETA - REAL . * On entry, BETA specifies the scalar beta. When BETA is * supplied as zero then Y need not be set on input. * Unchanged on exit. * * Y - REAL array of dimension at least * ( 1 + ( n - 1 )*abs( INCY ) ). * Before entry, the incremented array Y must contain the n * element vector y. On exit, Y is overwritten by the updated * vector y. * * INCY - INTEGER. * On entry, INCY specifies the increment for the elements of * Y. INCY must not be zero. * Unchanged on exit. * * Further Details * =============== * * Level 2 Blas routine. * * -- Written on 22-October-1986. * Jack Dongarra, Argonne National Lab. * Jeremy Du Croz, Nag Central Office. * Sven Hammarling, Nag Central Office. * Richard Hanson, Sandia National Labs. * * ===================================================================== * * .. Parameters .. REAL ONE,ZERO PARAMETER (ONE=1.0E+0,ZERO=0.0E+0) * .. * .. Local Scalars .. REAL TEMP1,TEMP2 INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL XERBLA * .. * * Test the input parameters. * INFO = 0 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN INFO = 1 ELSE IF (N.LT.0) THEN INFO = 2 ELSE IF (INCX.EQ.0) THEN INFO = 6 ELSE IF (INCY.EQ.0) THEN INFO = 9 END IF IF (INFO.NE.0) THEN CALL XERBLA('SSPMV ',INFO) RETURN END IF * * Quick return if possible. * IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN * * Set up the start points in X and Y. * IF (INCX.GT.0) THEN KX = 1 ELSE KX = 1 - (N-1)*INCX END IF IF (INCY.GT.0) THEN KY = 1 ELSE KY = 1 - (N-1)*INCY END IF * * Start the operations. In this version the elements of the array AP * are accessed sequentially with one pass through AP. * * First form y := beta*y. * IF (BETA.NE.ONE) THEN IF (INCY.EQ.1) THEN IF (BETA.EQ.ZERO) THEN DO 10 I = 1,N Y(I) = ZERO 10 CONTINUE ELSE DO 20 I = 1,N Y(I) = BETA*Y(I) 20 CONTINUE END IF ELSE IY = KY IF (BETA.EQ.ZERO) THEN DO 30 I = 1,N Y(IY) = ZERO IY = IY + INCY 30 CONTINUE ELSE DO 40 I = 1,N Y(IY) = BETA*Y(IY) IY = IY + INCY 40 CONTINUE END IF END IF END IF IF (ALPHA.EQ.ZERO) RETURN KK = 1 IF (LSAME(UPLO,'U')) THEN * * Form y when AP contains the upper triangle. * IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN DO 60 J = 1,N TEMP1 = ALPHA*X(J) TEMP2 = ZERO K = KK DO 50 I = 1,J - 1 Y(I) = Y(I) + TEMP1*AP(K) TEMP2 = TEMP2 + AP(K)*X(I) K = K + 1 50 CONTINUE Y(J) = Y(J) + TEMP1*AP(KK+J-1) + ALPHA*TEMP2 KK = KK + J 60 CONTINUE ELSE JX = KX JY = KY DO 80 J = 1,N TEMP1 = ALPHA*X(JX) TEMP2 = ZERO IX = KX IY = KY DO 70 K = KK,KK + J - 2 Y(IY) = Y(IY) + TEMP1*AP(K) TEMP2 = TEMP2 + AP(K)*X(IX) IX = IX + INCX IY = IY + INCY 70 CONTINUE Y(JY) = Y(JY) + TEMP1*AP(KK+J-1) + ALPHA*TEMP2 JX = JX + INCX JY = JY + INCY KK = KK + J 80 CONTINUE END IF ELSE * * Form y when AP contains the lower triangle. * IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN DO 100 J = 1,N TEMP1 = ALPHA*X(J) TEMP2 = ZERO Y(J) = Y(J) + TEMP1*AP(KK) K = KK + 1 DO 90 I = J + 1,N Y(I) = Y(I) + TEMP1*AP(K) TEMP2 = TEMP2 + AP(K)*X(I) K = K + 1 90 CONTINUE Y(J) = Y(J) + ALPHA*TEMP2 KK = KK + (N-J+1) 100 CONTINUE ELSE JX = KX JY = KY DO 120 J = 1,N TEMP1 = ALPHA*X(JX) TEMP2 = ZERO Y(JY) = Y(JY) + TEMP1*AP(KK) IX = JX IY = JY DO 110 K = KK + 1,KK + N - J IX = IX + INCX IY = IY + INCY Y(IY) = Y(IY) + TEMP1*AP(K) TEMP2 = TEMP2 + AP(K)*X(IX) 110 CONTINUE Y(JY) = Y(JY) + ALPHA*TEMP2 JX = JX + INCX JY = JY + INCY KK = KK + (N-J+1) 120 CONTINUE END IF END IF * RETURN * * End of SSPMV . * END
gpl-3.0
henriasv/lammps
lib/linalg/dgemm.f
68
11319
*> \brief \b DGEMM * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE DGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) * * .. Scalar Arguments .. * DOUBLE PRECISION ALPHA,BETA * INTEGER K,LDA,LDB,LDC,M,N * CHARACTER TRANSA,TRANSB * .. * .. Array Arguments .. * DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> DGEMM performs one of the matrix-matrix operations *> *> C := alpha*op( A )*op( B ) + beta*C, *> *> where op( X ) is one of *> *> op( X ) = X or op( X ) = X**T, *> *> alpha and beta are scalars, and A, B and C are matrices, with op( A ) *> an m by k matrix, op( B ) a k by n matrix and C an m by n matrix. *> \endverbatim * * Arguments: * ========== * *> \param[in] TRANSA *> \verbatim *> TRANSA is CHARACTER*1 *> On entry, TRANSA specifies the form of op( A ) to be used in *> the matrix multiplication as follows: *> *> TRANSA = 'N' or 'n', op( A ) = A. *> *> TRANSA = 'T' or 't', op( A ) = A**T. *> *> TRANSA = 'C' or 'c', op( A ) = A**T. *> \endverbatim *> *> \param[in] TRANSB *> \verbatim *> TRANSB is CHARACTER*1 *> On entry, TRANSB specifies the form of op( B ) to be used in *> the matrix multiplication as follows: *> *> TRANSB = 'N' or 'n', op( B ) = B. *> *> TRANSB = 'T' or 't', op( B ) = B**T. *> *> TRANSB = 'C' or 'c', op( B ) = B**T. *> \endverbatim *> *> \param[in] M *> \verbatim *> M is INTEGER *> On entry, M specifies the number of rows of the matrix *> op( A ) and of the matrix C. M must be at least zero. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> On entry, N specifies the number of columns of the matrix *> op( B ) and the number of columns of the matrix C. N must be *> at least zero. *> \endverbatim *> *> \param[in] K *> \verbatim *> K is INTEGER *> On entry, K specifies the number of columns of the matrix *> op( A ) and the number of rows of the matrix op( B ). K must *> be at least zero. *> \endverbatim *> *> \param[in] ALPHA *> \verbatim *> ALPHA is DOUBLE PRECISION. *> On entry, ALPHA specifies the scalar alpha. *> \endverbatim *> *> \param[in] A *> \verbatim *> A is DOUBLE PRECISION array of DIMENSION ( LDA, ka ), where ka is *> k when TRANSA = 'N' or 'n', and is m otherwise. *> Before entry with TRANSA = 'N' or 'n', the leading m by k *> part of the array A must contain the matrix A, otherwise *> the leading k by m part of the array A must contain the *> matrix A. *> \endverbatim *> *> \param[in] LDA *> \verbatim *> LDA is INTEGER *> On entry, LDA specifies the first dimension of A as declared *> in the calling (sub) program. When TRANSA = 'N' or 'n' then *> LDA must be at least max( 1, m ), otherwise LDA must be at *> least max( 1, k ). *> \endverbatim *> *> \param[in] B *> \verbatim *> B is DOUBLE PRECISION array of DIMENSION ( LDB, kb ), where kb is *> n when TRANSB = 'N' or 'n', and is k otherwise. *> Before entry with TRANSB = 'N' or 'n', the leading k by n *> part of the array B must contain the matrix B, otherwise *> the leading n by k part of the array B must contain the *> matrix B. *> \endverbatim *> *> \param[in] LDB *> \verbatim *> LDB is INTEGER *> On entry, LDB specifies the first dimension of B as declared *> in the calling (sub) program. When TRANSB = 'N' or 'n' then *> LDB must be at least max( 1, k ), otherwise LDB must be at *> least max( 1, n ). *> \endverbatim *> *> \param[in] BETA *> \verbatim *> BETA is DOUBLE PRECISION. *> On entry, BETA specifies the scalar beta. When BETA is *> supplied as zero then C need not be set on input. *> \endverbatim *> *> \param[in,out] C *> \verbatim *> C is DOUBLE PRECISION array of DIMENSION ( LDC, n ). *> Before entry, the leading m by n part of the array C must *> contain the matrix C, except when beta is zero, in which *> case C need not be set on entry. *> On exit, the array C is overwritten by the m by n matrix *> ( alpha*op( A )*op( B ) + beta*C ). *> \endverbatim *> *> \param[in] LDC *> \verbatim *> LDC is INTEGER *> On entry, LDC specifies the first dimension of C as declared *> in the calling (sub) program. LDC must be at least *> max( 1, m ). *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \date November 2011 * *> \ingroup double_blas_level3 * *> \par Further Details: * ===================== *> *> \verbatim *> *> Level 3 Blas routine. *> *> -- Written on 8-February-1989. *> Jack Dongarra, Argonne National Laboratory. *> Iain Duff, AERE Harwell. *> Jeremy Du Croz, Numerical Algorithms Group Ltd. *> Sven Hammarling, Numerical Algorithms Group Ltd. *> \endverbatim *> * ===================================================================== SUBROUTINE DGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) * * -- Reference BLAS level3 routine (version 3.4.0) -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2011 * * .. Scalar Arguments .. DOUBLE PRECISION ALPHA,BETA INTEGER K,LDA,LDB,LDC,M,N CHARACTER TRANSA,TRANSB * .. * .. Array Arguments .. DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*) * .. * * ===================================================================== * * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX * .. * .. Local Scalars .. DOUBLE PRECISION TEMP INTEGER I,INFO,J,L,NCOLA,NROWA,NROWB LOGICAL NOTA,NOTB * .. * .. Parameters .. DOUBLE PRECISION ONE,ZERO PARAMETER (ONE=1.0D+0,ZERO=0.0D+0) * .. * * Set NOTA and NOTB as true if A and B respectively are not * transposed and set NROWA, NCOLA and NROWB as the number of rows * and columns of A and the number of rows of B respectively. * NOTA = LSAME(TRANSA,'N') NOTB = LSAME(TRANSB,'N') IF (NOTA) THEN NROWA = M NCOLA = K ELSE NROWA = K NCOLA = M END IF IF (NOTB) THEN NROWB = K ELSE NROWB = N END IF * * Test the input parameters. * INFO = 0 IF ((.NOT.NOTA) .AND. (.NOT.LSAME(TRANSA,'C')) .AND. + (.NOT.LSAME(TRANSA,'T'))) THEN INFO = 1 ELSE IF ((.NOT.NOTB) .AND. (.NOT.LSAME(TRANSB,'C')) .AND. + (.NOT.LSAME(TRANSB,'T'))) THEN INFO = 2 ELSE IF (M.LT.0) THEN INFO = 3 ELSE IF (N.LT.0) THEN INFO = 4 ELSE IF (K.LT.0) THEN INFO = 5 ELSE IF (LDA.LT.MAX(1,NROWA)) THEN INFO = 8 ELSE IF (LDB.LT.MAX(1,NROWB)) THEN INFO = 10 ELSE IF (LDC.LT.MAX(1,M)) THEN INFO = 13 END IF IF (INFO.NE.0) THEN CALL XERBLA('DGEMM ',INFO) RETURN END IF * * Quick return if possible. * IF ((M.EQ.0) .OR. (N.EQ.0) .OR. + (((ALPHA.EQ.ZERO).OR. (K.EQ.0)).AND. (BETA.EQ.ONE))) RETURN * * And if alpha.eq.zero. * IF (ALPHA.EQ.ZERO) THEN IF (BETA.EQ.ZERO) THEN DO 20 J = 1,N DO 10 I = 1,M C(I,J) = ZERO 10 CONTINUE 20 CONTINUE ELSE DO 40 J = 1,N DO 30 I = 1,M C(I,J) = BETA*C(I,J) 30 CONTINUE 40 CONTINUE END IF RETURN END IF * * Start the operations. * IF (NOTB) THEN IF (NOTA) THEN * * Form C := alpha*A*B + beta*C. * DO 90 J = 1,N IF (BETA.EQ.ZERO) THEN DO 50 I = 1,M C(I,J) = ZERO 50 CONTINUE ELSE IF (BETA.NE.ONE) THEN DO 60 I = 1,M C(I,J) = BETA*C(I,J) 60 CONTINUE END IF DO 80 L = 1,K IF (B(L,J).NE.ZERO) THEN TEMP = ALPHA*B(L,J) DO 70 I = 1,M C(I,J) = C(I,J) + TEMP*A(I,L) 70 CONTINUE END IF 80 CONTINUE 90 CONTINUE ELSE * * Form C := alpha*A**T*B + beta*C * DO 120 J = 1,N DO 110 I = 1,M TEMP = ZERO DO 100 L = 1,K TEMP = TEMP + A(L,I)*B(L,J) 100 CONTINUE IF (BETA.EQ.ZERO) THEN C(I,J) = ALPHA*TEMP ELSE C(I,J) = ALPHA*TEMP + BETA*C(I,J) END IF 110 CONTINUE 120 CONTINUE END IF ELSE IF (NOTA) THEN * * Form C := alpha*A*B**T + beta*C * DO 170 J = 1,N IF (BETA.EQ.ZERO) THEN DO 130 I = 1,M C(I,J) = ZERO 130 CONTINUE ELSE IF (BETA.NE.ONE) THEN DO 140 I = 1,M C(I,J) = BETA*C(I,J) 140 CONTINUE END IF DO 160 L = 1,K IF (B(J,L).NE.ZERO) THEN TEMP = ALPHA*B(J,L) DO 150 I = 1,M C(I,J) = C(I,J) + TEMP*A(I,L) 150 CONTINUE END IF 160 CONTINUE 170 CONTINUE ELSE * * Form C := alpha*A**T*B**T + beta*C * DO 200 J = 1,N DO 190 I = 1,M TEMP = ZERO DO 180 L = 1,K TEMP = TEMP + A(L,I)*B(J,L) 180 CONTINUE IF (BETA.EQ.ZERO) THEN C(I,J) = ALPHA*TEMP ELSE C(I,J) = ALPHA*TEMP + BETA*C(I,J) END IF 190 CONTINUE 200 CONTINUE END IF END IF * RETURN * * End of DGEMM . * END
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/direct_io_10.f
174
1266
! { dg-do run } ! pr35699 run-time abort writing zero sized section to direct access file program directio call qi0010 ( 10, 1, 2, 3, 4, 9, 2) end subroutine qi0010 (nf10, nf1, nf2, nf3, nf4,nf9, np2) character(10) bda(nf10) character(10) bda1(nf10), bval integer j_len bda1(1) = 'x' do i = 2,10 bda1(i) = 'x'//bda1(i-1) enddo bda = 'unread' inquire(iolength = j_len) bda1(nf1:nf10:nf2), bda1(nf4:nf3), $ bda1(nf2:nf10:nf2) open (unit=48, $ access='direct', $ status='scratch', $ recl = j_len, $ iostat = istat, $ form='unformatted', $ action='readwrite') write (48,iostat = istat, rec = 3) bda1(nf1:nf10:nf2), $ bda1(nf4:nf3), bda1(nf2:nf10:nf2) if ( istat .ne. 0) then call abort endif istat = -314 read (48,iostat = istat, rec = np2+1) bda(nf1:nf9:nf2), $ bda(nf4:nf3), bda(nf2:nf10:nf2) if ( istat .ne. 0) then call abort endif do j1 = 1,10 bval = bda1(j1) if (bda(j1) .ne. bval) call abort enddo end subroutine
gpl-2.0
mogrodnik/piernik
src/base/sortable_list.F90
3
6555
! ! PIERNIK Code Copyright (C) 2006 Michal Hanasz ! ! This file is part of PIERNIK code. ! ! PIERNIK is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! PIERNIK is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with PIERNIK. If not, see <http://www.gnu.org/licenses/>. ! ! Initial implementation of PIERNIK code was based on TVD split MHD code by ! Ue-Li Pen ! see: Pen, Arras & Wong (2003) for algorithm and ! http://www.cita.utoronto.ca/~pen/MHD ! for original source code "mhd.f90" ! ! For full list of developers see $PIERNIK_HOME/license/pdt.txt ! #include "piernik.h" !> \brief Module that contains a general sorting routine. To be extended for other more sophisticated structures module sortable_list implicit none private public :: sortable_list_t, cleanup_sortable_list, temp_index !> !! \brief Abstract array of sortable elements with sorting method !! !! \details This type does not contain any actual array since it is too hard to extend it later to something !! usable. Every type that extends this one has to provide own sortable array and methods to allocate it, !! deallocate it, get bounds, make assignments and comparisons based on integer indices. !! Note that we use special index (parameter temp_index) to denote temporary storage for swapping elements. !< type, abstract :: sortable_list_t contains procedure(lubound_list), deferred :: l_bound !< Get lower bound of the list procedure(lubound_list), deferred :: u_bound !< Get upper bound of the list procedure(assign_list), deferred :: assign_element !< Make an assignment procedure(compare_list), deferred :: compare_elements !< Make a comparison procedure :: sort !< Sorting routine (currently shellsort) end type sortable_list_t interface subroutine assign_list(this, a, b) import sortable_list_t class(sortable_list_t), intent(inout) :: this integer, intent(in) :: a, b end subroutine assign_list pure logical function compare_list(this, a, b) import sortable_list_t class(sortable_list_t), intent(in) :: this integer, intent(in) :: a, b end function compare_list integer function lubound_list(this) import sortable_list_t class(sortable_list_t), intent(in) :: this end function lubound_list end interface integer, parameter :: temp_index = -huge(1) !< Symbolic index indicating temporary storage integer, dimension(:), allocatable :: gaps !< Auxiliary array for the sorting routine. Can be expanded and reused, so it is detached from the type sortable_list_t contains !> \brief deallocate everything locally allocated subroutine cleanup_sortable_list implicit none if (allocated(gaps)) deallocate(gaps) end subroutine cleanup_sortable_list !> !! \brief Shell sort with nontrivial coefficients !! !! \details Gap sequence according to: !! Tokuda, Naoyuki (1992). "An Improved Shellsort". In van Leeuven, Jan. Proceedings of the IFIP 12th World Computer Congress on Algorithms, Software, Architecture. !! Alternatively one can use gaps provided by M. Ciura "Best Increments for the Average Case of Shellsort". !! Proceedings of the 13th International Symposium on Fundamentals of Computation Theory. London: pp. 106~117. ISBN 3-540-42487-3. !! The Tokuda's gaps were chosen here due to their algebraic prescription. !! Ciura's gaps are: [ 1, 4, 10, 23, 57, 132, 301, 701 ] and were obtained by numerical searching of optimal average sorting time of the algorithm !! Larger Ciura's gaps can be obtained approximately with multiplier 2.25 !! !! \todo Consider rewriting to mergesort if this routine consumes too much CPU power !< subroutine sort(this) implicit none class(sortable_list_t), intent(inout) :: this integer :: g, i, j integer :: lb, ub lb = this%l_bound() ub = this%u_bound() if (.not. allocated(gaps)) then allocate(gaps(1)) gaps(1) = 1 endif do while (gaps(ubound(gaps, dim=1)) < ub) gaps = [ gaps, tokuda(ubound(gaps, dim=1)+1) ] enddo do g = ubound(gaps, dim=1), lbound(gaps, dim=1), -1 do i = gaps(g)+1, ub call this%assign_element(temp_index, i) !this%temp = this%list(i) j = i ! do while (j > gaps(g) .and. this%list(max(j - gaps(g), lbound(this%list, dim=1)))%id > temp%id) do while (j > gaps(g) .and. this%compare_elements(max(j - gaps(g), lb), temp_index)) ! Either use max() here, or put this%list(j - gaps(g)) with an "if" inside the while loop call this%assign_element(j, j-gaps(g)) !this%list(j) = this%list(j - gaps(g)) j = j - gaps(g) enddo call this%assign_element(j, temp_index) !this%list(j) = this%temp enddo enddo #ifdef DEBUG call check #endif /* DEBUG */ contains !> \brief Return k-th gap according to Tokuda prescription integer function tokuda(k) use dataio_pub, only: die implicit none integer, intent(in) :: k if (k < 1) call die("[sortable_list:sort:tokuda] k<1") tokuda = ceiling(0.8 * (2.25**k - 1.)) ! == ceiling((9**k-4**k)/(5.*4**(k-1))) end function tokuda !> \brief Check if our sorting was performed correctly subroutine check use dataio_pub, only: msg, warn, die implicit none logical :: fail fail = .false. do i = this%l_bound(), this%u_bound() - 1 if (this%compare_elements(i, i+1)) then write(msg,*)"this%list(", i+1, ") < this%list(", i, ")%id" call warn(msg) fail = .true. endif enddo if (fail) call die("[sortable_list:sort] failed") end subroutine check end subroutine sort end module sortable_list
gpl-3.0
HPAC/mr3smp
EXAMPLES/Hermitian/Fortran/main_ind.f
2
1335
PROGRAM MAIN INTEGER N, NMAX, JMAX, IL, IU, M, LDA, LDZ, ZERO, $ SEED PARAMETER (NMAX=1000, JMAX=NMAX, LDA=NMAX, LDZ=NMAX, ZERO=0, $ SEED=12) DOUBLE PRECISION VL, VU, W(NMAX) COMPLEX*16 A(NMAX,NMAX), Z(NMAX,JMAX) INTEGER I, J, IERR * external functions EXTERNAL ZHEEIG * Intialize Hermitian matrix A of size N-by-N N = 100 CALL SRAND(SEED) DO 100, J=1,N DO 200, I=1,J IF (I .EQ. J) THEN A(I,J) = COMPLEX(RAND(),ZERO) ELSE A(I,J) = COMPLEX(RAND(),RAND()) ENDIF 200 CONTINUE 100 CONTINUE DO 300, J=1,N DO 400, I=J+1,N A(I,J) = CONJG(A(J,I)) 400 CONTINUE 300 CONTINUE * Solve the eigenproblem * The number of threads for the LAPACK routines are set by * OMP_NUM_THREADS or GOTO_NUM_THREADS or MKL_NUM_THREADS ... * depending on the BLAS used. For the tridiagonal stage with * PMR_NUM_THREADS. IL = 1 IU = N/2 + 1 CALL ZHEEIG('V', 'I', 'L', N, A, LDA, VL, VU, IL, IU, $ M, W, Z, LDZ, IERR) IF (IERR .NE. 0) THEN WRITE(*,*) 'Routine has failed with error', IERR ENDIF WRITE(*,*) 'Sucessfully computed eigenpairs!' END
bsd-3-clause
HPAC/mr3smp
SRC/LAPACK/odrrc.f
2
4508
SUBROUTINE ODRRC( JOBT, N, VL, VU, D, E, PIVMIN, $ EIGCNT, LCNT, RCNT, INFO ) * * -- LAPACK auxiliary routine (version 3.2) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2006 * * .. Scalar Arguments .. CHARACTER JOBT INTEGER EIGCNT, INFO, LCNT, N, RCNT DOUBLE PRECISION PIVMIN, VL, VU * .. * .. Array Arguments .. DOUBLE PRECISION D( * ), E( * ) * .. * * Purpose * ======= * * Find the number of eigenvalues of the symmetric tridiagonal matrix T * that are in the interval (VL,VU] if JOBT = 'T', and of L D L^T * if JOBT = 'L'. * * Arguments * ========= * * JOBT (input) CHARACTER*1 * = 'T': Compute Sturm count for matrix T. * = 'L': Compute Sturm count for matrix L D L^T. * * N (input) INTEGER * The order of the matrix. N > 0. * * VL (input) DOUBLE PRECISION * VU (input) DOUBLE PRECISION * The lower and upper bounds for the eigenvalues. * * D (input) DOUBLE PRECISION array, dimension (N) * JOBT = 'T': The N diagonal elements of the tridiagonal matrix T. * JOBT = 'L': The N diagonal elements of the diagonal matrix D. * * E (input) DOUBLE PRECISION array, dimension (N) * JOBT = 'T': The N-1 offdiagonal elements of the matrix T. * JOBT = 'L': The N-1 offdiagonal elements of the matrix L. * * PIVMIN (input) DOUBLE PRECISION * The minimum pivot in the Sturm sequence for T. * * EIGCNT (output) INTEGER * The number of eigenvalues of the symmetric tridiagonal matrix T * that are in the interval (VL,VU] * * LCNT (output) INTEGER * RCNT (output) INTEGER * The left and right negcounts of the interval. * * INFO (output) INTEGER * * Further Details * =============== * * Based on contributions by * Beresford Parlett, University of California, Berkeley, USA * Jim Demmel, University of California, Berkeley, USA * Inderjit Dhillon, University of Texas, Austin, USA * Osni Marques, LBNL/NERSC, USA * Christof Voemel, University of California, Berkeley, USA * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ZERO PARAMETER ( ZERO = 0.0D0 ) * .. * .. Local Scalars .. INTEGER I LOGICAL MATT DOUBLE PRECISION LPIVOT, RPIVOT, SL, SU, TMP, TMP2 * .. * .. External Functions .. LOGICAL OLSAME EXTERNAL OLSAME * .. * .. Executable Statements .. * INFO = 0 LCNT = 0 RCNT = 0 EIGCNT = 0 MATT = OLSAME( JOBT, 'T' ) IF (MATT) THEN * Sturm sequence count on T LPIVOT = D( 1 ) - VL RPIVOT = D( 1 ) - VU IF( LPIVOT.LE.ZERO ) THEN LCNT = LCNT + 1 ENDIF IF( RPIVOT.LE.ZERO ) THEN RCNT = RCNT + 1 ENDIF DO 10 I = 1, N-1 TMP = E(I)**2 LPIVOT = ( D( I+1 )-VL ) - TMP/LPIVOT RPIVOT = ( D( I+1 )-VU ) - TMP/RPIVOT IF( LPIVOT.LE.ZERO ) THEN LCNT = LCNT + 1 ENDIF IF( RPIVOT.LE.ZERO ) THEN RCNT = RCNT + 1 ENDIF 10 CONTINUE ELSE * Sturm sequence count on L D L^T SL = -VL SU = -VU DO 20 I = 1, N - 1 LPIVOT = D( I ) + SL RPIVOT = D( I ) + SU IF( LPIVOT.LE.ZERO ) THEN LCNT = LCNT + 1 ENDIF IF( RPIVOT.LE.ZERO ) THEN RCNT = RCNT + 1 ENDIF TMP = E(I) * D(I) * E(I) * TMP2 = TMP / LPIVOT IF( TMP2.EQ.ZERO ) THEN SL = TMP - VL ELSE SL = SL*TMP2 - VL END IF * TMP2 = TMP / RPIVOT IF( TMP2.EQ.ZERO ) THEN SU = TMP - VU ELSE SU = SU*TMP2 - VU END IF 20 CONTINUE LPIVOT = D( N ) + SL RPIVOT = D( N ) + SU IF( LPIVOT.LE.ZERO ) THEN LCNT = LCNT + 1 ENDIF IF( RPIVOT.LE.ZERO ) THEN RCNT = RCNT + 1 ENDIF ENDIF EIGCNT = RCNT - LCNT RETURN * * end of ODRRC * END
bsd-3-clause
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/volatile10.f90
88
4109
! { dg-do run } ! { dg-options "-fdump-tree-optimized -O3" } ! Test setting host-/use-associated variables as VOLATILE ! PR fortran/30522 module impl implicit REAL (A-Z) volatile :: x end module impl module one implicit none logical :: l, lv volatile :: lv contains subroutine test1(cmp) logical :: cmp volatile :: l, lv if (l .neqv. cmp) call abort() if (lv .neqv. cmp) call abort() l = .false. lv = .false. if(l .or. lv) print *, 'one_test1' ! not optimized away end subroutine test1 subroutine test2(cmp) logical :: cmp if (l .neqv. cmp) call abort() if (lv .neqv. cmp) call abort() l = .false. if(l) print *, 'one_test2_1' ! optimized away lv = .false. if(lv) print *, 'one_test2_2' ! not optimized away end subroutine test2 end module one module two use :: one implicit none volatile :: lv,l contains subroutine test1t(cmp) logical :: cmp volatile :: l, lv if (l .neqv. cmp) call abort() if (lv .neqv. cmp) call abort() l = .false. if(l) print *, 'two_test1_1' ! not optimized away lv = .false. if(lv) print *, 'two_test1_2' ! not optimized away end subroutine test1t subroutine test2t(cmp) logical :: cmp if (l .neqv. cmp) call abort() if (lv .neqv. cmp) call abort() l = .false. if(l) print *, 'two_test2_1' ! not optimized away lv = .false. if(lv) print *, 'two_test2_2' ! not optimized away end subroutine test2t end module two program main use :: two, only: test1t, test2t implicit none logical :: lm, lmv volatile :: lmv lm = .true. lmv = .true. call test1m(.true.) lm = .true. lmv = .true. call test2m(.true.) lm = .false. lmv = .false. call test1m(.false.) lm = .false. lmv = .false. call test2m(.false.) contains subroutine test1m(cmp) use :: one logical :: cmp volatile :: lm,lmv if(lm .neqv. cmp) call abort() if(lmv .neqv. cmp) call abort() l = .false. lv = .false. call test1(.false.) l = .true. lv = .true. call test1(.true.) lm = .false. lmv = .false. if(lm .or. lmv) print *, 'main_test1_1' ! not optimized away l = .false. if(l) print *, 'main_test1_2' ! optimized away lv = .false. if(lv) print *, 'main_test1_3' ! not optimized away l = .false. lv = .false. call test2(.false.) l = .true. lv = .true. call test2(.true.) end subroutine test1m subroutine test2m(cmp) use :: one logical :: cmp volatile :: lv if(lm .neqv. cmp) call abort if(lmv .neqv. cmp) call abort() l = .false. lv = .false. call test1(.false.) l = .true. lv = .true. call test1(.true.) lm = .false. if(lm) print *, 'main_test2_1' ! not optimized away lmv = .false. if(lmv)print *, 'main_test2_2' ! not optimized away l = .false. if(l) print *, 'main_test2_3' ! optimized away lv = .false. if(lv) print *, 'main_test2_4' ! not optimized away l = .false. lv = .false. call test2(.false.) l = .true. lv = .true. call test2(.true.) end subroutine test2m end program main ! { dg-final { scan-tree-dump "one_test1" "optimized" } } ! TODO: dg-final { scan-tree-dump-not "one_test2_1" "optimized" } ! { dg-final { scan-tree-dump "one_test2_2" "optimized" } } ! { dg-final { scan-tree-dump "one_test2_2" "optimized" } } ! { dg-final { scan-tree-dump "two_test2_1" "optimized" } } ! { dg-final { scan-tree-dump "two_test2_2" "optimized" } } ! { dg-final { scan-tree-dump "main_test1_1" "optimized" } } ! TODO: dg-final { scan-tree-dump-not "main_test1_2" "optimized" } ! { dg-final { scan-tree-dump "main_test1_3" "optimized" } } ! { dg-final { scan-tree-dump "main_test2_1" "optimized" } } ! { dg-final { scan-tree-dump "main_test2_2" "optimized" } } ! TODO: dg-final { scan-tree-dump-not "main_test2_3" "optimized" } ! { dg-final { scan-tree-dump "main_test2_4" "optimized" } } ! { dg-final { cleanup-tree-dump "optimized" } }
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/optional_dim_3.f90
144
1760
! { dg-do run } ! PR34540 cshift, eoshift, kind=1 and kind=2 arguments. ! Test case thanks to Thomas Koenig. module tst_foo implicit none contains subroutine tst_optional(a,n1,n2) integer(kind=1), intent(in), optional:: n1 integer(kind=2), intent(in), optional:: n2 integer(kind=1), dimension(2) :: s1 character(64) :: testbuf real, dimension(:,:) :: a s1 = (/1, 1/) write(testbuf,'(4F10.2)') cshift(a, shift=s1) if (testbuf /= " 2.00 1.00 4.00 3.00") CALL abort write(testbuf,'(4F10.2)') cshift(a,shift=s1,dim=n2) if (testbuf /= " 2.00 1.00 4.00 3.00") CALL abort write(testbuf,'(4F10.2)') eoshift(a,shift=s1,dim=n1) if (testbuf /= " 2.00 0.00 4.00 0.00") CALL abort write(testbuf,'(4F10.2)') eoshift(a,shift=s1,dim=n2) if (testbuf /= " 2.00 0.00 4.00 0.00") CALL abort end subroutine tst_optional subroutine sub(bound, dimmy) integer(kind=8), optional :: dimmy logical, optional :: bound logical :: lotto(4) character(20) :: testbuf lotto = .false. lotto = cshift((/.true.,.false.,.true.,.false./),1,dim=dimmy) write(testbuf,*) lotto if (trim(testbuf).ne." F T F T") call abort lotto = .false. lotto = eoshift((/.true.,.true.,.true.,.true./),1,boundary=bound,dim=dimmy) lotto = eoshift(lotto,1,dim=dimmy) write(testbuf,*) lotto if (trim(testbuf).ne." T T F F") call abort end subroutine end module tst_foo program main use tst_foo implicit none real, dimension(2,2) :: r integer(kind=1) :: d1 integer(kind=2) :: d2 data r /1.0, 2.0, 3.0, 4.0/ d1 = 1_1 d2 = 1_2 call tst_optional(r,d1, d2) call sub(bound=.false., dimmy=1_8) call sub() end program main
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/vector_subscript_6.f90
114
1154
! { dg-do compile } ! { dg-options "-fdump-tree-original" } subroutine test0(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix integer(kind=kind(1)), dimension(:), intent(in) :: e_x esss = Ix(e_x) end subroutine subroutine test1(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix integer(kind=4), dimension(:), intent(in) :: e_x esss = Ix(e_x) end subroutine subroutine test2(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix integer(kind=8), dimension(:), intent(in) :: e_x esss = Ix(e_x) end subroutine subroutine test3(esss,Ix,Iyz, e_x, ii_ivec) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:), intent(in) :: Ix,Iyz integer(kind=kind(1)), dimension(:), intent(in) :: e_x,ii_ivec esss = esss + Ix(e_x) * Iyz(ii_ivec) end subroutine ! { dg-final { scan-tree-dump-not "malloc" "original" } } ! { dg-final { cleanup-tree-dump "original" } }
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/pr18122.f90
182
1212
! { dg-do run } ! test namelist with scalars and arrays. ! Based on example provided by thomas.koenig@online.de program sechs_w implicit none integer, parameter :: dr=selected_real_kind(15) integer, parameter :: nkmax=6 real (kind=dr) :: rb(nkmax) integer :: z real (kind=dr) :: dg real (kind=dr) :: a real (kind=dr) :: da real (kind=dr) :: delta real (kind=dr) :: s,t integer :: nk real (kind=dr) alpha0 real (kind=dr) :: phi, phi0, rad, rex, zk, z0, drdphi, dzdphi namelist /schnecke/ z, dg, a, t, delta, s, nk, rb, alpha0 open (10,status="scratch") write (10, *) "&SCHNECKE" write (10, *) " z=1," write (10, *) " dg=58.4," write (10, *) " a=48.," write (10, *) " delta=0.4," write (10, *) " s=0.4," write (10, *) " nk=6," write (10, *) " rb=60, 0, 40," write (10, *) " alpha0=20.," write (10, *) "/" rewind (10) read (10,schnecke) close (10) if ((z /= 1) .or. (dg /= 58.4_dr) .or. (a /= 48.0_dr) .or. & (delta /= 0.4_dr).or. (s /= 0.4_dr) .or. (nk /= 6) .or. & (rb(1) /= 60._dr).or. (rb(2) /= 0.0_dr).or. (rb(3) /=40.0_dr).or. & (alpha0 /= 20.0_dr)) call abort () end program sechs_w
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/elemental_scalar_args_1.f90
136
2209
! { dg-do compile } ! Test the fix for PR43843, in which the temporary for b(1) in ! test_member was an indirect reference, rather then the value. ! ! Contributed by Kyle Horne <horne.kyle@gmail.com> ! Reported by Tobias Burnus <burnus@gcc.gno.org> ! Reported by Harald Anlauf <anlauf@gmx.de> (PR43841) ! module polar_mod implicit none complex, parameter :: i = (0.0,1.0) real, parameter :: pi = 3.14159265359 real, parameter :: e = exp (1.0) type :: polar_t real :: l, th end type type(polar_t) :: one = polar_t (1.0, 0) interface operator(/) module procedure div_pp end interface interface operator(.ne.) module procedure ne_pp end interface contains elemental function div_pp(u,v) result(o) type(polar_t), intent(in) :: u, v type(polar_t) :: o complex :: a, b, c a = u%l*exp (i*u%th*pi) b = v%l*exp (i*v%th*pi) c = a/b o%l = abs (c) o%th = atan2 (imag (c), real (c))/pi end function div_pp elemental function ne_pp(u,v) result(o) type(polar_t), intent(in) :: u, v LOGICAL :: o if (u%l .ne. v%l) then o = .true. else if (u%th .ne. v%th) then o = .true. else o = .false. end if end function ne_pp end module polar_mod program main use polar_mod implicit none call test_member call test_other call test_scalar call test_real contains subroutine test_member type(polar_t), dimension(3) :: b b = polar_t (2.0,0.5) b(:) = b(:)/b(1) if (any (b .ne. one)) call abort end subroutine test_member subroutine test_other type(polar_t), dimension(3) :: b type(polar_t), dimension(3) :: c b = polar_t (3.0,1.0) c = polar_t (3.0,1.0) b(:) = b(:)/c(1) if (any (b .ne. one)) call abort end subroutine test_other subroutine test_scalar type(polar_t), dimension(3) :: b type(polar_t) :: c b = polar_t (4.0,1.5) c = b(1) b(:) = b(:)/c if (any (b .ne. one)) call abort end subroutine test_scalar subroutine test_real real,dimension(3) :: b real :: real_one b = 2.0 real_one = b(2)/b(1) b(:) = b(:)/b(1) if (any (b .ne. real_one)) call abort end subroutine test_real end program main
gpl-2.0
optimsoc/gzll-gcc
libgomp/testsuite/libgomp.fortran/lib2.f
112
2479
C { dg-do run } USE OMP_LIB DOUBLE PRECISION :: D, E LOGICAL :: L INTEGER (KIND = OMP_LOCK_KIND) :: LCK INTEGER (KIND = OMP_NEST_LOCK_KIND) :: NLCK D = OMP_GET_WTIME () CALL OMP_INIT_LOCK (LCK) CALL OMP_SET_LOCK (LCK) IF (OMP_TEST_LOCK (LCK)) CALL ABORT CALL OMP_UNSET_LOCK (LCK) IF (.NOT. OMP_TEST_LOCK (LCK)) CALL ABORT IF (OMP_TEST_LOCK (LCK)) CALL ABORT CALL OMP_UNSET_LOCK (LCK) CALL OMP_DESTROY_LOCK (LCK) CALL OMP_INIT_NEST_LOCK (NLCK) IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 1) CALL ABORT CALL OMP_SET_NEST_LOCK (NLCK) IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 3) CALL ABORT CALL OMP_UNSET_NEST_LOCK (NLCK) CALL OMP_UNSET_NEST_LOCK (NLCK) IF (OMP_TEST_NEST_LOCK (NLCK) .NE. 2) CALL ABORT CALL OMP_UNSET_NEST_LOCK (NLCK) CALL OMP_UNSET_NEST_LOCK (NLCK) CALL OMP_DESTROY_NEST_LOCK (NLCK) CALL OMP_SET_DYNAMIC (.TRUE.) IF (.NOT. OMP_GET_DYNAMIC ()) CALL ABORT CALL OMP_SET_DYNAMIC (.FALSE.) IF (OMP_GET_DYNAMIC ()) CALL ABORT CALL OMP_SET_NESTED (.TRUE.) IF (.NOT. OMP_GET_NESTED ()) CALL ABORT CALL OMP_SET_NESTED (.FALSE.) IF (OMP_GET_NESTED ()) CALL ABORT CALL OMP_SET_NUM_THREADS (5) IF (OMP_GET_NUM_THREADS () .NE. 1) CALL ABORT IF (OMP_GET_MAX_THREADS () .NE. 5) CALL ABORT IF (OMP_GET_THREAD_NUM () .NE. 0) CALL ABORT CALL OMP_SET_NUM_THREADS (3) IF (OMP_GET_NUM_THREADS () .NE. 1) CALL ABORT IF (OMP_GET_MAX_THREADS () .NE. 3) CALL ABORT IF (OMP_GET_THREAD_NUM () .NE. 0) CALL ABORT L = .FALSE. C$OMP PARALLEL REDUCTION (.OR.:L) L = OMP_GET_NUM_THREADS () .NE. 3 L = L .OR. (OMP_GET_THREAD_NUM () .LT. 0) L = L .OR. (OMP_GET_THREAD_NUM () .GE. 3) C$OMP MASTER L = L .OR. (OMP_GET_THREAD_NUM () .NE. 0) C$OMP END MASTER C$OMP END PARALLEL IF (L) CALL ABORT IF (OMP_GET_NUM_PROCS () .LE. 0) CALL ABORT IF (OMP_IN_PARALLEL ()) CALL ABORT C$OMP PARALLEL REDUCTION (.OR.:L) L = .NOT. OMP_IN_PARALLEL () C$OMP END PARALLEL C$OMP PARALLEL REDUCTION (.OR.:L) IF (.TRUE.) L = .NOT. OMP_IN_PARALLEL () C$OMP END PARALLEL IF (L) CALL ABORT E = OMP_GET_WTIME () IF (D .GT. E) CALL ABORT D = OMP_GET_WTICK () C Negative precision is definitely wrong, C bigger than 1s clock resolution is also strange IF (D .LE. 0 .OR. D .GT. 1.) CALL ABORT END
gpl-2.0
optimsoc/gzll-gcc
libgomp/testsuite/libgomp.fortran/strassen.f90
112
2362
! { dg-options "-O2" } ! { dg-skip-if "AArch64 tiny code model does not support programs larger than 1MiB" {aarch64_tiny} {"*"} {""} } program strassen_matmul use omp_lib integer, parameter :: N = 1024 double precision, save :: A(N,N), B(N,N), C(N,N), D(N,N) double precision :: start, end call random_seed call random_number (A) call random_number (B) start = omp_get_wtime () C = matmul (A, B) end = omp_get_wtime () write(*,'(a, f10.6)') ' Time for matmul = ', end - start D = 0 start = omp_get_wtime () call strassen (A, B, D, N) end = omp_get_wtime () write(*,'(a, f10.6)') ' Time for Strassen = ', end - start if (sqrt (sum ((C - D) ** 2)) / N .gt. 0.1) call abort D = 0 start = omp_get_wtime () !$omp parallel !$omp single call strassen (A, B, D, N) !$omp end single nowait !$omp end parallel end = omp_get_wtime () write(*,'(a, f10.6)') ' Time for Strassen MP = ', end - start if (sqrt (sum ((C - D) ** 2)) / N .gt. 0.1) call abort contains recursive subroutine strassen (A, B, C, N) integer, intent(in) :: N double precision, intent(in) :: A(N,N), B(N,N) double precision, intent(out) :: C(N,N) double precision :: T(N/2,N/2,7) integer :: K, L if (iand (N,1) .ne. 0 .or. N < 64) then C = matmul (A, B) return end if K = N / 2 L = N / 2 + 1 !$omp task shared (A, B, T) call strassen (A(:K,:K) + A(L:,L:), B(:K,:K) + B(L:,L:), T(:,:,1), K) !$omp end task !$omp task shared (A, B, T) call strassen (A(L:,:K) + A(L:,L:), B(:K,:K), T(:,:,2), K) !$omp end task !$omp task shared (A, B, T) call strassen (A(:K,:K), B(:K,L:) - B(L:,L:), T(:,:,3), K) !$omp end task !$omp task shared (A, B, T) call strassen (A(L:,L:), B(L:,:K) - B(:K,:K), T(:,:,4), K) !$omp end task !$omp task shared (A, B, T) call strassen (A(:K,:K) + A(:K,L:), B(L:,L:), T(:,:,5), K) !$omp end task !$omp task shared (A, B, T) call strassen (A(L:,:K) - A(:K,:K), B(:K,:K) + B(:K,L:), T(:,:,6), K) !$omp end task !$omp task shared (A, B, T) call strassen (A(:K,L:) - A(L:,L:), B(L:,:K) + B(L:,L:), T(:,:,7), K) !$omp end task !$omp taskwait C(:K,:K) = T(:,:,1) + T(:,:,4) - T(:,:,5) + T(:,:,7) C(L:,:K) = T(:,:,2) + T(:,:,4) C(:K,L:) = T(:,:,3) + T(:,:,5) C(L:,L:) = T(:,:,1) - T(:,:,2) + T(:,:,3) + T(:,:,6) end subroutine strassen end
gpl-2.0
pdebuyl/numpy
numpy/f2py/tests/src/return_integer/foo90.f90
12
1531
module f90_return_integer contains function t0(value) integer :: value integer :: t0 t0 = value end function t0 function t1(value) integer(kind=1) :: value integer(kind=1) :: t1 t1 = value end function t1 function t2(value) integer(kind=2) :: value integer(kind=2) :: t2 t2 = value end function t2 function t4(value) integer(kind=4) :: value integer(kind=4) :: t4 t4 = value end function t4 function t8(value) integer(kind=8) :: value integer(kind=8) :: t8 t8 = value end function t8 subroutine s0(t0,value) integer :: value integer :: t0 !f2py intent(out) t0 t0 = value end subroutine s0 subroutine s1(t1,value) integer(kind=1) :: value integer(kind=1) :: t1 !f2py intent(out) t1 t1 = value end subroutine s1 subroutine s2(t2,value) integer(kind=2) :: value integer(kind=2) :: t2 !f2py intent(out) t2 t2 = value end subroutine s2 subroutine s4(t4,value) integer(kind=4) :: value integer(kind=4) :: t4 !f2py intent(out) t4 t4 = value end subroutine s4 subroutine s8(t8,value) integer(kind=8) :: value integer(kind=8) :: t8 !f2py intent(out) t8 t8 = value end subroutine s8 end module f90_return_integer
bsd-3-clause
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/deferred_type_param_5.f90
136
1180
! { dg-do compile } ! ! PR fortran/49110 ! PR fortran/52843 ! ! Based on a contributed code by jwmwalrus@gmail.com ! ! Before, character(len=:) result variable were rejected in PURE functions. ! module mod1 use iso_c_binding implicit none contains pure function c_strlen(str) character(KIND = C_CHAR), intent(IN) :: str(*) integer :: c_strlen,i i = 1 do if (i < 1) then c_strlen = 0 return end if if (str(i) == c_null_char) exit i = i + 1 end do c_strlen = i - 1 end function c_strlen pure function c2fstring(cbuffer) result(string) character(:), allocatable :: string character(KIND = C_CHAR), intent(IN) :: cbuffer(*) integer :: i continue string = REPEAT(' ', c_strlen(cbuffer)) do i = 1, c_strlen(cbuffer) if (cbuffer(i) == C_NULL_CHAR) exit string(i:i) = cbuffer(i) enddo string = TRIM(string) end function end module mod1 use mod1 character(len=:), allocatable :: str str = c2fstring("ABCDEF"//c_null_char//"GHI") if (len(str) /= 6 .or. str /= "ABCDEF") call abort() end
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/proc_decl_23.f90
92
1091
! { dg-do compile } ! Test the fix for PR43227, in which the lines below would segfault. ! ! Dominique d'Humieres <dominiq@lps.ens.fr> ! function char1 (s) result(res) character, dimension(:), intent(in) :: s character(len=size(s)) :: res do i = 1, size(s) res(i:i) = s(i) end do end function char1 module m_string procedure(string_to_char) :: char1 ! segfault procedure(string_to_char), pointer :: char2 ! segfault type t_string procedure(string_to_char), pointer, nopass :: char3 ! segfault end type t_string contains function string_to_char (s) result(res) character, dimension(:), intent(in) :: s character(len=size(s)) :: res do i = 1, size(s) res(i:i) = s(i) end do end function string_to_char end module m_string use m_string type(t_string) :: t print *, string_to_char (["a","b","c"]) char2 => string_to_char print *, char2 (["d","e","f"]) t%char3 => string_to_char print *, t%char3 (["g","h","i"]) print *, char1 (["j","k","l"]) end ! { dg-final { cleanup-tree-dump "m_string" } }
gpl-2.0
alexurba/cftb
src/libsrc/lapack/SRC/dormql.f
5
7644
SUBROUTINE DORMQL( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, $ WORK, LWORK, INFO ) * * -- LAPACK routine (version 3.2) -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * November 2006 * * .. Scalar Arguments .. CHARACTER SIDE, TRANS INTEGER INFO, K, LDA, LDC, LWORK, M, N * .. * .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * ) * .. * * Purpose * ======= * * DORMQL overwrites the general real M-by-N matrix C with * * SIDE = 'L' SIDE = 'R' * TRANS = 'N': Q * C C * Q * TRANS = 'T': Q**T * C C * Q**T * * where Q is a real orthogonal matrix defined as the product of k * elementary reflectors * * Q = H(k) . . . H(2) H(1) * * as returned by DGEQLF. Q is of order M if SIDE = 'L' and of order N * if SIDE = 'R'. * * Arguments * ========= * * SIDE (input) CHARACTER*1 * = 'L': apply Q or Q**T from the Left; * = 'R': apply Q or Q**T from the Right. * * TRANS (input) CHARACTER*1 * = 'N': No transpose, apply Q; * = 'T': Transpose, apply Q**T. * * M (input) INTEGER * The number of rows of the matrix C. M >= 0. * * N (input) INTEGER * The number of columns of the matrix C. N >= 0. * * K (input) INTEGER * The number of elementary reflectors whose product defines * the matrix Q. * If SIDE = 'L', M >= K >= 0; * if SIDE = 'R', N >= K >= 0. * * A (input) DOUBLE PRECISION array, dimension (LDA,K) * The i-th column must contain the vector which defines the * elementary reflector H(i), for i = 1,2,...,k, as returned by * DGEQLF in the last k columns of its array argument A. * A is modified by the routine but restored on exit. * * LDA (input) INTEGER * The leading dimension of the array A. * If SIDE = 'L', LDA >= max(1,M); * if SIDE = 'R', LDA >= max(1,N). * * TAU (input) DOUBLE PRECISION array, dimension (K) * TAU(i) must contain the scalar factor of the elementary * reflector H(i), as returned by DGEQLF. * * C (input/output) DOUBLE PRECISION array, dimension (LDC,N) * On entry, the M-by-N matrix C. * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q. * * LDC (input) INTEGER * The leading dimension of the array C. LDC >= max(1,M). * * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK)) * On exit, if INFO = 0, WORK(1) returns the optimal LWORK. * * LWORK (input) INTEGER * The dimension of the array WORK. * If SIDE = 'L', LWORK >= max(1,N); * if SIDE = 'R', LWORK >= max(1,M). * For optimum performance LWORK >= N*NB if SIDE = 'L', and * LWORK >= M*NB if SIDE = 'R', where NB is the optimal * blocksize. * * If LWORK = -1, then a workspace query is assumed; the routine * only calculates the optimal size of the WORK array, returns * this value as the first entry of the WORK array, and no error * message related to LWORK is issued by XERBLA. * * INFO (output) INTEGER * = 0: successful exit * < 0: if INFO = -i, the i-th argument had an illegal value * * ===================================================================== * * .. Parameters .. INTEGER NBMAX, LDT PARAMETER ( NBMAX = 64, LDT = NBMAX+1 ) * .. * .. Local Scalars .. LOGICAL LEFT, LQUERY, NOTRAN INTEGER I, I1, I2, I3, IB, IINFO, IWS, LDWORK, LWKOPT, $ MI, NB, NBMIN, NI, NQ, NW * .. * .. Local Arrays .. DOUBLE PRECISION T( LDT, NBMAX ) * .. * .. External Functions .. LOGICAL LSAME INTEGER ILAENV EXTERNAL LSAME, ILAENV * .. * .. External Subroutines .. EXTERNAL DLARFB, DLARFT, DORM2L, XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. * .. Executable Statements .. * * Test the input arguments * INFO = 0 LEFT = LSAME( SIDE, 'L' ) NOTRAN = LSAME( TRANS, 'N' ) LQUERY = ( LWORK.EQ.-1 ) * * NQ is the order of Q and NW is the minimum dimension of WORK * IF( LEFT ) THEN NQ = M NW = MAX( 1, N ) ELSE NQ = N NW = MAX( 1, M ) END IF IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN INFO = -1 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'T' ) ) THEN INFO = -2 ELSE IF( M.LT.0 ) THEN INFO = -3 ELSE IF( N.LT.0 ) THEN INFO = -4 ELSE IF( K.LT.0 .OR. K.GT.NQ ) THEN INFO = -5 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN INFO = -7 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN INFO = -10 END IF * IF( INFO.EQ.0 ) THEN IF( M.EQ.0 .OR. N.EQ.0 ) THEN LWKOPT = 1 ELSE * * Determine the block size. NB may be at most NBMAX, where * NBMAX is used to define the local array T. * NB = MIN( NBMAX, ILAENV( 1, 'DORMQL', SIDE // TRANS, M, N, $ K, -1 ) ) LWKOPT = NW*NB END IF WORK( 1 ) = LWKOPT * IF( LWORK.LT.NW .AND. .NOT.LQUERY ) THEN INFO = -12 END IF END IF * IF( INFO.NE.0 ) THEN CALL XERBLA( 'DORMQL', -INFO ) RETURN ELSE IF( LQUERY ) THEN RETURN END IF * * Quick return if possible * IF( M.EQ.0 .OR. N.EQ.0 ) THEN RETURN END IF * NBMIN = 2 LDWORK = NW IF( NB.GT.1 .AND. NB.LT.K ) THEN IWS = NW*NB IF( LWORK.LT.IWS ) THEN NB = LWORK / LDWORK NBMIN = MAX( 2, ILAENV( 2, 'DORMQL', SIDE // TRANS, M, N, K, $ -1 ) ) END IF ELSE IWS = NW END IF * IF( NB.LT.NBMIN .OR. NB.GE.K ) THEN * * Use unblocked code * CALL DORM2L( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, $ IINFO ) ELSE * * Use blocked code * IF( ( LEFT .AND. NOTRAN ) .OR. $ ( .NOT.LEFT .AND. .NOT.NOTRAN ) ) THEN I1 = 1 I2 = K I3 = NB ELSE I1 = ( ( K-1 ) / NB )*NB + 1 I2 = 1 I3 = -NB END IF * IF( LEFT ) THEN NI = N ELSE MI = M END IF * DO 10 I = I1, I2, I3 IB = MIN( NB, K-I+1 ) * * Form the triangular factor of the block reflector * H = H(i+ib-1) . . . H(i+1) H(i) * CALL DLARFT( 'Backward', 'Columnwise', NQ-K+I+IB-1, IB, $ A( 1, I ), LDA, TAU( I ), T, LDT ) IF( LEFT ) THEN * * H or H' is applied to C(1:m-k+i+ib-1,1:n) * MI = M - K + I + IB - 1 ELSE * * H or H' is applied to C(1:m,1:n-k+i+ib-1) * NI = N - K + I + IB - 1 END IF * * Apply H or H' * CALL DLARFB( SIDE, TRANS, 'Backward', 'Columnwise', MI, NI, $ IB, A( 1, I ), LDA, T, LDT, C, LDC, WORK, $ LDWORK ) 10 CONTINUE END IF WORK( 1 ) = LWKOPT RETURN * * End of DORMQL * END
mit
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/argument_checking_2.f90
174
1371
! { dg-do compile } ! { dg-options "-std=f95" } ! ! PR fortran/30940 program main implicit none character(len=10) :: digit_string = '123456789', str character :: digit_arr(10) call copy(digit_string, digit_arr) ! { dg-error "Scalar CHARACTER actual argument with array dummy argument 'in'" } call copy(digit_arr,str) ! { dg-error "Scalar CHARACTER actual argument with array dummy argument 'out'" } if(str /= '123456789') call abort() digit_string = 'qwertasdf' call copy2(digit_string, digit_arr) ! { dg-error "Scalar CHARACTER actual argument with array dummy argument 'in'" } call copy2(digit_arr,str) ! { dg-error "Scalar CHARACTER actual argument with array dummy argument 'out'" } if(str /= 'qwertasdf') call abort() digit_string = '1qayxsw23e' call copy('1qayxsw23e', digit_arr) ! { dg-error "Scalar CHARACTER actual argument with array dummy argument 'in'" } call copy(digit_arr,str) ! { dg-error "Scalar CHARACTER actual argument with array dummy argument 'out'" } if(str /= '1qayxsw23e') call abort() contains subroutine copy(in, out) character, dimension(*) :: in character, dimension(10) :: out out = in(:10) end subroutine copy subroutine copy2(in, out) character, dimension(2,*) :: in character, dimension(2,5) :: out out(1:2,1:5) = in(1:2,1:5) end subroutine copy2 end program main
gpl-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/allocatable_dummy_1.f90
188
1177
! { dg-do run } ! Test procedures with allocatable dummy arguments program alloc_dummy implicit none integer, allocatable :: a(:) integer, allocatable :: b(:) call init(a) if (.NOT.allocated(a)) call abort() if (.NOT.all(a == [ 1, 2, 3 ])) call abort() call useit(a, b) if (.NOT.all(b == [ 1, 2, 3 ])) call abort() if (.NOT.all(whatever(a) == [ 1, 2, 3 ])) call abort() call kill(a) if (allocated(a)) call abort() call kill(b) if (allocated(b)) call abort() contains subroutine init(x) integer, allocatable, intent(out) :: x(:) allocate(x(3)) x = [ 1, 2, 3 ] end subroutine init subroutine useit(x, y) integer, allocatable, intent(in) :: x(:) integer, allocatable, intent(out) :: y(:) if (allocated(y)) call abort() call init(y) y = x end subroutine useit function whatever(x) integer, allocatable :: x(:) integer :: whatever(size(x)) whatever = x end function whatever subroutine kill(x) integer, allocatable, intent(out) :: x(:) end subroutine kill end program alloc_dummy
gpl-2.0
jchristopherson/linalg
src/external/qrupdate/dchdex.f
1
2085
c Copyright (C) 2008, 2009 VZLU Prague, a.s., Czech Republic c c Author: Jaroslav Hajek <highegg@gmail.com> c c This file is part of qrupdate. c c qrupdate is free software; you can redistribute it and/or modify c it under the terms of the GNU General Public License as published by c the Free Software Foundation; either version 3 of the License, or c (at your option) any later version. c c This program is distributed in the hope that it will be useful, c but WITHOUT ANY WARRANTY; without even the implied warranty of c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the c GNU General Public License for more details. c c You should have received a copy of the GNU General Public License c along with this software; see the file COPYING. If not, see c <http://www.gnu.org/licenses/>. c subroutine dchdex(n,R,ldr,j,w) c purpose: given an upper triangular matrix R that is a Cholesky c factor of a symmetric positive definite matrix A, i.e. c A = R'*R, this subroutine updates R -> R1 so that c R1'*R1 = A(jj,jj), where jj = [1:j-1,j+1:n+1]. c (real version) c arguments: c n (in) the order of matrix R. c R (io) on entry, the original upper trapezoidal matrix R. c on exit, the updated matrix R1. c ldr (in) leading dimension of R. ldr >= n. c j (in) the position of the deleted row/column. c w (out) a workspace vector of size n. c integer n,ldr,j double precision R(ldr,*),w(*) integer info,i external xerbla,dcopy,dqhqr c quick return if possible if (n == 1) return c check arguments info = 0 if (n < 0) then info = 1 else if (j < 1 .or. j > n) then info = 4 end if if (info /= 0) then call xerbla('DCHDEX',info) return end if c delete the j-th column. do i = j,n-1 call dcopy(n,R(1,i+1),1,R(1,i),1) end do c retriangularize. if (j < n) then call dqhqr(n+1-j,n-j,R(j,j),ldr,w,R(1,n)) end if end subroutine
gpl-3.0
mogrodnik/piernik
problems/mcrwind/initproblem.F90
3
11904
! ! PIERNIK Code Copyright (C) 2006 Michal Hanasz ! ! This file is part of PIERNIK code. ! ! PIERNIK is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! PIERNIK is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with PIERNIK. If not, see <http://www.gnu.org/licenses/>. ! ! Initial implementation of PIERNIK code was based on TVD split MHD code by ! Ue-Li Pen ! see: Pen, Arras & Wong (2003) for algorithm and ! http://www.cita.utoronto.ca/~pen/MHD ! for original source code "mhd.f90" ! ! For full list of developers see $PIERNIK_HOME/license/pdt.txt ! #include "piernik.h" module initproblem ! Initial condition for the cosmic ray driven dynamo ! Based on Parker instability setup ! Written by: M. Hanasz, February 2006 ! Modified by M.Hanasz for CR-driven dynamo use constants, only: ndims implicit none private public :: read_problem_par, problem_initial_conditions, problem_pointers real :: d0, alpha, bxn, byn, bzn, amp_cr, beta_cr !< galactic disk specific parameters real :: x0, y0, z0 !< parameters for a single supernova exploding at t=0 real, dimension(ndims) :: b_n, sn_pos namelist /PROBLEM_CONTROL/ d0, bxn, byn, bzn, x0, y0, z0, alpha, amp_cr, beta_cr contains !----------------------------------------------------------------------------- subroutine problem_pointers #ifdef GRAV use gravity, only: grav_pot_3d #endif /* GRAV */ use user_hooks, only: problem_customize_solution implicit none #ifdef GRAV grav_pot_3d => galactic_grav_pot_3d #endif /* GRAV */ problem_customize_solution => supernovae_wrapper end subroutine problem_pointers !----------------------------------------------------------------------------- subroutine read_problem_par use dataio_pub, only: nh use mpisetup, only: rbuff, master, slave, piernik_MPI_Bcast #if defined(COSM_RAYS) && defined(SN_SRC) use snsources, only: amp_ecr_sn #endif /* COSM_RAYS && SN_SRC */ implicit none d0 = 1.0 bxn = 0.0 byn = 1.0 bzn = 0.0 x0 = 0.0 y0 = 0.0 z0 = 0.0 alpha = 0.0 amp_cr = 0.0 beta_cr = 0.0 if (master) then if (.not.nh%initialized) call nh%init() open(newunit=nh%lun, file=nh%tmp1, status="unknown") write(nh%lun,nml=PROBLEM_CONTROL) close(nh%lun) open(newunit=nh%lun, file=nh%par_file) nh%errstr="" read(unit=nh%lun, nml=PROBLEM_CONTROL, iostat=nh%ierrh, iomsg=nh%errstr) close(nh%lun) call nh%namelist_errh(nh%ierrh, "PROBLEM_CONTROL") read(nh%cmdl_nml,nml=PROBLEM_CONTROL, iostat=nh%ierrh) call nh%namelist_errh(nh%ierrh, "PROBLEM_CONTROL", .true.) open(newunit=nh%lun, file=nh%tmp2, status="unknown") write(nh%lun,nml=PROBLEM_CONTROL) close(nh%lun) call nh%compare_namelist() rbuff(1) = d0 rbuff(2) = bxn rbuff(3) = byn rbuff(4) = bzn rbuff(5) = x0 rbuff(6) = y0 rbuff(7) = z0 rbuff(8) = amp_cr rbuff(9) = beta_cr rbuff(10) = alpha endif call piernik_MPI_Bcast(rbuff) if (slave) then d0 = rbuff(1) bxn = rbuff(2) byn = rbuff(3) bzn = rbuff(4) x0 = rbuff(5) y0 = rbuff(6) z0 = rbuff(7) amp_cr = rbuff(8) beta_cr = rbuff(9) alpha = rbuff(10) endif sn_pos = [x0, y0, z0 ] b_n = [bxn, byn, bzn] #if defined(COSM_RAYS) && defined(SN_SRC) if (amp_cr < 0.) amp_cr = amp_ecr_sn #endif /* COSM_RAYS && SN_SRC */ end subroutine read_problem_par !----------------------------------------------------------------------------- subroutine problem_initial_conditions use cg_leaves, only: leaves use cg_list, only: cg_list_element use constants, only: xdim, ydim, zdim, LO, HI use fluidindex, only: flind use fluidtypes, only: component_fluid use func, only: ekin, emag use global, only: smalld use grid_cont, only: grid_container use hydrostatic, only: hydrostatic_zeq_densmid, set_default_hsparams, dprof #ifdef SHEAR use shear, only: qshear, omega #endif /* SHEAR */ #ifdef COSM_RAYS use initcosmicrays, only: gamma_cr_1, iarr_crn, iarr_crs #ifdef SN_SRC use snsources, only: cr_sn #endif /* SN_SRC */ #endif /* COSM_RAYS */ implicit none class(component_fluid), pointer :: fl integer :: i, j, k real :: b0, csim2 type(cg_list_element), pointer :: cgl type(grid_container), pointer :: cg ! Secondary parameters fl => flind%ion b0 = sqrt(2. * alpha * d0 * fl%cs2) csim2 = fl%cs2 * (1.0 + alpha) cgl => leaves%first do while (associated(cgl)) cg => cgl%cg call set_default_hsparams(cg) i = cg%lhn(xdim,LO) j = cg%lhn(ydim,LO) call hydrostatic_zeq_densmid(i, j, d0, csim2) cg%u(fl%imx, RNG) = 0.0 cg%u(fl%imy, RNG) = 0.0 cg%u(fl%imz, RNG) = 0.0 #ifdef COSM_RAYS cg%u(iarr_crs, RNG) = 0.0 #endif /* COSM_RAYS */ do k = cg%lhn(zdim,LO), cg%lhn(zdim,HI) cg%u(fl%idn,:,:,k) = max(smalld, dprof(k)) do j = cg%lhn(ydim,LO), cg%lhn(ydim,HI) do i = cg%lhn(xdim,LO), cg%lhn(xdim,HI) #ifdef SHEAR cg%u(fl%imy,i,j,k) = -qshear * omega * cg%x(i) * cg%u(fl%idn,i,j,k) #endif /* SHEAR */ cg%b(:,i,j,k) = b0 * sqrt(cg%u(fl%idn,i,j,k) / d0) * b_n / sqrt(sum(b_n**2)) #ifndef ISO cg%u(fl%ien,i,j,k) = fl%cs2 / fl%gam_1 * cg%u(fl%idn,i,j,k) + ekin(cg%u(fl%imx,i,j,k), cg%u(fl%imy,i,j,k), cg%u(fl%imz,i,j,k), cg%u(fl%idn,i,j,k)) + & & emag(cg%b(xdim,i,j,k), cg%b(ydim,i,j,k), cg%b(zdim,i,j,k)) #endif /* !ISO */ #ifdef COSM_RAYS cg%u(iarr_crn(1),i,j,k) = beta_cr * fl%cs2 * cg%u(fl%idn,i,j,k) / gamma_cr_1 #endif /* COSM_RAYS */ enddo enddo enddo cgl => cgl%nxt enddo #if defined(COSM_RAYS) && defined(SN_SRC) call cr_sn(sn_pos, amp_cr) #endif /* COSM_RAYS && SN_SRC */ end subroutine problem_initial_conditions subroutine supernovae_wrapper(forward) #ifdef SN_SRC use snsources, only: random_sn #endif /* SN_SRC */ implicit none logical, intent(in) :: forward #ifdef SN_SRC if (forward) call random_sn #endif /* SN_SRC */ end subroutine supernovae_wrapper #ifdef GRAV !-------------------------------------------------------------------------- !> !! \brief Routine that compute values of gravitational acceleration !! \param sweep string of characters that points out the current sweep direction !! \param i1 integer, number of column in the first direction after one pointed out by sweep !! \param i2 integer, number of column in the second direction after one pointed out by sweep !! \param xsw 1D position array in the direction pointed out by sweep !! \param n number of elements of xsw array !! \param grav 1D array of gravitational acceleration values computed for positions from xsw and returned by the routine !! \n\n !! one type of %gravity is implemented here: \n\n !! local Galactic %gravity only in z-direction (see <a href="http://cdsads.u-strasbg.fr/abs/1998ApJ...497..759F">Ferriere K., 1998, Astrophys. Journal, 497, 759</a>)\n !! \f[ !! F_z = 3.23 \cdot 10^8 \cdot \left[\left(-4.4 \cdot 10^{-9} \cdot exp\left(-\frac{(r_{gc}-r_{gc_{}Sun})}{(4.9kpc)}\right) \cdot \frac{z}{\sqrt{(z^2+(0.2kpc)^2)}}\right) !! -\left( 1.7 \cdot 10^{-9} \cdot \frac{(r_{gc_{}Sun}^2 + (2.2kpc)^2)}{(r_{gc}^2 + (2.2kpc)^2)} \cdot \frac{z}{1kpc}\right) \right] !! \f] !! where \f$r_{gc}\f$ is galactocentric radius and \f$r_{gcSun}\f$ is the galactocentric radius of Sun. !< subroutine galactic_grav_accel(sweep, i1,i2, xsw, n, grav) use constants, only: zdim use gravity, only: r_gc use units, only: r_gc_sun, kpc implicit none integer(kind=4), intent(in) :: sweep integer, intent(in) :: i1, i2 integer(kind=4), intent(in) :: n real, dimension(n),intent(in) :: xsw real, dimension(n),intent(out) :: grav if (.false.) grav(1) = i1+i2 ! suppress compiler warning on unused argument if (sweep == zdim) then grav = 3.23e8 * ( & (-4.4e-9 * exp(-(r_gc-r_gc_sun)/(4.9*kpc)) * xsw/sqrt(xsw**2+(0.2*kpc)**2)) & -( 1.7e-9 * (r_gc_sun**2 + (2.2*kpc)**2)/(r_gc**2 + (2.2*kpc)**2)*xsw/kpc) ) ! -Om*(Om+G) * Z * (kpc ?) ! in the transition region between rigid ! ! and flat rotation F'98: eq.(36) else grav=0.0 endif end subroutine galactic_grav_accel !------------------------------------------------------------------------------ subroutine galactic_grav_pot_3d use axes_M, only: axes use cg_leaves, only: leaves use cg_list, only: cg_list_element use gravity, only: grav_type use grid_cont, only: grid_container implicit none type(axes) :: ax type(cg_list_element), pointer :: cgl type(grid_container), pointer :: cg grav_type => galactic_grav_pot cgl => leaves%first do while (associated(cgl)) cg => cgl%cg if (.not. cg%is_old) then call ax%allocate_axes(cg%lhn) ax%x(:) = cg%x(:) ax%y(:) = cg%y(:) ax%z(:) = cg%z(:) call galactic_grav_pot(cg%gp, ax, cg%lhn) call ax%deallocate_axes endif cgl => cgl%nxt enddo end subroutine galactic_grav_pot_3d subroutine galactic_grav_pot(gp, ax, lhn, flatten) use axes_M, only: axes use constants, only: ndims, LO, HI, zdim, half use gravity, only: r_gc use units, only: r_gc_sun, kpc implicit none real, dimension(:,:,:), pointer :: gp type(axes), intent(in) :: ax integer(kind=4), dimension(ndims,LO:HI), intent(in) :: lhn logical, optional, intent(in) :: flatten integer :: k real, parameter :: f1 = 3.23e8, f2 = -4.4e-9, f3 = 1.7e-9 real :: r1, r22, r32, s4, s5 r1 = 4.9*kpc r22 = (0.2*kpc)**2 r32 = (2.2*kpc)**2 s4 = f2 * exp(-(r_gc-r_gc_sun)/(r1)) s5 = f3 * (r_gc_sun**2 + r32)/(r_gc**2 + r32) ! grav = f1 * ((s4 * xsw/sqrt(xsw**2+r22)) - (s5 * xsw/kpc) ) !! -Om*(Om+G) * Z * (kpc ?) ! in the transition region between rigid and flat rotation F'98: eq.(36) do k = lhn(zdim,LO), lhn(zdim,HI) gp(:,:,k) = -f1 * (s4 * sqrt(ax%z(k)**2+r22) - s5 * half * ax%z(k)**2 / kpc) enddo return if (.false. .and. present(flatten)) k = 0 ! suppress compiler warnings end subroutine galactic_grav_pot #endif /* GRAV */ end module initproblem
gpl-3.0
mogrodnik/piernik
src/grid/list_of_cg_lists.F90
3
7652
! ! PIERNIK Code Copyright (C) 2006 Michal Hanasz ! ! This file is part of PIERNIK code. ! ! PIERNIK is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! PIERNIK is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with PIERNIK. If not, see <http://www.gnu.org/licenses/>. ! ! Initial implementation of PIERNIK code was based on TVD split MHD code by ! Ue-Li Pen ! see: Pen, Arras & Wong (2003) for algorithm and ! http://www.cita.utoronto.ca/~pen/MHD ! for original source code "mhd.f90" ! ! For full list of developers see $PIERNIK_HOME/license/pdt.txt ! #include "piernik.h" !> \brief This module contains list of grid container lists and related subroutines module list_of_cg_lists use cg_list, only: cg_list_t implicit none private public :: all_lists type :: cg_list_pointer class(cg_list_t), pointer :: lp end type cg_list_pointer type :: all_cg_lists type(cg_list_pointer), dimension(:), allocatable :: entries contains procedure :: print !< Print all cg lists for diagnostic purposes procedure :: register !< Reset (initialize) the given list and add it to the table if unique procedure :: unregister !< Remove given list procedure :: forget !< Erase given cg from all known lists procedure :: delete !< Delete all lists end type all_cg_lists type(all_cg_lists) :: all_lists contains !> \brief Print all cg lists for diagnostic purposes subroutine print(this, to_stdout) use constants, only: pSUM use dataio_pub, only: msg, printinfo, warn use mpisetup, only: master, piernik_MPI_Allreduce implicit none class(all_cg_lists), intent(inout) :: this !< object invoking type-bound procedure logical, optional, intent(in) :: to_stdout integer :: i, g_cnt !> \todo use MPI_Gather and let the master process print everything if (.not. allocated(this%entries)) then call printinfo("[list_of_cg_lists:print] Unbelievable! No lists at all!", to_stdout) else if (master) call printinfo("[list_of_cg_lists:print] All known cg_lists:", to_stdout) do i = lbound(this%entries(:),dim=1), ubound(this%entries(:), dim=1) if (associated(this%entries(i)%lp)) then !> \todo Call MPI_Allgather and print detailed distribution of grid pieces across processors g_cnt = this%entries(i)%lp%cnt call piernik_MPI_Allreduce(g_cnt, pSUM) write(msg, '(3a,i7,a)') "'", this%entries(i)%lp%label, "' : ", g_cnt, " element(s)" if (master) call printinfo(msg, to_stdout) else call warn("[list_of_cg_lists:print] (null)") endif enddo endif end subroutine print !> \brief Reset (initialize) the given list and add it to the table if unique subroutine register(this, cgl, label) implicit none class(all_cg_lists), intent(inout) :: this !< object invoking type-bound procedure class(cg_list_t), target, intent(inout) :: cgl !< a cg list to be created or reset character(len=*), intent(in) :: label !< name of the list type(cg_list_pointer), dimension(:), allocatable :: new_list integer :: i call cgl%init_new(label) ! update the list of lists if (.not. allocated(this%entries)) then allocate(this%entries(1)) else do i = lbound(this%entries(:),dim=1), ubound(this%entries(:), dim=1) if (this%entries(i)%lp%label == label) return ! do not duplicate entries (e.g. leaves) enddo allocate(new_list(lbound(this%entries(:),dim=1):ubound(this%entries(:), dim=1) + 1)) new_list(:ubound(this%entries(:), dim=1)) = this%entries(:) call move_alloc(from=new_list, to=this%entries) endif this%entries(ubound(this%entries, dim=1))%lp => cgl end subroutine register !> \brief Remove given list subroutine unregister(this, cgl) use dataio_pub, only: die implicit none class(all_cg_lists), intent(inout) :: this !< object invoking type-bound procedure class(cg_list_t), pointer, intent(inout) :: cgl !< a cg list to be created or reset type(cg_list_pointer), dimension(:), allocatable :: new_list integer :: i, j logical :: found if (.not. allocated(this%entries)) call die("[list_of_cg_lists:unregister] Empty list") allocate(new_list(lbound(this%entries(:),dim=1):ubound(this%entries(:), dim=1) - 1)) found = .false. do i = lbound(this%entries(:),dim=1), ubound(this%entries(:), dim=1) if (associated(cgl, this%entries(i)%lp)) then if (found) call die("[list_of_cg_lists:unregister] Double occurrence") found = .true. else j = i if (found) j = i - 1 new_list(j) = this%entries(i) endif enddo call move_alloc(from=new_list, to=this%entries) if (.not. found) call die("[list_of_cg_lists:unregister] No occurrence") end subroutine unregister !> !! \brief Erase given cg from all known lists !! !! \warning This routine becomes very expensive when there are thousands of cg on one process. !! It is called mostly from cleanup_piernik -> cleanup_grid -> delete_all . !! Consider implicit freeing or add a list of pointers to entries in lists for faster processing !< subroutine forget(this, cg) use cg_list, only: cg_list_element use grid_cont, only: grid_container use grid_container_ext, only: cg_extptrs implicit none class(all_cg_lists), intent(inout) :: this !< object invoking type-bound procedure type(grid_container), pointer, intent(inout) :: cg !< grid piece deemed to be forgotten type(cg_list_element), pointer :: cgl, aux integer :: i, ep ! scan all lists and remove the element if found do i = lbound(this%entries(:),dim=1), ubound(this%entries(:), dim=1) cgl => this%entries(i)%lp%first if (this%entries(i)%lp%cnt > 0) then do while (associated(cgl)) aux => cgl cgl => cgl%nxt if (associated(cg,aux%cg)) call this%entries(i)%lp%delete(aux) ! do not call exit here because it is safer to not assume single occurrence on a list enddo endif enddo call cg%cleanup do ep = ubound(cg_extptrs%ext, dim=1), lbound(cg_extptrs%ext, dim=1), -1 if (associated(cg_extptrs%ext(ep)%cleanup)) call cg_extptrs%ext(ep)%cleanup(cg) enddo deallocate(cg) end subroutine forget !> \brief Delete all lists subroutine delete(this) implicit none class(all_cg_lists), intent(inout) :: this !< object invoking type-bound procedure integer :: i do i = lbound(this%entries(:),dim=1), ubound(this%entries(:), dim=1) call this%entries(i)%lp%delete enddo if (allocated(all_lists%entries)) deallocate(all_lists%entries) end subroutine delete end module list_of_cg_lists
gpl-3.0
swihart/repeated
src/chidden.f
1
16357
c c repeated : A Library of Repeated Measurements Models c Copyright (C) 1998, 1999, 2000, 2001 J.K. Lindsey c c This program is free software; you can redistribute it and/or modify c it under the terms of the GNU General Public License as published by c the Free Software Foundation; either version 2 of the License, or c (at your option) any later version. c c This program is distributed in the hope that it will be useful, c but WITHOUT ANY WARRANTY; without even the implied warranty of c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the c GNU General Public License for more details. c c You should have received a copy of the GNU General Public License c along with this program; if not, write to the Free Software c Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. c c SYNOPSIS c c subroutine chidden_f(x,m,iq,nobs,mobs,s,n,times,l,pgamma,gamma,gamma2, c + val,vec,invec,model,lgam,ismu,mu,cmu,tvmu,pshape,pfam,ppar,par, c + delta,nn,filter,cf,a,b,c,gmod,rhs,pivot,qraux,work,work2,work3, c + like) c c DESCRIPTION c c Function to compute the likelihood of a hidden Markov chain model c with various response types in continuous time c subroutine chidden_f(x,m,iq,nobs,mobs,s,n,times,l,pgamma,gamma, + gamma2,val,vec,invec,model,lgam,ismu,mu,cmu,tvmu,pshape,pfam, + ppar,par,delta,nn,filter,cf,a,b,c,gmod,rhs,pivot,qraux,work, + work2,work3,like) ************************************************************************* * Function chidden computes minus the log likelihood of a * * multivariate hidden Markov model with m states and iq individuals * * in continuous time. * * * * Feel free to use or improve this program, provided that the * * origin is acknowledged. * * Iain MacDonald and Walter Zucchini * * Modified by J.K. Lindsey for R, March, November, December 1998 * * December, 1999, January, 2000 * * November, 2001 * ************************************************************************* implicit none integer n(*),m,iq,i,j,k,l,model,nobs(*),mobs,ii,nm,nn,pivot(m) logical cf,ismu,ppar double precision like,s(*),pi,sflog,av,tt,pshape(m),pgamma(m,m), + gmod(m,m),rhs(m),qraux(m),mu(nn,m,l),cmu(iq,m,l),par, + tvmu(mobs,m,l),ll,x(*),gamma(m,m),delta(m),a(m),b(m,m), + c(m),val(m),vec(m,m),invec(m,m),times(*),filter(m,nn),pfam, + tmp,tmp2,tmp3,lgam(*),work(2*m),work2(m),work3(m,m), + gamma2(m,m) double precision bernpr,poispr,multpr,cmultpr,contpr,proppr,binpr, + exppr,bbinpr,nbinpr,normpr,invgpr,logispr,cauchpr,laplpr, + levypr,paretpr,gammpr,weibpr,ggampr,glogpr,hjorpr,burrpr, + gweipr,gextpr,ginvgpr,powexpr,slaplpr,studpr call cfromx(x,m,gamma2,pgamma) c find eigenvalues/vectors and calculate gamma for unit time call geigen(gamma2, val, vec, invec, a, c, gmod, pivot, qraux, + work, work3, m) call mexp(gamma, val, vec, invec, 1.0d0, m, .false.) c calculate stationary distribution call deltas(gamma,delta,m,gmod,rhs,pivot,qraux,work) c special case: discretized Poisson process c G: gamma2, b: G-L, gmod: exp(G), gamma: exp(G-L) or exp(G)-exp(G-L) if(model.eq.30)then do 3 i=1,m c(i)=gamma2(i,i) do 4 j=1,m b(i,j)=gamma2(i,j) 4 continue 3 continue like=0. nm=0 do 1 i = 1, iq do 12 j=1,m a(j)=delta(j) 12 continue do 2 k = 1, nobs(i) nm=nm+1 if(k.eq.1)then tt=times(nm) else tt=times(nm)-times(nm-1) endif do 5 j=1,m if(ismu)then b(j,j)=c(j)-exp(mu(nm,j,1)) else b(j,j)=c(j)-exp(cmu(i,j,1)+tvmu(k,j,1)) endif 5 continue call geigen(b, val, vec, invec, rhs, work2, gmod, pivot, + qraux, work, work3, m) call mexp(gamma, val, vec, invec, tt, m, .false.) if(s(nm).eq.1.0)then call geigen(gamma2, val, vec, invec, rhs, work2, gmod, + pivot, qraux, work, work3, m) call mexp(gmod, val, vec, invec, tt, m, .false.) do 8 ii=1,m do 9 j=1,m gamma(ii,j)=gmod(ii,j)-gamma(ii,j) 9 continue 8 continue endif do 6 ii=1,m filter(ii,nm)=0.0 do 7 j=1,m filter(ii,nm)=filter(ii,nm)+a(j)*gamma(j,ii) 7 continue 6 continue tmp=0.0 do 13 j=1,m a(j)=filter(j,nm) tmp=tmp+a(j) 13 continue if(cf)then do 15 j=1,m filter(j,nm)=filter(j,nm)/tmp 15 continue endif 2 continue tmp=0.0 do 16 j=1,m tmp=tmp+a(j) 16 continue like=like-dlog(tmp) 1 continue return endif c all other models c take logs of probabilities do 10 i=1,m delta(i)=dlog(delta(i)) do 11 j=1,m gamma(i,j)=dlog(gamma(i,j)) 11 continue 10 continue c initial conditions like=0. nm=0 do 20 i = 1, iq if(ppar)then do 21 j=1,m work2(j)=0 21 continue endif nm=nm+1 do 30 j = 1, m a(j)=delta(j) if(model.lt.3.or.model.gt.6)then if(ismu)then tmp=mu(nm,j,1) else tmp=cmu(i,j,1)+tvmu(1,j,1) endif endif if(ppar)work2(j)=s(nm)-tmp goto(201,202,203,204,205,206,207,208,209,210,211,212,213, + 214,215,216,217,218,219,220,221,222,223,224,225,226, + 227,228,229),model 201 pi = bernpr(s(nm),tmp) goto 250 202 pi = poispr(s(nm),tmp) goto 250 203 pi = multpr(s(nm),ismu,mu,cmu,tvmu,i,j,1,iq,m,l,mobs,nm,nn) goto 250 204 pi = cmultpr(s,ismu,mu,cmu,tvmu,i,j,1,iq,m,l,mobs,nm,nn, + lgam) goto 250 205 pi = contpr(s(nm),ismu,mu,cmu,tvmu,i,j,1,iq,m,l,mobs,nm,nn) goto 250 206 pi = proppr(s(nm),ismu,mu,cmu,tvmu,i,j,1,iq,m,l,mobs,nm,nn) goto 250 207 pi = binpr(s(nm),n(nm),tmp) goto 250 208 pi = exppr(s(nm),tmp) goto 250 209 pi = bbinpr(s(nm),n(nm),tmp,pshape(j)) goto 250 210 pi = nbinpr(s(nm),tmp,pshape(j)) goto 250 211 pi = normpr(s(nm),tmp,pshape(j)) goto 250 212 pi = invgpr(s(nm),tmp,pshape(j)) goto 250 213 pi = logispr(s(nm),tmp,pshape(j)) goto 250 214 pi = cauchpr(s(nm),tmp,pshape(j)) goto 250 215 pi = laplpr(s(nm),tmp,pshape(j)) goto 250 216 pi = levypr(s(nm),tmp,pshape(j)) goto 250 217 pi = paretpr(s(nm),tmp,pshape(j)) goto 250 218 pi = gammpr(s(nm),tmp,pshape(j)) goto 250 219 pi = weibpr(s(nm),tmp,pshape(j)) goto 250 220 pi = ggampr(s(nm),tmp,pshape(j),pfam) goto 250 221 pi = glogpr(s(nm),tmp,pshape(j),pfam) goto 250 222 pi = hjorpr(s(nm),tmp,pshape(j),pfam) goto 250 223 pi = burrpr(s(nm),tmp,pshape(j),pfam) goto 250 224 pi = gweipr(s(nm),tmp,pshape(j),pfam) goto 250 225 pi = gextpr(s(nm),tmp,pshape(j),pfam) goto 250 226 pi = ginvgpr(s(nm),tmp,pshape(j),pfam) goto 250 227 pi = powexpr(s(nm),tmp,pshape(j),pfam) goto 250 228 pi = slaplpr(s(nm),tmp,pshape(j),pfam) goto 250 229 pi = studpr(s(nm),tmp,pshape(j),pfam) 250 a(j) = a(j) + pi 30 continue c filtered conditional probabilities of states if(cf)then ll = 0. do 31 j = 1, m filter(j,nm)=dexp(a(j)) ll = ll + filter(j,nm) 31 continue do 32 j = 1, m filter(j,nm)=filter(j,nm)/ll 32 continue endif c update likelihood at each subsequent time point sflog = 0. do 110 k = 2, nobs(i) nm=nm+1 tt=times(nm)-times(nm-1) if(tt.ne.1.0)then call mexp(gmod, val, vec, invec, tt, m, .true.) endif do 70 j = 1, m if(model.lt.3.or.model.gt.6)then if(ismu)then tmp=mu(nm,j,1) else tmp=cmu(i,j,1)+tvmu(k,j,1) endif endif if(ppar)then tmp2=tmp tmp3=par**tt*work2(j) if(model.ne.11.and.model.ne.13.and.model.ne.14.and. + model.ne.15.and.model.ne.16.and.model.ne.21.and. + model.ne.27.and.model.ne.28.and.model.ne.29.and. + tmp+tmp3.le.0.0)tmp3=0.0 if(model.eq.1.and.tmp+tmp3.ge.1.0)tmp3=0.0 tmp=tmp+tmp3 work2(j)=s(nm)-tmp2 endif goto(301,302,303,304,305,306,307,308,309,310,311,312,313, + 314,315,316,317,318,319,320,321,322,323,324,325,326, + 327,328,329),model 301 pi = bernpr(s(nm),tmp) goto 350 302 pi = poispr(s(nm),tmp) goto 350 303 pi = multpr(s(nm),ismu,mu,cmu,tvmu,i,j,k,iq,m,l,mobs,nm, + nn) goto 350 304 pi = cmultpr(s,ismu,mu,cmu,tvmu,i,j,k,iq,m,l,mobs,nm, + nn,lgam) goto 350 305 pi = contpr(s(nm),ismu,mu,cmu,tvmu,i,j,k,iq,m,l,mobs,nm, + nn) goto 350 306 pi = proppr(s(nm),ismu,mu,cmu,tvmu,i,j,k,iq,m,l,mobs,nm, + nn) goto 350 307 pi = binpr(s(nm),n(nm),tmp) goto 350 308 pi = exppr(s(nm),tmp) goto 350 309 pi = bbinpr(s(nm),n(nm),tmp,pshape(j)) goto 350 310 pi = nbinpr(s(nm),tmp,pshape(j)) goto 350 311 pi = normpr(s(nm),tmp,pshape(j)) goto 350 312 pi = invgpr(s(nm),tmp,pshape(j)) goto 350 313 pi = logispr(s(nm),tmp,pshape(j)) goto 350 314 pi = cauchpr(s(nm),tmp,pshape(j)) goto 350 315 pi = laplpr(s(nm),tmp,pshape(j)) goto 350 316 pi = levypr(s(nm),tmp,pshape(j)) goto 350 317 pi = paretpr(s(nm),tmp,pshape(j)) goto 350 318 pi = gammpr(s(nm),tmp,pshape(j)) goto 350 319 pi = weibpr(s(nm),tmp,pshape(j)) goto 350 320 pi = ggampr(s(nm),tmp,pshape(j),pfam) goto 350 321 pi = glogpr(s(nm),tmp,pshape(j),pfam) goto 350 322 pi = hjorpr(s(nm),tmp,pshape(j),pfam) goto 350 323 pi = burrpr(s(nm),tmp,pshape(j),pfam) goto 350 324 pi = gweipr(s(nm),tmp,pshape(j),pfam) goto 350 325 pi = gextpr(s(nm),tmp,pshape(j),pfam) goto 350 326 pi = ginvgpr(s(nm),tmp,pshape(j),pfam) goto 350 327 pi = powexpr(s(nm),tmp,pshape(j),pfam) goto 350 328 pi = slaplpr(s(nm),tmp,pshape(j),pfam) goto 350 329 pi = studpr(s(nm),tmp,pshape(j),pfam) 350 if(tt.eq.1.0)then do 60 ii = 1, m b(ii,j) = gamma(ii,j)+pi 60 continue else do 64 ii = 1, m b(ii,j) = gmod(ii,j)+pi 64 continue endif 70 continue c normalize to prevent underflow av = 0. do 90 j = 1, m c(j) = 0. do 80 ii = 1, m c(j) = c(j) + dexp(a(ii)+b(ii,j)) 80 continue av = av + c(j) 90 continue av = dlog(av/dble(m)) do 100 j = 1, m a(j) = dlog(c(j))-av 100 continue c correction factor for normalization sflog = sflog + av c filtered conditional probabilities of states if(cf)then ll = 0. do 101 j = 1, m filter(j,nm)=dexp(a(j)) ll = ll + filter(j,nm) 101 continue do 102 j = 1, m filter(j,nm)=filter(j,nm)/ll 102 continue endif 110 continue c calculate likelihood including correction factor ll = 0. do 120 j = 1, m ll = ll + dexp(a(j)) 120 continue like = like-(dlog(ll)+sflog) 20 continue c transform back to original values if(cf)then do 130 i = 1, m delta(i)=dexp(delta(i)) 130 continue endif return end subroutine cfromx(x, m, gamma, pgamma) ******************************************************************* * Convert the vector of parameters into transition rate matrix * ******************************************************************* implicit none integer m,i,ii,j double precision sum,gamma(m,m),pgamma(m,m),x(*) ii=0 do 30 i = 1, m sum = 0. do 20 j = 1, m if(j.ne.i.and.pgamma(i,j).ne.0.)then ii=ii+1 gamma(i,j) = dexp(x(ii)) sum = sum + gamma(i,j) endif 20 continue gamma(i,i)=-sum 30 continue return end subroutine geigen(gamma, val, vec, invec, a, c, gmod, pivot, + qraux, work, work3, m) *********************************************************** * Obtain eigenvalues and vectors and inverse of former * *********************************************************** implicit none integer info,i,j, rank c double precision rank integer m,pivot(m) double precision val(m),vec(m,m),invec(m,m),gamma(m,m),a(m),c(m), + gmod(m,m),qraux(m),work(2*m),work3(m,m) c get eigenvalues and vectors do 3 i=1,m do 4 j=1,m work3(i,j)=gamma(i,j) 4 continue 3 continue call rg(m,m,work3,val,a,1,vec,pivot,c,info) c invert matrix of eigenvectors do 1 i=1,m do 2 j=1,m gmod(i,j)=vec(i,j) if(i.eq.j)then work3(i,i)=1. else work3(i,j)=0. endif 2 continue 1 continue call dqrdc2(gmod,m,m,m,1d-07,rank,qraux,pivot,work) call dqrcf(gmod,m,rank,qraux,work3,m,invec,info) return end subroutine mexp(gamma, val, vec, invec, time, m, tlog) ********************************************************** * Matrix exponentiation given eigenvalues and vectors * ********************************************************** implicit none integer i,j,k,m logical tlog double precision val(m),vec(m,m),invec(m,m),gamma(m,m),time do 3 i=1,m do 2 j=1,m gamma(i,j)=0.0 do 1 k=1,m gamma(i,j)=gamma(i,j)+vec(i,k)*dexp(time*val(k))* + invec(k,j) 1 continue if(tlog)then gamma(i,j)=dlog(gamma(i,j)) endif 2 continue 3 continue return end
gpl-2.0
hjmjohnson/ITK
Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/double/dgghrd.f
43
8467
SUBROUTINE DGGHRD( COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB, Q, $ LDQ, Z, LDZ, INFO ) * * -- LAPACK routine (version 3.0) -- * Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., * Courant Institute, Argonne National Lab, and Rice University * September 30, 1994 * * .. Scalar Arguments .. CHARACTER COMPQ, COMPZ INTEGER IHI, ILO, INFO, LDA, LDB, LDQ, LDZ, N * .. * .. Array Arguments .. DOUBLE PRECISION A( LDA, * ), B( LDB, * ), Q( LDQ, * ), $ Z( LDZ, * ) * .. * * Purpose * ======= * * DGGHRD reduces a pair of real matrices (A,B) to generalized upper * Hessenberg form using orthogonal transformations, where A is a * general matrix and B is upper triangular: Q' * A * Z = H and * Q' * B * Z = T, where H is upper Hessenberg, T is upper triangular, * and Q and Z are orthogonal, and ' means transpose. * * The orthogonal matrices Q and Z are determined as products of Givens * rotations. They may either be formed explicitly, or they may be * postmultiplied into input matrices Q1 and Z1, so that * * Q1 * A * Z1' = (Q1*Q) * H * (Z1*Z)' * Q1 * B * Z1' = (Q1*Q) * T * (Z1*Z)' * * Arguments * ========= * * COMPQ (input) CHARACTER*1 * = 'N': do not compute Q; * = 'I': Q is initialized to the unit matrix, and the * orthogonal matrix Q is returned; * = 'V': Q must contain an orthogonal matrix Q1 on entry, * and the product Q1*Q is returned. * * COMPZ (input) CHARACTER*1 * = 'N': do not compute Z; * = 'I': Z is initialized to the unit matrix, and the * orthogonal matrix Z is returned; * = 'V': Z must contain an orthogonal matrix Z1 on entry, * and the product Z1*Z is returned. * * N (input) INTEGER * The order of the matrices A and B. N >= 0. * * ILO (input) INTEGER * IHI (input) INTEGER * It is assumed that A is already upper triangular in rows and * columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally set * by a previous call to DGGBAL; otherwise they should be set * to 1 and N respectively. * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0. * * A (input/output) DOUBLE PRECISION array, dimension (LDA, N) * On entry, the N-by-N general matrix to be reduced. * On exit, the upper triangle and the first subdiagonal of A * are overwritten with the upper Hessenberg matrix H, and the * rest is set to zero. * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,N). * * B (input/output) DOUBLE PRECISION array, dimension (LDB, N) * On entry, the N-by-N upper triangular matrix B. * On exit, the upper triangular matrix T = Q' B Z. The * elements below the diagonal are set to zero. * * LDB (input) INTEGER * The leading dimension of the array B. LDB >= max(1,N). * * Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N) * If COMPQ='N': Q is not referenced. * If COMPQ='I': on entry, Q need not be set, and on exit it * contains the orthogonal matrix Q, where Q' * is the product of the Givens transformations * which are applied to A and B on the left. * If COMPQ='V': on entry, Q must contain an orthogonal matrix * Q1, and on exit this is overwritten by Q1*Q. * * LDQ (input) INTEGER * The leading dimension of the array Q. * LDQ >= N if COMPQ='V' or 'I'; LDQ >= 1 otherwise. * * Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N) * If COMPZ='N': Z is not referenced. * If COMPZ='I': on entry, Z need not be set, and on exit it * contains the orthogonal matrix Z, which is * the product of the Givens transformations * which are applied to A and B on the right. * If COMPZ='V': on entry, Z must contain an orthogonal matrix * Z1, and on exit this is overwritten by Z1*Z. * * LDZ (input) INTEGER * The leading dimension of the array Z. * LDZ >= N if COMPZ='V' or 'I'; LDZ >= 1 otherwise. * * INFO (output) INTEGER * = 0: successful exit. * < 0: if INFO = -i, the i-th argument had an illegal value. * * Further Details * =============== * * This routine reduces A to Hessenberg and B to triangular form by * an unblocked reduction, as described in _Matrix_Computations_, * by Golub and Van Loan (Johns Hopkins Press.) * * ===================================================================== * * .. Parameters .. DOUBLE PRECISION ONE, ZERO PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) * .. * .. Local Scalars .. LOGICAL ILQ, ILZ INTEGER ICOMPQ, ICOMPZ, JCOL, JROW DOUBLE PRECISION C, S, TEMP * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL DLARTG, DLASET, DROT, XERBLA * .. * .. Intrinsic Functions .. INTRINSIC MAX * .. * .. Executable Statements .. * * Decode COMPQ * IF( LSAME( COMPQ, 'N' ) ) THEN ILQ = .FALSE. ICOMPQ = 1 ELSE IF( LSAME( COMPQ, 'V' ) ) THEN ILQ = .TRUE. ICOMPQ = 2 ELSE IF( LSAME( COMPQ, 'I' ) ) THEN ILQ = .TRUE. ICOMPQ = 3 ELSE ICOMPQ = 0 END IF * * Decode COMPZ * IF( LSAME( COMPZ, 'N' ) ) THEN ILZ = .FALSE. ICOMPZ = 1 ELSE IF( LSAME( COMPZ, 'V' ) ) THEN ILZ = .TRUE. ICOMPZ = 2 ELSE IF( LSAME( COMPZ, 'I' ) ) THEN ILZ = .TRUE. ICOMPZ = 3 ELSE ICOMPZ = 0 END IF * * Test the input parameters. * INFO = 0 IF( ICOMPQ.LE.0 ) THEN INFO = -1 ELSE IF( ICOMPZ.LE.0 ) THEN INFO = -2 ELSE IF( N.LT.0 ) THEN INFO = -3 ELSE IF( ILO.LT.1 ) THEN INFO = -4 ELSE IF( IHI.GT.N .OR. IHI.LT.ILO-1 ) THEN INFO = -5 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN INFO = -7 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN INFO = -9 ELSE IF( ( ILQ .AND. LDQ.LT.N ) .OR. LDQ.LT.1 ) THEN INFO = -11 ELSE IF( ( ILZ .AND. LDZ.LT.N ) .OR. LDZ.LT.1 ) THEN INFO = -13 END IF IF( INFO.NE.0 ) THEN CALL XERBLA( 'DGGHRD', -INFO ) RETURN END IF * * Initialize Q and Z if desired. * IF( ICOMPQ.EQ.3 ) $ CALL DLASET( 'Full', N, N, ZERO, ONE, Q, LDQ ) IF( ICOMPZ.EQ.3 ) $ CALL DLASET( 'Full', N, N, ZERO, ONE, Z, LDZ ) * * Quick return if possible * IF( N.LE.1 ) $ RETURN * * Zero out lower triangle of B * DO 20 JCOL = 1, N - 1 DO 10 JROW = JCOL + 1, N B( JROW, JCOL ) = ZERO 10 CONTINUE 20 CONTINUE * * Reduce A and B * DO 40 JCOL = ILO, IHI - 2 * DO 30 JROW = IHI, JCOL + 2, -1 * * Step 1: rotate rows JROW-1, JROW to kill A(JROW,JCOL) * TEMP = A( JROW-1, JCOL ) CALL DLARTG( TEMP, A( JROW, JCOL ), C, S, $ A( JROW-1, JCOL ) ) A( JROW, JCOL ) = ZERO CALL DROT( N-JCOL, A( JROW-1, JCOL+1 ), LDA, $ A( JROW, JCOL+1 ), LDA, C, S ) CALL DROT( N+2-JROW, B( JROW-1, JROW-1 ), LDB, $ B( JROW, JROW-1 ), LDB, C, S ) IF( ILQ ) $ CALL DROT( N, Q( 1, JROW-1 ), 1, Q( 1, JROW ), 1, C, S ) * * Step 2: rotate columns JROW, JROW-1 to kill B(JROW,JROW-1) * TEMP = B( JROW, JROW ) CALL DLARTG( TEMP, B( JROW, JROW-1 ), C, S, $ B( JROW, JROW ) ) B( JROW, JROW-1 ) = ZERO CALL DROT( IHI, A( 1, JROW ), 1, A( 1, JROW-1 ), 1, C, S ) CALL DROT( JROW-1, B( 1, JROW ), 1, B( 1, JROW-1 ), 1, C, $ S ) IF( ILZ ) $ CALL DROT( N, Z( 1, JROW ), 1, Z( 1, JROW-1 ), 1, C, S ) 30 CONTINUE 40 CONTINUE * RETURN * * End of DGGHRD * END
apache-2.0
optimsoc/gzll-gcc
gcc/testsuite/gfortran.dg/edit_real_1.f90
137
2462
! { dg-do run } ! Check real value edit descriptors ! Also checks that rounding is performed correctly program edit_real_1 character(len=20) s character(len=20) x character(len=200) t parameter (x = "xxxxxxxxxxxxxxxxxxxx") ! W append a "z" onto each test to check the field is the correct width s = x ! G -> F format write (s, '(G10.3,A)') 12.36, "z" if (s .ne. " 12.4 z") call abort s = x ! G -> E format write (s, '(G10.3,A)') -0.0012346, "z" if (s .ne. "-0.123E-02z") call abort s = x ! Gw.eEe format write (s, '(G10.3e1,a)') 12.34, "z" if (s .ne. " 12.3 z") call abort ! E format with excessive precision write (t, '(E199.192,A)') 1.5, "z" if ((t(1:7) .ne. " 0.1500") .or. (t(194:200) .ne. "00E+01z")) call abort ! EN format s = x write (s, '(EN15.3,A)') 12873.6, "z" if (s .ne. " 12.874E+03z") call abort ! EN format, negative exponent s = x write (s, '(EN15.3,A)') 12.345e-6, "z" if (s .ne. " 12.345E-06z") call abort ! ES format s = x write (s, '(ES10.3,A)') 16.235, "z" if (s .ne. " 1.624E+01z") call abort ! F format, small number s = x write (s, '(F10.8,A)') 1.0e-20, "z" if (s .ne. "0.00000000z") call abort ! E format, very large number. ! Used to overflow with positive scale factor s = x write (s, '(1PE10.3,A)') huge(0d0), "z" ! The actual value is target specific, so just do a basic check if ((s(1:1) .eq. "*") .or. (s(7:7) .ne. "+") .or. & (s(11:11) .ne. "z")) call abort ! F format, round up with carry to most significant digit. s = x write (s, '(F10.3,A)') 0.9999, "z" if (s .ne. " 1.000z") call abort ! F format, round up with carry to most significant digit < 0.1. s = x write (s, '(F10.3,A)') 0.0099, "z" if (s .ne. " 0.010z") call abort ! E format, round up with carry to most significant digit. s = x write (s, '(E10.3,A)') 0.9999, "z" if (s .ne. " 0.100E+01z") call abort ! EN format, round up with carry to most significant digit. s = x write (s, '(EN15.3,A)') 999.9999, "z" if (s .ne. " 1.000E+03z") call abort ! E format, positive scale factor s = x write (s, '(2PE10.4,A)') 1.2345, "z" if (s .ne. '12.345E-01z') call abort ! E format, negative scale factor s = x write (s, '(-2PE10.4,A)') 1.250001, "z" if (s .ne. '0.0013E+03z') call abort ! E format, single digit precision s = x write (s, '(E10.1,A)') 1.1, "z" if (s .ne. ' 0.1E+01z') call abort end
gpl-2.0