Changeset 3979
- Timestamp:
- Nov 28, 2025, 5:34:32 PM (2 days ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 3 edited
-
changelog.txt (modified) (1 diff)
-
pem.F90 (modified) (1 diff)
-
surf_temp.F90 (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3977 r3979 802 802 - Deletion of the reshaping tool "reshape_XIOS_output" used to convert XIOS outputs onto the PCM grid. Thus, the PEM is now able to read directly the format of XIOS outputs. 803 803 - Addition of subroutines to convert data between a lon x lat array and a vector. 804 805 == 28/11/2025 == JBC 806 Addition of the periodicity to search along the longitudes to find the nearest bare soil from the place where ice disappeared + Searching with slope priority according to equator-ward orientation to try gaining efficiency + Warning if the search is unsuccessful. -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r3977 r3979 743 743 !------------------------ 744 744 ! II_d.1 Update Tsurf 745 call update_tsurf_nearest_baresoil(ngrid,nslope,iim,jjm _value,tsurf_avg,co2_ice,is_co2ice_ini,co2ice_disappeared)745 call update_tsurf_nearest_baresoil(ngrid,nslope,iim,jjm - 1,latitude,tsurf_avg,co2_ice,is_co2ice_ini,co2ice_disappeared) 746 746 747 747 if (soil_pem) then -
trunk/LMDZ.COMMON/libf/evolution/surf_temp.F90
r3977 r3979 7 7 !======================================================================= 8 8 9 SUBROUTINE update_tsurf_nearest_baresoil(ngrid,nslope,iim_input,jjm_input,tsurf_avg,co2_ice,is_co2ice_ini,co2ice_disappeared) 9 SUBROUTINE update_tsurf_nearest_baresoil(ngrid,nslope,nlon,nlat,latitude,tsurf_avg,co2_ice,is_co2ice_ini,co2ice_disappeared) 10 11 use grid_conversion, only: vect2lonlat, lonlat2vect 10 12 11 13 implicit none 12 14 13 15 ! Inputs: 14 integer, intent(in) :: iim_input, jjm_input, nslope, ngrid16 integer, intent(in) :: nlon, nlat, nslope, ngrid 15 17 real, dimension(ngrid,nslope), intent(in) :: co2_ice 18 real, dimension(ngrid), intent(in) :: latitude 16 19 logical, dimension(ngrid,nslope), intent(in) :: is_co2ice_ini 17 20 ! Outputs: … … 19 22 logical, dimension(ngrid,nslope), intent(inout) :: co2ice_disappeared 20 23 ! Local variables: 21 real, parameter :: eps = 1.e-10 22 integer :: islope, i, j, k, radius, rmax, di, dj, ii, jj 23 logical :: found 24 real, dimension(iim_input + 1,jjm_input + 1,nslope) :: tsurf_ll, co2ice_ll, mask_co2ice_ini, co2ice_disappeared_ll 25 real, dimension(ngrid) :: tmp 24 real, parameter :: eps = 1.e-10 25 integer :: islope, i, j, k, radius, rmax, di, dj, ii, jj 26 logical :: found 27 real, dimension(nlon,nlat,nslope) :: tsurf_ll, co2ice_ll, mask_co2ice_ini, co2ice_disappeared_ll 28 real, dimension(nlon,nlat) :: latitude_ll 29 real, dimension(ngrid) :: tmp 30 integer, dimension(nslope - 1) :: priority 26 31 27 ! Check to escape the subroutine 32 ! Check to escape the subroutine (not relevant in 1D) 28 33 if (ngrid == 1) return 29 34 30 35 write(*,*) "> Updating surface temperature where ice disappeared" 31 36 ! Convert from reduced grid to lon-lat grid 32 #ifndef CPP_1D 37 call vect2lonlat(nlon,nlat,ngrid,latitude,latitude_ll) 33 38 do islope = 1,nslope 34 call gr_fi_dyn(1,ngrid,iim_input + 1,jjm_input + 1,tsurf_avg(:,islope),tsurf_ll(:,:,islope))35 call gr_fi_dyn(1,ngrid,iim_input + 1,jjm_input + 1,co2_ice(:,islope),co2ice_ll(:,:,islope))36 call gr_fi_dyn(1,ngrid,iim_input + 1,jjm_input + 1,merge(1.,0.,is_co2ice_ini(:,islope)),mask_co2ice_ini(:,:,islope))37 call gr_fi_dyn(1,ngrid,iim_input + 1,jjm_input + 1,merge(1.,0.,co2ice_disappeared(:,islope)),co2ice_disappeared_ll(:,:,islope))39 call vect2lonlat(nlon,nlat,ngrid,tsurf_avg(:,islope),tsurf_ll(:,:,islope)) 40 call vect2lonlat(nlon,nlat,ngrid,co2_ice(:,islope),co2ice_ll(:,:,islope)) 41 call vect2lonlat(nlon,nlat,ngrid,merge(1.,0.,is_co2ice_ini(:,islope)),mask_co2ice_ini(:,:,islope)) 42 call vect2lonlat(nlon,nlat,ngrid,merge(1.,0.,co2ice_disappeared(:,islope)),co2ice_disappeared_ll(:,:,islope)) 38 43 enddo 39 #endif40 44 41 45 ! For each point where ice disappeared 42 rmax = max( iim_input + 1,jjm_input + 1)43 do j = 1, jjm_input + 144 do i = 1, iim_input + 146 rmax = max(nlon,nlat) 47 do j = 1,nlat 48 do i = 1,nlon 45 49 do islope = 1,nslope 46 50 if (mask_co2ice_ini(i,j,islope) > 0.5 .and. co2ice_ll(i,j,islope) < eps .and. co2ice_disappeared_ll(i,j,islope) < 0.5) then 47 51 found = .false. 48 52 co2ice_disappeared_ll(i,j,islope) = 1. 49 do k = 1,nslope 50 if (k /= islope .and. mask_co2ice_ini(i,j,k) < 0.5) then 51 tsurf_ll(i,j,islope) = tsurf_ll(i,j,k) 53 call get_slope_priority(latitude_ll(i,j),nslope,islope,priority) 54 do k = 1,nslope - 1 55 if (mask_co2ice_ini(i,j,priority(k)) < 0.5) then 56 tsurf_ll(i,j,islope) = tsurf_ll(i,j,priority(k)) 52 57 found = .true. 53 58 exit … … 56 61 57 62 radius = 1 58 do while (.not. found .and. radius <= rmax) ! only if no adjacent slopes holds bare soil63 do while (.not. found .and. radius <= rmax) ! Only if no adjacent slopes holds bare soil 59 64 do dj = -radius,radius 60 65 do di = -radius,radius … … 62 67 ii = i + di 63 68 jj = j + dj 64 if (ii >= 1 .and. ii <= iim_input + 1 .and. jj >= 1 .and. jj <= jjm_input + 1) then 65 do k = 1,nslope 66 if (mask_co2ice_ini(ii,jj,k) < 0.5) then 67 tsurf_ll(i,j,islope) = tsurf_ll(i,j,k) 69 ! Longitudinal periodicity 70 if (ii < 1) then 71 ii = ii + nlon 72 else if (ii > nlon) then 73 ii = ii - nlon 74 endif 75 ! Latitude boundaries 76 if (jj >= 1 .and. jj <= nlat) then 77 call get_slope_priority(latitude_ll(ii,jj),nslope,islope,priority) 78 do k = 1,nslope - 1 79 if (mask_co2ice_ini(ii,jj,priority(k)) < 0.5) then 80 tsurf_ll(i,j,islope) = tsurf_ll(ii,jj,priority(k)) 68 81 found = .true. 69 82 exit … … 78 91 radius = radius + 1 79 92 enddo 93 if (.not. found) write(*,*) "WARNING: no bare soil found for ice disappeared on point:",i,j,islope 80 94 endif 81 82 95 enddo 83 96 enddo … … 85 98 86 99 ! Convert back from lon-lat grid to reduced grid 87 #ifndef CPP_1D88 100 do islope = 1,nslope 89 call gr_dyn_fi(1,iim_input + 1,jjm_input + 1,ngrid,tsurf_ll(:,:,islope),tsurf_avg(:,islope))90 call gr_dyn_fi(1,iim_input + 1,jjm_input + 1,ngrid,co2ice_disappeared_ll(:,:,islope),tmp)101 call lonlat2vect(nlon,nlat,ngrid,tsurf_ll(:,:,islope),tsurf_avg(:,islope)) 102 call lonlat2vect(nlon,nlat,ngrid,co2ice_disappeared_ll(:,:,islope),tmp) 91 103 where (tmp > 0.5) co2ice_disappeared(:,islope) = .true. 92 104 enddo 93 #endif94 105 95 106 END SUBROUTINE update_tsurf_nearest_baresoil 96 107 108 !======================================================================= 109 SUBROUTINE get_slope_priority(lat,nslope,islope,priority) 110 ! Priority given to equator-ward slope which are most likely to hold no ice 111 112 implicit none 113 114 ! Inputs: 115 real, intent(in) :: lat 116 integer, intent(in) :: nslope, islope 117 ! Outputs: 118 integer, dimension(nslope - 1), intent(out) :: priority 119 ! Locals: 120 integer :: i, k 121 122 ! Code 123 !----- 124 k = 1 125 126 ! Northern hemisphere 127 if (lat > 0.) then 128 ! Equator-ward slopes 129 do i = islope - 1,1,-1 130 priority(k) = i 131 k = k + 1 132 enddo 133 ! Pole-ward slopes 134 do i = islope + 1,nslope 135 priority(k) = i 136 k = k + 1 137 enddo 138 else ! Southern hemisphere 139 ! Equator-ward slopes 140 do i = islope + 1,nslope 141 priority(k) = i 142 k = k + 1 143 enddo 144 ! Pole-ward slopes 145 do i = islope - 1,1,-1 146 priority(k) = i 147 k = k + 1 148 enddo 149 endif 150 151 END SUBROUTINE get_slope_priority 152 97 153 END MODULE surf_temp
Note: See TracChangeset
for help on using the changeset viewer.
