Changeset 3910 for trunk/LMDZ.PLUTO/libf/dynphy_lonlat/phypluto
- Timestamp:
- Sep 3, 2025, 11:19:36 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/libf/dynphy_lonlat/phypluto/newstart.F
r3878 r3910 112 112 REAL field_input(ngridmx) 113 113 REAL,ALLOCATABLE :: field_inputs(:,:) 114 REAL, ALLOCATABLE :: n2fracfi(:) 115 REAL, ALLOCATABLE :: n2fracdat(:,:) 114 116 115 117 INTEGER i,j,l,isoil,ig,idum,k … … 155 157 real val, val1, val2, val3, val4, dist, ref ! to store temporary variables 156 158 real val5, val6, val7, val8, val9, val10,val11, val12 ! to store temporary variables 159 real :: val_lat1, val_lat2, val_lon1, val_lon2 160 real :: phi_min, phi_max, albomin, albomax !temp variables 161 real :: fact, addch4 157 162 real :: iceith=2000 ! thermal inertia of subterranean ice 158 163 integer :: iref,jref,iref1,jref1,iref2,jref2 … … 233 238 allocate(qsurf(ngridmx,nqtot)) 234 239 allocate(qsurf_tmp(ngridmx,nqtot)) 240 !allocate n2frac 241 allocate(n2fracfi(ngridmx)) 242 allocate(n2fracdat(iip1, jjp1)) 235 243 236 244 ! get value of nsoilmx and allocate corresponding arrays … … 671 679 write(*,*) 'bladed: add ch4 on bladed terrains' 672 680 write(*,*) 'cpbladed: add extension bladed terrains' 681 write(*,*) 'modch4_topo: add/remove ch4 (alb+topo)' 673 682 write(*,*) 'slope: add slope over all long. (for triton)' 674 683 write(*,*) 'digsp: specific to dig SP' 675 684 write(*,*) 'bugn2: correct bug of warm n2 due to HighRes' 676 write(*,*) 'bugn2_new: correct bug of warm n2 due to HighRes' 685 write(*,*) 'correct_t_non2: correct surf temp of no-n2 patches' 686 write(*,*) 'correct_t_n2: correct surface temp of warm n2' 677 687 write(*,*) 'bugch4: correct bug of warm ch4 due to HighRes' 678 688 write(*,*) 'flatnosp : topo flat except SP (topo controled)' … … 689 699 write(*,*) 'albedomap: read in an albedomap albedo.nc' 690 700 write(*,*) 'mod_distrib_ice: modify ice distrib. from albedo' 691 701 write(*,*) 'use_n2frac: read a n2frac map' 692 702 write(*,*) 693 703 write(*,*) 'Please note that emis and albedo are set in physiq' … … 1315 1325 ENDDO 1316 1326 1327 c modch4_topo : adding/removing ch4 ice with albedo + altitude filter 1328 c ---------------------------------------------------------- 1329 else if (modif(1:len_trim(modif)) .eq. 'modch4_topo') then 1330 1331 write(*,*) 'Adding or removing ch4 (alb+top)' 1332 write(*,*) 'Choice band : lat1 and lat2 ?' 1333 1200 read(*,*,iostat=ierr) val_lat1,val_lat2 1334 if(ierr.ne.0) goto 1200 1335 1336 write(*,*) 'Choice band : lon1 and lon2 ?' 1337 1201 read(*,*,iostat=ierr) val_lon1,val_lon2 1338 if(ierr.ne.0) goto 1201 1339 1340 write(*,*) 'Choice topo window (phi_min phi_max)' 1341 1202 read(*,*,iostat=ierr) phi_min,phi_max 1342 if(ierr.ne.0) goto 1202 1343 1344 write(*,*) 'Choice albedo window (albomin albomax)' 1345 1203 read(*,*,iostat=ierr) albomin,albomax 1346 if(ierr.ne.0) goto 1203 1347 1348 write(*,*) 'Choice multiplicative factor for ch4' 1349 1204 read(*,*,iostat=ierr) fact 1350 if(ierr.ne.0) goto 1204 1351 1352 write(*,*) 'Choice additional ch4' 1353 1205 read(*,*,iostat=ierr) addch4 1354 if(ierr.ne.0) goto 1205 1355 1356 ! Loop over gridpoints 1357 DO ig=1,ngridmx 1358 IF ( (latfi(ig)*180./pi.ge.val_lat1) .and. 1359 & (latfi(ig)*180./pi.le.val_lat2) .and. 1360 & (lonfi(ig)*180./pi.ge.val_lon1) .and. 1361 & (lonfi(ig)*180./pi.le.val_lon2) .and. 1362 & (zmea(ig).ge.phi_min) .and. 1363 & (zmea(ig).le.phi_max) .and. 1364 & (albedodat(ig).ge.albomin) .and. 1365 & (albedodat(ig).le.albomax) ) then 1366 1367 qsurf(ig,igcm_ch4_ice)=qsurf(ig,igcm_ch4_ice)*fact 1368 qsurf(ig,igcm_ch4_ice)=qsurf(ig,igcm_ch4_ice)+addch4 1369 1370 ENDIF 1371 ENDDO 1372 1317 1373 c cpbladed : add extension bladed terrains 1318 1374 c ---------------------------------------------------------- … … 2756 2812 ! END DO 2757 2813 2758 c bugn2_new correct bug warm n2 due to change of resolution2814 c correct_t_non2 correct tsurf for N2-free surfaces 2759 2815 c ----------------------------------------------------- 2760 else if (modif(1:len_trim(modif)) .eq. ' bugn2_new') then2816 else if (modif(1:len_trim(modif)) .eq. 'correct_t_non2') then 2761 2817 2762 2818 write(*,*) 'Where do you want to apply the change?' … … 2770 2826 566 read(*,*,iostat=ierr) val5,val6 2771 2827 if(ierr.ne.0) goto 566 2828 write(*,*) 'Choice of temperature threshold ?' 2829 567 read(*,*,iostat=ierr) val7 2830 if(ierr.ne.0) goto 567 2772 2831 2773 2832 ! let's find where we need to apply the correction 2774 2833 ierr=1 2775 do while (ierr.ne.0) 2834 do while (ierr.ne.0) ! do a loop until no change is made 2776 2835 ierr=0 2777 2836 do ig=1,ngridmx 2778 IF (qsurf(ig,igcm_n2). gt.0.) then2837 IF (qsurf(ig,igcm_n2).lt.1.e-6.and.tsurf(ig).le.val7) then 2779 2838 2780 2839 IF ( (latfi(ig)*180./pi.ge.val) .and. … … 2789 2848 ignew=0 2790 2849 DO compt=1,4 2791 if (qsurf(edge(compt),igcm_n2).le.1.e-6) then 2850 if (qsurf(edge(compt),igcm_n2).le.1.e-6.and. 2851 & tsurf(ig).gt.val7) then 2792 2852 ignew=edge(compt) 2793 2853 endif … … 2797 2857 write(*,*) 'ig=',ig,' replaced with ',ignew 2798 2858 qsurf(ig,igcm_n2)=0. 2859 tsurf(ig)=tsurf(ignew) 2860 DO l=1,nsoilmx 2861 tsoil(ig,l)=tsoil(ignew,l) 2862 ENDDO 2863 else 2864 write(*,*) 'No solution for ig=',ig 2865 write(*,*) ' edge=',edge 2866 endif 2867 2868 ENDIF 2869 ENDIF 2870 ENDIF 2871 end do 2872 end do 2873 2874 c correct_t_n2 : correct tsurf of warm n2 patches 2875 c ----------------------------------------------------- 2876 else if (modif(1:len_trim(modif)) .eq. 'correct_t_n2') then 2877 2878 write(*,*) 'Where do you want to apply the change?' 2879 write(*,*) 'Choice band : lat1 and lat2 ?' 2880 580 read(*,*,iostat=ierr) val,val2 2881 if(ierr.ne.0) goto 580 2882 write(*,*) 'Choice band : lon1 and lon2 ?' 2883 581 read(*,*,iostat=ierr) val3,val4 2884 if(ierr.ne.0) goto 581 2885 write(*,*) 'Choice of topography range ?' 2886 582 read(*,*,iostat=ierr) val5,val6 2887 if(ierr.ne.0) goto 582 2888 write(*,*) 'Choice of temperature threshold ?' 2889 583 read(*,*,iostat=ierr) val7 2890 if(ierr.ne.0) goto 583 2891 write(*,*) 'Do you want to remove (0) or keep (1) N2 ice ?' 2892 584 read(*,*,iostat=ierr) val8 2893 if(ierr.ne.0) goto 584 2894 2895 ! let's find where we need to apply the correction 2896 ierr=1 2897 do while (ierr.ne.0) 2898 ierr=0 2899 do ig=1,ngridmx 2900 IF (qsurf(ig,igcm_n2).gt.0..and.tsurf(ig).gt.val7) then 2901 2902 IF ( (latfi(ig)*180./pi.ge.val) .and. 2903 & (latfi(ig)*180./pi.le.val2) .and. 2904 & (lonfi(ig)*180./pi.ge.val3) .and. 2905 & (lonfi(ig)*180./pi.le.val4) ) then 2906 2907 IF ( (phisfi(ig).ge.val5) .and. 2908 & (phisfi(ig).le.val6) ) then 2909 ! Get the index of the adjecent points, N,S,E,W 2910 call get_next_point(ig,edge) 2911 ignew=0 2912 DO compt=1,4 2913 if (qsurf(edge(compt),igcm_n2).ge.1.e-6) then 2914 ignew=edge(compt) 2915 endif 2916 ENDDO 2917 if (ignew.gt.0) then ! Applying correction 2918 ierr=1 2919 write(*,*) 'ig=',ig,' replaced with ',ignew 2920 if (val8.eq.0) then 2921 qsurf(ig,igcm_n2)=0. 2922 endif 2799 2923 tsurf(ig)=tsurf(ignew) 2800 2924 DO l=1,nsoilmx … … 3709 3833 ENDDO 3710 3834 3835 c read an n2frac map 3836 c ----------------------------------------------------- 3837 else if (modif(1:len_trim(modif)) .eq. 'use_n2frac') then 3838 3839 ! Get field 2D 3840 fichnom = 'n2frac.nc' 3841 ierr = NF_OPEN(fichnom, NF_NOWRITE, nid_fi_input) 3842 IF (ierr .NE. NF_NOERR) THEN 3843 write(6,*) 'Problem opening n2frac file:', fichnom 3844 write(6,*) 'ierr = ', ierr 3845 CALL ABORT 3846 ENDIF 3847 3848 ierr = NF_INQ_VARID(nid_fi_input, "n2frac", nvarid_input) 3849 IF (ierr .NE. NF_NOERR) THEN 3850 PRINT*, "Could not find asked variable in n2frac.nc" 3851 CALL abort 3852 ENDIF 3853 #ifdef NC_DOUBLE 3854 ierr = NF_GET_VAR_DOUBLE(nid_fi_input,nvarid_input, 3855 & field_input) 3856 #else 3857 ierr = NF_GET_VAR_REAL(nid_fi_input,nvarid_input,field_input) 3858 #endif 3859 IF (ierr .NE. NF_NOERR) THEN 3860 PRINT*, "Could not get asked variable in n2frac.nc" 3861 CALL abort 3862 ELSE 3863 PRINT*, "Got variable in n2frac.nc" 3864 ENDIF 3865 3866 ! Transfer the data to the new variables 3867 DO ig = 1, ngridmx 3868 n2fracfi(ig) = field_input(ig) 3869 ENDDO 3870 print*, "Transferred data to n2fracfi" 3871 ! Confirmation message 3872 print*, "n2frac data has been successfully implemented." 3873 3711 3874 c slope : add slope on all longitudes 3712 3875 c ----------------------------------------------------- … … 4146 4309 call physdem1("restartfi.nc",nsoilmx,ngridmx,llm,nqtot, 4147 4310 & dtphys,real(day_ini), 4148 & tsurf,tsoil,ithfi,emis,albfi,q2,qsurf )4311 & tsurf,tsoil,ithfi,emis,albfi,q2,qsurf,n2fracfi) 4149 4312 ! & cloudfrac,totalfrac,hice, 4150 4313 ! & rnat,pctsrf_sic,tslab,tsea_ice,sea_ice) … … 4204 4367 4205 4368 ! Selection of the adjacent index depending on the grid point 4206 !! poles (now well implemented yet) 4207 IF (ig.eq.1) then 4369 !! poles (now well implemented yet) 4370 IF (ig.eq.1) then 4208 4371 edge = (/2, 2+int(iim/4),2+2*int(iim/4),iim+1 /) 4209 4372 ELSEIF (ig.eq.ngridmx) then
Note: See TracChangeset
for help on using the changeset viewer.
