Changeset 1647
- Timestamp:
- Jan 11, 2017, 3:33:51 PM (8 years ago)
- Location:
- trunk/LMDZ.TITAN/libf
- Files:
-
- 21 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/ini_archive.F
r1478 r1647 36 36 37 37 USE comsoil_h 38 USE slab_ice_h, only: noceanmx39 38 ! use control_mod 40 39 USE comvert_mod, ONLY: ap,bp,aps,bps,presnivs,pseudoalt … … 81 80 INTEGER idim_tim 82 81 INTEGER idim_nsoilmx ! "subsurface_layers" dimension ID # 83 INTEGER idim_noceanmx ! "ocean_layers" dimension ID #84 82 INTEGER nid,nvarid 85 83 real sig_s(llm),s(llm) … … 164 162 ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm) 165 163 ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx) 166 ierr = NF_DEF_DIM (nid,"ocean_layers",noceanmx,idim_noceanmx)167 164 168 165 ierr = NF_DEF_DIM (nid,"index", length, idim_index) -
trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/iniphysiq_mod.F90
r1573 r1647 11 11 12 12 use control_mod, only: nday 13 use surf_heat_transp_mod, only: ini_surf_heat_transp14 13 use infotrac, only : nqtot ! number of advected tracers 15 14 use planete_mod, only: ini_planete_mod … … 53 52 integer,intent(in) :: iflag_phys ! type of physics to be called 54 53 55 logical :: ok_slab_ocean56 57 54 ! the common part for all planetary physics 58 55 !------------------------------------------ … … 79 76 call ini_planete_mod(nlayer,preff,ap,bp) 80 77 81 ! for slab ocean, copy over some arrays82 ok_slab_ocean=.false. ! default value83 call getin_p("ok_slab_ocean",ok_slab_ocean)84 if (ok_slab_ocean) then85 call ini_surf_heat_transp(ip1jm,ip1jmp1,unsairez,fext,unsaire, &86 cu,cuvsurcv,cv,cvusurcu,aire,apoln,apols, &87 aireu,airev)88 endif89 90 78 call inifis(klon_omp,nlayer,nqtot,pdayref,punjours,nday,ptimestep, & 91 79 latitude,longitude,cell_area,prad,pg,pr,pcpp) -
trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/lect_start_archive.F
r1478 r1647 2 2 & date,tsurf,tsoil,emis,q2, 3 3 & t,ucov,vcov,ps,h,phisold_newgrid, 4 & q,qsurf,surfith,nid, 5 & rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 4 & q,qsurf,surfith,nid) 6 5 7 6 ! USE surfdat_h 8 7 USE comsoil_h, ONLY: nsoilmx, layer, mlayer, volcapa, inertiedat 9 USE tracer_h, ONLY: igcm_co2_ice10 8 USE infotrac, ONLY: tname, nqtot 11 USE slab_ice_h, ONLY: noceanmx12 9 ! USE control_mod 13 10 ! to use 'getin' 14 USE callkeys_mod, ONLY: ok_slab_ocean15 11 USE comvert_mod, ONLY: ap,bp,aps,bps,preff 16 12 USE comconst_mod, ONLY: kappa,g,pi … … 101 97 REAL tsurf(ngrid) ! surface temperature 102 98 REAL tsoil(ngrid,nsoilmx) ! soil temperature 103 REAL co2ice(ngrid) ! CO2 ice layer104 99 REAL emis(ngrid) 105 100 REAL q2(ngrid,llm+1),qsurf(ngrid,nqtot) 106 REAL tslab(ngrid,noceanmx)107 REAL rnat(ngrid),pctsrf_sic(ngrid)108 REAL tsea_ice(ngrid),sea_ice(ngrid)109 101 c REAL phisfi(ngrid) 110 102 … … 126 118 real tsurfS(iip1,jjp1),tsoilS(iip1,jjp1,nsoilmx) 127 119 real inertiedatS(iip1,jjp1,nsoilmx) 128 real co2iceS(iip1,jjp1)129 120 real emisS(iip1,jjp1) 130 121 REAL q2S(iip1,jjp1,llm+1),qsurfS(iip1,jjp1,nqtot) 131 real tslabS(iip1,jjp1,noceanmx) 132 real pctsrf_sicS(iip1,jjp1),tsea_iceS(iip1,jjp1) 133 real rnatS(iip1,jjp1), sea_iceS(iip1,jjp1) 134 135 real ptotal, co2icetotal 122 123 real ptotal 136 124 137 125 c Var intermediaires : vent naturel, mais pas coord scalaire … … 156 144 real, dimension(:,:,:), allocatable :: inertiedatoldnew 157 145 real, dimension(:,:), allocatable :: psold,phisold 158 real, dimension(:,:), allocatable :: co2iceold159 146 real, dimension(:,:), allocatable :: tsurfold 160 147 real, dimension(:,:), allocatable :: emisold 161 148 real, dimension(:,:,:,:), allocatable :: qold 162 real, dimension(:,:,:), allocatable :: tslabold163 real, dimension(:,:), allocatable :: rnatold,pctsrf_sicold164 real, dimension(:,:), allocatable :: tsea_iceold,sea_iceold165 166 149 167 150 real tab_cntrl(100) 168 151 169 real ptotalold , co2icetotalold152 real ptotalold 170 153 171 154 logical :: olddepthdef=.false. ! flag … … 300 283 allocate(phisold(imold+1,jmold+1)) 301 284 allocate(qold(imold+1,jmold+1,lmold,nqtot)) 302 allocate(co2iceold(imold+1,jmold+1))303 285 allocate(tsurfold(imold+1,jmold+1)) 304 286 allocate(emisold(imold+1,jmold+1)) … … 313 295 allocate(mlayerold(nsoilold)) 314 296 allocate(qsurfold(imold+1,jmold+1,nqtot)) 315 allocate(tslabold(imold+1,jmold+1,noceanmx))316 allocate(rnatold(imold+1,jmold+1))317 allocate(pctsrf_sicold(imold+1,jmold+1))318 allocate(tsea_iceold(imold+1,jmold+1))319 allocate(sea_iceold(imold+1,jmold+1))320 297 321 298 allocate(var (imold+1,jmold+1,llm)) … … 332 309 C----------------------------------------------------------------------- 333 310 c 3.1. Lecture du tableau des parametres du run 334 c (pour la lecture ulterieure de "ptotalold" et "co2icetotalold")311 c (pour la lecture ulterieure de "ptotalold") 335 312 c----------------------------------------------------------------------- 336 313 c … … 556 533 557 534 C----------------------------------------------------------------------- 558 c lecture de "ptotalold" et "co2icetotalold"535 c lecture de "ptotalold" 559 536 c----------------------------------------------------------------------- 560 537 ptotalold = tab_cntrl(tab0+49) 561 co2icetotalold = tab_cntrl(tab0+50)562 538 563 539 c----------------------------------------------------------------------- … … 636 612 637 613 c----------------------------------------------------------------------- 638 c 5.1 Lecture des champs 2D ( co2ice,emis,ps,tsurf,Tg[10], qsurf)614 c 5.1 Lecture des champs 2D (emis,ps,tsurf,Tg[10], qsurf) 639 615 c----------------------------------------------------------------------- 640 616 … … 642 618 count=(/imold+1,jmold+1,1,0/) 643 619 644 ! CO2ice is now in qsurf(igcm_co2_ice) ... 645 ! ierr = NF_INQ_VARID (nid, "co2ice", nvarid) 646 ! IF (ierr .NE. NF_NOERR) THEN 647 ! PRINT*, "lect_start_archive: Le champ <co2ice> est absent" 648 ! CALL abort 649 ! ENDIF 650 !#ifdef NC_DOUBLE 651 ! ierr = NF_GET_VARA_DOUBLE(nid, nvarid,start,count,co2iceold) 652 !#else 653 ! ierr = NF_GET_VARA_REAL(nid, nvarid,start,count,co2iceold) 654 !#endif 655 ! IF (ierr .NE. NF_NOERR) THEN 656 ! PRINT*, "lect_start_archive: Lecture echouee pour <co2ice>" 657 ! PRINT*, NF_STRERROR(ierr) 658 ! CALL abort 659 ! ENDIF 660 c 620 661 621 ierr = NF_INQ_VARID (nid, "emis", nvarid) 662 622 IF (ierr .NE. NF_NOERR) THEN … … 718 678 CALL abort 719 679 ENDIF 720 c 721 cc Slab ocean 722 if(ok_slab_ocean) then 723 start=(/1,1,1,memo/) 724 count=(/imold+1,jmold+1,noceanmx,1/) 725 726 ierr=NF_INQ_VARID(nid,"tslab",nvarid) 727 IF (ierr.ne.NF_NOERR) then 728 PRINT*,"lect_start_archive: Cannot find <tslab>" 729 ENDIF 730 #ifdef NC_DOUBLE 731 ierr=NF_GET_VARA_DOUBLE(nid,nvarid,start,count,tslabold) 732 #else 733 ierr=NF_GET_VARA_REAL(nid,nvarid,start,count,tslabold) 734 #endif 735 IF (ierr .NE. NF_NOERR) THEN 736 PRINT*, "lect_start_archive: Lecture echouee pour <tslab>" 737 ENDIF 738 739 740 c 741 start=(/1,1,memo,0/) 742 count=(/imold+1,jmold+1,1,0/) 743 744 ierr = NF_INQ_VARID (nid, "rnat", nvarid) 745 IF (ierr .NE. NF_NOERR) THEN 746 PRINT*, "lect_start_archive: Le champ <rnat> est absent" 747 ENDIF 748 #ifdef NC_DOUBLE 749 ierr = NF_GET_VARA_DOUBLE(nid, nvarid,start,count,rnatold) 750 #else 751 ierr = NF_GET_VARA_REAL(nid, nvarid,start,count,rnatold) 752 #endif 753 IF (ierr .NE. NF_NOERR) THEN 754 PRINT*, "lect_start_archive: Lecture echouee pour <rnat>" 755 ENDIF 756 c 757 ierr = NF_INQ_VARID (nid, "pctsrf_sic", nvarid) 758 IF (ierr .NE. NF_NOERR) THEN 759 PRINT*, "lect_start_archive: Le champ <pctsrf_sic> est absent" 760 ENDIF 761 #ifdef NC_DOUBLE 762 ierr = NF_GET_VARA_DOUBLE(nid, nvarid,start,count,pctsrf_sicold) 763 #else 764 ierr = NF_GET_VARA_REAL(nid, nvarid,start,count,pctsrf_sicold) 765 #endif 766 IF (ierr .NE. NF_NOERR) THEN 767 PRINT*, "lect_start_archive: Lecture echouee pour <pctsrf_sic>" 768 ENDIF 769 c 770 ierr = NF_INQ_VARID (nid, "tsea_ice", nvarid) 771 IF (ierr .NE. NF_NOERR) THEN 772 PRINT*, "lect_start_archive: Le champ <tsea_ice> est absent" 773 ENDIF 774 #ifdef NC_DOUBLE 775 ierr = NF_GET_VARA_DOUBLE(nid, nvarid,start,count,tsea_iceold) 776 #else 777 ierr = NF_GET_VARA_REAL(nid, nvarid,start,count,tsea_iceold) 778 #endif 779 IF (ierr .NE. NF_NOERR) THEN 780 PRINT*, "lect_start_archive: Lecture echouee pour <tsea_ice>" 781 ENDIF 782 c 783 ierr = NF_INQ_VARID (nid, "sea_ice", nvarid) 784 IF (ierr .NE. NF_NOERR) THEN 785 PRINT*, "lect_start_archive: Le champ <sea_ice> est absent" 786 ENDIF 787 #ifdef NC_DOUBLE 788 ierr = NF_GET_VARA_DOUBLE(nid, nvarid,start,count,sea_iceold) 789 #else 790 ierr = NF_GET_VARA_REAL(nid, nvarid,start,count,sea_iceold) 791 #endif 792 IF (ierr .NE. NF_NOERR) THEN 793 PRINT*, "lect_start_archive: Lecture echouee pour <sea_ice>" 794 ENDIF 795 796 ENDIF! ok_slab_ocean 680 797 681 c 798 682 write(*,*)"lect_start_archive: rlonuold:" … … 813 697 814 698 DO iq=1,nqtot 815 txt=trim(tname(iq))//"_surf"816 if (txt.eq."h2o_vap") then817 ! There is no surface tracer for h2o_vap;818 ! "h2o_ice" should be loaded instead819 txt="h2o_ice_surf"820 write(*,*) 'lect_start_archive: loading surface tracer',821 & ' h2o_ice instead of h2o_vap'822 endif823 824 699 825 700 write(*,*) "lect_start_archive: loading tracer ",trim(txt) … … 1045 920 & rlonuold,rlatvold,rlonu,rlatv) 1046 921 1047 ! CO2 ice is now in qsurf(igcm_co2_ice)1048 ! call interp_horiz (co2iceold,co2ices,imold,jmold,iim,jjm,1,1049 ! & rlonuold,rlatvold,rlonu,rlatv)1050 1051 922 c Temperature de surface 1052 923 call interp_horiz (tsurfold,tsurfs,imold,jmold,iim,jjm,1, … … 1088 959 END DO 1089 960 END DO 1090 co2icetotal = 0. 1091 if (igcm_co2_ice.ne.0) then 1092 ! recast surface CO2 ice on new grid 1093 call interp_horiz(qsurfold(1,1,igcm_co2_ice), 1094 & qsurfs(1,1,igcm_co2_ice), 1095 & imold,jmold,iim,jjm,1, 1096 & rlonuold,rlatvold,rlonu,rlatv) 1097 DO j=1,jjp1 1098 DO i=1,iim 1099 !co2icetotal = co2icetotal + co2iceS(i,j)*aire(i,j) 1100 co2icetotal=co2icetotal+qsurfS(i,j,igcm_co2_ice)*aire(i,j) 1101 END DO 1102 END DO 1103 else 1104 write(*,*) "Warning: No co2_ice surface tracer" 1105 endif 961 1106 962 1107 963 write(*,*) … … 1110 966 write (*,*) 'Ratio new atm./ old atm =', ptotal/ptotalold 1111 967 write(*,*) 1112 write(*,*)'Ancienne grille: masse de la glace CO2:',co2icetotalold1113 write(*,*)'Nouvelle grille: masse de la glace CO2:',co2icetotal1114 if (co2icetotalold.ne.0.) then1115 write(*,*)'Ratio new ice./old ice =',co2icetotal/co2icetotalold1116 endif1117 write(*,*)1118 1119 968 1120 969 DO j=1,jjp1 … … 1124 973 END DO 1125 974 1126 if ( co2icetotalold.gt.0.) then1127 ! DO j=1,jjp11128 ! DO i=1,iip11129 ! co2iceS(i,j)=co2iceS(i,j) * co2icetotalold/co2icetotal1130 ! END DO1131 ! END DO1132 write(*,*) "Not enforcing conservation of surface CO2 ice"1133 write(*,*) " (should be OK when CO2 ice is a tracer)"1134 end if1135 975 1136 976 c----------------------------------------------------------------------- … … 1290 1130 1291 1131 c----------------------------------------------------------------------- 1292 c 6.3 Slab Ocean : 1293 c----------------------------------------------------------------------- 1294 call interp_horiz (tslabold,tslabs,imold,jmold,iim,jjm,noceanmx, 1295 & rlonuold,rlatvold,rlonu,rlatv) 1296 call gr_dyn_fi (noceanmx,iim+1,jjm+1,ngrid,tslabs,tslab) 1297 1298 call interp_horiz (rnatold,rnats,imold,jmold,iim,jjm,1, 1299 & rlonuold,rlatvold,rlonu,rlatv) 1300 call gr_dyn_fi (1,iim+1,jjm+1,ngrid,rnats,rnat) 1301 1302 call interp_horiz (pctsrf_sicold,pctsrf_sics,imold,jmold,iim, 1303 & jjm,1,rlonuold,rlatvold,rlonu,rlatv) 1304 call gr_dyn_fi (1,iim+1,jjm+1,ngrid,pctsrf_sics,pctsrf_sic) 1305 1306 call interp_horiz (tsea_iceold,tsea_ices,imold,jmold,iim,jjm,1, 1307 & rlonuold,rlatvold,rlonu,rlatv) 1308 call gr_dyn_fi (1,iim+1,jjm+1,ngrid,tsea_ices,tsea_ice) 1309 1310 call interp_horiz (sea_iceold,sea_ices,imold,jmold,iim,jjm,1, 1311 & rlonuold,rlatvold,rlonu,rlatv) 1312 call gr_dyn_fi (1,iim+1,jjm+1,ngrid,sea_ices,sea_ice) 1313 1314 c----------------------------------------------------------------------- 1315 c 6.4 Variable 3d : 1132 c 6.3 Variable 3d : 1316 1133 c----------------------------------------------------------------------- 1317 1134 … … 1434 1251 end do 1435 1252 enddo 1436 1437 ! call gr_dyn_fi (1,iim+1,jjm+1,ngrid,co2ices,co2ice)1438 ! no need to transfer "co2ice" any more; it is in qsurf(igcm_co2_ice)1439 1253 1440 1254 endif !! if nqtot .ne. 0 … … 1470 1284 deallocate(phisold) 1471 1285 deallocate(qold) 1472 deallocate(co2iceold)1473 1286 deallocate(tsurfold) 1474 1287 deallocate(emisold) … … 1482 1295 deallocate(qsurfold) 1483 1296 deallocate(var,varp1) 1484 deallocate(tslabold)1485 deallocate(rnatold)1486 deallocate(pctsrf_sicold)1487 deallocate(tsea_iceold)1488 deallocate(sea_iceold)1489 1297 1490 1298 ! write(*,*)'lect_start_archive: END' -
trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/newstart.F
r1644 r1647 19 19 & is_master 20 20 use infotrac, only: infotrac_init, nqtot, tname 21 USE tracer_h, ONLY: igcm_co2_ice, igcm_h2o_vap, igcm_h2o_ice22 21 USE comsoil_h, ONLY: nsoilmx, layer, mlayer, inertiedat 23 22 USE surfdat_h, ONLY: phisfi, albedodat, … … 28 27 use phyredem, only: physdem0, physdem1 29 28 use iostart, only: open_startphy 30 use slab_ice_h, only:noceanmx31 29 use filtreg_mod, only: inifilr 32 30 USE mod_const_mpi, ONLY: COMM_LMDZ … … 95 93 REAL tsurf(ngridmx) ! surface temperature 96 94 REAL,ALLOCATABLE :: tsoil(:,:) ! soil temperature 97 ! REAL co2ice(ngridmx) ! CO2 ice layer98 95 REAL emis(ngridmx) ! surface emissivity 99 96 real emisread ! added by RW … … 109 106 real mugaz ! molar mass of the atmosphere 110 107 111 integer ierr 112 113 REAL rnat(ngridmx) 114 REAL,ALLOCATABLE :: tslab(:,:) ! slab ocean temperature 115 REAL pctsrf_sic(ngridmx) ! sea ice cover 116 REAL tsea_ice(ngridmx) ! temperature sea_ice 117 REAL sea_ice(ngridmx) ! mass of sea ice (kg/m2) 108 integer ierr 118 109 119 110 c Variables on the new grid along scalar points … … 153 144 logical :: flagtset=.false. , flagps0=.false. 154 145 real val, val2, val3, val4 ! to store temporary variables 155 real :: iceith=2000 ! thermal inertia of subterranean ice156 146 157 147 INTEGER :: itau … … 165 155 ! added by BC for equilibrium temperature startup 166 156 real teque 167 168 ! added by BC for cloud fraction setup169 REAL hice(ngridmx),cloudfrac(ngridmx,llm)170 REAL totalfrac(ngridmx)171 172 157 173 158 ! added by RW for nuketharsis … … 209 194 allocate(tsoil(ngridmx,nsoilmx)) 210 195 allocate(ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx)) 211 allocate(tslab(ngridmx,nsoilmx))212 196 213 197 c======================================================================= … … 355 339 CALL phyetat0 (ngridmx,llm,fichnom,tab0,Lmodif,nsoilmx, 356 340 . nqtot,day_ini,time, 357 . tsurf,tsoil,emis,q2,qsurf, !) ! temporary modif by RDW 358 . cloudfrac,totalfrac,hice,rnat,pctsrf_sic,tslab,tsea_ice, 359 . sea_ice) 341 . tsurf,tsoil,emis,q2,qsurf) 360 342 361 343 ! copy albedo and soil thermal inertia on (local) physics grid … … 549 531 & date,tsurf,tsoil,emis,q2, 550 532 & t,ucov,vcov,ps,teta,phisold_newgrid,q,qsurf, 551 & surfith,nid, 552 & rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 533 & surfith,nid) 553 534 write(*,*) "OK, read start_archive file" 554 535 ! copy soil thermal inertia … … 784 765 else if (trim(modif).eq.'ptot') then 785 766 786 ! check if we have a co2_ice surface tracer:787 if (igcm_co2_ice.eq.0) then788 write(*,*) " No surface CO2 ice !"789 write(*,*) " only atmospheric pressure will be considered!"790 endif791 767 c calcul de la pression totale glace + atm actuelle 792 768 patm=0. … … 800 776 patm = patm + ps(i,j)*aire(i,j) 801 777 airetot= airetot + aire(i,j) 802 if (igcm_co2_ice.ne.0) then803 !pcap = pcap + aire(i,j)*co2ice(ig)*g804 pcap = pcap + aire(i,j)*qsurf(ig,igcm_co2_ice)*g805 endif806 778 ENDDO 807 779 ENDDO 808 780 ptoto = pcap + patm 809 781 810 print*,'Current total pressure at surface ( co2 ice +atm) ',782 print*,'Current total pressure at surface (atm) ', 811 783 & ptoto/airetot 812 784 … … 1048 1020 else if (trim(modif) .eq. 'wetstart') then 1049 1021 ! check that there is indeed a water vapor tracer 1050 if (igcm_h2o_vap.eq.0) then 1022 1051 1023 write(*,*) "No water vapour tracer! Can't use this option" 1052 1024 stop 1053 endif1054 DO l=1,llm1055 DO j=1,jjp11056 DO i=1,iip11057 q(i,j,l,igcm_h2o_vap)=150.e-6 * (rlatu(j)+pi/2.) / pi1058 ENDDO1059 ENDDO1060 ENDDO1061 1062 write(*,*) 'Water mass mixing ratio at north pole='1063 * ,q(1,1,1,igcm_h2o_vap)1064 write(*,*) '---------------------------south pole='1065 * ,q(1,jjp1,1,igcm_h2o_vap)1066 1025 1067 1026 c noglacier : remove tropical water ice (to initialize high res sim) 1068 1027 c -------------------------------------------------- 1069 1028 else if (trim(modif) .eq. 'noglacier') then 1070 if (igcm_h2o_ice.eq.0) then1029 1071 1030 write(*,*) "No water ice tracer! Can't use this option" 1072 1031 stop 1073 endif 1074 do ig=1,ngridmx 1075 j=(ig-2)/iim +2 1076 if(ig.eq.1) j=1 1077 write(*,*) 'OK: remove surface ice for |lat|<45' 1078 if (abs(rlatu(j)*180./pi).lt.45.) then 1079 qsurf(ig,igcm_h2o_ice)=0. 1080 end if 1081 end do 1032 1082 1033 1083 1034 … … 1085 1036 c -------------------------------------------------- 1086 1037 else if (trim(modif) .eq. 'watercapn') then 1087 if (igcm_h2o_ice.eq.0) then1038 1088 1039 write(*,*) "No water ice tracer! Can't use this option" 1089 1040 stop 1090 endif1091 1092 DO j=1,jjp11093 DO i=1,iim1094 ig=1+(j-2)*iim +i1095 if(j.eq.1) ig=11096 if(j.eq.jjp1) ig=ngridmx1097 1098 if (rlatu(j)*180./pi.gt.80.) then1099 qsurf(ig,igcm_h2o_ice)=3.4e31100 !do isoil=1,nsoilmx1101 ! ith(i,j,isoil) = 18000. ! thermal inertia1102 !enddo1103 write(*,*)' ==> Ice mesh North boundary (deg)= ',1104 & rlatv(j-1)*180./pi1105 end if1106 ENDDO1107 ENDDO1108 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)1109 1110 c$$$ do ig=1,ngridmx1111 c$$$ j=(ig-2)/iim +21112 c$$$ if(ig.eq.1) j=11113 c$$$ if (rlatu(j)*180./pi.gt.80.) then1114 c$$$1115 c$$$ qsurf(ig,igcm_h2o_ice)=1.e51116 c$$$ qsurf(ig,igcm_h2o_vap)=0.0!1.e51117 c$$$1118 c$$$ write(*,*) 'ig=',ig,' H2O ice mass (kg/m2)= ',1119 c$$$ & qsurf(ig,igcm_h2o_ice)1120 c$$$1121 c$$$ write(*,*)' ==> Ice mesh South boundary (deg)= ',1122 c$$$ & rlatv(j)*180./pi1123 c$$$ end if1124 c$$$ enddo1125 1041 1126 1042 c watercaps : H20 ice on permanent southern cap 1127 1043 c ------------------------------------------------- 1128 1044 else if (trim(modif) .eq. 'watercaps') then 1129 if (igcm_h2o_ice.eq.0) then 1045 1130 1046 write(*,*) "No water ice tracer! Can't use this option" 1131 1047 stop 1132 endif1133 1134 DO j=1,jjp11135 DO i=1,iim1136 ig=1+(j-2)*iim +i1137 if(j.eq.1) ig=11138 if(j.eq.jjp1) ig=ngridmx1139 1140 if (rlatu(j)*180./pi.lt.-80.) then1141 qsurf(ig,igcm_h2o_ice)=3.4e31142 !do isoil=1,nsoilmx1143 ! ith(i,j,isoil) = 18000. ! thermal inertia1144 !enddo1145 write(*,*)' ==> Ice mesh South boundary (deg)= ',1146 & rlatv(j-1)*180./pi1147 end if1148 ENDDO1149 ENDDO1150 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)1151 1152 c$$$ do ig=1,ngridmx1153 c$$$ j=(ig-2)/iim +21154 c$$$ if(ig.eq.1) j=11155 c$$$ if (rlatu(j)*180./pi.lt.-80.) then1156 c$$$ qsurf(ig,igcm_h2o_ice)=1.e51157 c$$$ qsurf(ig,igcm_h2o_vap)=0.0 !1.e51158 c$$$1159 c$$$ write(*,*) 'ig=',ig,' H2O ice mass (kg/m2)= ',1160 c$$$ & qsurf(ig,igcm_h2o_ice)1161 c$$$ write(*,*)' ==> Ice mesh North boundary (deg)= ',1162 c$$$ & rlatv(j-1)*180./pi1163 c$$$ end if1164 c$$$ enddo1165 1166 1048 1167 1049 c noacglac : H2O ice across highest terrain 1168 1050 c -------------------------------------------- 1169 1051 else if (trim(modif) .eq. 'noacglac') then 1170 if (igcm_h2o_ice.eq.0) then 1052 1171 1053 write(*,*) "No water ice tracer! Can't use this option" 1172 1054 stop 1173 endif1174 DO j=1,jjp11175 DO i=1,iim1176 ig=1+(j-2)*iim +i1177 if(j.eq.1) ig=11178 if(j.eq.jjp1) ig=ngridmx1179 1180 if(phis(i,j).gt.1000.*g)then1181 alb(i,j) = 0.5 ! snow value1182 do isoil=1,nsoilmx1183 ith(i,j,isoil) = 18000. ! thermal inertia1184 ! this leads to rnat set to 'ocean' in physiq.F901185 ! actually no, because it is soil not surface1186 enddo1187 endif1188 ENDDO1189 ENDDO1190 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)1191 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi)1192 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi)1193 1194 1195 1055 1196 1056 c oborealis : H2O oceans across Vastitas Borealis 1197 1057 c ----------------------------------------------- 1198 1058 else if (trim(modif) .eq. 'oborealis') then 1199 if (igcm_h2o_ice.eq.0) then 1059 1200 1060 write(*,*) "No water ice tracer! Can't use this option" 1201 1061 stop 1202 endif 1203 DO j=1,jjp1 1204 DO i=1,iim 1205 ig=1+(j-2)*iim +i 1206 if(j.eq.1) ig=1 1207 if(j.eq.jjp1) ig=ngridmx 1208 1209 if(phis(i,j).lt.-4000.*g)then 1210 ! if( (phis(i,j).lt.-4000.*g) 1211 ! & .and. (rlatu(j)*180./pi.lt.0.) )then ! south hemisphere only 1212 ! phis(i,j)=-8000.0*g ! proper ocean 1213 phis(i,j)=-4000.0*g ! scanty ocean 1214 1215 alb(i,j) = 0.07 ! oceanic value 1216 do isoil=1,nsoilmx 1217 ith(i,j,isoil) = 18000. ! thermal inertia 1218 ! this leads to rnat set to 'ocean' in physiq.F90 1219 ! actually no, because it is soil not surface 1220 enddo 1221 endif 1222 ENDDO 1223 ENDDO 1224 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) 1225 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) 1226 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi) 1227 1062 1228 1063 c iborealis : H2O ice in Northern plains 1229 1064 c -------------------------------------- 1230 1065 else if (trim(modif) .eq. 'iborealis') then 1231 if (igcm_h2o_ice.eq.0) then 1066 1232 1067 write(*,*) "No water ice tracer! Can't use this option" 1233 1068 stop 1234 endif1235 DO j=1,jjp11236 DO i=1,iim1237 ig=1+(j-2)*iim +i1238 if(j.eq.1) ig=11239 if(j.eq.jjp1) ig=ngridmx1240 1241 if(phis(i,j).lt.-4000.*g)then1242 !qsurf(ig,igcm_h2o_ice)=1.e31243 qsurf(ig,igcm_h2o_ice)=241.4 ! to make total 33 kg m^-21244 endif1245 ENDDO1246 ENDDO1247 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)1248 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi)1249 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi)1250 1251 1069 1252 1070 c oceanball : H2O liquid everywhere 1253 1071 c ---------------------------- 1254 1072 else if (trim(modif) .eq. 'oceanball') then 1255 if (igcm_h2o_ice.eq.0) then 1073 1256 1074 write(*,*) "No water ice tracer! Can't use this option" 1257 1075 stop 1258 endif1259 DO j=1,jjp11260 DO i=1,iim1261 ig=1+(j-2)*iim +i1262 if(j.eq.1) ig=11263 if(j.eq.jjp1) ig=ngridmx1264 1265 qsurf(ig,igcm_h2o_vap)=0.0 ! for ocean, this is infinite source1266 qsurf(ig,igcm_h2o_ice)=0.01267 alb(i,j) = 0.07 ! ocean value1268 1269 do isoil=1,nsoilmx1270 ith(i,j,isoil) = 18000. ! thermal inertia1271 !ith(i,j,isoil) = 50. ! extremely low for test1272 ! this leads to rnat set to 'ocean' in physiq.F901273 enddo1274 1275 ENDDO1276 ENDDO1277 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)1278 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi)1279 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,phis,phisfi)1280 1076 1281 1077 c iceball : H2O ice everywhere 1282 1078 c ---------------------------- 1283 1079 else if (trim(modif) .eq. 'iceball') then 1284 if (igcm_h2o_ice.eq.0) then 1080 1285 1081 write(*,*) "No water ice tracer! Can't use this option" 1286 1082 stop 1287 endif1288 DO j=1,jjp11289 DO i=1,iim1290 ig=1+(j-2)*iim +i1291 if(j.eq.1) ig=11292 if(j.eq.jjp1) ig=ngridmx1293 1294 qsurf(ig,igcm_h2o_vap)=-50. ! for ocean, this is infinite source1295 qsurf(ig,igcm_h2o_ice)=50. ! == to 0.05 m of oceanic ice1296 alb(i,j) = 0.6 ! ice albedo value1297 1298 do isoil=1,nsoilmx1299 !ith(i,j,isoil) = 18000. ! thermal inertia1300 ! this leads to rnat set to 'ocean' in physiq.F901301 enddo1302 1303 ENDDO1304 ENDDO1305 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi)1306 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi)1307 1083 1308 1084 c supercontinent : H2O ice everywhere 1309 1085 c ---------------------------- 1310 1086 else if (trim(modif) .eq. 'supercontinent') then 1311 write(*,*) 'Minimum longitude (-180,180)' 1312 read(*,*) val 1313 write(*,*) 'Maximum longitude (-180,180)' 1314 read(*,*) val2 1315 write(*,*) 'Minimum latitude (-90,90)' 1316 read(*,*) val3 1317 write(*,*) 'Maximum latitude (-90,90)' 1318 read(*,*) val4 1319 1320 do j=1,jjp1 1321 do i=1,iip1 1322 ig=1+(j-2)*iim +i 1323 if(j.eq.1) ig=1 1324 if(j.eq.jjp1) ig=ngridmx 1325 1326 c Supercontinent: 1327 if (((rlatu(j)*180./pi.le.val4).and. 1328 & (rlatu(j)*180./pi.ge.val3).and. 1329 & (rlonv(i)*180./pi.le.val2).and. 1330 & (rlonv(i)*180./pi.ge.val))) then 1331 1332 rnat(ig)=1. 1333 alb(i,j) = 0.3 1334 do isoil=1,nsoilmx 1335 ith(i,j,isoil) = 2000. 1336 enddo 1337 c Ocean: 1338 else 1339 rnat(ig)=0. 1340 alb(i,j) = 0.07 1341 do isoil=1,nsoilmx 1342 ith(i,j,isoil) = 18000. 1343 enddo 1344 end if 1345 1346 enddo 1347 enddo 1348 CALL gr_dyn_fi(nsoilmx,iip1,jjp1,ngridmx,ith,ithfi) 1349 CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,alb,albfi) 1087 1088 write(*,*) "No water ice tracer! Can't use this option" 1089 stop 1350 1090 1351 1091 c isotherm : Isothermal temperatures and no winds … … 1445 1185 c ------------------------------------------------ 1446 1186 else if (trim(modif) .eq. 'co2ice=0') then 1447 ! check that there is indeed a co2_ice tracer ...1448 if (igcm_co2_ice.ne.0) then1449 do ig=1,ngridmx1450 !co2ice(ig)=01451 qsurf(ig,igcm_co2_ice)=01452 emis(ig)=emis(ngridmx/2)1453 end do1454 else1455 1187 write(*,*) "Can't remove CO2 ice!! (no co2_ice tracer)" 1456 endif1188 1457 1189 1458 1190 ! therm_ini_s: (re)-set soil thermal inertia to reference surface values … … 1484 1216 c ------------------------------------------------ 1485 1217 else if (trim(modif) .eq. 'slab_ocean_0') then 1486 write(*,*)'OK: initialisation of slab ocean' 1487 1488 DO ig=1, ngridmx 1489 rnat(ig)=1. 1490 tslab(ig,1)=0. 1491 tslab(ig,2)=0. 1492 tsea_ice(ig)=0. 1493 sea_ice(ig)=0. 1494 pctsrf_sic(ig)=0. 1495 1496 if(ithfi(ig,1).GT.10000.)then 1497 rnat(ig)=0. 1498 phisfi(ig)=0. 1499 tsea_ice(ig)=273.15-1.8 1500 tslab(ig,1)=tsurf(ig) 1501 tslab(ig,2)=tsurf(ig)!*2./3.+(273.15-1.8)/3. 1502 endif 1503 1504 ENDDO 1505 CALL gr_fi_dyn(1,ngridmx,iip1,jjp1,phisfi,phis) 1506 1507 1218 1219 write(*,*) "No ocean yet on Titan ! Can't use this option" 1220 stop 1508 1221 1509 1222 else … … 1517 1230 999 continue 1518 1231 1519 1520 c=======================================================================1521 c Initialisation for cloud fraction and oceanic ice (added by BC 2010)1522 c=======================================================================1523 DO ig=1, ngridmx1524 totalfrac(ig)=0.51525 DO l=1,llm1526 cloudfrac(ig,l)=0.51527 ENDDO1528 ! Ehouarn, march 2012: also add some initialisation for hice1529 hice(ig)=0.01530 ENDDO1531 1232 1532 c========================================================1533 1534 ! DO ig=1,ngridmx1535 ! IF(tsurf(ig) .LT. 273.16-1.8) THEN1536 ! hice(ig)=(273.16-1.8-tsurf(ig))/(273.16-1.8-240)*1.1537 ! hice(ig)=min(hice(ig),1.0)1538 ! ENDIF1539 ! ENDDO1540 1541 1542 1543 1233 1544 1234 c======================================================================= … … 1647 1337 call physdem1("restartfi.nc",nsoilmx,ngridmx,llm,nqtot, 1648 1338 & dtphys,real(day_ini), 1649 & tsurf,tsoil,emis,q2,qsurf, 1650 & cloudfrac,totalfrac,hice, 1651 & rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 1339 & tsurf,tsoil,emis,q2,qsurf) 1652 1340 1653 1341 c======================================================================= -
trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/start2archive.F
r1644 r1647 25 25 ! use control_mod 26 26 ! use comgeomphy, only: initcomgeomphy 27 use slab_ice_h, only: noceanmx28 27 ! to use 'getin' 29 28 USE ioipsl_getincom … … 31 30 USE mod_const_mpi, ONLY: COMM_LMDZ 32 31 USE control_mod, only: planet_type 33 USE callkeys_mod, ONLY: ok_slab_ocean34 32 use filtreg_mod, only: inifilr 35 33 USE comvert_mod, ONLY: ap,bp … … 72 70 REAL tsurf(ngridmx) ! Surface temperature 73 71 REAL,ALLOCATABLE :: tsoil(:,:) ! Soil temperature 74 REAL co2ice(ngridmx) ! CO2 ice layer75 72 REAL q2(ngridmx,llm+1) 76 73 REAL,ALLOCATABLE :: qsurf(:,:) … … 82 79 INTEGER*4 day_ini_fi 83 80 84 ! added by FF for cloud fraction setup85 REAL hice(ngridmx)86 REAL cloudfrac(ngridmx,llm),totalcloudfrac(ngridmx)87 88 ! added by BC for slab ocean89 REAL rnat(ngridmx),pctsrf_sic(ngridmx),sea_ice(ngridmx)90 REAL tslab(ngridmx,noceanmx),tsea_ice(ngridmx)91 92 81 93 82 c Variable naturelle / grille scalaire … … 97 86 REAL,ALLOCATABLE :: tsoilS(:,:) 98 87 REAL,ALLOCATABLE :: ithS(:,:) ! Soil Thermal Inertia 99 REAL co2iceS(ip1jmp1)100 88 REAL q2S(ip1jmp1,llm+1) 101 89 REAL,ALLOCATABLE :: qsurfS(:,:) 102 90 REAL emisS(ip1jmp1) 103 104 ! added by FF for cloud fraction setup105 REAL hiceS(ip1jmp1)106 REAL cloudfracS(ip1jmp1,llm),totalcloudfracS(ip1jmp1)107 108 ! added by BC for slab ocean109 REAL rnatS(ip1jmp1),pctsrf_sicS(ip1jmp1),sea_iceS(ip1jmp1)110 REAL tslabS(ip1jmp1,noceanmx),tsea_iceS(ip1jmp1)111 91 112 92 … … 120 100 INTEGER Lmodif 121 101 122 REAL ptotal , co2icetotal102 REAL ptotal 123 103 REAL timedyn,timefi !fraction du jour dans start, startfi 124 104 REAL date … … 236 216 CALL phyetat0 (ngridmx,llm,fichnom,0,Lmodif,nsoilmx,nqtot, 237 217 . day_ini_fi,timefi, 238 . tsurf,tsoil,emis,q2,qsurf, 239 ! change FF 05/2011 240 . cloudfrac,totalcloudfrac,hice, 241 ! change BC 05/2014 242 . rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 243 218 . tsurf,tsoil,emis,q2,qsurf) 244 219 245 220 … … 328 303 c 329 304 c tsurf --> tsurfS 330 c co2ice --> co2iceS331 305 c tsoil --> tsoilS 332 306 c emis --> emisS … … 337 311 338 312 call gr_fi_dyn(1,ngridmx,iip1,jjp1,tsurf,tsurfS) 339 ! call gr_fi_dyn(1,ngridmx,iip1,jjp1,co2ice,co2iceS)340 313 call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,tsoil,tsoilS) 341 314 ! Note: thermal inertia "inertiedat" is in comsoil.h … … 344 317 call gr_fi_dyn(llm+1,ngridmx,iip1,jjp1,q2,q2S) 345 318 call gr_fi_dyn(nqtot,ngridmx,iip1,jjp1,qsurf,qsurfS) 346 call gr_fi_dyn(llm,ngridmx,iip1,jjp1,cloudfrac,cloudfracS)347 call gr_fi_dyn(1,ngridmx,iip1,jjp1,hice,hiceS)348 call gr_fi_dyn(1,ngridmx,iip1,jjp1,totalcloudfrac,totalcloudfracS)349 350 call gr_fi_dyn(1,ngridmx,iip1,jjp1,rnat,rnatS)351 call gr_fi_dyn(1,ngridmx,iip1,jjp1,pctsrf_sic,pctsrf_sicS)352 call gr_fi_dyn(1,ngridmx,iip1,jjp1,tsea_ice,tsea_iceS)353 call gr_fi_dyn(1,ngridmx,iip1,jjp1,sea_ice,sea_iceS)354 call gr_fi_dyn(noceanmx,ngridmx,iip1,jjp1,tslab,tslabS)355 319 356 320 c======================================================================= … … 359 323 360 324 ptotal = 0. 361 co2icetotal = 0.362 325 DO j=1,jjp1 363 326 DO i=1,iim 364 327 ptotal=ptotal+aire(i+(iim+1)*(j-1))*ps(i+(iim+1)*(j-1))/g 365 ! co2icetotal = co2icetotal +366 ! & co2iceS(i+(iim+1)*(j-1))*aire(i+(iim+1)*(j-1))367 328 ENDDO 368 329 ENDDO 369 330 write(*,*)'Ancienne grille : masse de l''atm :',ptotal 370 ! write(*,*)'Ancienne grille : masse de la glace CO2 :',co2icetotal 371 372 c----------------------------------------------------------------------- 373 c Passage de "ptotal" et "co2icetotal" par tab_cntrl_fi 331 332 c----------------------------------------------------------------------- 333 c Passage de "ptotal" par tab_cntrl_fi 374 334 c----------------------------------------------------------------------- 375 335 376 336 tab_cntrl_fi(49) = ptotal 377 tab_cntrl_fi(50) = co2icetotal337 tab_cntrl_fi(50) = 0. 378 338 379 339 c======================================================================= … … 430 390 431 391 c----------------------------------------------------------------------- 432 c Ecriture des champs ( co2ice,emis,ps,Tsurf,T,u,v,q2,q,qsurf)392 c Ecriture des champs (emis,ps,Tsurf,T,u,v,q2,q,qsurf) 433 393 c----------------------------------------------------------------------- 434 394 c ATTENTION: q2 a une couche de plus!!!! … … 439 399 c----------------------------------------------------------------------- 440 400 441 ! call write_archive(nid,ntime,'co2ice','couche de glace co2',442 ! & 'kg/m2',2,co2iceS)443 401 call write_archive(nid,ntime,'emis','grd emis',' ',2,emisS) 444 402 call write_archive(nid,ntime,'ps','Psurf','Pa',2,ps) … … 497 455 ! Note: no need to write volcapa, it is stored in "controle" table 498 456 499 c----------------------------------------------------------------------- 500 c Ecriture du champs cloudfrac,hice,totalcloudfrac 501 c----------------------------------------------------------------------- 502 call write_archive(nid,ntime,'hice', 503 & 'Height of oceanic ice','m',2,hiceS) 504 call write_archive(nid,ntime,'totalcloudfrac', 505 & 'Total cloud Fraction','',2,totalcloudfracS) 506 call write_archive(nid,ntime,'cloudfrac' 507 & ,'Cloud fraction','',3,cloudfracS) 508 509 c----------------------------------------------------------------------- 510 c Slab ocean 511 c----------------------------------------------------------------------- 512 OPEN(99,file='callphys.def',status='old',form='formatted' 513 & ,iostat=ierr) 514 CLOSE(99) 515 516 IF(ierr.EQ.0) THEN 517 518 519 write(*,*) "Use slab-ocean ?" 520 ok_slab_ocean=.false. ! default value 521 call getin("ok_slab_ocean",ok_slab_ocean) 522 write(*,*) "ok_slab_ocean = ",ok_slab_ocean 523 524 if(ok_slab_ocean) then 525 call write_archive(nid,ntime,'rnat' 526 & ,'rnat','',2,rnatS) 527 call write_archive(nid,ntime,'pctsrf_sic' 528 & ,'pctsrf_sic','',2,pctsrf_sicS) 529 call write_archive(nid,ntime,'sea_ice' 530 & ,'sea_ice','',2,sea_iceS) 531 call write_archive(nid,ntime,'tslab' 532 & ,'tslab','',-2,tslabS) 533 call write_archive(nid,ntime,'tsea_ice' 534 & ,'tsea_ice','',2,tsea_iceS) 535 endif !ok_slab_ocean 536 ENDIF 537 c----------------------------------------------------------------------- 457 538 458 c Fin 539 459 c----------------------------------------------------------------------- -
trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/write_archive.F
r1478 r1647 33 33 34 34 use comsoil_h, only: nsoilmx 35 use slab_ice_h, only: noceanmx36 35 37 36 implicit none … … 195 194 edges(1)=iip1 196 195 edges(2)=jjp1 197 edges(3)= noceanmx196 edges(3)=1 ! JVO2017 : was noceanmx before -> set to 1 198 197 edges(4)=1 199 198 #ifdef NC_DOUBLE -
trunk/LMDZ.TITAN/libf/phytitan/aeropacity.F90
r1542 r1647 1 1 Subroutine aeropacity(ngrid,nlayer,nq,pplay,pplev,pq, & 2 aerosol,reffrad,QREFvis3d,QREFir3d,tau_col ,cloudfrac,totcloudfrac,clearsky)2 aerosol,reffrad,QREFvis3d,QREFir3d,tau_col) 3 3 4 4 use radinc_h, only : L_TAUMAX,naerkind 5 5 use aerosol_mod 6 USE tracer_h, only: noms ,rho_co2,rho_ice6 USE tracer_h, only: noms 7 7 use comcstfi_mod, only: g 8 use callkeys_mod, only: aerofixco2,aerofixh2o,kastprof,cloudlvl, & 9 CLFvarying,CLFfixval,dusttau, & 10 pres_bottom_tropo,pres_top_tropo,obs_tau_col_tropo, & 8 use callkeys_mod, only: pres_bottom_tropo,pres_top_tropo,obs_tau_col_tropo, & 11 9 pres_bottom_strato,pres_top_strato,obs_tau_col_strato 12 10 … … 55 53 REAL,INTENT(IN) :: QREFir3d(ngrid,nlayer,naerkind) 56 54 REAL,INTENT(OUT):: tau_col(ngrid) !column integrated visible optical depth 57 ! BENJAMIN MODIFS58 real,intent(in) :: cloudfrac(ngrid,nlayer) ! cloud fraction59 real,intent(out) :: totcloudfrac(ngrid) ! total cloud fraction60 logical,intent(in) :: clearsky61 55 62 56 real aerosol0 … … 69 63 EXTERNAL CBRT 70 64 71 INTEGER,SAVE :: i_co2ice=0 ! co2 ice72 INTEGER,SAVE :: i_h2oice=0 ! water ice73 !$OMP THREADPRIVATE(i_co2ice,i_h2oice)74 CHARACTER(LEN=20) :: tracername ! to temporarily store text75 76 65 ! for fixed dust profiles 77 real topdust, expfactor, zp 78 REAL taudusttmp(ngrid) ! Temporary dust opacity used before scaling 79 REAL tauh2so4tmp(ngrid) ! Temporary h2so4 opacity used before scaling 80 81 real CLFtot 66 real expfactor, zp 82 67 83 68 ! identify tracers … … 85 70 86 71 write(*,*) "Tracers found in aeropacity:" 87 do iq=1,nq88 tracername=noms(iq)89 if (tracername.eq."co2_ice") then90 i_co2ice=iq91 write(*,*) "i_co2ice=",i_co2ice92 93 endif94 if (tracername.eq."h2o_ice") then95 i_h2oice=iq96 write(*,*) "i_h2oice=",i_h2oice97 endif98 enddo99 72 100 73 if (noaero) then … … 107 80 endif 108 81 109 if ((iaero_co2.ne.0).and.(.not.noaero)) then110 print*, 'iaero_co2= ',iaero_co2111 endif112 if (iaero_h2o.ne.0) then113 print*,'iaero_h2o= ',iaero_h2o114 endif115 if (iaero_dust.ne.0) then116 print*,'iaero_dust= ',iaero_dust117 endif118 if (iaero_h2so4.ne.0) then119 print*,'iaero_h2so4= ',iaero_h2so4120 endif121 82 if (iaero_back2lay.ne.0) then 122 83 print*,'iaero_back2lay= ',iaero_back2lay … … 127 88 128 89 129 ! --------------------------------------------------------- 130 !================================================================== 131 ! CO2 ice aerosols 132 !================================================================== 90 ! --------------------------------------------------------- 133 91 134 if (iaero_co2.ne.0) then135 iaer=iaero_co2136 ! 1. Initialization137 aerosol(1:ngrid,1:nlayer,iaer)=0.0138 ! 2. Opacity calculation139 if (noaero) then ! aerosol set to zero140 aerosol(1:ngrid,1:nlayer,iaer)=0.0141 elseif (aerofixco2.or.(i_co2ice.eq.0)) then ! CO2 ice cloud prescribed142 aerosol(1:ngrid,1:nlayer,iaer)=1.e-9143 !aerosol(1:ngrid,12,iaer)=4.0 ! single cloud layer option144 else145 DO ig=1, ngrid146 DO l=1,nlayer-1 ! to stop the rad tran bug147 148 aerosol0 = &149 ( 0.75 * QREFvis3d(ig,l,iaer) / &150 ( rho_co2 * reffrad(ig,l,iaer) ) ) * &151 ( pq(ig,l,i_co2ice) + 1.E-9 ) * &152 ( pplev(ig,l) - pplev(ig,l+1) ) / g153 aerosol0 = max(aerosol0,1.e-9)154 aerosol0 = min(aerosol0,L_TAUMAX)155 aerosol(ig,l,iaer) = aerosol0156 ! aerosol(ig,l,iaer) = 0.0157 ! print*, aerosol(ig,l,iaer)158 ! using cloud fraction159 ! aerosol(ig,l,iaer) = -log(1 - CLF + CLF*exp(-aerosol0/CLF))160 ! aerosol(ig,l,iaer) = min(aerosol(ig,l,iaer),L_TAUMAX)161 162 163 ENDDO164 ENDDO165 end if ! if fixed or varying166 end if ! if CO2 aerosols167 !==================================================================168 ! Water ice / liquid169 !==================================================================170 171 if (iaero_h2o.ne.0) then172 iaer=iaero_h2o173 ! 1. Initialization174 aerosol(1:ngrid,1:nlayer,iaer)=0.0175 ! 2. Opacity calculation176 if (aerofixh2o.or.(i_h2oice.eq.0).or.clearsky) then177 aerosol(1:ngrid,1:nlayer,iaer) =1.e-9178 179 ! put cloud at cloudlvl180 if(kastprof.and.(cloudlvl.ne.0.0))then181 ig=1182 do l=1,nlayer183 if(int(cloudlvl).eq.l)then184 !if(cloudlvl.gt.(pplay(ig,l)/pplev(ig,1)))then185 print*,'Inserting cloud at level ',l186 !aerosol(ig,l,iaer)=10.0187 188 rho_ice=920.0189 190 ! the Kasting approximation191 aerosol(ig,l,iaer) = &192 ( 0.75 * QREFvis3d(ig,l,iaer) / &193 ( rho_ice * reffrad(ig,l,iaer) ) ) * &194 !( pq(ig,l,i_h2oice) + 1.E-9 ) * &195 ( 4.0e-4 + 1.E-9 ) * &196 ( pplev(ig,l) - pplev(ig,l+1) ) / g197 198 199 open(115,file='clouds.out',form='formatted')200 write(115,*) l,aerosol(ig,l,iaer)201 close(115)202 203 return204 endif205 end do206 207 call abort208 endif209 210 else211 212 do ig=1, ngrid213 do l=1,nlayer-1 ! to stop the rad tran bug214 215 aerosol(ig,l,iaer) = & !modification by BC216 ( 0.75 * QREFvis3d(ig,l,iaer) / &217 ( rho_ice * reffrad(ig,l,iaer) ) ) * &218 ! pq(ig,l,i_h2oice) * & !JL I dropped the +1e-9 here to have the same219 !( pplev(ig,l) - pplev(ig,l+1) ) / g ! opacity in the clearsky=true and the220 ! clear=false/pq=0 case221 ( pq(ig,l,i_h2oice) + 1.E-9 ) * & ! Doing this makes the code unstable, so I have restored it (RW)222 ( pplev(ig,l) - pplev(ig,l+1) ) / g223 224 enddo225 enddo226 227 if(CLFvarying)then228 call totalcloudfrac(ngrid,nlayer,nq,cloudfrac,totcloudfrac,pplev,pq,aerosol(1,1,iaer))229 do ig=1, ngrid230 do l=1,nlayer-1 ! to stop the rad tran bug231 CLFtot = max(totcloudfrac(ig),0.01)232 aerosol(ig,l,iaer)=aerosol(ig,l,iaer)/CLFtot233 aerosol(ig,l,iaer) = max(aerosol(ig,l,iaer),1.e-9)234 enddo235 enddo236 else237 do ig=1, ngrid238 do l=1,nlayer-1 ! to stop the rad tran bug239 CLFtot = CLFfixval240 aerosol(ig,l,iaer)=aerosol(ig,l,iaer)/CLFtot241 aerosol(ig,l,iaer) = max(aerosol(ig,l,iaer),1.e-9)242 enddo243 enddo244 end if!(CLFvarying)245 endif !(aerofixed.or.(i_h2oice.eq.0).or.clearsky)246 247 end if ! End if h2o aerosol248 249 !==================================================================250 ! Dust251 !==================================================================252 if (iaero_dust.ne.0) then253 iaer=iaero_dust254 ! 1. Initialization255 aerosol(1:ngrid,1:nlayer,iaer)=0.0256 257 topdust=30.0 ! km (used to be 10.0 km) LK258 259 ! 2. Opacity calculation260 261 ! expfactor=0.262 DO l=1,nlayer-1263 DO ig=1,ngrid264 ! Typical mixing ratio profile265 266 zp=(pplev(ig,1)/pplay(ig,l))**(70./topdust)267 expfactor=max(exp(0.007*(1.-max(zp,1.))),1.e-3)268 269 ! Vertical scaling function270 aerosol(ig,l,iaer)= (pplev(ig,l)-pplev(ig,l+1)) &271 *expfactor272 273 274 ENDDO275 ENDDO276 277 ! Rescaling each layer to reproduce the choosen (or assimilated)278 ! dust extinction opacity at visible reference wavelength, which279 ! is scaled to the surface pressure pplev(ig,1)280 281 taudusttmp(1:ngrid)=0.282 DO l=1,nlayer283 DO ig=1,ngrid284 taudusttmp(ig) = taudusttmp(ig) &285 + aerosol(ig,l,iaer)286 ENDDO287 ENDDO288 DO l=1,nlayer-1289 DO ig=1,ngrid290 aerosol(ig,l,iaer) = max(1E-20, &291 dusttau &292 * pplev(ig,1) / pplev(ig,1) &293 * aerosol(ig,l,iaer) &294 / taudusttmp(ig))295 296 ENDDO297 ENDDO298 end if ! If dust aerosol299 300 !==================================================================301 ! H2SO4302 !==================================================================303 ! added by LK304 if (iaero_h2so4.ne.0) then305 iaer=iaero_h2so4306 307 ! 1. Initialization308 aerosol(1:ngrid,1:nlayer,iaer)=0.0309 310 311 ! 2. Opacity calculation312 313 ! expfactor=0.314 DO l=1,nlayer-1315 DO ig=1,ngrid316 ! Typical mixing ratio profile317 318 zp=(pplev(ig,1)/pplay(ig,l))**(70./30) !emulating topdust319 expfactor=max(exp(0.007*(1.-max(zp,1.))),1.e-3)320 321 ! Vertical scaling function322 aerosol(ig,l,iaer)= (pplev(ig,l)-pplev(ig,l+1))*expfactor323 324 ENDDO325 ENDDO326 tauh2so4tmp(1:ngrid)=0.327 DO l=1,nlayer328 DO ig=1,ngrid329 tauh2so4tmp(ig) = tauh2so4tmp(ig) + aerosol(ig,l,iaer)330 ENDDO331 ENDDO332 DO l=1,nlayer-1333 DO ig=1,ngrid334 aerosol(ig,l,iaer) = max(1E-20, &335 1 &336 * pplev(ig,1) / pplev(ig,1) &337 * aerosol(ig,l,iaer) &338 / tauh2so4tmp(ig))339 340 ENDDO341 ENDDO342 343 ! 1/700. is assuming a "sulfurtau" of 1344 ! Sulfur aerosol routine to be improved.345 ! aerosol0 = &346 ! ( 0.75 * QREFvis3d(ig,l,iaer) / &347 ! ( rho_h2so4 * reffrad(ig,l,iaer) ) ) * &348 ! ( pq(ig,l,i_h2so4) + 1.E-9 ) * &349 ! ( pplev(ig,l) - pplev(ig,l+1) ) / g350 ! aerosol0 = max(aerosol0,1.e-9)351 ! aerosol0 = min(aerosol0,L_TAUMAX)352 ! aerosol(ig,l,iaer) = aerosol0353 354 ! ENDDO355 ! ENDDO356 end if357 358 359 ! ---------------------------------------------------------360 92 !================================================================== 361 93 ! Two-layer aerosols (unknown composition) -
trunk/LMDZ.TITAN/libf/phytitan/aerosol_mod.F90
r1315 r1647 8 8 ! corresponding aerosol was not activated in callphys.def 9 9 ! -- otherwise a value is given in iniaerosol 10 integer :: iaero_co2 = 011 integer :: iaero_h2o = 012 integer :: iaero_dust = 013 integer :: iaero_h2so4 = 014 10 logical :: noaero = .false. 15 11 16 12 ! two-layer simple aerosol model 17 13 integer :: iaero_back2lay = 0 18 !$OMP THREADPRIVATE( iaero_co2,iaero_h2o,iaero_dust,iaero_h2so4,noaero,iaero_back2lay)14 !$OMP THREADPRIVATE(noaero,iaero_back2lay) 19 15 20 16 !================================================================== -
trunk/LMDZ.TITAN/libf/phytitan/calc_cpp_mugaz.F90
r1397 r1647 38 38 else 39 39 ! all values at 300 K from Engineering Toolbox 40 if(igas.eq.igas_CO2)then 41 mugaz_c = mugaz_c + 44.01*gfrac(igas) 42 elseif(igas.eq.igas_N2)then 40 if(igas.eq.igas_N2)then 43 41 mugaz_c = mugaz_c + 28.01*gfrac(igas) 44 42 elseif(igas.eq.igas_H2)then 45 43 mugaz_c = mugaz_c + 2.01*gfrac(igas) 46 elseif(igas.eq.igas_He)then47 mugaz_c = mugaz_c + 4.003*gfrac(igas)48 elseif(igas.eq.igas_H2O)then49 mugaz_c = mugaz_c + 18.02*gfrac(igas)50 elseif(igas.eq.igas_SO2)then51 mugaz_c = mugaz_c + 64.066*gfrac(igas)52 elseif(igas.eq.igas_H2S)then53 mugaz_c = mugaz_c + 34.08*gfrac(igas)54 44 elseif(igas.eq.igas_CH4)then 55 45 mugaz_c = mugaz_c + 16.04*gfrac(igas) 56 elseif(igas.eq.igas_NH3)then57 mugaz_c = mugaz_c + 17.03*gfrac(igas)58 46 elseif(igas.eq.igas_C2H6)then 59 47 ! C2H6 http://encyclopedia.airliquide.com/Encyclopedia.asp?GasID=28 … … 77 65 else 78 66 ! all values at 300 K from Engineering Toolbox 79 if(igas.eq.igas_CO2)then 80 !cpp_c = cpp_c + 0.744*gfrac(igas) ! @ ~210 K (better for 81 !Mars conditions) 82 cpp_c = cpp_c + 0.846*gfrac(igas)*44.01/mugaz_c 83 elseif(igas.eq.igas_N2)then 67 if(igas.eq.igas_N2)then 84 68 cpp_c = cpp_c + 1.040*gfrac(igas)*28.01/mugaz_c 85 69 elseif(igas.eq.igas_H2)then 86 70 cpp_c = cpp_c + 14.31*gfrac(igas)*2.01/mugaz_c 87 elseif(igas.eq.igas_He)then88 cpp_c = cpp_c + 5.19*gfrac(igas)*4.003/mugaz_c89 elseif(igas.eq.igas_H2O)then90 cpp_c = cpp_c + 1.864*gfrac(igas)*18.02/mugaz_c91 elseif(igas.eq.igas_SO2)then92 cpp_c = cpp_c + 0.64*gfrac(igas)*64.066/mugaz_c93 elseif(igas.eq.igas_H2S)then94 cpp_c = cpp_c + 1.003*gfrac(igas)*34.08/mugaz_c ! from wikipedia...95 71 elseif(igas.eq.igas_CH4)then 96 72 cpp_c = cpp_c + 2.226*gfrac(igas)*16.04/mugaz_c 97 elseif(igas.eq.igas_NH3)then98 cpp_c = cpp_c + 2.175*gfrac(igas)*17.03/mugaz_c99 print*,'WARNING, cpp for NH3 may be for liquid'100 73 elseif(igas.eq.igas_C2H6)then 101 74 ! C2H6 -
trunk/LMDZ.TITAN/libf/phytitan/calc_rayleigh.F90
r1397 r1647 62 62 tauconsti(igas) = 0.0 63 63 else 64 if(igas.eq.igas_CO2) then 65 tauconsti(igas) = (8.7/g)*1.527*scalep/P0 66 elseif(igas.eq.igas_N2)then 64 if(igas.eq.igas_N2)then 67 65 tauconsti(igas) = (9.81/g)*8.569E-3*scalep/(P0/93.0) 68 elseif(igas.eq.igas_H2O)then69 ! tauconsti(igas) = (10.0/g)*9.22E-3*scalep/101325.070 tauconsti(igas) = 1.98017E-10/(g*mugaz*100.)71 66 elseif(igas.eq.igas_H2)then 72 67 tauconsti(igas) = (10.0/g)*0.0241*scalep/101325.0 … … 74 69 ! uses n=1.000132 from Optics, Fourth Edition. 75 70 ! was out by a factor 2! 76 elseif(igas.eq.igas_He)then77 tauconsti(igas) = (10.0/g)*0.00086*scalep/101325.078 71 else 79 72 print*,'Error in calc_rayleigh: Gas species not recognised!' … … 114 107 tauvari(igas) = 0.0 115 108 else 116 if(igas.eq.igas_CO2)then 117 tauvari(igas) = (1.0+0.013/wl**2)/wl**4 118 elseif(igas.eq.igas_N2)then 109 if(igas.eq.igas_N2)then 119 110 tauvari(igas) = (1.0+0.0113/wl**2+0.00013/wl**4)/wl**4 120 elseif(igas.eq.igas_H2O)then121 ! tauvari(igas) = 1.0/wl**4 ! to be improved...122 tauvari(igas) = (5.7918E6/(2.38E2-1/wl**2)+1.679E5/(57.36E0-1/wl**2))**2/wl**4123 111 elseif(igas.eq.igas_H2)then 124 tauvari(igas) = 1.0/wl**4125 elseif(igas.eq.igas_He)then126 112 tauvari(igas) = 1.0/wl**4 127 113 else -
trunk/LMDZ.TITAN/libf/phytitan/callcorrk.F90
r1529 r1647 6 6 fluxabs_sw,fluxtop_dn, & 7 7 OLR_nu,OSR_nu, & 8 tau_col,cloudfrac,totcloudfrac, & 9 clearsky,firstcall,lastcall) 8 tau_col,firstcall,lastcall) 10 9 11 10 use radinc_h 12 11 use radcommon_h 13 use watercommon_h14 12 use datafile_mod, only: datadir 15 13 use ioipsl_getin_p_mod, only: getin_p 16 14 use gases_h 17 use radii_mod, only : su_aer_radii, co2_reffrad,h2o_reffrad,dust_reffrad,h2so4_reffrad,back2lay_reffrad18 use aerosol_mod, only : iaero_ co2,iaero_h2o,iaero_dust,iaero_h2so4, iaero_back2lay15 use radii_mod, only : su_aer_radii,back2lay_reffrad 16 use aerosol_mod, only : iaero_back2lay 19 17 USE tracer_h 20 18 use comcstfi_mod, only: pi, mugaz, cpp 21 use callkeys_mod, only: varactive,diurnal,tracer,water,nosurf,varfixed,satval, &22 kastprof,strictboundcorrk,specOLR,CLFvarying19 use callkeys_mod, only: diurnal,tracer,nosurf,satval, & 20 strictboundcorrk,specOLR 23 21 24 22 implicit none … … 62 60 REAL,INTENT(IN) :: dist_star ! Distance star-planet (AU). 63 61 REAL,INTENT(IN) :: muvar(ngrid,nlayer+1) 64 REAL,INTENT(IN) :: cloudfrac(ngrid,nlayer) ! Fraction of clouds (%).65 logical,intent(in) :: clearsky66 62 logical,intent(in) :: firstcall ! Signals first call to physics. 67 63 logical,intent(in) :: lastcall ! Signals last call to physics. … … 80 76 REAL,INTENT(OUT) :: OSR_nu(ngrid,L_NSPECTV) ! Outgoing SW radition in each band (Normalized to the band width (W/m2/cm-1). 81 77 REAL,INTENT(OUT) :: tau_col(ngrid) ! Diagnostic from aeropacity. 82 REAL,INTENT(OUT) :: albedo_equivalent(ngrid) ! Spectrally Integrated Albedo. For Diagnostic. By MT2015 83 REAL,INTENT(OUT) :: totcloudfrac(ngrid) ! Column Fraction of clouds (%). 78 REAL,INTENT(OUT) :: albedo_equivalent(ngrid) ! Spectrally Integrated Albedo. For Diagnostic. By MT2015 84 79 85 80 86 87 88 89 81 ! Globally varying aerosol optical properties on GCM grid ; not needed everywhere so not in radcommon_h. 90 82 REAL :: QVISsQREF3d(ngrid,nlayer,L_NSPECTV,naerkind) … … 230 222 231 223 232 if((igcm_h2o_vap.eq.0) .and. varactive)then233 print*,'varactive in callcorrk but no h2o_vap tracer.'234 stop235 endif236 237 224 OLR_nu(:,:) = 0. 238 225 OSR_nu(:,:) = 0. … … 278 265 279 266 do iaer=1,naerkind 280 281 if ((iaer.eq.iaero_co2).and.tracer.and.(igcm_co2_ice.gt.0)) then ! Treat condensed co2 particles. 282 call co2_reffrad(ngrid,nlayer,nq,pq,reffrad(1,1,iaero_co2)) 283 print*,'Max. CO2 ice particle size = ',maxval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 284 print*,'Min. CO2 ice particle size = ',minval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 285 end if 286 287 if ((iaer.eq.iaero_h2o).and.water) then ! Treat condensed water particles. To be generalized for other aerosols ... 288 call h2o_reffrad(ngrid,nlayer,pq(1,1,igcm_h2o_ice),pt, & 289 reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o)) 290 print*,'Max. H2O cloud particle size = ',maxval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 291 print*,'Min. H2O cloud particle size = ',minval(reffrad(1:ngrid,1:nlayer,iaer))/1.e-6,' um' 292 endif 293 294 if(iaer.eq.iaero_dust)then 295 call dust_reffrad(ngrid,nlayer,reffrad(1,1,iaero_dust)) 296 print*,'Dust particle size = ',reffrad(1,1,iaer)/1.e-6,' um' 297 endif 298 299 if(iaer.eq.iaero_h2so4)then 300 call h2so4_reffrad(ngrid,nlayer,reffrad(1,1,iaero_h2so4)) 301 print*,'H2SO4 particle size =',reffrad(1,1,iaer)/1.e-6,' um' 302 endif 303 267 304 268 if(iaer.eq.iaero_back2lay)then 305 269 call back2lay_reffrad(ngrid,reffrad(1,1,iaero_back2lay),nlayer,pplev) … … 323 287 call aeropacity(ngrid,nlayer,nq,pplay,pplev,pq,aerosol, & 324 288 reffrad,QREFvis3d,QREFir3d, & 325 tau_col ,cloudfrac,totcloudfrac,clearsky)289 tau_col) 326 290 327 291 … … 506 470 507 471 508 !----------------------------------------------------------------------- 509 ! Water vapour (to be generalised for other gases eventually ...) 510 !----------------------------------------------------------------------- 472 do k=1,L_LEVELS 473 qvar(k) = 1.0D-7 474 end do 475 476 477 ! IMPORTANT: Now convert from kg/kg to mol/mol. 478 ! do k=1,L_LEVELS 479 ! qvar(k) = qvar(k)/(epsi+qvar(k)*(1.-epsi)) 480 ! end do 481 482 DO l=1,nlayer 483 muvarrad(2*l) = muvar(ig,nlayer+2-l) 484 muvarrad(2*l+1) = (muvar(ig,nlayer+2-l)+muvar(ig,max(nlayer+1-l,1)))/2 485 END DO 511 486 512 if(varactive)then 513 514 i_var=igcm_h2o_vap 515 do l=1,nlayer 516 qvar(2*l) = pq(ig,nlayer+1-l,i_var) 517 qvar(2*l+1) = pq(ig,nlayer+1-l,i_var) 518 !JL13index qvar(2*l+1) = (pq(ig,nlayer+1-l,i_var)+pq(ig,max(nlayer-l,1),i_var))/2 519 !JL13index ! Average approximation as for temperature... 520 end do 521 qvar(1)=qvar(2) 522 523 elseif(varfixed)then 524 525 do l=1,nlayer ! Here we will assign fixed water vapour profiles globally. 526 RH = satval * ((pplay(ig,l)/pplev(ig,1) - 0.02) / 0.98) 527 if(RH.lt.0.0) RH=0.0 528 529 ptemp=pplay(ig,l) 530 Ttemp=pt(ig,l) 531 call watersat(Ttemp,ptemp,qsat) 532 533 !pq_temp(l) = qsat ! fully saturated everywhere 534 pq_temp(l) = RH * qsat ! ~realistic profile (e.g. 80% saturation at ground) 535 end do 536 537 do l=1,nlayer 538 qvar(2*l) = pq_temp(nlayer+1-l) 539 qvar(2*l+1) = (pq_temp(nlayer+1-l)+pq_temp(max(nlayer-l,1)))/2 540 end do 541 542 qvar(1)=qvar(2) 543 544 ! Lowest layer of atmosphere 545 RH = satval * (1 - 0.02) / 0.98 546 if(RH.lt.0.0) RH=0.0 547 548 ! ptemp = pplev(ig,1) 549 ! Ttemp = tsurf(ig) 550 ! call watersat(Ttemp,ptemp,qsat) 551 552 qvar(2*nlayer+1)= RH * qsat ! ~realistic profile (e.g. 80% saturation at ground) 553 554 else 555 do k=1,L_LEVELS 556 qvar(k) = 1.0D-7 557 end do 558 end if ! varactive/varfixed 559 560 if(.not.kastprof)then 561 ! IMPORTANT: Now convert from kg/kg to mol/mol. 562 do k=1,L_LEVELS 563 qvar(k) = qvar(k)/(epsi+qvar(k)*(1.-epsi)) 564 end do 565 end if 566 567 !----------------------------------------------------------------------- 568 ! kcm mode only ! 569 !----------------------------------------------------------------------- 570 571 if(kastprof)then 572 573 ! Initial values equivalent to mugaz. 574 DO l=1,nlayer 575 muvarrad(2*l) = mugaz 576 muvarrad(2*l+1) = mugaz 577 END DO 578 579 if(ngasmx.gt.1)then 580 581 DO l=1,nlayer 582 muvarrad(2*l) = muvar(ig,nlayer+2-l) 583 muvarrad(2*l+1) = (muvar(ig,nlayer+2-l) + & 584 muvar(ig,max(nlayer+1-l,1)))/2 585 END DO 586 587 muvarrad(1) = muvarrad(2) 588 muvarrad(2*nlayer+1) = muvar(ig,1) 589 590 print*,'Recalculating qvar with VARIABLE epsi for kastprof' 591 print*,'Assumes that the variable gas is H2O!!!' 592 print*,'Assumes that there is only one tracer' 593 594 !i_var=igcm_h2o_vap 595 i_var=1 596 597 if(nq.gt.1)then 598 print*,'Need 1 tracer only to run kcm1d.e' 599 stop 600 endif 601 602 do l=1,nlayer 603 vtmp(l)=pq(ig,l,i_var)/(epsi+pq(ig,l,i_var)*(1.-epsi)) 604 !vtmp(l)=pq(ig,l,i_var)*muvar(ig,l+1)/mH2O !JL to be changed 605 end do 606 607 do l=1,nlayer 608 qvar(2*l) = vtmp(nlayer+1-l) 609 qvar(2*l+1) = vtmp(nlayer+1-l) 610 ! qvar(2*l+1) = ( vtmp(nlayer+1-l) + vtmp(max(nlayer-l,1)) )/2 611 end do 612 qvar(1)=qvar(2) 613 614 print*,'Warning: reducing qvar in callcorrk.' 615 print*,'Temperature profile no longer consistent ', & 616 'with saturated H2O. qsat=',satval 617 618 do k=1,L_LEVELS 619 qvar(k) = qvar(k)*satval 620 end do 621 622 endif 623 else ! if kastprof 624 DO l=1,nlayer 625 muvarrad(2*l) = muvar(ig,nlayer+2-l) 626 muvarrad(2*l+1) = (muvar(ig,nlayer+2-l)+muvar(ig,max(nlayer+1-l,1)))/2 627 END DO 628 629 muvarrad(1) = muvarrad(2) 630 muvarrad(2*nlayer+1)=muvar(ig,1) 631 endif ! if kastprof 487 muvarrad(1) = muvarrad(2) 488 muvarrad(2*nlayer+1)=muvar(ig,1) 632 489 633 490 ! Keep values inside limits for which we have radiative transfer coefficients !!! … … 949 806 950 807 ! See physiq.F for explanations about CLFvarying. This is temporary. 951 if (lastcall .and. .not.CLFvarying) then808 if (lastcall) then 952 809 IF( ALLOCATED( gasi ) ) DEALLOCATE( gasi ) 953 810 IF( ALLOCATED( gasv ) ) DEALLOCATE( gasv ) -
trunk/LMDZ.TITAN/libf/phytitan/callkeys_mod.F90
r1520 r1647 4 4 logical,save :: callrad,corrk,calldifv,UseTurbDiff 5 5 !$OMP THREADPRIVATE(callrad,corrk,calldifv,UseTurbDiff) 6 logical,save :: calladj,c o2cond,callsoil7 !$OMP THREADPRIVATE(calladj,c o2cond,callsoil)6 logical,save :: calladj,callsoil 7 !$OMP THREADPRIVATE(calladj,callsoil) 8 8 logical,save :: season,diurnal,tlocked,rings_shadow,lwrite 9 9 !$OMP THREADPRIVATE(season,diurnal,tlocked,rings_shadow,lwrite) 10 10 logical,save :: callstats,calleofdump 11 11 !$OMP THREADPRIVATE(callstats,calleofdump) 12 logical,save :: callgasvis,continuum, H2Ocont_simple,graybody13 !$OMP THREADPRIVATE(callgasvis,continuum, H2Ocont_simple,graybody)12 logical,save :: callgasvis,continuum,graybody 13 !$OMP THREADPRIVATE(callgasvis,continuum,graybody) 14 14 logical,save :: strictboundcorrk 15 15 !$OMP THREADPRIVATE(strictboundcorrk) … … 19 19 logical,save :: meanOLR 20 20 logical,save :: specOLR 21 logical,save :: kastprof 22 !$OMP THREADPRIVATE(enertest,nonideal,meanOLR,kastprof) 21 !$OMP THREADPRIVATE(enertest,nonideal,meanOLR) 23 22 logical,save :: newtonian 24 23 logical,save :: check_cpp_match … … 29 28 logical,save :: stelbbody 30 29 logical,save :: ozone 31 logical,save :: nearco2cond32 30 logical,save :: tracer 33 31 logical,save :: mass_redistrib 34 !$OMP THREADPRIVATE(stelbbody,ozone,nearco2cond,tracer,mass_redistrib) 35 logical,save :: varactive 36 logical,save :: varfixed 37 logical,save :: radfixed 32 !$OMP THREADPRIVATE(stelbbody,ozone,tracer,mass_redistrib) 38 33 logical,save :: sedimentation 39 !$OMP THREADPRIVATE(varactive,varfixed,radfixed,sedimentation) 40 logical,save :: water,watercond,waterrain 41 !$OMP THREADPRIVATE(water,watercond,waterrain) 42 logical,save :: aeroco2,aeroh2o,aeroh2so4,aeroback2lay 43 !$OMP THREADPRIVATE(aeroco2,aeroh2o,aeroh2so4,aeroback2lay) 44 logical,save :: aerofixco2,aerofixh2o 45 !$OMP THREADPRIVATE(aerofixco2,aerofixh2o) 46 logical,save :: hydrology 47 logical,save :: sourceevol 48 logical,save :: CLFvarying 34 !$OMP THREADPRIVATE(sedimentation) 35 logical,save :: aeroback2lay 36 !$OMP THREADPRIVATE(aeroback2lay) 49 37 logical,save :: nosurf 50 38 logical,save :: oblate 51 !$OMP THREADPRIVATE(hydrology,sourceevol,CLFvarying,nosurf,oblate) 52 logical,save :: ok_slab_ocean 53 logical,save :: ok_slab_sic 54 logical,save :: ok_slab_heat_transp 55 logical,save :: albedo_spectral_mode 56 !$OMP THREADPRIVATE(ok_slab_ocean,ok_slab_sic,ok_slab_heat_transp,albedo_spectral_mode) 39 !$OMP THREADPRIVATE(nosurf,oblate) 57 40 58 41 integer,save :: iddist … … 63 46 64 47 real,save :: topdustref 65 real,save :: Nmix_co266 real,save :: dusttau67 48 real,save :: Fat1AU 68 49 real,save :: stelTbb 69 !$OMP THREADPRIVATE(topdustref,Nmix_co2,dusttau,Fat1AU,stelTbb) 70 real,save :: Tstrat 50 !$OMP THREADPRIVATE(topdustref,Fat1AU,stelTbb) 71 51 real,save :: tplanet 72 52 real,save :: obs_tau_col_tropo 73 53 real,save :: obs_tau_col_strato 74 !$OMP THREADPRIVATE( Tstrat,tplanet,obs_tau_col_tropo,obs_tau_col_strato)54 !$OMP THREADPRIVATE(tplanet,obs_tau_col_tropo,obs_tau_col_strato) 75 55 real,save :: pres_bottom_tropo 76 56 real,save :: pres_top_tropo … … 81 61 real,save :: size_strato 82 62 real,save :: satval 83 real,save :: CLFfixval 84 real,save :: n2mixratio 85 !$OMP THREADPRIVATE(size_tropo,size_strato,satval,CLFfixval,n2mixratio) 86 real,save :: co2supsat 63 !$OMP THREADPRIVATE(size_tropo,size_strato,satval) 87 64 real,save :: pceil 88 real,save :: albedosnow 89 real,save :: albedoco2ice 90 real,save :: maxicethick 91 !$OMP THREADPRIVATE(co2supsat,pceil,albedosnow,albedoco2ice,maxicethick) 92 real,save :: Tsaldiff 65 !$OMP THREADPRIVATE(pceil) 93 66 real,save :: tau_relax 94 real,save :: cloudlvl95 real,save :: icetstep96 67 real,save :: intheat 97 !$OMP THREADPRIVATE( Tsaldiff,tau_relax,cloudlvl,icetstep,intheat)68 !$OMP THREADPRIVATE(tau_relax,intheat) 98 69 real,save :: flatten 99 70 real,save :: Rmean -
trunk/LMDZ.TITAN/libf/phytitan/callsedim.F
r1477 r1647 4 4 5 5 use radinc_h, only : naerkind 6 use radii_mod, only: h2o_reffrad 7 use aerosol_mod, only : iaero_h2o 8 USE tracer_h, only : igcm_co2_ice,igcm_h2o_ice,radius,rho_q 6 USE tracer_h, only : radius, rho_q 9 7 use comcstfi_mod, only: g 10 use callkeys_mod, only : water11 8 12 9 IMPLICIT NONE … … 62 59 real epaisseur (ngrid,nlay) ! Layer thickness (m) 63 60 real wq(ngrid,nlay+1) ! displaced tracer mass (kg.m-2) 64 c real dens(ngrid,nlay) ! Mean density of the ice part. accounting for dust core65 61 66 62 … … 73 69 IF (firstcall) THEN 74 70 firstcall=.false. 75 ! add some tests on presence of required tracers/aerosols:76 if (water) then77 if (igcm_h2o_ice.eq.0) then78 write(*,*) "callsedim error: water=.true.",79 & " but igcm_h2o_ice=0"80 stop81 endif82 if (iaero_h2o.eq.0) then83 write(*,*) "callsedim error: water=.true.",84 & " but iaero_ho2=0"85 stop86 endif87 endif88 71 ENDIF ! of IF (firstcall) 89 72 … … 106 89 107 90 do iq=1,nq 108 if( (radius(iq).gt.1.e-9).and.(iq.ne.igcm_co2_ice)) then109 ! (no sedim for gases , and co2_ice sedim is done in condense_co2)91 if(radius(iq).gt.1.e-9) then 92 ! (no sedim for gases) 110 93 111 94 ! store locally updated tracers … … 120 103 ! Sedimentation 121 104 !====================================================================== 122 ! Water123 if (water.and.(iq.eq.igcm_h2o_ice)) then124 ! compute radii for h2o_ice125 call h2o_reffrad(ngrid,nlay,zqi(1,1,igcm_h2o_ice),zt,126 & reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o))127 ! call sedimentation for h2o_ice128 call newsedim(ngrid,nlay,ngrid*nlay,ptimestep,129 & pplev,masse,epaisseur,zt,reffrad(1,1,iaero_h2o),130 & rho_q(iq),zqi(1,1,igcm_h2o_ice),wq)131 132 105 ! General Case 133 else134 106 call newsedim(ngrid,nlay,1,ptimestep, 135 107 & pplev,masse,epaisseur,zt,radius(iq),rho_q(iq), 136 108 & zqi(1,1,iq),wq) 137 endif138 109 139 110 !======================================================================= … … 152 123 ENDDO 153 124 ENDDO 154 endif ! of no gases no co2_ice125 endif ! of no gases 155 126 enddo ! of do iq=1,nq 156 127 return -
trunk/LMDZ.TITAN/libf/phytitan/comsoil_h.F90
r1538 r1647 8 8 ! Full soil layer depths are set as: layer(k)=lay1_soil*alpha_soil**(k-1) , k=1,nsoil 9 9 ! Mid soil layer depths are set as: mlayer(k)=lay1_soil*alpha_soil**(k-1/2) , k=0,nsoil-1 10 real,save :: lay1_soil=2.e- 4! depth (m) of first full soil layer (may be set in callphys.def)10 real,save :: lay1_soil=2.e-3 ! depth (m) of first full soil layer (may be set in callphys.def) 11 11 real,save :: alpha_soil=2 ! coefficient for soil layer thickness (may be set in callphys.def) 12 12 !$OMP THREADPRIVATE(nsoilmx,lay1_soil,alpha_soil) -
trunk/LMDZ.TITAN/libf/phytitan/convadj.F
r1397 r1647 8 8 USE tracer_h 9 9 use comcstfi_mod, only: g 10 use callkeys_mod, only: tracer ,water10 use callkeys_mod, only: tracer 11 11 12 12 implicit none … … 16 16 ! Purpose 17 17 ! ------- 18 ! Calculates dry convective adjustment. If one tracer is CO2, 19 ! we take into account the molecular mass variation (e.g. when 20 ! CO2 condenses) to trigger convection (F. Forget 01/2005) 18 ! Calculates dry convective adjustment. 21 19 ! 22 20 ! Authors … … 62 60 63 61 ! Tracers 64 INTEGER iq,ico2 65 save ico2 66 !$OMP THREADPRIVATE(ico2) 62 INTEGER iq 67 63 REAL zq(ngrid,nlay,nq), zq2(ngrid,nlay,nq) 68 REAL zqm(nq) ,zqco2m69 real m_co2, m_noco2,A , B64 REAL zqm(nq) 65 real A , B 70 66 save A, B 71 67 !$OMP THREADPRIVATE(A,B) … … 73 69 real mtot1, mtot2 , mm1, mm2 74 70 integer l1ref, l2ref 75 LOGICAL vtest(ngrid),down, firstcall71 LOGICAL vtest(ngrid),down, firstcall 76 72 save firstcall 77 73 data firstcall/.true./ … … 88 84 89 85 IF (firstcall) THEN 90 ico2=091 if (tracer) then92 ! Prepare Special treatment if one of the tracers is CO2 gas93 do iq=1,nq94 if (noms(iq).eq."co2") then95 print*,'dont go there'96 stop97 ico2=iq98 m_co2 = 44.01E-3 ! CO2 molecular mass (kg/mol)99 m_noco2 = 33.37E-3 ! Non condensible mol mass (kg/mol)100 ! Compute A and B coefficient use to compute101 ! mean molecular mass Mair defined by102 ! 1/Mair = q(ico2)/m_co2 + (1-q(ico2))/m_noco2103 ! 1/Mair = A*q(ico2) + B104 A =(1/m_co2 - 1/m_noco2)105 B=1/m_noco2106 end if107 enddo108 endif109 86 firstcall=.false. 110 87 ENDIF ! of IF (firstcall) 111 88 112 89 DO l=1,nlay 113 90 DO ig=1,ngrid … … 142 119 ENDDO 143 120 144 if (ico2.ne.0) then 145 ! Special case if one of the tracers is CO2 gas 146 DO l=1,nlay 147 DO ig=1,ngrid 148 zhc(ig,l) = zh2(ig,l)*(A*zq2(ig,l,ico2)+B) 149 ENDDO 150 ENDDO 151 else 152 CALL scopy(ngrid*nlay,zh2,1,zhc,1) 153 end if 121 CALL scopy(ngrid*nlay,zh2,1,zhc,1) 154 122 155 123 ! Find out which grid points are convectively unstable … … 203 171 zdsm = dsig(l2) 204 172 zhm = zh2(i, l2) 205 if(ico2.ne.0) zqco2m = zq2(i,l2,ico2)206 173 207 174 ! Test loop downwards … … 211 178 zdsm = zdsm + dsig(l) 212 179 zhm = zhm + sdsig(l) * (zh2(i, l) - zhm) / zsm 213 if(ico2.ne.0) then 214 zqco2m = 215 & zqco2m + dsig(l) * (zq2(i,l,ico2) - zqco2m) / zdsm 216 zhmc = zhm*(A*zqco2m+B) 217 else 218 zhmc = zhm 219 end if 180 zhmc = zhm 220 181 221 182 ! do we have to extend the column downwards? … … 260 221 end do 261 222 DO l = l1, l2 262 if(ico2.ne.0) then 263 zalpha=zalpha+ 264 & ABS(zhc(i,l)/(A+B*zqco2m) -zhm)*dsig(l) 265 else 266 zalpha=zalpha+ABS(zh2(i,l)-zhm)*dsig(l) 267 endif 223 zalpha=zalpha+ABS(zh2(i,l)-zhm)*dsig(l) 268 224 zh2(i, l) = zhm 269 225 ! modifs by RDW !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 306 262 end do 307 263 ENDDO 308 if (ico2.ne.0) then309 DO l=l1, l2310 zhc(i,l) = zh2(i,l)*(A*zq2(i,l,ico2)+B)311 ENDDO312 end if313 264 314 265 … … 324 275 ! check conservation 325 276 cadjncons=0.0 326 if(water)then327 do l = 1, nlay328 masse = (pplev(i,l) - pplev(i,l+1))/g329 iq = igcm_h2o_vap330 cadjncons = cadjncons +331 & masse*(zq2(i,l,iq)-zq(i,l,iq))/ptimestep332 end do333 endif334 277 335 278 if(cadjncons.lt.-1.e-6)then … … 369 312 print*,'zh2(ig,:) = ',zh2(i,l) 370 313 end do 371 do l = 1, nlay372 print*,'zq(ig,:,vap) = ',zq(i,l,igcm_h2o_vap)373 end do374 do l = 1, nlay375 print*,'zq2(ig,:,vap) = ',zq2(i,l,igcm_h2o_vap)376 end do377 print*,'zqm(vap) = ',zqm(igcm_h2o_vap)314 ! do l = 1, nlay 315 ! print*,'zq(ig,:,vap) = ',zq(i,l,igcm_h2o_vap) 316 ! end do 317 ! do l = 1, nlay 318 ! print*,'zq2(ig,:,vap) = ',zq2(i,l,igcm_h2o_vap) 319 ! end do 320 ! print*,'zqm(vap) = ',zqm(igcm_h2o_vap) 378 321 print*,'jadrs=',jadrs 379 322 -
trunk/LMDZ.TITAN/libf/phytitan/gases_h.F90
r1315 r1647 19 19 ! in analogy with tracer.h ... 20 20 integer :: igas_H2 21 integer :: igas_He22 integer :: igas_H2O23 integer :: igas_CO224 integer :: igas_CO25 21 integer :: igas_N2 26 integer :: igas_O227 integer :: igas_SO228 integer :: igas_H2S29 22 integer :: igas_CH4 30 integer :: igas_NH331 23 integer :: igas_C2H2 32 24 integer :: igas_C2H6 33 25 !!$OMP THREADPRIVATE(ngasmx,vgas,gnom,gfrac,& 34 ! !$OMP igas_H2,igas_He,igas_H2O,igas_CO2,igas_CO,igas_N2,& 35 ! !$OMP igas_O2,igas_SO2,igas_H2S,igas_CH4,igas_NH3,igas_C2H2,igas_C2H6) 26 ! !$OMP igas_H2,igas_N2,igas_CH4,igas_C2H2,igas_C2H6) 36 27 37 28 end module gases_h -
trunk/LMDZ.TITAN/libf/phytitan/iniaerosol.F
r1397 r1647 4 4 use radinc_h, only: naerkind 5 5 use aerosol_mod 6 use callkeys_mod, only: aeroco2,aeroh2o,dusttau,aeroh2so4, 7 & aeroback2lay 6 use callkeys_mod, only: aeroback2lay 8 7 9 8 IMPLICIT NONE … … 22 21 23 22 ia=0 24 if (aeroco2) then 25 ia=ia+1 26 iaero_co2=ia 27 endif 28 write(*,*) '--- CO2 aerosol = ', iaero_co2 29 30 if (aeroh2o) then 31 ia=ia+1 32 iaero_h2o=ia 33 endif 34 write(*,*) '--- H2O aerosol = ', iaero_h2o 35 36 if (dusttau.gt.0) then 37 ia=ia+1 38 iaero_dust=ia 39 endif 40 write(*,*) '--- Dust aerosol = ', iaero_dust 41 42 if (aeroh2so4) then 43 ia=ia+1 44 iaero_h2so4=ia 45 endif 46 write(*,*) '--- H2SO4 aerosol = ', iaero_h2so4 47 23 48 24 if (aeroback2lay) then 49 25 ia=ia+1 … … 59 35 60 36 if (ia.eq.0) then !For the zero aerosol case. 37 noaero = .true. 61 38 ia = 1 62 noaero = .true.63 iaero_co2=ia64 39 endif 65 40 -
trunk/LMDZ.TITAN/libf/phytitan/inifis_mod.F90
r1542 r1647 235 235 call getin_p("continuum",continuum) 236 236 write(*,*) " continuum = ",continuum 237 238 write(*,*) "use analytic function for H2O continuum ?"239 H2Ocont_simple=.false. ! default value240 call getin_p("H2Ocont_simple",H2Ocont_simple)241 write(*,*) " H2Ocont_simple = ",H2Ocont_simple242 237 243 238 write(*,*) "call turbulent vertical diffusion ?" … … 255 250 call getin_p("calladj",calladj) 256 251 write(*,*) " calladj = ",calladj 257 258 write(*,*) "call CO2 condensation ?"259 co2cond=.false. ! default value260 call getin_p("co2cond",co2cond)261 write(*,*) " co2cond = ",co2cond262 ! Test of incompatibility263 if (co2cond.and.(.not.tracer)) then264 print*,'We need a CO2 ice tracer to condense CO2'265 call abort266 endif267 268 write(*,*) "CO2 supersaturation level ?"269 co2supsat=1.0 ! default value270 call getin_p("co2supsat",co2supsat)271 write(*,*) " co2supsat = ",co2supsat272 252 273 253 write(*,*) "Radiative timescale for Newtonian cooling ?" … … 313 293 write(*,*)" specOLR = ",specOLR 314 294 315 write(*,*)"Operate in kastprof mode?"316 kastprof=.false.317 call getin_p("kastprof",kastprof)318 write(*,*)" kastprof = ",kastprof319 320 295 write(*,*)"Uniform absorption in radiative transfer?" 321 296 graybody=.false. … … 339 314 write(*,*)" alpha_soil = ",alpha_soil 340 315 341 ! Slab Ocean342 write(*,*) "Use slab-ocean ?"343 ok_slab_ocean=.false. ! default value344 call getin_p("ok_slab_ocean",ok_slab_ocean)345 write(*,*) "ok_slab_ocean = ",ok_slab_ocean346 ! Sanity check: for now slab oncean only works in serial mode347 if (ok_slab_ocean.and.is_parallel) then348 write(*,*) " Error: slab ocean should only be used in serial mode!"349 call abort350 endif351 352 write(*,*) "Use slab-sea-ice ?"353 ok_slab_sic=.true. ! default value354 call getin_p("ok_slab_sic",ok_slab_sic)355 write(*,*) "ok_slab_sic = ",ok_slab_sic356 357 write(*,*) "Use heat transport for the ocean ?"358 ok_slab_heat_transp=.true. ! default value359 call getin_p("ok_slab_heat_transp",ok_slab_heat_transp)360 write(*,*) "ok_slab_heat_transp = ",ok_slab_heat_transp361 362 363 364 ! Test of incompatibility:365 ! if kastprof used, we must be in 1D366 if (kastprof.and.(ngrid.gt.1)) then367 print*,'kastprof can only be used in 1D!'368 call abort369 endif370 371 write(*,*)"Stratospheric temperature for kastprof mode?"372 Tstrat=167.0373 call getin_p("Tstrat",Tstrat)374 write(*,*)" Tstrat = ",Tstrat375 376 316 write(*,*)"Remove lower boundary?" 377 317 nosurf=.false. … … 441 381 ! TRACERS: 442 382 443 write(*,*)"Varying H2O cloud fraction?"444 CLFvarying=.false. ! default value445 call getin_p("CLFvarying",CLFvarying)446 write(*,*)" CLFvarying = ",CLFvarying447 448 write(*,*)"Value of fixed H2O cloud fraction?"449 CLFfixval=1.0 ! default value450 call getin_p("CLFfixval",CLFfixval)451 write(*,*)" CLFfixval = ",CLFfixval452 453 write(*,*)"fixed radii for Cloud particles?"454 radfixed=.false. ! default value455 call getin_p("radfixed",radfixed)456 write(*,*)" radfixed = ",radfixed457 458 if(kastprof)then459 radfixed=.true.460 endif461 462 write(*,*)"Number mixing ratio of CO2 ice particles:"463 Nmix_co2=1.e6 ! default value464 call getin_p("Nmix_co2",Nmix_co2)465 write(*,*)" Nmix_co2 = ",Nmix_co2466 467 383 ! write(*,*)"Number of radiatively active aerosols:" 468 384 ! naerkind=0. ! default value … … 470 386 ! write(*,*)" naerkind = ",naerkind 471 387 472 write(*,*)"Opacity of dust (if used):" 473 dusttau=0. ! default value 474 call getin_p("dusttau",dusttau) 475 write(*,*)" dusttau = ",dusttau 476 477 write(*,*)"Radiatively active CO2 aerosols?" 478 aeroco2=.false. ! default value 479 call getin_p("aeroco2",aeroco2) 480 write(*,*)" aeroco2 = ",aeroco2 481 482 write(*,*)"Fixed CO2 aerosol distribution?" 483 aerofixco2=.false. ! default value 484 call getin_p("aerofixco2",aerofixco2) 485 write(*,*)" aerofixco2 = ",aerofixco2 486 487 write(*,*)"Radiatively active water ice?" 488 aeroh2o=.false. ! default value 489 call getin_p("aeroh2o",aeroh2o) 490 write(*,*)" aeroh2o = ",aeroh2o 491 492 write(*,*)"Fixed H2O aerosol distribution?" 493 aerofixh2o=.false. ! default value 494 call getin_p("aerofixh2o",aerofixh2o) 495 write(*,*)" aerofixh2o = ",aerofixh2o 496 497 write(*,*)"Radiatively active sulfuric acid aersols?" 498 aeroh2so4=.false. ! default value 499 call getin_p("aeroh2so4",aeroh2so4) 500 write(*,*)" aeroh2so4 = ",aeroh2so4 501 388 502 389 !================================= 503 390 … … 553 440 !================================= 554 441 555 write(*,*)"Cloud pressure level (with kastprof only):"556 cloudlvl=0. ! default value557 call getin_p("cloudlvl",cloudlvl)558 write(*,*)" cloudlvl = ",cloudlvl559 560 write(*,*)"Is the variable gas species radiatively active?"561 Tstrat=167.0562 varactive=.false.563 call getin_p("varactive",varactive)564 write(*,*)" varactive = ",varactive565 566 write(*,*)"Is the variable gas species distribution set?"567 varfixed=.false.568 call getin_p("varfixed",varfixed)569 write(*,*)" varfixed = ",varfixed570 571 442 write(*,*)"What is the saturation % of the variable species?" 572 443 satval=0.8 … … 574 445 write(*,*)" satval = ",satval 575 446 576 577 ! Test of incompatibility:578 ! if varactive, then varfixed should be false579 if (varactive.and.varfixed) then580 print*,'if varactive, varfixed must be OFF!'581 stop582 endif583 584 447 write(*,*) "Gravitationnal sedimentation ?" 585 448 sedimentation=.false. ! default value 586 449 call getin_p("sedimentation",sedimentation) 587 write(*,*) " sedimentation = ",sedimentation 588 589 write(*,*) "Compute water cycle ?" 590 water=.false. ! default value 591 call getin_p("water",water) 592 write(*,*) " water = ",water 593 594 ! Test of incompatibility: 595 ! if water is true, there should be at least a tracer 596 if (water.and.(.not.tracer)) then 597 print*,'if water is ON, tracer must be ON too!' 598 stop 599 endif 600 601 write(*,*) "Include water condensation ?" 602 watercond=.false. ! default value 603 call getin_p("watercond",watercond) 604 write(*,*) " watercond = ",watercond 605 606 ! Test of incompatibility: 607 ! if watercond is used, then water should be used too 608 if (watercond.and.(.not.water)) then 609 print*,'if watercond is used, water should be used too' 610 stop 611 endif 612 613 write(*,*) "Include water precipitation ?" 614 waterrain=.false. ! default value 615 call getin_p("waterrain",waterrain) 616 write(*,*) " waterrain = ",waterrain 617 618 write(*,*) "Include surface hydrology ?" 619 hydrology=.false. ! default value 620 call getin_p("hydrology",hydrology) 621 write(*,*) " hydrology = ",hydrology 622 623 write(*,*) "Evolve surface water sources ?" 624 sourceevol=.false. ! default value 625 call getin_p("sourceevol",sourceevol) 626 write(*,*) " sourceevol = ",sourceevol 627 628 write(*,*) "Ice evolution timestep ?" 629 icetstep=100.0 ! default value 630 call getin_p("icetstep",icetstep) 631 write(*,*) " icetstep = ",icetstep 632 633 write(*,*) "Spectral Dependant albedo ?" 634 albedo_spectral_mode=.false. ! default value 635 call getin_p("albedo_spectral_mode",albedo_spectral_mode) 636 write(*,*) " albedo_spectral_mode = ",albedo_spectral_mode 637 638 write(*,*) "Snow albedo ?" 639 write(*,*) "If albedo_spectral_mode=.true., then this " 640 write(*,*) "corresponds to the 0.5 microns snow albedo." 641 albedosnow=0.5 ! default value 642 call getin_p("albedosnow",albedosnow) 643 write(*,*) " albedosnow = ",albedosnow 644 645 write(*,*) "CO2 ice albedo ?" 646 albedoco2ice=0.5 ! default value 647 call getin_p("albedoco2ice",albedoco2ice) 648 write(*,*) " albedoco2ice = ",albedoco2ice 649 650 write(*,*) "Maximum ice thickness ?" 651 maxicethick=2.0 ! default value 652 call getin_p("maxicethick",maxicethick) 653 write(*,*) " maxicethick = ",maxicethick 654 655 write(*,*) "Freezing point of seawater ?" 656 Tsaldiff=-1.8 ! default value 657 call getin_p("Tsaldiff",Tsaldiff) 658 write(*,*) " Tsaldiff = ",Tsaldiff 450 write(*,*) " sedimentation = ",sedimentation 659 451 660 452 write(*,*) "Does user want to force cpp and mugaz?" -
trunk/LMDZ.TITAN/libf/phytitan/initracer.F
r1621 r1647 3 3 use surfdat_h 4 4 USE tracer_h 5 USE callkeys_mod, only: water6 5 IMPLICIT NONE 7 6 c======================================================================= … … 25 24 26 25 ! real qsurf(ngrid,nq) ! tracer on surface (e.g. kg.m-2) 27 ! real co2ice(ngrid) ! co2 ice mass on surface (e.g. kg.m-2)28 26 character(len=20) :: txt ! to store some text 29 27 integer iq,ig,count … … 40 38 c alpha_lift(nq) ! saltation vertical flux/horiz flux ratio (m-1) 41 39 c alpha_devil(nq) ! lifting coeeficient by dust devil 42 c rho_dust ! Mars dust density43 c rho_ice ! Water ice density44 40 c doubleq ! if method with mass (iq=1) and number(iq=2) mixing ratio 45 41 c varian ! Characteristic variance of log-normal distribution … … 76 72 ! 0. initialize tracer indexes to zero: 77 73 ! NB: igcm_* indexes are commons in 'tracer.h' 78 do iq=1,nq79 igcm_dustbin(iq)=080 enddo81 igcm_dust_mass=082 igcm_dust_number=083 igcm_h2o_vap=084 igcm_h2o_ice=085 igcm_co2=086 74 igcm_co=0 87 75 igcm_o=0 … … 97 85 igcm_ar=0 98 86 igcm_ar_n2=0 99 igcm_co2_ice=0100 87 101 88 write(*,*) 'initracer: noms() ', noms … … 133 120 ! endif ! of if (doubleq) 134 121 ! 2. find chemistry and water tracers 135 do iq=1,nq 136 if (noms(iq).eq."co2") then 137 igcm_co2=iq 138 mmol(igcm_co2)=44. 139 count=count+1 140 ! write(*,*) 'co2: count=',count 141 endif 142 if (noms(iq).eq."co2_ice") then 143 igcm_co2_ice=iq 144 mmol(igcm_co2_ice)=44. 145 count=count+1 146 ! write(*,*) 'co2_ice: count=',count 147 endif 148 if (noms(iq).eq."h2o_vap") then 149 igcm_h2o_vap=iq 150 mmol(igcm_h2o_vap)=18. 151 count=count+1 152 ! write(*,*) 'h2o_vap: count=',count 153 endif 154 if (noms(iq).eq."h2o_ice") then 155 igcm_h2o_ice=iq 156 mmol(igcm_h2o_ice)=18. 157 count=count+1 158 ! write(*,*) 'h2o_ice: count=',count 159 endif 160 enddo ! of do iq=1,nq 161 122 162 123 ! check that we identified all tracers: 163 124 if (count.ne.nq) then … … 181 142 call zerophys(nq,rho_q) 182 143 183 rho_dust=2500. ! Mars dust density (kg.m-3)184 rho_ice=920. ! Water ice density (kg.m-3)185 rho_co2=1620. ! CO2 ice density (kg.m-3)186 187 188 189 c$$$ if (doubleq) then190 c$$$c "doubleq" technique191 c$$$c -------------------192 c$$$c (transport of mass and number mixing ratio)193 c$$$c iq=1: Q mass mixing ratio, iq=2: N number mixing ratio194 c$$$195 c$$$ if( (nq.lt.2).or.(water.and.(nq.lt.3)) ) then196 c$$$ write(*,*)'initracer: nq is too low : nq=', nq197 c$$$ write(*,*)'water= ',water,' doubleq= ',doubleq198 c$$$ end if199 c$$$200 c$$$ varian=0.637 ! Characteristic variance201 c$$$ qext(igcm_dust_mass)=3.04 ! reference extinction at 0.67 um for ref dust202 c$$$ qext(igcm_dust_number)=3.04 ! reference extinction at 0.67 um for ref dust203 c$$$ rho_q(igcm_dust_mass)=rho_dust204 c$$$ rho_q(igcm_dust_number)=rho_dust205 c$$$206 c$$$c Intermediate calcul for computing geometric mean radius r0207 c$$$c as a function of mass and number mixing ratio Q and N208 c$$$c (r0 = (r3n_q * Q/ N)209 c$$$ r3n_q = exp(-4.5*varian**2)*(3./4.)/(pi*rho_dust)210 c$$$211 c$$$c Intermediate calcul for computing effective radius reff212 c$$$c from geometric mean radius r0213 c$$$c (reff = ref_r0 * r0)214 c$$$ ref_r0 = exp(2.5*varian**2)215 c$$$216 c$$$c lifted dust :217 c$$$c '''''''''''218 c$$$ reff_lift = 3.e-6 ! Effective radius of lifted dust (m)219 c$$$ alpha_devil(igcm_dust_mass)=9.e-9 ! dust devil lift mass coeff220 c$$$ alpha_lift(igcm_dust_mass)=3.0e-15 ! Lifted mass coeff221 c$$$222 c$$$ r0_lift = reff_lift/ref_r0223 c$$$ alpha_devil(igcm_dust_number)=r3n_q*224 c$$$ & alpha_devil(igcm_dust_mass)/r0_lift**3225 c$$$ alpha_lift(igcm_dust_number)=r3n_q*226 c$$$ & alpha_lift(igcm_dust_mass)/r0_lift**3227 c$$$228 c$$$c Not used:229 c$$$ radius(igcm_dust_mass) = 0.230 c$$$ radius(igcm_dust_number) = 0.231 c$$$232 c$$$ else233 234 235 c$$$ if (dustbin.gt.1) then236 c$$$ print*,'ATTENTION:',237 c$$$ $ ' properties of dust need input in initracer !!!'238 c$$$ stop239 c$$$240 c$$$ else if (dustbin.eq.1) then241 c$$$242 c$$$c This will be used for 1 dust particle size:243 c$$$c ------------------------------------------244 c$$$ radius(igcm_dustbin(1))=3.e-6245 c$$$ Qext(igcm_dustbin(1))=3.04246 c$$$ alpha_lift(igcm_dustbin(1))=0.0e-6247 c$$$ alpha_devil(igcm_dustbin(1))=7.65e-9248 c$$$ qextrhor(igcm_dustbin(1))=(3./4.)*Qext(igcm_dustbin(1))249 c$$$ & /(rho_dust*radius(igcm_dustbin(1)))250 c$$$ rho_q(igcm_dustbin(1))=rho_dust251 c$$$252 c$$$ endif253 c$$$! end if ! (doubleq)254 255 c Initialization for water vapor256 c ------------------------------257 if(water) then258 radius(igcm_h2o_vap)=0.259 Qext(igcm_h2o_vap)=0.260 alpha_lift(igcm_h2o_vap) =0.261 alpha_devil(igcm_h2o_vap)=0.262 qextrhor(igcm_h2o_vap)= 0.263 264 c "Dryness coefficient" controlling the evaporation and265 c sublimation from the ground water ice (close to 1)266 c HERE, the goal is to correct for the fact267 c that the simulated permanent water ice polar caps268 c is larger than the actual cap and the atmospheric269 c opacity not always realistic.270 271 272 ! if(ngrid.eq.1)273 274 275 ! to be modified for BC+ version?276 277 !! this is defined in surfdat_h.F90278 IF (.not.ALLOCATED(dryness)) ALLOCATE(dryness(ngrid))279 IF (.not.ALLOCATED(watercaptag)) ALLOCATE(watercaptag(ngrid))280 281 do ig=1,ngrid282 if (ngrid.ne.1) watercaptag(ig)=.false.283 dryness(ig) = 1.284 enddo285 286 287 288 289 ! IF (caps) THEN290 c Perennial H20 north cap defined by watercaptag=true (allows surface to be291 c hollowed by sublimation in vdifc).292 ! do ig=1,ngrid293 ! if (lati(ig)*180./pi.gt.84) then294 ! if (ngrid.ne.1) watercaptag(ig)=.true.295 ! dryness(ig) = 1.296 c Use the following cap definition for high spatial resolution (latitudinal bin <= 5 deg)297 c if (lati(ig)*180./pi.lt.85.and.long(ig).ge.0) then298 c if (ngrid.ne.1) watercaptag(ig)=.true.299 c dryness(ig) = 1.300 c endif301 c if (lati(ig)*180./pi.ge.85) then302 c if (ngrid.ne.1) watercaptag(ig)=.true.303 c dryness(ig) = 1.304 c endif305 ! endif ! (lati>80 deg)306 ! end do ! (ngrid)307 ! ENDIF ! (caps)308 309 ! if(iceparty.and.(nq.ge.2)) then310 311 radius(igcm_h2o_ice)=3.e-6312 rho_q(igcm_h2o_ice)=rho_ice313 Qext(igcm_h2o_ice)=0.314 ! alpha_lift(igcm_h2o_ice) =0.315 ! alpha_devil(igcm_h2o_ice)=0.316 qextrhor(igcm_h2o_ice)= (3./4.)*Qext(igcm_h2o_ice)317 $ / (rho_ice*radius(igcm_h2o_ice))318 319 320 321 ! elseif(iceparty.and.(nq.lt.2)) then322 ! write(*,*) 'nq is too low : nq=', nq323 ! write(*,*) 'water= ',water,' iceparty= ',iceparty324 ! endif325 326 end if ! (water)327 144 328 145 c Output for records: -
trunk/LMDZ.TITAN/libf/phytitan/iostart.F90
r1621 r1647 15 15 INTEGER,SAVE :: idim6 ! "nlayer" dimension 16 16 INTEGER,SAVE :: idim7 ! "Time" dimension 17 INTEGER,SAVE :: idim8 ! "ocean_layers" dimension18 17 INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields) 19 18 !$OMP THREADPRIVATE(idim1,idim2,idim3,idim4,idim5,idim6,idim7,timeindex) … … 469 468 USE tracer_h, only: nqtot 470 469 USE comsoil_h, only: nsoilmx 471 USE slab_ice_h, only: noceanmx472 470 473 471 IMPLICIT NONE … … 558 556 ENDIF 559 557 560 ierr=NF90_DEF_DIM(nid_restart,"ocean_layers",noceanmx,idim8)561 IF (ierr/=NF90_NOERR) THEN562 write(*,*)'open_restartphy: problem defining oceanic layer dimension '563 write(*,*)trim(nf90_strerror(ierr))564 CALL ABORT565 ENDIF566 567 568 558 ierr=NF90_ENDDEF(nid_restart) 569 559 IF (ierr/=NF90_NOERR) THEN … … 646 636 USE mod_grid_phy_lmdz 647 637 USE mod_phys_lmdz_para 648 USE slab_ice_h, only: noceanmx649 638 IMPLICIT NONE 650 639 CHARACTER(LEN=*),INTENT(IN) :: field_name … … 832 821 endif ! of if (.not.present(time)) 833 822 834 ELSE IF (field_size==noceanmx) THEN835 ! input is a 2D "oceanic field" array836 if (.not.present(time)) then ! for a time-independent field837 ierr = NF90_REDEF(nid_restart)838 #ifdef NC_DOUBLE839 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,&840 (/idim2,idim8/),nvarid)841 #else842 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,&843 (/idim2,idim8/),nvarid)844 #endif845 if (ierr.ne.NF90_NOERR) then846 write(*,*)"put_field_rgen error: failed to define "//trim(field_name)847 write(*,*)trim(nf90_strerror(ierr))848 endif849 IF (LEN_TRIM(title) > 0) ierr=NF90_PUT_ATT(nid_restart,nvarid,"title",title)850 ierr = NF90_ENDDEF(nid_restart)851 ierr = NF90_PUT_VAR(nid_restart,nvarid,field_glo)852 else853 ! check if the variable has already been defined:854 ierr=NF90_INQ_VARID(nid_restart,field_name,nvarid)855 if (ierr/=NF90_NOERR) then ! variable not found, define it856 ierr=NF90_REDEF(nid_restart)857 #ifdef NC_DOUBLE858 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,&859 (/idim2,idim8,idim7/),nvarid)860 #else861 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,&862 (/idim2,idim8,idim7/),nvarid)863 #endif864 if (ierr.ne.NF90_NOERR) then865 write(*,*)"put_field_rgen error: failed to define "//trim(field_name)866 write(*,*)trim(nf90_strerror(ierr))867 endif868 IF (LEN_TRIM(title) > 0) ierr=NF90_PUT_ATT(nid_restart,nvarid,"title",title)869 ierr=NF90_ENDDEF(nid_restart)870 endif871 ! Write the variable872 ierr=NF90_PUT_VAR(nid_restart,nvarid,field_glo,&873 start=(/1,1,timeindex/))874 875 endif ! of if (.not.present(time))876 877 878 823 ELSE 879 824 PRINT *, "Error phyredem(put_field_rgen) : wrong dimension for ",trim(field_name) … … 948 893 USE comsoil_h, only: nsoilmx 949 894 USE mod_phys_lmdz_para, only: is_master 950 USE slab_ice_h, only: noceanmx951 895 IMPLICIT NONE 952 896 CHARACTER(LEN=*),INTENT(IN) :: var_name … … 1000 944 ! We know it is an "mlayer" kind of 1D array 1001 945 idim1d=idim3 1002 ELSEIF (var_size==noceanmx) THEN1003 ! We know it is an "mlayer" kind of 1D array1004 idim1d=idim81005 946 ELSE 1006 947 PRINT *, "put_var_rgen error : wrong dimension" -
trunk/LMDZ.TITAN/libf/phytitan/mass_redistribution.F90
r1542 r1647 1 1 SUBROUTINE mass_redistribution(ngrid,nlayer,nq,ptimestep, & 2 rnat,pcapcal,pplay,pplev,pt,ptsrf,pq,pqs, &2 pcapcal,pplay,pplev,pt,ptsrf,pq,pqs, & 3 3 pu,pv,pdt,pdtsrf,pdq,pdu,pdv,pdmassmr, & 4 4 pdtmr,pdtsrfmr,pdpsrfmr,pdumr,pdvmr,pdqmr,pdqsmr) 5 5 6 USE watercommon_h, Only: Tsat_water,RLVTT7 6 use surfdat_h 8 7 use radcommon_h, only: glat … … 10 9 USE planete_mod, only: bp 11 10 use comcstfi_mod, only: g 12 USE callkeys_mod, ONLY: water13 11 14 12 IMPLICIT NONE … … 57 55 INTEGER ngrid, nlayer, nq 58 56 REAL ptimestep 59 REAL pcapcal(ngrid) 60 INTEGER rnat(ngrid) 57 REAL pcapcal(ngrid) 61 58 REAL pplay(ngrid,nlayer),pplev(ngrid,nlayer+1) 62 59 REAL pt(ngrid,nlayer),pdt(ngrid,nlayer) … … 76 73 77 74 ! Boiling/sublimation 78 REAL Tsat(ngrid),zmassboil(ngrid)75 REAL zmassboil(ngrid) 79 76 80 77 ! vertical reorganization of sigma levels … … 132 129 133 130 134 if (water) then135 do ig=1,ngrid136 call Tsat_water(pplev(ig,1)+zdmass_sum(ig,1)*g*ptimestep,Tsat(ig))137 enddo138 call writediagfi(ngrid,'Tsat','saturation temperature at surface','',2,Tsat)139 140 do ig=1,ngrid141 if (ztsrf(ig).gt.Tsat(ig)) then142 zmassboil(ig)=(ptsrf(ig)-Tsat(ig))*pcapcal(ig)/RLVTT/ptimestep143 if ((zmassboil(ig)*ptimestep.gt.pqs(ig,igcm_h2o_vap)).and.(rnat(ig).eq.1)) then144 zmassboil(ig)=pqs(ig,igcm_h2o_vap)/ptimestep145 endif146 zmassboil(ig)=zmassboil(ig)*0.0 !momentary, should be 1. JL12147 pdqsmr(ig,igcm_h2o_vap)=-zmassboil(ig)148 pdtsrfmr(ig)=-zmassboil(ig)*RLVTT/pcapcal(ig)149 ztsrf(ig)=ptsrf(ig)+pdtsrfmr(ig)*ptimestep150 else151 zmassboil(ig)=0.152 pdtsrfmr(ig)=0.153 endif154 enddo155 endif156 157 131 ! ************************* 158 132 ! UPDATE SURFACE … … 219 193 zvm(1) = 0. 220 194 zqm(1,1:nq)=0. ! most tracer do not condense ! 221 if (water) zqm(1,igcm_h2o_vap)=1. ! flux is 100% h2o at surface222 195 223 196 ! Van Leer scheme: -
trunk/LMDZ.TITAN/libf/phytitan/optci.F90
r1397 r1647 7 7 use gases_h 8 8 use comcstfi_mod, only: g, r, mugaz 9 use callkeys_mod, only: kastprof,continuum,graybody,H2Ocont_simple9 use callkeys_mod, only: continuum,graybody 10 10 implicit none 11 11 … … 77 77 integer interm 78 78 79 !--- Kasting's CIA ----------------------------------------80 !real*8, parameter :: Ci(L_NSPECTI)=[ &81 ! 3.8E-5, 1.2E-5, 2.8E-6, 7.6E-7, 4.5E-7, 2.3E-7, &82 ! 5.4E-7, 1.6E-6, 0.0, &83 ! 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &84 ! 0.0, 4.0E-7, 4.0E-6, 1.4E-5, &85 ! 1.0E-5, 1.2E-6, 2.0E-7, 5.0E-8, 3.0E-8, 0.0 ]86 !real*8, parameter :: Ti(L_NSPECTI)=[ -2.2, -1.9, &87 ! -1.7, -1.7, -1.7, -1.7, -1.7, -1.7, &88 ! 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, &89 ! -1.7,-1.7,-1.7,-1.7,-1.7,-1.7,-1.7, -1.7,0.0 ]90 !----------------------------------------------------------91 92 79 !! AS: to save time in computing continuum (see bilinearbig) 93 80 IF (.not.ALLOCATED(indi)) THEN … … 107 94 DPR(k) = PLEV(K)-PLEV(K-1) 108 95 109 !--- Kasting's CIA ----------------------------------------110 !dz(k)=dpr(k)*189.02*TMID(K)/(0.03720*PMID(K))111 ! this is CO2 path length (in cm) as written by Francois112 ! delta_z = delta_p * R_specific * T / (g * P)113 ! But Kasting states that W is in units of _atmosphere_ cm114 ! So we do115 !dz(k)=dz(k)*(PMID(K)/1013.25)116 !dz(k)=dz(k)/100.0 ! in m for SI calc117 !----------------------------------------------------------118 119 96 ! if we have continuum opacities, we need dz 120 if(kastprof)then 121 dz(k) = dpr(k)*(1000.0d0*8.3145d0/muvar(k))*TMID(K)/(g*PMID(K)) 122 U(k) = Cmk*DPR(k)*mugaz/muvar(k) 123 else 124 dz(k) = dpr(k)*R*TMID(K)/(glat_ig*PMID(K))*mugaz/muvar(k) 125 U(k) = Cmk*DPR(k)*mugaz/muvar(k) ! only Cmk line in optci.F 97 dz(k) = dpr(k)*R*TMID(K)/(glat_ig*PMID(K))*mugaz/muvar(k) 98 U(k) = Cmk*DPR(k)*mugaz/muvar(k) ! only Cmk line in optci.F 126 99 !JL13 the mugaz/muvar factor takes into account water meanmolecular weight if water is present 127 endif128 100 129 101 call tpindex(PMID(K),TMID(K),QVAR(K),pfgasref,tgasref,WREFVAR, & … … 185 157 call interpolateN2H2(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm) 186 158 indi(nw,igas,jgas) = interm 187 elseif(jgas.eq.igas_He)then188 interm = indi(nw,igas,jgas)189 call interpolateH2He(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm)190 indi(nw,igas,jgas) = interm191 159 endif 192 160 dtemp = dtemp + dtempc 193 161 enddo 194 195 elseif(igas.eq.igas_H2O.and.T_cont.gt.200.0)then196 197 p_air = dble(PMID(k)*scalep) - p_cont ! note assumes background is air!198 if(H2Ocont_simple)then199 call interpolateH2Ocont_PPC(wn_cont,T_cont,p_cont,p_air,dtemp,.false.)200 else201 interm = indi(nw,igas,igas)202 call interpolateH2Ocont_CKD(wn_cont,T_cont,p_cont,p_air,dtemp,.false.,interm)203 indi(nw,igas,igas) = interm204 endif205 162 206 163 endif -
trunk/LMDZ.TITAN/libf/phytitan/optcv.F90
r1397 r1647 7 7 use gases_h 8 8 use comcstfi_mod, only: g, r, mugaz 9 use callkeys_mod, only: kastprof,continuum,graybody,H2Ocont_simple,callgasvis9 use callkeys_mod, only: continuum,graybody,callgasvis 10 10 11 11 implicit none … … 106 106 107 107 ! if we have continuum opacities, we need dz 108 if(kastprof)then 109 dz(k) = dpr(k)*(1000.0d0*8.3145d0/muvar(k))*TMID(K)/(g*PMID(K)) 110 U(k) = Cmk*DPR(k)*mugaz/muvar(k) 111 else 112 dz(k) = dpr(k)*R*TMID(K)/(glat_ig*PMID(K))*mugaz/muvar(k) 113 U(k) = Cmk*DPR(k)*mugaz/muvar(k) ! only Cmk line in optci.F 114 !JL13 the mugaz/muvar factor takes into account water meanmolecular weight if water is present 115 endif 108 109 dz(k) = dpr(k)*R*TMID(K)/(glat_ig*PMID(K))*mugaz/muvar(k) 110 U(k) = Cmk*DPR(k)*mugaz/muvar(k) ! only Cmk line in optci.F 111 !JL13 the mugaz/muvar factor takes into account water meanmolecular weight if water is present 112 116 113 117 114 call tpindex(PMID(K),TMID(K),QVAR(K),pfgasref,tgasref,WREFVAR, & … … 186 183 indv(nw,igas,jgas) = interm 187 184 ! should be irrelevant in the visible 188 elseif(jgas.eq.igas_He)then189 interm = indv(nw,igas,jgas)190 call interpolateH2He(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm)191 indv(nw,igas,jgas) = interm192 185 endif 193 186 dtemp = dtemp + dtempc 194 187 enddo 195 196 elseif(igas.eq.igas_H2O.and.T_cont.gt.200.0)then197 198 p_air = dble(PMID(k)*scalep) - p_cont ! note assumes background is air!199 if(H2Ocont_simple)then200 call interpolateH2Ocont_PPC(wn_cont,T_cont,p_cont,p_air,dtemp,.false.)201 else202 interm = indv(nw,igas,igas)203 call interpolateH2Ocont_CKD(wn_cont,T_cont,p_cont,p_air,dtemp,.false.,interm)204 indv(nw,igas,igas) = interm205 endif206 188 207 189 endif -
trunk/LMDZ.TITAN/libf/phytitan/phyetat0.F90
r1621 r1647 1 1 subroutine phyetat0 (ngrid,nlayer,fichnom,tab0,Lmodif,nsoil,nq, & 2 2 day_ini,time,tsurf,tsoil, & 3 emis,q2,qsurf,cloudfrac,totcloudfrac,hice, & 4 rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 3 emis,q2,qsurf) 5 4 6 5 … … 10 9 get_field, get_var, inquire_field, & 11 10 inquire_dimension, inquire_dimension_length 12 use slab_ice_h, only: noceanmx13 use callkeys_mod, only: CLFvarying14 11 15 12 implicit none … … 45 42 real,intent(out) :: q2(ngrid,nlayer+1) ! 46 43 real,intent(out) :: qsurf(ngrid,nq) ! tracers on surface 47 ! real co2ice(ngrid) ! co2 ice cover48 real,intent(out) :: cloudfrac(ngrid,nlayer)49 real,intent(out) :: hice(ngrid), totcloudfrac(ngrid)50 real,intent(out) :: pctsrf_sic(ngrid),tslab(ngrid,noceanmx)51 real,intent(out) :: tsea_ice(ngrid),sea_ice(ngrid)52 real,intent(out) :: rnat(ngrid)53 44 54 45 !====================================================================== … … 56 47 57 48 ! INTEGER radpas 58 ! REAL co2_ppm59 49 ! REAL solaire 60 50 … … 250 240 minval(emis), maxval(emis) 251 241 endif 252 253 ! Cloud fraction (added by BC 2010)254 if (CLFvarying) then255 call get_field("cloudfrac",cloudfrac,found,indextime)256 if (.not.found) then257 write(*,*) "phyetat0: Failed loading <cloudfrac>"258 call abort259 else260 write(*,*) "phyetat0: Cloud fraction <cloudfrac> range:", &261 minval(cloudfrac), maxval(cloudfrac)262 endif263 else264 cloudfrac(:,:)=0.0265 endif266 267 ! Total cloud fraction (added by BC 2010)268 if (CLFvarying) then269 call get_field("totcloudfrac",totcloudfrac,found,indextime)270 if (.not.found) then271 write(*,*) "phyetat0: Failed loading <totcloudfrac>"272 call abort273 else274 write(*,*) "phyetat0: Total cloud fraction <totcloudfrac> range:", &275 minval(totcloudfrac), maxval(totcloudfrac)276 endif277 else278 totcloudfrac(:)=0.0279 endif280 281 ! Height of oceanic ice (added by BC 2010)282 call get_field("hice",hice,found,indextime)283 if (.not.found) then284 write(*,*) "phyetat0: Failed loading <hice>"285 ! call abort286 do ig=1,ngrid287 hice(ig)=0.288 enddo289 else290 write(*,*) "phyetat0: Height of oceanic ice <hice> range:", &291 minval(hice), maxval(hice)292 endif293 294 ! SLAB OCEAN (added by BC 2014)295 ! nature of the surface296 call get_field("rnat",rnat,found,indextime)297 if (.not.found) then298 write(*,*) "phyetat0: Failed loading <rnat>"299 do ig=1,ngrid300 rnat(ig)=1.301 enddo302 else303 do ig=1,ngrid304 if((nint(rnat(ig)).eq.2).or.(nint(rnat(ig)).eq.0))then305 rnat(ig)=0.306 else307 rnat(ig)=1.308 endif309 enddo310 311 write(*,*) "phyetat0: Nature of surface <rnat> range:", &312 minval(rnat), maxval(rnat)313 endif314 ! Pourcentage of sea ice cover315 call get_field("pctsrf_sic",pctsrf_sic,found,indextime)316 if (.not.found) then317 write(*,*) "phyetat0: Failed loading <pctsrf_sic>"318 do ig=1,ngrid319 pctsrf_sic(ig)=0.320 enddo321 else322 write(*,*) "phyetat0: Pourcentage of sea ice cover <pctsrf_sic> range:", &323 minval(pctsrf_sic), maxval(pctsrf_sic)324 endif325 ! Slab ocean temperature (2 layers)326 call get_field("tslab",tslab,found,indextime)327 if (.not.found) then328 write(*,*) "phyetat0: Failed loading <tslab>"329 do ig=1,ngrid330 do iq=1,noceanmx331 tslab(ig,iq)=tsurf(ig)332 enddo333 enddo334 else335 write(*,*) "phyetat0: Slab ocean temperature <tslab> range:", &336 minval(tslab), maxval(tslab)337 endif338 ! Oceanic ice temperature339 call get_field("tsea_ice",tsea_ice,found,indextime)340 if (.not.found) then341 write(*,*) "phyetat0: Failed loading <tsea_ice>"342 do ig=1,ngrid343 tsea_ice(ig)=273.15-1.8344 enddo345 else346 write(*,*) "phyetat0: Oceanic ice temperature <tsea_ice> range:", &347 minval(tsea_ice), maxval(tsea_ice)348 endif349 ! Oceanic ice quantity (kg/m^2)350 call get_field("sea_ice",sea_ice,found,indextime)351 if (.not.found) then352 write(*,*) "phyetat0: Failed loading <sea_ice>"353 do ig=1,ngrid354 tsea_ice(ig)=0.355 enddo356 else357 write(*,*) "phyetat0: Oceanic ice quantity <sea_ice> range:", &358 minval(sea_ice), maxval(sea_ice)359 endif360 361 362 363 242 364 243 ! pbl wind variance -
trunk/LMDZ.TITAN/libf/phytitan/phyredem.F90
r1621 r1647 135 135 136 136 subroutine physdem1(filename,nsoil,ngrid,nlay,nq, & 137 phystep,time,tsurf,tsoil,emis,q2,qsurf, & 138 cloudfrac,totcloudfrac,hice, & 139 rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 137 phystep,time,tsurf,tsoil,emis,q2,qsurf) 140 138 ! write time-dependent variable to restart file 141 139 use iostart, only : open_restartphy, close_restartphy, & 142 140 put_var, put_field 143 141 use tracer_h, only: noms 144 use slab_ice_h, only: noceanmx145 use callkeys_mod, only: ok_slab_ocean146 142 147 143 implicit none … … 159 155 real,intent(in) :: q2(ngrid,nlay+1) 160 156 real,intent(in) :: qsurf(ngrid,nq) 161 real,intent(in) :: cloudfrac(ngrid,nlay)162 real,intent(in) :: totcloudfrac(ngrid)163 real,intent(in) :: hice(ngrid)164 real,intent(in) :: rnat(ngrid)165 real,intent(in) :: pctsrf_sic(ngrid)166 real,intent(in) :: tslab(ngrid,noceanmx)167 real,intent(in) :: tsea_ice(ngrid)168 real,intent(in) :: sea_ice(ngrid)169 157 170 158 integer :: iq … … 189 177 call put_field("q2","pbl wind variance",q2) 190 178 191 ! cloud fraction and sea ice (NB: these should be optional... to be improved)192 call put_field("cloudfrac","Cloud fraction",cloudfrac)193 call put_field("totcloudfrac","Total fraction",totcloudfrac)194 call put_field("hice","Height of oceanic ice",hice)195 196 !Slab ocean197 if(ok_slab_ocean) then198 call put_field("rnat","Nature of surface",rnat)199 call put_field("pctsrf_sic","Pourcentage sea ice",pctsrf_sic)200 call put_field("tslab","Temperature slab ocean",tslab)201 call put_field("tsea_ice","Temperature sea ice",tsea_ice)202 call put_field("sea_ice","Sea ice mass",sea_ice)203 endif!(ok_slab_ocean)204 205 206 179 ! tracers 207 180 if (nq>0) then -
trunk/LMDZ.TITAN/libf/phytitan/physiq_mod.F90
r1637 r1647 15 15 16 16 use radinc_h, only : L_NSPECTI,L_NSPECTV,naerkind 17 use watercommon_h, only : RLVTT, Psat_water,epsi18 17 use gases_h, only: gnom, gfrac 19 18 use radcommon_h, only: sigma, glat, grav, BWNV 20 use radii_mod, only: h2o_reffrad, co2_reffrad 21 use aerosol_mod, only: iaero_co2, iaero_h2o 22 use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe, & 23 dryness, watercaptag 19 use surfdat_h, only: phisfi, zmea, zstd, zsig, zgam, zthe 24 20 use comdiurn_h, only: coslat, sinlat, coslon, sinlon 25 21 use comsaison_h, only: mu0, fract, dist_star, declin, right_ascen … … 29 25 USE tracer_h, only: noms, mmol, radius, rho_q, qext, & 30 26 alpha_lift, alpha_devil, qextrhor, & 31 igcm_h2o_ice, igcm_h2o_vap, igcm_dustbin, & 32 igcm_co2_ice 27 igcm_dustbin 33 28 use time_phylmdz_mod, only: ecritphy, iphysiq, nday 34 29 use phyredem, only: physdem0, physdem1 35 use slab_ice_h, only: capcalocean, capcalseaice,capcalsno, &36 noceanmx37 use ocean_slab_mod, only :ocean_slab_init, ocean_slab_ice, &38 ini_surf_heat_transp_mod, &39 ocean_slab_get_vars,ocean_slab_final40 use surf_heat_transp_mod,only :init_masquv41 30 use planetwide_mod, only: planetwide_minval,planetwide_maxval,planetwide_sumval 42 31 use mod_phys_lmdz_para, only : is_master … … 81 70 ! IV. Dry Convective adjustment : 82 71 ! 83 ! V. Condensation and sublimation of gases (currently just CO2). 84 ! 85 ! VI. Tracers 86 ! VI.1. Water and water ice. 87 ! VI.2. Aerosols and particles. 88 ! VI.3. Updates (pressure variations, surface budget). 89 ! VI.4. Slab Ocean. 90 ! VI.5. Surface Tracer Update. 91 ! 92 ! VII. Surface and sub-surface soil temperature. 93 ! 94 ! VIII. Perform diagnostics and write output files. 72 ! V. Tracers 73 ! V.1. Aerosols and particles. 74 ! V.2. Updates (pressure variations, surface budget). 75 ! V.3. Surface Tracer Update. 76 ! 77 ! VI. Surface and sub-surface soil temperature. 78 ! 79 ! VII. Perform diagnostics and write output files. 95 80 ! 96 81 ! … … 156 141 ! No more ngridmx/nqmx, F90 commons and adaptation to parallel: A. Spiga (2012) 157 142 ! Purge of the code : M. Turbet (2015) 158 !================================================================== 143 ! Fork for Titan and clean of all too-generic (ocean, water, co2 ...) routines : J. Vatant d'Ollone (2017) 144 !============================================================================================ 159 145 160 146 … … 212 198 real, dimension(:,:),allocatable,save :: albedo ! Surface Spectral albedo. By MT2015. 213 199 real, dimension(:),allocatable,save :: albedo_equivalent ! Spectral Mean albedo. 214 real, dimension(:),allocatable,save :: albedo_snow_SPECTV ! Snow Spectral albedo. 215 real, dimension(:),allocatable,save :: albedo_co2_ice_SPECTV ! CO2 ice Spectral albedo. 216 217 !$OMP THREADPRIVATE(tsurf,tsoil,albedo,albedo_equivalent,albedo_snow_SPECTV,albedo_co2_ice_SPECTV) 200 201 !$OMP THREADPRIVATE(tsurf,tsoil,albedo,albedo_equivalent) 218 202 219 203 real,dimension(:),allocatable,save :: albedo_bareground ! Bare Ground Albedo. By MT 2015. 220 real,dimension(:),allocatable,save :: rnat ! Defines the type of the grid (ocean,continent,...). By BC. 221 222 !$OMP THREADPRIVATE(albedo_bareground,rnat) 204 205 !$OMP THREADPRIVATE(albedo_bareground) 223 206 224 207 real,dimension(:),allocatable,save :: emis ! Thermal IR surface emissivity. … … 276 259 real zdtsurf(ngrid) ! Cumulated tendencies. 277 260 real zdtsurfmr(ngrid) ! Mass_redistribution routine. 278 real zdtsurfc(ngrid) ! Condense_co2 routine.279 261 real zdtsdif(ngrid) ! Turbdiff/vdifc routines. 280 real zdtsurf_hyd(ngrid) ! Hydrol routine.281 262 282 263 ! For Atmospheric Temperatures : (K/s) 283 real dtlscale(ngrid,nlayer) ! Largescale routine. 284 real zdtc(ngrid,nlayer) ! Condense_co2 routine. 285 real zdtdif(ngrid,nlayer) ! Turbdiff/vdifc routines. 264 real zdtdif(ngrid,nlayer) ! Turbdiff/vdifc routines. 286 265 real zdtmr(ngrid,nlayer) ! Mass_redistribution routine. 287 real zdtrain(ngrid,nlayer) ! Rain routine.288 real dtmoist(ngrid,nlayer) ! Moistadj routine.289 real dt_ekman(ngrid,noceanmx), dt_hdiff(ngrid,noceanmx) ! Slab_ocean routine.290 266 real zdtsw1(ngrid,nlayer), zdtlw1(ngrid,nlayer) ! Callcorrk routine. 291 267 292 268 ! For Surface Tracers : (kg/m2/s) 293 269 real dqsurf(ngrid,nq) ! Cumulated tendencies. 294 real zdqsurfc(ngrid) ! Condense_co2 routine.295 270 real zdqsdif(ngrid,nq) ! Turbdiff/vdifc routines. 296 271 real zdqssed(ngrid,nq) ! Callsedim routine. 297 272 real zdqsurfmr(ngrid,nq) ! Mass_redistribution routine. 298 real zdqsrain(ngrid), zdqssnow(ngrid) ! Rain routine.299 real dqs_hyd(ngrid,nq) ! Hydrol routine.300 273 301 274 ! For Tracers : (kg/kg_of_air/s) 302 real zdqc(ngrid,nlayer,nq) ! Condense_co2 routine.303 275 real zdqadj(ngrid,nlayer,nq) ! Convadj routine. 304 276 real zdqdif(ngrid,nlayer,nq) ! Turbdiff/vdifc routines. … … 306 278 real zdqsed(ngrid,nlayer,nq) ! Callsedim routine. 307 279 real zdqmr(ngrid,nlayer,nq) ! Mass_redistribution routine. 308 real zdqrain(ngrid,nlayer,nq) ! Rain routine.309 real dqmoist(ngrid,nlayer,nq) ! Moistadj routine.310 real dqvaplscale(ngrid,nlayer) ! Largescale routine.311 real dqcldlscale(ngrid,nlayer) ! Largescale routine.312 280 313 281 ! For Winds : (m/s/s) … … 359 327 real qcol(ngrid,nq) ! Tracer Column Mass (kg/m2). 360 328 361 ! included by RW for H2O Manabe scheme362 real rneb_man(ngrid,nlayer) ! H2O cloud fraction (moistadj).363 real rneb_lsc(ngrid,nlayer) ! H2O cloud fraction (large scale).364 365 366 329 ! to test energy conservation (RW+JL) 367 330 real mass(ngrid,nlayer),massarea(ngrid,nlayer) … … 371 334 real dEzRadsw(ngrid,nlayer),dEzRadlw(ngrid,nlayer),dEzdiff(ngrid,nlayer) 372 335 real dEdiffs(ngrid),dEdiff(ngrid) 373 real madjdE(ngrid), lscaledE(ngrid),madjdEz(ngrid,nlayer), lscaledEz(ngrid,nlayer)374 336 375 337 !JL12 conservation test for mean flow kinetic energy has been disabled temporarily 376 338 377 real dtmoist_max,dtmoist_min378 339 real dItot, dItot_tmp, dVtot, dVtot_tmp 379 380 real,allocatable,save :: hice(:) ! Oceanic Ice height. by BC 381 !$OMP THREADPRIVATE(hice) 382 383 real h2otot ! Total Amount of water. For diagnostic. 384 real icesrf,liqsrf,icecol,vapcol ! Total Amounts of water (ice,liq,vap). For diagnostic. 340 385 341 real dWtot, dWtot_tmp, dWtots, dWtots_tmp 386 logical,save :: watertest 387 !$OMP THREADPRIVATE(watertest) 388 389 real qsat(ngrid,nlayer) ! Water Vapor Volume Mixing Ratio at saturation (kg/kg_of_air). 390 real RH(ngrid,nlayer) ! Relative humidity. 391 real H2Omaxcol(ngrid) ! Maximum possible H2O column amount (at 100% saturation) (kg/m2). 392 real psat_tmp 393 394 logical clearsky ! For double radiative transfer call. By BC 342 395 343 396 344 ! For Clear Sky Case. … … 400 348 real tau_col1(ngrid) ! For aerosol optical depth diagnostic. 401 349 real OLR_nu1(ngrid,L_NSPECTI), OSR_nu1(ngrid,L_NSPECTV) ! For Outgoing Radiation diagnostics. 402 real tf, ntf 403 404 real,allocatable,dimension(:,:),save :: cloudfrac ! Fraction of clouds (%). 405 real,allocatable,dimension(:),save :: totcloudfrac ! Column fraction of clouds (%). 406 !$OMP THREADPRIVATE(cloudfrac,totcloudfrac) 407 408 real nconsMAX, vdifcncons(ngrid), cadjncons(ngrid) ! Vdfic water conservation test. By RW 350 real tf, ntf 409 351 410 352 real,allocatable,dimension(:,:),save :: qsurf_hist … … 418 360 419 361 real reffcol(ngrid,naerkind) 420 421 ! Sourceevol for 'accelerated ice evolution'. By RW422 real,allocatable,dimension(:),save :: ice_initial423 real delta_ice,ice_tot424 real,allocatable,dimension(:),save :: ice_min425 integer num_run426 logical,save :: ice_update427 !$OMP THREADPRIVATE(ice_initial,ice_min,ice_update)428 429 ! For slab ocean. By BC430 real, dimension(:),allocatable,save :: pctsrf_sic431 real, dimension(:,:),allocatable,save :: tslab432 real, dimension(:),allocatable,save :: tsea_ice433 real, dimension(:),allocatable,save :: sea_ice434 real, dimension(:),allocatable,save :: zmasq435 integer, dimension(:),allocatable,save ::knindex436 !$OMP THREADPRIVATE(pctsrf_sic,tslab,tsea_ice,sea_ice,zmasq,knindex)437 438 real :: tsurf2(ngrid)439 real :: flux_o(ngrid),flux_g(ngrid),fluxgrdocean(ngrid)440 real :: flux_sens_lat(ngrid)441 real :: qsurfint(ngrid,nq)442 362 443 363 … … 457 377 ALLOCATE(tsoil(ngrid,nsoilmx)) 458 378 ALLOCATE(albedo(ngrid,L_NSPECTV)) 459 ALLOCATE(albedo_equivalent(ngrid)) 460 ALLOCATE(albedo_snow_SPECTV(L_NSPECTV)) 461 ALLOCATE(albedo_co2_ice_SPECTV(L_NSPECTV)) 462 ALLOCATE(albedo_bareground(ngrid)) 463 ALLOCATE(rnat(ngrid)) 379 ALLOCATE(albedo_equivalent(ngrid)) 380 ALLOCATE(albedo_bareground(ngrid)) 464 381 ALLOCATE(emis(ngrid)) 465 382 ALLOCATE(dtrad(ngrid,nlayer)) … … 472 389 ALLOCATE(ztprevious(ngrid,nlayer)) 473 390 ALLOCATE(zuprevious(ngrid,nlayer)) 474 ALLOCATE(cloudfrac(ngrid,nlayer))475 ALLOCATE(totcloudfrac(ngrid))476 ALLOCATE(hice(ngrid))477 391 ALLOCATE(qsurf_hist(ngrid,nq)) 478 392 ALLOCATE(reffrad(ngrid,nlayer,naerkind)) 479 393 ALLOCATE(nueffrad(ngrid,nlayer,naerkind)) 480 ALLOCATE(ice_initial(ngrid))481 ALLOCATE(ice_min(ngrid))482 394 ALLOCATE(fluxsurf_lw(ngrid)) 483 395 ALLOCATE(fluxsurf_sw(ngrid)) … … 493 405 ALLOCATE(zdtsw(ngrid,nlayer)) 494 406 ALLOCATE(tau_col(ngrid)) 495 ALLOCATE(pctsrf_sic(ngrid))496 ALLOCATE(tslab(ngrid,noceanmx))497 ALLOCATE(tsea_ice(ngrid))498 ALLOCATE(sea_ice(ngrid))499 ALLOCATE(zmasq(ngrid))500 ALLOCATE(knindex(ngrid))501 407 502 408 ! This is defined in comsaison_h … … 532 438 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 533 439 call phyetat0(ngrid,nlayer,"startfi.nc",0,0,nsoilmx,nq, & 534 day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf, & 535 cloudfrac,totcloudfrac,hice, & 536 rnat,pctsrf_sic,tslab, tsea_ice,sea_ice) 440 day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf) 537 441 538 442 if (pday.ne.day_ini) then … … 550 454 albedo(:,:)=0.0 551 455 albedo_bareground(:)=0.0 552 albedo_snow_SPECTV(:)=0.0 553 albedo_co2_ice_SPECTV(:)=0.0 554 call surfini(ngrid,nq,qsurf,albedo,albedo_bareground,albedo_snow_SPECTV,albedo_co2_ice_SPECTV) 456 call surfini(ngrid,nq,qsurf,albedo,albedo_bareground) 555 457 556 458 ! Initialize orbital calculation. … … 564 466 endif 565 467 566 ! Initialize oceanic variables.567 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~568 569 if (ok_slab_ocean)then570 571 call ocean_slab_init(ngrid,ptimestep, tslab, &572 sea_ice, pctsrf_sic)573 574 call ini_surf_heat_transp_mod()575 576 knindex(:) = 0577 578 do ig=1,ngrid579 zmasq(ig)=1580 knindex(ig) = ig581 if (nint(rnat(ig)).eq.0) then582 zmasq(ig)=0583 endif584 enddo585 586 CALL init_masquv(ngrid,zmasq)587 588 endif ! end of 'ok_slab_ocean'.589 590 468 591 469 ! Initialize soil. … … 595 473 call soil(ngrid,nsoilmx,firstcall,lastcall,inertiedat, & 596 474 ptimestep,tsurf,tsoil,capcal,fluxgrd) 597 598 if (ok_slab_ocean) then599 do ig=1,ngrid600 if (nint(rnat(ig)).eq.2) then601 capcal(ig)=capcalocean602 if (pctsrf_sic(ig).gt.0.5) then603 capcal(ig)=capcalseaice604 if (qsurf(ig,igcm_h2o_ice).gt.0.) then605 capcal(ig)=capcalsno606 endif607 endif608 endif609 enddo610 endif ! end of 'ok_slab_ocean'.611 475 612 476 else ! else of 'callsoil'. … … 620 484 621 485 icount=1 622 623 ! Decide whether to update ice at end of run.624 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~625 ice_update=.false.626 if(sourceevol)then627 !$OMP MASTER628 open(128,file='num_run',form='formatted', &629 status="old",iostat=ierr)630 if (ierr.ne.0) then631 write(*,*) "physiq: Error! No num_run file!"632 write(*,*) " (which is needed for sourceevol option)"633 stop634 endif635 read(128,*) num_run636 close(128)637 !$OMP END MASTER638 !$OMP BARRIER639 640 if(num_run.ne.0.and.mod(num_run,2).eq.0)then641 print*,'Updating ice at end of this year!'642 ice_update=.true.643 ice_min(:)=1.e4644 endif645 646 endif ! end of 'sourceevol'.647 648 649 ! Here is defined the type of the surface : Continent or Ocean.650 ! BC2014 : This is now already done in newstart.651 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~652 if (.not.ok_slab_ocean) then653 654 rnat(:)=1.655 do ig=1,ngrid656 if(inertiedat(ig,1).gt.1.E4)then657 rnat(ig)=0658 endif659 enddo660 661 print*,'WARNING! Surface type currently decided by surface inertia'662 print*,'This should be improved e.g. in newstart.F'663 486 664 endif ! end of 'ok_slab_ocean'.665 666 487 667 488 ! Initialize surface history variable. … … 674 495 zuprevious(:,:)=pu(:,:) 675 496 676 ! Set temperature just above condensation temperature (for Early Mars)677 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~678 if(nearco2cond) then679 write(*,*)' WARNING! Starting at Tcond+1K'680 do l=1, nlayer681 do ig=1,ngrid682 pdt(ig,l)= ((-3167.8)/(log(.01*pplay(ig,l))-23.23)+4 &683 -pt(ig,l)) / ptimestep684 enddo685 enddo686 endif687 497 688 498 if(meanOLR)then … … 691 501 call system('rm -f h2o_bal.out') ! to record global hydrological balance. 692 502 endif 693 694 695 watertest=.false.696 if(water)then ! Initialize variables for water cycle697 698 if(enertest)then699 watertest = .true.700 endif701 702 if(ice_update)then703 ice_initial(:)=qsurf(:,igcm_h2o_ice)704 endif705 706 endif707 708 call su_watercycle ! even if we don't have a water cycle, we might709 ! need epsi for the wvp definitions in callcorrk.F710 503 711 504 if (ngrid.ne.1) then ! Note : no need to create a restart file in 1d. … … 735 528 ! Initialize various variables 736 529 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 737 738 if ( .not.nearco2cond ) then 739 pdt(1:ngrid,1:nlayer) = 0.0 740 endif 530 531 pdt(1:ngrid,1:nlayer) = 0.0 741 532 zdtsurf(1:ngrid) = 0.0 742 533 pdq(1:ngrid,1:nlayer,1:nq) = 0.0 … … 746 537 pdpsrf(1:ngrid) = 0.0 747 538 zflubid(1:ngrid) = 0.0 748 flux_sens_lat(1:ngrid) = 0.0749 539 taux(1:ngrid) = 0.0 750 540 tauy(1:ngrid) = 0.0 … … 870 660 ! II.a Call correlated-k radiative transfer scheme 871 661 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 872 if(kastprof)then 873 print*,'kastprof should not = true here' 874 call abort 875 endif 876 if(water) then 877 muvar(1:ngrid,1:nlayer)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,1:nlayer,igcm_h2o_vap)) 878 muvar(1:ngrid,nlayer+1)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,nlayer,igcm_h2o_vap)) 879 ! take into account water effect on mean molecular weight 880 else 881 muvar(1:ngrid,1:nlayer+1)=mugaz 882 endif 883 884 885 if(ok_slab_ocean) then 886 tsurf2(:)=tsurf(:) 887 do ig=1,ngrid 888 if (nint(rnat(ig))==0) then 889 tsurf(ig)=((1.-pctsrf_sic(ig))*tslab(ig,1)**4+pctsrf_sic(ig)*tsea_ice(ig)**4)**0.25 890 endif 891 enddo 892 endif !(ok_slab_ocean) 893 662 663 muvar(1:ngrid,1:nlayer+1)=mugaz 664 894 665 ! standard callcorrk 895 clearsky=.false.896 666 call callcorrk(ngrid,nlayer,pq,nq,qsurf, & 897 667 albedo,albedo_equivalent,emis,mu0,pplev,pplay,pt, & … … 900 670 fluxsurfabs_sw,fluxtop_lw, & 901 671 fluxabs_sw,fluxtop_dn,OLR_nu,OSR_nu, & 902 tau_col,cloudfrac,totcloudfrac, & 903 clearsky,firstcall,lastcall) 904 905 ! Option to call scheme once more for clear regions 906 if(CLFvarying)then 907 908 ! ---> PROBLEMS WITH ALLOCATED ARRAYS : temporary solution in callcorrk: do not deallocate if CLFvarying ... 909 clearsky=.true. 910 call callcorrk(ngrid,nlayer,pq,nq,qsurf, & 911 albedo,albedo_equivalent1,emis,mu0,pplev,pplay,pt, & 912 tsurf,fract,dist_star,aerosol,muvar, & 913 zdtlw1,zdtsw1,fluxsurf_lw1,fluxsurf_sw1, & 914 fluxsurfabs_sw1,fluxtop_lw1, & 915 fluxabs_sw1,fluxtop_dn,OLR_nu1,OSR_nu1, & 916 tau_col1,cloudfrac,totcloudfrac, & 917 clearsky,firstcall,lastcall) 918 clearsky = .false. ! just in case. 919 920 ! Sum the fluxes and heating rates from cloudy/clear cases 921 do ig=1,ngrid 922 tf=totcloudfrac(ig) 923 ntf=1.-tf 924 fluxsurf_lw(ig) = ntf*fluxsurf_lw1(ig) + tf*fluxsurf_lw(ig) 925 fluxsurf_sw(ig) = ntf*fluxsurf_sw1(ig) + tf*fluxsurf_sw(ig) 926 albedo_equivalent(ig) = ntf*albedo_equivalent1(ig) + tf*albedo_equivalent(ig) 927 fluxsurfabs_sw(ig) = ntf*fluxsurfabs_sw1(ig) + tf*fluxsurfabs_sw(ig) 928 fluxtop_lw(ig) = ntf*fluxtop_lw1(ig) + tf*fluxtop_lw(ig) 929 fluxabs_sw(ig) = ntf*fluxabs_sw1(ig) + tf*fluxabs_sw(ig) 930 tau_col(ig) = ntf*tau_col1(ig) + tf*tau_col(ig) 931 932 zdtlw(ig,1:nlayer) = ntf*zdtlw1(ig,1:nlayer) + tf*zdtlw(ig,1:nlayer) 933 zdtsw(ig,1:nlayer) = ntf*zdtsw1(ig,1:nlayer) + tf*zdtsw(ig,1:nlayer) 934 935 OSR_nu(ig,1:L_NSPECTV) = ntf*OSR_nu1(ig,1:L_NSPECTV) + tf*OSR_nu(ig,1:L_NSPECTV) 936 OLR_nu(ig,1:L_NSPECTI) = ntf*OLR_nu1(ig,1:L_NSPECTI) + tf*OLR_nu(ig,1:L_NSPECTI) 937 enddo 938 939 endif ! end of CLFvarying. 940 941 if(ok_slab_ocean) then 942 tsurf(:)=tsurf2(:) 943 endif 944 672 tau_col,firstcall,lastcall) 945 673 946 674 ! Radiative flux from the sky absorbed by the surface (W.m-2). … … 957 685 dtrad(1:ngrid,1:nlayer)=zdtsw(1:ngrid,1:nlayer)+zdtlw(1:ngrid,1:nlayer) 958 686 959 ! Late initialization of the Ice Spectral Albedo. We needed the visible bands to do that !960 if (firstcall .and. albedo_spectral_mode) then961 call spectral_albedo_calc(albedo_snow_SPECTV)962 endif963 964 687 elseif(newtonian)then 965 688 … … 1040 763 if (UseTurbDiff) then 1041 764 1042 call turbdiff(ngrid,nlayer,nq, rnat,&765 call turbdiff(ngrid,nlayer,nq, & 1043 766 ptimestep,capcal,lwrite, & 1044 767 pplay,pplev,zzlay,zzlev,z0, & … … 1046 769 pdt,pdq,zflubid, & 1047 770 zdudif,zdvdif,zdtdif,zdtsdif, & 1048 sensibFlux,q2,zdqdif,zdq evap,zdqsdif,&771 sensibFlux,q2,zdqdif,zdqsdif, & 1049 772 taux,tauy,lastcall) 1050 773 … … 1053 776 zdh(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)/zpopsk(1:ngrid,1:nlayer) 1054 777 1055 call vdifc(ngrid,nlayer,nq, rnat,zpopsk,&778 call vdifc(ngrid,nlayer,nq,zpopsk, & 1056 779 ptimestep,capcal,lwrite, & 1057 780 pplay,pplev,zzlay,zzlev,z0, & … … 1072 795 pdt(1:ngrid,1:nlayer)=pdt(1:ngrid,1:nlayer)+zdtdif(1:ngrid,1:nlayer) 1073 796 zdtsurf(1:ngrid)=zdtsurf(1:ngrid)+zdtsdif(1:ngrid) 1074 1075 1076 if(ok_slab_ocean)then1077 flux_sens_lat(1:ngrid)=(zdtsdif(1:ngrid)*capcal(1:ngrid)-fluxrad(1:ngrid))1078 endif1079 1080 797 1081 798 if (tracer) then … … 1116 833 endif ! end of 'enertest' 1117 834 1118 1119 ! Test water conservation.1120 if(watertest.and.water)then1121 1122 call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp)1123 call planetwide_sumval(zdqsdif(:,igcm_h2o_vap)*cell_area(:)*ptimestep/totarea_planet,dWtots_tmp)1124 do ig = 1, ngrid1125 vdifcncons(ig)=SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_vap))1126 enddo1127 call planetwide_sumval(massarea(:,:)*zdqdif(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot)1128 call planetwide_sumval(zdqsdif(:,igcm_h2o_ice)*cell_area(:)*ptimestep/totarea_planet,dWtots)1129 dWtot = dWtot + dWtot_tmp1130 dWtots = dWtots + dWtots_tmp1131 do ig = 1, ngrid1132 vdifcncons(ig)=vdifcncons(ig) + SUM(mass(ig,:)*zdqdif(ig,:,igcm_h2o_ice))1133 enddo1134 call planetwide_maxval(vdifcncons(:),nconsMAX)1135 1136 if (is_master) then1137 print*,'---------------------------------------------------------------'1138 print*,'In difv atmospheric water change =',dWtot,' kg m-2'1139 print*,'In difv surface water change =',dWtots,' kg m-2'1140 print*,'In difv non-cons factor =',dWtot+dWtots,' kg m-2'1141 print*,'In difv MAX non-cons factor =',nconsMAX,' kg m-2 s-1'1142 endif1143 1144 endif ! end of 'watertest'1145 !-------------------------1146 1147 835 else ! calldifv 1148 836 … … 1190 878 endif 1191 879 1192 ! Test water conservation1193 if(watertest)then1194 call planetwide_sumval(massarea(:,:)*zdqadj(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dWtot_tmp)1195 do ig = 1, ngrid1196 cadjncons(ig)=SUM(mass(ig,:)*zdqadj(ig,:,igcm_h2o_vap))1197 enddo1198 call planetwide_sumval(massarea(:,:)*zdqadj(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot)1199 dWtot = dWtot + dWtot_tmp1200 do ig = 1, ngrid1201 cadjncons(ig)=cadjncons(ig) + SUM(mass(ig,:)*zdqadj(ig,:,igcm_h2o_ice))1202 enddo1203 call planetwide_maxval(cadjncons(:),nconsMAX)1204 1205 if (is_master) then1206 print*,'In convadj atmospheric water change =',dWtot,' kg m-2'1207 print*,'In convadj MAX non-cons factor =',nconsMAX,' kg m-2 s-1'1208 endif1209 1210 endif ! end of 'watertest'1211 880 1212 881 endif ! end of 'calladj' 1213 1214 !----------------------------------------------- 1215 ! V. Carbon dioxide condensation-sublimation : 1216 !----------------------------------------------- 1217 1218 if (co2cond) then 1219 1220 if (.not.tracer) then 1221 print*,'We need a CO2 ice tracer to condense CO2' 1222 call abort 1223 endif 1224 call condense_co2(ngrid,nlayer,nq,ptimestep, & 1225 capcal,pplay,pplev,tsurf,pt, & 1226 pdt,zdtsurf,pq,pdq, & 1227 qsurf,zdqsurfc,albedo,emis, & 1228 albedo_bareground,albedo_co2_ice_SPECTV, & 1229 zdtc,zdtsurfc,pdpsrf,zdqc) 1230 1231 pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+zdtc(1:ngrid,1:nlayer) 1232 zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurfc(1:ngrid) 1233 1234 pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq)+ zdqc(1:ngrid,1:nlayer,1:nq) 1235 dqsurf(1:ngrid,igcm_co2_ice) = dqsurf(1:ngrid,igcm_co2_ice) + zdqsurfc(1:ngrid) 1236 1237 ! test energy conservation 1238 if(enertest)then 1239 call planetwide_sumval(cpp*massarea(:,:)*zdtc(:,:)/totarea_planet,dEtot) 1240 call planetwide_sumval(capcal(:)*zdtsurfc(:)*cell_area(:)/totarea_planet,dEtots) 1241 if (is_master) then 1242 print*,'In co2cloud atmospheric energy change =',dEtot,' W m-2' 1243 print*,'In co2cloud surface energy change =',dEtots,' W m-2' 1244 endif 1245 endif 1246 1247 endif ! end of 'co2cond' 1248 882 1249 883 1250 884 !--------------------------------------------- 1251 ! V I. Specific parameterizations for tracers885 ! V. Specific parameterizations for tracers 1252 886 !--------------------------------------------- 1253 887 1254 888 if (tracer) then 1255 889 1256 ! --------------------- 1257 ! VI.1. Water and ice 1258 ! --------------------- 1259 if (water) then 1260 1261 ! Water ice condensation in the atmosphere 1262 if(watercond.and.(RLVTT.gt.1.e-8))then 1263 1264 dqmoist(1:ngrid,1:nlayer,1:nq)=0. 1265 dtmoist(1:ngrid,1:nlayer)=0. 1266 1267 ! Moist Convective Adjustment. 1268 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1269 call moistadj(ngrid,nlayer,nq,pt,pq,pdq,pplev,pplay,dtmoist,dqmoist,ptimestep,rneb_man) 1270 1271 pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap) & 1272 + dqmoist(1:ngrid,1:nlayer,igcm_h2o_vap) 1273 pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice) & 1274 + dqmoist(1:ngrid,1:nlayer,igcm_h2o_ice) 1275 pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtmoist(1:ngrid,1:nlayer) 1276 1277 ! Test energy conservation. 1278 if(enertest)then 1279 1280 call planetwide_sumval(cpp*massarea(:,:)*dtmoist(:,:)/totarea_planet,dEtot) 1281 call planetwide_maxval(dtmoist(:,:),dtmoist_max) 1282 call planetwide_minval(dtmoist(:,:),dtmoist_min) 1283 madjdEz(:,:)=cpp*mass(:,:)*dtmoist(:,:) 1284 do ig=1,ngrid 1285 madjdE(ig) = cpp*SUM(mass(:,:)*dtmoist(:,:)) 1286 enddo 1287 1288 if (is_master) then 1289 print*,'In moistadj atmospheric energy change =',dEtot,' W m-2' 1290 print*,'In moistadj MAX atmospheric energy change =',dtmoist_max*ptimestep,'K/step' 1291 print*,'In moistadj MIN atmospheric energy change =',dtmoist_min*ptimestep,'K/step' 1292 endif 1293 1294 call planetwide_sumval(massarea(:,:)*dqmoist(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+ & 1295 massarea(:,:)*dqmoist(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) 1296 if (is_master) print*,'In moistadj atmospheric water change =',dWtot,' kg m-2' 1297 1298 endif ! end of 'enertest' 1299 1300 1301 ! Large scale condensation/evaporation. 1302 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1303 call largescale(ngrid,nlayer,nq,ptimestep,pplev,pplay,pt,pq,pdt,pdq,dtlscale,dqvaplscale,dqcldlscale,rneb_lsc) 1304 1305 pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+dtlscale(1:ngrid,1:nlayer) 1306 pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap)+dqvaplscale(1:ngrid,1:nlayer) 1307 pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice)+dqcldlscale(1:ngrid,1:nlayer) 1308 1309 ! Test energy conservation. 1310 if(enertest)then 1311 lscaledEz(:,:) = cpp*mass(:,:)*dtlscale(:,:) 1312 do ig=1,ngrid 1313 lscaledE(ig) = cpp*SUM(mass(:,:)*dtlscale(:,:)) 1314 enddo 1315 call planetwide_sumval(cpp*massarea(:,:)*dtlscale(:,:)/totarea_planet,dEtot) 1316 1317 if (is_master) print*,'In largescale atmospheric energy change =',dEtot,' W m-2' 1318 1319 ! Test water conservation. 1320 call planetwide_sumval(massarea(:,:)*dqvaplscale(:,:)*ptimestep/totarea_planet+ & 1321 SUM(massarea(:,:)*dqcldlscale(:,:))*ptimestep/totarea_planet,dWtot) 1322 1323 if (is_master) print*,'In largescale atmospheric water change =',dWtot,' kg m-2' 1324 endif ! end of 'enertest' 1325 1326 ! Compute cloud fraction. 1327 do l = 1, nlayer 1328 do ig=1,ngrid 1329 cloudfrac(ig,l)=MAX(rneb_lsc(ig,l),rneb_man(ig,l)) 1330 enddo 1331 enddo 1332 1333 endif ! end of 'watercond' 1334 1335 ! Water ice / liquid precipitation. 1336 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1337 if(waterrain)then 1338 1339 zdqrain(1:ngrid,1:nlayer,1:nq) = 0.0 1340 zdqsrain(1:ngrid) = 0.0 1341 zdqssnow(1:ngrid) = 0.0 1342 1343 call rain(ngrid,nlayer,nq,ptimestep,pplev,pplay,pt,pdt,pq,pdq, & 1344 zdtrain,zdqrain,zdqsrain,zdqssnow,cloudfrac) 1345 1346 pdq(1:ngrid,1:nlayer,igcm_h2o_vap) = pdq(1:ngrid,1:nlayer,igcm_h2o_vap) & 1347 + zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap) 1348 pdq(1:ngrid,1:nlayer,igcm_h2o_ice) = pdq(1:ngrid,1:nlayer,igcm_h2o_ice) & 1349 + zdqrain(1:ngrid,1:nlayer,igcm_h2o_ice) 1350 pdt(1:ngrid,1:nlayer) = pdt(1:ngrid,1:nlayer)+zdtrain(1:ngrid,1:nlayer) 1351 1352 dqsurf(1:ngrid,igcm_h2o_vap) = dqsurf(1:ngrid,igcm_h2o_vap)+zdqsrain(1:ngrid) 1353 dqsurf(1:ngrid,igcm_h2o_ice) = dqsurf(1:ngrid,igcm_h2o_ice)+zdqssnow(1:ngrid) 1354 1355 ! Test energy conservation. 1356 if(enertest)then 1357 1358 call planetwide_sumval(cpp*massarea(:,:)*zdtrain(:,:)/totarea_planet,dEtot) 1359 if (is_master) print*,'In rain atmospheric T energy change =',dEtot,' W m-2' 1360 call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)/totarea_planet*RLVTT/cpp,dItot_tmp) 1361 call planetwide_sumval(cell_area(:)*zdqssnow(:)/totarea_planet*RLVTT/cpp,dItot) 1362 dItot = dItot + dItot_tmp 1363 call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet,dVtot_tmp) 1364 call planetwide_sumval(cell_area(:)*zdqsrain(:)/totarea_planet*RLVTT/cpp,dVtot) 1365 dVtot = dVtot + dVtot_tmp 1366 dEtot = dItot + dVtot 1367 1368 if (is_master) then 1369 print*,'In rain dItot =',dItot,' W m-2' 1370 print*,'In rain dVtot =',dVtot,' W m-2' 1371 print*,'In rain atmospheric L energy change =',dEtot,' W m-2' 1372 endif 1373 1374 ! Test water conservation 1375 call planetwide_sumval(massarea(:,:)*zdqrain(:,:,igcm_h2o_vap)*ptimestep/totarea_planet+ & 1376 massarea(:,:)*zdqrain(:,:,igcm_h2o_ice)*ptimestep/totarea_planet,dWtot) 1377 call planetwide_sumval((zdqsrain(:)+zdqssnow(:))*cell_area(:)*ptimestep/totarea_planet,dWtots) 1378 1379 if (is_master) then 1380 print*,'In rain atmospheric water change =',dWtot,' kg m-2' 1381 print*,'In rain surface water change =',dWtots,' kg m-2' 1382 print*,'In rain non-cons factor =',dWtot+dWtots,' kg m-2' 1383 endif 1384 1385 endif ! end of 'enertest' 1386 1387 end if ! enf of 'waterrain' 1388 1389 end if ! end of 'water' 1390 890 1391 891 ! ------------------------- 1392 ! V I.2. Aerosol particles892 ! V.1. Aerosol particles 1393 893 ! ------------------------- 1394 894 … … 1398 898 zdqsed(1:ngrid,1:nlayer,1:nq) = 0.0 1399 899 zdqssed(1:ngrid,1:nq) = 0.0 1400 1401 if(watertest)then1402 1403 iq=igcm_h2o_ice1404 call planetwide_sumval(massarea(:,:)*pq(:,:,iq)*ptimestep/totarea_planet,dWtot)1405 call planetwide_sumval(massarea(:,:)*pdq(:,:,iq)*ptimestep/totarea_planet,dWtots)1406 if (is_master) then1407 print*,'Before sedim pq =',dWtot,' kg m-2'1408 print*,'Before sedim pdq =',dWtots,' kg m-2'1409 endif1410 endif1411 900 1412 901 call callsedim(ngrid,nlayer,ptimestep, & … … 1414 903 zdqsed,zdqssed,nq) 1415 904 1416 if(watertest)then1417 iq=igcm_h2o_ice1418 call planetwide_sumval(massarea(:,:)*pq(:,:,iq)*ptimestep/totarea_planet,dWtot)1419 call planetwide_sumval(massarea(:,:)*pdq(:,:,iq)*ptimestep/totarea_planet,dWtots)1420 if (is_master) then1421 print*,'After sedim pq =',dWtot,' kg m-2'1422 print*,'After sedim pdq =',dWtots,' kg m-2'1423 endif1424 endif1425 1426 905 ! Whether it falls as rain or snow depends only on the surface temperature 1427 906 pdq(1:ngrid,1:nlayer,1:nq) = pdq(1:ngrid,1:nlayer,1:nq) + zdqsed(1:ngrid,1:nlayer,1:nq) 1428 907 dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + zdqssed(1:ngrid,1:nq) 1429 908 1430 ! Test water conservation1431 if(watertest)then1432 call planetwide_sumval(massarea(:,:)*(zdqsed(:,:,igcm_h2o_vap)+zdqsed(:,:,igcm_h2o_ice))*ptimestep/totarea_planet,dWtot)1433 call planetwide_sumval((zdqssed(:,igcm_h2o_vap)+zdqssed(:,igcm_h2o_ice))*cell_area(:)*ptimestep/totarea_planet,dWtots)1434 if (is_master) then1435 print*,'In sedim atmospheric ice change =',dWtot,' kg m-2'1436 print*,'In sedim surface ice change =',dWtots,' kg m-2'1437 print*,'In sedim non-cons factor =',dWtot+dWtots,' kg m-2'1438 endif1439 endif1440 1441 909 end if ! end of 'sedimentation' 1442 910 1443 911 1444 912 ! --------------- 1445 ! V I.3. Updates913 ! V.2. Updates 1446 914 ! --------------- 1447 915 … … 1449 917 if(mass_redistrib) then 1450 918 1451 zdmassmr(1:ngrid,1:nlayer) = mass(1:ngrid,1:nlayer) * & 1452 ( zdqevap(1:ngrid,1:nlayer) & 1453 + zdqrain(1:ngrid,1:nlayer,igcm_h2o_vap) & 1454 + dqmoist(1:ngrid,1:nlayer,igcm_h2o_vap) & 1455 + dqvaplscale(1:ngrid,1:nlayer) ) 919 zdmassmr(1:ngrid,1:nlayer) = mass(1:ngrid,1:nlayer) * zdqevap(1:ngrid,1:nlayer) 1456 920 1457 921 do ig = 1, ngrid … … 1464 928 1465 929 call mass_redistribution(ngrid,nlayer,nq,ptimestep, & 1466 rnat,capcal,pplay,pplev,pt,tsurf,pq,qsurf,&930 capcal,pplay,pplev,pt,tsurf,pq,qsurf, & 1467 931 pu,pv,pdt,zdtsurf,pdq,pdu,pdv,zdmassmr, & 1468 932 zdtmr,zdtsurfmr,zdpsrfmr,zdumr,zdvmr,zdqmr,zdqsurfmr) … … 1478 942 endif 1479 943 1480 ! ------------------1481 ! VI.4. Slab Ocean1482 ! ------------------1483 1484 if (ok_slab_ocean)then1485 1486 do ig=1,ngrid1487 qsurfint(:,igcm_h2o_ice)=qsurf(:,igcm_h2o_ice)1488 enddo1489 1490 call ocean_slab_ice(ptimestep, &1491 ngrid, knindex, tsea_ice, fluxrad, &1492 zdqssnow, qsurf(:,igcm_h2o_ice), &1493 - zdqsdif(:,igcm_h2o_vap), &1494 flux_sens_lat,tsea_ice, pctsrf_sic, &1495 taux,tauy,icount)1496 1497 1498 call ocean_slab_get_vars(ngrid,tslab, &1499 sea_ice, flux_o, &1500 flux_g, dt_hdiff, &1501 dt_ekman)1502 1503 do ig=1,ngrid1504 if (nint(rnat(ig)).eq.1)then1505 tslab(ig,1) = 0.1506 tslab(ig,2) = 0.1507 tsea_ice(ig) = 0.1508 sea_ice(ig) = 0.1509 pctsrf_sic(ig) = 0.1510 qsurf(ig,igcm_h2o_ice) = qsurfint(ig,igcm_h2o_ice)1511 endif1512 enddo1513 1514 endif ! end of 'ok_slab_ocean'1515 1516 944 ! ----------------------------- 1517 ! V I.5. Surface Tracer Update945 ! V.3. Surface Tracer Update 1518 946 ! ----------------------------- 1519 947 1520 if(hydrology)then 1521 1522 call hydrol(ngrid,nq,ptimestep,rnat,tsurf,qsurf,dqsurf,dqs_hyd, & 1523 capcal,albedo,albedo_bareground, & 1524 albedo_snow_SPECTV,albedo_co2_ice_SPECTV, & 1525 mu0,zdtsurf,zdtsurf_hyd,hice,pctsrf_sic, & 1526 sea_ice) 1527 1528 zdtsurf(1:ngrid) = zdtsurf(1:ngrid) + zdtsurf_hyd(1:ngrid) 1529 dqsurf(1:ngrid,1:nq) = dqsurf(1:ngrid,1:nq) + dqs_hyd(1:ngrid,1:nq) 1530 1531 qsurf(1:ngrid,1:nq) = qsurf(1:ngrid,1:nq) + ptimestep*dqsurf(1:ngrid,1:nq) 1532 1533 ! Test energy conservation 1534 if(enertest)then 1535 call planetwide_sumval(cell_area(:)*capcal(:)*zdtsurf_hyd(:)/totarea_planet,dEtots) 1536 if (is_master) print*,'In hydrol surface energy change =',dEtots,' W m-2' 1537 endif 1538 1539 ! test water conservation 1540 if(watertest)then 1541 call planetwide_sumval(dqs_hyd(:,igcm_h2o_ice)*cell_area(:)*ptimestep/totarea_planet,dWtots) 1542 if (is_master) print*,'In hydrol surface ice change =',dWtots,' kg m-2' 1543 call planetwide_sumval(dqs_hyd(:,igcm_h2o_vap)*cell_area(:)*ptimestep/totarea_planet,dWtots) 1544 if (is_master) then 1545 print*,'In hydrol surface water change =',dWtots,' kg m-2' 1546 print*,'---------------------------------------------------------------' 1547 endif 1548 endif 1549 1550 else ! of if (hydrology) 1551 1552 qsurf(1:ngrid,1:nq) = qsurf(1:ngrid,1:nq) + ptimestep*dqsurf(1:ngrid,1:nq) 1553 1554 end if ! of if (hydrology) 948 qsurf(1:ngrid,1:nq) = qsurf(1:ngrid,1:nq) + ptimestep*dqsurf(1:ngrid,1:nq) 1555 949 1556 950 ! Add qsurf to qsurf_hist, which is what we save in diagfi.nc. At the same time, we set the water … … 1558 952 qsurf_hist(:,:) = qsurf(:,:) 1559 953 1560 if(ice_update)then1561 ice_min(1:ngrid)=min(ice_min(1:ngrid),qsurf(1:ngrid,igcm_h2o_ice))1562 endif1563 1564 954 endif! end of if 'tracer' 1565 955 1566 956 1567 957 !------------------------------------------------ 1568 ! VI I. Surface and sub-surface soil temperature958 ! VI. Surface and sub-surface soil temperature 1569 959 !------------------------------------------------ 1570 960 1571 961 1572 962 ! Increment surface temperature 1573 if(ok_slab_ocean)then 1574 do ig=1,ngrid 1575 if (nint(rnat(ig)).eq.0)then 1576 zdtsurf(ig)= (tslab(ig,1) & 1577 + pctsrf_sic(ig)*(tsea_ice(ig)-tslab(ig,1))-tsurf(ig))/ptimestep 1578 endif 1579 tsurf(ig)=tsurf(ig)+ptimestep*zdtsurf(ig) 1580 enddo 1581 1582 else 1583 tsurf(1:ngrid)=tsurf(1:ngrid)+ptimestep*zdtsurf(1:ngrid) 1584 endif ! end of 'ok_slab_ocean' 1585 963 964 tsurf(1:ngrid)=tsurf(1:ngrid)+ptimestep*zdtsurf(1:ngrid) 1586 965 1587 966 ! Compute soil temperatures and subsurface heat flux. … … 1592 971 1593 972 1594 if (ok_slab_ocean) then1595 1596 do ig=1,ngrid1597 1598 fluxgrdocean(ig)=fluxgrd(ig)1599 if (nint(rnat(ig)).eq.0) then1600 capcal(ig)=capcalocean1601 fluxgrd(ig)=0.1602 fluxgrdocean(ig)=pctsrf_sic(ig)*flux_g(ig)+(1-pctsrf_sic(ig))*(dt_hdiff(ig,1)+dt_ekman(ig,1))1603 do iq=1,nsoilmx1604 tsoil(ig,iq)=tsurf(ig)1605 enddo1606 if (pctsrf_sic(ig).gt.0.5) then1607 capcal(ig)=capcalseaice1608 if (qsurf(ig,igcm_h2o_ice).gt.0.) then1609 capcal(ig)=capcalsno1610 endif1611 endif1612 endif1613 1614 enddo1615 1616 endif !end of 'ok_slab_ocean'1617 1618 1619 973 ! Test energy conservation 1620 974 if(enertest)then … … 1625 979 1626 980 !--------------------------------------------------- 1627 ! VII I. Perform diagnostics and write output files981 ! VII. Perform diagnostics and write output files 1628 982 !--------------------------------------------------- 1629 983 … … 1757 1111 ! Generalised for arbitrary aerosols now. By LK 1758 1112 reffcol(1:ngrid,1:naerkind)=0.0 1759 if(co2cond.and.(iaero_co2.ne.0))then1760 call co2_reffrad(ngrid,nlayer,nq,zq,reffrad(1,1,iaero_co2))1761 do ig=1,ngrid1762 reffcol(ig,iaero_co2) = SUM(zq(ig,1:nlayer,igcm_co2_ice)*reffrad(ig,1:nlayer,iaero_co2)*mass(ig,1:nlayer))1763 enddo1764 endif1765 if(water.and.(iaero_h2o.ne.0))then1766 call h2o_reffrad(ngrid,nlayer,zq(1,1,igcm_h2o_ice),zt, &1767 reffrad(1,1,iaero_h2o),nueffrad(1,1,iaero_h2o))1768 do ig=1,ngrid1769 reffcol(ig,iaero_h2o) = SUM(zq(ig,1:nlayer,igcm_h2o_ice)*reffrad(ig,1:nlayer,iaero_h2o)*mass(ig,1:nlayer))1770 enddo1771 endif1772 1113 1773 1114 endif ! end of 'tracer' 1774 1775 1776 ! Test for water conservation.1777 if(water)then1778 1779 call planetwide_sumval(cell_area(:)*qsurf_hist(:,igcm_h2o_ice)/totarea_planet,icesrf)1780 call planetwide_sumval(cell_area(:)*qsurf_hist(:,igcm_h2o_vap)/totarea_planet,liqsrf)1781 call planetwide_sumval(cell_area(:)*qcol(:,igcm_h2o_ice)/totarea_planet,icecol)1782 call planetwide_sumval(cell_area(:)*qcol(:,igcm_h2o_vap)/totarea_planet,vapcol)1783 1784 h2otot = icesrf + liqsrf + icecol + vapcol1785 1786 if (is_master) then1787 print*,' Total water amount [kg m^-2]: ',h2otot1788 print*,' Surface ice Surface liq. Atmos. con. Atmos. vap. [kg m^-2] '1789 print*, icesrf,liqsrf,icecol,vapcol1790 endif1791 1792 if(meanOLR .and. is_master)then1793 if((ngrid.gt.1) .or. (mod(icount-1,ecritphy).eq.0))then1794 ! to record global water balance1795 open(98,file="h2o_bal.out",form='formatted',position='append')1796 write(98,*) zday,icesrf,liqsrf,icecol,vapcol1797 close(98)1798 endif1799 endif1800 1801 endif1802 1803 1804 ! Calculate RH (Relative Humidity) for diagnostic.1805 if(water)then1806 1807 do l = 1, nlayer1808 do ig=1,ngrid1809 call Psat_water(zt(ig,l),pplay(ig,l),psat_tmp,qsat(ig,l))1810 RH(ig,l) = zq(ig,l,igcm_h2o_vap) / qsat(ig,l)1811 enddo1812 enddo1813 1814 ! Compute maximum possible H2O column amount (100% saturation).1815 do ig=1,ngrid1816 H2Omaxcol(ig) = SUM( qsat(ig,:) * mass(ig,:))1817 enddo1818 1819 endif ! end of 'water'1820 1115 1821 1116 … … 1838 1133 ztime_fin = ptime + ptimestep/(float(iphysiq)*daysec) 1839 1134 1840 ! Update surface ice distribution to iterate to steady state if requested1841 if(ice_update)then1842 1843 do ig=1,ngrid1844 1845 delta_ice = (qsurf(ig,igcm_h2o_ice)-ice_initial(ig))1846 1847 ! add multiple years of evolution1848 qsurf_hist(ig,igcm_h2o_ice) = qsurf_hist(ig,igcm_h2o_ice) + delta_ice*icetstep1849 1850 ! if ice has gone -ve, set to zero1851 if(qsurf_hist(ig,igcm_h2o_ice).lt.0.0)then1852 qsurf_hist(ig,igcm_h2o_ice) = 0.01853 endif1854 1855 ! if ice is seasonal, set to zero (NEW)1856 if(ice_min(ig).lt.0.01)then1857 qsurf_hist(ig,igcm_h2o_ice) = 0.01858 endif1859 1860 enddo1861 1862 ! enforce ice conservation1863 ice_tot= SUM(qsurf_hist(:,igcm_h2o_ice)*cell_area(:) )/SUM(cell_area(:))1864 qsurf_hist(:,igcm_h2o_ice) = qsurf_hist(:,igcm_h2o_ice)*(icesrf/ice_tot)1865 1866 endif1867 1868 1135 if (ngrid.ne.1) then 1869 1136 write(*,*)'PHYSIQ: for physdem ztime_fin =',ztime_fin … … 1871 1138 call physdem1("restartfi.nc",nsoilmx,ngrid,nlayer,nq, & 1872 1139 ptimestep,ztime_fin, & 1873 tsurf,tsoil,emis,q2,qsurf_hist, & 1874 cloudfrac,totcloudfrac,hice, & 1875 rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) 1876 endif 1877 1878 if(ok_slab_ocean) then 1879 call ocean_slab_final!(tslab, seaice) 1880 end if 1881 1140 tsurf,tsoil,emis,q2,qsurf_hist) 1141 endif 1882 1142 1883 1143 endif ! end of 'lastcall' … … 1937 1197 1938 1198 end do 1939 1940 if (water) then1941 vmr=zq(1:ngrid,1:nlayer,igcm_h2o_vap)*mugaz/mmol(igcm_h2o_vap)1942 call wstats(ngrid,"vmr_h2ovapor", &1943 "H2O vapour volume mixing ratio","mol/mol", &1944 3,vmr)1945 endif1946 1199 1947 1200 endif ! end of 'tracer' 1948 1949 if(watercond.and.CLFvarying)then1950 call wstats(ngrid,"rneb_man","H2O cloud fraction (conv)"," ",3,rneb_man)1951 call wstats(ngrid,"rneb_lsc","H2O cloud fraction (large scale)"," ",3,rneb_lsc)1952 call wstats(ngrid,"CLF","H2O cloud fraction"," ",3,cloudfrac)1953 call wstats(ngrid,"CLFt","H2O column cloud fraction"," ",2,totcloudfrac)1954 call wstats(ngrid,"RH","relative humidity"," ",3,RH)1955 endif1956 1957 if (ok_slab_ocean) then1958 call wstats(ngrid,"dt_hdiff1","dt_hdiff1","K/s",2,dt_hdiff(:,1))1959 call wstats(ngrid,"dt_hdiff2","dt_hdiff2","K/s",2,dt_hdiff(:,2))1960 call wstats(ngrid,"dt_ekman1","dt_ekman1","K/s",2,dt_ekman(:,1))1961 call wstats(ngrid,"dt_ekman2","dt_ekman2","K/s",2,dt_ekman(:,2))1962 call wstats(ngrid,"tslab1","tslab1","K",2,tslab(:,1))1963 call wstats(ngrid,"tslab2","tslab2","K",2,tslab(:,2))1964 call wstats(ngrid,"pctsrf_sic","pct ice/sea","",2,pctsrf_sic)1965 call wstats(ngrid,"tsea_ice","tsea_ice","K",2,tsea_ice)1966 call wstats(ngrid,"sea_ice","sea ice","kg/m2",2,sea_ice)1967 call wstats(ngrid,"rnat","nature of the surface","",2,rnat)1968 endif1969 1201 1970 1202 if(lastcall) then … … 2003 1235 ! call writediagsoil(ngrid,"temp","temperature","K",3,tsoil) 2004 1236 2005 ! Oceanic layers2006 if(ok_slab_ocean) then2007 call writediagfi(ngrid,"pctsrf_sic","pct ice/sea","",2,pctsrf_sic)2008 call writediagfi(ngrid,"tsea_ice","tsea_ice","K",2,tsea_ice)2009 call writediagfi(ngrid,"sea_ice","sea ice","kg/m2",2,sea_ice)2010 call writediagfi(ngrid,"tslab1","tslab1","K",2,tslab(:,1))2011 call writediagfi(ngrid,"tslab2","tslab2","K",2,tslab(:,2))2012 call writediagfi(ngrid,"dt_hdiff1","dt_hdiff1","K/s",2,dt_hdiff(:,1))2013 call writediagfi(ngrid,"dt_hdiff2","dt_hdiff2","K/s",2,dt_hdiff(:,2))2014 call writediagfi(ngrid,"dt_ekman1","dt_ekman1","K/s",2,dt_ekman(:,1))2015 call writediagfi(ngrid,"dt_ekman2","dt_ekman2","K/s",2,dt_ekman(:,2))2016 call writediagfi(ngrid,"rnat","nature of the surface","",2,rnat)2017 call writediagfi(ngrid,"sensibFlux","sensible heat flux","w.m^-2",2,sensibFlux)2018 call writediagfi(ngrid,"latentFlux","latent heat flux","w.m^-2",2,zdqsdif(:,igcm_h2o_vap)*RLVTT)2019 endif2020 1237 2021 1238 … … 2037 1254 ! call writediagfi(ngrid,"fluxsurflwcs","lw back radiation (cs).","W m-2",2,fluxsurf_lw1) 2038 1255 2039 if(ok_slab_ocean) then 2040 call writediagfi(ngrid,"GND","heat flux from ground","W m-2",2,fluxgrdocean) 2041 else 2042 call writediagfi(ngrid,"GND","heat flux from ground","W m-2",2,fluxgrd) 2043 endif 1256 1257 call writediagfi(ngrid,"GND","heat flux from ground","W m-2",2,fluxgrd) 2044 1258 2045 1259 call writediagfi(ngrid,"DYN","dynamical heat input","W m-2",2,fluxdyn) … … 2065 1279 endif 2066 1280 2067 if(watercond) then2068 2069 call writediagfi(ngrid,"lscaledE","heat from largescale","W m-2",2,lscaledE)2070 call writediagfi(ngrid,"madjdE","heat from moistadj","W m-2",2,madjdE)2071 call writediagfi(ngrid,"qsatatm","atm qsat"," ",3,qsat)2072 2073 ! call writediagfi(ngrid,"lscaledEz","heat from largescale","W m-2",3,lscaledEz)2074 ! call writediagfi(ngrid,"madjdEz","heat from moistadj","W m-2",3,madjdEz)2075 ! call writediagfi(ngrid,"h2o_max_col","maximum H2O column amount","kg.m^-2",2,H2Omaxcol)2076 2077 endif2078 2079 1281 endif ! end of 'enertest' 2080 1282 … … 2087 1289 2088 1290 ! For Debugging. 2089 !call writediagfi(ngrid,'rnat','Terrain type',' ',2,real(rnat))2090 1291 !call writediagfi(ngrid,'pphi','Geopotential',' ',3,pphi) 2091 1292 2092 2093 ! Output aerosols.2094 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) &2095 call writediagfi(ngrid,'CO2ice_reff','CO2ice_reff','m',3,reffrad(1,1,iaero_co2))2096 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) &2097 call writediagfi(ngrid,'H2Oice_reff','H2Oice_reff','m',3,reffrad(:,:,iaero_h2o))2098 if (igcm_co2_ice.ne.0.and.iaero_co2.ne.0) &2099 call writediagfi(ngrid,'CO2ice_reffcol','CO2ice_reffcol','um kg m^-2',2,reffcol(1,iaero_co2))2100 if (igcm_h2o_ice.ne.0.and.iaero_h2o.ne.0) &2101 call writediagfi(ngrid,'H2Oice_reffcol','H2Oice_reffcol','um kg m^-2',2,reffcol(1,iaero_h2o))2102 1293 2103 1294 ! Output tracers. … … 2114 1305 ! 'kg m^-2',2,qsurf(1,iq) ) 2115 1306 2116 if(watercond.or.CLFvarying)then2117 call writediagfi(ngrid,"rneb_man","H2O cloud fraction (conv)"," ",3,rneb_man)2118 call writediagfi(ngrid,"rneb_lsc","H2O cloud fraction (large scale)"," ",3,rneb_lsc)2119 call writediagfi(ngrid,"CLF","H2O cloud fraction"," ",3,cloudfrac)2120 call writediagfi(ngrid,"CLFt","H2O column cloud fraction"," ",2,totcloudfrac)2121 call writediagfi(ngrid,"RH","relative humidity"," ",3,RH)2122 endif2123 2124 if(waterrain)then2125 call writediagfi(ngrid,"rain","rainfall","kg m-2 s-1",2,zdqsrain)2126 call writediagfi(ngrid,"snow","snowfall","kg m-2 s-1",2,zdqssnow)2127 endif2128 2129 if((hydrology).and.(.not.ok_slab_ocean))then2130 call writediagfi(ngrid,"hice","oceanic ice height","m",2,hice)2131 endif2132 2133 if(ice_update)then2134 call writediagfi(ngrid,"ice_min","min annual ice","m",2,ice_min)2135 call writediagfi(ngrid,"ice_ini","initial annual ice","m",2,ice_initial)2136 endif2137 2138 1307 do ig=1,ngrid 2139 1308 if(tau_col(ig).gt.1.e3)then -
trunk/LMDZ.TITAN/libf/phytitan/radii_mod.F90
r1529 r1647 3 3 !================================================================== 4 4 ! module to centralize the radii calculations for aerosols 5 ! OK for water but should be extended to other aerosols (CO2,...)6 5 !================================================================== 7 6 8 ! water cloud optical properties 9 10 use callkeys_mod, only: radfixed,Nmix_co2, & 11 pres_bottom_tropo,pres_top_tropo,size_tropo, & 12 pres_bottom_strato,size_strato 13 14 real, save :: rad_h2o 15 real, save :: rad_h2o_ice 16 real, save :: Nmix_h2o 17 real, save :: Nmix_h2o_ice 18 !$OMP THREADPRIVATE(rad_h2o,rad_h2o_ice,Nmix_h2o,Nmix_h2o_ice) 19 real, parameter :: coef_chaud=0.13 20 real, parameter :: coef_froid=0.09 21 7 use callkeys_mod, only: pres_bottom_tropo,pres_top_tropo, & 8 size_tropo,pres_bottom_strato,size_strato 22 9 23 10 contains … … 38 25 use ioipsl_getin_p_mod, only: getin_p 39 26 use radinc_h, only: naerkind 40 use aerosol_mod, only: iaero_back2lay, iaero_co2, iaero_dust, & 41 iaero_h2o, iaero_h2so4 27 use aerosol_mod, only: iaero_back2lay 42 28 Implicit none 43 29 … … 59 45 ! .def file. To be improved! 60 46 61 if(iaer.eq.iaero_co2)then ! CO2 ice 47 48 ! WARNING : Titan adapt. (J. Vatant d'Ollone, 2017) 49 ! - ONLY THE NO AEROSOL CASE FOR NOW SINCE WE COMPUTE THEM ANOTHER WAY ! 50 ! - This routine is just here to keep the code running without unplugging all (yet) 51 ! - There's only the dummy aerosol case on iaer = 1 52 if(iaer.eq.1)then 62 53 reffrad(1:ngrid,1:nlayer,iaer) = 1.e-4 63 nueffrad(1:ngrid,1:nlayer,iaer) = 0.164 endif65 66 if(iaer.eq.iaero_h2o)then ! H2O ice67 reffrad(1:ngrid,1:nlayer,iaer) = 1.e-568 nueffrad(1:ngrid,1:nlayer,iaer) = 0.169 endif70 71 if(iaer.eq.iaero_dust)then ! dust72 reffrad(1:ngrid,1:nlayer,iaer) = 1.e-573 nueffrad(1:ngrid,1:nlayer,iaer) = 0.174 endif75 76 if(iaer.eq.iaero_h2so4)then ! H2O ice77 reffrad(1:ngrid,1:nlayer,iaer) = 1.e-678 54 nueffrad(1:ngrid,1:nlayer,iaer) = 0.1 79 55 endif … … 83 59 nueffrad(1:ngrid,1:nlayer,iaer) = 0.1 84 60 endif 85 86 87 61 88 62 if(iaer.gt.5)then … … 95 69 enddo 96 70 97 98 if (radfixed) then99 100 write(*,*)"radius of H2O water particles:"101 rad_h2o=13. ! default value102 call getin_p("rad_h2o",rad_h2o)103 write(*,*)" rad_h2o = ",rad_h2o104 105 write(*,*)"radius of H2O ice particles:"106 rad_h2o_ice=35. ! default value107 call getin_p("rad_h2o_ice",rad_h2o_ice)108 write(*,*)" rad_h2o_ice = ",rad_h2o_ice109 110 else111 112 write(*,*)"Number mixing ratio of H2O water particles:"113 Nmix_h2o=1.e6 ! default value114 call getin_p("Nmix_h2o",Nmix_h2o)115 write(*,*)" Nmix_h2o = ",Nmix_h2o116 117 write(*,*)"Number mixing ratio of H2O ice particles:"118 Nmix_h2o_ice=Nmix_h2o ! default value119 call getin_p("Nmix_h2o_ice",Nmix_h2o_ice)120 write(*,*)" Nmix_h2o_ice = ",Nmix_h2o_ice121 endif122 123 71 print*,'exit su_aer_radii' 124 72 … … 126 74 !================================================================== 127 75 128 129 !==================================================================130 subroutine h2o_reffrad(ngrid,nlayer,pq,pt,reffrad,nueffrad)131 !==================================================================132 ! Purpose133 ! -------134 ! Compute the effective radii of liquid and icy water particles135 !136 ! Authors137 ! -------138 ! Jeremy Leconte (2012)139 !140 !==================================================================141 use watercommon_h, Only: T_h2O_ice_liq,T_h2O_ice_clouds,rhowater,rhowaterice142 use comcstfi_mod, only: pi143 Implicit none144 145 integer,intent(in) :: ngrid146 integer,intent(in) :: nlayer147 148 real, intent(in) :: pq(ngrid,nlayer) !water ice mixing ratios (kg/kg)149 real, intent(in) :: pt(ngrid,nlayer) !temperature (K)150 real, intent(out) :: reffrad(ngrid,nlayer) !aerosol radii151 real, intent(out) :: nueffrad(ngrid,nlayer) ! dispersion152 153 integer :: ig,l154 real zfice ,zrad,zrad_liq,zrad_ice155 real,external :: CBRT156 157 158 if (radfixed) then159 do l=1,nlayer160 do ig=1,ngrid161 zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds)162 zfice = MIN(MAX(zfice,0.0),1.0)163 reffrad(ig,l)= rad_h2o * (1.-zfice) + rad_h2o_ice * zfice164 nueffrad(ig,l) = coef_chaud * (1.-zfice) + coef_froid * zfice165 enddo166 enddo167 else168 do l=1,nlayer169 do ig=1,ngrid170 zfice = 1.0 - (pt(ig,l)-T_h2O_ice_clouds) / (T_h2O_ice_liq-T_h2O_ice_clouds)171 zfice = MIN(MAX(zfice,0.0),1.0)172 zrad_liq = CBRT( 3*pq(ig,l)/(4*Nmix_h2o*pi*rhowater) )173 zrad_ice = CBRT( 3*pq(ig,l)/(4*Nmix_h2o_ice*pi*rhowaterice) )174 nueffrad(ig,l) = coef_chaud * (1.-zfice) + coef_froid * zfice175 zrad = zrad_liq * (1.-zfice) + zrad_ice * zfice176 177 reffrad(ig,l) = min(max(zrad,1.e-6),1000.e-6)178 enddo179 enddo180 end if181 182 end subroutine h2o_reffrad183 !==================================================================184 185 186 !==================================================================187 subroutine h2o_cloudrad(ngrid,nlayer,pql,reffliq,reffice)188 !==================================================================189 ! Purpose190 ! -------191 ! Compute the effective radii of liquid and icy water particles192 !193 ! Authors194 ! -------195 ! Jeremy Leconte (2012)196 !197 !==================================================================198 use watercommon_h, Only: rhowater,rhowaterice199 use comcstfi_mod, only: pi200 Implicit none201 202 integer,intent(in) :: ngrid203 integer,intent(in) :: nlayer204 205 real, intent(in) :: pql(ngrid,nlayer) !condensed water mixing ratios (kg/kg)206 real, intent(out) :: reffliq(ngrid,nlayer),reffice(ngrid,nlayer) !liquid and ice water particle radii (m)207 208 real,external :: CBRT209 integer :: i,k210 211 if (radfixed) then212 reffliq(1:ngrid,1:nlayer)= rad_h2o213 reffice(1:ngrid,1:nlayer)= rad_h2o_ice214 else215 do k=1,nlayer216 do i=1,ngrid217 reffliq(i,k) = CBRT(3*pql(i,k)/(4*Nmix_h2o*pi*rhowater))218 reffliq(i,k) = min(max(reffliq(i,k),1.e-6),1000.e-6)219 220 reffice(i,k) = CBRT(3*pql(i,k)/(4*Nmix_h2o_ice*pi*rhowaterice))221 reffice(i,k) = min(max(reffice(i,k),1.e-6),1000.e-6)222 enddo223 enddo224 endif225 226 end subroutine h2o_cloudrad227 !==================================================================228 229 230 231 !==================================================================232 subroutine co2_reffrad(ngrid,nlayer,nq,pq,reffrad)233 !==================================================================234 ! Purpose235 ! -------236 ! Compute the effective radii of co2 ice particles237 !238 ! Authors239 ! -------240 ! Jeremy Leconte (2012)241 !242 !==================================================================243 USE tracer_h, only:igcm_co2_ice,rho_co2244 use comcstfi_mod, only: pi245 Implicit none246 247 integer,intent(in) :: ngrid,nlayer,nq248 249 real, intent(in) :: pq(ngrid,nlayer,nq) !tracer mixing ratios (kg/kg)250 real, intent(out) :: reffrad(ngrid,nlayer) !co2 ice particles radii (m)251 252 integer :: ig,l253 real :: zrad254 real,external :: CBRT255 256 257 258 if (radfixed) then259 reffrad(1:ngrid,1:nlayer) = 5.e-5 ! CO2 ice260 else261 do l=1,nlayer262 do ig=1,ngrid263 zrad = CBRT( 3*pq(ig,l,igcm_co2_ice)/(4*Nmix_co2*pi*rho_co2) )264 reffrad(ig,l) = min(max(zrad,1.e-6),100.e-6)265 enddo266 enddo267 end if268 269 end subroutine co2_reffrad270 !==================================================================271 272 273 274 !==================================================================275 subroutine dust_reffrad(ngrid,nlayer,reffrad)276 !==================================================================277 ! Purpose278 ! -------279 ! Compute the effective radii of dust particles280 !281 ! Authors282 ! -------283 ! Jeremy Leconte (2012)284 !285 !==================================================================286 Implicit none287 288 integer,intent(in) :: ngrid289 integer,intent(in) :: nlayer290 291 real, intent(out) :: reffrad(ngrid,nlayer) !dust particles radii (m)292 293 reffrad(1:ngrid,1:nlayer) = 2.e-6 ! dust294 295 end subroutine dust_reffrad296 !==================================================================297 298 299 !==================================================================300 subroutine h2so4_reffrad(ngrid,nlayer,reffrad)301 !==================================================================302 ! Purpose303 ! -------304 ! Compute the effective radii of h2so4 particles305 !306 ! Authors307 ! -------308 ! Jeremy Leconte (2012)309 !310 !==================================================================311 Implicit none312 313 integer,intent(in) :: ngrid314 integer,intent(in) :: nlayer315 316 real, intent(out) :: reffrad(ngrid,nlayer) !h2so4 particle radii (m)317 318 reffrad(1:ngrid,1:nlayer) = 1.e-6 ! h2so4319 320 end subroutine h2so4_reffrad321 !==================================================================322 76 323 77 !================================================================== -
trunk/LMDZ.TITAN/libf/phytitan/su_gases.F90
r1315 r1647 73 73 igas_H2=igas 74 74 count=count+1 75 elseif (trim(gnom(igas)).eq."He_" .or. trim(gnom(igas)).eq."He") then76 igas_He=igas77 count=count+178 elseif (trim(gnom(igas)).eq."H2O") then79 igas_H2O=igas80 count=count+181 elseif (trim(gnom(igas)).eq."CO2") then82 igas_CO2=igas83 count=count+184 elseif (trim(gnom(igas)).eq."CO_" .or. trim(gnom(igas)).eq."CO") then85 igas_CO=igas86 count=count+187 75 elseif (trim(gnom(igas)).eq."N2_" .or. trim(gnom(igas)).eq."N2") then 88 76 igas_N2=igas 89 77 count=count+1 90 elseif (trim(gnom(igas)).eq."O2_" .or. trim(gnom(igas)).eq."O2") then91 igas_O2=igas92 count=count+193 elseif (trim(gnom(igas)).eq."SO2") then94 igas_SO2=igas95 count=count+196 elseif (trim(gnom(igas)).eq."H2S") then97 igas_H2S=igas98 count=count+199 78 elseif (trim(gnom(igas)).eq."CH4") then 100 79 igas_CH4=igas 101 count=count+1102 elseif (trim(gnom(igas)).eq."NH3") then103 igas_NH3=igas104 80 count=count+1 105 81 elseif (trim(gnom(igas)).eq."C2H6") then -
trunk/LMDZ.TITAN/libf/phytitan/suaer_corrk.F90
r1529 r1647 42 42 ! MODIF R. Wordsworth (2009) 43 43 ! - generalisation to arbitrary spectral bands 44 ! 45 !================================================================== 44 ! 45 ! WARNING : Titan adapt. (J. Vatant d'Ollone, 2017) 46 ! - ONLY THE NO AEROSOL CASE FOR NOW SINCE WE COMPUTE THEM ANOTHER WAY ! 47 ! - This routine is just here to keep the code running without unplugging all (yet) 48 !================================================================================================ 46 49 47 50 ! Optical properties (read in external ASCII files) … … 106 109 endif 107 110 do iaer=1,naerkind 108 if (iaer.eq. iaero_co2) then111 if (iaer.eq.1) then ! JVO 2017 : Now iaer = 1 is always dummy co2 for noaero case, since we don't use aerosols 109 112 forgetit=.true. 110 if (.not.noaero) then111 print*, 'naerkind= co2', iaer112 end if113 113 ! visible 114 114 if(forgetit)then … … 130 130 ! JB thinks this shouldn't matter too much, but it needs to be 131 131 ! fixed / decided for the final version. 132 133 if (iaer.eq.iaero_h2o) then134 print*, 'naerkind= h2o', iaer135 136 ! visible137 file_id(iaer,1) = 'optprop_icevis_n50.dat'138 lamrefvis(iaer)=1.5E-6 ! 1.5um OMEGA/MEx139 ! infrared140 file_id(iaer,2) = 'optprop_iceir_n50.dat'141 lamrefir(iaer)=12.1E-6 ! 825cm-1 TES/MGS142 endif143 144 if (iaer.eq.iaero_dust) then145 print*, 'naerkind= dust', iaer146 147 ! visible148 file_id(iaer,1) = 'optprop_dustvis_n50.dat'149 !lamrefvis(iaer)=1.5E-6 ! 1.5um OMEGA/MEx150 lamrefvis(iaer)=0.67e-6151 ! infrared152 file_id(iaer,2) = 'optprop_dustir_n50.dat'153 !lamrefir(iaer)=12.1E-6 ! 825cm-1 TES/MGS154 lamrefir(iaer)=9.3E-6155 endif156 157 if (iaer.eq.iaero_h2so4) then158 print*, 'naerkind= h2so4', iaer159 160 ! visible161 file_id(iaer,1) = 'optprop_h2so4vis_n20.dat'162 !lamrefir(iaer)= doesn't exist?163 lamrefvis(iaer)=1.5E-6 ! no idea, must find164 ! infrared165 file_id(iaer,2) = 'optprop_h2so4ir_n20.dat'166 !lamrefir(iaer)=12.1E-6 ! 825cm-1 TES/MGS167 lamrefir(iaer)=9.3E-6 ! no idea, must find168 ! added by LK169 endif170 132 171 133 if (iaer.eq.iaero_back2lay) then … … 328 290 329 291 jfile = jfile+1 330 IF ((idomain.NE. iaero_co2).OR.(iaer.NE.iaero_co2)) THEN292 IF ((idomain.NE.1).OR.(iaer.NE.1)) THEN 331 293 endwhile = .true. 332 294 ENDIF … … 346 308 347 309 ! 1.5 If Francois' data, convert wvl to metres 348 if(iaer.eq. iaero_co2)then310 if(iaer.eq.1)then 349 311 if(forgetit)then 350 312 ! print*,'please sort out forgetit for naerkind>1' -
trunk/LMDZ.TITAN/libf/phytitan/sugas_corrk.F90
r1521 r1647 29 29 use gases_h 30 30 use ioipsl_getin_p_mod, only: getin_p 31 use callkeys_mod, only: varactive,varfixed,graybody,callgasvis,& 32 continuum,H2Ocont_simple 31 use callkeys_mod, only: graybody,callgasvis, continuum 33 32 implicit none 34 33 … … 86 85 endif 87 86 88 if(ngas.eq.1 .and. (varactive.or.varfixed))then 89 print*,'You have varactive/fixed=.true. but the database [', & 90 corrkdir(1:LEN_TRIM(corrkdir)), & 91 '] has no variable species, exiting.' 92 call abort 93 elseif(ngas.gt.5 .or. ngas.lt.1)then 87 if(ngas.gt.5 .or. ngas.lt.1)then 94 88 print*,ngas,' species in database [', & 95 89 corrkdir(1:LEN_TRIM(corrkdir)), & … … 112 106 read(111,*) wrefvar 113 107 close(111) 114 115 if(L_REFVAR.gt.1 .and. (.not.varactive) .and. (.not.varfixed))then116 print*,'You have varactive and varfixed=.false. and the database [', &117 corrkdir(1:LEN_TRIM(corrkdir)), &118 '] has a variable species.'119 call abort120 endif121 108 122 109 ! Check that gastype and gnom match … … 638 625 dummy = -9999 639 626 call interpolateN2H2(592.D+0,278.15D+0,200000.D+0,10000.D+0,testcont,.true.,dummy) 640 elseif (jgas .eq. igas_He) then641 dummy = -9999642 call interpolateH2He(500.D+0,250.D+0,200000.D+0,10000.D+0,testcont,.true.,dummy)643 627 endif 644 628 enddo 645 646 elseif (igas .eq. igas_H2O) then647 648 ! H2O is special649 if(H2Ocont_simple)then650 call interpolateH2Ocont_PPC(990.D+0,296.D+0,683.2D+0*2,0.D+0,testcont,.true.)651 else652 dummy = -9999653 call interpolateH2Ocont_CKD(990.D+0,296.D+0,683.2D+0*2,0.D+0,testcont,.true.,dummy)654 endif655 629 656 630 endif -
trunk/LMDZ.TITAN/libf/phytitan/surfdat_h.F90
r1482 r1647 17 17 !$OMP THREADPRIVATE(zmea,zstd,zsig,zgam,zthe) 18 18 19 real,allocatable,dimension(:) :: dryness !"Dryness coefficient" for grnd water ice sublimation20 ! AS: previously in tracer.h. it is more logical here.21 22 logical,allocatable,dimension(:) :: watercaptag !! was in watercap.h23 !$OMP THREADPRIVATE(dryness,watercaptag)24 25 19 end module surfdat_h 26 20 -
trunk/LMDZ.TITAN/libf/phytitan/surfini.F
r1482 r1647 1 SUBROUTINE surfini(ngrid,nq,qsurf,albedo,albedo_bareground, 2 & albedo_snow_SPECTV,albedo_co2_ice_SPECTV) 1 SUBROUTINE surfini(ngrid,nq,qsurf,albedo,albedo_bareground) 3 2 4 3 USE surfdat_h, only: albedodat 5 USE tracer_h, only: igcm_co2_ice6 4 use planetwide_mod, only: planetwide_maxval, planetwide_minval 7 5 use radinc_h, only : L_NSPECTV 8 use callkeys_mod, only : albedosnow, albedoco2ice9 6 10 7 IMPLICIT NONE … … 26 23 REAL,INTENT(OUT) :: albedo(ngrid,L_NSPECTV) 27 24 REAL,INTENT(OUT) :: albedo_bareground(ngrid) 28 REAL,INTENT(OUT) :: albedo_snow_SPECTV(L_NSPECTV)29 REAL,INTENT(OUT) :: albedo_co2_ice_SPECTV(L_NSPECTV)30 25 REAL,INTENT(IN) :: qsurf(ngrid,nq) ! tracer on surface (kg/m2) 31 26 … … 35 30 c======================================================================= 36 31 37 ! Step 1 : Initialisation of the Spectral Albedos. 38 DO nw=1,L_NSPECTV 39 albedo_snow_SPECTV(nw)=albedosnow 40 albedo_co2_ice_SPECTV(nw)=albedoco2ice 41 ENDDO 42 43 44 ! Step 2 : We get the bare ground albedo from the start files. 32 ! We get the bare ground albedo from the start files. 45 33 DO ig=1,ngrid 46 34 albedo_bareground(ig)=albedodat(ig) … … 54 42 write(*,*) 'surfini: maximum bare ground albedo',max_albedo 55 43 56 57 ! Step 3 : We modify the albedo considering some CO2 at the surface. We dont take into account water ice (this is made in hydrol after the first timestep) ... 58 if (igcm_co2_ice.ne.0) then 59 DO ig=1,ngrid 60 IF (qsurf(ig,igcm_co2_ice) .GT. 1.) THEN ! This was changed by MT2015. Condition for ~1mm of CO2 ice deposit. 61 DO nw=1,L_NSPECTV 62 albedo(ig,nw)=albedo_co2_ice_SPECTV(nw) 63 ENDDO 64 END IF 65 ENDDO 66 else 67 write(*,*) "surfini: No CO2 ice tracer on surface ..." 68 write(*,*) " and therefore no albedo change." 69 endif 44 70 45 call planetwide_minval(albedo,min_albedo) 71 46 call planetwide_maxval(albedo,max_albedo) -
trunk/LMDZ.TITAN/libf/phytitan/tracer_h.F90
r1621 r1647 20 20 real r3n_q ! used to compute r0 from number and mass mixing ratio 21 21 real rho_dust ! Mars dust density (kg.m-3) 22 real rho_ice ! Water ice density (kg.m-3)23 real rho_co2 ! CO2 ice density (kg.m-3)24 22 real ref_r0 ! for computing reff=ref_r0*r0 (in log.n. distribution) 25 23 !$OMP THREADPRIVATE(noms,mmol,radius,rho_q,qext,alpha_lift,alpha_devil,qextrhor, & 26 !$OMP varian,r3n_q,rho_dust,rho_ice,r ho_co2,ref_r0)24 !$OMP varian,r3n_q,rho_dust,rho_ice,ref_r0) 27 25 28 26 ! tracer indexes: these are initialized in initracer and should be 0 if the … … 33 31 integer :: igcm_dust_mass ! dust mass mixing ratio (for transported dust) 34 32 integer :: igcm_dust_number ! dust number mixing ratio (transported dust) 35 ! water36 integer :: igcm_h2o_vap ! water vapour37 integer :: igcm_h2o_ice ! water ice38 33 ! chemistry: 39 integer :: igcm_co240 34 integer :: igcm_co 41 35 integer :: igcm_o … … 52 46 ! other tracers 53 47 integer :: igcm_ar_n2 ! for simulations using co2 +neutral gaz 54 integer :: igcm_co2_ice ! CO2 ice 55 !$OMP THREADPRIVATE(igcm_dustbin,igcm_dust_mass,igcm_dust_number,igcm_h2o_vap,igcm_h2o_ice, & 56 !$OMP igcm_co2,igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h,igcm_h2,igcm_oh, & 57 !$OMP igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_ar_n2,igcm_co2_ice) 48 !$OMP THREADPRIVATE(igcm_dustbin,igcm_dust_mass,igcm_dust_number, & 49 !$OMP igcm_co,igcm_o,igcm_o1d,igcm_o2,igcm_o3,igcm_h,igcm_h2,igcm_oh, & 50 !$OMP igcm_ho2,igcm_h2o2,igcm_n2,igcm_ar,igcm_ar_n2) 58 51 59 52 end module tracer_h -
trunk/LMDZ.TITAN/libf/phytitan/turbdiff.F90
r1477 r1647 1 subroutine turbdiff(ngrid,nlay,nq, rnat,&1 subroutine turbdiff(ngrid,nlay,nq, & 2 2 ptimestep,pcapcal,lecrit, & 3 3 pplay,pplev,pzlay,pzlev,pz0, & … … 5 5 pdtfi,pdqfi,pfluxsrf, & 6 6 Pdudif,pdvdif,pdtdif,pdtsrf,sensibFlux,pq2, & 7 pdqdif,pdqevap,pdqsdif,flux_u,flux_v,lastcall) 8 9 use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol,Psat_water 7 pdqdif,pdqsdif,flux_u,flux_v,lastcall) 8 10 9 use radcommon_h, only : sigma, glat 11 use surfdat_h, only: dryness12 use tracer_h, only: igcm_h2o_vap, igcm_h2o_ice13 10 use comcstfi_mod, only: rcp, g, r, cpp 14 use callkeys_mod, only: water,tracer,nosurf11 use callkeys_mod, only: tracer,nosurf 15 12 16 13 implicit none … … 62 59 REAL,INTENT(IN) :: pcapcal(ngrid) 63 60 REAL,INTENT(INOUT) :: pq2(ngrid,nlay+1) 64 REAL,INTENT(OUT) :: flux_u(ngrid),flux_v(ngrid) 65 REAL,INTENT(IN) :: rnat(ngrid) 61 REAL,INTENT(OUT) :: flux_u(ngrid),flux_v(ngrid) 66 62 LOGICAL,INTENT(IN) :: lastcall ! not used 67 63 … … 109 105 INTEGER iq 110 106 REAL zq(ngrid,nlay,nq) 111 REAL zqnoevap(ngrid,nlay) !special for water case to compute where evaporated water goes.112 REAL pdqevap(ngrid,nlay) !special for water case to compute where evaporated water goes.113 107 REAL zdmassevap(ngrid) 114 108 REAL rho(ngrid) ! near-surface air density 115 REAL qsat(ngrid),psat(ngrid)116 109 REAL kmixmin 117 110 118 ! Variables added for implicit latent heat inclusion119 ! --------------------------------------------------120 real dqsat(ngrid), qsat_temp1, qsat_temp2,psat_temp121 122 integer, save :: ivap, iliq, iliq_surf,iice_surf ! also make liq for clarity on surface...123 !$OMP THREADPRIVATE(ivap,iliq,iliq_surf,iice_surf)124 111 125 112 real, parameter :: karman=0.4 … … 133 120 ! -------------- 134 121 135 IF (firstcall) THEN 136 137 if(water)then 138 ivap=igcm_h2o_vap 139 iliq=igcm_h2o_ice 140 iliq_surf=igcm_h2o_vap 141 iice_surf=igcm_h2o_ice ! simply to make the code legible 142 ! to be generalised 143 else 144 ivap=0 145 iliq=0 146 iliq_surf=0 147 iice_surf=0 ! simply to make the code legible 148 endif 122 IF (firstcall) THEN 123 149 124 sensibFlux(:)=0. 150 125 … … 202 177 ENDDO 203 178 ENDDO 204 if (water) then205 DO ilev=1,nlay206 DO ig=1,ngrid207 zqnoevap(ig,ilev)=pq(ig,ilev,ivap) + pdqfi(ig,ilev,ivap)*ptimestep208 ENDDO209 ENDDO210 Endif211 179 end if 212 180 … … 405 373 ! flux (if any) from subsurface 406 374 407 if(.not.water) then408 375 409 376 DO ig=1,ngrid … … 427 394 ENDDO 428 395 429 endif ! not water430 396 431 397 !----------------------------------------------------------------------- … … 446 412 ! ----------------------- 447 413 do iq=1,nq 448 449 if (iq.ne.ivap) then450 414 451 415 DO ig=1,ngrid … … 462 426 ENDDO 463 427 ENDDO 464 465 if ((water).and.(iq.eq.iliq)) then 466 ! special case for condensed water tracer: do not include 467 ! h2o ice tracer from surface (which is set when handling 468 ! h2o vapour case (see further down). 469 ! zb(ig,1)=0 if iq ne ivap 470 DO ig=1,ngrid 471 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 472 zcq(ig,1)=(zmass(ig,1)*zq(ig,1,iq)+zfluxq(ig,2)*zcq(ig,2))*z1(ig) 473 ENDDO 474 else ! general case 475 do ig=1,ngrid 476 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 477 zcq(ig,1)=(zmass(ig,1)*zq(ig,1,iq)+zfluxq(ig,2)*zcq(ig,2)+(-pdqsdif(ig,iq))*ptimestep)*z1(ig) 478 ! tracer flux from surface 479 ! currently pdqsdif always zero here, 480 ! so last line is superfluous 481 enddo 482 endif ! of if (water.and.(iq.eq.igcm_h2o_ice)) 483 428 429 do ig=1,ngrid 430 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 431 zcq(ig,1)=(zmass(ig,1)*zq(ig,1,iq)+zfluxq(ig,2)*zcq(ig,2)+(-pdqsdif(ig,iq))*ptimestep)*z1(ig) 432 ! tracer flux from surface 433 ! currently pdqsdif always zero here, 434 ! so last line is superfluous 435 enddo 484 436 485 437 ! Starting upward calculations for simple tracer mixing (e.g., dust) … … 493 445 end do 494 446 end do 495 496 endif ! if (iq.ne.ivap)497 498 ! Calculate temperature tendency including latent heat term499 ! and assuming an infinite source of water on the ground500 ! ------------------------------------------------------------------501 502 if (water.and.(iq.eq.ivap)) then503 504 ! compute evaporation efficiency505 do ig=1,ngrid506 if(nint(rnat(ig)).eq.1)then507 dryness(ig)=pqsurf(ig,iliq_surf)+pqsurf(ig,iice_surf)508 dryness(ig)=MIN(1.,2*dryness(ig)/mx_eau_sol)509 dryness(ig)=MAX(0.,dryness(ig))510 endif511 enddo512 513 do ig=1,ngrid514 ! Calculate the value of qsat at the surface (water)515 call Psat_water(ptsrf(ig),pplev(ig,1),psat(ig),qsat(ig))516 call Psat_water(ptsrf(ig)-0.0001,pplev(ig,1),psat_temp,qsat_temp1)517 call Psat_water(ptsrf(ig)+0.0001,pplev(ig,1),psat_temp,qsat_temp2)518 dqsat(ig)=(qsat_temp2-qsat_temp1)/0.0002519 ! calculate dQsat / dT by finite differences520 ! we cannot use the updated temperature value yet...521 enddo522 523 ! coefficients for q524 525 do ig=1,ngrid526 z1(ig)=1./(zmass(ig,nlay)+zfluxq(ig,nlay))527 zcq(ig,nlay)=zmass(ig,nlay)*zq(ig,nlay,iq)*z1(ig)528 zdq(ig,nlay)=zfluxq(ig,nlay)*z1(ig)529 enddo530 531 do ilay=nlay-1,2,-1532 do ig=1,ngrid533 z1(ig)=1./(zmass(ig,ilay)+zfluxq(ig,ilay)+zfluxq(ig,ilay+1)*(1.-zdq(ig,ilay+1)))534 zcq(ig,ilay)=(zmass(ig,ilay)*zq(ig,ilay,iq)+zfluxq(ig,ilay+1)*zcq(ig,ilay+1))*z1(ig)535 zdq(ig,ilay)=zfluxq(ig,ilay)*z1(ig)536 enddo537 enddo538 539 do ig=1,ngrid540 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,1)*dryness(ig)+zfluxq(ig,2)*(1.-zdq(ig,2)))541 zcq(ig,1)=(zmass(ig,1)*zq(ig,1,iq)+zfluxq(ig,2)*zcq(ig,2))*z1(ig)542 zdq(ig,1)=dryness(ig)*zfluxq(ig,1)*z1(ig)543 enddo544 545 do ig=1,ngrid546 !calculation of surface temperature547 zdq0(ig) = dqsat(ig)548 zcq0(ig) = qsat(ig)-dqsat(ig)*ptsrf(ig)549 550 z1(ig) = pcapcal(ig)*ptsrf(ig) +cpp*zfluxt(ig,1)*zct(ig,1)*zovExner(ig,1) &551 + zdplanck(ig)*ptsrf(ig) + pfluxsrf(ig)*ptimestep &552 + zfluxq(ig,1)*dryness(ig)*RLVTT*((zdq(ig,1)-1.0)*zcq0(ig)+zcq(ig,1))553 554 z2(ig) = pcapcal(ig) + cpp*zfluxt(ig,1)*(1.-zovExner(ig,1)*zdt(ig,1)) &555 + zdplanck(ig)+zfluxq(ig,1)*dryness(ig)*RLVTT*zdq0(ig)*(1.0-zdq(ig,1))556 557 ztsrf(ig) = z1(ig) / z2(ig)558 559 ! calculation of qs and q1560 zq0(ig) = zcq0(ig)+zdq0(ig)*ztsrf(ig)561 zq(ig,1,iq) = zcq(ig,1)+zdq(ig,1)*zq0(ig)562 563 ! calculation of evaporation564 dqsdif_total(ig)=zfluxq(ig,1)*dryness(ig)*(zq(ig,1,ivap)-zq0(ig))565 566 ! --------------------------------------------------------567 ! Now check if we've taken too much water from the surface568 ! This can only occur on the continent569 ! If we do, we recompute Tsurf, T1 and q1 accordingly570 if((-dqsdif_total(ig).gt.(pqsurf(ig,iice_surf)+pqsurf(ig,iliq_surf))).and.rnat(ig).eq.1)then571 !water flux * ptimestep572 dqsdif_total(ig)=-(pqsurf(ig,iice_surf)+pqsurf(ig,iliq_surf))573 574 !recompute surface temperature575 z1(ig) = pcapcal(ig)*ptsrf(ig) +cpp*zfluxq(ig,1)*zct(ig,1)*zovExner(ig,1) &576 + zdplanck(ig)*ptsrf(ig) + pfluxsrf(ig)*ptimestep &577 + RLVTT*dqsdif_total(ig)578 z2(ig) = pcapcal(ig) + cpp*zfluxq(ig,1)*(1.-zovExner(ig,1)*zdt(ig,1)) &579 + zdplanck(ig)580 ztsrf(ig) = z1(ig) / z2(ig)581 582 !recompute q1 with new water flux from surface583 zq(ig,1,iq) = (zmass(ig,1)*(pq(ig,1,iq)+ptimestep*pdqfi(ig,1,iq)) &584 +zfluxq(ig,2)*zcq(ig,2)-dqsdif_total(ig)) &585 / (zmass(ig,1)+(1.-zdq(ig,2))*zfluxq(ig,2))586 end if587 588 ! calculation surface T tendency and T(1)589 pdtsrf(ig) = (ztsrf(ig) - ptsrf(ig))/ptimestep590 zt(ig,1) = zct(ig,1) + zdt(ig,1)*ztsrf(ig)591 enddo592 593 594 ! recalculate temperature and q(vap) to top of atmosphere, starting from ground595 do ilay=2,nlay596 do ig=1,ngrid597 zq(ig,ilay,iq)=zcq(ig,ilay)+zdq(ig,ilay)*zq(ig,ilay-1,iq)598 zt(ig,ilay)=zct(ig,ilay)+zdt(ig,ilay)*zt(ig,ilay-1)599 end do600 end do601 602 603 do ig=1,ngrid604 ! --------------------------------------------------------------------------605 ! On the ocean, if T > 0 C then the vapour tendency must replace the ice one606 ! The surface vapour tracer is actually liquid. To make things difficult.607 608 if (nint(rnat(ig)).eq.0) then ! unfrozen ocean609 610 pdqsdif(ig,iliq_surf)=dqsdif_total(ig)/ptimestep611 pdqsdif(ig,iice_surf)=0.0612 613 elseif (nint(rnat(ig)).eq.1) then ! (continent)614 ! If water is evaporating / subliming, we take it from ice before liquid615 ! -- is this valid??616 if(dqsdif_total(ig).lt.0)then617 if (-dqsdif_total(ig).gt.pqsurf(ig,iice_surf))then618 pdqsdif(ig,iice_surf) = -pqsurf(ig,iice_surf)/ptimestep ! removes all the ice!619 pdqsdif(ig,iliq_surf) = dqsdif_total(ig)/ptimestep- pdqsdif(ig,iice_surf) ! take the remainder from the liquid instead620 else621 pdqsdif(ig,iice_surf)=dqsdif_total(ig)/ptimestep622 pdqsdif(ig,iliq_surf)=0.623 end if624 else !dqsdif_total(ig).ge.0625 !If water vapour is condensing, we must decide whether it forms ice or liquid.626 if(ztsrf(ig).gt.T_h2O_ice_liq)then627 pdqsdif(ig,iice_surf)=0.0628 pdqsdif(ig,iliq_surf)=dqsdif_total(ig)/ptimestep629 else630 pdqsdif(ig,iice_surf)=dqsdif_total(ig)/ptimestep631 pdqsdif(ig,iliq_surf)=0.0632 endif633 endif634 635 elseif (nint(rnat(ig)).eq.2) then ! (continental glaciers)636 pdqsdif(ig,iliq_surf)=0.0637 pdqsdif(ig,iice_surf)=dqsdif_total(ig)/ptimestep638 639 endif !rnat640 end do ! of DO ig=1,ngrid641 642 endif ! if (water et iq=ivap)643 447 end do ! of do iq=1,nq 644 645 if (water) then ! special case where we recompute water mixing without any evaporation. 646 ! The difference with the first calculation then tells us where evaporated water has gone 647 648 DO ig=1,ngrid 649 z1(ig)=1./(zmass(ig,nlay)+zfluxq(ig,nlay)) 650 zcq(ig,nlay)=zmass(ig,nlay)*zqnoevap(ig,nlay)*z1(ig) 651 zdq(ig,nlay)=zfluxq(ig,nlay)*z1(ig) 652 ENDDO 653 654 DO ilay=nlay-1,2,-1 655 DO ig=1,ngrid 656 z1(ig)=1./(zmass(ig,ilay)+zfluxq(ig,ilay)+zfluxq(ig,ilay+1)*(1.-zdq(ig,ilay+1))) 657 zcq(ig,ilay)=(zmass(ig,ilay)*zqnoevap(ig,ilay)+zfluxq(ig,ilay+1)*zcq(ig,ilay+1))*z1(ig) 658 zdq(ig,ilay)=zfluxq(ig,ilay)*z1(ig) 659 ENDDO 660 ENDDO 661 662 do ig=1,ngrid 663 z1(ig)=1./(zmass(ig,1)+zfluxq(ig,2)*(1.-zdq(ig,2))) 664 zcq(ig,1)=(zmass(ig,1)*zqnoevap(ig,1)+zfluxq(ig,2)*zcq(ig,2))*z1(ig) 665 enddo 666 667 ! Starting upward calculations for simple tracer mixing (e.g., dust) 668 do ig=1,ngrid 669 zqnoevap(ig,1)=zcq(ig,1) 670 end do 671 672 do ilay=2,nlay 673 do ig=1,ngrid 674 zqnoevap(ig,ilay)=zcq(ig,ilay)+zdq(ig,ilay)*zqnoevap(ig,ilay-1) 675 end do 676 end do 677 678 endif ! if water 679 680 448 681 449 endif ! tracer 682 450 … … 706 474 enddo 707 475 enddo 708 if (water) then709 do ilev = 1, nlay710 do ig=1,ngrid711 pdqevap(ig,ilev)=(zq(ig,ilev,ivap)-zqnoevap(ig,ilev))/ptimestep712 enddo713 enddo714 do ig=1,ngrid715 zdmassevap(ig)=SUM(pdqevap(ig,:)*zmass(ig,:))*ptimestep716 end do717 endif718 476 endif 719 720 if(water)then721 call writediagfi(ngrid,'beta','Dryness coefficient',' ',2,dryness)722 if (tracer) then723 call writediagfi(ngrid,'dqevap','evaporated water vapor specific concentration','s-1',3,pdqevap)724 endif725 endif726 477 727 478 ! if(lastcall)then -
trunk/LMDZ.TITAN/libf/phytitan/vdifc.F
r1542 r1647 1 subroutine vdifc(ngrid,nlay,nq, rnat,ppopsk,1 subroutine vdifc(ngrid,nlay,nq,ppopsk, 2 2 & ptimestep,pcapcal,lecrit, 3 3 & pplay,pplev,pzlay,pzlev,pz0, … … 7 7 & pdqdif,pdqsdif,lastcall) 8 8 9 use watercommon_h, only : RLVTT, T_h2O_ice_liq, RCPD, mx_eau_sol10 9 use radcommon_h, only : sigma 11 10 USE surfdat_h 12 11 USE tracer_h 13 12 use comcstfi_mod, only: g, r, cpp, rcp 14 use callkeys_mod, only: water,tracer,nosurf13 use callkeys_mod, only: tracer,nosurf 15 14 16 15 implicit none … … 53 52 REAL pdtsrf(ngrid),sensibFlux(ngrid),pcapcal(ngrid) 54 53 REAL pq2(ngrid,nlay+1) 55 56 real rnat(ngrid) 54 57 55 58 56 ! Arguments added for condensation … … 116 114 REAL kmixmin 117 115 118 ! Variables added for implicit latent heat inclusion119 ! --------------------------------------------------120 real latconst, dqsat(ngrid), qsat_temp1, qsat_temp2121 real z1_Tdry(ngrid), z2_Tdry(ngrid)122 real z1_T(ngrid), z2_T(ngrid)123 real zb_T(ngrid)124 real zc_T(ngrid,nlay)125 real zd_T(ngrid,nlay)126 real lat1(ngrid), lat2(ngrid)127 real surfh2otot128 logical surffluxdiag129 integer isub ! sub-loop for precision130 131 integer ivap, iice ! also make liq for clarity on surface...132 save ivap, iice133 !$OMP THREADPRIVATE(ivap,iice)134 135 116 real, parameter :: karman=0.4 136 117 real cd0, roughratio 137 118 138 logical forceWC139 119 real masse, Wtot, Wdiff 140 120 141 121 real dqsdif_total(ngrid) 142 122 real zq0(ngrid) 143 144 forceWC=.true.145 ! forceWC=.false.146 123 147 124 … … 155 132 ! PRINT*,'In vdifc: Tcond(P=1mb)=',tcond1mb,' Lcond=',latcond 156 133 ! PRINT*,' acond,bcond',acond,bcond 157 158 if(water)then159 ! iliq=igcm_h2o_vap160 ivap=igcm_h2o_vap161 iice=igcm_h2o_ice ! simply to make the code legible162 ! to be generalised later163 endif164 134 165 135 firstcall=.false. … … 404 374 ! flux (if any) from subsurface 405 375 406 if(.not.water) then407 376 408 377 DO ig=1,ngrid … … 427 396 ENDDO 428 397 429 endif ! not water430 398 431 399 !----------------------------------------------------------------------- … … 446 414 ! ----------------------- 447 415 do iq=1,nq 448 449 if (iq.ne.igcm_h2o_vap) then450 416 451 417 DO ig=1,ngrid … … 465 431 ENDDO 466 432 467 if ((water).and.(iq.eq.iice)) then 468 ! special case for water ice tracer: do not include 469 ! h2o ice tracer from surface (which is set when handling 470 ! h2o vapour case (see further down). 471 ! zb(ig,1)=0 if iq ne ivap 472 DO ig=1,ngrid 473 z1(ig)=1./(za(ig,1)+ 474 & zb(ig,2)*(1.-zdq(ig,2))) 475 zcq(ig,1)=(za(ig,1)*zq(ig,1,iq)+ 476 & zb(ig,2)*zcq(ig,2))*z1(ig) 477 ENDDO 478 else ! general case 433 434 479 435 DO ig=1,ngrid 480 436 z1(ig)=1./(za(ig,1)+ … … 487 443 ! so last line is superfluous 488 444 enddo 489 endif ! of if (water.and.(iq.eq.igcm_h2o_ice))490 445 491 446 … … 502 457 end do 503 458 504 endif ! if (iq.ne.igcm_h2o_vap) 505 506 ! Calculate temperature tendency including latent heat term 507 ! and assuming an infinite source of water on the ground 508 ! ------------------------------------------------------------------ 509 510 if (water.and.(iq.eq.igcm_h2o_vap)) then 511 512 ! compute evaporation efficiency 513 do ig = 1, ngrid 514 if(nint(rnat(ig)).eq.1)then 515 dryness(ig)=pqsurf(ig,ivap)+pqsurf(ig,iice) 516 dryness(ig)=MIN(1.,2*dryness(ig)/mx_eau_sol) 517 dryness(ig)=MAX(0.,dryness(ig)) 518 endif 519 enddo 520 521 do ig=1,ngrid 522 523 ! Calculate the value of qsat at the surface (water) 524 call watersat(ptsrf(ig),pplev(ig,1),qsat(ig)) 525 call watersat(ptsrf(ig)-0.0001,pplev(ig,1),qsat_temp1) 526 call watersat(ptsrf(ig)+0.0001,pplev(ig,1),qsat_temp2) 527 dqsat(ig)=(qsat_temp2-qsat_temp1)/0.0002 528 ! calculate dQsat / dT by finite differences 529 ! we cannot use the updated temperature value yet... 530 531 enddo 532 533 ! coefficients for q 534 535 do ig=1,ngrid 536 z1(ig)=1./(za(ig,nlay)+zb(ig,nlay)) 537 zcq(ig,nlay)=za(ig,nlay)*zq(ig,nlay,iq)*z1(ig) 538 zdq(ig,nlay)=zb(ig,nlay)*z1(ig) 539 enddo 540 541 do ilay=nlay-1,2,-1 542 do ig=1,ngrid 543 z1(ig)=1./(za(ig,ilay)+zb(ig,ilay)+ 544 $ zb(ig,ilay+1)*(1.-zdq(ig,ilay+1))) 545 zcq(ig,ilay)=(za(ig,ilay)*zq(ig,ilay,iq)+ 546 $ zb(ig,ilay+1)*zcq(ig,ilay+1))*z1(ig) 547 zdq(ig,ilay)=zb(ig,ilay)*z1(ig) 548 enddo 549 enddo 550 551 do ig=1,ngrid 552 z1(ig)=1./(za(ig,1)+zb(ig,1)*dryness(ig)+ 553 $ zb(ig,2)*(1.-zdq(ig,2))) 554 zcq(ig,1)=(za(ig,1)*zq(ig,1,iq)+ 555 $ zb(ig,2)*zcq(ig,2))*z1(ig) 556 zdq(ig,1)=dryness(ig)*zb(ig,1)*z1(ig) 557 enddo 558 559 ! calculation of h0 and h1 560 do ig=1,ngrid 561 zdq0(ig) = dqsat(ig) 562 zcq0(ig) = qsat(ig)-dqsat(ig)*ptsrf(ig) 563 564 z1(ig) = pcapcal(ig)*ptsrf(ig) +cpp*zb(ig,1)*zc(ig,1) 565 & + zdplanck(ig)*ptsrf(ig) + pfluxsrf(ig)*ptimestep 566 & + zb(ig,1)*dryness(ig)*RLVTT* 567 & ((zdq(ig,1)-1.0)*zcq0(ig)+zcq(ig,1)) 568 569 z2(ig) = pcapcal(ig) + cpp*zb(ig,1)*(1.-zd(ig,1)) 570 & +zdplanck(ig) 571 & +zb(ig,1)*dryness(ig)*RLVTT*zdq0(ig)* 572 & (1.0-zdq(ig,1)) 573 574 ztsrf2(ig) = z1(ig) / z2(ig) 575 pdtsrf(ig) = (ztsrf2(ig) - ptsrf(ig))/ptimestep 576 zh(ig,1) = zc(ig,1) + zd(ig,1)*ztsrf2(ig) 577 enddo 578 579 ! calculation of qs and q1 580 do ig=1,ngrid 581 zq0(ig) = zcq0(ig)+zdq0(ig)*ztsrf2(ig) 582 zq(ig,1,iq) = zcq(ig,1)+zdq(ig,1)*zq0(ig) 583 enddo 584 585 ! calculation of evaporation 586 do ig=1,ngrid 587 evap(ig)= zb(ig,1)*dryness(ig)*(zq(ig,1,ivap)-zq0(ig)) 588 dqsdif_total(ig)=evap(ig) 589 enddo 590 591 ! recalculate temperature and q(vap) to top of atmosphere, starting from ground 592 do ilay=2,nlay 593 do ig=1,ngrid 594 zq(ig,ilay,iq)=zcq(ig,ilay) 595 & +zdq(ig,ilay)*zq(ig,ilay-1,iq) 596 zh(ig,ilay)=zc(ig,ilay)+zd(ig,ilay)*zh(ig,ilay-1) 597 end do 598 end do 599 600 do ig=1,ngrid 601 602 ! -------------------------------------------------------------------------- 603 ! On the ocean, if T > 0 C then the vapour tendency must replace the ice one 604 ! The surface vapour tracer is actually liquid. To make things difficult. 605 606 if (nint(rnat(ig)).eq.0) then ! unfrozen ocean 607 608 pdqsdif(ig,ivap)=dqsdif_total(ig)/ptimestep 609 pdqsdif(ig,iice)=0.0 610 611 612 elseif (nint(rnat(ig)).eq.1) then ! (continent) 613 614 ! -------------------------------------------------------- 615 ! Now check if we've taken too much water from the surface 616 ! This can only occur on the continent 617 618 ! If water is evaporating / subliming, we take it from ice before liquid 619 ! -- is this valid?? 620 if(dqsdif_total(ig).lt.0)then 621 pdqsdif(ig,iice)=dqsdif_total(ig)/ptimestep 622 pdqsdif(ig,iice)=max(-pqsurf(ig,iice)/ptimestep 623 & ,pdqsdif(ig,iice)) 624 endif 625 ! sublimation only greater than qsurf(ice) 626 ! ---------------------------------------- 627 ! we just convert some liquid to vapour too 628 ! if latent heats are the same, no big deal 629 if (-dqsdif_total(ig).gt.pqsurf(ig,iice))then 630 pdqsdif(ig,iice) = -pqsurf(ig,iice)/ptimestep ! removes all the ice! 631 pdqsdif(ig,ivap) = dqsdif_total(ig)/ptimestep 632 & - pdqsdif(ig,iice) ! take the remainder from the liquid instead 633 pdqsdif(ig,ivap) = max(-pqsurf(ig,ivap)/ptimestep 634 & ,pdqsdif(ig,ivap)) 635 endif 636 637 endif ! if (rnat.ne.1) 638 639 ! If water vapour is condensing, we must decide whether it forms ice or liquid. 640 if(dqsdif_total(ig).gt.0)then ! a bug was here! 641 if(ztsrf2(ig).gt.T_h2O_ice_liq)then 642 pdqsdif(ig,iice)=0.0 643 pdqsdif(ig,ivap)=dqsdif_total(ig)/ptimestep 644 else 645 pdqsdif(ig,iice)=dqsdif_total(ig)/ptimestep 646 pdqsdif(ig,ivap)=0.0 647 endif 648 endif 649 650 end do ! of DO ig=1,ngrid 651 endif ! if (water et iq=ivap) 459 652 460 end do ! of do iq=1,nq 653 461 endif ! traceur … … 685 493 enddo 686 494 687 if(water.and.forceWC)then ! force water conservation in model688 ! we calculate the difference and add it to the ground689 ! this is ugly and should be improved in the future690 do ig=1,ngrid691 Wtot=0.0692 do ilay=1,nlay693 masse = (pplev(ig,ilay) - pplev(ig,ilay+1))/g694 ! Wtot=Wtot+masse*(zq(ig,ilay,iice)-695 ! & (pq(ig,ilay,iice)+pdqfi(ig,ilay,iice)*ptimestep))696 Wtot=Wtot+masse*(zq(ig,ilay,ivap)-697 & (pq(ig,ilay,ivap)+pdqfi(ig,ilay,ivap)*ptimestep))698 enddo699 Wdiff=Wtot/ptimestep+pdqsdif(ig,ivap)+pdqsdif(ig,iice)700 701 if(ztsrf2(ig).gt.T_h2O_ice_liq)then702 pdqsdif(ig,ivap)=pdqsdif(ig,ivap)-Wdiff703 else704 pdqsdif(ig,iice)=pdqsdif(ig,iice)-Wdiff705 endif706 enddo707 708 endif709 710 495 endif 711 712 if(water)then713 call writediagfi(ngrid,'beta','Dryness coefficient',' ',2,dryness)714 endif715 496 716 497 ! if(lastcall)then
Note: See TracChangeset
for help on using the changeset viewer.