--- trunk/libf/dyn3d/grad.f 2011/12/12 13:25:01 55 +++ trunk/libf/dyn3d/grad.f90 2012/01/30 14:37:26 60 @@ -1,44 +1,44 @@ -! -! $Header: /home/cvsroot/LMDZ4/libf/dyn3d/grad.F,v 1.1.1.1 2004/05/19 12:53:05 lmdzadmin Exp $ -! - SUBROUTINE grad(klevel, pg,pgx,pgy ) -c -c P. Le Van -c -c ****************************************************************** -c .. calcul des composantes covariantes en x et y du gradient de g -c -c ****************************************************************** -c pg est un argument d'entree pour le s-prog -c pgx et pgy sont des arguments de sortie pour le s-prog -c - use dimens_m - use paramet_m - IMPLICIT NONE -c - INTEGER, intent(in):: klevel - REAL pg( ip1jmp1,klevel ) - REAL pgx( ip1jmp1,klevel ) , pgy( ip1jm,klevel ) - INTEGER l,ij -c -c - DO 6 l = 1,klevel -c - DO 2 ij = 1, ip1jmp1 - 1 - pgx( ij,l ) = pg( ij +1,l ) - pg( ij,l ) - 2 CONTINUE -c -c .... correction pour pgx(ip1,j,l) .... -c ... pgx(iip1,j,l)= pgx(1,j,l) .... -CDIR$ IVDEP - DO 3 ij = iip1, ip1jmp1, iip1 - pgx( ij,l ) = pgx( ij -iim,l ) - 3 CONTINUE -c - DO 4 ij = 1,ip1jm - pgy( ij,l ) = pg( ij,l ) - pg( ij +iip1,l ) - 4 CONTINUE -c - 6 CONTINUE - RETURN - END +module grad_m + + IMPLICIT NONE + +contains + + SUBROUTINE grad(klevel, pg, pgx, pgy) + + ! From LMDZ4/libf/dyn3d/grad.F, version 1.1.1.1 2004/05/19 12:53:05 + ! P. Le Van + + ! Calcul des composantes covariantes en x et y du gradient de g. + + USE dimens_m, ONLY : iim + USE paramet_m, ONLY : iip1, ip1jm, ip1jmp1 + + INTEGER, intent(in):: klevel + REAL, intent(in):: pg(ip1jmp1, klevel) + REAL, intent(out):: pgx(ip1jmp1, klevel) , pgy(ip1jm, klevel) + + ! Local: + INTEGER l, ij + + !---------------------------------------------------------------- + + DO l = 1, klevel + DO ij = 1, ip1jmp1 - 1 + pgx(ij, l) = pg(ij +1, l) - pg(ij, l) + end DO + + ! correction pour pgx(ip1, j, l) + ! pgx(iip1, j, l)= pgx(1, j, l) + DO ij = iip1, ip1jmp1, iip1 + pgx(ij, l) = pgx(ij -iim, l) + end DO + + DO ij = 1, ip1jm + pgy(ij, l) = pg(ij, l) - pg(ij +iip1, l) + end DO + end DO + + END SUBROUTINE grad + +end module grad_m