| 1 | MODULE conf_pem_mod |
|---|
| 2 | |
|---|
| 3 | !======================================================================= |
|---|
| 4 | ! |
|---|
| 5 | ! Purpose: Read the parameter for a PEM run in run_pem.def |
|---|
| 6 | ! |
|---|
| 7 | ! Author: RV, JBC |
|---|
| 8 | !======================================================================= |
|---|
| 9 | |
|---|
| 10 | IMPLICIT NONE |
|---|
| 11 | |
|---|
| 12 | CONTAINS |
|---|
| 13 | |
|---|
| 14 | SUBROUTINE conf_pem(i_myear,n_myears) |
|---|
| 15 | |
|---|
| 16 | #ifdef CPP_IOIPSL |
|---|
| 17 | use IOIPSL, only: getin |
|---|
| 18 | #else |
|---|
| 19 | ! if not using IOIPSL, we still need to use (a local version of) getin |
|---|
| 20 | use ioipsl_getincom, only: getin |
|---|
| 21 | #endif |
|---|
| 22 | |
|---|
| 23 | use time_evol_mod, only: year_bp_ini, dt_pem, water_ice_criterion, co2_ice_criterion, ps_criterion, Max_iter_pem, & |
|---|
| 24 | evol_orbit_pem, var_obl, var_ecc, var_lsp, convert_years |
|---|
| 25 | use comsoil_h_pem, only: soil_pem, fluxgeo, water_reservoir_nom, depth_breccia, depth_bedrock, reg_thprop_dependp |
|---|
| 26 | use adsorption_mod, only: adsorption_pem |
|---|
| 27 | use glaciers_mod, only: co2glaciersflow, h2oglaciersflow |
|---|
| 28 | use ice_table_mod, only: icetable_equilibrium, icetable_dynamic |
|---|
| 29 | |
|---|
| 30 | integer, intent(out) :: i_myear, n_myears ! Current simulated Martian year and maximum number of Martian years to be simulated |
|---|
| 31 | |
|---|
| 32 | character(len=20), parameter :: modname ='conf_pem' |
|---|
| 33 | integer :: ierr |
|---|
| 34 | integer :: year_earth_bp_ini ! Initial year (in Earth years) of the simulation of the PEM defined in run.def |
|---|
| 35 | |
|---|
| 36 | !PEM parameters |
|---|
| 37 | |
|---|
| 38 | ! #---------- Martian years parameters from launching script |
|---|
| 39 | open(100,file = 'tmp_PEMyears.txt',status = 'old',form = 'formatted',iostat = ierr) |
|---|
| 40 | if (ierr /= 0) then |
|---|
| 41 | write(*,*) 'Cannot find required file "tmp_PEMyears.txt"!' |
|---|
| 42 | write(*,*) 'It should be created by the launching script...' |
|---|
| 43 | stop |
|---|
| 44 | else |
|---|
| 45 | read(100,*) i_myear, n_myears, convert_years |
|---|
| 46 | endif |
|---|
| 47 | close(100) |
|---|
| 48 | |
|---|
| 49 | ! #---------- Orbital parameters |
|---|
| 50 | evol_orbit_pem=.false. |
|---|
| 51 | call getin('evol_orbit_pem',evol_orbit_pem) |
|---|
| 52 | |
|---|
| 53 | year_bp_ini = 0. |
|---|
| 54 | call getin('year_earth_bp_ini',year_earth_bp_ini) |
|---|
| 55 | year_bp_ini = year_earth_bp_ini/convert_years |
|---|
| 56 | |
|---|
| 57 | var_obl = .true. |
|---|
| 58 | call getin('var_obl',var_obl) |
|---|
| 59 | write(*,*) 'Does obliquity vary ?',var_obl |
|---|
| 60 | |
|---|
| 61 | var_ecc = .true. |
|---|
| 62 | call getin('var_ecc',var_ecc) |
|---|
| 63 | write(*,*) 'Does excentricity vary ?',var_ecc |
|---|
| 64 | |
|---|
| 65 | var_lsp = .true. |
|---|
| 66 | call getin('var_lsp',var_lsp) |
|---|
| 67 | write(*,*) 'Does Ls peri vary ?',var_lsp |
|---|
| 68 | |
|---|
| 69 | ! #---------- Stopping criteria parameters |
|---|
| 70 | Max_iter_pem=100000000 |
|---|
| 71 | call getin('Max_iter_pem', Max_iter_pem) |
|---|
| 72 | |
|---|
| 73 | water_ice_criterion=0.2 |
|---|
| 74 | call getin('water_ice_criterion', water_ice_criterion) |
|---|
| 75 | |
|---|
| 76 | co2_ice_criterion=0.2 |
|---|
| 77 | call getin('co2_ice_criterion', co2_ice_criterion) |
|---|
| 78 | |
|---|
| 79 | ps_criterion = 0.15 |
|---|
| 80 | call getin('ps_criterion',ps_criterion) |
|---|
| 81 | |
|---|
| 82 | dt_pem=1 |
|---|
| 83 | call getin('dt_pem', dt_pem) |
|---|
| 84 | |
|---|
| 85 | ! #---------- Subsurface parameters |
|---|
| 86 | soil_pem=.true. |
|---|
| 87 | call getin('soil_pem', soil_pem) |
|---|
| 88 | |
|---|
| 89 | adsorption_pem = .true. |
|---|
| 90 | call getin('adsorption_pem',adsorption_pem) |
|---|
| 91 | |
|---|
| 92 | co2glaciersflow = .true. |
|---|
| 93 | call getin('co2glaciersflow', co2glaciersflow) |
|---|
| 94 | |
|---|
| 95 | h2oglaciersflow = .true. |
|---|
| 96 | call getin('h2oglaciersflow', h2oglaciersflow) |
|---|
| 97 | |
|---|
| 98 | reg_thprop_dependp = .false. |
|---|
| 99 | call getin('reg_thprop_dependp',reg_thprop_dependp) |
|---|
| 100 | write(*,*) 'Thermal properties of the regolith vary with pressure ?', reg_thprop_dependp |
|---|
| 101 | |
|---|
| 102 | ! #---------- Layering parameters |
|---|
| 103 | fluxgeo = 0. |
|---|
| 104 | call getin('fluxgeo',fluxgeo) |
|---|
| 105 | write(*,*) 'Flux Geothermal is set to',fluxgeo |
|---|
| 106 | |
|---|
| 107 | depth_breccia = 10. |
|---|
| 108 | call getin('depth_breccia',depth_breccia) |
|---|
| 109 | write(*,*) 'Depth of breccia is set to',depth_breccia |
|---|
| 110 | |
|---|
| 111 | depth_bedrock = 1000. |
|---|
| 112 | call getin('depth_bedrock',depth_bedrock) |
|---|
| 113 | write(*,*) 'Depth of bedrock is set to',depth_bedrock |
|---|
| 114 | |
|---|
| 115 | icetable_equilibrium = .true. |
|---|
| 116 | call getin('icetable_equilibrium',icetable_equilibrium) |
|---|
| 117 | write(*,*) 'Is the ice table computed at equilibrium?', icetable_equilibrium |
|---|
| 118 | |
|---|
| 119 | icetable_dynamic = .false. |
|---|
| 120 | call getin('icetable_dynamic',icetable_dynamic) |
|---|
| 121 | write(*,*) 'Is the ice table computed with the dynamic method?', icetable_dynamic |
|---|
| 122 | if ((.not.soil_pem).and.((icetable_equilibrium).or.(icetable_dynamic))) then |
|---|
| 123 | write(*,*) 'Ice table must be used when soil_pem = T' |
|---|
| 124 | call abort_physic(modname,"Ice table must be used when soil_pem = T",1) |
|---|
| 125 | endif |
|---|
| 126 | |
|---|
| 127 | if ((.not.soil_pem).and.adsorption_pem) then |
|---|
| 128 | write(*,*) 'Adsorption must be used when soil_pem = T' |
|---|
| 129 | call abort_physic(modname,"Adsorption must be used when soil_pem = T",1) |
|---|
| 130 | endif |
|---|
| 131 | |
|---|
| 132 | if ((.not.soil_pem).and.(fluxgeo.gt.0.)) then |
|---|
| 133 | write(*,*) 'Soil is not activated but Flux Geo > 0.' |
|---|
| 134 | call abort_physic(modname,"Soil is not activated but Flux Geo > 0.",1) |
|---|
| 135 | endif |
|---|
| 136 | |
|---|
| 137 | if ((.not.soil_pem).and.reg_thprop_dependp) then |
|---|
| 138 | write(*,*) 'Regolith properties vary with Ps only when soil is set to true' |
|---|
| 139 | call abort_physic(modname,'Regolith properties vary with Ps only when soil is set to true',1) |
|---|
| 140 | endif |
|---|
| 141 | |
|---|
| 142 | if (evol_orbit_pem .and. year_bp_ini == 0.) then |
|---|
| 143 | write(*,*) 'You want to follow the file obl_ecc_lsp.asc for changing orb parameters,' |
|---|
| 144 | write(*,*) 'but you did not specify from which year to start.' |
|---|
| 145 | call abort_physic(modname,"evol_orbit_pem=.true. but year_bp_ini=0",1) |
|---|
| 146 | endif |
|---|
| 147 | |
|---|
| 148 | water_reservoir_nom = 1e4 |
|---|
| 149 | call getin('water_reservoir_nom',water_reservoir_nom) |
|---|
| 150 | |
|---|
| 151 | END SUBROUTINE conf_pem |
|---|
| 152 | |
|---|
| 153 | END MODULE conf_pem_mod |
|---|