LMDZ
gridpoint_buffers.F90
Go to the documentation of this file.
2 
3 ! Purpose.
4 ! --------
5 ! GRIDPOINT_BUFFERS defines the type "gridpoint buffer",
6 ! and the operations to create and destroy instances of
7 ! the type.
8 
9 ! Author.
10 ! -------
11 ! Mike Fisher *ECMWF*
12 
13 ! Modifications.
14 ! --------------
15 ! Original : 1999-11-10
16 ! M.Hamrud 01-Oct-2003 CY28 Cleaning
17 
18 ! ------------------------------------------------------------------
19 
20 USE parkind1 ,ONLY : jpim ,jprb
21 USE yomhook ,ONLY : lhook, dr_hook
22 
23 USE yomct0 , ONLY : nprintlev , lallopr
24 USE yomgem , ONLY : ngptot
25 USE yomlun , ONLY : nulout
26 
27 IMPLICIT NONE
28 SAVE
29 
30 PRIVATE
31 PUBLIC gridpoint_buffer, &
35 
37 CHARACTER(LEN=1), POINTER :: clname(:)
38 INTEGER(KIND=JPIM) :: ifields
39 INTEGER(KIND=JPIM) :: idgen
40 INTEGER(KIND=JPIM) :: idgenl
41 INTEGER(KIND=JPIM) :: iblen
42 INTEGER(KIND=JPIM) :: ipack
43 LOGICAL :: lfilled
44 REAL(KIND=JPRB), POINTER :: gpbuf(:)
45 END TYPE gridpoint_buffer
46 
47 #include "abor1.intfb.h"
48 
49 !-----------------------------------------------------------------------
50 
51 CONTAINS
52 SUBROUTINE allocate_gridpoint_buffer (CDNAME,YDGPBUF,KFIELDS,KPACK, &
53  & kgptot)
54 
55 type(gridpoint_buffer),INTENT(OUT) :: ydgpbuf
56 CHARACTER(LEN=*) , INTENT(IN) :: CDNAME
57 INTEGER(KIND=JPIM) , INTENT(IN) :: KFIELDS,KPACK
58 INTEGER(KIND=JPIM) , INTENT(IN),OPTIONAL :: KGPTOT
59 
60 INTEGER(KIND=JPIM) :: J, IGPTOT
61 REAL(KIND=JPRB) :: ZDUM
62 REAL(KIND=JPRB) :: ZHOOK_HANDLE
63 
64 IF (lhook) CALL dr_hook('GRIDPOINT_BUFFERS:ALLOCATE_GRIDPOINT_BUFFER',0,zhook_handle)
65 
66 IF(PRESENT(kgptot))THEN
67  igptot=kgptot
68 ELSE
69  igptot=ngptot
70 ENDIF
71 
72 ALLOCATE (ydgpbuf%CLNAME(len(cdname)))
73 
74 DO j=1,len(cdname)
75  ydgpbuf%CLNAME(j) = cdname(j:j)
76 ENDDO
77 
78 ydgpbuf%IFIELDS = kfields
79 ydgpbuf%IPACK = kpack
80 
81 IF (kpack > 1) CALL abor1('ALLOCATE_GRIDPOINT_BUFFER: KPACK > 1')
82 ydgpbuf%IBLEN = igptot * kfields
83 
84 ALLOCATE (ydgpbuf%GPBUF(ydgpbuf%IBLEN))
85 IF (nprintlev >= 1.OR. lallopr) &
86  & WRITE(nulout,91) cdname,SIZE(ydgpbuf%GPBUF),shape(ydgpbuf%GPBUF)
87 ydgpbuf%GPBUF(:) = huge(zdum)
88 ydgpbuf%LFILLED = .false.
89 
90 IF (lhook) CALL dr_hook('GRIDPOINT_BUFFERS:ALLOCATE_GRIDPOINT_BUFFER',1,zhook_handle)
91 91 FORMAT(1x,'ALLOCATED GRIDPOINT BUFFER ',a,', SIZE=',i8,', SHAPE=',7i8)
92 END SUBROUTINE allocate_gridpoint_buffer
93 
94 SUBROUTINE deallocate_gridpoint_buffer (YDGPBUF)
95 type(gridpoint_buffer),INTENT(INOUT) :: ydgpbuf
96 INTEGER(KIND=JPIM) :: J
97 REAL(KIND=JPRB) :: ZHOOK_HANDLE
98 
99 IF (lhook) CALL dr_hook('GRIDPOINT_BUFFERS:DEALLOCATE_GRIDPOINT_BUFFER',0,zhook_handle)
100 IF (nprintlev >= 1.OR. lallopr) &
101  & WRITE(nulout,92) (ydgpbuf%CLNAME(j),j=1,SIZE(ydgpbuf%CLNAME))
102 
103 DEALLOCATE (ydgpbuf%GPBUF)
104 DEALLOCATE (ydgpbuf%CLNAME)
105 ydgpbuf%LFILLED = .false.
106 
107 IF (lhook) CALL dr_hook('GRIDPOINT_BUFFERS:DEALLOCATE_GRIDPOINT_BUFFER',1,zhook_handle)
108 92 FORMAT(1x,'DEALLOCATED GRIDPOINT BUFFER:,',100a1)
109 END SUBROUTINE deallocate_gridpoint_buffer
110 
111 LOGICAL FUNCTION allocated_gridpoint_buffer (YDGPBUF)
112 type(gridpoint_buffer),INTENT(IN) :: ydgpbuf
113 allocated_gridpoint_buffer = ASSOCIATED (ydgpbuf%GPBUF)
114 END FUNCTION allocated_gridpoint_buffer
115 
116 END MODULE gridpoint_buffers
117 
logical function, public allocated_gridpoint_buffer(YDGPBUF)
subroutine abor1(CDTEXT)
Definition: abor1.F90:2
logical lallopr
Definition: yomct0.F90:327
Definition: yomct0.F90:1
Definition: yomgem.F90:1
integer(kind=jpim) ngptot
Definition: yomgem.F90:19
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL false
Definition: calcul_STDlev.h:26
integer, parameter jprb
Definition: parkind1.F90:31
integer(kind=jpim) nprintlev
Definition: yomct0.F90:328
!$Header!c c INCLUDE fxyprim h c c c Fonctions in line c c REAL fyprim REAL rj c c il faut la calculer avant d appeler ces fonctions c c c Fonctions a changer selon x(x) et y(y) choisis.c-----------------------------------------------------------------c c.....ici
Definition: yomlun.F90:1
logical lhook
Definition: yomhook.F90:12
subroutine, public deallocate_gridpoint_buffer(YDGPBUF)
subroutine dr_hook(CDNAME, KSWITCH, PKEY)
Definition: yomhook.F90:17
integer, parameter jpim
Definition: parkind1.F90:13
subroutine, public allocate_gridpoint_buffer(CDNAME, YDGPBUF, KFIELDS, KPACK, KGPTOT)