Changeset 2896 for trunk/LMDZ.MARS
- Timestamp:
- Feb 14, 2023, 11:06:29 AM (22 months ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/iostart.F90
r2399 r2896 14 14 INTEGER,SAVE :: idim6 ! "nlayer" dimension 15 15 INTEGER,SAVE :: idim7 ! "Time" dimension 16 INTEGER,SAVE :: idim8 ! "nslope" dimension 17 INTEGER,SAVE :: idim9 ! "inter slope" dimension 16 18 INTEGER,SAVE :: timeindex ! current time index (for time-dependent fields) 17 19 INTEGER,PARAMETER :: length=100 ! size of tab_cntrl array … … 466 468 USE tracer_mod, only: nqmx 467 469 USE comsoil_h, only: nsoilmx 470 USE comslope_mod, only: nslope 468 471 IMPLICIT NONE 469 472 CHARACTER(LEN=*),INTENT(IN) :: filename … … 554 557 ENDIF 555 558 559 ierr=NF90_DEF_DIM(nid_restart,"nslope",nslope,idim8) 560 IF (ierr/=NF90_NOERR) THEN 561 write(*,*)'phyredem: problem defining nslope dimension' 562 write(*,*)trim(nf90_strerror(ierr)) 563 CALL ABORT 564 ENDIF 565 566 ierr=NF90_DEF_DIM(nid_restart,"inter slope",nslope+1,idim9) 567 IF (ierr/=NF90_NOERR) THEN 568 write(*,*)'phyredem: problem defining inter slope dimension' 569 write(*,*)trim(nf90_strerror(ierr)) 570 CALL ABORT 571 ENDIF 572 556 573 ierr=NF90_ENDDEF(nid_restart) 557 574 IF (ierr/=NF90_NOERR) THEN … … 632 649 USE dimphy 633 650 USE comsoil_h, only: nsoilmx 651 USE comslope_mod, ONLY: nslope 634 652 USE mod_grid_phy_lmdz 635 653 USE mod_phys_lmdz_para … … 819 837 endif ! of if (.not.present(time)) 820 838 839 ELSE IF (field_size==nslope) THEN 840 ! input is a 2D "subsurface field" array 841 if (.not.present(time)) then ! for a time-independent field 842 ierr = NF90_REDEF(nid_restart) 843 #ifdef NC_DOUBLE 844 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,& 845 (/idim2,idim8/),nvarid) 846 #else 847 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,& 848 (/idim2,idim8/),nvarid) 849 #endif 850 if (ierr.ne.NF90_NOERR) then 851 write(*,*)"put_field_rgen error: failed to define"//trim(field_name) 852 write(*,*)trim(nf90_strerror(ierr)) 853 endif 854 IF (LEN_TRIM(title) > 0) ierr=NF90_PUT_ATT(nid_restart,nvarid,"title",title) 855 ierr = NF90_ENDDEF(nid_restart) 856 ierr = NF90_PUT_VAR(nid_restart,nvarid,field_glo) 857 else 858 ! check if the variable has already been defined: 859 ierr=NF90_INQ_VARID(nid_restart,field_name,nvarid) 860 if (ierr/=NF90_NOERR) then ! variable not found, define it 861 ierr=NF90_REDEF(nid_restart) 862 #ifdef NC_DOUBLE 863 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_DOUBLE,& 864 (/idim2,idim8,idim7/),nvarid) 865 #else 866 ierr=NF90_DEF_VAR(nid_restart,field_name,NF90_FLOAT,& 867 (/idim2,idim8,idim7/),nvarid) 868 #endif 869 if (ierr.ne.NF90_NOERR) then 870 write(*,*)"put_field_rgen error: failed to define"//trim(field_name) 871 write(*,*)trim(nf90_strerror(ierr)) 872 endif 873 IF (LEN_TRIM(title) > 0) ierr=NF90_PUT_ATT(nid_restart,nvarid,"title",title) 874 ierr=NF90_ENDDEF(nid_restart) 875 endif 876 ! Write the variable 877 ierr=NF90_PUT_VAR(nid_restart,nvarid,field_glo,& 878 start=(/1,1,timeindex/)) 879 880 endif ! of if (.not.present(time)) 881 821 882 ELSE 822 883 PRINT *, "Error phyredem(put_field_rgen) : wrong dimension for ",trim(field_name) … … 890 951 nf90_inq_dimid, nf90_inquire_dimension, NF90_INQ_VARID 891 952 USE comsoil_h, only: nsoilmx 953 USE comslope_mod, only: nslope 892 954 USE mod_phys_lmdz_para, only: is_master 893 955 IMPLICIT NONE … … 941 1003 ! We know it is an "mlayer" kind of 1D array 942 1004 idim1d=idim3 1005 ELSEIF (var_size==nslope+1) THEN 1006 ! We know it is an "inter slope" kind of 1D array 1007 idim1d=idim9 943 1008 ELSE 944 1009 PRINT *, "put_var_rgen error : wrong dimension" -
trunk/LMDZ.MARS/libf/phymars/phyetat0_mod.F90
r2892 r2896 10 10 subroutine phyetat0 (fichnom,tab0,Lmodif,nsoil,ngrid,nlay,nq, & 11 11 day_ini,time0,tsurf,tsoil,albedo,emis,q2,qsurf, & 12 tauscaling,totcloudfrac,wstar,watercap) 12 tauscaling,totcloudfrac,wstar,watercap,def_slope, & 13 def_slope_mean,subslope_dist) 13 14 14 15 use tracer_mod, only: noms ! tracer names … … 25 26 USE ioipsl_getin_p_mod, ONLY : getin_p 26 27 use comsoil_h, only: flux_geo 28 USE comslope_mod, ONLY: nslope, major_slope 27 29 implicit none 28 30 … … 68 70 real,intent(out) :: wstar(ngrid) ! Max vertical velocity in thermals (m/s) 69 71 real,intent(out) :: watercap(ngrid) ! h2o_ice_cover 72 real, intent(out) :: def_slope(nslope+1) !boundaries for bining of the slopes 73 real, intent(out) :: def_slope_mean(nslope) 74 real, intent(out) :: subslope_dist(ngrid,nslope) !undermesh statistics 70 75 !====================================================================== 71 76 ! Local variables: … … 74 79 real xmin,xmax ! to display min and max of a field 75 80 ! 76 INTEGER ig,iq,lmax 81 INTEGER ig,iq,lmax,islope 77 82 INTEGER nid, nvarid 78 83 INTEGER ierr, i, nsrf … … 106 111 REAL :: watercaptag_tmp(ngrid) 107 112 113 ! Sub-grid scale slopes 114 LOGICAL :: startphy_slope !to be retrocompatible and add the nslope dimension 115 REAL, ALLOCATABLE :: default_def_slope(:) 116 REAL :: sum_dist 117 REAL :: current_max !var to find max distrib slope 118 108 119 CHARACTER(len=5) :: modname="phyetat0" 109 120 … … 122 133 p_omeg,p_g,p_mugaz,p_daysec,time0) 123 134 endif ! of if (startphy_file) 135 136 if(nslope.ne.1) then 137 call abort_physic(modname, & 138 "phyetat0: For now, nslope should be 1 (set in comslope_mod)",1) 139 endif 140 141 allocate(default_def_slope(nslope+1)) 142 !Sub-grid scale subslopes 143 if (nslope.eq.7) then 144 default_def_slope(1) = -43. 145 default_def_slope(2) = -19. 146 default_def_slope(3) = -9. 147 default_def_slope(4) = -3. 148 default_def_slope(5) = 3. 149 default_def_slope(6) = 9. 150 default_def_slope(7) = 19. 151 default_def_slope(8) = 43. 152 elseif (nslope.eq.5) then 153 default_def_slope(1) = -43. 154 default_def_slope(2) = -9. 155 default_def_slope(3) = -3. 156 default_def_slope(4) = 3. 157 default_def_slope(5) = 9. 158 default_def_slope(6) = 43. 159 elseif (nslope.eq.1) then 160 default_def_slope(1) = 0. 161 default_def_slope(2) = 0. 162 endif 163 164 if (startphy_file) then 165 call get_var("def_slope",def_slope,found) 166 if(.not.found) then 167 startphy_slope=.false. 168 write(*,*)'slope_settings: Problem while reading <def_slope>' 169 write(*,*)'default def_slope will be used' 170 do islope=1,nslope+1 171 def_slope(islope) = default_def_slope(islope) 172 enddo 173 write(*,*)'computing corresponding distribution <subslope_dist>' 174 write(*,*)'For now, woth nslope=1, subslope_dist is straigforward' 175 write(*,*)'Later this operation will be done by newstart with a specific routine' 176 subslope_dist(:,:)=1. 177 !call subslope_mola(ngrid,nslope,def_slope,subslope_dist) 178 else 179 startphy_slope=.true. 180 call get_field("subslope_dist",subslope_dist,found,indextime) 181 if(.not.found) then 182 write(*,*)'slope_settings: Problem while reading <subslope_dist>' 183 write(*,*)'computing a new distribution' 184 write(*,*)'For now, woth nslope=1, subslope_dist is straigforward' 185 write(*,*)'Later this operation will be done by newstart with a specific routine' 186 subslope_dist(:,:)=1. 187 !call subslope_mola(ngrid,nslope,def_slope,subslope_dist) 188 endif 189 endif 190 else ! startphy_file 191 do islope=1,nslope+1 192 def_slope(islope) = default_def_slope(islope) 193 enddo 194 write(*,*)'computing corresponding distribution <subslope_dist>' 195 write(*,*)'For now, woth nslope=1, subslope_dist is straigforward' 196 write(*,*)'Later this operation will be done by newstart with a specific routine' 197 subslope_dist(:,:)=1. 198 !call subslope_mola(ngrid,nslope,def_slope,subslope_dist) 199 endif 200 201 do islope=1,nslope 202 def_slope_mean(islope) =(def_slope(islope)+def_slope(islope+1))/2. 203 enddo 204 205 DO ig = 1,ngrid 206 sum_dist = 0. 207 DO islope = 1,nslope 208 sum_dist = sum_dist + subslope_dist(ig,islope) 209 ENDDO 210 DO islope = 1,nslope 211 subslope_dist(ig,islope) = subslope_dist(ig,islope)/sum_dist 212 ENDDO 213 ENDDO 214 215 !Now determine the major subslope, ie. the maximal distribution 216 217 DO ig=1,ngrid 218 major_slope(ig)=1 219 current_max=subslope_dist(ig,1) 220 DO islope=2,nslope 221 if(subslope_dist(ig,islope).GT.current_max) then 222 major_slope(ig)=islope 223 current_max=subslope_dist(ig,islope) 224 ENDIF 225 ENDDO 226 ENDDO 124 227 125 228 if (startphy_file) then … … 637 740 write(*,*) "phyetat0: Surface water ice <watercap> range:", & 638 741 minval(watercap), maxval(watercap) 639 640 641 742 642 743 if (startphy_file) then -
trunk/LMDZ.MARS/libf/phymars/phyredem.F90
r2887 r2896 7 7 subroutine physdem0(filename,lonfi,latfi,nsoil,ngrid,nlay,nq, & 8 8 phystep,day_ini,time,airefi, & 9 alb,ith) 9 alb,ith,def_slope, & 10 subslope_dist) 10 11 ! create physics restart file and write time-independent variables 11 12 use comsoil_h, only: inertiedat, volcapa, mlayer … … 23 24 use comcstfi_h, only: g, mugaz, omeg, rad, rcp 24 25 use time_phylmdz_mod, only: daysec 26 use comslope_mod, ONLY: nslope 25 27 implicit none 26 28 … … 38 40 real,intent(in) :: alb(ngrid) 39 41 real,intent(in) :: ith(ngrid,nsoil) 42 real, intent(in) :: def_slope(nslope+1) !boundaries for bining of the slopes 43 real, intent(in) :: subslope_dist(ngrid,nslope) !undermesh statistics 40 44 41 45 real :: tab_cntrl(length) ! nb "length=100" defined in iostart module … … 144 148 145 149 call put_field("watercaptag","Infinite water reservoir",watercaptag_tmp) 150 151 ! Sub grid scale slope parametrization 152 call put_var("def_slope","slope criterium stages",def_slope) 153 call put_field("subslope_dist","under mesh slope distribution",subslope_dist) 146 154 147 155 ! Close file -
trunk/LMDZ.MARS/libf/phymars/physiq_mod.F
r2887 r2896 104 104 USE mod_grid_phy_lmdz, ONLY: grid_type, unstructured 105 105 use ioipsl_getin_p_mod, only: getin_p 106 use comslope_mod, ONLY: nslope,def_slope,def_slope_mean, 107 & subslope_dist,iflat,sky_slope, 108 & major_slope,compute_meshgridavg, 109 & ini_comslope_h 106 110 107 111 IMPLICIT NONE … … 529 533 !$OMP THREADPRIVATE(check_physics_inputs,check_physics_outputs) 530 534 535 c Sub-grid scale slopes 536 integer :: islope 537 531 538 logical :: write_restart 532 539 … … 563 570 c ~~~~~~~~~~~~ 564 571 #ifndef MESOSCALE 572 573 call ini_comslope_h(ngrid) 574 565 575 ! GCM. Read netcdf initial physical parameters. 566 576 CALL phyetat0 ("startfi.nc",0,0, … … 569 579 & tsurf,tsoil,albedo,emis, 570 580 & q2,qsurf,tauscaling,totcloudfrac,wstar, 571 & watercap) 581 & watercap,def_slope,def_slope_mean,subslope_dist) 582 583 DO islope=1,nslope 584 sky_slope(islope) = (1.+cos(pi*def_slope_mean(islope)/180.))/2. 585 END DO 586 587 ! Sky view: 588 DO islope=1,nslope 589 sky_slope(islope) = (1.+cos(pi*def_slope_mean(islope)/180.))/2. 590 END DO 591 ! Determine the 'flatest' slopes 592 iflat = 1 593 DO islope=2,nslope 594 IF(abs(def_slope_mean(islope)).lt. 595 & abs(def_slope_mean(iflat)))THEN 596 iflat = islope 597 ENDIF 598 ENDDO 599 PRINT*,'Flat slope for islope = ',iflat 600 PRINT*,'corresponding criterium = ',def_slope_mean(iflat) 572 601 573 602 #else … … 646 675 c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 647 676 CALL surfini(ngrid,qsurf) 677 648 678 CALL iniorbit(aphelie,periheli,year_day,peri_day,obliquit) 649 679 … … 714 744 & nsoilmx,ngrid,nlayer,nq, 715 745 & ptimestep,pday,0.,cell_area, 716 & albedodat,inertiedat) 746 & albedodat,inertiedat,def_slope, 747 & subslope_dist) 717 748 else 718 749 call physdem0("restartfi.nc",longitude,latitude, 719 750 & nsoilmx,ngrid,nlayer,nq, 720 751 & ptimestep,float(day_end),0.,cell_area, 721 & albedodat,inertiedat) 752 & albedodat,inertiedat,def_slope, 753 & subslope_dist) 722 754 endif 723 755 endif … … 1361 1393 zcdh(:) = 0. 1362 1394 zcdv(:) = 0. 1395 1363 1396 CALL vdifc(ngrid,nlayer,nq,zpopsk, 1364 1397 $ ptimestep,capcal,lwrite, … … 1370 1403 & zcondicea_co2microp,sensibFlux, 1371 1404 & dustliftday,local_time,watercap,dwatercap_dif) 1405 1372 1406 DO ig=1,ngrid 1373 1407 zdtsurf(ig)=zdtsurf(ig)+zdtsdif(ig) … … 1839 1873 call dustdevil(ngrid,nlayer,nq, zplev,pu,pv,pt, tsurf,q2, 1840 1874 & zdqdev,zdqsdev) 1841 1875 1842 1876 if (dustbin.ge.1) then 1843 1877 do iq=1,nq … … 1872 1906 & pq,pdq,zdqsed,zdqssed,nq, 1873 1907 & tau,tauscaling) 1908 1874 1909 c Flux at the surface of co2 ice computed in co2cloud microtimestep 1875 1910 IF (rdstorm) THEN … … 1944 1979 $ zdqcloud,zdqscloud,tau(:,1),qsurf(:,igcm_co2), 1945 1980 $ pu,pdu,pv,pdv,surfdust,surfice) 1981 1946 1982 endif ! of if (modulo(icount-1,ichemistry).eq.0) 1947 1983 … … 2040 2076 $ zdqssed_co2,zcondicea_co2microp, 2041 2077 & zdqsc) 2078 2042 2079 DO iq=1, nq 2043 2080 DO ig=1,ngrid
Note: See TracChangeset
for help on using the changeset viewer.