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