Changeset 2913 for trunk/LMDZ.MARS/libf/phymars
- Timestamp:
- Mar 14, 2023, 10:07:33 AM (22 months ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.