| 1 | MODULE config |
|---|
| 2 | !----------------------------------------------------------------------- |
|---|
| 3 | ! NAME |
|---|
| 4 | ! config |
|---|
| 5 | ! |
|---|
| 6 | ! DESCRIPTION |
|---|
| 7 | ! Read and apply parameters for a PEM run from run_pem.def. |
|---|
| 8 | ! |
|---|
| 9 | ! AUTHORS & DATE |
|---|
| 10 | ! R. Vandemeulebrouck |
|---|
| 11 | ! JB Clement, 2023-2025 |
|---|
| 12 | ! |
|---|
| 13 | ! NOTES |
|---|
| 14 | ! |
|---|
| 15 | !----------------------------------------------------------------------- |
|---|
| 16 | |
|---|
| 17 | ! DEPENDENCIES |
|---|
| 18 | ! ------------ |
|---|
| 19 | use numerics, only: dp, di, k4, minieps |
|---|
| 20 | |
|---|
| 21 | ! DECLARATION |
|---|
| 22 | ! ----------- |
|---|
| 23 | implicit none |
|---|
| 24 | |
|---|
| 25 | character(7), parameter :: rundef_name = 'run.def' |
|---|
| 26 | character(11), parameter :: runPCMdef_name = 'run_pcm.def' |
|---|
| 27 | character(12), parameter :: callphys_name = 'callphys.def' |
|---|
| 28 | |
|---|
| 29 | contains |
|---|
| 30 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 31 | |
|---|
| 32 | !======================================================================= |
|---|
| 33 | SUBROUTINE read_rundef() |
|---|
| 34 | !----------------------------------------------------------------------- |
|---|
| 35 | ! NAME |
|---|
| 36 | ! read_rundef |
|---|
| 37 | ! |
|---|
| 38 | ! DESCRIPTION |
|---|
| 39 | ! Read PEM runtime configuration from getin keys, then set |
|---|
| 40 | ! module-scoped parameters accordingly. |
|---|
| 41 | ! |
|---|
| 42 | ! AUTHORS & DATE |
|---|
| 43 | ! R. Vandemeulebrouck |
|---|
| 44 | ! JB Clement, 2023-2025 |
|---|
| 45 | ! |
|---|
| 46 | ! NOTES |
|---|
| 47 | ! |
|---|
| 48 | !----------------------------------------------------------------------- |
|---|
| 49 | |
|---|
| 50 | ! DEPENDENCIES |
|---|
| 51 | ! ------------ |
|---|
| 52 | #ifdef CPP_IOIPSL |
|---|
| 53 | use IOIPSL, only: getin |
|---|
| 54 | #else |
|---|
| 55 | ! If not using IOIPSL, we still need to use (a local version of) getin |
|---|
| 56 | use ioipsl_getincom, only: getin |
|---|
| 57 | #endif |
|---|
| 58 | use evolution, only: set_evolution_config |
|---|
| 59 | use stopping_crit, only: set_stopping_crit_config |
|---|
| 60 | use soil, only: set_soil_config |
|---|
| 61 | use sorption, only: set_sorption_config |
|---|
| 62 | use glaciers, only: set_glaciers_config |
|---|
| 63 | use surf_ice, only: set_surf_ice_config |
|---|
| 64 | use ice_table, only: set_ice_table_config |
|---|
| 65 | use layered_deposits, only: set_layered_deposits_config |
|---|
| 66 | use output, only: set_output_config |
|---|
| 67 | use orbit, only: set_orbit_config |
|---|
| 68 | use atmosphere, only: set_atmosphere_config |
|---|
| 69 | use stoppage, only: stop_clean |
|---|
| 70 | use display, only: print_msg |
|---|
| 71 | |
|---|
| 72 | ! DECLARATION |
|---|
| 73 | ! ----------- |
|---|
| 74 | implicit none |
|---|
| 75 | |
|---|
| 76 | ! LOCAL VARIABLES |
|---|
| 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 |
|---|
| 79 | logical(k4) :: icetable_equilibrium_l, icetable_dynamic_l, h2oice_flow_l, co2ice_flow_l, do_layering_l, impose_dust_ratio_l |
|---|
| 80 | integer(di) :: output_rate_l |
|---|
| 81 | integer(di) :: pem_ini_earth_date ! Initial year (in Earth years) of the PEM workflow defined in "run.def" |
|---|
| 82 | real(dp) :: dt_l, nmax_yr_run_l, h2oice_crit_l, co2ice_crit_l, ps_crit_l, max_change_obl_l, max_change_ecc_l, max_change_lsp_l |
|---|
| 83 | real(dp) :: flux_geo_l, depth_breccia_l, depth_bedrock_l, threshold_h2oice_cap_l, h2oice_huge_ini_l, d_dust_l, dust2ice_ratio_l |
|---|
| 84 | |
|---|
| 85 | ! CODE |
|---|
| 86 | ! ---- |
|---|
| 87 | inquire(file = rundef_name,exist = here) |
|---|
| 88 | if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//rundef_name//'" (PEM)!',1) |
|---|
| 89 | call print_msg('> Reading "'//rundef_name//'"') |
|---|
| 90 | |
|---|
| 91 | ! Output |
|---|
| 92 | ! ~~~~~~ |
|---|
| 93 | output_rate_l = 1_di ! Default value: every year |
|---|
| 94 | call getin('output_rate',output_rate_l) |
|---|
| 95 | |
|---|
| 96 | ! Orbital parameters |
|---|
| 97 | ! ~~~~~~~~~~~~~~~~~~ |
|---|
| 98 | evol_orbit_l = .false. |
|---|
| 99 | call getin('evol_orbit',evol_orbit_l) |
|---|
| 100 | |
|---|
| 101 | pem_ini_earth_date = 0_di |
|---|
| 102 | call getin('pem_ini_earth_date',pem_ini_earth_date) |
|---|
| 103 | |
|---|
| 104 | evol_obl_l = .true. |
|---|
| 105 | call getin('evol_obl',evol_obl_l) |
|---|
| 106 | |
|---|
| 107 | evol_ecc_l = .true. |
|---|
| 108 | call getin('evol_ecc',evol_ecc_l) |
|---|
| 109 | |
|---|
| 110 | evol_lsp_l = .true. |
|---|
| 111 | call getin('evol_lsp',evol_lsp_l) |
|---|
| 112 | |
|---|
| 113 | dt_l = 1._dp |
|---|
| 114 | call getin('dt',dt_l) |
|---|
| 115 | |
|---|
| 116 | ! Stopping criteria |
|---|
| 117 | ! ~~~~~~~~~~~~~~~~~ |
|---|
| 118 | nmax_yr_run_l = 100000000._dp |
|---|
| 119 | call getin('nmax_yr_run',nmax_yr_run_l) |
|---|
| 120 | |
|---|
| 121 | h2oice_crit_l = 0.2_dp |
|---|
| 122 | call getin('h2oice_crit',h2oice_crit_l) |
|---|
| 123 | |
|---|
| 124 | co2ice_crit_l = 0.2_dp |
|---|
| 125 | call getin('co2ice_crit',co2ice_crit_l) |
|---|
| 126 | |
|---|
| 127 | ps_crit_l = 0.15_dp |
|---|
| 128 | call getin('ps_crit',ps_crit_l) |
|---|
| 129 | |
|---|
| 130 | max_change_obl_l = 1._dp |
|---|
| 131 | call getin('max_change_obl',max_change_obl_l) |
|---|
| 132 | |
|---|
| 133 | max_change_ecc_l = 5.e-3_dp |
|---|
| 134 | call getin('max_change_ecc',max_change_ecc_l) |
|---|
| 135 | |
|---|
| 136 | max_change_lsp_l = 20._dp |
|---|
| 137 | call getin('max_change_lsp',max_change_lsp_l) |
|---|
| 138 | |
|---|
| 139 | ! Subsurface |
|---|
| 140 | ! ~~~~~~~~~~ |
|---|
| 141 | do_soil_l = .true. |
|---|
| 142 | call getin('do_soil',do_soil_l) |
|---|
| 143 | |
|---|
| 144 | do_sorption_l = .false. |
|---|
| 145 | call getin('do_sorption',do_sorption_l) |
|---|
| 146 | |
|---|
| 147 | reg_thprop_dependp_l = .false. |
|---|
| 148 | call getin('reg_thprop_dependp',reg_thprop_dependp_l) |
|---|
| 149 | |
|---|
| 150 | flux_geo_l = 0._dp |
|---|
| 151 | call getin('flux_geo',flux_geo_l) |
|---|
| 152 | |
|---|
| 153 | depth_breccia_l = 10._dp |
|---|
| 154 | call getin('depth_breccia',depth_breccia_l) |
|---|
| 155 | |
|---|
| 156 | depth_bedrock_l = 1000._dp |
|---|
| 157 | call getin('depth_bedrock',depth_bedrock_l) |
|---|
| 158 | |
|---|
| 159 | icetable_equilibrium_l = .true. |
|---|
| 160 | call getin('icetable_equilibrium',icetable_equilibrium_l) |
|---|
| 161 | |
|---|
| 162 | icetable_dynamic_l = .false. |
|---|
| 163 | call getin('icetable_dynamic',icetable_dynamic_l) |
|---|
| 164 | |
|---|
| 165 | ! Ice management |
|---|
| 166 | ! ~~~~~~~~~~~~~~ |
|---|
| 167 | h2oice_huge_ini_l = 9200._dp ! [kg/m^2]; Default = 10 m |
|---|
| 168 | call getin('h2oice_huge_ini',h2oice_huge_ini_l) |
|---|
| 169 | |
|---|
| 170 | threshold_h2oice_cap_l = 460._dp ! kg.m-2 (= 0.5 m) |
|---|
| 171 | call getin('threshold_h2oice_cap',threshold_h2oice_cap_l) |
|---|
| 172 | |
|---|
| 173 | h2oice_flow_l = .true. |
|---|
| 174 | call getin('h2oice_flow',h2oice_flow_l) |
|---|
| 175 | |
|---|
| 176 | co2ice_flow_l = .true. |
|---|
| 177 | call getin('co2ice_flow',co2ice_flow_l) |
|---|
| 178 | |
|---|
| 179 | ! Layering |
|---|
| 180 | ! ~~~~~~~~ |
|---|
| 181 | do_layering_l = .false. |
|---|
| 182 | call getin('do_layering',do_layering_l) |
|---|
| 183 | |
|---|
| 184 | d_dust_l = 5.78e-2_dp ! kg.m-2.y-1 (= 1.e-9 kg.m-2.s-1) |
|---|
| 185 | call getin('d_dust',d_dust_l) |
|---|
| 186 | |
|---|
| 187 | impose_dust_ratio_l = .false. |
|---|
| 188 | call getin('impose_dust_ratio',impose_dust_ratio_l) |
|---|
| 189 | |
|---|
| 190 | dust2ice_ratio_l = 0.01_dp |
|---|
| 191 | call getin('dust2ice_ratio',dust2ice_ratio_l) |
|---|
| 192 | |
|---|
| 193 | ! Setters |
|---|
| 194 | call set_output_config(output_rate_l) |
|---|
| 195 | call set_orbit_config(evol_orbit_l,evol_obl_l,evol_ecc_l,evol_lsp_l,max_change_obl_l,max_change_ecc_l,max_change_lsp_l) |
|---|
| 196 | call set_evolution_config(pem_ini_earth_date,dt_l,nmax_yr_run_l) |
|---|
| 197 | call set_stopping_crit_config(h2oice_crit_l,co2ice_crit_l,ps_crit_l) |
|---|
| 198 | call set_soil_config(do_soil_l,reg_thprop_dependp_l,flux_geo_l,depth_breccia_l,depth_bedrock_l) |
|---|
| 199 | call set_sorption_config(do_sorption_l) |
|---|
| 200 | call set_ice_table_config(icetable_equilibrium_l,icetable_dynamic_l) |
|---|
| 201 | call set_surf_ice_config(threshold_h2oice_cap_l,h2oice_huge_ini_l) |
|---|
| 202 | call set_glaciers_config(h2oice_flow_l,co2ice_flow_l) |
|---|
| 203 | call set_layered_deposits_config(do_layering_l,impose_dust_ratio_l,d_dust_l,dust2ice_ratio_l) |
|---|
| 204 | |
|---|
| 205 | ! Read "run_pcm.def" parameters |
|---|
| 206 | hybrid = .true. ! Default |
|---|
| 207 | call get_hybrid(hybrid) |
|---|
| 208 | call set_atmosphere_config(hybrid) |
|---|
| 209 | |
|---|
| 210 | ! Check incompatibilities |
|---|
| 211 | call check_config_incompatibility() |
|---|
| 212 | |
|---|
| 213 | END SUBROUTINE read_rundef |
|---|
| 214 | !======================================================================= |
|---|
| 215 | |
|---|
| 216 | !======================================================================= |
|---|
| 217 | SUBROUTINE check_config_incompatibility() |
|---|
| 218 | !----------------------------------------------------------------------- |
|---|
| 219 | ! NAME |
|---|
| 220 | ! check_config_incompatibility |
|---|
| 221 | ! |
|---|
| 222 | ! DESCRIPTION |
|---|
| 223 | ! Check incompatibilities in the PEM runtime configuration. |
|---|
| 224 | ! |
|---|
| 225 | ! AUTHORS & DATE |
|---|
| 226 | ! JB Clement, 02/2026 |
|---|
| 227 | ! |
|---|
| 228 | ! NOTES |
|---|
| 229 | ! |
|---|
| 230 | !----------------------------------------------------------------------- |
|---|
| 231 | |
|---|
| 232 | ! DEPENDENCIES |
|---|
| 233 | ! ------------ |
|---|
| 234 | use stoppage, only: stop_clean |
|---|
| 235 | use soil, only: do_soil, reg_thprop_dependp, flux_geo |
|---|
| 236 | use sorption, only: do_sorption |
|---|
| 237 | use orbit, only: evol_orbit |
|---|
| 238 | use evolution, only: pem_ini_date |
|---|
| 239 | use ice_table, only: icetable_equilibrium, icetable_dynamic |
|---|
| 240 | use display, only: print_msg |
|---|
| 241 | |
|---|
| 242 | ! DECLARATION |
|---|
| 243 | ! ----------- |
|---|
| 244 | implicit none |
|---|
| 245 | |
|---|
| 246 | ! CODE |
|---|
| 247 | ! ---- |
|---|
| 248 | ! Warnings (possible incompatibilities) |
|---|
| 249 | if (evol_orbit .and. abs(pem_ini_date) < minieps) call print_msg('Warning: evol_orbit = .true. but the initial date of the PEM is set to 0!') |
|---|
| 250 | |
|---|
| 251 | ! Errors (true incompatibilities) |
|---|
| 252 | if (.not. do_soil) then |
|---|
| 253 | if (icetable_equilibrium .or. icetable_dynamic) call stop_clean(__FILE__,__LINE__,'ice table must be used when do_soil = true!',1) |
|---|
| 254 | if (abs(flux_geo) > minieps) call stop_clean(__FILE__,__LINE__,'soil is not activated but flux_geo /= 0!',1) |
|---|
| 255 | if (reg_thprop_dependp) call stop_clean(__FILE__,__LINE__,'regolith properties vary according to Ps only when soil = true!',1) |
|---|
| 256 | if (do_sorption) call stop_clean(__FILE__,__LINE__,'do_soil must be true when do_sorption = true!',1) |
|---|
| 257 | end if |
|---|
| 258 | |
|---|
| 259 | END SUBROUTINE check_config_incompatibility |
|---|
| 260 | !======================================================================= |
|---|
| 261 | |
|---|
| 262 | !======================================================================= |
|---|
| 263 | SUBROUTINE read_callphys() |
|---|
| 264 | !----------------------------------------------------------------------- |
|---|
| 265 | ! NAME |
|---|
| 266 | ! read_callphys |
|---|
| 267 | ! |
|---|
| 268 | ! DESCRIPTION |
|---|
| 269 | ! Read physics runtime configuration from getin keys, then set |
|---|
| 270 | ! module-scoped parameters accordingly. |
|---|
| 271 | ! |
|---|
| 272 | ! AUTHORS & DATE |
|---|
| 273 | ! JB Clement, 01/2026 |
|---|
| 274 | ! |
|---|
| 275 | ! NOTES |
|---|
| 276 | ! To work, it needs that "run_pem.def" hols a line with |
|---|
| 277 | ! "INCLUDEDEF=callphys.def". |
|---|
| 278 | !----------------------------------------------------------------------- |
|---|
| 279 | |
|---|
| 280 | ! DEPENDENCIES |
|---|
| 281 | ! ------------ |
|---|
| 282 | #ifdef CPP_IOIPSL |
|---|
| 283 | use IOIPSL, only: getin |
|---|
| 284 | #else |
|---|
| 285 | ! If not using IOIPSL, we still need to use (a local version of) getin |
|---|
| 286 | use ioipsl_getincom, only: getin |
|---|
| 287 | #endif |
|---|
| 288 | use atmosphere, only: CO2cond_ps_PCM |
|---|
| 289 | use stoppage, only: stop_clean |
|---|
| 290 | use display, only: print_msg |
|---|
| 291 | |
|---|
| 292 | ! DECLARATION |
|---|
| 293 | ! ----------- |
|---|
| 294 | implicit none |
|---|
| 295 | |
|---|
| 296 | ! LOCAL VARIABLES |
|---|
| 297 | ! --------------- |
|---|
| 298 | logical(k4) :: here |
|---|
| 299 | |
|---|
| 300 | ! CODE |
|---|
| 301 | ! ---- |
|---|
| 302 | inquire(file = callphys_name,exist = here) |
|---|
| 303 | if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//callphys_name//'"!',1) |
|---|
| 304 | call print_msg('> Reading "'//callphys_name//'"') |
|---|
| 305 | |
|---|
| 306 | CO2cond_ps_PCM = 1._dp ! Default value |
|---|
| 307 | call getin("CO2cond_ps",CO2cond_ps_PCM) |
|---|
| 308 | if (CO2cond_ps_PCM < 0._dp .or. CO2cond_ps_PCM > 1._dp) call stop_clean(__FILE__,__LINE__,'Value for ''CO2cond_ps'' is not between 0 and 1. Please, specify a correct value in "'//callphys_name//'"!',1) |
|---|
| 309 | |
|---|
| 310 | END SUBROUTINE read_callphys |
|---|
| 311 | !======================================================================= |
|---|
| 312 | |
|---|
| 313 | !======================================================================= |
|---|
| 314 | SUBROUTINE get_hybrid(hybrid) |
|---|
| 315 | !----------------------------------------------------------------------- |
|---|
| 316 | ! NAME |
|---|
| 317 | ! get_hybrid |
|---|
| 318 | ! |
|---|
| 319 | ! DESCRIPTION |
|---|
| 320 | ! Get the key definition in "run_pcm.def". |
|---|
| 321 | ! |
|---|
| 322 | ! AUTHORS & DATE |
|---|
| 323 | ! JB Clement, 12/2025 |
|---|
| 324 | ! |
|---|
| 325 | ! NOTES |
|---|
| 326 | ! |
|---|
| 327 | !----------------------------------------------------------------------- |
|---|
| 328 | |
|---|
| 329 | ! DEPENDENCIES |
|---|
| 330 | ! ------------ |
|---|
| 331 | use stoppage, only: stop_clean |
|---|
| 332 | use display, only: print_msg |
|---|
| 333 | use utility, only: bool2str |
|---|
| 334 | |
|---|
| 335 | ! DECLARATION |
|---|
| 336 | ! ----------- |
|---|
| 337 | implicit none |
|---|
| 338 | |
|---|
| 339 | ! ARGUMENTS |
|---|
| 340 | ! --------- |
|---|
| 341 | logical(k4), intent(inout) :: hybrid |
|---|
| 342 | |
|---|
| 343 | ! LOCAL VARIABLES |
|---|
| 344 | ! --------------- |
|---|
| 345 | integer(di) :: ierr, funit, eq_pos |
|---|
| 346 | logical(k4) :: here, found, hybrid_in |
|---|
| 347 | character(256) :: line |
|---|
| 348 | character(128) :: key, res |
|---|
| 349 | |
|---|
| 350 | ! CODE |
|---|
| 351 | ! ---- |
|---|
| 352 | inquire(file = runPCMdef_name,exist = here) |
|---|
| 353 | if (.not. here) call stop_clean(__FILE__,__LINE__,'cannot find required file "'//runPCMdef_name//'"!',1) |
|---|
| 354 | call print_msg('> Reading "'//runPCMdef_name//'"') |
|---|
| 355 | open(newunit = funit,file = runPCMdef_name,status = 'old',form = 'formatted',action = 'read',iostat = ierr) |
|---|
| 356 | if (ierr /= 0) call stop_clean(__FILE__,__LINE__,'error opening file "'//runPCMdef_name//'"!',ierr) |
|---|
| 357 | |
|---|
| 358 | found = .false. |
|---|
| 359 | hybrid_in = hybrid |
|---|
| 360 | do |
|---|
| 361 | ! Read the line |
|---|
| 362 | read(funit,'(a)',iostat = ierr) line |
|---|
| 363 | if (ierr /= 0) exit |
|---|
| 364 | |
|---|
| 365 | ! Skip empty lines and comments |
|---|
| 366 | if (trim(line) == '') cycle |
|---|
| 367 | if (line(1:1) == '#' .or. line(1:1) == '!') cycle |
|---|
| 368 | |
|---|
| 369 | ! Get the position of equal sign |
|---|
| 370 | eq_pos = index(line,'=') |
|---|
| 371 | if (eq_pos == 0) cycle |
|---|
| 372 | |
|---|
| 373 | ! Get the key and its value/result |
|---|
| 374 | key = adjustl(trim(line(:eq_pos - 1))) |
|---|
| 375 | res = adjustl(trim(line(eq_pos + 1:))) |
|---|
| 376 | |
|---|
| 377 | ! Check the key |
|---|
| 378 | if (trim(key) == 'hybrid') then |
|---|
| 379 | read(res,*,iostat = ierr) hybrid |
|---|
| 380 | if (ierr == 0) found = .true. |
|---|
| 381 | exit |
|---|
| 382 | end if |
|---|
| 383 | end do |
|---|
| 384 | |
|---|
| 385 | close(funit) |
|---|
| 386 | |
|---|
| 387 | if (.not. found) call print_msg('Warning: key ''hybrid'' not found in the file "'//runPCMdef_name//'"!') |
|---|
| 388 | if (hybrid .eqv. hybrid_in) call print_msg('USING DEFAULTS : hybrid = '//bool2str(hybrid_in)) |
|---|
| 389 | |
|---|
| 390 | END SUBROUTINE get_hybrid |
|---|
| 391 | !======================================================================= |
|---|
| 392 | |
|---|
| 393 | !======================================================================= |
|---|
| 394 | SUBROUTINE read_controldata() |
|---|
| 395 | !----------------------------------------------------------------------- |
|---|
| 396 | ! NAME |
|---|
| 397 | ! read_controldata |
|---|
| 398 | ! |
|---|
| 399 | ! DESCRIPTION |
|---|
| 400 | ! Read 'controle' data in "startfi.nc". |
|---|
| 401 | ! |
|---|
| 402 | ! AUTHORS & DATE |
|---|
| 403 | ! JB Clement, 01/2026 |
|---|
| 404 | ! |
|---|
| 405 | ! NOTES |
|---|
| 406 | ! |
|---|
| 407 | !----------------------------------------------------------------------- |
|---|
| 408 | |
|---|
| 409 | ! DEPENDENCIES |
|---|
| 410 | ! ------------ |
|---|
| 411 | use io_netcdf, only: open_nc, close_nc, startfi_name, get_dim_nc, get_var_nc |
|---|
| 412 | use physics, only: init_physics |
|---|
| 413 | use orbit, only: init_orbit |
|---|
| 414 | use soil, only: volcapa |
|---|
| 415 | use stoppage, only: stop_clean |
|---|
| 416 | use display, only: print_msg |
|---|
| 417 | |
|---|
| 418 | ! DECLARATION |
|---|
| 419 | ! ----------- |
|---|
| 420 | implicit none |
|---|
| 421 | |
|---|
| 422 | ! LOCAL VARIABLES |
|---|
| 423 | ! --------------- |
|---|
| 424 | integer(di) :: nindex ! Size of dimension 'index' |
|---|
| 425 | real(dp), dimension(:), allocatable :: controle |
|---|
| 426 | |
|---|
| 427 | ! CODE |
|---|
| 428 | ! ---- |
|---|
| 429 | call print_msg('> Reading control data ("'//startfi_name//'")') |
|---|
| 430 | ! Open the "startfi.nc" file |
|---|
| 431 | call open_nc(startfi_name,'read') |
|---|
| 432 | |
|---|
| 433 | ! Get the dimension size of 'index' |
|---|
| 434 | call get_dim_nc('index',nindex) |
|---|
| 435 | |
|---|
| 436 | ! Get 'controle' |
|---|
| 437 | allocate(controle(nindex)) |
|---|
| 438 | call get_var_nc('controle',controle) |
|---|
| 439 | |
|---|
| 440 | ! Close the file |
|---|
| 441 | call close_nc(startfi_name) |
|---|
| 442 | |
|---|
| 443 | ! Initialize physical data |
|---|
| 444 | ! Arguments order: rad, g, mugaz, rcp |
|---|
| 445 | call print_msg(' > Initializing physical constants') |
|---|
| 446 | call init_physics(controle(5),controle(7),controle(8),controle(9)) |
|---|
| 447 | |
|---|
| 448 | ! Initialize soil data |
|---|
| 449 | call print_msg(' > Initializing soil parameters') |
|---|
| 450 | volcapa = controle(35) |
|---|
| 451 | if (abs(volcapa) < minieps) call stop_clean(__FILE__,__LINE__,'volcapa is 0 in "'//startfi_name//'"!',1) |
|---|
| 452 | |
|---|
| 453 | ! Initialize orbital data |
|---|
| 454 | ! Arguments order: Obliquity, Perihelion, Aphelion, Date of perihelion, Year length, Sol length |
|---|
| 455 | call print_msg(' > Initializing orbital characteristics of the planet') |
|---|
| 456 | call init_orbit(controle(18),controle(15),controle(16),controle(17),controle(14),controle(10)) |
|---|
| 457 | |
|---|
| 458 | deallocate(controle) |
|---|
| 459 | |
|---|
| 460 | END SUBROUTINE read_controldata |
|---|
| 461 | !======================================================================= |
|---|
| 462 | |
|---|
| 463 | END MODULE config |
|---|