Changeset 5120 for LMDZ6/branches/Amaury_dev/libf
- Timestamp:
- Jul 24, 2024, 7:06:44 PM (4 months ago)
- Location:
- LMDZ6/branches/Amaury_dev/libf
- Files:
-
- 6 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/dyn3dmem/conf_gcm.F90
r5118 r5120 7 7 USE IOIPSL 8 8 USE misc_mod 9 USE mod_filtre_fft, ONLY: use_filtre_fft10 USE mod_filtre_fft_loc, ONLY: use_filtre_fft_loc=>use_filtre_fft9 USE lmdz_filtre_fft, ONLY: use_filtre_fft 10 USE lmdz_filtre_fft_loc, ONLY: use_filtre_fft_loc=>use_filtre_fft 11 11 USE mod_hallo, ONLY: use_mpi_alloc 12 12 USE infotrac, ONLY: type_trac -
LMDZ6/branches/Amaury_dev/libf/dyn3dmem/filtreg_p.F90
r5117 r5120 5 5 ifiltre, iaire, griscal ,iter) 6 6 USE parallel_lmdz, ONLY: OMP_CHUNK 7 USE mod_filtre_fft8 USE lmdz_timer_filtre 7 USE lmdz_filtre_fft, ONLY: use_filtre_fft, filtre_u_fft, filtre_v_fft, filtre_inv_fft 8 USE lmdz_timer_filtre, ONLY: init_timer, start_timer, stop_timer 9 9 USE lmdz_coefils, ONLY: jfiltnu, jfiltnv, jfiltsu, jfiltsv, sddu, sddv, unsddu, unsddv, modfrstv, modfrstu 10 10 USE lmdz_filtreg, ONLY: matrinvn, matrinvs, matriceun, matriceus, matricevn, matricevs -
LMDZ6/branches/Amaury_dev/libf/dyn3dmem/lmdz_filtreg_p.F90
r5117 r5120 10 10 ifiltre, iaire, griscal, iter) 11 11 USE parallel_lmdz, ONLY: OMP_CHUNK 12 USE mod_filtre_fft_loc, ONLY: use_filtre_fft, filtre_u_fft, &12 USE lmdz_filtre_fft_loc, ONLY: use_filtre_fft, filtre_u_fft, & 13 13 filtre_v_fft, filtre_inv_fft 14 14 USE lmdz_timer_filtre, ONLY: init_timer, start_timer, stop_timer -
LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_fft_wrapper.f90
r5107 r5120 1 1 MODULE lmdz_fft_wrapper 2 IMPLICIT NONE; PRIVATE 3 PUBLIC vsize, inc, init_fft, fft_forward, fft_backward 2 4 3 5 INTEGER,SAVE :: vsize … … 6 8 CONTAINS 7 9 8 SUBROUTINE Init_fft(iim,nb)10 SUBROUTINE init_fft(iim,nb) 9 11 IMPLICIT NONE 10 12 INTEGER :: iim … … 13 15 print *, "wrapper fft : une FFT doit etre specifiee a l'aide d'une clee CPP, sinon utiliser le filtre classique" 14 16 stop 1 15 END SUBROUTINE Init_fft17 END SUBROUTINE init_fft 16 18 17 19 -
LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft.F90
r5119 r5120 2 2 ! $Id$ 3 3 4 MODULE mod_filtre_fft 5 6 LOGICAL,SAVE :: use_filtre_fft 7 REAL,SAVE,ALLOCATABLE :: Filtre_u(:,:) 8 REAL,SAVE,ALLOCATABLE :: Filtre_v(:,:) 9 REAL,SAVE,ALLOCATABLE :: Filtre_inv(:,:) 4 MODULE lmdz_filtre_fft 5 IMPLICIT NONE; PRIVATE 6 PUBLIC use_filtre_fft, filtre_u, filtre_v, filtre_inv, init_filtre_fft, filtre_u_fft, & 7 filtre_v_fft, filtre_inv_fft 8 9 LOGICAL :: use_filtre_fft 10 REAL,ALLOCATABLE :: filtre_u(:,:) 11 REAL,ALLOCATABLE :: filtre_v(:,:) 12 REAL,ALLOCATABLE :: filtre_inv(:,:) 10 13 11 14 CONTAINS 12 15 13 SUBROUTINE Init_filtre_fft(coeffu,modfrstu,jfiltnu,jfiltsu,coeffv,modfrstv,jfiltnv,jfiltsv)16 SUBROUTINE init_filtre_fft(coeffu,modfrstu,jfiltnu,jfiltsu,coeffv,modfrstv,jfiltnv,jfiltsv) 14 17 USE lmdz_fft 15 18 IMPLICIT NONE … … 37 40 ENDDO 38 41 39 ALLOCATE( Filtre_u(iim,jjm))40 ALLOCATE( Filtre_v(iim,jjm))41 ALLOCATE( Filtre_inv(iim,jjm))42 ALLOCATE(filtre_u(iim,jjm)) 43 ALLOCATE(filtre_v(iim,jjm)) 44 ALLOCATE(filtre_inv(iim,jjm)) 42 45 43 46 … … 45 48 DO i=1,iim 46 49 IF (index_vp(i) < modfrstu(j)) THEN 47 Filtre_u(i,j)=048 ELSE 49 Filtre_u(i,j)=coeffu(index_vp(i),j)50 filtre_u(i,j)=0 51 ELSE 52 filtre_u(i,j)=coeffu(index_vp(i),j) 50 53 ENDIF 51 54 ENDDO … … 55 58 DO i=1,iim 56 59 IF (index_vp(i) < modfrstu(j)) THEN 57 Filtre_u(i,j)=058 ELSE 59 Filtre_u(i,j)=coeffu(index_vp(i),j)60 filtre_u(i,j)=0 61 ELSE 62 filtre_u(i,j)=coeffu(index_vp(i),j) 60 63 ENDIF 61 64 ENDDO … … 65 68 DO i=1,iim 66 69 IF (index_vp(i) < modfrstv(j)) THEN 67 Filtre_v(i,j)=068 ELSE 69 Filtre_v(i,j)=coeffv(index_vp(i),j)70 filtre_v(i,j)=0 71 ELSE 72 filtre_v(i,j)=coeffv(index_vp(i),j) 70 73 ENDIF 71 74 ENDDO … … 75 78 DO i=1,iim 76 79 IF (index_vp(i) < modfrstv(j)) THEN 77 Filtre_v(i,j)=078 ELSE 79 Filtre_v(i,j)=coeffv(index_vp(i),j)80 filtre_v(i,j)=0 81 ELSE 82 filtre_v(i,j)=coeffv(index_vp(i),j) 80 83 ENDIF 81 84 ENDDO … … 85 88 DO i=1,iim 86 89 IF (index_vp(i) < modfrstu(j)) THEN 87 Filtre_inv(i,j)=088 ELSE 89 Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))90 filtre_inv(i,j)=0 91 ELSE 92 filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j)) 90 93 ENDIF 91 94 ENDDO … … 95 98 DO i=1,iim 96 99 IF (index_vp(i) < modfrstu(j)) THEN 97 Filtre_inv(i,j)=098 ELSE 99 Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))100 filtre_inv(i,j)=0 101 ELSE 102 filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j)) 100 103 ENDIF 101 104 ENDDO … … 107 110 WRITE (*,*)jfiltnu,jfiltsu,jfiltnv,jjm-jfiltsv 108 111 WRITE (*,*)MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1 109 CALL Init_FFT(iim,(llm+1)*(MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1))112 CALL init_FFT(iim,(llm+1)*(MAX(jfiltnu-2,jjm-jfiltsu,jfiltnv-2,jjm-jfiltsv)+1)) 110 113 #else 111 CALL Init_FFT(iim,(jjm+1)*(llm+1))114 CALL init_FFT(iim,(jjm+1)*(llm+1)) 112 115 #endif 113 116 114 END SUBROUTINE Init_filtre_fft115 116 SUBROUTINE Filtre_u_fft(vect_inout,nlat,jj_begin,jj_end,nbniv)117 END SUBROUTINE init_filtre_fft 118 119 SUBROUTINE filtre_u_fft(vect_inout,nlat,jj_begin,jj_end,nbniv) 117 120 USE lmdz_fft 118 121 #ifdef CPP_PARA … … 152 155 DO j=1,jj_end-jj_begin+1 153 156 DO i=1,iim/2+1 154 TF_vect(i,j,l)=TF_vect(i,j,l)* Filtre_u(i,jj_begin+j-1)157 TF_vect(i,j,l)=TF_vect(i,j,l)*filtre_u(i,jj_begin+j-1) 155 158 ENDDO 156 159 ENDDO … … 172 175 !$OMP END DO NOWAIT 173 176 174 END SUBROUTINE Filtre_u_fft 175 176 177 SUBROUTINE Filtre_v_fft(vect_inout,nlat,jj_begin,jj_end,nbniv) 177 END SUBROUTINE filtre_u_fft 178 179 SUBROUTINE filtre_v_fft(vect_inout,nlat,jj_begin,jj_end,nbniv) 178 180 USE lmdz_fft 179 181 #ifdef CPP_PARA … … 214 216 DO j=1,jj_end-jj_begin+1 215 217 DO i=1,iim/2+1 216 TF_vect(i,j,l)=TF_vect(i,j,l)* Filtre_v(i,jj_begin+j-1)218 TF_vect(i,j,l)=TF_vect(i,j,l)*filtre_v(i,jj_begin+j-1) 217 219 ENDDO 218 220 ENDDO … … 234 236 !$OMP END DO NOWAIT 235 237 236 END SUBROUTINE Filtre_v_fft 237 238 239 SUBROUTINE Filtre_inv_fft(vect_inout,nlat,jj_begin,jj_end,nbniv) 238 END SUBROUTINE filtre_v_fft 239 240 SUBROUTINE filtre_inv_fft(vect_inout,nlat,jj_begin,jj_end,nbniv) 240 241 USE lmdz_fft 241 242 #ifdef CPP_PARA … … 275 276 DO j=1,jj_end-jj_begin+1 276 277 DO i=1,iim/2+1 277 TF_vect(i,j,l)=TF_vect(i,j,l)* Filtre_inv(i,jj_begin+j-1)278 TF_vect(i,j,l)=TF_vect(i,j,l)*filtre_inv(i,jj_begin+j-1) 278 279 ENDDO 279 280 ENDDO … … 294 295 !$OMP END DO NOWAIT 295 296 296 END SUBROUTINE Filtre_inv_fft297 END SUBROUTINE filtre_inv_fft 297 298 298 END MODULE mod_filtre_fft299 END MODULE lmdz_filtre_fft 299 300 -
LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtre_fft_loc.f90
r5119 r5120 1 MODULE mod_filtre_fft_loc 2 3 LOGICAL,SAVE :: use_filtre_fft 4 REAL,SAVE,ALLOCATABLE :: Filtre_u(:,:) 5 REAL,SAVE,ALLOCATABLE :: Filtre_v(:,:) 6 REAL,SAVE,ALLOCATABLE :: Filtre_inv(:,:) 1 MODULE lmdz_filtre_fft_loc 2 IMPLICIT NONE; PRIVATE 3 PUBLIC use_filtre_fft, filtre_u, filtre_v, filtre_inv, init_filtre_fft, filtre_u_fft, & 4 filtre_v_fft, filtre_inv_fft 5 6 LOGICAL, SAVE :: use_filtre_fft 7 REAL, SAVE, ALLOCATABLE :: Filtre_u(:, :) 8 REAL, SAVE, ALLOCATABLE :: Filtre_v(:, :) 9 REAL, SAVE, ALLOCATABLE :: Filtre_inv(:, :) 7 10 8 11 CONTAINS 9 10 SUBROUTINE Init_filtre_fft(coeffu, modfrstu,jfiltnu,jfiltsu,coeffv,modfrstv,jfiltnv,jfiltsv)12 13 SUBROUTINE Init_filtre_fft(coeffu, modfrstu, jfiltnu, jfiltsu, coeffv, modfrstv, jfiltnv, jfiltsv) 11 14 USE lmdz_fft 12 15 IMPLICIT NONE 13 16 include 'dimensions.h' 14 REAL, INTENT(IN) :: coeffu(iim,jjm) 15 INTEGER,INTENT(IN) :: modfrstu(jjm) 16 INTEGER,INTENT(IN) :: jfiltnu 17 INTEGER,INTENT(IN) :: jfiltsu 18 REAL, INTENT(IN) :: coeffv(iim,jjm) 19 INTEGER,INTENT(IN) :: modfrstv(jjm) 20 INTEGER,INTENT(IN) :: jfiltnv 21 INTEGER,INTENT(IN) :: jfiltsv 22 23 INTEGER :: index_vp(iim) 24 INTEGER :: i,j 25 26 index_vp(1)=1 27 DO i=1,iim/2 28 index_vp(i+1)=i*2 29 ENDDO 30 31 DO i=1,iim/2-1 32 index_vp(iim/2+i+1)=iim-2*i+1 33 ENDDO 34 35 ALLOCATE(Filtre_u(iim,jjm)) 36 ALLOCATE(Filtre_v(iim,jjm)) 37 ALLOCATE(Filtre_inv(iim,jjm)) 38 39 40 DO j=2,jfiltnu 41 DO i=1,iim 17 REAL, INTENT(IN) :: coeffu(iim, jjm) 18 INTEGER, INTENT(IN) :: modfrstu(jjm) 19 INTEGER, INTENT(IN) :: jfiltnu 20 INTEGER, INTENT(IN) :: jfiltsu 21 REAL, INTENT(IN) :: coeffv(iim, jjm) 22 INTEGER, INTENT(IN) :: modfrstv(jjm) 23 INTEGER, INTENT(IN) :: jfiltnv 24 INTEGER, INTENT(IN) :: jfiltsv 25 26 INTEGER :: index_vp(iim) 27 INTEGER :: i, j 28 29 index_vp(1) = 1 30 DO i = 1, iim / 2 31 index_vp(i + 1) = i * 2 32 ENDDO 33 34 DO i = 1, iim / 2 - 1 35 index_vp(iim / 2 + i + 1) = iim - 2 * i + 1 36 ENDDO 37 38 ALLOCATE(Filtre_u(iim, jjm)) 39 ALLOCATE(Filtre_v(iim, jjm)) 40 ALLOCATE(Filtre_inv(iim, jjm)) 41 42 DO j = 2, jfiltnu 43 DO i = 1, iim 42 44 IF (index_vp(i) < modfrstu(j)) THEN 43 Filtre_u(i, j)=044 ELSE 45 Filtre_u(i, j)=coeffu(index_vp(i),j)46 ENDIF 47 ENDDO 48 ENDDO 49 50 DO j =jfiltsu,jjm51 DO i =1,iim45 Filtre_u(i, j) = 0 46 ELSE 47 Filtre_u(i, j) = coeffu(index_vp(i), j) 48 ENDIF 49 ENDDO 50 ENDDO 51 52 DO j = jfiltsu, jjm 53 DO i = 1, iim 52 54 IF (index_vp(i) < modfrstu(j)) THEN 53 Filtre_u(i, j)=054 ELSE 55 Filtre_u(i, j)=coeffu(index_vp(i),j)56 ENDIF 57 ENDDO 58 ENDDO 59 60 DO j =1,jfiltnv61 DO i =1,iim55 Filtre_u(i, j) = 0 56 ELSE 57 Filtre_u(i, j) = coeffu(index_vp(i), j) 58 ENDIF 59 ENDDO 60 ENDDO 61 62 DO j = 1, jfiltnv 63 DO i = 1, iim 62 64 IF (index_vp(i) < modfrstv(j)) THEN 63 Filtre_v(i, j)=064 ELSE 65 Filtre_v(i, j)=coeffv(index_vp(i),j)66 ENDIF 67 ENDDO 68 ENDDO 69 70 DO j =jfiltsv,jjm71 DO i =1,iim65 Filtre_v(i, j) = 0 66 ELSE 67 Filtre_v(i, j) = coeffv(index_vp(i), j) 68 ENDIF 69 ENDDO 70 ENDDO 71 72 DO j = jfiltsv, jjm 73 DO i = 1, iim 72 74 IF (index_vp(i) < modfrstv(j)) THEN 73 Filtre_v(i, j)=074 ELSE 75 Filtre_v(i, j)=coeffv(index_vp(i),j)76 ENDIF 77 ENDDO 78 ENDDO 79 80 DO j =2,jfiltnu81 DO i =1,iim75 Filtre_v(i, j) = 0 76 ELSE 77 Filtre_v(i, j) = coeffv(index_vp(i), j) 78 ENDIF 79 ENDDO 80 ENDDO 81 82 DO j = 2, jfiltnu 83 DO i = 1, iim 82 84 IF (index_vp(i) < modfrstu(j)) THEN 83 Filtre_inv(i, j)=084 ELSE 85 Filtre_inv(i, j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j))86 ENDIF 87 ENDDO 88 ENDDO 89 90 DO j =jfiltsu,jjm91 DO i =1,iim85 Filtre_inv(i, j) = 0 86 ELSE 87 Filtre_inv(i, j) = coeffu(index_vp(i), j) / (1. + coeffu(index_vp(i), j)) 88 ENDIF 89 ENDDO 90 ENDDO 91 92 DO j = jfiltsu, jjm 93 DO i = 1, iim 92 94 IF (index_vp(i) < modfrstu(j)) THEN 93 Filtre_inv(i,j)=0 94 ELSE 95 Filtre_inv(i,j)=coeffu(index_vp(i),j)/(1.+coeffu(index_vp(i),j)) 96 ENDIF 97 ENDDO 98 ENDDO 99 100 101 ! CALL Init_FFT(iim,(jjm+1)*(llm+1)) 102 103 95 Filtre_inv(i, j) = 0 96 ELSE 97 Filtre_inv(i, j) = coeffu(index_vp(i), j) / (1. + coeffu(index_vp(i), j)) 98 ENDIF 99 ENDDO 100 ENDDO 101 102 103 ! CALL Init_FFT(iim,(jjm+1)*(llm+1)) 104 104 105 END SUBROUTINE Init_filtre_fft 105 106 SUBROUTINE Filtre_u_fft(vect_inout, jjb,jje,jj_begin,jj_end,nbniv)106 107 SUBROUTINE Filtre_u_fft(vect_inout, jjb, jje, jj_begin, jj_end, nbniv) 107 108 USE lmdz_fft 108 109 #ifdef CPP_PARA … … 111 112 IMPLICIT NONE 112 113 include 'dimensions.h' 113 INTEGER, INTENT(IN) :: jjb114 INTEGER, INTENT(IN) :: jje115 INTEGER, INTENT(IN) :: jj_begin116 INTEGER, INTENT(IN) :: jj_end117 INTEGER, INTENT(IN) :: nbniv118 REAL, INTENT(INOUT) :: vect_inout(iim+1,jjb:jje,nbniv)119 120 REAL :: vect(iim+inc,jj_end-jj_begin+1,nbniv)121 COMPLEX :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)122 INTEGER 123 INTEGER :: i, j,l114 INTEGER, INTENT(IN) :: jjb 115 INTEGER, INTENT(IN) :: jje 116 INTEGER, INTENT(IN) :: jj_begin 117 INTEGER, INTENT(IN) :: jj_end 118 INTEGER, INTENT(IN) :: nbniv 119 REAL, INTENT(INOUT) :: vect_inout(iim + 1, jjb:jje, nbniv) 120 121 REAL :: vect(iim + inc, jj_end - jj_begin + 1, nbniv) 122 COMPLEX :: TF_vect(iim / 2 + 1, jj_end - jj_begin + 1, nbniv) 123 INTEGER :: nb_vect 124 INTEGER :: i, j, l 124 125 INTEGER :: ll_nb 125 ! REAL :: vect_tmp(iim+inc,jj_end-jj_begin+1,nbniv)126 127 ll_nb =0128 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)129 DO l =1,nbniv130 ll_nb =ll_nb+1131 DO j =1,jj_end-jj_begin+1132 DO i =1,iim+1133 vect(i, j,ll_nb)=vect_inout(i,j+jj_begin-1,l)134 ENDDO 135 ENDDO 136 ENDDO 137 !$OMP END DO NOWAIT138 139 nb_vect =(jj_end-jj_begin+1)*ll_nb140 141 ! vect_tmp=vect142 143 CALL FFT_forward(vect, TF_vect,nb_vect)144 145 ! CALL FFT_forward(vect,TF_vect_test,nb_vect)146 ! PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"147 ! DO j=1,jj_end-jj_begin+1148 ! DO i=1,iim/2+1149 ! PRINT *,"====",i,j,"----->",TF_vect_test(i,j,1)150 ! ENDDO151 ! ENDDO152 153 DO l =1,ll_nb154 DO j =1,jj_end-jj_begin+1155 DO i =1,iim/2+1156 TF_vect(i, j,l)=TF_vect(i,j,l)*Filtre_u(i,jj_begin+j-1)157 ENDDO 158 ENDDO 159 ENDDO 160 161 CALL FFT_backward(TF_vect, vect,nb_vect)162 ! CALL FFT_backward(TF_vect_test,vect_test,nb_vect)163 164 ! PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx"165 ! DO j=1,jj_end-jj_begin+1166 ! DO i=1,iim167 ! PRINT *,"====",i,j,"----->",vect_test(i,j,1)168 ! ENDDO169 ! ENDDO170 171 ll_nb =0172 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)173 DO l =1,nbniv174 ll_nb =ll_nb+1175 DO j =1,jj_end-jj_begin+1176 DO i =1,iim+1177 vect_inout(i, j+jj_begin-1,l)=vect(i,j,ll_nb)178 ENDDO 179 ENDDO 180 ENDDO 181 !$OMP END DO NOWAIT126 ! REAL :: vect_tmp(iim+inc,jj_end-jj_begin+1,nbniv) 127 128 ll_nb = 0 129 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 130 DO l = 1, nbniv 131 ll_nb = ll_nb + 1 132 DO j = 1, jj_end - jj_begin + 1 133 DO i = 1, iim + 1 134 vect(i, j, ll_nb) = vect_inout(i, j + jj_begin - 1, l) 135 ENDDO 136 ENDDO 137 ENDDO 138 !$OMP END DO NOWAIT 139 140 nb_vect = (jj_end - jj_begin + 1) * ll_nb 141 142 ! vect_tmp=vect 143 144 CALL FFT_forward(vect, TF_vect, nb_vect) 145 146 ! CALL FFT_forward(vect,TF_vect_test,nb_vect) 147 ! PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx" 148 ! DO j=1,jj_end-jj_begin+1 149 ! DO i=1,iim/2+1 150 ! PRINT *,"====",i,j,"----->",TF_vect_test(i,j,1) 151 ! ENDDO 152 ! ENDDO 153 154 DO l = 1, ll_nb 155 DO j = 1, jj_end - jj_begin + 1 156 DO i = 1, iim / 2 + 1 157 TF_vect(i, j, l) = TF_vect(i, j, l) * Filtre_u(i, jj_begin + j - 1) 158 ENDDO 159 ENDDO 160 ENDDO 161 162 CALL FFT_backward(TF_vect, vect, nb_vect) 163 ! CALL FFT_backward(TF_vect_test,vect_test,nb_vect) 164 165 ! PRINT *,"XXXXXXXXXXXXX Filtre_u_FFT xxxxxxxxxxxx" 166 ! DO j=1,jj_end-jj_begin+1 167 ! DO i=1,iim 168 ! PRINT *,"====",i,j,"----->",vect_test(i,j,1) 169 ! ENDDO 170 ! ENDDO 171 172 ll_nb = 0 173 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 174 DO l = 1, nbniv 175 ll_nb = ll_nb + 1 176 DO j = 1, jj_end - jj_begin + 1 177 DO i = 1, iim + 1 178 vect_inout(i, j + jj_begin - 1, l) = vect(i, j, ll_nb) 179 ENDDO 180 ENDDO 181 ENDDO 182 !$OMP END DO NOWAIT 182 183 183 184 END SUBROUTINE Filtre_u_fft 184 185 186 SUBROUTINE Filtre_v_fft(vect_inout, jjb,jje,jj_begin,jj_end,nbniv)185 186 187 SUBROUTINE Filtre_v_fft(vect_inout, jjb, jje, jj_begin, jj_end, nbniv) 187 188 USE lmdz_fft 188 189 #ifdef CPP_PARA … … 191 192 IMPLICIT NONE 192 193 INCLUDE 'dimensions.h' 193 INTEGER, INTENT(IN) :: jjb194 INTEGER, INTENT(IN) :: jje195 INTEGER, INTENT(IN) :: jj_begin196 INTEGER, INTENT(IN) :: jj_end197 INTEGER, INTENT(IN) :: nbniv198 REAL, INTENT(INOUT) :: vect_inout(iim+1,jjb:jje,nbniv)199 200 REAL :: vect(iim+inc,jj_end-jj_begin+1,nbniv)201 COMPLEX :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)202 INTEGER 203 INTEGER :: i, j,l194 INTEGER, INTENT(IN) :: jjb 195 INTEGER, INTENT(IN) :: jje 196 INTEGER, INTENT(IN) :: jj_begin 197 INTEGER, INTENT(IN) :: jj_end 198 INTEGER, INTENT(IN) :: nbniv 199 REAL, INTENT(INOUT) :: vect_inout(iim + 1, jjb:jje, nbniv) 200 201 REAL :: vect(iim + inc, jj_end - jj_begin + 1, nbniv) 202 COMPLEX :: TF_vect(iim / 2 + 1, jj_end - jj_begin + 1, nbniv) 203 INTEGER :: nb_vect 204 INTEGER :: i, j, l 204 205 INTEGER :: ll_nb 205 206 ll_nb=0 207 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 208 DO l=1,nbniv 209 ll_nb=ll_nb+1 210 DO j=1,jj_end-jj_begin+1 211 DO i=1,iim+1 212 vect(i,j,ll_nb)=vect_inout(i,j+jj_begin-1,l) 213 ENDDO 214 ENDDO 215 ENDDO 216 !$OMP END DO NOWAIT 217 218 219 nb_vect=(jj_end-jj_begin+1)*ll_nb 220 221 CALL FFT_forward(vect,TF_vect,nb_vect) 222 223 DO l=1,ll_nb 224 DO j=1,jj_end-jj_begin+1 225 DO i=1,iim/2+1 226 TF_vect(i,j,l)=TF_vect(i,j,l)*Filtre_v(i,jj_begin+j-1) 227 ENDDO 228 ENDDO 229 ENDDO 230 231 CALL FFT_backward(TF_vect,vect,nb_vect) 232 233 234 ll_nb=0 235 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 236 DO l=1,nbniv 237 ll_nb=ll_nb+1 238 DO j=1,jj_end-jj_begin+1 239 DO i=1,iim+1 240 vect_inout(i,j+jj_begin-1,l)=vect(i,j,ll_nb) 241 ENDDO 242 ENDDO 243 ENDDO 244 !$OMP END DO NOWAIT 245 206 207 ll_nb = 0 208 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 209 DO l = 1, nbniv 210 ll_nb = ll_nb + 1 211 DO j = 1, jj_end - jj_begin + 1 212 DO i = 1, iim + 1 213 vect(i, j, ll_nb) = vect_inout(i, j + jj_begin - 1, l) 214 ENDDO 215 ENDDO 216 ENDDO 217 !$OMP END DO NOWAIT 218 219 nb_vect = (jj_end - jj_begin + 1) * ll_nb 220 221 CALL FFT_forward(vect, TF_vect, nb_vect) 222 223 DO l = 1, ll_nb 224 DO j = 1, jj_end - jj_begin + 1 225 DO i = 1, iim / 2 + 1 226 TF_vect(i, j, l) = TF_vect(i, j, l) * Filtre_v(i, jj_begin + j - 1) 227 ENDDO 228 ENDDO 229 ENDDO 230 231 CALL FFT_backward(TF_vect, vect, nb_vect) 232 233 ll_nb = 0 234 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 235 DO l = 1, nbniv 236 ll_nb = ll_nb + 1 237 DO j = 1, jj_end - jj_begin + 1 238 DO i = 1, iim + 1 239 vect_inout(i, j + jj_begin - 1, l) = vect(i, j, ll_nb) 240 ENDDO 241 ENDDO 242 ENDDO 243 !$OMP END DO NOWAIT 244 246 245 END SUBROUTINE Filtre_v_fft 247 246 248 247 249 SUBROUTINE Filtre_inv_fft(vect_inout, jjb,jje,jj_begin,jj_end,nbniv)248 SUBROUTINE Filtre_inv_fft(vect_inout, jjb, jje, jj_begin, jj_end, nbniv) 250 249 USE lmdz_fft 251 250 #ifdef CPP_PARA … … 254 253 IMPLICIT NONE 255 254 INCLUDE 'dimensions.h' 256 INTEGER, INTENT(IN) :: jjb257 INTEGER, INTENT(IN) :: jje258 INTEGER, INTENT(IN) :: jj_begin259 INTEGER, INTENT(IN) :: jj_end260 INTEGER, INTENT(IN) :: nbniv261 REAL, INTENT(INOUT) :: vect_inout(iim+1,jjb:jje,nbniv)262 263 REAL :: vect(iim+inc,jj_end-jj_begin+1,nbniv)264 COMPLEX :: TF_vect(iim/2+1,jj_end-jj_begin+1,nbniv)265 INTEGER 266 INTEGER :: i, j,l255 INTEGER, INTENT(IN) :: jjb 256 INTEGER, INTENT(IN) :: jje 257 INTEGER, INTENT(IN) :: jj_begin 258 INTEGER, INTENT(IN) :: jj_end 259 INTEGER, INTENT(IN) :: nbniv 260 REAL, INTENT(INOUT) :: vect_inout(iim + 1, jjb:jje, nbniv) 261 262 REAL :: vect(iim + inc, jj_end - jj_begin + 1, nbniv) 263 COMPLEX :: TF_vect(iim / 2 + 1, jj_end - jj_begin + 1, nbniv) 264 INTEGER :: nb_vect 265 INTEGER :: i, j, l 267 266 INTEGER :: ll_nb 268 269 ll_nb =0270 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)271 DO l =1,nbniv272 ll_nb =ll_nb+1273 DO j =1,jj_end-jj_begin+1274 DO i =1,iim+1275 vect(i, j,ll_nb)=vect_inout(i,j+jj_begin-1,l)276 ENDDO 277 ENDDO 278 ENDDO 279 !$OMP END DO NOWAIT280 281 nb_vect =(jj_end-jj_begin+1)*ll_nb282 283 CALL FFT_forward(vect, TF_vect,nb_vect)284 285 DO l =1,ll_nb286 DO j =1,jj_end-jj_begin+1287 DO i =1,iim/2+1288 TF_vect(i, j,l)=TF_vect(i,j,l)*Filtre_inv(i,jj_begin+j-1)289 ENDDO 290 ENDDO 291 ENDDO 292 293 CALL FFT_backward(TF_vect, vect,nb_vect)294 295 ll_nb =0296 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK)297 DO l =1,nbniv298 ll_nb =ll_nb+1299 DO j =1,jj_end-jj_begin+1300 DO i =1,iim+1301 vect_inout(i, j+jj_begin-1,l)=vect(i,j,ll_nb)302 ENDDO 303 ENDDO 304 ENDDO 305 !$OMP END DO NOWAIT306 307 END SUBROUTINE Filtre_inv_fft 308 309 310 ! SUBROUTINE get_ll_index(nbniv,ll_index,ll_nb)311 ! IMPLICIT NONE312 ! INTEGER,INTENT(IN) :: nbniv313 ! INTEGER,INTENT(OUT) :: ll_index(nbniv)314 ! INTEGER,INTENT(OUT) :: ll_nb315 316 ! INTEGER :: l,ll_begin, ll_end317 ! INTEGER :: omp_rank,omp_size318 ! INTEGER :: OMP_GET_NUM_THREADS319 ! INTEGER :: omp_chunk320 ! EXTERNAL OMP_GET_NUM_THREADS321 ! INTEGER :: OMP_GET_THREAD_NUM322 ! EXTERNAL OMP_GET_THREAD_NUM323 324 325 ! omp_size=OMP_GET_NUM_THREADS()326 ! omp_rank=OMP_GET_THREAD_NUM() 327 ! omp_chunk=nbniv/omp_size+min(1,MOD(nbniv,omp_size))328 329 ! ll_begin=omp_rank*OMP_CHUNK+1330 ! ll_nb=0331 ! DO WHILE (ll_begin<=nbniv)332 ! ll_end=min(ll_begin+OMP_CHUNK-1,nbniv)333 ! DO l=ll_begin,ll_end334 ! ll_nb=ll_nb+1335 ! ll_index(ll_nb)=l336 ! ENDDO337 ! ll_begin=ll_begin+omp_size*OMP_CHUNK338 ! ENDDO339 340 ! END SUBROUTINE get_ll_index341 342 END MODULE mod_filtre_fft_loc267 268 ll_nb = 0 269 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 270 DO l = 1, nbniv 271 ll_nb = ll_nb + 1 272 DO j = 1, jj_end - jj_begin + 1 273 DO i = 1, iim + 1 274 vect(i, j, ll_nb) = vect_inout(i, j + jj_begin - 1, l) 275 ENDDO 276 ENDDO 277 ENDDO 278 !$OMP END DO NOWAIT 279 280 nb_vect = (jj_end - jj_begin + 1) * ll_nb 281 282 CALL FFT_forward(vect, TF_vect, nb_vect) 283 284 DO l = 1, ll_nb 285 DO j = 1, jj_end - jj_begin + 1 286 DO i = 1, iim / 2 + 1 287 TF_vect(i, j, l) = TF_vect(i, j, l) * Filtre_inv(i, jj_begin + j - 1) 288 ENDDO 289 ENDDO 290 ENDDO 291 292 CALL FFT_backward(TF_vect, vect, nb_vect) 293 294 ll_nb = 0 295 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 296 DO l = 1, nbniv 297 ll_nb = ll_nb + 1 298 DO j = 1, jj_end - jj_begin + 1 299 DO i = 1, iim + 1 300 vect_inout(i, j + jj_begin - 1, l) = vect(i, j, ll_nb) 301 ENDDO 302 ENDDO 303 ENDDO 304 !$OMP END DO NOWAIT 305 306 END SUBROUTINE Filtre_inv_fft 307 308 309 ! SUBROUTINE get_ll_index(nbniv,ll_index,ll_nb) 310 ! IMPLICIT NONE 311 ! INTEGER,INTENT(IN) :: nbniv 312 ! INTEGER,INTENT(OUT) :: ll_index(nbniv) 313 ! INTEGER,INTENT(OUT) :: ll_nb 314 315 ! INTEGER :: l,ll_begin, ll_end 316 ! INTEGER :: omp_rank,omp_size 317 ! INTEGER :: OMP_GET_NUM_THREADS 318 ! INTEGER :: omp_chunk 319 ! EXTERNAL OMP_GET_NUM_THREADS 320 ! INTEGER :: OMP_GET_THREAD_NUM 321 ! EXTERNAL OMP_GET_THREAD_NUM 322 323 324 ! omp_size=OMP_GET_NUM_THREADS() 325 ! omp_rank=OMP_GET_THREAD_NUM() 326 ! omp_chunk=nbniv/omp_size+min(1,MOD(nbniv,omp_size)) 327 328 ! ll_begin=omp_rank*OMP_CHUNK+1 329 ! ll_nb=0 330 ! DO WHILE (ll_begin<=nbniv) 331 ! ll_end=min(ll_begin+OMP_CHUNK-1,nbniv) 332 ! DO l=ll_begin,ll_end 333 ! ll_nb=ll_nb+1 334 ! ll_index(ll_nb)=l 335 ! ENDDO 336 ! ll_begin=ll_begin+omp_size*OMP_CHUNK 337 ! ENDDO 338 339 ! END SUBROUTINE get_ll_index 340 341 END MODULE lmdz_filtre_fft_loc 343 342 -
LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_filtreg.F90
r5117 r5120 579 579 SUBROUTINE inifilr 580 580 #ifdef CPP_PARA 581 USE mod_filtre_fft, ONLY: use_filtre_fft,Init_filtre_fft582 USE mod_filtre_fft_loc, ONLY: Init_filtre_fft_loc=>Init_filtre_fft !581 USE lmdz_filtre_fft, ONLY: use_filtre_fft,Init_filtre_fft 582 USE lmdz_filtre_fft_loc, ONLY: Init_filtre_fft_loc=>Init_filtre_fft ! 583 583 #endif 584 584 USE serre_mod, ONLY: alphax -
LMDZ6/branches/Amaury_dev/libf/filtrez/lmdz_timer_filtre.f90
r5107 r5120 2 2 IMPLICIT NONE 3 3 PRIVATE 4 REAL :: time5 REAL :: Last_time 6 PUBLIC :: Init_timer, start_timer, stop_timer, Print_filtre_timer4 PUBLIC :: init_timer, start_timer, stop_timer, print_filtre_timer 5 6 REAL :: time, last_time 7 7 CONTAINS 8 8 9 SUBROUTINE Init_timer9 SUBROUTINE init_timer 10 10 time = 0 11 11 Last_time = 0 12 END SUBROUTINE Init_timer12 END SUBROUTINE init_timer 13 13 14 SUBROUTINE Start_timer14 SUBROUTINE start_timer 15 15 16 16 CALL cpu_time(last_time) … … 23 23 24 24 CALL cpu_time(t) 25 Time = Time + t - last_time25 time = time + t - last_time 26 26 27 27 END SUBROUTINE stop_timer 28 28 29 SUBROUTINE Print_filtre_timer30 PRINT *, "Temps CPU passe dans le filtre :", Time31 END SUBROUTINE Print_filtre_timer29 SUBROUTINE print_filtre_timer 30 PRINT *, "Temps CPU passe dans le filtre :", time 31 END SUBROUTINE print_filtre_timer 32 32 33 33 END MODULE lmdz_timer_filtre -
LMDZ6/branches/Amaury_dev/libf/misc/lmdz_ssum_scopy.f90
r5119 r5120 1 ! TO MOVE SOMEWHERE ELSE !! (Amaury - 07/2024)2 ! Move with other vector/math functions3 1 ! Those are old legacy CRAY replacement functions, that are now used in several parts of the code. 4 2
Note: See TracChangeset
for help on using the changeset viewer.