Changeset 3214 for trunk/LMDZ.COMMON/libf/evolution
- Timestamp:
- Feb 12, 2024, 5:37:25 PM (10 months ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3210 r3214 236 236 - Addition in the deftank of a bash script "modify_startfi_var.sh" to modify the value of a variable in a "startfi.nc". 237 237 - Small corrections due to r3206. 238 239 == 12/02/2024 == JBC 240 - It is now possible to set the number of initial PCM calls independently of the number of "inter-PEM" PCM calls. It is useful to get a stable situation for the start of the simulation. 241 - Correction of a bug: 'reshape_XIOS_output' treated the first two PCM runs instead of the last two. The numbering has been adapted in "launch_pem.sh" to get it right. 242 - PEM outputs ("diagpem.nc" and "diagsoil_pem.nc") has been improved: 'Time' now evolves according to 'dt_pem' (usually year by year) and 'ecritpem' is a full variable of "time_evol_mod.F90". -
trunk/LMDZ.COMMON/libf/evolution/conf_pem.F90
r3210 r3214 24 24 25 25 use time_evol_mod, only: year_bp_ini, dt_pem, h2o_ice_crit, co2_ice_crit, ps_criterion, Max_iter_pem, & 26 evol_orbit_pem, var_obl, var_ecc, var_lsp, convert_years 26 evol_orbit_pem, var_obl, var_ecc, var_lsp, convert_years, ecritpem 27 27 use comsoil_h_pem, only: soil_pem, fluxgeo, ini_huge_h2oice, depth_breccia, depth_bedrock, reg_thprop_dependp 28 28 use adsorption_mod, only: adsorption_pem 29 29 use glaciers_mod, only: h2oice_flow, co2ice_flow, inf_h2oice_threshold, metam_co2ice_threshold, metam_h2oice_threshold, metam_h2oice, metam_co2ice 30 30 use ice_table_mod, only: icetable_equilibrium, icetable_dynamic 31 use time_phylmdz_mod, only: ecritphy32 31 33 32 implicit none … … 54 53 !#---------- Output parameters ----------# 55 54 ! Frequency of outputs for the PEM 56 ecritp hy= 1 ! Default value: every year57 call getin('ecritpem',ecritp hy)55 ecritpem = 1 ! Default value: every year 56 call getin('ecritpem',ecritpem) 58 57 59 58 !#---------- Orbital parameters ----------# -
trunk/LMDZ.COMMON/libf/evolution/deftank/concat_diagpem.sh
r3210 r3214 10 10 ecritpem=1 11 11 12 # Number of initial PCM calls 13 nPCM_ini=4 14 12 15 # Number of GCM calls between each PEM call 13 n GCM=216 nPCM=2 14 17 15 18 # List of NetCDF files to concatenate … … 34 37 35 38 # Loop to concatenate the NetCDF files 36 newTime=$((n GCM+ 1))39 newTime=$((nPCM_ini + 1)) 37 40 for file in "${files[@]}"; do 38 41 # Extract the 'Time' variable into a temporary file … … 61 64 ncrcat -O $output_file $file -o $output_file 62 65 fi 63 newTime=$((newTime + n GCM))66 newTime=$((newTime + nPCM)) 64 67 done 65 68 -
trunk/LMDZ.COMMON/libf/evolution/deftank/launch_pem.sh
r3210 r3214 25 25 #---------- Modify here the number of years to be simulated ------------ 26 26 ## set the number of years, either Martian or Earth years: 27 n_mars_years=1000000 28 #n_earth_years=1000000 27 n_mars_years=1000 28 #n_earth_years=300 29 30 #------------- Modify here the number of initial PCM calls ------------- 31 ## set the number of initial PCM calls between each PEM call: 32 nPCM_ini=4 29 33 30 34 #---------------- Modify here the number of PCM calls ------------------ … … 130 134 echo $i_myear $n_myear $convert_years > info_PEM.txt 131 135 136 #-------------------------- Initial PCM runs --------------------------- 137 cp run_PCM.def run.def 138 for ((i = 1; i <= $nPCM_ini; i++)); do 139 echo "Run PCM $iPCM (initial): call $i/$nPCM_ini..." 140 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh 141 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh 142 sbatch -W exePCM.sh 143 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally 144 echo "Error: the run PCM $iPCM crashed!" 145 exit 1 146 fi 147 # Copy data files and prepare the next run 148 mv out_runPCM${iPCM} out_PCM/run${iPCM} 149 mv diagfi.nc diags/diagfi${iPCM}.nc 150 if [ -f "diagsoil.nc" ]; then 151 mv diagsoil.nc diags/diagsoil${iPCM}.nc 152 fi 153 if [ -f "stats.nc" ]; then 154 mv stats.nc diags/stats${iPCM}.nc 155 fi 156 k=$(echo "$i + 2 - $nPCM_ini" | bc -l) 157 if [$(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM 158 mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc 159 else 160 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc 161 mv Xdiurnalave.nc data2reshape_Y${k}.nc 162 fi 163 cp restartfi.nc starts/startfi${iPCM}.nc 164 mv restartfi.nc startfi.nc 165 if [ -f "restart.nc" ]; then 166 cp restart.nc starts/restart${iPCM}.nc 167 mv restart.nc start.nc 168 elif [ -f "restart1D.txt" ]; then 169 cp restart1D.txt starts/restart1D${iPCM}.txt 170 mv restart1D.txt start1D.txt 171 fi 172 ((iPCM++)) 173 ((i_myear++)) 174 echo "Done!" 175 done 176 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt 177 132 178 #---------------------- Main loop to call PEM/PCM ---------------------- 133 179 while [ $i_myear -lt $n_myear ]; do 134 #--- Loop to run PCM year by year135 cp run_PCM.def run.def136 for ((i = 1; i <= $nPCM; i++)); do137 echo "Run PCM $iPCM: call $i/$nPCM..."138 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh139 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh140 sbatch -W exePCM.sh141 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally142 echo "Error: the run PCM $iPCM has crashed!"143 exit 1144 fi145 # Copy data files and prepare the next run146 mv out_runPCM${iPCM} out_PCM/run${iPCM}147 mv diagfi.nc diags/diagfi${iPCM}.nc148 if [ -f "diagsoil.nc" ]; then149 mv diagsoil.nc diags/diagsoil${iPCM}.nc150 fi151 if [ -f "stats.nc" ]; then152 mv stats.nc diags/stats${iPCM}.nc153 fi154 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc155 mv Xdiurnalave.nc data2reshape${i}.nc156 cp restartfi.nc starts/startfi${iPCM}.nc157 mv restartfi.nc startfi.nc158 if [ -f "restart.nc" ]; then159 cp restart.nc starts/restart${iPCM}.nc160 mv restart.nc start.nc161 elif [ -f "restart1D.txt" ]; then162 cp restart1D.txt starts/restart1D${iPCM}.txt163 mv restart1D.txt start1D.txt164 fi165 ((iPCM++))166 ((i_myear++))167 echo "Done!"168 done169 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt170 171 180 #--- Reshaping PCM data with XIOS 172 181 echo "Reshaping PCM data with XIOS..." … … 185 194 ./$exePEM > out_runPEM${iPEM} 2>&1 186 195 if [ ! -f "restartfi_evol.nc" ]; then # Check if run ended abnormally 187 echo "Error: the run PEM $iPEM hascrashed!"196 echo "Error: the run PEM $iPEM crashed!" 188 197 exit 1 189 198 fi … … 191 200 mv out_runPEM${iPEM} out_PEM/run${iPEM} 192 201 mv diagpem.nc diags/diagpem${iPEM}.nc 193 mv diagsoilpem.nc diags/diagsoilpem${iPEM}.nc 202 if [ -f "diagsoilpem.nc" ]; then 203 mv diagsoilpem.nc diags/diagsoilpem${iPEM}.nc 204 fi 194 205 cp restartpem.nc starts/startpem${iPEM}.nc 195 206 mv restartpem.nc startpem.nc … … 206 217 read i_myear n_myear convert_years < info_PEM.txt 207 218 echo "Done!" 219 220 #--- Loop to run PCM year by year 221 cp run_PCM.def run.def 222 for ((i = 1; i <= $nPCM; i++)); do 223 echo "Run PCM $iPCM: call $i/$nPCM..." 224 sed -i "s/#SBATCH --job-name=runPCM.*/#SBATCH --job-name=runPCM${iPCM}/" exePCM.sh 225 sed -i "s/out_runPCM[0-9]\+/out_runPCM${iPCM}/" exePCM.sh 226 sbatch -W exePCM.sh 227 if [ ! -f "restartfi.nc" ]; then # Check if run ended abnormally 228 echo "Error: the run PCM $iPCM crashed!" 229 exit 1 230 fi 231 # Copy data files and prepare the next run 232 mv out_runPCM${iPCM} out_PCM/run${iPCM} 233 mv diagfi.nc diags/diagfi${iPCM}.nc 234 if [ -f "diagsoil.nc" ]; then 235 mv diagsoil.nc diags/diagsoil${iPCM}.nc 236 fi 237 if [ -f "stats.nc" ]; then 238 mv stats.nc diags/stats${iPCM}.nc 239 fi 240 k=$(echo "$i + 2 - $nPCM" | bc -l) 241 if [$(echo "$k < 1" | bc -l) -eq 1 ]; then # Only the last 2 years are taken for the PEM 242 mv Xdiurnalave.nc diags/data2reshape${iPCM}.nc 243 else 244 cp Xdiurnalave.nc diags/data2reshape${iPCM}.nc 245 mv Xdiurnalave.nc data2reshape_Y${k}.nc 246 fi 247 cp restartfi.nc starts/startfi${iPCM}.nc 248 mv restartfi.nc startfi.nc 249 if [ -f "restart.nc" ]; then 250 cp restart.nc starts/restart${iPCM}.nc 251 mv restart.nc start.nc 252 elif [ -f "restart1D.txt" ]; then 253 cp restart1D.txt starts/restart1D${iPCM}.txt 254 mv restart1D.txt start1D.txt 255 fi 256 ((iPCM++)) 257 ((i_myear++)) 258 echo "Done!" 259 done 260 sed -i "1s/.*/$i_myear $n_myear $convert_years/" info_PEM.txt 208 261 done 209 262 … … 212 265 213 266 date 214 echo "The launching script has terminated."267 echo "The launching script ended." -
trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
r3206 r3214 109 109 !1. Run 110 110 if (startpem_file) then 111 write(*,*)'There is a "startpem.nc"!' 111 112 ! open pem initial state file: 112 113 call open_startphy(filename) … … 321 322 ! h2o ice 322 323 h2o_ice = 0. 323 write(*,*)'There is no "startpem.nc" so ''h2o_ice'' is reconstructed from watercaptag with default value ''ini_huge_h2oice''.' 324 do ig = 1,ngrid 325 if (watercaptag(ig)) h2o_ice(ig,:) = ini_huge_h2oice/subslope_dist(ig,:)*cos(pi*def_slope_mean(:)*180.) 326 enddo 324 write(*,*)'There is no "startpem.nc"!' 325 write(*,*)'So ''h2o_ice'' is initialized with default value ''ini_huge_h2oice'' where ''watercaptag'' is true.' 326 do ig = 1,ngrid 327 if (watercaptag(ig)) h2o_ice(ig,:) = ini_huge_h2oice/subslope_dist(ig,:)*cos(pi*def_slope_mean(:)*180.) 328 enddo 327 329 328 330 ! co2 ice 331 write(*,*)'So ''co2_ice'' is initialized with ''perennial_co2ice''.' 329 332 co2_ice = perennial_co2ice 330 333 -
trunk/LMDZ.COMMON/libf/evolution/reshape_XIOS_output.F90
r3181 r3214 14 14 implicit none 15 15 16 integer :: state, ncid , ncid1, ncid2, nDims, nVars, nGlobalAtts, unlimDimID17 integer :: i, j,include_parents, cstat16 integer :: state, ncid1, ncid2, nDims, nVars, nGlobalAtts, unlimDimID 17 integer :: i, include_parents, cstat 18 18 integer, dimension(:), allocatable :: dimids, varids, dimids_2, varids_2, dimid_var 19 19 real, dimension(:), allocatable :: tempvalues_1d, values_1d … … 31 31 write(str(1:1),'(i1.1)') numyear 32 32 33 state = nf90_open(path = "data2reshape "//str//".nc", mode = nf90_nowrite, ncid = ncid1)33 state = nf90_open(path = "data2reshape_Y"//str//".nc", mode = nf90_nowrite, ncid = ncid1) 34 34 if (state /= nf90_noerr) call handle_err(state) 35 35 -
trunk/LMDZ.COMMON/libf/evolution/time_evol_mod.F90
r3159 r3214 14 14 logical :: var_ecc ! True if we want the PEM to follow obl_ecc_lsp.asc parameters for eccenticity 15 15 logical :: var_lsp ! True if we want the PEM to follow obl_ecc_lsp.asc parameters for ls perihelie 16 integer :: ecritpem ! For "diagpem.nc" outputs, writen every ecritpem 16 17 17 18 END MODULE time_evol_mod -
trunk/LMDZ.COMMON/libf/evolution/writediagpem.F90
r3190 r3214 16 16 ! (ou encore 1d, dans le cas de testphys1d, pour sortir une colonne) 17 17 ! La periode d'ecriture est donnee par 18 ! "ecritp hy" regle dans le fichier de controle de run : run.def18 ! "ecritpem " regle dans le fichier de controle de run : run.def 19 19 ! 20 20 ! writediagpem peut etre appele de n'importe quelle subroutine … … 49 49 use surfdat_h, only: phisfi 50 50 use geometry_mod, only: cell_area 51 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq, day_ini52 51 use mod_phys_lmdz_para, only: is_parallel, is_mpi_root, is_master, gather 53 52 use mod_grid_phy_lmdz, only: klon_glo, Grid1Dto2D_glo, nbp_lon, nbp_lat, nbp_lev, grid_type, unstructured 53 use time_evol_mod, only: ecritpem, dt_pem 54 54 55 55 implicit none … … 120 120 !*************************************************************** 121 121 !Sortie des variables au rythme voulu 122 irythme = int(ecritp hy) ! output rate set by ecritphy122 irythme = int(ecritpem) ! output rate set by ecritpem 123 123 124 124 !*************************************************************** … … 235 235 ! write "header" of file (longitudes, latitudes, geopotential, ...) 236 236 IF (klon_glo>1) THEN ! general 3D case 237 call iniwrite(nid, day_ini,phis,area,nbp_lon+1,nbp_lat)237 call iniwrite(nid,0,phis,area,nbp_lon+1,nbp_lat) 238 238 ELSE ! 1D model 239 call iniwrite(nid, day_ini,phisfi_glo(1),areafi_glo(1),1,1)239 call iniwrite(nid,0,phisfi_glo(1),areafi_glo(1),1,1) 240 240 ENDIF 241 241 … … 255 255 ! to writediagpem 256 256 !------------------------------------------------------------------------ 257 if (nom == firstnom) zitau = zitau + iphysiq257 if (nom == firstnom) zitau = zitau + dt_pem 258 258 259 259 !-------------------------------------------------------- … … 271 271 ntime=ntime+1 ! increment # of stored time steps 272 272 ! compute corresponding date (in days and fractions thereof) 273 date =(zitau +1.)/day_step273 date = float(zitau + 1) 274 274 ! Get NetCDF ID of 'Time' variable 275 275 ierr= NF_INQ_VARID(nid,"Time",varid) … … 580 580 END SUBROUTINE writediagpem 581 581 582 subroutine writediagsoilpem(ngrid,name,title,units,dimpx,px) 582 !================================================================= 583 584 SUBROUTINE writediagsoilpem(ngrid,name,title,units,dimpx,px) 583 585 584 586 ! Write variable 'name' to NetCDF file 'diagsoil.nc'. … … 593 595 ! Modifs: Aug.2010 Ehouarn: enforce outputs to be real*4 594 596 595 use comsoil_h_PEM, only: nsoilmx_PEM, inertiedat_PEM596 use geometry_mod, only: cell_area597 use time_phylmdz_mod, only: ecritphy, day_step, iphysiq598 use mod_ phys_lmdz_para, only : is_mpi_root, is_master, gather599 use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo, nbp_lon, nbp_lat600 use mod_grid_phy_lmdz, only : grid_type, unstructured597 use comsoil_h_PEM, only: nsoilmx_PEM, inertiedat_PEM 598 use geometry_mod, only: cell_area 599 use mod_phys_lmdz_para, only: is_mpi_root, is_master, gather 600 use mod_grid_phy_lmdz, only: klon_glo, Grid1Dto2D_glo, nbp_lon, nbp_lat 601 use mod_grid_phy_lmdz, only: grid_type, unstructured 602 use time_evol_mod, only: ecritpem, dt_pem 601 603 602 604 implicit none … … 679 681 680 682 ! Set output sample rate 681 isample=int(ecritphy) ! same as for diagfi outputs 682 ! Note ecritphy is known from control.h 683 isample = int(ecritpem) ! same as for diagpem outputs 683 684 684 685 ! Create output NetCDF file … … 745 746 if (name.eq.firstname) then 746 747 ! if we run across 'firstname', then it is a new time step 747 zitau=zitau+iphysiq 748 ! Note iphysiq is known from control.h 748 zitau = zitau + dt_pem 749 749 endif 750 750 … … 755 755 if (name.eq.firstname) then 756 756 ntime=ntime+1 757 date=float(zitau+1)/float(day_step) 758 ! Note: day_step is known from control.h 757 date = float(zitau + 1) 759 758 760 759 if (is_master) then … … 988 987 endif 989 988 990 end subroutinewritediagsoilpem989 END SUBROUTINE writediagsoilpem 991 990 992 991
Note: See TracChangeset
for help on using the changeset viewer.