Changeset 5281 for LMDZ6/trunk/libf/dyn3d/guide_mod.f90
- Timestamp:
- Oct 28, 2024, 11:17:48 AM (3 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d/guide_mod.f90
r5272 r5281 8 8 ! F. Codron 01/09 9 9 !======================================================================= 10 11 USE getparam, only: ini_getparam, fin_getparam, getpar 10 USE getparam, only: ini_getparam, fin_getparam, getpar 12 11 USE Write_Field 13 12 use netcdf, only: nf90_nowrite, nf90_open, nf90_inq_varid, nf90_close, & … … 92 91 93 92 ! --------------------------------------------- 94 ! Lecture des parametres: 93 ! Lecture des parametres: 95 94 ! --------------------------------------------- 96 95 call ini_getparam("nudging_parameters_out.txt") … … 172 171 173 172 call fin_getparam 174 173 175 174 ! --------------------------------------------- 176 175 ! Determination du nombre de niveaux verticaux … … 230 229 231 230 232 endif 231 endif 233 232 error=nf90_inq_dimid(ncidpl,'LEVEL',rid) 234 233 IF (error.NE.NF90_NOERR) error=nf90_inq_dimid(ncidpl,'PRESSURE',rid) … … 237 236 ENDIF 238 237 error=nf90_inquire_dimension(ncidpl,rid,len=nlevnc) 239 write(*,*)trim(modname)//' : number of vertical levels nlevnc', nlevnc 238 write(*,*)trim(modname)//' : number of vertical levels nlevnc', nlevnc 240 239 rcod = nf90_close(ncidpl) 241 240 … … 264 263 IF (error /= 0) CALL abort_gcm(modname,abort_message,1) 265 264 alpha_u=0.;alpha_v=0;alpha_T=0;alpha_Q=0;alpha_P=0 266 265 267 266 IF (guide_u) THEN 268 267 ALLOCATE(unat1(iip1,jjp1,nlevnc), stat = error) … … 288 287 tnat1=0.;tnat2=0.;tgui1=0.;tgui2=0. 289 288 ENDIF 290 289 291 290 IF (guide_Q) THEN 292 291 ALLOCATE(qnat1(iip1,jjp1,nlevnc), stat = error) … … 361 360 USE comconst_mod, ONLY: cpp, dtvr, daysec,kappa 362 361 USE comvert_mod, ONLY: ap, bp, preff, presnivs, pressure_exner 363 362 364 363 USE dimensions_mod, ONLY: iim, jjm, llm, ndm 365 364 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & … … 391 390 REAL :: tau,reste ! position entre 2 etats de guidage 392 391 REAL, SAVE :: factt ! pas de temps en fraction de jour 393 392 394 393 INTEGER :: l 395 394 CHARACTER(LEN=20) :: modname="guide_main" … … 402 401 IF (first) THEN 403 402 first=.FALSE. 404 CALL guide_init 403 CALL guide_init 405 404 itau_test=1001 406 405 step_rea=1 407 406 count_no_rea=0 408 407 ! Calcul des constantes de rappel 409 factt=dtvr*iperiod/daysec 408 factt=dtvr*iperiod/daysec 410 409 call tau2alpha(3,iip1,jjm ,factt,tau_min_v,tau_max_v,alpha_v) 411 410 call tau2alpha(2,iip1,jjp1,factt,tau_min_u,tau_max_u,alpha_u) … … 421 420 enddo 422 421 endif 423 ! ini_anal: etat initial egal au guidage 422 ! ini_anal: etat initial egal au guidage 424 423 IF (ini_anal) THEN 425 424 CALL guide_interp(ps,teta) … … 464 463 itau 465 464 abort_message='stopped' 466 CALL abort_gcm(modname,abort_message,1) 465 CALL abort_gcm(modname,abort_message,1) 467 466 ELSE 468 467 IF (guide_v) vnat1=vnat2 … … 503 502 504 503 !----------------------------------------------------------------------- 505 ! Ajout des champs de guidage 504 ! Ajout des champs de guidage 506 505 !----------------------------------------------------------------------- 507 506 ! Sauvegarde du guidage? 508 f_out=((MOD(itau,iguide_sav).EQ.0).AND.guide_sav) 507 f_out=((MOD(itau,iguide_sav).EQ.0).AND.guide_sav) 509 508 IF (f_out) THEN 510 509 ! compute pressures at layer interfaces … … 522 521 CALL guide_out("SP",jjp1,llm,p(:,1:llm)) 523 522 ENDIF 524 523 525 524 if (guide_u) then 526 525 if (guide_add) then … … 528 527 else 529 528 f_add=(1.-tau)*ugui1+tau*ugui2-ucov 530 endif 529 endif 531 530 if (guide_zon) CALL guide_zonave(1,jjp1,llm,f_add) 532 531 CALL guide_addfield(ip1jmp1,llm,f_add,alpha_u) … … 542 541 else 543 542 f_add=(1.-tau)*tgui1+tau*tgui2-teta 544 endif 543 endif 545 544 if (guide_zon) CALL guide_zonave(2,jjp1,llm,f_add) 546 545 CALL guide_addfield(ip1jmp1,llm,f_add,alpha_T) … … 554 553 else 555 554 f_add(1:ip1jmp1,1)=(1.-tau)*psgui1+tau*psgui2-ps 556 endif 555 endif 557 556 if (guide_zon) CALL guide_zonave(2,jjp1,1,f_add(1:ip1jmp1,1)) 558 557 CALL guide_addfield(ip1jmp1,1,f_add(1:ip1jmp1,1),alpha_P) … … 568 567 else 569 568 f_add=(1.-tau)*qgui1+tau*qgui2-q 570 endif 569 endif 571 570 if (guide_zon) CALL guide_zonave(2,jjp1,llm,f_add) 572 571 CALL guide_addfield(ip1jmp1,llm,f_add,alpha_Q) … … 580 579 else 581 580 f_add(1:ip1jm,:)=(1.-tau)*vgui1+tau*vgui2-vcov 582 endif 581 endif 583 582 if (guide_zon) CALL guide_zonave(2,jjm,llm,f_add(1:ip1jm,:)) 584 583 CALL guide_addfield(ip1jm,llm,f_add(1:ip1jm,:),alpha_v) … … 599 598 INTEGER, INTENT(IN) :: hsize 600 599 INTEGER, INTENT(IN) :: vsize 601 REAL, DIMENSION(hsize), INTENT(IN) :: alpha 600 REAL, DIMENSION(hsize), INTENT(IN) :: alpha 602 601 REAL, DIMENSION(hsize,vsize), INTENT(INOUT) :: field 603 602 … … 615 614 616 615 USE comconst_mod, ONLY: pi 617 616 618 617 USE dimensions_mod, ONLY: iim, jjm, llm, ndm 619 618 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & 620 619 ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm 620 USE comgeom_mod_h 621 621 IMPLICIT NONE 622 622 623 623 624 624 625 INCLUDE "comgeom.h" 626 625 627 626 ! input/output variables 628 627 INTEGER, INTENT(IN) :: typ … … 665 664 fieldm(j,l)=fieldm(j,l)+field(ij,l) 666 665 ENDDO 667 ENDDO 666 ENDDO 668 667 fieldm(:,l)=fieldm(:,l)/REAL(imax(typ)-imin(typ)+1) 669 668 ! Compute forcing … … 680 679 !======================================================================= 681 680 SUBROUTINE guide_interp(psi,teta) 682 681 683 682 use exner_hyb_m, only: exner_hyb 684 683 use exner_milieu_m, only: exner_milieu … … 686 685 use comvert_mod, only: preff, pressure_exner, bp, ap 687 686 USE dimensions_mod, ONLY: iim, jjm, llm, ndm 688 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, &687 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & 689 688 ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm 689 USE comgeom2_mod_h 690 690 IMPLICIT NONE 691 692 693 694 include "comgeom2.h"695 696 691 REAL, DIMENSION (iip1,jjp1), INTENT(IN) :: psi ! Psol gcm 697 692 REAL, DIMENSION (iip1,jjp1,llm), INTENT(IN) :: teta ! Temp. Pot. gcm … … 702 697 REAL, DIMENSION (iip1,jjp1,llm) :: plunc,plsnc !niveaux pression modele 703 698 REAL, DIMENSION (iip1,jjm,llm) :: plvnc !niveaux pression modele 704 REAL, DIMENSION (iip1,jjp1,llmp1) :: p ! pression intercouches 699 REAL, DIMENSION (iip1,jjp1,llmp1) :: p ! pression intercouches 705 700 REAL, DIMENSION (iip1,jjp1,llm) :: pls, pext ! var intermediaire 706 REAL, DIMENSION (iip1,jjp1,llm) :: pbarx 707 REAL, DIMENSION (iip1,jjm,llm) :: pbary 701 REAL, DIMENSION (iip1,jjp1,llm) :: pbarx 702 REAL, DIMENSION (iip1,jjm,llm) :: pbary 708 703 ! Variables pour fonction Exner (P milieu couche) 709 704 REAL, DIMENSION (iip1,jjp1,llm) :: pk 710 REAL, DIMENSION (iip1,jjp1) :: pks 705 REAL, DIMENSION (iip1,jjp1) :: pks 711 706 REAL :: prefkap,unskap 712 707 ! Pression de vapeur saturante 713 708 REAL, DIMENSION (ip1jmp1,llm) :: qsat 714 709 !Variables intermediaires interpolation 715 REAL, DIMENSION (iip1,jjp1,llm) :: zu1,zu2 710 REAL, DIMENSION (iip1,jjp1,llm) :: zu1,zu2 716 711 REAL, DIMENSION (iip1,jjm,llm) :: zv1,zv2 717 712 718 713 INTEGER :: i,j,l,ij 719 714 CHARACTER(LEN=20),PARAMETER :: modname="guide_interp" 720 715 721 716 write(*,*)trim(modname)//': interpolate nudging variables' 722 717 ! ----------------------------------------------------------------- … … 767 762 endif 768 763 endif 769 764 770 765 ! ----------------------------------------------------------------- 771 ! Calcul niveaux pression modele 766 ! Calcul niveaux pression modele 772 767 ! ----------------------------------------------------------------- 773 768 CALL pression( ip1jmp1, ap, bp, psi, p ) … … 839 834 ugui2(ij,l)=zu2(i,j,l)*cu(i,j) 840 835 enddo 841 ugui1(j*iip1,l)=ugui1((j-1)*iip1+1,l) 842 ugui2(j*iip1,l)=ugui2((j-1)*iip1+1,l) 836 ugui1(j*iip1,l)=ugui1((j-1)*iip1+1,l) 837 ugui2(j*iip1,l)=ugui2((j-1)*iip1+1,l) 843 838 enddo 844 839 do i=1,iip1 … … 850 845 enddo 851 846 ENDIF 852 847 853 848 IF (guide_T) THEN 854 849 CALL pres2lev(tnat1,zu1,nlevnc,llm,plnc1,plsnc,iip1,jjp1,invert_p) … … 869 864 enddo 870 865 ENDIF 871 tgui1(j*iip1,l)=tgui1((j-1)*iip1+1,l) 872 tgui2(j*iip1,l)=tgui2((j-1)*iip1+1,l) 866 tgui1(j*iip1,l)=tgui1((j-1)*iip1+1,l) 867 tgui2(j*iip1,l)=tgui2((j-1)*iip1+1,l) 873 868 enddo 874 869 do i=1,iip1 875 870 tgui1(i,l)=tgui1(1,l) 876 tgui1(ip1jm+i,l)=tgui1(ip1jm+1,l) 871 tgui1(ip1jm+i,l)=tgui1(ip1jm+1,l) 877 872 tgui2(i,l)=tgui2(1,l) 878 tgui2(ip1jm+i,l)=tgui2(ip1jm+1,l) 873 tgui2(ip1jm+i,l)=tgui2(ip1jm+1,l) 879 874 enddo 880 875 enddo … … 893 888 vgui2(ij,l)=zv2(i,j,l)*cv(i,j) 894 889 enddo 895 vgui1(j*iip1,l)=vgui1((j-1)*iip1+1,l) 896 vgui2(j*iip1,l)=vgui2((j-1)*iip1+1,l) 890 vgui1(j*iip1,l)=vgui1((j-1)*iip1+1,l) 891 vgui2(j*iip1,l)=vgui2((j-1)*iip1+1,l) 897 892 enddo 898 893 enddo 899 894 ENDIF 900 895 901 896 IF (guide_Q) THEN 902 897 ! On suppose qu'on a la bonne variable dans le fichier de guidage: … … 911 906 qgui2(ij,l)=zu2(i,j,l) 912 907 enddo 913 qgui1(j*iip1,l)=qgui1((j-1)*iip1+1,l) 914 qgui2(j*iip1,l)=qgui2((j-1)*iip1+1,l) 908 qgui1(j*iip1,l)=qgui1((j-1)*iip1+1,l) 909 qgui2(j*iip1,l)=qgui2((j-1)*iip1+1,l) 915 910 enddo 916 911 do i=1,iip1 917 912 qgui1(i,l)=qgui1(1,l) 918 qgui1(ip1jm+i,l)=qgui1(ip1jm+1,l) 913 qgui1(ip1jm+i,l)=qgui1(ip1jm+1,l) 919 914 qgui2(i,l)=qgui2(1,l) 920 qgui2(ip1jm+i,l)=qgui2(ip1jm+1,l) 915 qgui2(ip1jm+i,l)=qgui2(ip1jm+1,l) 921 916 enddo 922 917 enddo … … 924 919 CALL q_sat(iip1*jjp1*llm,teta*pk/cpp,plsnc,qsat) 925 920 qgui1=qgui1*qsat*0.01 !hum. rel. en % 926 qgui2=qgui2*qsat*0.01 921 qgui2=qgui2*qsat*0.01 927 922 ENDIF 928 923 ENDIF … … 937 932 use comconst_mod, only: pi 938 933 use serre_mod, only: clon, clat, grossismx, grossismy 939 934 940 935 USE dimensions_mod, ONLY: iim, jjm, llm, ndm 941 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, &936 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & 942 937 ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm 943 implicit none 944 945 946 947 include "comgeom2.h" 948 938 USE comgeom2_mod_h 939 implicit none 949 940 ! input arguments : 950 941 INTEGER, INTENT(IN) :: typ ! u(2),v(3), ou scalaire(1) … … 953 944 REAL, INTENT(IN) :: taumin,taumax 954 945 ! output arguments: 955 REAL, DIMENSION(pim,pjm), INTENT(OUT) :: alpha 956 946 REAL, DIMENSION(pim,pjm), INTENT(OUT) :: alpha 947 957 948 ! local variables: 958 949 LOGICAL, SAVE :: first=.TRUE. … … 1040 1031 ENDIF 1041 1032 ! Premier appel: calcul des aires min et max et de gamma. 1042 IF (first) THEN 1033 IF (first) THEN 1043 1034 first=.FALSE. 1044 1035 ! coordonnees du centre du zoom 1045 CALL coordij(clon,clat,ilon,ilat) 1036 CALL coordij(clon,clat,ilon,ilat) 1046 1037 ! aire de la maille au centre du zoom 1047 1038 dxdy_min=dxdys(ilon,ilat) … … 1067 1058 endif 1068 1059 gamma=log(0.5)/log(gamma) 1069 if (gamma4) then 1060 if (gamma4) then 1070 1061 gamma=min(gamma,4.) 1071 1062 endif … … 1168 1159 ENDIF 1169 1160 rcode = nf90_inq_varid(ncidp, 'PRES', varidp) 1170 IF (rcode.NE.NF90_NOERR) THEN 1161 IF (rcode.NE.NF90_NOERR) THEN 1171 1162 abort_message='Nudging: error -> no PRES variable in file P.nc' 1172 1163 CALL abort_gcm(modname,abort_message,1) … … 1221 1212 write(*,*) trim(modname)//' ncidv,varidv',ncidv,varidv 1222 1213 if (ncidpl.eq.-99) ncidpl=ncidv 1223 1214 1224 1215 status=NF90_INQ_DIMID(ncidv, "LONV", dimid) 1225 1216 status=NF90_INQUIRE_DIMENSION(ncidv,dimid,namedim,lendim) 1226 1217 1227 1218 IF (lendim .NE. iip1) THEN 1228 1219 abort_message='dimension LONV different from iip1 in v.nc' … … 1237 1228 CALL abort_gcm(modname,abort_message,1) 1238 1229 ENDIF 1239 1230 1240 1231 endif 1241 1232 … … 1350 1341 count(4)=1 1351 1342 1352 ! Pression 1343 ! Pression 1353 1344 if (guide_plevs.EQ.2) then 1354 1345 status=NF90_GET_VAR(ncidp,varidp,pnat2,start,count) … … 1382 1373 CALL invert_lat(iip1,jjp1,nlevnc,qnat2) 1383 1374 ENDIF 1384 1375 1385 1376 endif 1386 1377 … … 1672 1663 1673 1664 END SUBROUTINE guide_read2D 1674 1665 1675 1666 !======================================================================= 1676 1667 SUBROUTINE guide_out(varname,hsize,vsize,field) … … 1680 1671 use netcdf95, only: nf95_def_var, nf95_put_var 1681 1672 use netcdf, only: nf90_float, nf90_def_var, nf90_put_var 1682 1673 1683 1674 USE dimensions_mod, ONLY: iim, jjm, llm, ndm 1684 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, &1675 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & 1685 1676 ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm 1677 USE comgeom2_mod_h 1686 1678 IMPLICIT NONE 1687 1679 1688 1680 1689 1681 1690 INCLUDE "comgeom2.h"1691 1682 1692 1683 ! Variables entree
Note: See TracChangeset
for help on using the changeset viewer.