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 | !======================================================================= |
---|
13 | contains |
---|
14 | !======================================================================= |
---|
15 | |
---|
16 | SUBROUTINE conf_pem(i_myear,n_myears) |
---|
17 | |
---|
18 | #ifdef CPP_IOIPSL |
---|
19 | use IOIPSL, only: getin |
---|
20 | #else |
---|
21 | ! if not using IOIPSL, we still need to use (a local version of) getin |
---|
22 | use ioipsl_getincom, only: getin |
---|
23 | #endif |
---|
24 | |
---|
25 | use time_evol_mod, only: year_bp_ini, dt, h2o_ice_crit, co2_ice_crit, ps_criterion, Max_iter_pem, & |
---|
26 | evol_orbit_pem, var_obl, var_ecc, var_lsp, convert_years, ecritpem |
---|
27 | use comsoil_h_pem, only: soil_pem, fluxgeo, ini_huge_h2oice, depth_breccia, depth_bedrock, reg_thprop_dependp |
---|
28 | use adsorption_mod, only: adsorption_pem |
---|
29 | use glaciers_mod, only: h2oice_flow, co2ice_flow, inf_h2oice_threshold, metam_co2ice_threshold, metam_h2oice_threshold, metam_h2oice, metam_co2ice |
---|
30 | use ice_table_mod, only: icetable_equilibrium, icetable_dynamic |
---|
31 | use layering_mod, only: layering_algo |
---|
32 | use info_PEM_mod, only: iPCM, iPEM, nPCM, nPCM_ini |
---|
33 | |
---|
34 | implicit none |
---|
35 | |
---|
36 | real, intent(out) :: i_myear, n_myears ! Current simulated Martian year and maximum number of Martian years to be simulated |
---|
37 | |
---|
38 | character(20), parameter :: modname ='conf_pem' |
---|
39 | integer :: ierr |
---|
40 | integer :: year_earth_bp_ini ! Initial year (in Earth years) of the simulation of the PEM defined in run.def |
---|
41 | |
---|
42 | !PEM parameters |
---|
43 | |
---|
44 | ! #---------- Martian years parameters from launching script |
---|
45 | open(100,file = 'info_PEM.txt',status = 'old',form = 'formatted',iostat = ierr) |
---|
46 | if (ierr /= 0) then |
---|
47 | write(*,*) 'Cannot find required file "info_PEM.txt"!' |
---|
48 | write(*,*) 'It should be created by the launching script...' |
---|
49 | stop |
---|
50 | else |
---|
51 | read(100,*) i_myear, n_myears, convert_years, iPCM, iPEM, nPCM, nPCM_ini |
---|
52 | endif |
---|
53 | close(100) |
---|
54 | |
---|
55 | !#---------- Output parameters ----------# |
---|
56 | ! Frequency of outputs for the PEM |
---|
57 | ecritpem = 1 ! Default value: every year |
---|
58 | call getin('ecritpem',ecritpem) |
---|
59 | |
---|
60 | !#---------- Orbital parameters ----------# |
---|
61 | evol_orbit_pem = .false. |
---|
62 | call getin('evol_orbit_pem',evol_orbit_pem) |
---|
63 | |
---|
64 | year_earth_bp_ini = 0. |
---|
65 | call getin('year_earth_bp_ini',year_earth_bp_ini) |
---|
66 | year_bp_ini = year_earth_bp_ini/convert_years |
---|
67 | |
---|
68 | var_obl = .true. |
---|
69 | call getin('var_obl',var_obl) |
---|
70 | write(*,*) 'Does obliquity vary?',var_obl |
---|
71 | |
---|
72 | var_ecc = .true. |
---|
73 | call getin('var_ecc',var_ecc) |
---|
74 | write(*,*) 'Does eccentricity vary?',var_ecc |
---|
75 | |
---|
76 | var_lsp = .true. |
---|
77 | call getin('var_lsp',var_lsp) |
---|
78 | write(*,*) 'Does Ls peri vary?',var_lsp |
---|
79 | |
---|
80 | !#---------- Stopping criteria parameters ----------# |
---|
81 | Max_iter_pem = 100000000 |
---|
82 | call getin('Max_iter_pem',Max_iter_pem) |
---|
83 | write(*,*) 'Max_iter_pem =',Max_iter_pem |
---|
84 | |
---|
85 | h2o_ice_crit = 0.2 |
---|
86 | call getin('h2o_ice_crit',h2o_ice_crit) |
---|
87 | write(*,*) 'h2o_ice_crit =',h2o_ice_crit |
---|
88 | |
---|
89 | co2_ice_crit = 0.2 |
---|
90 | call getin('co2_ice_crit',co2_ice_crit) |
---|
91 | write(*,*) 'co2_ice_crit =',co2_ice_crit |
---|
92 | |
---|
93 | ps_criterion = 0.15 |
---|
94 | call getin('ps_criterion',ps_criterion) |
---|
95 | write(*,*) 'ps_criterion =',ps_criterion |
---|
96 | |
---|
97 | dt = 1. |
---|
98 | call getin('dt',dt) |
---|
99 | |
---|
100 | !#---------- Subsurface parameters ----------# |
---|
101 | soil_pem = .true. |
---|
102 | call getin('soil_pem',soil_pem) |
---|
103 | |
---|
104 | adsorption_pem = .false. |
---|
105 | call getin('adsorption_pem',adsorption_pem) |
---|
106 | |
---|
107 | reg_thprop_dependp = .false. |
---|
108 | call getin('reg_thprop_dependp',reg_thprop_dependp) |
---|
109 | write(*,*) 'Thermal properties of the regolith vary with pressure ?', reg_thprop_dependp |
---|
110 | |
---|
111 | fluxgeo = 0. |
---|
112 | call getin('fluxgeo',fluxgeo) |
---|
113 | write(*,*) 'Flux Geothermal is set to',fluxgeo |
---|
114 | |
---|
115 | depth_breccia = 10. |
---|
116 | call getin('depth_breccia',depth_breccia) |
---|
117 | write(*,*) 'Depth of breccia is set to',depth_breccia |
---|
118 | |
---|
119 | depth_bedrock = 1000. |
---|
120 | call getin('depth_bedrock',depth_bedrock) |
---|
121 | write(*,*) 'Depth of bedrock is set to',depth_bedrock |
---|
122 | |
---|
123 | icetable_equilibrium = .true. |
---|
124 | call getin('icetable_equilibrium',icetable_equilibrium) |
---|
125 | write(*,*) 'Is the ice table computed at equilibrium?', icetable_equilibrium |
---|
126 | |
---|
127 | icetable_dynamic = .false. |
---|
128 | call getin('icetable_dynamic',icetable_dynamic) |
---|
129 | write(*,*) 'Is the ice table computed with the dynamic method?', icetable_dynamic |
---|
130 | if ((.not. soil_pem) .and. (icetable_equilibrium .or. icetable_dynamic)) then |
---|
131 | write(*,*) 'Ice table (equilibrium or dynamic method) must be used when soil_pem = T' |
---|
132 | call abort_physic(modname,"Ice table must be used when soil_pem = T",1) |
---|
133 | endif |
---|
134 | if (icetable_equilibrium .and. icetable_dynamic) then |
---|
135 | write(*,*) 'Ice table is asked to be computed both by the equilibrium and dynamic method.' |
---|
136 | write(*,*) 'The dynamic method is then chosen.' |
---|
137 | icetable_equilibrium = .false. |
---|
138 | endif |
---|
139 | |
---|
140 | if ((.not. soil_pem) .and. adsorption_pem) then |
---|
141 | write(*,*) 'Adsorption must be used when soil_pem = T' |
---|
142 | call abort_physic(modname,"Adsorption must be used when soil_pem = T",1) |
---|
143 | endif |
---|
144 | |
---|
145 | if ((.not. soil_pem) .and. (fluxgeo > 0.)) then |
---|
146 | write(*,*) 'Soil is not activated but Flux Geo > 0.' |
---|
147 | call abort_physic(modname,"Soil is not activated but Flux Geo > 0.",1) |
---|
148 | endif |
---|
149 | |
---|
150 | if ((.not. soil_pem) .and. reg_thprop_dependp) then |
---|
151 | write(*,*) 'Regolith properties vary with Ps only when soil is set to true' |
---|
152 | call abort_physic(modname,'Regolith properties vary with Ps only when soil is set to true',1) |
---|
153 | endif |
---|
154 | |
---|
155 | if (evol_orbit_pem .and. abs(year_bp_ini) < 1.e-10) then |
---|
156 | write(*,*) 'You want to follow the file "obl_ecc_lsp.asc" for changing orbital parameters,' |
---|
157 | write(*,*) 'but you did not specify from which year to start.' |
---|
158 | call abort_physic(modname,"evol_orbit_pem=.true. but year_bp_ini = 0",1) |
---|
159 | endif |
---|
160 | |
---|
161 | !#---------- Ice management parameters ----------# |
---|
162 | ini_huge_h2oice = 9200. ! kg.m-2 (= 10 m) |
---|
163 | call getin('ini_huge_h2oice',ini_huge_h2oice) |
---|
164 | |
---|
165 | inf_h2oice_threshold = 460. ! kg.m-2 (= 0.5 m) |
---|
166 | call getin('inf_h2oice_threshold',inf_h2oice_threshold) |
---|
167 | |
---|
168 | metam_h2oice = .false. |
---|
169 | call getin('metam_h2oice',metam_h2oice) |
---|
170 | |
---|
171 | metam_h2oice_threshold = 460. ! kg.m-2 (= 0.5 m) |
---|
172 | call getin('metam_h2oice_threshold',metam_h2oice_threshold) |
---|
173 | |
---|
174 | h2oice_flow = .true. |
---|
175 | call getin('h2oice_flow',h2oice_flow) |
---|
176 | |
---|
177 | metam_co2ice = .false. |
---|
178 | call getin('metam_co2ice',metam_co2ice) |
---|
179 | |
---|
180 | metam_co2ice_threshold = 16500. ! kg.m-2 (= 10 m) |
---|
181 | call getin('metam_co2ice_threshold',metam_co2ice_threshold) |
---|
182 | |
---|
183 | co2ice_flow = .true. |
---|
184 | call getin('co2ice_flow',co2ice_flow) |
---|
185 | |
---|
186 | !#---------- Layering parameters ----------# |
---|
187 | layering_algo = .false. |
---|
188 | call getin('layering',layering_algo) |
---|
189 | |
---|
190 | END SUBROUTINE conf_pem |
---|
191 | |
---|
192 | END MODULE conf_pem_mod |
---|