Changeset 5249 for LMDZ6/trunk/libf/dyn3dmem
- Timestamp:
- Oct 22, 2024, 11:35:08 AM (8 weeks ago)
- Location:
- LMDZ6/trunk/libf/dyn3dmem
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3dmem/dynredem_mod.F90
r5084 r5249 170 170 ! 171 171 SUBROUTINE cre_var(ncid,var,title,did,units) 172 ! 173 !=============================================================================== 172 USE lmdz_cppkeys_wrapper, ONLY: nf90_format 174 173 IMPLICIT NONE 175 174 !=============================================================================== … … 180 179 CHARACTER(LEN=*), OPTIONAL, INTENT(IN) :: units 181 180 !=============================================================================== 182 #ifdef NC_DOUBLE 183 CALL err(NF90_DEF_VAR(ncid,var,NF90_DOUBLE,did,nvarid),"inq",var) 184 #else 185 CALL err(NF90_DEF_VAR(ncid,var,NF90_FLOAT ,did,nvarid),"inq",var) 186 #endif 181 CALL err(NF90_DEF_VAR(ncid,var,nf90_format ,did,nvarid),"inq",var) 187 182 IF(title/="") CALL err(NF90_PUT_ATT(ncid,nvarid,"title",title),var) 188 183 IF(PRESENT(units)) CALL err(NF90_PUT_ATT(ncid,nvarid,"units",units),var) -
LMDZ6/trunk/libf/dyn3dmem/guide_loc_mod.F90
r5084 r5249 19 19 20 20 ! --------------------------------------------- 21 ! Declarations des cles logiques et parametres 21 ! Declarations des cles logiques et parametres 22 22 ! --------------------------------------------- 23 23 INTEGER, PRIVATE, SAVE :: iguide_read,iguide_int,iguide_sav 24 24 INTEGER, PRIVATE, SAVE :: nlevnc, guide_plevs 25 25 LOGICAL, PRIVATE, SAVE :: guide_u,guide_v,guide_T,guide_Q,guide_P 26 LOGICAL, PRIVATE, SAVE :: guide_hr,guide_teta 27 LOGICAL, PRIVATE, SAVE :: guide_BL,guide_reg,guide_add,gamma4,guide_zon 26 LOGICAL, PRIVATE, SAVE :: guide_hr,guide_teta 27 LOGICAL, PRIVATE, SAVE :: guide_BL,guide_reg,guide_add,gamma4,guide_zon 28 28 LOGICAL, PRIVATE, SAVE :: invert_p,invert_y,ini_anal 29 29 LOGICAL, PRIVATE, SAVE :: guide_2D,guide_sav,guide_modele 30 30 !FC 31 31 LOGICAL, PRIVATE, SAVE :: convert_Pa 32 32 33 33 REAL, PRIVATE, SAVE :: tau_min_u,tau_max_u 34 34 REAL, PRIVATE, SAVE :: tau_min_v,tau_max_v … … 43 43 REAL, PRIVATE, SAVE :: plim_guide_BL 44 44 45 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: alpha_u,alpha_v 46 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: alpha_T,alpha_Q 45 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: alpha_u,alpha_v 46 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: alpha_T,alpha_Q 47 47 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: alpha_P,alpha_pcor 48 48 49 49 ! --------------------------------------------- 50 50 ! Variables de guidage … … 64 64 REAL, ALLOCATABLE, DIMENSION(:,:), PRIVATE, SAVE :: qgui1,qgui2 65 65 REAL, ALLOCATABLE, DIMENSION(:), PRIVATE, SAVE :: psgui1,psgui2 66 66 67 67 INTEGER,SAVE,PRIVATE :: ijbu,ijbv,ijeu,ijev !,ijnu,ijnv 68 68 INTEGER,SAVE,PRIVATE :: jjbu,jjbv,jjeu,jjev,jjnu,jjnv … … 78 78 79 79 IMPLICIT NONE 80 80 81 81 INCLUDE "dimensions.h" 82 82 INCLUDE "paramet.h" … … 89 89 90 90 ! --------------------------------------------- 91 ! Lecture des parametres: 91 ! Lecture des parametres: 92 92 ! --------------------------------------------- 93 93 call ini_getparam("nudging_parameters_out.txt") … … 168 168 169 169 call fin_getparam 170 170 171 171 ! --------------------------------------------- 172 172 ! Determination du nombre de niveaux verticaux … … 198 198 CALL abort_gcm(modname,abort_message,1) 199 199 endif 200 200 201 201 endif 202 202 … … 211 211 endif 212 212 213 213 214 214 elseif (guide_T) then 215 215 if (ncidpl.eq.-99) then … … 233 233 234 234 235 endif 235 endif 236 236 error=NF_INQ_DIMID(ncidpl,'LEVEL',rid) 237 237 IF (error.NE.NF_NOERR) error=NF_INQ_DIMID(ncidpl,'PRESSURE',rid) … … 268 268 IF (error /= 0) CALL abort_gcm(modname,abort_message,1) 269 269 alpha_u=0.;alpha_v=0;alpha_T=0;alpha_Q=0;alpha_P=0 270 270 271 271 IF (guide_u) THEN 272 272 ALLOCATE(unat1(iip1,jjb_u:jje_u,nlevnc), stat = error) … … 292 292 tnat1=0.;tnat2=0.;tgui1=0.;tgui2=0. 293 293 ENDIF 294 294 295 295 IF (guide_Q) THEN 296 296 ALLOCATE(qnat1(iip1,jjb_u:jje_u,nlevnc), stat = error) … … 366 366 USE comconst_mod, ONLY: cpp, daysec, dtvr, kappa 367 367 USE comvert_mod, ONLY: ap, bp, preff, presnivs, pressure_exner 368 368 369 369 IMPLICIT NONE 370 370 371 371 INCLUDE "dimensions.h" 372 372 INCLUDE "paramet.h" … … 386 386 ! Variables pour fonction Exner (P milieu couche) 387 387 REAL, ALLOCATABLE, SAVE, DIMENSION (:,:,:) :: pk 388 REAL, ALLOCATABLE, SAVE, DIMENSION (:,:) :: pks 388 REAL, ALLOCATABLE, SAVE, DIMENSION (:,:) :: pks 389 389 REAL :: unskap 390 390 REAL, ALLOCATABLE, SAVE, DIMENSION (:,:) :: p ! besoin si guide_P … … 396 396 REAL, SAVE :: factt ! pas de temps en fraction de jour 397 397 !$OMP THREADPRIVATE(factt) 398 398 399 399 INTEGER :: i,j,l 400 400 CHARACTER(LEN=20) :: modname="guide_main" 401 402 !$OMP MASTER 401 402 !$OMP MASTER 403 403 ijbu=ij_begin ; ijeu=ij_end 404 jjbu=jj_begin ; jjeu=jj_end ; jjnu=jjeu-jjbu+1 404 jjbu=jj_begin ; jjeu=jj_end ; jjnu=jjeu-jjbu+1 405 405 ijbv=ij_begin ; ijev=ij_end 406 jjbv=jj_begin ; jjev=jj_end ; jjnv=jjev-jjbv+1 406 jjbv=jj_begin ; jjev=jj_end ; jjnv=jjev-jjbv+1 407 407 IF (pole_sud) THEN 408 408 ijeu=ij_end-iip1 409 409 ijev=ij_end-iip1 410 410 jjev=jj_end-1 411 jjnv=jjev-jjbv+1 411 jjnv=jjev-jjbv+1 412 412 ENDIF 413 413 IF (pole_nord) THEN … … 417 417 !$OMP END MASTER 418 418 !$OMP BARRIER 419 419 420 420 ! PRINT *,'---> on rentre dans guide_main' 421 421 ! CALL AllGather_Field(ucov,ip1jmp1,llm) … … 424 424 ! CALL AllGather_Field(ps,ip1jmp1,1) 425 425 ! CALL AllGather_Field(q,ip1jmp1,llm) 426 426 427 427 !----------------------------------------------------------------------- 428 428 ! Initialisations au premier passage … … 432 432 first=.FALSE. 433 433 !$OMP MASTER 434 ALLOCATE(f_addu(ijb_u:ije_u,llm) ) 435 ALLOCATE(f_addv(ijb_v:ije_v,llm) ) 436 ALLOCATE(pk(iip1,jjb_u:jje_u,llm) ) 437 ALLOCATE(pks(iip1,jjb_u:jje_u) ) 438 ALLOCATE(p(ijb_u:ije_u,llmp1) ) 439 CALL guide_init 434 ALLOCATE(f_addu(ijb_u:ije_u,llm) ) 435 ALLOCATE(f_addv(ijb_v:ije_v,llm) ) 436 ALLOCATE(pk(iip1,jjb_u:jje_u,llm) ) 437 ALLOCATE(pks(iip1,jjb_u:jje_u) ) 438 ALLOCATE(p(ijb_u:ije_u,llmp1) ) 439 CALL guide_init 440 440 !$OMP END MASTER 441 441 !$OMP BARRIER … … 444 444 count_no_rea=0 445 445 ! Calcul des constantes de rappel 446 factt=dtvr*iperiod/daysec 446 factt=dtvr*iperiod/daysec 447 447 !$OMP MASTER 448 448 call tau2alpha(3, iip1, jjb_v, jje_v, factt, tau_min_v, tau_max_v, alpha_v) … … 461 461 !$OMP END MASTER 462 462 !$OMP BARRIER 463 ! ini_anal: etat initial egal au guidage 463 ! ini_anal: etat initial egal au guidage 464 464 IF (ini_anal) THEN 465 465 CALL guide_interp(ps,teta) 466 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 466 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 467 467 DO l=1,llm 468 468 IF (guide_u) ucov(ijbu:ijeu,l)=ugui2(ijbu:ijeu,l) … … 471 471 IF (guide_Q) q(ijbu:ijeu,l)=qgui2(ijbu:ijeu,l) 472 472 ENDDO 473 473 474 474 IF (guide_P) THEN 475 475 !$OMP MASTER … … 555 555 ! CALL WriteField_u('teta_guide',teta) 556 556 ! CALL WriteField_u('masse_guide',masse) 557 558 557 558 559 559 !----------------------------------------------------------------------- 560 ! Ajout des champs de guidage 560 ! Ajout des champs de guidage 561 561 !----------------------------------------------------------------------- 562 562 ! Sauvegarde du guidage? 563 f_out=((MOD(itau,iguide_sav).EQ.0).AND.guide_sav) 563 f_out=((MOD(itau,iguide_sav).EQ.0).AND.guide_sav) 564 564 IF (f_out) THEN 565 565 … … 588 588 CALL guide_out("SP",jjp1,llm,p(ijb_u:ije_u,1:llm),1.) 589 589 ENDIF 590 590 591 591 if (guide_u) then 592 592 if (guide_add) then … … 600 600 f_addu(ijbu:ijeu,l)=(1.-tau)*ugui1(ijbu:ijeu,l)+tau*ugui2(ijbu:ijeu,l)-ucov(ijbu:ijeu,l) 601 601 ENDDO 602 endif 603 602 endif 603 604 604 ! CALL WriteField_u('f_addu',f_addu) 605 605 … … 632 632 f_addu(ijbu:ijeu,l)=(1.-tau)*tgui1(ijbu:ijeu,l)+tau*tgui2(ijbu:ijeu,l)-teta(ijbu:ijeu,l) 633 633 ENDDO 634 endif 634 endif 635 635 if (guide_zon) CALL guide_zonave_u(2,llm,f_addu) 636 636 CALL guide_addfield_u(llm,f_addu,alpha_T) … … 653 653 !$OMP END MASTER 654 654 !$OMP BARRIER 655 endif 655 endif 656 656 if (guide_zon) CALL guide_zonave_u(2,1,f_addu(ijb_u:ije_u,1)) 657 657 CALL guide_addfield_u(1,f_addu(ijb_u:ije_u,1),alpha_P) … … 677 677 f_addu(ijbu:ijeu,l)=(1.-tau)*qgui1(ijbu:ijeu,l)+tau*qgui2(ijbu:ijeu,l)-q(ijbu:ijeu,l) 678 678 ENDDO 679 endif 679 endif 680 680 if (guide_zon) CALL guide_zonave_u(2,llm,f_addu) 681 681 CALL guide_addfield_u(llm,f_addu,alpha_Q) … … 701 701 ENDDO 702 702 703 endif 704 703 endif 704 705 705 if (guide_zon) CALL guide_zonave_v(2,jjm,llm,f_addv(ijb_v:ije_v,:)) 706 706 707 707 CALL guide_addfield_v(llm,f_addv(ijb_v:ije_v,:),alpha_v) 708 708 IF (f_out) CALL guide_out("v",jjm,llm,vcov(ijb_v:ije_v,:),factt) … … 710 710 IF (f_out) THEN 711 711 ! Ehouarn: Fill in the gaps adequately 712 IF (ijbv>ijb_v) f_addv(ijb_v:ijbv-1,:)=0 712 IF (ijbv>ijb_v) f_addv(ijb_v:ijbv-1,:)=0 713 713 IF (ijev<ije_v) f_addv(ijev+1:ije_v,:)=0 714 714 CALL guide_out("vcov",jjm,llm,f_addv(ijb_v:ije_v,:)/factt,factt) … … 733 733 ! input variables 734 734 INTEGER, INTENT(IN) :: vsize 735 REAL, DIMENSION(ijb_u:ije_u), INTENT(IN) :: alpha 735 REAL, DIMENSION(ijb_u:ije_u), INTENT(IN) :: alpha 736 736 REAL, DIMENSION(ijb_u:ije_u,vsize), INTENT(INOUT) :: field 737 737 … … 756 756 ! input variables 757 757 INTEGER, INTENT(IN) :: vsize 758 REAL, DIMENSION(ijb_v:ije_v), INTENT(IN) :: alpha 758 REAL, DIMENSION(ijb_v:ije_v), INTENT(IN) :: alpha 759 759 REAL, DIMENSION(ijb_v:ije_v,vsize), INTENT(INOUT) :: field 760 760 … … 768 768 769 769 END SUBROUTINE guide_addfield_v 770 770 771 771 !======================================================================= 772 772 … … 774 774 775 775 USE comconst_mod, ONLY: pi 776 776 777 777 IMPLICIT NONE 778 778 … … 780 780 INCLUDE "paramet.h" 781 781 INCLUDE "comgeom.h" 782 782 783 783 ! input/output variables 784 784 INTEGER, INTENT(IN) :: typ … … 791 791 792 792 INTEGER, DIMENSION (2), SAVE :: imin, imax ! averaging domain 793 !$OMP THREADPRIVATE(imin,imax) 793 !$OMP THREADPRIVATE(imin,imax) 794 794 INTEGER :: i,j,l,ij 795 795 REAL, DIMENSION (iip1) :: lond ! longitude in Deg. … … 815 815 ENDIF 816 816 817 817 818 818 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 819 819 DO l=1,vsize … … 829 829 fieldm(j,l)=fieldm(j,l)+field(ij,l) 830 830 ENDDO 831 ENDDO 831 ENDDO 832 832 fieldm(:,l)=fieldm(:,l)/REAL(imax(typ)-imin(typ)+1) 833 833 ! Compute forcing … … 846 846 847 847 USE comconst_mod, ONLY: pi 848 848 849 849 IMPLICIT NONE 850 850 … … 852 852 INCLUDE "paramet.h" 853 853 INCLUDE "comgeom.h" 854 854 855 855 ! input/output variables 856 856 INTEGER, INTENT(IN) :: typ … … 896 896 fieldm(j,l)=fieldm(j,l)+field(ij,l) 897 897 ENDDO 898 ENDDO 898 ENDDO 899 899 fieldm(:,l)=fieldm(:,l)/REAL(imax(typ)-imin(typ)+1) 900 900 ! Compute forcing … … 909 909 910 910 END SUBROUTINE guide_zonave_v 911 911 912 912 !======================================================================= 913 913 SUBROUTINE guide_interp(psi,teta) … … 934 934 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: plunc,plsnc !niveaux pression modele 935 935 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: plvnc !niveaux pression modele 936 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: p ! pression intercouches 936 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: p ! pression intercouches 937 937 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: pls, pext ! var intermediaire 938 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: pbarx 939 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: pbary 938 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: pbarx 939 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: pbary 940 940 ! Variables pour fonction Exner (P milieu couche) 941 941 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: pk 942 REAL ,ALLOCATABLE, SAVE, DIMENSION (:,:) :: pks 942 REAL ,ALLOCATABLE, SAVE, DIMENSION (:,:) :: pks 943 943 REAL :: unskap 944 944 ! Pression de vapeur saturante 945 945 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:) :: qsat 946 946 !Variables intermediaires interpolation 947 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: zu1,zu2 947 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: zu1,zu2 948 948 REAL, ALLOCATABLE, SAVE,DIMENSION (:,:,:) :: zv1,zv2 949 949 950 950 INTEGER :: i,j,l,ij 951 951 CHARACTER(LEN=20),PARAMETER :: modname="guide_interp" 952 TYPE(Request),SAVE :: Req 952 TYPE(Request),SAVE :: Req 953 953 !$OMP THREADPRIVATE(Req) 954 954 955 955 if (is_master) write(*,*)trim(modname)//': interpolate nudging variables' 956 956 ! ----------------------------------------------------------------- … … 959 959 IF (first) THEN 960 960 !$OMP MASTER 961 ALLOCATE(plnc1(iip1,jjb_u:jje_u,nlevnc) ) 962 ALLOCATE(plnc2(iip1,jjb_u:jje_u,nlevnc) ) 963 ALLOCATE(plunc(iip1,jjb_u:jje_u,llm) ) 964 ALLOCATE(plsnc(iip1,jjb_u:jje_u,llm) ) 965 ALLOCATE(plvnc(iip1,jjb_v:jje_v,llm) ) 966 ALLOCATE(p(iip1,jjb_u:jje_u,llmp1) ) 967 ALLOCATE(pls(iip1,jjb_u:jje_u,llm) ) 968 ALLOCATE(pext(iip1,jjb_u:jje_u,llm) ) 969 ALLOCATE(pbarx(iip1,jjb_u:jje_u,llm) ) 970 ALLOCATE(pbary(iip1,jjb_v:jje_v,llm) ) 971 ALLOCATE(pk(iip1,jjb_u:jje_u,llm) ) 972 ALLOCATE(pks (iip1,jjb_u:jje_u) ) 973 ALLOCATE(qsat(ijb_u:ije_u,llm) ) 974 ALLOCATE(zu1(iip1,jjb_u:jje_u,llm) ) 975 ALLOCATE(zu2(iip1,jjb_u:jje_u,llm) ) 976 ALLOCATE(zv1(iip1,jjb_v:jje_v,llm) ) 961 ALLOCATE(plnc1(iip1,jjb_u:jje_u,nlevnc) ) 962 ALLOCATE(plnc2(iip1,jjb_u:jje_u,nlevnc) ) 963 ALLOCATE(plunc(iip1,jjb_u:jje_u,llm) ) 964 ALLOCATE(plsnc(iip1,jjb_u:jje_u,llm) ) 965 ALLOCATE(plvnc(iip1,jjb_v:jje_v,llm) ) 966 ALLOCATE(p(iip1,jjb_u:jje_u,llmp1) ) 967 ALLOCATE(pls(iip1,jjb_u:jje_u,llm) ) 968 ALLOCATE(pext(iip1,jjb_u:jje_u,llm) ) 969 ALLOCATE(pbarx(iip1,jjb_u:jje_u,llm) ) 970 ALLOCATE(pbary(iip1,jjb_v:jje_v,llm) ) 971 ALLOCATE(pk(iip1,jjb_u:jje_u,llm) ) 972 ALLOCATE(pks (iip1,jjb_u:jje_u) ) 973 ALLOCATE(qsat(ijb_u:ije_u,llm) ) 974 ALLOCATE(zu1(iip1,jjb_u:jje_u,llm) ) 975 ALLOCATE(zu2(iip1,jjb_u:jje_u,llm) ) 976 ALLOCATE(zv1(iip1,jjb_v:jje_v,llm) ) 977 977 ALLOCATE(zv2(iip1,jjb_v:jje_v,llm) ) 978 978 !$OMP END MASTER 979 979 !$OMP BARRIER 980 ENDIF 981 982 983 984 980 ENDIF 981 982 983 984 985 985 IF (guide_plevs.EQ.0) THEN 986 986 !$OMP DO … … 993 993 ENDDO 994 994 ENDDO 995 ENDIF 995 ENDIF 996 996 997 997 if (first) then … … 1006 1006 write(*,*)trim(modname)//' nudging file :' 1007 1007 SELECT CASE (guide_plevs) 1008 CASE (0) 1008 CASE (0) 1009 1009 do l=1,nlevnc 1010 1010 write(*,*)trim(modname)//' PL(',l,')=',plnc2(1,jjbu,l) … … 1045 1045 1046 1046 ! ----------------------------------------------------------------- 1047 ! Calcul niveaux pression modele 1047 ! Calcul niveaux pression modele 1048 1048 ! ----------------------------------------------------------------- 1049 1049 … … 1175 1175 enddo 1176 1176 ENDIF 1177 tgui1(j*iip1,l)=tgui1((j-1)*iip1+1,l) 1178 tgui2(j*iip1,l)=tgui2((j-1)*iip1+1,l) 1177 tgui1(j*iip1,l)=tgui1((j-1)*iip1+1,l) 1178 tgui2(j*iip1,l)=tgui2((j-1)*iip1+1,l) 1179 1179 enddo 1180 1180 if (pole_nord) then … … 1186 1186 if (pole_sud) then 1187 1187 do i=1,iip1 1188 tgui1(ip1jm+i,l)=tgui1(ip1jm+1,l) 1189 tgui2(ip1jm+i,l)=tgui2(ip1jm+1,l) 1188 tgui1(ip1jm+i,l)=tgui1(ip1jm+1,l) 1189 tgui2(ip1jm+i,l)=tgui2(ip1jm+1,l) 1190 1190 enddo 1191 1191 endif … … 1237 1237 qgui2(ij,l)=zu2(i,j,l) 1238 1238 enddo 1239 qgui1(j*iip1,l)=qgui1((j-1)*iip1+1,l) 1240 qgui2(j*iip1,l)=qgui2((j-1)*iip1+1,l) 1239 qgui1(j*iip1,l)=qgui1((j-1)*iip1+1,l) 1240 qgui2(j*iip1,l)=qgui2((j-1)*iip1+1,l) 1241 1241 enddo 1242 1242 if (pole_nord) then … … 1248 1248 if (pole_sud) then 1249 1249 do i=1,iip1 1250 qgui1(ip1jm+i,l)=qgui1(ip1jm+1,l) 1251 qgui2(ip1jm+i,l)=qgui2(ip1jm+1,l) 1250 qgui1(ip1jm+i,l)=qgui1(ip1jm+1,l) 1251 qgui2(ip1jm+i,l)=qgui2(ip1jm+1,l) 1252 1252 enddo 1253 1253 endif … … 1259 1259 plsnc(:,jjbu:jjeu,l),qsat(ijbu:ijeu,l)) 1260 1260 qgui1(ijbu:ijeu,l)=qgui1(ijbu:ijeu,l)*qsat(ijbu:ijeu,l)*0.01 !hum. rel. en % 1261 qgui2(ijbu:ijeu,l)=qgui2(ijbu:ijeu,l)*qsat(ijbu:ijeu,l)*0.01 1261 qgui2(ijbu:ijeu,l)=qgui2(ijbu:ijeu,l)*qsat(ijbu:ijeu,l)*0.01 1262 1262 enddo 1263 1263 … … 1296 1296 ENDDO 1297 1297 ENDIF 1298 1298 1299 1299 ! Interpolation verticale 1300 1300 !$OMP MASTER … … 1315 1315 ugui2(ij,l)=zu2(i,j,l)*cu(i,j) 1316 1316 enddo 1317 ugui1(j*iip1,l)=ugui1((j-1)*iip1+1,l) 1318 ugui2(j*iip1,l)=ugui2((j-1)*iip1+1,l) 1317 ugui1(j*iip1,l)=ugui1((j-1)*iip1+1,l) 1318 ugui2(j*iip1,l)=ugui2((j-1)*iip1+1,l) 1319 1319 enddo 1320 1320 if (pole_nord) then … … 1332 1332 enddo 1333 1333 ENDIF 1334 1334 1335 1335 IF (guide_v) THEN 1336 1336 ! Calcul des nouvelles valeurs des niveaux de pression du guidage … … 1390 1390 vgui2(ij,l)=zv2(i,j,l)*cv(i,j) 1391 1391 enddo 1392 vgui1(j*iip1,l)=vgui1((j-1)*iip1+1,l) 1393 vgui2(j*iip1,l)=vgui2((j-1)*iip1+1,l) 1392 vgui1(j*iip1,l)=vgui1((j-1)*iip1+1,l) 1393 vgui2(j*iip1,l)=vgui2((j-1)*iip1+1,l) 1394 1394 enddo 1395 1395 enddo 1396 1396 ENDIF 1397 1397 1398 1398 1399 1399 END SUBROUTINE guide_interp … … 1406 1406 use comconst_mod, only: pi 1407 1407 use serre_mod, only: clat, clon, grossismx, grossismy 1408 1408 1409 1409 implicit none 1410 1410 … … 1420 1420 REAL, INTENT(IN) :: taumin,taumax 1421 1421 ! output arguments: 1422 REAL, DIMENSION(pim,jjb:jje), INTENT(OUT) :: alpha 1423 1422 REAL, DIMENSION(pim,jjb:jje), INTENT(OUT) :: alpha 1423 1424 1424 ! local variables: 1425 1425 LOGICAL, SAVE :: first=.TRUE. … … 1506 1506 ENDIF 1507 1507 ! Premier appel: calcul des aires min et max et de gamma. 1508 IF (first) THEN 1508 IF (first) THEN 1509 1509 first=.FALSE. 1510 1510 ! coordonnees du centre du zoom 1511 CALL coordij(clon,clat,ilon,ilat) 1511 CALL coordij(clon,clat,ilon,ilat) 1512 1512 ! aire de la maille au centre du zoom 1513 1513 dxdy_min=dxdys(ilon,ilat) … … 1532 1532 endif 1533 1533 gamma=log(0.5)/log(gamma) 1534 if (gamma4) then 1534 if (gamma4) then 1535 1535 gamma=min(gamma,4.) 1536 1536 endif … … 1573 1573 !======================================================================= 1574 1574 SUBROUTINE guide_read(timestep) 1575 1575 USE netcdf, ONLY: nf90_put_var 1576 1576 IMPLICIT NONE 1577 1577 … … 1621 1621 write(*,*),trim(modname)//' ncidpl,varidap',ncidpl,varidap 1622 1622 endif 1623 1623 1624 1624 ! Pression si guidage sur niveaux P variables 1625 1625 if (guide_plevs.EQ.2) then … … 1630 1630 ENDIF 1631 1631 rcode = nf90_inq_varid(ncidp, 'PRES', varidp) 1632 IF (rcode.NE.NF_NOERR) THEN 1632 IF (rcode.NE.NF_NOERR) THEN 1633 1633 abort_message='Nudging: error -> no PRES variable in file P.nc' 1634 1634 CALL abort_gcm(modname,abort_message,1) … … 1646 1646 ENDIF 1647 1647 rcode = nf90_inq_varid(ncidu, 'UWND', varidu) 1648 IF (rcode.NE.NF_NOERR) THEN 1648 IF (rcode.NE.NF_NOERR) THEN 1649 1649 abort_message='Nudging: error -> no UWND variable in file u.nc' 1650 1650 CALL abort_gcm(modname,abort_message,1) … … 1653 1653 if (ncidpl.eq.-99) ncidpl=ncidu 1654 1654 1655 1655 1656 1656 status=NF90_INQ_DIMID(ncidu, "LONU", dimid) 1657 1657 status=NF90_INQUIRE_DIMENSION(ncidu,dimid,namedim,lendim) … … 1667 1667 CALL abort_gcm(modname,abort_message,1) 1668 1668 ENDIF 1669 1669 1670 1670 endif 1671 1671 … … 1678 1678 ENDIF 1679 1679 rcode = nf90_inq_varid(ncidv, 'VWND', varidv) 1680 IF (rcode.NE.NF_NOERR) THEN 1680 IF (rcode.NE.NF_NOERR) THEN 1681 1681 abort_message='Nudging: error -> no VWND variable in file v.nc' 1682 1682 CALL abort_gcm(modname,abort_message,1) … … 1684 1684 write(*,*),trim(modname)//' ncidv,varidv',ncidv,varidv 1685 1685 if (ncidpl.eq.-99) ncidpl=ncidv 1686 1686 1687 1687 status=NF90_INQ_DIMID(ncidv, "LONV", dimid) 1688 1688 status=NF90_INQUIRE_DIMENSION(ncidv,dimid,namedim,lendim) 1689 1689 1690 1690 IF (lendim .NE. iip1) THEN 1691 1691 abort_message='dimension LONV different from iip1 in v.nc' … … 1700 1700 CALL abort_gcm(modname,abort_message,1) 1701 1701 ENDIF 1702 1702 1703 1703 endif 1704 1704 … … 1711 1711 ENDIF 1712 1712 rcode = nf90_inq_varid(ncidt, 'AIR', varidt) 1713 IF (rcode.NE.NF_NOERR) THEN 1713 IF (rcode.NE.NF_NOERR) THEN 1714 1714 abort_message='Nudging: error -> no AIR variable in file T.nc' 1715 1715 CALL abort_gcm(modname,abort_message,1) … … 1742 1742 ENDIF 1743 1743 rcode = nf90_inq_varid(ncidQ, 'RH', varidQ) 1744 IF (rcode.NE.NF_NOERR) THEN 1744 IF (rcode.NE.NF_NOERR) THEN 1745 1745 abort_message='Nudging: error -> no RH variable in file hur.nc' 1746 1746 CALL abort_gcm(modname,abort_message,1) … … 1774 1774 ENDIF 1775 1775 rcode = nf90_inq_varid(ncidps, 'SP', varidps) 1776 IF (rcode.NE.NF_NOERR) THEN 1776 IF (rcode.NE.NF_NOERR) THEN 1777 1777 abort_message='Nudging: error -> no SP variable in file ps.nc' 1778 1778 CALL abort_gcm(modname,abort_message,1) … … 1788 1788 ! Coefs ap, bp pour calcul de la pression aux differents niveaux 1789 1789 IF (guide_plevs.EQ.1) THEN 1790 #ifdef NC_DOUBLE 1791 status=NF_GET_VARA_DOUBLE(ncidpl,varidap,1,nlevnc,apnc) 1792 status=NF_GET_VARA_DOUBLE(ncidpl,varidbp,1,nlevnc,bpnc) 1793 #else 1794 status=NF_GET_VARA_REAL(ncidpl,varidap,1,nlevnc,apnc) 1795 status=NF_GET_VARA_REAL(ncidpl,varidbp,1,nlevnc,bpnc) 1796 #endif 1790 status = nf90_put_var(ncidpl, varidap, apnc, [1], [nlevnc]) 1791 status = nf90_put_var(ncidpl, varidbp, bpnc, [1], [nlevnc]) 1797 1792 ELSEIF (guide_plevs.EQ.0) THEN 1798 #ifdef NC_DOUBLE 1799 status=NF_GET_VARA_DOUBLE(ncidpl,varidpl,1,nlevnc,apnc) 1800 #else 1801 status=NF_GET_VARA_REAL(ncidpl,varidpl,1,nlevnc,apnc) 1802 #endif 1793 status = nf90_put_var(ncidpl, varidpl, apnc, [1], [nlevnc]) 1803 1794 !FC Pour les corrections la pression est deja en Pascals on commente la ligne ci-dessous 1804 1795 IF(convert_Pa) apnc=apnc*100.! conversion en Pascals … … 1824 1815 1825 1816 IF (invert_y) start(2)=jjp1-jje_u+1 1826 ! Pression 1817 ! Pression 1827 1818 if (guide_plevs.EQ.2) then 1828 #ifdef NC_DOUBLE 1829 status=NF_GET_VARA_DOUBLE(ncidp,varidp,start,count,pnat2) 1830 #else 1831 status=NF_GET_VARA_REAL(ncidp,varidp,start,count,pnat2) 1832 #endif 1819 status = nf90_put_var(ncidp, varidp, pnat2, start, count) 1833 1820 IF (invert_y) THEN 1834 1821 ! PRINT*,"Invertion impossible actuellement" … … 1840 1827 ! Vent zonal 1841 1828 if (guide_u) then 1842 #ifdef NC_DOUBLE 1843 status=NF_GET_VARA_DOUBLE(ncidu,varidu,start,count,unat2) 1844 #else 1845 status=NF_GET_VARA_REAL(ncidu,varidu,start,count,unat2) 1846 #endif 1829 status = nf90_put_var(ncidu, varidu, unat2, start, count) 1847 1830 IF (invert_y) THEN 1848 1831 ! PRINT*,"Invertion impossible actuellement" … … 1856 1839 ! Temperature 1857 1840 if (guide_T) then 1858 #ifdef NC_DOUBLE 1859 status=NF_GET_VARA_DOUBLE(ncidt,varidt,start,count,tnat2) 1860 #else 1861 status=NF_GET_VARA_REAL(ncidt,varidt,start,count,tnat2) 1862 #endif 1841 status = nf90_put_var(ncidt, varidt, tnat2, start, count) 1863 1842 IF (invert_y) THEN 1864 1843 ! PRINT*,"Invertion impossible actuellement" … … 1870 1849 ! Humidite 1871 1850 if (guide_Q) then 1872 #ifdef NC_DOUBLE 1873 status=NF_GET_VARA_DOUBLE(ncidQ,varidQ,start,count,qnat2) 1874 #else 1875 status=NF_GET_VARA_REAL(ncidQ,varidQ,start,count,qnat2) 1876 #endif 1851 status = nf90_put_var(ncidQ, varidQ, qnat2, start, count) 1877 1852 IF (invert_y) THEN 1878 1853 ! PRINT*,"Invertion impossible actuellement" … … 1888 1863 count(2)=jjnb_v 1889 1864 IF (invert_y) start(2)=jjm-jje_v+1 1890 1891 #ifdef NC_DOUBLE 1892 status=NF_GET_VARA_DOUBLE(ncidv,varidv,start,count,vnat2) 1893 #else 1894 status=NF_GET_VARA_REAL(ncidv,varidv,start,count,vnat2) 1895 #endif 1865 status = nf90_put_var(ncidv, varidv, vnat2, start, count) 1896 1866 IF (invert_y) THEN 1897 1867 ! PRINT*,"Invertion impossible actuellement" … … 1910 1880 count(4)=0 1911 1881 IF (invert_y) start(2)=jjp1-jje_u+1 1912 #ifdef NC_DOUBLE 1913 status=NF_GET_VARA_DOUBLE(ncidps,varidps,start,count,psnat2) 1914 #else 1915 status=NF_GET_VARA_REAL(ncidps,varidps,start,count,psnat2) 1916 #endif 1882 status = nf90_put_var(ncidps, varidps, psnat2, start, count) 1917 1883 IF (invert_y) THEN 1918 1884 ! PRINT*,"Invertion impossible actuellement" … … 1926 1892 !======================================================================= 1927 1893 SUBROUTINE guide_read2D(timestep) 1928 1894 USE netcdf, ONLY: nf90_put_var 1929 1895 IMPLICIT NONE 1930 1896 … … 2075 2041 ! Coefs ap, bp pour calcul de la pression aux differents niveaux 2076 2042 if (guide_plevs.EQ.1) then 2077 #ifdef NC_DOUBLE 2078 status=NF_GET_VARA_DOUBLE(ncidpl,varidap,1,nlevnc,apnc) 2079 status=NF_GET_VARA_DOUBLE(ncidpl,varidbp,1,nlevnc,bpnc) 2080 #else 2081 status=NF_GET_VARA_REAL(ncidpl,varidap,1,nlevnc,apnc) 2082 status=NF_GET_VARA_REAL(ncidpl,varidbp,1,nlevnc,bpnc) 2083 #endif 2043 status = nf90_put_var(ncidpl, varidap, apnc, [1], [nlevnc]) 2044 status = nf90_put_var(ncidpl, varidbp, bpnc, [1], [nlevnc]) 2084 2045 elseif (guide_plevs.EQ.0) THEN 2085 #ifdef NC_DOUBLE 2086 status=NF_GET_VARA_DOUBLE(ncidpl,varidpl,1,nlevnc,apnc) 2087 #else 2088 status=NF_GET_VARA_REAL(ncidpl,varidpl,1,nlevnc,apnc) 2089 #endif 2046 status = nf90_put_var(ncidpl, varidpl, apnc, [1], [nlevnc]) 2090 2047 apnc=apnc*100.! conversion en Pascals 2091 2048 bpnc(:)=0. … … 2112 2069 ! Pression 2113 2070 if (guide_plevs.EQ.2) then 2114 #ifdef NC_DOUBLE 2115 status=NF_GET_VARA_DOUBLE(ncidp,varidp,start,count,zu) 2116 #else 2117 status=NF_GET_VARA_REAL(ncidp,varidp,start,count,zu) 2118 #endif 2071 status = nf90_put_var(ncidp, varidp, zu, start, count) 2119 2072 DO i=1,iip1 2120 2073 pnat2(i,:,:)=zu(:,:) … … 2129 2082 ! Vent zonal 2130 2083 if (guide_u) then 2131 #ifdef NC_DOUBLE 2132 status=NF_GET_VARA_DOUBLE(ncidu,varidu,start,count,zu) 2133 #else 2134 status=NF_GET_VARA_REAL(ncidu,varidu,start,count,zu) 2135 #endif 2084 status = nf90_put_var(ncidu, varidu, zu, start, count) 2136 2085 DO i=1,iip1 2137 2086 unat2(i,:,:)=zu(:,:) … … 2148 2097 ! Temperature 2149 2098 if (guide_T) then 2150 #ifdef NC_DOUBLE 2151 status=NF_GET_VARA_DOUBLE(ncidt,varidt,start,count,zu) 2152 #else 2153 status=NF_GET_VARA_REAL(ncidt,varidt,start,count,zu) 2154 #endif 2099 status = nf90_put_var(ncidt, varidt, zu, start, count) 2155 2100 DO i=1,iip1 2156 2101 tnat2(i,:,:)=zu(:,:) … … 2166 2111 ! Humidite 2167 2112 if (guide_Q) then 2168 #ifdef NC_DOUBLE 2169 status=NF_GET_VARA_DOUBLE(ncidQ,varidQ,start,count,zu) 2170 #else 2171 status=NF_GET_VARA_REAL(ncidQ,varidQ,start,count,zu) 2172 #endif 2113 status = nf90_put_var(ncidQ, varidQ, zu, start, count) 2173 2114 DO i=1,iip1 2174 2115 qnat2(i,:,:)=zu(:,:) 2175 2116 ENDDO 2176 2117 2177 2118 IF (invert_y) THEN 2178 2119 ! PRINT*,"Invertion impossible actuellement" … … 2187 2128 count(2)=jjnb_v 2188 2129 IF (invert_y) start(2)=jjm-jje_v+1 2189 #ifdef NC_DOUBLE 2190 status=NF_GET_VARA_DOUBLE(ncidv,varidv,start,count,zv) 2191 #else 2192 status=NF_GET_VARA_REAL(ncidv,varidv,start,count,zv) 2193 #endif 2130 status = nf90_put_var(ncidv, varidv, zv, start, count) 2194 2131 DO i=1,iip1 2195 2132 vnat2(i,:,:)=zv(:,:) … … 2197 2134 2198 2135 IF (invert_y) THEN 2199 2136 2200 2137 ! PRINT*,"Invertion impossible actuellement" 2201 2138 ! CALL abort_gcm(modname,abort_message,1) … … 2213 2150 count(4)=0 2214 2151 IF (invert_y) start(2)=jjp1-jje_u+1 2215 #ifdef NC_DOUBLE 2216 status=NF_GET_VARA_DOUBLE(ncidps,varidps,start,count,zu(:,1)) 2217 #else 2218 status=NF_GET_VARA_REAL(ncidps,varidps,start,count,zu(:,1)) 2219 #endif 2152 status = nf90_put_var(ncidps, varidps, zu(:, 1), start, count) 2220 2153 DO i=1,iip1 2221 2154 psnat2(i,:)=zu(:,1) … … 2230 2163 2231 2164 END SUBROUTINE guide_read2D 2232 2165 2233 2166 !======================================================================= 2234 2167 SUBROUTINE guide_out(varname,hsize,vsize,field_loc,factt) … … 2238 2171 USE comvert_mod, ONLY: presnivs 2239 2172 use netcdf95, only: nf95_def_var, nf95_put_var 2240 use netcdf, only: nf90_float 2173 use netcdf, only: nf90_float, nf90_put_var 2241 2174 2242 2175 IMPLICIT NONE … … 2246 2179 INCLUDE "netcdf.inc" 2247 2180 INCLUDE "comgeom2.h" 2248 2181 2249 2182 ! Variables entree 2250 2183 CHARACTER*(*), INTENT(IN) :: varname … … 2266 2199 REAL, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: field_glo 2267 2200 CHARACTER(LEN=20),PARAMETER :: modname="guide_out" 2268 2201 2269 2202 !$OMP MASTER 2270 2203 ALLOCATE(field_glo(iip1,hsize,vsize)) … … 2294 2227 RETURN 2295 2228 ENDIF 2296 2229 2297 2230 !$OMP MASTER 2298 IF (timestep.EQ.0) THEN 2231 IF (timestep.EQ.0) THEN 2299 2232 ! ---------------------------------------------- 2300 2233 ! initialisation fichier de sortie … … 2303 2236 ierr=NF_CREATE("guide_ins.nc",IOR(NF_CLOBBER,NF_64BIT_OFFSET),nid) 2304 2237 ! Definition des dimensions 2305 ierr=NF_DEF_DIM(nid,"LONU",iip1,id_lonu) 2306 ierr=NF_DEF_DIM(nid,"LONV",iip1,id_lonv) 2307 ierr=NF_DEF_DIM(nid,"LATU",jjp1,id_latu) 2308 ierr=NF_DEF_DIM(nid,"LATV",jjm,id_latv) 2238 ierr=NF_DEF_DIM(nid,"LONU",iip1,id_lonu) 2239 ierr=NF_DEF_DIM(nid,"LONV",iip1,id_lonv) 2240 ierr=NF_DEF_DIM(nid,"LATU",jjp1,id_latu) 2241 ierr=NF_DEF_DIM(nid,"LATV",jjm,id_latv) 2309 2242 ierr=NF_DEF_DIM(nid,"LEVEL",llm,id_lev) 2310 2243 ierr=NF_DEF_DIM(nid,"TIME",NF_UNLIMITED,id_tim) … … 2324 2257 call nf95_def_var(nid, "alpha_q", nf90_float, (/id_lonv, id_latu/), & 2325 2258 varid_alpha_q) 2326 2259 2327 2260 ierr=NF_ENDDEF(nid) 2328 2261 2329 2262 ! Enregistrement des variables dimensions 2330 #ifdef NC_DOUBLE 2331 ierr = NF_PUT_VAR_DOUBLE(nid,vid_lonu,rlonu*180./pi) 2332 ierr = NF_PUT_VAR_DOUBLE(nid,vid_lonv,rlonv*180./pi) 2333 ierr = NF_PUT_VAR_DOUBLE(nid,vid_latu,rlatu*180./pi) 2334 ierr = NF_PUT_VAR_DOUBLE(nid,vid_latv,rlatv*180./pi) 2335 ierr = NF_PUT_VAR_DOUBLE(nid,vid_lev,presnivs) 2336 ierr = NF_PUT_VAR_DOUBLE(nid,vid_cu,cu) 2337 ierr = NF_PUT_VAR_DOUBLE(nid,vid_cv,cv) 2338 ierr = NF_PUT_VAR_DOUBLE(nid,vid_au,zu) 2339 ierr = NF_PUT_VAR_DOUBLE(nid,vid_av,zv) 2340 #else 2341 ierr = NF_PUT_VAR_REAL(nid,vid_lonu,rlonu*180./pi) 2342 ierr = NF_PUT_VAR_REAL(nid,vid_lonv,rlonv*180./pi) 2343 ierr = NF_PUT_VAR_REAL(nid,vid_latu,rlatu*180./pi) 2344 ierr = NF_PUT_VAR_REAL(nid,vid_latv,rlatv*180./pi) 2345 ierr = NF_PUT_VAR_REAL(nid,vid_lev,presnivs) 2346 ierr = NF_PUT_VAR_REAL(nid,vid_cu,cu) 2347 ierr = NF_PUT_VAR_REAL(nid,vid_cv,cv) 2348 ierr = NF_PUT_VAR_REAL(nid,vid_au,alpha_u) 2349 ierr = NF_PUT_VAR_REAL(nid,vid_av,alpha_v) 2350 #endif 2263 ierr = nf90_put_var(nid, vid_lonu, rlonu * 180. / pi) 2264 ierr = nf90_put_var(nid, vid_lonv, rlonv * 180. / pi) 2265 ierr = nf90_put_var(nid, vid_latu, rlatu * 180. / pi) 2266 ierr = nf90_put_var(nid, vid_latv, rlatv * 180. / pi) 2267 ierr = nf90_put_var(nid, vid_lev, presnivs) 2268 ierr = nf90_put_var(nid, vid_cu, cu) 2269 ierr = nf90_put_var(nid, vid_cv, cv) 2270 ierr = nf90_put_var(nid, vid_au, zu) 2271 ierr = nf90_put_var(nid, vid_av, zv) 2351 2272 call nf95_put_var(nid, varid_alpha_t, zt) 2352 2273 call nf95_put_var(nid, varid_alpha_q, zq) … … 2387 2308 ierr = NF_DEF_VAR(nid,"q",NF_FLOAT,4,dim4,varid) 2388 2309 ENDIF 2389 2310 2390 2311 ierr = NF_ENDDEF(nid) 2391 2312 ierr = NF_CLOSE(nid) … … 2395 2316 ! Enregistrement du champ 2396 2317 ! -------------------------------------------------------------------- 2397 2318 2398 2319 ierr=NF_OPEN("guide_ins.nc",NF_WRITE,nid) 2399 2320 … … 2420 2341 CASE("u","ua") 2421 2342 !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) 2422 DO l=1,llm 2343 DO l=1,llm 2423 2344 field_glo(:,2:jjm,l)=field_glo(:,2:jjm,l)/cu(:,2:jjm) 2424 2345 field_glo(:,1,l)=0. ; field_glo(:,jjp1,l)=0. … … 2438 2359 !$OMP MASTER 2439 2360 2440 #ifdef NC_DOUBLE 2441 ierr = NF_PUT_VARA_DOUBLE(nid,varid,start,count,field_glo) 2442 #else 2443 ierr = NF_PUT_VARA_REAL(nid,varid,start,count,field_glo) 2444 #endif 2445 2361 ierr = nf90_put_var(nid, varid, field_glo, start, count) 2446 2362 ierr = NF_CLOSE(nid) 2447 2363 … … 2451 2367 2452 2368 END SUBROUTINE guide_out 2453 2454 2369 2370 2455 2371 !=========================================================================== 2456 2372 subroutine correctbid(iim,nl,x)
Note: See TracChangeset
for help on using the changeset viewer.