Changeset 2913
- Timestamp:
- Mar 14, 2023, 10:07:33 AM (22 months ago)
- Location:
- trunk/LMDZ.MARS
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/README
r2911 r2913 3939 3939 == 12/03/2023 == EM 3940 3940 Follow-up on the addition of an nslope dimension, also adapt XIOS outputs. 3941 3942 == 14/03/2023 == RV 3943 Adapt start2archive.F to the subslope parametrisation. 3944 Small correction for newstart. -
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/ini_archive.F
r2573 r2913 1 1 c======================================================================= 2 subroutine ini_archive(nid,idayref,phis,ith,tab_cntrl_fi) 2 subroutine ini_archive(nid,idayref,phis,ith,tab_cntrl_fi 3 & ,def_slope,subslope_dist) 3 4 c======================================================================= 4 5 c … … 40 41 USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy 41 42 USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 43 use comslope_mod, ONLY: nslope 42 44 implicit none 43 45 … … 66 68 REAL phis(ip1jmp1) 67 69 real ith(ip1jmp1,nsoilmx) 70 real subslope_dist(ip1jmp1,nslope) 71 real def_slope(nslope+1) 68 72 REAL tab_cntrl_fi(length) 69 73 … … 77 81 INTEGER idim_tim 78 82 INTEGER idim_nsoilmx ! "subsurface_layers" dimension ID # 83 INTEGER idim_nslope, idim_nslope_p1 79 84 INTEGER nid,nvarid 80 85 real sig_s(llm),s(llm) … … 163 168 ierr = NF_DEF_DIM (nid,"interlayer", llmp1, idim_llmp1) 164 169 ierr = NF_DEF_DIM (nid,"Time", NF_UNLIMITED, idim_tim) 170 ierr = NF_DEF_DIM (nid,"nslope", nslope, idim_nslope) 171 ierr = NF_DEF_DIM (nid,"nslope_plus_1",nslope+1,idim_nslope_p1) 165 172 166 173 c … … 513 520 #endif 514 521 522 c Put subslope dist 523 dims3(1)=idim_rlonv 524 dims3(2)=idim_rlatu 525 dims3(3)=idim_nslope 526 ierr = NF_REDEF (nid) 527 #ifdef NC_DOUBLE 528 ierr = NF_DEF_VAR (nid, "subslope_dist", NF_DOUBLE, 3, 529 . dims3,nvarid) 530 #else 531 ierr = NF_DEF_VAR (nid, "subslope_dist", NF_FLOAT, 3, 532 . dims3,nvarid) 533 #endif 534 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",13, 535 . "subslope_dist") 536 537 ierr = NF_ENDDEF(nid) 538 #ifdef NC_DOUBLE 539 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,subslope_dist) 540 #else 541 ierr = NF_PUT_VAR_REAL (nid,nvarid,subslope_dist) 542 #endif 543 544 c Put def_slope 545 546 ierr = NF_REDEF (nid) 547 #ifdef NC_DOUBLE 548 ierr = NF_DEF_VAR (nid, "def_slope", NF_DOUBLE, 1, 549 . [idim_nslope_p1],nvarid) 550 #else 551 ierr = NF_DEF_VAR (nid, "def_slope", NF_FLOAT, 1, 552 . [idim_nslope_p1],nvarid) 553 #endif 554 ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name",7,"def_slope") 555 ierr = NF_ENDDEF(nid) 556 #ifdef NC_DOUBLE 557 ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,def_slope) 558 #else 559 ierr = NF_PUT_VAR_REAL (nid,nvarid,def_slope) 560 #endif 561 515 562 PRINT*,'iim,jjm,llm,idayref',iim,jjm,llm,idayref 516 563 PRINT*,'rad,omeg,g,mugaz,kappa', -
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F
r2828 r2913 33 33 USE phyetat0_mod, ONLY: phyetat0 34 34 USE exner_hyb_m, ONLY: exner_hyb 35 use comslope_mod, ONLY: nslope,def_slope,def_slope_mean, 36 & subslope_dist 37 USE comcstfi_h, only: pi 35 38 implicit none 36 39 … … 61 64 c Variable Physiques (grille physique) 62 65 c ------------------------------------ 63 REAL tsurf(ngridmx) ! Surface temperature64 REAL tsoil(ngridmx,nsoilmx) ! Soil temperature65 REAL watercap(ngridmx) ! h2o ice layer66 REAL tauscaling(ngridmx) ! dust conversion factor67 REAL totcloudfrac(ngridmx) ! sub-grid cloud fraction66 REAL,ALLOCATABLE :: tsurf(:,:) ! Surface temperature 67 REAL,ALLOCATABLE :: tsoil(:,:,:) ! Soil temperature 68 REAL,ALLOCATABLE :: watercap(:,:) ! h2o ice layer 69 REAL :: tauscaling(ngridmx) ! dust conversion factor 70 REAL:: totcloudfrac(ngridmx) ! sub-grid cloud fraction 68 71 REAL q2(ngridmx,llm+1) 69 REAL emis(ngridmx)70 REAL albedo(ngridmx,2)72 REAL,ALLOCATABLE :: emis(:,:) 73 REAL,ALLOCATABLE :: albedo(:,:,:) 71 74 REAL wstar(ngridmx) 72 75 INTEGER start,length … … 78 81 c ------------------------------------ 79 82 REAL T(ip1jmp1,llm),us(ip1jmp1,llm),vs(ip1jmp1,llm) 80 REAL tsurfS(ip1jmp1)81 REAL tsoilS(ip1jmp1,nsoilmx)83 REAL,ALLOCATABLE :: tsurfS(:,:) 84 REAL,ALLOCATABLE :: tsoilS(:,:,:) 82 85 REAL ithS(ip1jmp1,nsoilmx) ! Soil Thermal Inertia 83 REAL watercapS(ip1jmp1)84 REAL tauscalingS(ip1jmp1)85 REAL totcloudfracS(ip1jmp1)86 REAL,ALLOCATABLE :: watercapS(:,:) 87 REAL :: tauscalingS(ip1jmp1) 88 REAL :: totcloudfracS(ip1jmp1) 86 89 REAL q2S(ip1jmp1,llm+1) 87 REAL,ALLOCATABLE :: qsurfS(:,:) 88 REAL emisS(ip1jmp1) 89 REAL albedoS(ip1jmp1) 90 REAL,ALLOCATABLE :: qsurfS(:,:,:) 91 REAL,ALLOCATABLE :: emisS(:,:) 92 REAL,ALLOCATABLE :: albedoS(:,:) 93 REAL, ALLOCATABLE :: subslope_distS(:,:) 90 94 91 95 c Variables intermediaires : vent naturel, mais pas coord scalaire … … 106 110 data fichier /'startfi'/ 107 111 108 INTEGER ij, l,i,j,isoil,iq 112 INTEGER ij, l,i,j,isoil,iq,islope 109 113 character*80 fichnom 110 114 integer :: ierr,ntime … … 133 137 134 138 ! allocate arrays: 135 allocate(q(ip1jmp1,llm,nqtot)) 136 allocate(qsurfS(ip1jmp1,nqtot)) 137 139 allocate(q(ip1jmp1,llm,nqtot)) 138 140 139 141 fichnom = 'start.nc' … … 161 163 Lmodif=0 162 164 165 allocate(tsurf(ngridmx,nslope)) 166 allocate(tsoil(ngridmx,nsoilmx,nslope)) 167 allocate(watercap(ngridmx,nslope)) 168 allocate(emis(ngridmx,nslope)) 169 allocate(albedo(ngridmx,2,nslope)) 170 171 allocate(qsurfS(ip1jmp1,nqtot,nslope)) 172 allocate(tsurfS(ip1jmp1,nslope)) 173 allocate(tsoilS(ip1jmp1,nsoilmx,nslope)) 174 allocate(watercapS(ip1jmp1,nslope)) 175 allocate(emisS(ip1jmp1,nslope)) 176 allocate(albedoS(ip1jmp1,nslope)) 177 allocate(subslope_distS(ip1jmp1,nslope)) 178 163 179 CALL phyetat0 (fichnom,0,Lmodif,nsoilmx,ngridmx,llm,nqtot, 164 180 & day_ini_fi,timefi,tsurf,tsoil,albedo,emis,q2,qsurf, 165 & tauscaling,totcloudfrac,wstar,watercap) 181 & tauscaling,totcloudfrac,wstar,watercap,def_slope, 182 & def_slope_mean,subslope_dist) 166 183 167 184 ierr = NF_OPEN (fichnom, NF_NOWRITE,nid1) … … 257 274 c----------------------------------------------------------------------- 258 275 259 call gr_fi_dyn(1,ngridmx,iip1,jjp1,tsurf,tsurfS) 260 call gr_fi_dyn(1,ngridmx,iip1,jjp1,watercap,watercapS) 261 call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,tsoil,tsoilS) 276 do islope=1,nslope 277 call gr_fi_dyn(1,ngridmx,iip1,jjp1,tsurf(:,islope), 278 & tsurfS(:,islope)) 279 call gr_fi_dyn(1,ngridmx,iip1,jjp1,watercap(:,islope), 280 & watercapS(:,islope)) 281 call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,tsoil(:,:,islope), 282 & tsoilS(:,:,islope)) 262 283 ! Note: thermal inertia "inertiedat" is in comsoil.h 284 call gr_fi_dyn(1,ngridmx,iip1,jjp1,emis(:,islope), 285 & emisS(:,islope)) 286 call gr_fi_dyn(1,ngridmx,iip1,jjp1,albedo(:,1,islope), 287 & albedoS(:,islope)) 288 call gr_fi_dyn(nqtot,ngridmx,iip1,jjp1,qsurf(:,:,islope), 289 & qsurfS(:,:,islope)) 290 call gr_fi_dyn(1,ngridmx,iip1,jjp1,subslope_dist(:,islope), 291 & subslope_distS(:,islope)) 292 enddo 263 293 call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,inertiedat,ithS) 264 call gr_fi_dyn(1,ngridmx,iip1,jjp1,emis,emisS)265 call gr_fi_dyn(1,ngridmx,iip1,jjp1,albedo(:,1),albedoS)266 294 call gr_fi_dyn(llm+1,ngridmx,iip1,jjp1,q2,q2S) 267 call gr_fi_dyn(nqtot,ngridmx,iip1,jjp1,qsurf,qsurfS)268 295 call gr_fi_dyn(1,ngridmx,iip1,jjp1,tauscaling,tauscalingS) 269 296 call gr_fi_dyn(1,ngridmx,iip1,jjp1,totcloudfrac,totcloudfracS) … … 283 310 DO j=1,jjp1 284 311 DO i=1,iim 312 DO islope=1,nslope 285 313 ptotal=ptotal+aire(i+(iim+1)*(j-1))*ps(i+(iim+1)*(j-1))/g 286 314 co2icetotal = co2icetotal + 287 & qsurfS(i+(iim+1)*(j-1),igcm_co2)*aire(i+(iim+1)*(j-1)) 315 & qsurfS(i+(iim+1)*(j-1),igcm_co2,islope)* 316 & aire(i+(iim+1)*(j-1))* 317 & subslope_distS(i+(iim+1)*(j-1),islope)/ 318 & cos(pi*def_slope_mean(islope)) 319 ENDDO 288 320 ENDDO 289 321 ENDDO … … 324 356 ierr = NF_CREATE('start_archive.nc', 325 357 & IOR(NF_CLOBBER,NF_64BIT_OFFSET), nid) 326 call ini_archive(nid,day_ini,phis,ithS,tab_cntrl_fi) 358 call ini_archive(nid,day_ini,phis,ithS,tab_cntrl_fi, 359 & def_slope,subslope_distS) 327 360 endif 328 361 … … 398 431 txt=trim(tname(iq))//"_surf" 399 432 call write_archive(nid,ntime,txt,'Tracer on surface', 400 & 'kg.m-2',2,qsurfS( 1,iq))433 & 'kg.m-2',2,qsurfS(:,iq,:)) 401 434 enddo 402 435 … … 417 450 ! Write soil temperatures tsoil 418 451 call write_archive(nid,ntime,'tsoil','Soil temperature', 419 & 'K',-3,tsoilS )452 & 'K',-3,tsoilS(:,:,:)) 420 453 421 454 ! Write soil thermal inertia -
trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/write_archive.F
r1422 r2913 33 33 34 34 use comsoil_h, only: nsoilmx 35 use comslope_mod, ONLY: nslope 35 36 implicit none 36 37 … … 58 59 59 60 c local 60 integer, dimension( 4) :: edges,corner,id61 integer, dimension(5) :: edges,corner,id 61 62 integer :: varid,i,j,l 62 63 c----------------------------------------------------------------------- … … 124 125 ! get variables' ID, if it exists 125 126 ierr=NF_INQ_VARID(nid,nom,varid) 127 128 if(nom.eq."tsoil") then 129 130 if (ierr.ne.NF_NOERR) then ! variable not defined yet 131 ! build related coordinates 132 ierr=NF_INQ_DIMID(nid,"longitude",id(1)) 133 ierr=NF_INQ_DIMID(nid,"latitude",id(2)) 134 ierr=NF_INQ_DIMID(nid,"subsurface_layers",id(3)) 135 if (ierr.ne.NF_NOERR) then 136 write(*,*)"write_archive: dimension <subsurface_layers>", 137 & " is missing !!!" 138 call abort 139 endif 140 ierr=NF_INQ_DIMID(nid,"nslope",id(4)) 141 if (ierr.ne.NF_NOERR) then 142 write(*,*)"write_archive: dimension <nslope>", 143 & " is missing !!!" 144 call abort 145 endif 146 ierr=NF_INQ_DIMID(nid,"Time",id(5)) 147 148 ! define the variable 149 write(*,*)"=====================" 150 write(*,*)"defining ",nom 151 call def_var(nid,nom,titre,unite,5,id,varid,ierr) 152 153 endif 154 155 ! build cedges and corners 156 corner(1)=1 157 corner(2)=1 158 corner(3)=1 159 corner(4)=1 160 corner(5)=ntime 161 162 edges(1)=iip1 163 edges(2)=jjp1 164 edges(3)=nsoilmx 165 edges(4)=nslope 166 edges(5)=1 167 168 #ifdef NC_DOUBLE 169 ierr= NF_PUT_VARA_DOUBLE(nid,varid,corner,edges,px) 170 #else 171 ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,px) 172 #endif 173 174 else 126 175 127 176 if (ierr.ne.NF_NOERR) then ! variable not defined yet … … 160 209 #endif 161 210 211 endif 212 162 213 163 214 ! For a surface 2D Variable … … 169 220 170 221 ierr= NF_INQ_VARID(nid,nom,varid) 222 223 if(nom.eq."tauscaling" .or. nom.eq."totcloudfrac" .or. 224 & nom.eq."ps" .or. nom.eq."q2surf") then 225 171 226 if (ierr /= NF_NOERR) then 172 227 ! choix du nom des coordonnees … … 203 258 call abort 204 259 endif 260 261 else 262 263 if (ierr /= NF_NOERR) then 264 ! choix du nom des coordonnees 265 ierr= NF_INQ_DIMID(nid,"longitude",id(1)) 266 ierr= NF_INQ_DIMID(nid,"latitude",id(2)) 267 ierr= NF_INQ_DIMID(nid,"nslope",id(3)) 268 ierr= NF_INQ_DIMID(nid,"Time",id(4)) 269 270 ! Creation de la variable si elle n'existait pas 271 272 write (*,*) "=====================" 273 write (*,*) "creation de ",nom 274 275 call def_var(nid,nom,titre,unite,4,id,varid,ierr) 276 277 endif 278 279 corner(1)=1 280 corner(2)=1 281 corner(3)=1 282 corner(4)=ntime 283 284 edges(1)=iip1 285 edges(2)=jjp1 286 edges(3)=nslope 287 edges(4)=1 288 289 290 #ifdef NC_DOUBLE 291 ierr = NF_PUT_VARA_DOUBLE (nid,varid,corner,edges,px) 292 #else 293 ierr= NF_PUT_VARA_REAL(nid,varid,corner,edges,px) 294 #endif 295 296 if (ierr.ne.NF_NOERR) then 297 write(*,*) "***** PUT_VAR matter in write_archive" 298 write(*,*) "***** with ",nom,nf_STRERROR(ierr) 299 call abort 300 endif 301 302 endif 205 303 206 304 -
trunk/LMDZ.MARS/libf/phymars/iostart.F90
r2907 r2913 15 15 INTEGER,SAVE :: idim7 ! "Time" dimension 16 16 INTEGER,SAVE :: idim8 ! "nslope" dimension 17 INTEGER,SAVE :: idim9 ! " inter slope" dimension17 INTEGER,SAVE :: idim9 ! "nslope_plus_1" dimension 18 18 INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields) 19 19 INTEGER,PARAMETER :: length=100 ! size of tab_cntrl array … … 564 564 ENDIF 565 565 566 ierr=NF90_DEF_DIM(nid_restart,"inter 566 ierr=NF90_DEF_DIM(nid_restart,"inter_slope",nslope+1,idim9) 567 567 IF (ierr/=NF90_NOERR) THEN 568 568 write(*,*)'phyredem: problem defining inter slope dimension' … … 660 660 661 661 REAL :: field_glo(klon_glo,field_size) 662 REAL :: field_glo_reshape(klon_glo,nsoilmx,nslope,timeindex) 662 663 INTEGER :: ierr 663 664 INTEGER :: nvarid … … 804 805 endif ! of if (.not.present(timeindex)) 805 806 806 ELSE IF (field_size==nsoilmx ) THEN807 ELSE IF (field_size==nsoilmx .or. field_size==nsoilmx*nslope) THEN 807 808 ! input is a 2D "subsurface field" array 808 809 if (.not.present(time)) then ! for a time-independent field … … 828 829 ierr=NF90_REDEF(nid_restart) 829 830 #ifdef NC_DOUBLE 831 if(field_name.eq. "tsoil") then 832 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,& 833 (/idim2,idim3,idim8,idim7/),nvarid) 834 else 830 835 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,& 831 836 (/idim2,idim3,idim7/),nvarid) 832 #else 837 endif 838 #else 839 if(field_name.eq. "tsoil") then 840 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,& 841 (/idim2,idim3,idim8,idim7/),nvarid) 842 else 833 843 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,& 834 844 (/idim2,idim3,idim7/),nvarid) 845 endif 835 846 #endif 836 847 if (ierr.ne.NF90_NOERR) then … … 842 853 endif 843 854 ! Write the variable 855 if(field_name.eq. "tsoil") then 856 857 field_glo_reshape=RESHAPE(field_glo, (/klon_glo, nsoilmx, nslope, timeindex/)) 858 859 ierr=NF90_PUT_VAR(nid_restart,nvarid,field_glo_reshape,& 860 start=(/1,1,1,timeindex/)) 861 else 844 862 ierr=NF90_PUT_VAR(nid_restart,nvarid,field_glo,& 845 863 start=(/1,1,timeindex/)) 846 864 endif 847 865 endif ! of if (.not.present(time)) 848 866 -
trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
r2909 r2913 60 60 61 61 ! outputs: 62 real,intent(out) :: tsurf(ngrid ) ! surface temperature63 real,intent(out) :: tsoil(ngrid,nsoil ) ! soil temperature64 real,intent(out) :: albedo(ngrid,2 ) ! surface albedo65 real,intent(out) :: emis(ngrid ) ! surface emissivity62 real,intent(out) :: tsurf(ngrid,nslope) ! surface temperature 63 real,intent(out) :: tsoil(ngrid,nsoil,nslope) ! soil temperature 64 real,intent(out) :: albedo(ngrid,2,nslope) ! surface albedo 65 real,intent(out) :: emis(ngrid,nslope) ! surface emissivity 66 66 real,intent(out) :: q2(ngrid,nlay+1) ! 67 real,intent(out) :: qsurf(ngrid,nq ) ! tracers on surface67 real,intent(out) :: qsurf(ngrid,nq,nslope) ! tracers on surface 68 68 real,intent(out) :: tauscaling(ngrid) ! dust conversion factor 69 69 real,intent(out) :: totcloudfrac(ngrid) ! total cloud fraction 70 70 real,intent(out) :: wstar(ngrid) ! Max vertical velocity in thermals (m/s) 71 real,intent(out) :: watercap(ngrid ) ! h2o_ice_cover71 real,intent(out) :: watercap(ngrid,nslope) ! h2o_ice_cover 72 72 real, intent(out) :: def_slope(nslope+1) !boundaries for bining of the slopes 73 73 real, intent(out) :: def_slope_mean(nslope) … … 143 143 write(*,*)'We take default def_slope and subslope dist' 144 144 allocate(default_def_slope(nslope+1)) 145 default_def_slope(1) = 0.146 default_def_slope(2) = 0.145 default_def_slope(1) = -90. 146 default_def_slope(2) = 90. 147 147 subslope_dist(:,:)=1. 148 def_slope(:)=default_def_slope(:) 148 149 else 149 150 write(*,*)'Variable def_slope is not present in the start and' … … 168 169 default_def_slope(2) = 0. 169 170 subslope_dist(:,:)=1. 171 def_slope(:)=default_def_slope(:) 170 172 else 171 173 write(*,*)'Without starfi, lets first run with nslope=1' … … 516 518 endif 517 519 else 518 tsurf(: )=0. ! will be updated afterwards in physiq !520 tsurf(:,:)=0. ! will be updated afterwards in physiq ! 519 521 endif ! of if (startphy_file) 520 522 write(*,*) "phyetat0: Surface temperature <tsurf> range:", & … … 523 525 ! Surface albedo 524 526 if (startphy_file) then 525 call get_field("albedo",albedo(:,1 ),found,indextime)527 call get_field("albedo",albedo(:,1,:),found,indextime) 526 528 if (.not.found) then 527 529 write(*,*) "phyetat0: Failed loading <albedo>" 528 albedo(:,1)=albedodat(:) 529 endif 530 else 531 albedo(:,1)=albedodat(:) 530 do islope=1,nslope 531 albedo(:,1,islope)=albedodat(:) 532 enddo 533 endif 534 else 535 do islope=1,nslope 536 albedo(:,1,islope)=albedodat(:) 537 enddo 532 538 endif ! of if (startphy_file) 533 539 write(*,*) "phyetat0: Surface albedo <albedo> range:", & 534 minval(albedo(:,1 )), maxval(albedo(:,1))535 albedo(:,2 )=albedo(:,1)540 minval(albedo(:,1,:)), maxval(albedo(:,1,:)) 541 albedo(:,2,:)=albedo(:,1,:) 536 542 537 543 ! Surface emissivity … … 547 553 call getin_p("surfemis_without_startfi",surfemis) 548 554 print*,"surfemis_without_startfi",surfemis 549 emis(: )=surfemis555 emis(:,:)=surfemis 550 556 endif ! of if (startphy_file) 551 557 write(*,*) "phyetat0: Surface emissivity <emis> range:", & … … 633 639 ! We first check if co2ice exist in the startfi file (old way) 634 640 ! CO2 ice cover 635 call get_field("co2ice",qsurf(:,iq ),found,indextime)641 call get_field("co2ice",qsurf(:,iq,:),found,indextime) 636 642 ! If not, we load the corresponding tracer in qsurf 637 643 if (.not.found) then 638 call get_field(txt,qsurf(:,iq ),found,indextime)644 call get_field(txt,qsurf(:,iq,:),found,indextime) 639 645 if (.not.found) then 640 646 call abort_physic(modname, & … … 643 649 endif 644 650 else ! (not the co2 tracer) 645 call get_field(txt,qsurf(:,iq ),found,indextime)651 call get_field(txt,qsurf(:,iq,:),found,indextime) 646 652 if (.not.found) then 647 653 write(*,*) "phyetat0: Failed loading <",trim(txt),">" 648 654 write(*,*) " ",trim(txt)," is set to zero" 649 qsurf(:,iq )=0.655 qsurf(:,iq,:)=0. 650 656 endif 651 657 endif !endif co2 652 658 else !(not startphy_file) 653 qsurf(:,iq )=0.659 qsurf(:,iq,:)=0. 654 660 endif ! of if (startphy_file) 655 661 write(*,*) "phyetat0: Surface tracer <",trim(txt),"> range:", & 656 minval(qsurf(:,iq )), maxval(qsurf(:,iq))662 minval(qsurf(:,iq,:)), maxval(qsurf(:,iq,:)) 657 663 enddo ! of do iq=1,nq 658 664 … … 661 667 ! CO2 ice cover 662 668 if (startphy_file) then 663 call get_field("co2ice",qsurf(:,iq ),found,indextime)669 call get_field("co2ice",qsurf(:,iq,:),found,indextime) 664 670 ! If not, we load the corresponding tracer in qsurf 665 671 if (.not.found) then 666 call get_field(txt,qsurf(:,iq ),found,indextime)672 call get_field(txt,qsurf(:,iq,:),found,indextime) 667 673 if (.not.found) then 668 674 call abort_physic(modname, & … … 672 678 else 673 679 ! If we run without startfile, co2ice is set to 0 674 qsurf(:,iq )=0.680 qsurf(:,iq,:)=0. 675 681 endif !if (startphy_file) 676 682 write(*,*) "phyetat0: CO2 ice cover <co2ice> range:", & 677 minval(qsurf(:,iq )), maxval(qsurf(:,iq))683 minval(qsurf(:,iq,:)), maxval(qsurf(:,iq,:)) 678 684 endif 679 685 … … 685 691 write(*,*) "phyetat0: Failed loading <watercap> : ", & 686 692 "<watercap> is set to zero" 687 watercap(: )=0693 watercap(:,:)=0 688 694 write(*,*) 'Now transfer negative surface water ice to', & 689 695 ' watercap !' … … 693 699 if (txt.eq."h2o_ice") then 694 700 do ig=1,ngrid 695 if (qsurf(ig,iq).lt.0.0) then 696 watercap(ig) = qsurf(ig,iq) 697 qsurf(ig,iq) = 0.0 698 end if 701 do islope=1,nslope 702 if (qsurf(ig,iq,islope).lt.0.0) then 703 watercap(ig,islope) = qsurf(ig,iq,islope) 704 qsurf(ig,iq,islope) = 0.0 705 end if 706 enddo 699 707 end do 700 708 endif … … 702 710 if (txt.eq."hdo_ice") then 703 711 do ig=1,ngrid 704 if (qsurf(ig,iq).lt.0.0) then 705 qsurf(ig,iq) = 0.0 706 end if 712 do islope=1,nslope 713 if (qsurf(ig,iq,islope).lt.0.0) then 714 qsurf(ig,iq,islope) = 0.0 715 end if 716 enddo 707 717 end do 708 718 endif … … 712 722 endif ! of if (.not.found) 713 723 else 714 watercap(: )=0724 watercap(:,:)=0 715 725 endif ! of if (startphy_file) 716 726 write(*,*) "phyetat0: Surface water ice <watercap> range:", & -
trunk/LMDZ.MARS/libf/phymars/phyredem.F90
r2896 r2913 171 171 use dust_param_mod, only: dustscaling_mode 172 172 use comsoil_h,only: flux_geo 173 use comslope_mod, ONLY: nslope 173 174 implicit none 174 175 … … 182 183 real,intent(in) :: phystep 183 184 real,intent(in) :: time 184 real,intent(in) :: tsurf(ngrid )185 real,intent(in) :: tsoil(ngrid,nsoil )186 real,intent(in) :: albedo(ngrid,2 )187 real,intent(in) :: emis(ngrid )185 real,intent(in) :: tsurf(ngrid,nslope) 186 real,intent(in) :: tsoil(ngrid,nsoil,nslope) 187 real,intent(in) :: albedo(ngrid,2,nslope) 188 real,intent(in) :: emis(ngrid,nslope) 188 189 real,intent(in) :: q2(ngrid,nlay+1) 189 real,intent(in) :: qsurf(ngrid,nq )190 real,intent(in) :: qsurf(ngrid,nq,nslope) 190 191 real,intent(in) :: tauscaling(ngrid) 191 192 real,intent(in) :: totcloudfrac(ngrid) 192 193 real,intent(in) :: wstar(ngrid) 193 real,intent(in) :: watercap(ngrid )194 real,intent(in) :: watercap(ngrid,nslope) 194 195 195 196 integer :: iq … … 219 220 220 221 ! Albedo of the surface 221 call put_field("albedo","Surface albedo",albedo(:,1 ),time)222 call put_field("albedo","Surface albedo",albedo(:,1,:),time) 222 223 223 224 ! Emissivity of the surface … … 312 313 end if 313 314 314 call put_field(trim(txt),"tracer on surface",qsurf(:,iq ),time)315 call put_field(trim(txt),"tracer on surface",qsurf(:,iq,:),time) 315 316 enddo 316 317 endif -
trunk/LMDZ.MARS/libf/phymars/soil_settings.F
r2887 r2913 5 5 use iostart, only: inquire_field_ndims, get_var, get_field, 6 6 & inquire_field, inquire_dimension_length 7 USE comslope_mod, ONLY: nslope 7 8 implicit none 8 9 … … 41 42 integer,intent(in) :: ngrid ! # of horizontal grid points 42 43 integer,intent(in) :: nsoil ! # of soil layers 43 real,intent(in) :: tsurf(ngrid ) ! surface temperature44 real,intent(in) :: tsurf(ngrid,nslope) ! surface temperature 44 45 integer,intent(in) :: indextime ! position on time axis 45 46 ! output: 46 real,intent(out) :: tsoil(ngrid,nsoil ) ! soil temperature47 real,intent(out) :: tsoil(ngrid,nsoil,nslope) ! soil temperature 47 48 48 49 !====================================================================== … … 54 55 integer ndims ! # of dimensions of read <inertiedat> data 55 56 integer ig,iloop ! loop counters 57 integer islope 56 58 57 59 integer edges(3),corner(3) ! to read a specific time … … 64 66 real,dimension(:),allocatable :: oldmlayer 65 67 real,dimension(:,:),allocatable :: oldinertiedat 66 real,dimension(:,: ),allocatable :: oldtsoil68 real,dimension(:,:,:),allocatable :: oldtsoil 67 69 68 70 ! for interpolation … … 317 319 write(*,*)' => Building <tsoil> from surface values <tsurf>' 318 320 do iloop=1,nsoil 319 tsoil(:,iloop)=tsurf(:) 321 do islope=1,nslope 322 tsoil(:,iloop,islope)=tsurf(:,islope) 323 enddo 320 324 enddo 321 325 else ! <tsoil> found 322 326 if (interpol) then ! put values in oldtsoil 323 327 if (.not.allocated(oldtsoil)) then 324 allocate(oldtsoil(ngrid,dimlen ),stat=ierr)328 allocate(oldtsoil(ngrid,dimlen,nslope),stat=ierr) 325 329 if (ierr.ne.0) then 326 330 write(*,*) 'soil_settings: failed allocation of ', … … 376 380 do ig=1,ngrid 377 381 ! copy values 378 oldval(1)=tsurf(ig) 379 oldval(2:dimlen+1)=oldtsoil(ig,1:dimlen) 382 do islope=1,nslope 383 oldval(1)=tsurf(ig,islope) 384 oldval(2:dimlen+1)=oldtsoil(ig,1:dimlen,islope) 380 385 ! build vertical coordinate 381 386 oldgrid(1)=0. ! ground … … 385 390 call interp_line(oldgrid,oldval,dimlen+1,mlayer,newval,nsoil) 386 391 ! copy result in tsoil 387 tsoil(ig,:)=newval(:) 392 tsoil(ig,:,islope)=newval(:) 393 enddo 388 394 enddo 389 395 … … 419 425 oldgrid(2:dimlen+1)=oldmlayer(1:dimlen) 420 426 do ig=1,ngrid 427 do islope=1,nslope 421 428 ! data 422 oldval(1)=tsurf(ig )423 oldval(2:dimlen+1)=oldtsoil(ig,1:dimlen )429 oldval(1)=tsurf(ig,islope) 430 oldval(2:dimlen+1)=oldtsoil(ig,1:dimlen,islope) 424 431 ! interpolate 425 432 call interp_line(oldgrid,oldval,dimlen+1,mlayer,newval,nsoil) 426 433 ! copy result in inertiedat 427 tsoil(ig,:)=newval(:) 434 tsoil(ig,:,islope)=newval(:) 435 enddo 428 436 enddo 429 437
Note: See TracChangeset
for help on using the changeset viewer.