Changeset 4068
- Timestamp:
- Feb 12, 2026, 12:32:15 PM (7 weeks ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 8 edited
-
changelog.txt (modified) (2 diffs)
-
clim_state_init.F90 (modified) (3 diffs)
-
clim_state_rec.F90 (modified) (6 diffs)
-
config.F90 (modified) (2 diffs)
-
deftank/run_PEM.def (modified) (1 diff)
-
io_netcdf.F90 (modified) (8 diffs)
-
layered_deposits.F90 (modified) (1 diff)
-
pem.F90 (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r4065 r4068 849 849 - "numerics" defines numerical types and constants for reproducibility, portability across compilers and future transitions (e.g. quadruple precision experiments); 850 850 - "display" provides a single controlled interface for runtime messages, status output and diagnostics, avoiding direct 'print'/'write' to enable silent mode, log redirection, and MPI-safe output in the future. 851 - "utility" (new module)hosts generic helpers used throughout the code (e.g. "int2str" or "real2str");851 - "utility" hosts generic helpers used throughout the code (e.g. "int2str" or "real2str"); 852 852 - Add modules "clim_state_init"/"clim_state_rec" which provide robust read/write logic for "start/startfi/startpem", including 1D fallbacks, mesh conversions and dimension checks. NetCDF file creation is centralized and explicit. Restart files are now self-consistent and future-proof, requiring changes only to affected variables; 853 853 - Add module "atmosphere" which computes pressure fields, reconstructs potential temperature and air mass. It also holds the whole logic to define sigma or hybrid coordinates for altitudes; … … 865 865 This revision is a structural milestone aiming to be behavior-preserving where possible. It has been tested via compilation and short integration runs. However, due to extensive renames, moves, and API changes, full validation is still ongoing. 866 866 Note: the revision includes one (possibly two) easter egg hidden in the code for future archaeologists of the PEM. No physics were harmed. 867 868 == 12/02/2026 == JBC 869 Following r4065, some safeguards forgotten in "io_netcdf.F90" + 'tsurf' is not needed anymore in the "start1D.txt" + few forgotten small updates. -
trunk/LMDZ.COMMON/libf/evolution/clim_state_init.F90
r4065 r4068 137 137 character(30) :: header 138 138 real(dp), dimension(1,1) :: tmp 139 real(dp), dimension(nslope) :: tmp_1d140 139 real(dp), dimension(1,1,nlayer) :: q_tmp, teta_tmp, wind_tmp 141 140 real(dp), dimension(nlayer + 1) :: ap_tmp, bp_tmp … … 157 156 158 157 do i = 1,nq 159 read(funit,*,iostat = ierr) header, ( tmp_1d(j),j = 1,nslope), (q_tmp(1,1,k),k = 1,nlayer)158 read(funit,*,iostat = ierr) header, (q_tmp(1,1,k),k = 1,nlayer) 160 159 if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'not enough atmospheric layers defined in the file "'//start1D_name//'" for the tracer "'//trim(header)//'"!',1) 161 160 call set_q_PCM(q_tmp,i) … … 165 164 read(funit,*,iostat = ierr) header, (wind_tmp(1,1,k),k = 1,nlayer) 166 165 call set_v_PCM(wind_tmp) 167 read(funit,*,iostat = ierr) header, (t mp_1d(j),j = 1,nslope), (teta_tmp(1,1,k),k = 1,nlayer)166 read(funit,*,iostat = ierr) header, (teta_tmp(1,1,k),k = 1,nlayer) 168 167 call set_teta_PCM(teta_tmp) 169 168 -
trunk/LMDZ.COMMON/libf/evolution/clim_state_rec.F90
r4065 r4068 31 31 32 32 !======================================================================= 33 SUBROUTINE write_restart(ps4PCM,pa4PCM,preff4PCM, tsurf4PCM,q4PCM,teta4PCM,air_mass4PCM)33 SUBROUTINE write_restart(ps4PCM,pa4PCM,preff4PCM,q4PCM,teta4PCM,air_mass4PCM) 34 34 !----------------------------------------------------------------------- 35 35 ! NAME … … 61 61 real(dp), intent(in) :: pa4PCM, preff4PCM 62 62 real(dp), dimension(:), intent(in) :: ps4PCM 63 real(dp), dimension(:,:), intent(in) :: t surf4PCM, teta4PCM, air_mass4PCM63 real(dp), dimension(:,:), intent(in) :: teta4PCM, air_mass4PCM 64 64 real(dp), dimension(:,:,:), intent(in) :: q4PCM 65 65 … … 75 75 ! ~~~~~~~~~~~~~ 76 76 if (ngrid == 1) then 77 call write_restart1D(ps4PCM,pa4PCM,preff4PCM, tsurf4PCM,q4PCM)77 call write_restart1D(ps4PCM,pa4PCM,preff4PCM,q4PCM) 78 78 return 79 79 end if … … 120 120 121 121 !======================================================================= 122 SUBROUTINE write_restart1D(ps4PCM,pa4PCM,preff4PCM, tsurf4PCM,q4PCM)122 SUBROUTINE write_restart1D(ps4PCM,pa4PCM,preff4PCM,q4PCM) 123 123 !----------------------------------------------------------------------- 124 124 ! NAME … … 151 151 real(dp), intent(in) :: pa4PCM, preff4PCM 152 152 real(dp), dimension(:), intent(in) :: ps4PCM 153 real(dp), dimension(:,:), intent(in) :: tsurf4PCM154 153 real(dp), dimension(:,:,:), intent(in) :: q4PCM 155 154 … … 170 169 write(funit,*) 'u', (u_PCM(1,l), l = 1,nlayer) 171 170 write(funit,*) 'v', (v_PCM(1,l), l = 1,nlayer) 172 write(funit,*) 'teta', (t surf4PCM(1,j), j = 1,nslope), (teta_PCM(1,l), l = 1,nlayer)171 write(funit,*) 'teta', (teta_PCM(1,l), l = 1,nlayer) 173 172 close(funit) 174 173 -
trunk/LMDZ.COMMON/libf/evolution/config.F90
r4065 r4068 76 76 ! LOCAL VARIABLES 77 77 ! --------------- 78 logical(k4) :: here, evol_orbit_l, evol_obl_l, evol_ecc_l, evol_lsp_l, do_soil_l, reg_thprop_dependp_l, do_sorption_l, hybrid _alt_coord_l78 logical(k4) :: here, evol_orbit_l, evol_obl_l, evol_ecc_l, evol_lsp_l, do_soil_l, reg_thprop_dependp_l, do_sorption_l, hybrid 79 79 logical(k4) :: icetable_equilibrium_l, icetable_dynamic_l, h2oice_flow_l, co2ice_flow_l, do_layering_l, impose_dust_ratio_l 80 80 integer(di) :: output_rate_l … … 204 204 205 205 ! Read "run_PCM.def" parameters 206 hybrid _alt_coord_l = .true. ! Default setting207 call get_hybrid(hybrid _alt_coord_l)208 call set_atmosphere_config(hybrid _alt_coord_l)206 hybrid = .true. ! Default 207 call get_hybrid(hybrid) 208 call set_atmosphere_config(hybrid) 209 209 210 210 ! Check incompatibilities -
trunk/LMDZ.COMMON/libf/evolution/deftank/run_PEM.def
r4065 r4068 102 102 # dust2ice_ratio=0.1 103 103 104 # Some definitions for the physics , in file 'callphys.def'104 # Some definitions for the physics in file "run_PCM.def" 105 105 INCLUDEDEF=run_PCM.def -
trunk/LMDZ.COMMON/libf/evolution/io_netcdf.F90
r4065 r4068 958 958 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill) 959 959 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 960 if (has_fill .and. var == fill_value) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 960 if (has_fill) then 961 if (var == fill_value) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 962 end if 961 963 962 964 ! Valid range … … 977 979 end if 978 980 end if 979 if (has_range .and. (var < valid_min .or. var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 981 if (has_range) then 982 if (var < valid_min .or. var > valid_max) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 983 end if 980 984 981 985 END SUBROUTINE check_valid_var0d_nc … … 1124 1128 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill) 1125 1129 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1126 if (has_fill .and. any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1130 if (has_fill) then 1131 if (any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1132 end if 1127 1133 1128 1134 ! Valid range … … 1143 1149 end if 1144 1150 end if 1145 if (has_range .and. (any(var < valid_min) .or. any(var > valid_max))) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 1151 if (has_range) then 1152 if (any(var < valid_min) .or. any(var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 1153 end if 1146 1154 1147 1155 END SUBROUTINE check_valid_var2d_nc … … 1205 1213 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill) 1206 1214 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1207 if (has_fill .and. any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1215 if (has_fill) then 1216 if (any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1217 end if 1208 1218 1209 1219 ! Valid range … … 1224 1234 end if 1225 1235 end if 1226 if (has_range .and. (any(var < valid_min) .or. any(var > valid_max))) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 1236 if (has_range) then 1237 if (any(var < valid_min) .or. any(var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 1238 end if 1227 1239 1228 1240 END SUBROUTINE check_valid_var3d_nc … … 1286 1298 call check_nc(nf90_get_att(ncid,varid,"_FillValue",fill_value),'getting fill value',has_fill) 1287 1299 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1288 if (has_fill .and. any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1300 if (has_fill) then 1301 if (any(var == fill_value)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1302 end if 1289 1303 1290 1304 ! Valid range … … 1305 1319 end if 1306 1320 end if 1307 if (has_range .and. (any(var < valid_min) .or. any(var > valid_max))) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 1321 if (has_range) then 1322 if(any(var < valid_min) .or. any(var > valid_max)) call stop_clean(__FILE__,__LINE__,'Values outside valid range ('//real2str(valid_min)//','//real2str(valid_max)//') detected in '//var_name//'!',1) 1323 end if 1308 1324 1309 1325 END SUBROUTINE check_valid_var4d_nc -
trunk/LMDZ.COMMON/libf/evolution/layered_deposits.F90
r4065 r4068 117 117 d_dust = d_dust_in 118 118 dust2ice_ratio = dust2ice_ratio_in 119 call print_msg('do_layering = '//bool2str(do_layering))119 call print_msg('do_layering = '//bool2str(do_layering)) 120 120 call print_msg('impose_dust_ratio = '//bool2str(impose_dust_ratio)) 121 121 call print_msg('d_dust = '//real2str(d_dust)) -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r4065 r4068 265 265 allocate(character(8) :: num) 266 266 end if 267 allocate(delta_icetable(ngrid),icetable_depth_old(ngrid,nslope),is_co2ice_disappeared(ngrid,nslope) )267 allocate(delta_icetable(ngrid),icetable_depth_old(ngrid,nslope),is_co2ice_disappeared(ngrid,nslope),tsoil_ts_old(ngrid,nsoil,nslope,nday)) 268 268 is_co2ice_disappeared(:,:) = .false. 269 269 delta_icetable(:) = 0._dp … … 290 290 ! Conversion to surface ice 291 291 call layering2surfice(layerings_map,h2o_ice,co2_ice,h2oice_depth) 292 293 292 else 294 293 zlag(:,:) = 0._dp … … 324 323 325 324 ! Evolve soil temperature 326 allocate(tsoil_ts_old(ngrid,nsoil,nslope,nday))327 325 call evolve_soil_temp(tsoil_avg,tsurf_avg,tsoil_ts,tsoil_ts_old,h2o_soildensity_avg) 328 326 … … 491 489 492 490 ! Write the "start.nc" 493 call write_restart(ps4PCM,pa4PCM,preff4PCM, tsurf4PCM,q4PCM,teta4PCM,air_mass4PCM)491 call write_restart(ps4PCM,pa4PCM,preff4PCM,q4PCM,teta4PCM,air_mass4PCM) 494 492 495 493 ! Update the duration information of the simulation
Note: See TracChangeset
for help on using the changeset viewer.
