1 | ! ================================================================================================================================= |
---|
2 | ! PROGRAM : forcesoil |
---|
3 | ! |
---|
4 | ! CONTACT : orchidee-help _at_ ipsl.jussieu.fr |
---|
5 | ! |
---|
6 | ! LICENCE : IPSL (2006). This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC |
---|
7 | ! |
---|
8 | !>\BRIEF This subroutine runs the soilcarbon submodel using specific initial conditions |
---|
9 | !! and driving variables in order to obtain soil carbon stocks closed to the steady-state values |
---|
10 | !! quicker than when using the ''full'' ORCHIDEE. |
---|
11 | !! |
---|
12 | !!\n DESCRIPTION: None |
---|
13 | !! This subroutine computes the soil carbon stocks by calling the soilcarbon routine at each time step. \n |
---|
14 | !! The aim is to obtain soil carbon stocks closed to the steady-state values and ultimately to create |
---|
15 | !! an updated stomate restart file for the stomate component. The state variables of the subsystem are the clay content |
---|
16 | !! (fixed value) and the soil carbon stocks. Initial conditions for the state variables are read in an |
---|
17 | !! input stomate restart file. Driving variables are Soil carbon input, Water and Temperature stresses on |
---|
18 | !! Organic Matter decomposition. Driving variables are read from a specific forcing file produced by a former run of ORCHIDEE |
---|
19 | !! (SECHIBA+STOMATE). \n |
---|
20 | !! The FORCESOIL program first consists in reading a set of input files, allocating variables and |
---|
21 | !! preparing output stomate restart file. \n |
---|
22 | !! Then, a loop over time is performed in which the soilcarbon routine is called at each time step. \n |
---|
23 | !! Last, final values of the soil carbon stocks are written into the output stomate restart file. \n |
---|
24 | !! No flag is associated with the use of the FORCESOIL program. \n |
---|
25 | !! |
---|
26 | !! RECENT CHANGE(S): None |
---|
27 | !! |
---|
28 | !! REFERENCE(S) : None |
---|
29 | !! |
---|
30 | !! FLOWCHART : None |
---|
31 | !! |
---|
32 | !! SVN : |
---|
33 | !! $HeadURL: $ |
---|
34 | !! $Date: $ |
---|
35 | !! $Revision: $ |
---|
36 | !! \n |
---|
37 | !_ ================================================================================================================================= |
---|
38 | |
---|
39 | PROGRAM forcesoil |
---|
40 | |
---|
41 | USE netcdf |
---|
42 | !- |
---|
43 | USE defprec |
---|
44 | USE constantes |
---|
45 | USE constantes_soil |
---|
46 | USE constantes_mtc |
---|
47 | ! USE pft_parameters |
---|
48 | USE stomate_data |
---|
49 | USE ioipsl_para |
---|
50 | USE mod_orchidee_para |
---|
51 | USE stomate_soilcarbon |
---|
52 | USE vertical_soil |
---|
53 | USE control |
---|
54 | ! USE constantes_var |
---|
55 | |
---|
56 | !- |
---|
57 | IMPLICIT NONE |
---|
58 | !- |
---|
59 | CHARACTER(LEN=80) :: sto_restname_in,sto_restname_out |
---|
60 | INTEGER(i_std) :: iim,jjm !! Indices (unitless) |
---|
61 | |
---|
62 | INTEGER(i_std),PARAMETER :: llm = 1 !! Vertical Layers (requested by restini routine) (unitless) |
---|
63 | INTEGER(i_std) :: kjpindex !! Domain size (unitless) |
---|
64 | |
---|
65 | INTEGER(i_std) :: itau_dep,itau_len !! Time step read in the restart file (?) |
---|
66 | !! and number of time steps of the simulation (unitless) |
---|
67 | CHARACTER(LEN=30) :: time_str !! Length of the simulation (year) |
---|
68 | REAL(r_std) :: dt_files !! time step between two successive itaus (?) |
---|
69 | !! (requested by restini routine) (seconds) |
---|
70 | REAL(r_std) :: date0 !! Time at which itau = 0 (requested by restini routine) (?) |
---|
71 | INTEGER(i_std) :: rest_id_sto !! ID of the input restart file (unitless) |
---|
72 | CHARACTER(LEN=20), SAVE :: thecalendar = 'noleap' !! Type of calendar defined in the input restart file |
---|
73 | !! (unitless) |
---|
74 | !- |
---|
75 | CHARACTER(LEN=100) :: Cforcing_name !! Name of the forcing file (unitless) |
---|
76 | INTEGER :: Cforcing_id !! ID of the forcing file (unitless) |
---|
77 | INTEGER :: v_id !! ID of the variable 'Index' stored in the forcing file |
---|
78 | !! (unitless) |
---|
79 | REAL(r_std) :: dt_forcesoil !! Time step at which soilcarbon routine is called (days) |
---|
80 | INTEGER :: nparan !! Number of values stored per year in the forcing file |
---|
81 | !! (unitless) |
---|
82 | INTEGER :: nbyear |
---|
83 | INTEGER(i_std),DIMENSION(:),ALLOCATABLE :: indices !! Grid Point Index used per processor (unitless) |
---|
84 | INTEGER(i_std),DIMENSION(:),ALLOCATABLE :: indices_g !! Grid Point Index for all processor (unitless) |
---|
85 | REAL(r_std),DIMENSION(:),ALLOCATABLE :: x_indices_g !! Grid Point Index for all processor (unitless) |
---|
86 | REAL(r_std),DIMENSION(:,:),ALLOCATABLE :: lon, lat !! Longitude and Latitude of each grid point defined |
---|
87 | !! in lat/lon (2D) (degrees) |
---|
88 | REAL(r_std),DIMENSION(llm) :: lev !! Number of level (requested by restini routine) (unitless) |
---|
89 | |
---|
90 | |
---|
91 | INTEGER :: i,k,j,l,m,iatt,iv,iyear !! counters (unitless) |
---|
92 | REAL(r_std) :: soil_depth !! Soil depth (m) |
---|
93 | CHARACTER(LEN=80) :: var_name |
---|
94 | CHARACTER(LEN=8000) :: taboo_vars !! string used for storing the name of the variables |
---|
95 | !! of the stomate restart file that are not automatically |
---|
96 | !! duplicated from input to output restart file (unitless) |
---|
97 | REAL(r_std),DIMENSION(1) :: xtmp !! scalar read/written in restget/restput routines (unitless) |
---|
98 | INTEGER(i_std),PARAMETER :: nbvarmax=800 !! maximum # of variables assumed in the stomate restart file |
---|
99 | !! (unitless) |
---|
100 | INTEGER(i_std) :: nbvar !! # of variables effectively present |
---|
101 | !! in the stomate restart file (unitless) |
---|
102 | CHARACTER(LEN=50),DIMENSION(nbvarmax) :: varnames !! list of the names of the variables stored |
---|
103 | !! in the stomate restart file (unitless) |
---|
104 | INTEGER(i_std) :: varnbdim !! # of dimensions of a given variable |
---|
105 | !! of the stomate restart file |
---|
106 | INTEGER(i_std),PARAMETER :: varnbdim_max=20 !! maximal # of dimensions assumed for any variable |
---|
107 | !! of the stomate restart file |
---|
108 | INTEGER,DIMENSION(varnbdim_max) :: vardims !! length of each dimension of a given variable |
---|
109 | !! of the stomate restart file |
---|
110 | LOGICAL :: l1d !! boolean : TRUE if all dimensions of a given variable |
---|
111 | !! of the stomate restart file are of length 1 (ie scalar) |
---|
112 | !! (unitless) |
---|
113 | REAL(r_std),DIMENSION(:,:),ALLOCATABLE :: var_3d !! matrix read/written in restget/restput routines (unitless) |
---|
114 | REAL(r_std) :: x_tmp !! temporary variable used to store return value |
---|
115 | !! from nf90_get_att (unitless) |
---|
116 | CHARACTER(LEN=10) :: part_str !! string suffix indicating the index of a PFT |
---|
117 | |
---|
118 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:) :: soil_ph_g !! Soil pH (0-14, pH unit) |
---|
119 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:) :: clay_g !! clay fraction (nbpglo) (unitless) |
---|
120 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:) :: bulk_dens_g !! soil bulk density (nbpglo) (g cm-3) |
---|
121 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:):: soiltile_g !! Fraction of each soil tile (0-1, unitless) |
---|
122 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:):: veget_max_g !! PFT "Maximal" coverage fraction of a PFT defined in |
---|
123 | !! the input vegetation map |
---|
124 | !! @tex $(m^2 m^{-2})$ @endtex, parallel computing |
---|
125 | REAL(r_std),DIMENSION(:,:,:,:,:,:),ALLOCATABLE :: soilcarbon_input_g !! soil carbon input (nbpglob,npool,nvm,time) |
---|
126 | !! (\f$gC m^{-2} dt_forcesoil^{-1}\f$) |
---|
127 | REAL(r_std),DIMENSION(:,:,:,:,:),ALLOCATABLE :: floodcarbon_input_g !! soil carbon input (nbpglob,npool,nvm,time) |
---|
128 | !! (\f$gC m^{-2} dt_forcesoil^{-1}\f$) |
---|
129 | REAL(r_std),DIMENSION(:,:,:,:),ALLOCATABLE :: control_temp_soil_g !! Temperature control (nbp_glo,nbdl,time) on OM decomposition |
---|
130 | !! (unitless) |
---|
131 | REAL(r_std),DIMENSION(:,:,:,:),ALLOCATABLE :: control_moist_soil_g !! Moisture control (nbp_glo,nbdl,time) on OM decomposition |
---|
132 | !! ?? Should be defined per PFT as well (unitless) |
---|
133 | REAL(r_std),DIMENSION (:,:,:), ALLOCATABLE :: moist_soil_g !! soil moisture content \f($m^3 \times m^3$)\f |
---|
134 | REAL(r_std),DIMENSION (:,:,:,:), ALLOCATABLE :: soil_mc_g !! soil moisture content per soil type \f($m^3 \times m^3$)\f |
---|
135 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:) :: floodout_g !! flux out of floodplains |
---|
136 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: wat_flux0_g !! Water flux in the first soil layers exported for soil C calculations |
---|
137 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:,:):: wat_flux_g !! Water flux in the soil layers exported for soil C calculations |
---|
138 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) ::runoff_per_soil_g !! Runoff per soil type [mm] |
---|
139 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) ::drainage_per_soil_g !! Drainage per soil type [mm] |
---|
140 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: DOC_to_topsoil_g !! DOC inputs to top of the soil column, from reinfiltration on |
---|
141 | !! floodplains and from irrigation |
---|
142 | !! @tex $(gC m^{-2} day{-1})$ @endtex |
---|
143 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: DOC_to_subsoil_g !! DOC inputs to bottom of the soil column, from returnflow |
---|
144 | !! in swamps and lakes |
---|
145 | !! @tex $(gC m^{-2} day{-1})$ @endtex |
---|
146 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:) :: flood_frac_g !! DOC inputs to bottom of the soil column, from returnflow |
---|
147 | !! TF-DOC |
---|
148 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: precip2canopy_g !! Precipitation onto the canopy |
---|
149 | !$OMP THREADPRIVATE(precip2canopy_g) |
---|
150 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: precip2ground_g !! Precipitation not intercepted by canopy |
---|
151 | !$OMP THREADPRIVATE(precip2ground_g) |
---|
152 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: canopy2ground_g !! Water flux from canopy to the ground |
---|
153 | !$OMP THREADPRIVATE(canopy2ground_g) |
---|
154 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: interception_storage_g !! Storage of DOC and soluble OC in canopy |
---|
155 | !$OMP THREADPRIVATE(interception_storage_g) |
---|
156 | |
---|
157 | REAL(r_std),DIMENSION(:,:,:,:),ALLOCATABLE :: carbon_g !! Soil carbon stocks (nbp_glo,ncarb,nvm) (\f$gC m^{-2}\f$) |
---|
158 | REAL(r_std), DIMENSION(:,:,:,:,:,:), ALLOCATABLE :: DOC_g !! Dissolved Organic Carbon in soil |
---|
159 | !! The unit is given by m^3 of |
---|
160 | !! ground @tex $(gC m{-2}) $ @endtex |
---|
161 | REAL(r_std), ALLOCATABLE ::litter_above_g(:,:,:,:,:) !! Metabolic and structural litter, below ground |
---|
162 | !! The unit is given by m^2 of |
---|
163 | !! ground @tex $(gCi m{-2})$ @endtex |
---|
164 | REAL(r_std), ALLOCATABLE ::litter_below_g(:,:,:,:,:,:) !! Metabolic and structural litter, below ground |
---|
165 | !! The unit is given by m^2 of |
---|
166 | !! ground @tex $(gC m^{-2})$ @endtex |
---|
167 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: lignin_struc_above_g !! Ratio Lignine/Carbon in structural litter for above |
---|
168 | !! ground compartments (unitless) |
---|
169 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:,:):: lignin_struc_below_g !! Ratio Lignine/Carbon in structural litter for below |
---|
170 | !! ground compartments (unitless) |
---|
171 | REAL(r_std),ALLOCATABLE :: clay(:) !! clay fraction (nbp_loc) (unitless) |
---|
172 | REAL(r_std),ALLOCATABLE :: soil_ph(:) !! Soil pH (0-14 pH units) |
---|
173 | REAL(r_std),ALLOCATABLE :: poor_soils(:) !! Poor soils (0-1) |
---|
174 | REAL(r_std),ALLOCATABLE :: bulk_dens(:) !! soil bulk density (nbpglo) (g cm-3) |
---|
175 | REAL(r_std),ALLOCATABLE :: soilcarbon_input(:,:,:,:,:,:) !! soil carbon input (nbp_loc,npool,nvm,time) |
---|
176 | !! water @tex $(gC m{-2} of water)$ @endte |
---|
177 | |
---|
178 | REAL(r_std),ALLOCATABLE :: floodcarbon_input(:,:,:,:,:) !! soil carbon input (nbp_loc,npool,nvm,time) |
---|
179 | !! water @tex $(gC m{-2} of water)$ @endte |
---|
180 | REAL(r_std),ALLOCATABLE :: control_temp_soil(:,:,:,:) !! Temperature control (nbp_loc,nbdl,time) on OM decomposition |
---|
181 | !! (unitless) |
---|
182 | REAL(r_std),ALLOCATABLE :: control_moist_soil(:,:,:,:) !! Moisture control (nbp_loc,nbdl,time) on OM decomposition |
---|
183 | !! ?? Should be defined per PFT as well (unitless) |
---|
184 | |
---|
185 | REAL(r_std),ALLOCATABLE :: carbon(:,:,:,:) !! Soil carbon stocks (nbp_loc,ncarb,nvm) (\f$gC m^{-2}\f$) |
---|
186 | REAL(r_std), ALLOCATABLE ::litter_above(:,:,:,:,:) !! Metabolic and structural litter, below ground |
---|
187 | !! The unit is given by m^2 of |
---|
188 | !! ground @tex $(gCi m{-2})$ @endtex |
---|
189 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: lignin_struc_above !! Ratio Lignine/Carbon in structural litter for above |
---|
190 | !! ground compartments (unitless) |
---|
191 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:,:):: lignin_struc_below !! Ratio Lignine/Carbon in structural litter for below |
---|
192 | !! ground compartments (unitless) |
---|
193 | REAL(r_std),ALLOCATABLE :: veget_max(:,:) !! PFT "Maximal" coverage fraction of a PFT defined in |
---|
194 | !! the input vegetation map |
---|
195 | !! @tex $(m^2 m^{-2})$ @endtex |
---|
196 | REAL(r_std), ALLOCATABLE ::litter_below(:,:,:,:,:,:) !! Metabolic and structural litter, below ground |
---|
197 | !! The unit is given by m^2 of |
---|
198 | !! ground @tex $(gC m^{-2})$ @endtex |
---|
199 | REAL(r_std),DIMENSION(:,:),ALLOCATABLE :: resp_hetero_soil !! Heterotrophic respiration (\f$gC m^{-2} dt_forcesoil^{-1}\f$) |
---|
200 | !! (requested by soilcarbon routine but not used here) |
---|
201 | REAL(r_std),DIMENSION(:,:),ALLOCATABLE :: resp_flood_soil !! Heterotrophic respiration (\f$gC m^{-2} dt_forcesoil^{-1}\f$) |
---|
202 | !! (requested by soilcarbon routine but not used here) |
---|
203 | REAL(r_std), DIMENSION(:,:), ALLOCATABLE :: soilhum !! Daily soil humidity of each soil layer |
---|
204 | !! (unitless) |
---|
205 | REAL(r_std),DIMENSION (:,:,:), ALLOCATABLE :: moist_soil !! soil moisture content \f($m^3 \times m^3$)\f |
---|
206 | REAL(r_std),DIMENSION (:,:,:,:), ALLOCATABLE :: soil_mc !! soil moisture content \f($m^3 \times m^3$)\f |
---|
207 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:) :: floodout !! flux out of floodplains |
---|
208 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: wat_flux0 !! Water flux in the first soil layers exported for soil C calculations |
---|
209 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:,:):: wat_flux !! Water flux in the soil layers exported for soil C calculations |
---|
210 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) ::runoff_per_soil !! Runoff per soil type [mm] |
---|
211 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) ::drainage_per_soil !! Drainage per soil type [mm] |
---|
212 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: DOC_to_topsoil !! DOC inputs to top of the soil column, from reinfiltration on |
---|
213 | !! floodplains and from irrigation |
---|
214 | !! @tex $(gC m^{-2} day{-1})$ @endtex |
---|
215 | REAL(r_std),ALLOCATABLE,SAVE,DIMENSION(:,:,:) :: DOC_to_subsoil !! DOC inputs to bottom of the soil column, from returnflow |
---|
216 | !! in swamps and lakes |
---|
217 | !! @tex $(gC m^{-2} day{-1})$ @endtex |
---|
218 | !! TF-DOC, maybe put all togetehr into one matrix |
---|
219 | REAL(r_std), DIMENSION(:,:,:,:), ALLOCATABLE :: dry_dep_canopy !! Increase in canopy storage of soluble OC & DOC |
---|
220 | !! @tex $(gC.m^{-2})$ @endtex |
---|
221 | REAL(r_std), DIMENSION(:,:,:,:), ALLOCATABLE :: DOC_precip2canopy !! Wet deposition of DOC onto canopy |
---|
222 | !! @tex $(gC.m^{-2})$ @endtex |
---|
223 | REAL(r_std), DIMENSION(:,:,:,:), ALLOCATABLE :: DOC_precip2ground !! Wet deposition of DOC not intecepted by canopy |
---|
224 | !! @tex $(gC.m^{-2})$ @endtex |
---|
225 | REAL(r_std), DIMENSION(:,:,:,:), ALLOCATABLE :: DOC_canopy2ground !! Wet deposition of DOC not intecepted by canopy |
---|
226 | !! @tex $(gC.m^{-2})$ @endtex |
---|
227 | REAL(r_std), DIMENSION(:,:,:,:), ALLOCATABLE :: DOC_infil !! Wet deposition of DOC infiltrating into the ground |
---|
228 | !! @tex $(gC.m^{-2})$ @endtex |
---|
229 | REAL(r_std), DIMENSION(:,:,:,:), ALLOCATABLE :: DOC_noinfil !! Wet deposition of DOC going into surface runoff |
---|
230 | !! @tex $(gC.m^{-2})$ @endtex |
---|
231 | REAL(r_std), DIMENSION(:,:,:), ALLOCATABLE :: interception_storage !! Storage of soluble OC attached to canopy |
---|
232 | !! @tex $(gC.m^{-2})$ @endtex |
---|
233 | REAL(r_std), DIMENSION(:,:,:), ALLOCATABLE :: precip2canopy !! Precipitation onto the canopy |
---|
234 | !! @tex $(mm.dt^{-1})$ @endtex |
---|
235 | REAL(r_std), DIMENSION(:,:,:), ALLOCATABLE :: precip2ground !! Precipitation not intercepted by canopy |
---|
236 | !! @tex $(mm.dt^{-1})$ @endtex |
---|
237 | REAL(r_std), DIMENSION(:,:,:), ALLOCATABLE :: canopy2ground !! Water flux from canopy to the ground |
---|
238 | !! @tex $(mm.dt^{-1})$ @endtex |
---|
239 | REAL(r_std), DIMENSION(:,:,:,:,:), ALLOCATABLE :: biomass !! Biomass in |
---|
240 | !! @tex $(kg.m^{-2})$ @endtex |
---|
241 | REAL(r_std),DIMENSION (:,:), ALLOCATABLE :: soiltile !! Fraction of each soil tile (0-1, unitless) |
---|
242 | REAL(r_std), DIMENSION(:,:,:,:,:,:), ALLOCATABLE :: DOC !! Dissolved Organic Carbon in soil |
---|
243 | !! The unit is given by m^3 of |
---|
244 | !! ground @tex $(gC m{-2}) $ @endtex |
---|
245 | REAL(r_std), DIMENSION(:,:,:,:,:), ALLOCATABLE :: DOC_EXP !! Dissolved Organic Carbon in soil |
---|
246 | !! The unit is given by m^3 of |
---|
247 | !! water @tex $(gCm {-3}) $ @endtex |
---|
248 | REAL(r_std), DIMENSION(:,:), ALLOCATABLE :: flood_frac !! Flooded fraction of grid box |
---|
249 | |
---|
250 | INTEGER(i_std) :: ier,iret !! Used for hangling errors |
---|
251 | |
---|
252 | CHARACTER(LEN=30) :: temp_name |
---|
253 | LOGICAL :: debug !! boolean used for printing messages |
---|
254 | LOGICAL :: l_error !! boolean for memory allocation |
---|
255 | |
---|
256 | !_ ================================================================================================================================= |
---|
257 | |
---|
258 | CALL Init_orchidee_para |
---|
259 | CALL init_timer |
---|
260 | |
---|
261 | !- |
---|
262 | debug = .FALSE. |
---|
263 | CALL getin_p('DEBUG_INFO',debug) |
---|
264 | !!- |
---|
265 | !! 1. Initialisation stage |
---|
266 | !! Reading a set of input files, allocating variables and preparing output restart file. |
---|
267 | !!- |
---|
268 | ! Define restart file name |
---|
269 | ! for reading initial conditions (sto_restname_in var) and for writting final conditions (sto_restname_out var). |
---|
270 | ! User values are used if present in the .def file. |
---|
271 | ! If not present, default values (stomate_start.nc and stomate_rest_out.c) are used. |
---|
272 | !- |
---|
273 | IF (is_root_prc) THEN |
---|
274 | sto_restname_in = 'stomate_start.nc' |
---|
275 | CALL getin ('STOMATE_RESTART_FILEIN',sto_restname_in) |
---|
276 | WRITE(numout,*) 'STOMATE INPUT RESTART_FILE: ',TRIM(sto_restname_in) |
---|
277 | sto_restname_out = 'stomate_rest_out.nc' |
---|
278 | CALL getin ('STOMATE_RESTART_FILEOUT',sto_restname_out) |
---|
279 | WRITE(numout,*) 'STOMATE OUTPUT RESTART_FILE: ',TRIM(sto_restname_out) |
---|
280 | !- |
---|
281 | ! Open the input file and Get some Dimension and Attributes ID's |
---|
282 | !- |
---|
283 | iret = NF90_OPEN (sto_restname_in, NF90_NOWRITE, rest_id_sto) |
---|
284 | iret = NF90_INQUIRE_DIMENSION (rest_id_sto,1,len=iim_g) |
---|
285 | iret = NF90_INQUIRE_DIMENSION (rest_id_sto,2,len=jjm_g) |
---|
286 | iret = NF90_INQ_VARID (rest_id_sto, "time", iv) |
---|
287 | iret = NF90_GET_ATT (rest_id_sto, iv, 'calendar',thecalendar) |
---|
288 | iret = NF90_CLOSE (rest_id_sto) |
---|
289 | i=INDEX(thecalendar,ACHAR(0)) |
---|
290 | IF ( i > 0 ) THEN |
---|
291 | thecalendar(i:20)=' ' |
---|
292 | ENDIF |
---|
293 | !- |
---|
294 | ! Allocate longitudes and latitudes |
---|
295 | !- |
---|
296 | ALLOCATE (lon(iim_g,jjm_g)) |
---|
297 | ALLOCATE (lat(iim_g,jjm_g)) |
---|
298 | lon(:,:) = zero |
---|
299 | lat(:,:) = zero |
---|
300 | lev(1) = zero |
---|
301 | !- |
---|
302 | CALL restini & |
---|
303 | & (sto_restname_in, iim_g, jjm_g, lon, lat, llm, lev, & |
---|
304 | & sto_restname_out, itau_dep, date0, dt_files, rest_id_sto) |
---|
305 | ENDIF |
---|
306 | CALL control_initialize(dt_files) |
---|
307 | CALL bcast(date0) |
---|
308 | CALL bcast(thecalendar) |
---|
309 | WRITE(numout,*) "calendar = ",thecalendar |
---|
310 | !- |
---|
311 | ! calendar |
---|
312 | !- |
---|
313 | CALL ioconf_calendar (thecalendar) |
---|
314 | CALL ioget_calendar (one_year,one_day) |
---|
315 | CALL ioconf_startdate(date0) |
---|
316 | ! |
---|
317 | !! For master process only |
---|
318 | ! |
---|
319 | IF (is_root_prc) THEN |
---|
320 | !- |
---|
321 | ! define forcing file's name (Cforcing_name var) |
---|
322 | ! User value is used if present in the .def file |
---|
323 | ! If not, default (NONE) is used |
---|
324 | !- |
---|
325 | Cforcing_name = 'NONE' |
---|
326 | CALL getin ('STOMATE_CFORCING_NAME',Cforcing_name) |
---|
327 | !- |
---|
328 | ! Open FORCESOIL's forcing file to read some basic info (dimensions, variable ID's) |
---|
329 | ! and allocate variables. |
---|
330 | !- |
---|
331 | iret = NF90_OPEN (TRIM(Cforcing_name),NF90_NOWRITE,Cforcing_id) |
---|
332 | IF (iret /= NF90_NOERR) THEN |
---|
333 | CALL ipslerr (3,'forcesoil', & |
---|
334 | & 'Could not open file : ', & |
---|
335 | & Cforcing_name,'(Do you have forget it ?)') |
---|
336 | ENDIF |
---|
337 | !- |
---|
338 | ! Total Domain size is stored in nbp_glo variable |
---|
339 | !- |
---|
340 | ier = NF90_GET_ATT (Cforcing_id,NF90_GLOBAL,'kjpindex',x_tmp) |
---|
341 | nbp_glo = NINT(x_tmp) |
---|
342 | !- |
---|
343 | ! Number of values stored per year in the forcing file is stored in nparan var. |
---|
344 | !- |
---|
345 | ier = NF90_GET_ATT (Cforcing_id,NF90_GLOBAL,'nparan',x_tmp) |
---|
346 | nparan = NINT(x_tmp) |
---|
347 | ier = NF90_GET_ATT (Cforcing_id,NF90_GLOBAL,'nbyear',x_tmp) |
---|
348 | nbyear = NINT(x_tmp) |
---|
349 | !- |
---|
350 | ALLOCATE (indices_g(nbp_glo)) |
---|
351 | ALLOCATE (clay_g(nbp_glo)) |
---|
352 | ALLOCATE (soil_ph_g(nbp_glo)) |
---|
353 | ALLOCATE (bulk_dens_g(nbp_glo)) |
---|
354 | ALLOCATE (soiltile_g(nbp_glo,nstm)) |
---|
355 | ALLOCATE (veget_max_g(nbp_glo,nvm)) |
---|
356 | !- |
---|
357 | ALLOCATE (x_indices_g(nbp_glo),stat=ier) |
---|
358 | ier = NF90_INQ_VARID (Cforcing_id,'index',v_id) |
---|
359 | ier = NF90_GET_VAR (Cforcing_id,v_id,x_indices_g) |
---|
360 | indices_g(:) = NINT(x_indices_g(:)) |
---|
361 | WRITE(numout,*) mpi_rank,"indices globaux : ",indices_g |
---|
362 | DEALLOCATE (x_indices_g) |
---|
363 | !- |
---|
364 | ier = NF90_INQ_VARID (Cforcing_id,'clay',v_id) |
---|
365 | ier = NF90_GET_VAR (Cforcing_id,v_id,clay_g) |
---|
366 | ier = NF90_INQ_VARID (Cforcing_id,'soil_ph',v_id) |
---|
367 | ier = NF90_GET_VAR (Cforcing_id,v_id,soil_ph_g) |
---|
368 | ier = NF90_INQ_VARID (Cforcing_id,'bulk_dens',v_id) |
---|
369 | ier = NF90_GET_VAR (Cforcing_id,v_id,bulk_dens_g) |
---|
370 | ier = NF90_INQ_VARID (Cforcing_id,'soiltile',v_id) |
---|
371 | ier = NF90_GET_VAR (Cforcing_id,v_id,soiltile_g) |
---|
372 | ier = NF90_INQ_VARID (Cforcing_id,'veget_max',v_id) |
---|
373 | ier = NF90_GET_VAR (Cforcing_id,v_id,veget_max_g) |
---|
374 | !- |
---|
375 | ! time step of forcesoil program (in days) |
---|
376 | !- |
---|
377 | dt_forcesoil = one_year / FLOAT(nparan) |
---|
378 | WRITE(numout,*) 'time step (d): ',dt_forcesoil |
---|
379 | WRITE(numout,*) 'nparan: ',nparan |
---|
380 | WRITE(numout,*) 'nbyear: ',nbyear |
---|
381 | !- |
---|
382 | ! read and write the variables in the output restart file we do not modify within the Forcesoil program |
---|
383 | ! ie all variables stored in the input restart file except those stored in taboo_vars |
---|
384 | !- |
---|
385 | taboo_vars ='$lon$ $lat$ $lev$ $nav_lon$ $nav_lat$ $nav_lev$ $time$ $time_steps$ '// & |
---|
386 | & '$dt_days$ $date$' |
---|
387 | ! & '$day_counter$ $dt_days$ $date$ ' |
---|
388 | !- |
---|
389 | DO m = 1,nvm |
---|
390 | WRITE(part_str,'(I2)') m |
---|
391 | IF (m < 10) part_str(1:1) = '0' |
---|
392 | temp_name = '$carbon_z01_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
393 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
394 | ENDDO |
---|
395 | |
---|
396 | DO m = 1,nvm |
---|
397 | WRITE(part_str,'(I2)') m |
---|
398 | IF (m < 10) part_str(1:1) = '0' |
---|
399 | temp_name = '$carbon_z02_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
400 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
401 | ENDDO |
---|
402 | |
---|
403 | DO m = 1,nvm |
---|
404 | WRITE(part_str,'(I2)') m |
---|
405 | IF (m < 10) part_str(1:1) = '0' |
---|
406 | temp_name = '$carbon_z03_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
407 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
408 | ENDDO |
---|
409 | |
---|
410 | DO m = 1,nvm |
---|
411 | WRITE(part_str,'(I2)') m |
---|
412 | IF (m < 10) part_str(1:1) = '0' |
---|
413 | temp_name = '$carbon_z04_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
414 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
415 | ENDDO |
---|
416 | |
---|
417 | DO m = 1,nvm |
---|
418 | WRITE(part_str,'(I2)') m |
---|
419 | IF (m < 10) part_str(1:1) = '0' |
---|
420 | temp_name = '$carbon_z05_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
421 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
422 | ENDDO |
---|
423 | |
---|
424 | DO m = 1,nvm |
---|
425 | WRITE(part_str,'(I2)') m |
---|
426 | IF (m < 10) part_str(1:1) = '0' |
---|
427 | temp_name = '$carbon_z06_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
428 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
429 | ENDDO |
---|
430 | |
---|
431 | DO m = 1,nvm |
---|
432 | WRITE(part_str,'(I2)') m |
---|
433 | IF (m < 10) part_str(1:1) = '0' |
---|
434 | temp_name = '$carbon_z07_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
435 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
436 | ENDDO |
---|
437 | |
---|
438 | DO m = 1,nvm |
---|
439 | WRITE(part_str,'(I2)') m |
---|
440 | IF (m < 10) part_str(1:1) = '0' |
---|
441 | temp_name = '$carbon_z08_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
442 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
443 | ENDDO |
---|
444 | |
---|
445 | DO m = 1,nvm |
---|
446 | WRITE(part_str,'(I2)') m |
---|
447 | IF (m < 10) part_str(1:1) = '0' |
---|
448 | temp_name = '$carbon_z09_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
449 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
450 | ENDDO |
---|
451 | |
---|
452 | DO m = 1,nvm |
---|
453 | WRITE(part_str,'(I2)') m |
---|
454 | IF (m < 10) part_str(1:1) = '0' |
---|
455 | temp_name = '$carbon_z10_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
456 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
457 | ENDDO |
---|
458 | |
---|
459 | DO m = 1,nvm |
---|
460 | WRITE(part_str,'(I2)') m |
---|
461 | IF (m < 10) part_str(1:1) = '0' |
---|
462 | temp_name = '$carbon_z11_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
463 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
464 | ENDDO |
---|
465 | |
---|
466 | DO m = 1,npool |
---|
467 | WRITE(part_str,'(I1)') m |
---|
468 | temp_name = '$freedoc_z1_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
469 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
470 | ENDDO |
---|
471 | |
---|
472 | DO m = 1,npool |
---|
473 | WRITE(part_str,'(I1)') m |
---|
474 | temp_name = '$freedoc_z2_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
475 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
476 | ENDDO |
---|
477 | |
---|
478 | DO m = 1,npool |
---|
479 | WRITE(part_str,'(I1)') m |
---|
480 | temp_name = '$freedoc_z3_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
481 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
482 | ENDDO |
---|
483 | |
---|
484 | DO m = 1,npool |
---|
485 | WRITE(part_str,'(I1)') m |
---|
486 | temp_name = '$freedoc_z4_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
487 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
488 | ENDDO |
---|
489 | |
---|
490 | DO m = 1,npool |
---|
491 | WRITE(part_str,'(I1)') m |
---|
492 | temp_name = '$freedoc_z5_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
493 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
494 | ENDDO |
---|
495 | |
---|
496 | DO m = 1,npool |
---|
497 | WRITE(part_str,'(I1)') m |
---|
498 | temp_name = '$freedoc_z6_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
499 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
500 | ENDDO |
---|
501 | |
---|
502 | DO m = 1,npool |
---|
503 | WRITE(part_str,'(I1)') m |
---|
504 | temp_name = '$freedoc_z7_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
505 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
506 | ENDDO |
---|
507 | |
---|
508 | DO m = 1,npool |
---|
509 | WRITE(part_str,'(I1)') m |
---|
510 | temp_name = '$freedoc_z8_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
511 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
512 | ENDDO |
---|
513 | |
---|
514 | DO m = 1,npool |
---|
515 | WRITE(part_str,'(I1)') m |
---|
516 | temp_name = '$freedoc_z9_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
517 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
518 | ENDDO |
---|
519 | |
---|
520 | DO m = 1,npool |
---|
521 | WRITE(part_str,'(I1)') m |
---|
522 | temp_name = '$freedoc_z10_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
523 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
524 | ENDDO |
---|
525 | |
---|
526 | DO m = 1,npool |
---|
527 | WRITE(part_str,'(I1)') m |
---|
528 | temp_name = '$freedoc_z11_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
529 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
530 | ENDDO |
---|
531 | |
---|
532 | DO m = 1,npool |
---|
533 | WRITE(part_str,'(I1)') m |
---|
534 | temp_name = '$adsdoc_z1_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
535 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
536 | ENDDO |
---|
537 | |
---|
538 | DO m = 1,npool |
---|
539 | WRITE(part_str,'(I1)') m |
---|
540 | temp_name = '$adsdoc_z2_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
541 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
542 | ENDDO |
---|
543 | |
---|
544 | DO m = 1,npool |
---|
545 | WRITE(part_str,'(I1)') m |
---|
546 | temp_name = '$adsdoc_z3_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
547 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
548 | ENDDO |
---|
549 | |
---|
550 | DO m = 1,npool |
---|
551 | WRITE(part_str,'(I1)') m |
---|
552 | temp_name = '$adsdoc_z4_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
553 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
554 | ENDDO |
---|
555 | |
---|
556 | DO m = 1,npool |
---|
557 | WRITE(part_str,'(I1)') m |
---|
558 | temp_name = '$adsdoc_z5_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
559 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
560 | ENDDO |
---|
561 | |
---|
562 | DO m = 1,npool |
---|
563 | WRITE(part_str,'(I1)') m |
---|
564 | temp_name = '$adsdoc_z6_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
565 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
566 | ENDDO |
---|
567 | |
---|
568 | DO m = 1,npool |
---|
569 | WRITE(part_str,'(I1)') m |
---|
570 | temp_name = '$adsdoc_z7_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
571 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
572 | ENDDO |
---|
573 | |
---|
574 | DO m = 1,npool |
---|
575 | WRITE(part_str,'(I1)') m |
---|
576 | temp_name = '$adsdoc_z8_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
577 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
578 | ENDDO |
---|
579 | |
---|
580 | DO m = 1,npool |
---|
581 | WRITE(part_str,'(I1)') m |
---|
582 | temp_name = '$adsdoc_z9_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
583 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
584 | ENDDO |
---|
585 | |
---|
586 | DO m = 1,npool |
---|
587 | WRITE(part_str,'(I1)') m |
---|
588 | temp_name = '$adsdoc_z10_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
589 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
590 | ENDDO |
---|
591 | |
---|
592 | DO m = 1,npool |
---|
593 | WRITE(part_str,'(I1)') m |
---|
594 | temp_name = '$adsdoc_z11_'//part_str(1:LEN_TRIM(part_str))//'$' |
---|
595 | taboo_vars = TRIM(taboo_vars)//' '//TRIM(temp_name) |
---|
596 | ENDDO |
---|
597 | |
---|
598 | !- |
---|
599 | CALL ioget_vname(rest_id_sto, nbvar, varnames) |
---|
600 | !- |
---|
601 | ! read and write some special variables (1D or variables that we need) |
---|
602 | !- |
---|
603 | !var_name = 'day_counter' |
---|
604 | !CALL restget (rest_id_sto, var_name, 1, 1, 1, itau_dep, .TRUE., xtmp) |
---|
605 | !CALL restput (rest_id_sto, var_name, 1, 1, 1, itau_dep, xtmp) |
---|
606 | !- |
---|
607 | var_name = 'dt_days' |
---|
608 | CALL restget (rest_id_sto, var_name, 1, 1, 1, itau_dep, .TRUE., xtmp) |
---|
609 | CALL restput (rest_id_sto, var_name, 1, 1, 1, itau_dep, xtmp) |
---|
610 | !- |
---|
611 | var_name = 'date' |
---|
612 | CALL restget (rest_id_sto, var_name, 1, 1, 1, itau_dep, .TRUE., xtmp) |
---|
613 | CALL restput (rest_id_sto, var_name, 1, 1, 1, itau_dep, xtmp) |
---|
614 | !- |
---|
615 | |
---|
616 | DO iv=1,nbvar |
---|
617 | !-- check if the variable is to be written here |
---|
618 | IF (INDEX(taboo_vars,'$'//TRIM(varnames(iv))//'$') == 0 ) THEN |
---|
619 | !---- get variable dimensions, especially 3rd dimension |
---|
620 | CALL ioget_vdim & |
---|
621 | & (rest_id_sto, varnames(iv), varnbdim_max, varnbdim, vardims) |
---|
622 | l1d = ALL(vardims(1:varnbdim) == 1) |
---|
623 | !---- read it |
---|
624 | IF (l1d) THEN |
---|
625 | CALL restget & |
---|
626 | & (rest_id_sto, TRIM(varnames(iv)), 1, vardims(3), & |
---|
627 | & 1, itau_dep, .TRUE., xtmp) |
---|
628 | ELSE |
---|
629 | ALLOCATE( var_3d(nbp_glo,vardims(3)), stat=ier) |
---|
630 | IF (ier /= 0) STOP 'ALLOCATION PROBLEM' |
---|
631 | !---- |
---|
632 | |
---|
633 | CALL restget & |
---|
634 | & (rest_id_sto, TRIM(varnames(iv)), nbp_glo, vardims(3), & |
---|
635 | & 1, itau_dep, .TRUE., var_3d, 'gather', nbp_glo, indices_g) |
---|
636 | ENDIF |
---|
637 | !---- write it |
---|
638 | IF (l1d) THEN |
---|
639 | CALL restput & |
---|
640 | & (rest_id_sto, TRIM(varnames(iv)), 1, vardims(3), & |
---|
641 | & 1, itau_dep, xtmp) |
---|
642 | ELSE |
---|
643 | CALL restput & |
---|
644 | & (rest_id_sto, TRIM(varnames(iv)), nbp_glo, vardims(3), & |
---|
645 | & 1, itau_dep, var_3d, 'scatter', nbp_glo, indices_g) |
---|
646 | !---- |
---|
647 | DEALLOCATE(var_3d) |
---|
648 | ENDIF |
---|
649 | ENDIF |
---|
650 | ENDDO |
---|
651 | !- |
---|
652 | ! read soil carbon stocks values stored in the input restart file |
---|
653 | !- |
---|
654 | ALLOCATE(carbon_g(nbp_glo,ncarb,nvm,nbdl),stat=ier) |
---|
655 | IF (ier /= 0) THEN |
---|
656 | WRITE(numout,*) 'Allocatoin error carbon_g ier = ',ier |
---|
657 | STOP |
---|
658 | END IF |
---|
659 | carbon_g(:,:,:,:) = val_exp |
---|
660 | ALLOCATE(DOC_g(nbp_glo,nvm,nbdl,ndoc,npool,nelements),stat=ier) |
---|
661 | IF (ier /= 0) THEN |
---|
662 | WRITE(numout,*) 'Allocatoin error DOC_g ier = ',ier |
---|
663 | STOP |
---|
664 | END IF |
---|
665 | |
---|
666 | DOC_g(:,:,:,:,:,:) = val_exp |
---|
667 | DO m=1,nvm |
---|
668 | WRITE (part_str, '(I2)') m |
---|
669 | IF (m<10) part_str(1:1)='0' |
---|
670 | var_name = 'carbon_z01_'//part_str(1:LEN_TRIM(part_str)) |
---|
671 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
672 | & .TRUE., carbon_g(:,:,m,1), 'gather', nbp_glo, indices_g) |
---|
673 | IF (ALL(carbon_g(:,:,m,1) == val_exp)) carbon_g(:,:,m,1) = zero |
---|
674 | ENDDO |
---|
675 | DO m=1,nvm |
---|
676 | WRITE (part_str, '(I2)') m |
---|
677 | IF (m<10) part_str(1:1)='0' |
---|
678 | var_name = 'carbon_z02_'//part_str(1:LEN_TRIM(part_str)) |
---|
679 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
680 | & .TRUE., carbon_g(:,:,m,2), 'gather', nbp_glo, indices_g) |
---|
681 | IF (ALL(carbon_g(:,:,m,2) == val_exp)) carbon_g(:,:,m,2) = zero |
---|
682 | ENDDO |
---|
683 | |
---|
684 | DO m=1,nvm |
---|
685 | WRITE (part_str, '(I2)') m |
---|
686 | IF (m<10) part_str(1:1)='0' |
---|
687 | var_name = 'carbon_z03_'//part_str(1:LEN_TRIM(part_str)) |
---|
688 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
689 | & .TRUE., carbon_g(:,:,m,3), 'gather', nbp_glo, indices_g) |
---|
690 | IF (ALL(carbon_g(:,:,m,3) == val_exp)) carbon_g(:,:,m,3) = zero |
---|
691 | ENDDO |
---|
692 | |
---|
693 | DO m=1,nvm |
---|
694 | WRITE (part_str, '(I2)') m |
---|
695 | IF (m<10) part_str(1:1)='0' |
---|
696 | var_name = 'carbon_z04_'//part_str(1:LEN_TRIM(part_str)) |
---|
697 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
698 | & .TRUE., carbon_g(:,:,m,4), 'gather', nbp_glo, indices_g) |
---|
699 | IF (ALL(carbon_g(:,:,m,4) == val_exp)) carbon_g(:,:,m,4) = zero |
---|
700 | ENDDO |
---|
701 | |
---|
702 | DO m=1,nvm |
---|
703 | WRITE (part_str, '(I2)') m |
---|
704 | IF (m<10) part_str(1:1)='0' |
---|
705 | var_name = 'carbon_z05_'//part_str(1:LEN_TRIM(part_str)) |
---|
706 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
707 | & .TRUE., carbon_g(:,:,m,5), 'gather', nbp_glo, indices_g) |
---|
708 | IF (ALL(carbon_g(:,:,m,5) == val_exp)) carbon_g(:,:,m,5) = zero |
---|
709 | ENDDO |
---|
710 | |
---|
711 | DO m=1,nvm |
---|
712 | WRITE (part_str, '(I2)') m |
---|
713 | IF (m<10) part_str(1:1)='0' |
---|
714 | var_name = 'carbon_z06_'//part_str(1:LEN_TRIM(part_str)) |
---|
715 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
716 | & .TRUE., carbon_g(:,:,m,6), 'gather', nbp_glo, indices_g) |
---|
717 | IF (ALL(carbon_g(:,:,m,6) == val_exp)) carbon_g(:,:,m,6) = zero |
---|
718 | ENDDO |
---|
719 | |
---|
720 | DO m=1,nvm |
---|
721 | WRITE (part_str, '(I2)') m |
---|
722 | IF (m<10) part_str(1:1)='0' |
---|
723 | var_name = 'carbon_z07_'//part_str(1:LEN_TRIM(part_str)) |
---|
724 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
725 | & .TRUE., carbon_g(:,:,m,7), 'gather', nbp_glo, indices_g) |
---|
726 | IF (ALL(carbon_g(:,:,m,7) == val_exp)) carbon_g(:,:,m,7) = zero |
---|
727 | ENDDO |
---|
728 | |
---|
729 | DO m=1,nvm |
---|
730 | WRITE (part_str, '(I2)') m |
---|
731 | IF (m<10) part_str(1:1)='0' |
---|
732 | var_name = 'carbon_z08_'//part_str(1:LEN_TRIM(part_str)) |
---|
733 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
734 | & .TRUE., carbon_g(:,:,m,8), 'gather', nbp_glo, indices_g) |
---|
735 | IF (ALL(carbon_g(:,:,m,8) == val_exp)) carbon_g(:,:,m,8) = zero |
---|
736 | ENDDO |
---|
737 | |
---|
738 | DO m=1,nvm |
---|
739 | WRITE (part_str, '(I2)') m |
---|
740 | IF (m<10) part_str(1:1)='0' |
---|
741 | var_name = 'carbon_z09_'//part_str(1:LEN_TRIM(part_str)) |
---|
742 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
743 | & .TRUE., carbon_g(:,:,m,9), 'gather', nbp_glo, indices_g) |
---|
744 | IF (ALL(carbon_g(:,:,m,9) == val_exp)) carbon_g(:,:,m,9) = zero |
---|
745 | ENDDO |
---|
746 | |
---|
747 | DO m=1,nvm |
---|
748 | WRITE (part_str, '(I2)') m |
---|
749 | IF (m<10) part_str(1:1)='0' |
---|
750 | var_name = 'carbon_z10_'//part_str(1:LEN_TRIM(part_str)) |
---|
751 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
752 | & .TRUE., carbon_g(:,:,m,10), 'gather', nbp_glo, indices_g) |
---|
753 | IF (ALL(carbon_g(:,:,m,10) == val_exp)) carbon_g(:,:,m,10) = zero |
---|
754 | ENDDO |
---|
755 | |
---|
756 | DO m=1,nvm |
---|
757 | WRITE (part_str, '(I2)') m |
---|
758 | IF (m<10) part_str(1:1)='0' |
---|
759 | var_name = 'carbon_z11_'//part_str(1:LEN_TRIM(part_str)) |
---|
760 | CALL restget (rest_id_sto, var_name, nbp_glo, ncarb , 1, itau_dep, & |
---|
761 | & .TRUE., carbon_g(:,:,m,11), 'gather', nbp_glo, indices_g) |
---|
762 | IF (ALL(carbon_g(:,:,m,11) == val_exp)) carbon_g(:,:,m,11) = zero |
---|
763 | ENDDO |
---|
764 | |
---|
765 | DO m=1,npool |
---|
766 | WRITE (part_str, '(I1)') m |
---|
767 | var_name = 'freedoc_z1_'//part_str(1:LEN_TRIM(part_str)) |
---|
768 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
769 | & .TRUE., DOC_g(:,:,1,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
770 | IF (ALL(DOC_g(:,:,1,ifree,m,icarbon) == val_exp)) DOC_g(:,:,1,ifree,m,icarbon) = zero |
---|
771 | ENDDO |
---|
772 | DO m=1,npool |
---|
773 | WRITE (part_str, '(I1)') m |
---|
774 | var_name = 'freedoc_z2_'//part_str(1:LEN_TRIM(part_str)) |
---|
775 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
776 | & .TRUE., DOC_g(:,:,2,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
777 | IF (ALL(DOC_g(:,:,2,ifree,m,icarbon) == val_exp)) DOC_g(:,:,2,ifree,m,icarbon) = zero |
---|
778 | ENDDO |
---|
779 | |
---|
780 | DO m=1,npool |
---|
781 | WRITE (part_str, '(I1)') m |
---|
782 | var_name = 'freedoc_z3_'//part_str(1:LEN_TRIM(part_str)) |
---|
783 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
784 | & .TRUE., DOC_g(:,:,3,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
785 | IF (ALL(DOC_g(:,:,3,ifree,m,icarbon) == val_exp)) DOC_g(:,:,3,ifree,m,icarbon) = zero |
---|
786 | ENDDO |
---|
787 | |
---|
788 | DO m=1,npool |
---|
789 | WRITE (part_str, '(I1)') m |
---|
790 | var_name = 'freedoc_z4_'//part_str(1:LEN_TRIM(part_str)) |
---|
791 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
792 | & .TRUE., DOC_g(:,:,4,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
793 | IF (ALL(DOC_g(:,:,4,ifree,m,icarbon) == val_exp)) DOC_g(:,:,4,ifree,m,icarbon) = zero |
---|
794 | ENDDO |
---|
795 | |
---|
796 | DO m=1,npool |
---|
797 | WRITE (part_str, '(I1)') m |
---|
798 | var_name = 'freedoc_z5_'//part_str(1:LEN_TRIM(part_str)) |
---|
799 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
800 | & .TRUE., DOC_g(:,:,5,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
801 | IF (ALL(DOC_g(:,:,5,ifree,m,icarbon) == val_exp)) DOC_g(:,:,5,ifree,m,icarbon) = zero |
---|
802 | ENDDO |
---|
803 | |
---|
804 | DO m=1,npool |
---|
805 | WRITE (part_str, '(I1)') m |
---|
806 | var_name = 'freedoc_z6_'//part_str(1:LEN_TRIM(part_str)) |
---|
807 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
808 | & .TRUE., DOC_g(:,:,6,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
809 | IF (ALL(DOC_g(:,:,6,ifree,m,icarbon) == val_exp)) DOC_g(:,:,6,ifree,m,icarbon) = zero |
---|
810 | ENDDO |
---|
811 | |
---|
812 | DO m=1,npool |
---|
813 | WRITE (part_str, '(I1)') m |
---|
814 | var_name = 'freedoc_z7_'//part_str(1:LEN_TRIM(part_str)) |
---|
815 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
816 | & .TRUE., DOC_g(:,:,7,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
817 | IF (ALL(DOC_g(:,:,7,ifree,m,icarbon) == val_exp)) DOC_g(:,:,7,ifree,m,icarbon) = zero |
---|
818 | ENDDO |
---|
819 | |
---|
820 | DO m=1,npool |
---|
821 | WRITE (part_str, '(I1)') m |
---|
822 | var_name = 'freedoc_z8_'//part_str(1:LEN_TRIM(part_str)) |
---|
823 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
824 | & .TRUE., DOC_g(:,:,8,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
825 | IF (ALL(DOC_g(:,:,8,ifree,m,icarbon) == val_exp)) DOC_g(:,:,8,ifree,m,icarbon) = zero |
---|
826 | ENDDO |
---|
827 | |
---|
828 | DO m=1,npool |
---|
829 | WRITE (part_str, '(I1)') m |
---|
830 | var_name = 'freedoc_z9_'//part_str(1:LEN_TRIM(part_str)) |
---|
831 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
832 | & .TRUE., DOC_g(:,:,9,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
833 | IF (ALL(DOC_g(:,:,9,ifree,m,icarbon) == val_exp)) DOC_g(:,:,9,ifree,m,icarbon) = zero |
---|
834 | ENDDO |
---|
835 | |
---|
836 | DO m=1,npool |
---|
837 | WRITE (part_str, '(I1)') m |
---|
838 | var_name = 'freedoc_z10_'//part_str(1:LEN_TRIM(part_str)) |
---|
839 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
840 | & .TRUE., DOC_g(:,:,10,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
841 | IF (ALL(DOC_g(:,:,10,ifree,m,icarbon) == val_exp)) DOC_g(:,:,10,ifree,m,icarbon) = zero |
---|
842 | ENDDO |
---|
843 | |
---|
844 | DO m=1,npool |
---|
845 | WRITE (part_str, '(I1)') m |
---|
846 | var_name = 'freedoc_z11_'//part_str(1:LEN_TRIM(part_str)) |
---|
847 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
848 | & .TRUE., DOC_g(:,:,11,ifree,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
849 | IF (ALL(DOC_g(:,:,11,ifree,m,icarbon) == val_exp)) DOC_g(:,:,11,ifree,m,icarbon) = zero |
---|
850 | ENDDO |
---|
851 | DO m=1,npool |
---|
852 | WRITE (part_str, '(I1)') m |
---|
853 | var_name = 'adsdoc_z1_'//part_str(1:LEN_TRIM(part_str)) |
---|
854 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
855 | & .TRUE., DOC_g(:,:,1,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
856 | IF (ALL(DOC_g(:,:,1,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,1,iadsorbed,m,icarbon) = zero |
---|
857 | ENDDO |
---|
858 | DO m=1,npool |
---|
859 | WRITE (part_str, '(I1)') m |
---|
860 | var_name = 'adsdoc_z2_'//part_str(1:LEN_TRIM(part_str)) |
---|
861 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
862 | & .TRUE., DOC_g(:,:,2,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
863 | IF (ALL(DOC_g(:,:,2,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,2,iadsorbed,m,icarbon) = zero |
---|
864 | ENDDO |
---|
865 | |
---|
866 | DO m=1,npool |
---|
867 | WRITE (part_str, '(I1)') m |
---|
868 | var_name = 'adsdoc_z3_'//part_str(1:LEN_TRIM(part_str)) |
---|
869 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
870 | & .TRUE., DOC_g(:,:,3,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
871 | IF (ALL(DOC_g(:,:,3,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,3,iadsorbed,m,icarbon) = zero |
---|
872 | ENDDO |
---|
873 | |
---|
874 | DO m=1,npool |
---|
875 | WRITE (part_str, '(I1)') m |
---|
876 | var_name = 'adsdoc_z4_'//part_str(1:LEN_TRIM(part_str)) |
---|
877 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
878 | & .TRUE., DOC_g(:,:,4,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
879 | IF (ALL(DOC_g(:,:,4,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,4,iadsorbed,m,icarbon) = zero |
---|
880 | ENDDO |
---|
881 | |
---|
882 | DO m=1,npool |
---|
883 | WRITE (part_str, '(I1)') m |
---|
884 | var_name = 'adsdoc_z5_'//part_str(1:LEN_TRIM(part_str)) |
---|
885 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
886 | & .TRUE., DOC_g(:,:,5,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
887 | IF (ALL(DOC_g(:,:,5,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,5,iadsorbed,m,icarbon) = zero |
---|
888 | ENDDO |
---|
889 | |
---|
890 | DO m=1,npool |
---|
891 | WRITE (part_str, '(I1)') m |
---|
892 | var_name = 'adsdoc_z6_'//part_str(1:LEN_TRIM(part_str)) |
---|
893 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
894 | & .TRUE., DOC_g(:,:,6,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
895 | IF (ALL(DOC_g(:,:,6,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,6,iadsorbed,m,icarbon) = zero |
---|
896 | ENDDO |
---|
897 | |
---|
898 | DO m=1,npool |
---|
899 | WRITE (part_str, '(I1)') m |
---|
900 | var_name = 'adsdoc_z7_'//part_str(1:LEN_TRIM(part_str)) |
---|
901 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
902 | & .TRUE., DOC_g(:,:,7,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
903 | IF (ALL(DOC_g(:,:,7,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,7,iadsorbed,m,icarbon) = zero |
---|
904 | ENDDO |
---|
905 | |
---|
906 | DO m=1,npool |
---|
907 | WRITE (part_str, '(I1)') m |
---|
908 | var_name = 'adsdoc_z8_'//part_str(1:LEN_TRIM(part_str)) |
---|
909 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
910 | & .TRUE., DOC_g(:,:,8,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
911 | IF (ALL(DOC_g(:,:,8,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,8,iadsorbed,m,icarbon) = zero |
---|
912 | ENDDO |
---|
913 | |
---|
914 | DO m=1,npool |
---|
915 | WRITE (part_str, '(I1)') m |
---|
916 | var_name = 'adsdoc_z9_'//part_str(1:LEN_TRIM(part_str)) |
---|
917 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
918 | & .TRUE., DOC_g(:,:,9,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
919 | IF (ALL(DOC_g(:,:,9,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,9,iadsorbed,m,icarbon) = zero |
---|
920 | ENDDO |
---|
921 | |
---|
922 | DO m=1,npool |
---|
923 | WRITE (part_str, '(I1)') m |
---|
924 | var_name = 'adsdoc_z10_'//part_str(1:LEN_TRIM(part_str)) |
---|
925 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
926 | & .TRUE., DOC_g(:,:,10,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
927 | IF (ALL(DOC_g(:,:,10,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,10,iadsorbed,m,icarbon) = zero |
---|
928 | ENDDO |
---|
929 | |
---|
930 | DO m=1,npool |
---|
931 | WRITE (part_str, '(I1)') m |
---|
932 | var_name = 'adsdoc_z11_'//part_str(1:LEN_TRIM(part_str)) |
---|
933 | CALL restget (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
934 | & .TRUE., DOC_g(:,:,11,iadsorbed,m,icarbon), 'gather', nbp_glo, indices_g) |
---|
935 | IF (ALL(DOC_g(:,:,11,iadsorbed,m,icarbon) == val_exp)) DOC_g(:,:,11,iadsorbed,m,icarbon) = zero |
---|
936 | ENDDO |
---|
937 | |
---|
938 | ! TF-DOC |
---|
939 | ALLOCATE(interception_storage_g(nbp_glo,nvm,nelements)) |
---|
940 | interception_storage_g(:,:,:) = val_exp |
---|
941 | CALL restget (rest_id_sto, 'interception_storage_DOC', nbp_glo, nvm , 1, itau_dep, & |
---|
942 | & & .TRUE., interception_storage_g(:,:,icarbon), 'gather', nbp_glo, indices_g) |
---|
943 | IF (ALL(interception_storage_g(:,:,icarbon) == val_exp)) interception_storage_g(:,:,icarbon) = zero |
---|
944 | ! |
---|
945 | WRITE(numout,*) "date0 : ",date0, itau_dep |
---|
946 | !- |
---|
947 | ! Analytical spinup is set to false |
---|
948 | ! |
---|
949 | spinup_analytic = .FALSE. |
---|
950 | |
---|
951 | ! Length of the run (in Years) |
---|
952 | ! User value is used if present in the .def file |
---|
953 | ! If not, default value (10000 Years) is used |
---|
954 | !- |
---|
955 | WRITE(time_str,'(a)') '10000Y' |
---|
956 | CALL getin('TIME_LENGTH', time_str) |
---|
957 | write(numout,*) 'Number of years for carbon spinup : ',time_str |
---|
958 | ! transform into itau |
---|
959 | CALL tlen2itau(time_str, dt_forcesoil*one_day, date0, itau_len) |
---|
960 | write(numout,*) 'Number of time steps to do: ',itau_len |
---|
961 | !- |
---|
962 | ! read soil carbon inputs, water and temperature stresses on OM decomposition |
---|
963 | ! into the forcing file - We read an average year. |
---|
964 | !- |
---|
965 | ALLOCATE(soilcarbon_input_g(nbp_glo,nvm,nbdl,npool,nelements,nparan*nbyear)) |
---|
966 | ALLOCATE(floodcarbon_input_g(nbp_glo,nvm,npool,nelements,nparan*nbyear)) |
---|
967 | ALLOCATE(litter_above_g(nbp_glo,nlitt,nvm,nelements,nparan*nbyear)) |
---|
968 | ALLOCATE(litter_below_g(nbp_glo,nlitt,nvm,nbdl,nelements,nparan*nbyear)) |
---|
969 | ALLOCATE(lignin_struc_above_g(nbp_glo,nvm,nparan*nbyear)) |
---|
970 | ALLOCATE(lignin_struc_below_g(nbp_glo,nvm,nbdl,nparan*nbyear)) |
---|
971 | !- |
---|
972 | ALLOCATE(control_temp_soil_g(nbp_glo,nbdl,npool*2,nparan*nbyear)) |
---|
973 | ALLOCATE(control_moist_soil_g(nbp_glo,nbdl,nvm,nparan*nbyear)) |
---|
974 | ALLOCATE(moist_soil_g(nbp_glo,nbdl,nparan*nbyear)) |
---|
975 | ALLOCATE(soil_mc_g(nbp_glo,nbdl,nstm,nparan*nbyear)) |
---|
976 | ALLOCATE(floodout_g(nbp_glo,nparan*nbyear)) |
---|
977 | ALLOCATE(wat_flux0_g(nbp_glo,nstm,nparan*nbyear)) |
---|
978 | ALLOCATE(wat_flux_g(nbp_glo,nbdl,nstm,nparan*nbyear)) |
---|
979 | ALLOCATE(runoff_per_soil_g(nbp_glo,nstm,nparan*nbyear)) |
---|
980 | ALLOCATE(drainage_per_soil_g(nbp_glo,nstm,nparan*nbyear)) |
---|
981 | ALLOCATE(DOC_to_topsoil_g(nbp_glo,nflow,nparan*nbyear)) |
---|
982 | ALLOCATE(DOC_to_subsoil_g(nbp_glo,nflow,nparan*nbyear)) |
---|
983 | ALLOCATE(flood_frac_g(nbp_glo,nparan*nbyear)) |
---|
984 | !! TF-DOC |
---|
985 | ALLOCATE(precip2canopy_g(nbp_glo,nvm,nparan*nbyear)) |
---|
986 | ALLOCATE(precip2ground_g(nbp_glo,nvm,nparan*nbyear)) |
---|
987 | ALLOCATE(canopy2ground_g(nbp_glo,nvm,nparan*nbyear)) |
---|
988 | !- |
---|
989 | ier = NF90_INQ_VARID (Cforcing_id,'soilcarbon_input',v_id) |
---|
990 | ier = NF90_GET_VAR (Cforcing_id,v_id,soilcarbon_input_g) |
---|
991 | ier = NF90_INQ_VARID (Cforcing_id,'floodcarbon_input',v_id) |
---|
992 | ier = NF90_GET_VAR (Cforcing_id,v_id,soilcarbon_input_g) |
---|
993 | ier = NF90_INQ_VARID (Cforcing_id, 'control_moist_soil',v_id) |
---|
994 | ier = NF90_GET_VAR (Cforcing_id,v_id,control_moist_soil_g) |
---|
995 | ier = NF90_INQ_VARID (Cforcing_id, 'control_temp_soil',v_id) |
---|
996 | ier = NF90_GET_VAR (Cforcing_id,v_id,control_temp_soil_g) |
---|
997 | ier = NF90_INQ_VARID (Cforcing_id, 'litter_above',v_id) |
---|
998 | ier = NF90_GET_VAR (Cforcing_id,v_id,litter_above_g) |
---|
999 | ier = NF90_INQ_VARID (Cforcing_id, 'litter_below',v_id) |
---|
1000 | ier = NF90_GET_VAR (Cforcing_id,v_id,litter_below_g) |
---|
1001 | ier = NF90_INQ_VARID (Cforcing_id, 'moist_soil',v_id) |
---|
1002 | ier = NF90_GET_VAR (Cforcing_id,v_id,moist_soil_g) |
---|
1003 | ier = NF90_INQ_VARID (Cforcing_id, 'soil_mc',v_id) |
---|
1004 | ier = NF90_GET_VAR (Cforcing_id,v_id,soil_mc_g) |
---|
1005 | ier = NF90_INQ_VARID (Cforcing_id, 'floodout',v_id) |
---|
1006 | ier = NF90_GET_VAR (Cforcing_id,v_id,floodout_g) |
---|
1007 | ier = NF90_INQ_VARID (Cforcing_id, 'wat_flux0',v_id) |
---|
1008 | ier = NF90_GET_VAR (Cforcing_id,v_id,wat_flux0_g) |
---|
1009 | ier = NF90_INQ_VARID (Cforcing_id, 'wat_flux',v_id) |
---|
1010 | ier = NF90_GET_VAR (Cforcing_id,v_id,wat_flux_g) |
---|
1011 | ier = NF90_INQ_VARID (Cforcing_id, 'runoff_per_soil',v_id) |
---|
1012 | ier = NF90_GET_VAR (Cforcing_id,v_id,runoff_per_soil_g) |
---|
1013 | ier = NF90_INQ_VARID (Cforcing_id, 'drainage_per_soil',v_id) |
---|
1014 | ier = NF90_GET_VAR (Cforcing_id,v_id,drainage_per_soil_g) |
---|
1015 | ier = NF90_INQ_VARID (Cforcing_id, 'DOC_to_topsoil',v_id) |
---|
1016 | ier = NF90_GET_VAR (Cforcing_id,v_id,DOC_to_topsoil_g) |
---|
1017 | ier = NF90_INQ_VARID (Cforcing_id, 'DOC_to_subsoil',v_id) |
---|
1018 | ier = NF90_GET_VAR (Cforcing_id,v_id,DOC_to_subsoil_g) |
---|
1019 | ier = NF90_INQ_VARID (Cforcing_id, 'flood_frac',v_id) |
---|
1020 | ier = NF90_GET_VAR (Cforcing_id,v_id,flood_frac_g) |
---|
1021 | !! TF-DOC |
---|
1022 | ier = NF90_INQ_VARID (Cforcing_id, 'precip2canopy',v_id) |
---|
1023 | ier = NF90_GET_VAR (Cforcing_id,v_id,precip2canopy_g) |
---|
1024 | ier = NF90_INQ_VARID (Cforcing_id, 'precip2ground',v_id) |
---|
1025 | ier = NF90_GET_VAR (Cforcing_id,v_id,precip2ground_g) |
---|
1026 | ier = NF90_INQ_VARID (Cforcing_id, 'canopy2ground',v_id) |
---|
1027 | ier = NF90_GET_VAR (Cforcing_id,v_id,canopy2ground_g) |
---|
1028 | !- |
---|
1029 | ier = NF90_INQ_VARID (Cforcing_id, 'lignin_struc_above',v_id) |
---|
1030 | ier = NF90_GET_VAR (Cforcing_id,v_id,lignin_struc_above_g) |
---|
1031 | ier = NF90_INQ_VARID (Cforcing_id, 'lignin_struc_below',v_id) |
---|
1032 | ier = NF90_GET_VAR (Cforcing_id,v_id,lignin_struc_below_g) |
---|
1033 | !- |
---|
1034 | ier = NF90_CLOSE (Cforcing_id) |
---|
1035 | !- |
---|
1036 | ENDIF |
---|
1037 | CALL bcast(nparan) |
---|
1038 | CALL bcast(nbyear) |
---|
1039 | CALL bcast(dt_forcesoil) |
---|
1040 | CALL bcast(iim_g) |
---|
1041 | CALL bcast(jjm_g) |
---|
1042 | CALL bcast(nbp_glo) |
---|
1043 | CALL bcast(itau_dep) |
---|
1044 | CALL bcast(itau_len) |
---|
1045 | IF (.NOT. ALLOCATED(indices_g)) ALLOCATE (indices_g(nbp_glo)) |
---|
1046 | CALL bcast(indices_g) |
---|
1047 | |
---|
1048 | ! |
---|
1049 | ! We must initialize data_para : |
---|
1050 | CALL init_orchidee_data_para_driver(nbp_glo,indices_g) |
---|
1051 | |
---|
1052 | kjpindex=nbp_loc |
---|
1053 | jjm=jj_nb |
---|
1054 | iim=iim_g |
---|
1055 | IF (debug) WRITE(numout,*) "Local grid : ",kjpindex,iim,jjm |
---|
1056 | |
---|
1057 | !--- |
---|
1058 | !--- Create the index table |
---|
1059 | !--- |
---|
1060 | !--- This job returns a LOCAL kindex. |
---|
1061 | !--- |
---|
1062 | ALLOCATE (indices(kjpindex),stat=ier) |
---|
1063 | ! |
---|
1064 | !! scattering to all processes in parallel mode |
---|
1065 | ! |
---|
1066 | CALL scatter(indices_g,indices) |
---|
1067 | indices(1:kjpindex)=indices(1:kjpindex)-(jj_begin-1)*iim_g |
---|
1068 | IF (debug) WRITE(numout,*) mpi_rank,"indices locaux = ",indices(1:kjpindex) |
---|
1069 | !- |
---|
1070 | ! Allocation of the variables for a processor |
---|
1071 | !- |
---|
1072 | ALLOCATE(clay(kjpindex)) |
---|
1073 | ALLOCATE(soil_ph(kjpindex)) |
---|
1074 | ALLOCATE(poor_soils(kjpindex)) |
---|
1075 | ALLOCATE(bulk_dens(kjpindex)) |
---|
1076 | ALLOCATE(soiltile(kjpindex,nstm)) |
---|
1077 | ALLOCATE(veget_max(kjpindex,nvm)) |
---|
1078 | ALLOCATE(soilcarbon_input(kjpindex,nvm,nbdl,npool,nelements,nparan*nbyear)) |
---|
1079 | ALLOCATE(floodcarbon_input(kjpindex,nvm,npool,nelements,nparan*nbyear)) |
---|
1080 | ALLOCATE(control_temp_soil(kjpindex,nbdl,npool*2,nparan*nbyear)) |
---|
1081 | ALLOCATE(control_moist_soil(kjpindex,nbdl,nvm,nparan*nbyear)) |
---|
1082 | ALLOCATE(carbon(kjpindex,ncarb,nvm,nbdl)) |
---|
1083 | ALLOCATE(litter_above(kjpindex,nlitt,nvm,nelements,nparan*nbyear)) |
---|
1084 | ALLOCATE(litter_below(kjpindex,nlitt,nvm,nbdl,nelements,nparan*nbyear)) |
---|
1085 | ALLOCATE(resp_hetero_soil(kjpindex,nvm)) |
---|
1086 | ALLOCATE(resp_flood_soil(kjpindex,nvm)) |
---|
1087 | ALLOCATE(soilhum(kjpindex,nbdl)) |
---|
1088 | ALLOCATE(moist_soil(kjpindex,nbdl,nparan*nbyear)) |
---|
1089 | ALLOCATE(soil_mc(kjpindex,nbdl,nstm,nparan*nbyear)) |
---|
1090 | ALLOCATE(floodout(kjpindex,nparan*nbyear)) |
---|
1091 | ALLOCATE(wat_flux0(kjpindex,nstm,nparan*nbyear)) |
---|
1092 | ALLOCATE(wat_flux(kjpindex,nbdl,nstm,nparan*nbyear)) |
---|
1093 | ALLOCATE(runoff_per_soil(kjpindex,nstm,nparan*nbyear)) |
---|
1094 | ALLOCATE(drainage_per_soil(kjpindex,nstm,nparan*nbyear)) |
---|
1095 | ALLOCATE(DOC_to_topsoil(kjpindex,nflow,nparan*nbyear)) |
---|
1096 | ALLOCATE(DOC_to_subsoil(kjpindex,nflow,nparan*nbyear)) |
---|
1097 | ALLOCATE(flood_frac(kjpindex,nparan*nbyear)) |
---|
1098 | ALLOCATE(DOC(kjpindex,nvm,nbdl,ndoc,npool,nelements)) |
---|
1099 | ALLOCATE(DOC_EXP(kjpindex,nvm,nexp,npool,nelements)) |
---|
1100 | ALLOCATE(lignin_struc_above(kjpindex,nvm,nparan*nbyear)) |
---|
1101 | ALLOCATE(lignin_struc_below(kjpindex,nvm,nbdl,nparan*nbyear)) |
---|
1102 | ! TF-DOC |
---|
1103 | ALLOCATE(dry_dep_canopy(kjpindex,nvm,nelements,nparan*nbyear)) |
---|
1104 | ALLOCATE(DOC_precip2canopy(kjpindex,nvm,nelements,nparan*nbyear)) |
---|
1105 | ALLOCATE(DOC_precip2ground(kjpindex,nvm,nelements,nparan*nbyear)) |
---|
1106 | ALLOCATE(DOC_canopy2ground(kjpindex,nvm,nelements,nparan*nbyear)) |
---|
1107 | ALLOCATE(DOC_infil(kjpindex,nvm,nelements,nparan*nbyear)) |
---|
1108 | ALLOCATE(DOC_noinfil(kjpindex,nvm,nelements,nparan*nbyear)) |
---|
1109 | ALLOCATE(interception_storage(kjpindex,nvm,nelements)) |
---|
1110 | ALLOCATE(precip2canopy(kjpindex,nvm,nparan*nbyear)) |
---|
1111 | ALLOCATE(precip2ground(kjpindex,nvm,nparan*nbyear)) |
---|
1112 | ALLOCATE(canopy2ground(kjpindex,nvm,nparan*nbyear)) |
---|
1113 | ALLOCATE(biomass(kjpindex,nvm,nparts,nelements,nparan*nbyear)) |
---|
1114 | flood_frac = zero |
---|
1115 | iatt = 0 |
---|
1116 | !- |
---|
1117 | ! Initialization of the variables for a processor |
---|
1118 | !- |
---|
1119 | CALL Scatter(clay_g,clay) |
---|
1120 | CALL Scatter(soil_ph_g,soil_ph) |
---|
1121 | CALL Scatter(bulk_dens_g,bulk_dens) |
---|
1122 | CALL Scatter(soiltile_g,soiltile) |
---|
1123 | CALL Scatter(veget_max_g,veget_max) |
---|
1124 | DO m =1,nvm |
---|
1125 | DO l=1,nbdl |
---|
1126 | DO i=1,npool |
---|
1127 | CALL Scatter(soilcarbon_input_g(:,m,l,i,:,:),soilcarbon_input(:,m,l,i,:,:)) |
---|
1128 | ENDDO |
---|
1129 | ENDDO |
---|
1130 | ENDDO |
---|
1131 | DO m =1,nvm |
---|
1132 | DO i=1,npool |
---|
1133 | CALL Scatter(floodcarbon_input_g(:,m,i,:,:),floodcarbon_input(:,m,i,:,:)) |
---|
1134 | ENDDO |
---|
1135 | ENDDO |
---|
1136 | DO i =1,nlitt |
---|
1137 | DO j=1,nvm |
---|
1138 | CALL Scatter(litter_above_g(:,i,j,:,:),litter_above(:,i,j,:,:)) |
---|
1139 | ENDDO |
---|
1140 | ENDDO |
---|
1141 | |
---|
1142 | DO i =1,nlitt |
---|
1143 | DO j=1,nvm |
---|
1144 | DO k = 1,nbdl |
---|
1145 | CALL Scatter(litter_below_g(:,i,j,k,:,:),litter_below(:,i,j,k,:,:)) |
---|
1146 | ENDDO |
---|
1147 | ENDDO |
---|
1148 | ENDDO |
---|
1149 | CALL Scatter(control_temp_soil_g,control_temp_soil) |
---|
1150 | CALL Scatter(control_moist_soil_g,control_moist_soil) |
---|
1151 | CALL Scatter(moist_soil_g,moist_soil) |
---|
1152 | CALL Scatter(soil_mc_g,soil_mc) |
---|
1153 | CALL Scatter(floodout_g,floodout) |
---|
1154 | CALL Scatter(wat_flux0_g,wat_flux0) |
---|
1155 | CALL Scatter(wat_flux_g,wat_flux) |
---|
1156 | CALL Scatter(runoff_per_soil_g,runoff_per_soil) |
---|
1157 | CALL Scatter(drainage_per_soil_g,drainage_per_soil) |
---|
1158 | CALL Scatter(DOC_to_topsoil_g,DOC_to_topsoil) |
---|
1159 | CALL Scatter(DOC_to_subsoil_g,DOC_to_subsoil) |
---|
1160 | CALL Scatter(flood_frac_g,flood_frac) |
---|
1161 | !TF-DOC |
---|
1162 | CALL Scatter(precip2canopy_g,precip2canopy) |
---|
1163 | CALL Scatter(precip2ground_g,precip2ground) |
---|
1164 | CALL Scatter(canopy2ground_g,canopy2ground) |
---|
1165 | CALL Scatter(interception_storage_g,interception_storage) |
---|
1166 | DO m =1,nvm |
---|
1167 | DO l=1,nbdl |
---|
1168 | CALL Scatter(carbon_g(:,:,m,l),carbon(:,:,m,l)) |
---|
1169 | ENDDO |
---|
1170 | ENDDO |
---|
1171 | DO m =1,nbdl |
---|
1172 | DO l=1,ndoc |
---|
1173 | DO i= 1,npool |
---|
1174 | CALL Scatter(DOC_g(:,:,m,l,i,icarbon),DOC(:,:,m,l,i,icarbon)) |
---|
1175 | ENDDO |
---|
1176 | ENDDO |
---|
1177 | ENDDO |
---|
1178 | DO j=1,nvm |
---|
1179 | CALL Scatter(lignin_struc_above_g(:,j,:),lignin_struc_above(:,j,:)) |
---|
1180 | ENDDO |
---|
1181 | DO j=1,nvm |
---|
1182 | DO k = 1,nbdl |
---|
1183 | CALL Scatter(lignin_struc_below_g(:,j,k,:),lignin_struc_below(:,j,k,:)) |
---|
1184 | ENDDO |
---|
1185 | ENDDO |
---|
1186 | !- |
---|
1187 | ! Configu |
---|
1188 | !- |
---|
1189 | |
---|
1190 | !Config Key = FRAC_CARB_AP |
---|
1191 | !Config Desc = frac carb coefficients from active pool: depends on clay content |
---|
1192 | !Config if = OK_STOMATE |
---|
1193 | !Config Def = 0.004 |
---|
1194 | !Config Help = fraction of the active pool going to the passive pool |
---|
1195 | !Config Units = [-] |
---|
1196 | CALL getin_p('FRAC_CARB_AP',frac_carb_ap) |
---|
1197 | ! |
---|
1198 | !Config Key = FRAC_CARB_SA |
---|
1199 | !Config Desc = frac_carb_coefficients from slow pool |
---|
1200 | !Config if = OK_STOMATE |
---|
1201 | !Config Def = 0.42 |
---|
1202 | !Config Help = fraction of the slow pool going to the active pool |
---|
1203 | !Config Units = [-] |
---|
1204 | CALL getin_p('FRAC_CARB_SA',frac_carb_sa) |
---|
1205 | ! |
---|
1206 | !Config Key = FRAC_CARB_SP |
---|
1207 | !Config Desc = frac_carb_coefficients from slow pool |
---|
1208 | !Config if = OK_STOMATE |
---|
1209 | !Config Def = 0.03 |
---|
1210 | !Config Help = fraction of the slow pool going to the passive pool |
---|
1211 | !Config Units = [-] |
---|
1212 | !CALL getin_p('FRAC_CARB_SP',frac_carb_sp) |
---|
1213 | ! |
---|
1214 | !Config Key = FRAC_CARB_PA |
---|
1215 | !Config Desc = frac_carb_coefficients from passive pool |
---|
1216 | !Config if = OK_STOMATE |
---|
1217 | !Config Def = 0.45 |
---|
1218 | !Config Help = fraction of the passive pool going to the passive pool |
---|
1219 | !Config Units = [-] |
---|
1220 | CALL getin_p('FRAC_CARB_PA',frac_carb_pa) |
---|
1221 | ! |
---|
1222 | !Config Key = FRAC_CARB_PS |
---|
1223 | !Config Desc = frac_carb_coefficients from passive pool |
---|
1224 | !Config if = OK_STOMATE |
---|
1225 | !Config Def = 0.0 |
---|
1226 | !Config Help = fraction of the passive pool going to the passive pool |
---|
1227 | !Config Units = [-] |
---|
1228 | !CALL getin_p('FRAC_CARB_PS',frac_carb_ps) |
---|
1229 | ! |
---|
1230 | !Config Key = ACTIVE_TO_PASS_CLAY_FRAC |
---|
1231 | !Config Desc = |
---|
1232 | !Config if = OK_STOMATE |
---|
1233 | !Config Def = .68 |
---|
1234 | !Config Help = |
---|
1235 | !Config Units = [-] |
---|
1236 | CALL getin_p('ACTIVE_TO_PASS_CLAY_FRAC',active_to_pass_clay_frac) |
---|
1237 | ! |
---|
1238 | !Config Key = CARBON_TAU_IACTIVE |
---|
1239 | !Config Desc = residence times in carbon pools |
---|
1240 | !Config if = OK_STOMATE |
---|
1241 | !Config Def = 0.3 |
---|
1242 | !Config Help = |
---|
1243 | !Config Units = [days] |
---|
1244 | CALL getin_p('CARBON_TAU_IACTIVE',carbon_tau_iactive) |
---|
1245 | ! |
---|
1246 | !Config Key = CARBON_TAU_ISLOW |
---|
1247 | !Config Desc = residence times in carbon pools |
---|
1248 | !Config if = OK_STOMATE |
---|
1249 | !Config Def = 1.12 |
---|
1250 | !Config Help = |
---|
1251 | !Config Units = [days] |
---|
1252 | CALL getin_p('CARBON_TAU_ISLOW',carbon_tau_islow) |
---|
1253 | ! |
---|
1254 | !Config Key = CARBON_TAU_IPASSIVE |
---|
1255 | !Config Desc = residence times in carbon pools |
---|
1256 | !Config if = OK_STOMATE |
---|
1257 | !Config Def = 461.98 |
---|
1258 | !Config Help = residence time in the passive pool |
---|
1259 | !Config Units = [days] |
---|
1260 | CALL getin_p('CARBON_TAU_IPASSIVE',carbon_tau_ipassive) |
---|
1261 | ! |
---|
1262 | !Config Key = PRIMING_PARAM_IACTIVE |
---|
1263 | !Config Desc = priming parameter in carbon pools |
---|
1264 | !Config if = OK_STOMATE |
---|
1265 | !Config Def = 493.66 |
---|
1266 | !Config Help = |
---|
1267 | !Config Units = [-] |
---|
1268 | CALL getin_p('PRIMING_PARAM_IACTIVE',priming_param_iactive) |
---|
1269 | ! |
---|
1270 | !Config Key = PRIMING_PARAM_ISLOW |
---|
1271 | !Config Desc = priming parameter in carbon pools |
---|
1272 | !Config if = OK_STOMATE |
---|
1273 | !Config Def = 194.03 |
---|
1274 | !Config Help = |
---|
1275 | !Config Units = [-] |
---|
1276 | CALL getin_p('PRIMING_PARAM_ISLOW',priming_param_islow) |
---|
1277 | ! |
---|
1278 | !Config Key = PRIMING_PARAM_IPASSIVE |
---|
1279 | !Config Desc = priming parameter in carbon pools |
---|
1280 | !Config if = OK_STOMATE |
---|
1281 | !Config Def = 136.54 |
---|
1282 | !Config Help = |
---|
1283 | !Config Units = [-] |
---|
1284 | CALL getin_p('PRIMING_PARAM_IPASSIVE',priming_param_ipassive) |
---|
1285 | ! |
---|
1286 | ! !Config Key = BULK_DENSITY |
---|
1287 | ! !Config Desc = value of the soil bulk density |
---|
1288 | ! !Config if = READ_BULK_DENSITY |
---|
1289 | ! !Config Def = 1.65 |
---|
1290 | ! !Config Help = |
---|
1291 | ! !Config Units = [kg m-3] |
---|
1292 | ! CALL getin_p('BULK_DENSITY',bulk_dens) |
---|
1293 | ! |
---|
1294 | !Config Key = FLUX_TOT_COEFF |
---|
1295 | !Config Desc = |
---|
1296 | !Config if = OK_STOMATE |
---|
1297 | !Config Def = 1.2, 1.4,.75 |
---|
1298 | !Config Help = |
---|
1299 | !Config Units = [days] |
---|
1300 | CALL getin_p('FLUX_TOT_COEFF',flux_tot_coeff) |
---|
1301 | ! |
---|
1302 | !Config Key = PREF_SOIL_VEG |
---|
1303 | !Config Desc = The soil tile number for each vegetation |
---|
1304 | !Config if = OK_SECHIBA or OK_STOMATE |
---|
1305 | !Config Def = 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3 |
---|
1306 | !Config Help = Gives the number of the soil tile on which we will |
---|
1307 | !Config put each vegetation. This allows to divide the |
---|
1308 | !hydrological column |
---|
1309 | !Config Units = [-] |
---|
1310 | CALL getin_p('PREF_SOIL_VEG',pref_soil_veg) |
---|
1311 | ! |
---|
1312 | !Config Key = DOC_tau_labile |
---|
1313 | !Config Desc = residence time of labile DOC |
---|
1314 | !Config if = OK_STOMATE |
---|
1315 | !Config Def = 3.76 |
---|
1316 | !Config Help = mean from Kalbitz et al., 2003 Geoderma |
---|
1317 | !Config Units = [days] |
---|
1318 | CALL getin_p('DOC_TAU_LABILE',DOC_tau_labile) |
---|
1319 | ! |
---|
1320 | !Config Key = DOC_tau_stable |
---|
1321 | !Config Desc = residence time of stable DOC |
---|
1322 | !Config if = OK_STOMATE |
---|
1323 | !Config Def = 602.41 |
---|
1324 | !Config Help = mean from Kalbitz et al., 2003 Geoderma |
---|
1325 | !Config Units = [days] |
---|
1326 | CALL getin_p('DOC_TAU_STABLE',DOC_tau_stable) |
---|
1327 | ! |
---|
1328 | !!Config Key = D_DOC |
---|
1329 | !Config Desc = diffusion coefficient of DOC |
---|
1330 | !Config if = OK_STOMATE |
---|
1331 | !Config Def = 0.0000004428 |
---|
1332 | !Config Help = from Burdige et al., 1999 in Ota et al., 2013 |
---|
1333 | !Config Units = [m^2 hr-1] |
---|
1334 | CALL getin_p('D_DOC',D_DOC) |
---|
1335 | ! |
---|
1336 | !!Config Key = Dif |
---|
1337 | !Config Desc = diffusion coefficient of POC |
---|
1338 | !Config if = OK_STOMATE |
---|
1339 | !Config Def = 1E-4 |
---|
1340 | !Config Help = from Koven et al., 2013 BG |
---|
1341 | !Config Units = [m^2 day-1] |
---|
1342 | CALL getin_p('Dif',Dif) |
---|
1343 | ! |
---|
1344 | !!Config Key = CUE |
---|
1345 | !Config Desc = Microbial carbon use efficiency |
---|
1346 | !Config if = OK_STOMATE |
---|
1347 | !Config Def = 0.5 |
---|
1348 | !Config Help = Assumed value of CUE=0.5 |
---|
1349 | !Config Units = [-] |
---|
1350 | CALL getin_p('CUE',CUE) |
---|
1351 | |
---|
1352 | !!- |
---|
1353 | !! 2. Computational step |
---|
1354 | !! Loop over time - Call of soilcarbon routine at each time step |
---|
1355 | !! Updated soil carbon stocks are stored into carbon variable |
---|
1356 | !! We only keep the last value of carbon variable (no time dimension). |
---|
1357 | !!- |
---|
1358 | iyear=1 |
---|
1359 | DO i=1,itau_len |
---|
1360 | iatt = iatt+1 |
---|
1361 | IF (iatt > nparan*nbyear) THEN |
---|
1362 | IF (debug) WRITE(numout,*) iyear |
---|
1363 | iatt = 1 |
---|
1364 | iyear=iyear+1 |
---|
1365 | ENDIF |
---|
1366 | |
---|
1367 | ! Get diaglev from module vertical for CWRR |
---|
1368 | diaglev=znt(1:nbdl) |
---|
1369 | |
---|
1370 | CALL soilcarbon & |
---|
1371 | & (kjpindex, dt_forcesoil, clay, & |
---|
1372 | & soilcarbon_input(:,:,:,:,:,iatt),floodcarbon_input(:,:,:,:,iatt), control_temp_soil(:,:,:,iatt), control_moist_soil(:,:,:,iatt), & |
---|
1373 | & carbon, resp_hetero_soil, resp_flood_soil, & |
---|
1374 | & litter_above(:,:,:,:,iatt),litter_below(:,:,:,:,:,iatt),& |
---|
1375 | & soilhum, DOC, moist_soil(:,:,iatt), DOC_EXP,& |
---|
1376 | & lignin_struc_above(:,:,iatt), lignin_struc_below(:,:,:,iatt),& |
---|
1377 | & floodout(:,iatt), runoff_per_soil(:,:,iatt), drainage_per_soil(:,:,iatt), wat_flux0(:,:,iatt), & |
---|
1378 | & wat_flux(:,:,:,iatt),bulk_dens, soil_ph, poor_soils, veget_max, soil_mc(:,:,:,iatt), soiltile, & |
---|
1379 | & DOC_to_topsoil(:,:,iatt), DOC_to_subsoil(:,:,iatt), flood_frac(:,iatt), & |
---|
1380 | & precip2ground(:,:,iatt), precip2canopy(:,:,iatt), canopy2ground(:,:,iatt), & |
---|
1381 | & dry_dep_canopy(:,:,:,iatt), DOC_precip2ground(:,:,:,iatt), & |
---|
1382 | & DOC_precip2canopy(:,:,:,iatt), DOC_canopy2ground(:,:,:,iatt), & |
---|
1383 | & DOC_infil(:,:,:,iatt), DOC_noinfil(:,:,:,iatt), interception_storage, biomass(:,:,:,:,iatt), runoff_per_soil(:,2,iatt)) |
---|
1384 | ENDDO |
---|
1385 | WRITE(numout,*) "End of soilcarbon LOOP." |
---|
1386 | |
---|
1387 | ! |
---|
1388 | !! Gathering of variables towards main processor in parallel mode |
---|
1389 | ! |
---|
1390 | DO m =1,nvm |
---|
1391 | DO l=1,nbdl |
---|
1392 | CALL Gather(carbon(:,:,m,l),carbon_g(:,:,m,l)) |
---|
1393 | ENDDO |
---|
1394 | ENDDO |
---|
1395 | DO m =1,nbdl |
---|
1396 | DO l=1,ndoc |
---|
1397 | DO i= 1,npool |
---|
1398 | CALL Gather(DOC(:,:,m,l,i,icarbon),DOC_g(:,:,m,l,i,icarbon)) |
---|
1399 | ENDDO |
---|
1400 | ENDDO |
---|
1401 | ENDDO |
---|
1402 | ! TF-DOC |
---|
1403 | CALL Gather(interception_storage,interception_storage_g) |
---|
1404 | !!- |
---|
1405 | !! 3. write new carbon stocks into the ouput restart file |
---|
1406 | !!- |
---|
1407 | IF (is_root_prc) THEN |
---|
1408 | DO m=1,nvm |
---|
1409 | WRITE (part_str, '(I2)') m |
---|
1410 | IF (m<10) part_str(1:1)='0' |
---|
1411 | var_name = 'carbon_z01_'//part_str(1:LEN_TRIM(part_str)) |
---|
1412 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1413 | & carbon_g(:,:,m,1), 'scatter', nbp_glo, indices_g) |
---|
1414 | ENDDO |
---|
1415 | DO m=1,nvm |
---|
1416 | WRITE (part_str, '(I2)') m |
---|
1417 | IF (m<10) part_str(1:1)='0' |
---|
1418 | var_name = 'carbon_z02_'//part_str(1:LEN_TRIM(part_str)) |
---|
1419 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1420 | & carbon_g(:,:,m,2), 'scatter', nbp_glo, indices_g) |
---|
1421 | ENDDO |
---|
1422 | |
---|
1423 | DO m=1,nvm |
---|
1424 | WRITE (part_str, '(I2)') m |
---|
1425 | IF (m<10) part_str(1:1)='0' |
---|
1426 | var_name = 'carbon_z03_'//part_str(1:LEN_TRIM(part_str)) |
---|
1427 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1428 | & carbon_g(:,:,m,3), 'scatter', nbp_glo, indices_g) |
---|
1429 | ENDDO |
---|
1430 | |
---|
1431 | DO m=1,nvm |
---|
1432 | WRITE (part_str, '(I2)') m |
---|
1433 | IF (m<10) part_str(1:1)='0' |
---|
1434 | var_name = 'carbon_z04_'//part_str(1:LEN_TRIM(part_str)) |
---|
1435 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1436 | & carbon_g(:,:,m,4), 'scatter', nbp_glo, indices_g) |
---|
1437 | ENDDO |
---|
1438 | |
---|
1439 | DO m=1,nvm |
---|
1440 | WRITE (part_str, '(I2)') m |
---|
1441 | IF (m<10) part_str(1:1)='0' |
---|
1442 | var_name = 'carbon_z05_'//part_str(1:LEN_TRIM(part_str)) |
---|
1443 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1444 | & carbon_g(:,:,m,5), 'scatter', nbp_glo, indices_g) |
---|
1445 | ENDDO |
---|
1446 | |
---|
1447 | DO m=1,nvm |
---|
1448 | WRITE (part_str, '(I2)') m |
---|
1449 | IF (m<10) part_str(1:1)='0' |
---|
1450 | var_name = 'carbon_z06_'//part_str(1:LEN_TRIM(part_str)) |
---|
1451 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1452 | & carbon_g(:,:,m,6), 'scatter', nbp_glo, indices_g) |
---|
1453 | ENDDO |
---|
1454 | |
---|
1455 | DO m=1,nvm |
---|
1456 | WRITE (part_str, '(I2)') m |
---|
1457 | IF (m<10) part_str(1:1)='0' |
---|
1458 | var_name = 'carbon_z07_'//part_str(1:LEN_TRIM(part_str)) |
---|
1459 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1460 | & carbon_g(:,:,m,7), 'scatter', nbp_glo, indices_g) |
---|
1461 | ENDDO |
---|
1462 | |
---|
1463 | DO m=1,nvm |
---|
1464 | WRITE (part_str, '(I2)') m |
---|
1465 | IF (m<10) part_str(1:1)='0' |
---|
1466 | var_name = 'carbon_z07_'//part_str(1:LEN_TRIM(part_str)) |
---|
1467 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1468 | & carbon_g(:,:,m,7), 'scatter', nbp_glo, indices_g) |
---|
1469 | ENDDO |
---|
1470 | |
---|
1471 | DO m=1,nvm |
---|
1472 | WRITE (part_str, '(I2)') m |
---|
1473 | IF (m<10) part_str(1:1)='0' |
---|
1474 | var_name = 'carbon_z08_'//part_str(1:LEN_TRIM(part_str)) |
---|
1475 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1476 | & carbon_g(:,:,m,8), 'scatter', nbp_glo, indices_g) |
---|
1477 | ENDDO |
---|
1478 | |
---|
1479 | DO m=1,nvm |
---|
1480 | WRITE (part_str, '(I2)') m |
---|
1481 | IF (m<10) part_str(1:1)='0' |
---|
1482 | var_name = 'carbon_z09_'//part_str(1:LEN_TRIM(part_str)) |
---|
1483 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1484 | & carbon_g(:,:,m,9), 'scatter', nbp_glo, indices_g) |
---|
1485 | ENDDO |
---|
1486 | |
---|
1487 | DO m=1,nvm |
---|
1488 | WRITE (part_str, '(I2)') m |
---|
1489 | IF (m<10) part_str(1:1)='0' |
---|
1490 | var_name = 'carbon_z10_'//part_str(1:LEN_TRIM(part_str)) |
---|
1491 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1492 | & carbon_g(:,:,m,10), 'scatter', nbp_glo, indices_g) |
---|
1493 | ENDDO |
---|
1494 | |
---|
1495 | DO m=1,nvm |
---|
1496 | WRITE (part_str, '(I2)') m |
---|
1497 | IF (m<10) part_str(1:1)='0' |
---|
1498 | var_name = 'carbon_z11_'//part_str(1:LEN_TRIM(part_str)) |
---|
1499 | CALL restput (rest_id_sto, var_name, nbp_glo, ncarb, 1, itau_dep, & |
---|
1500 | & carbon_g(:,:,m,11), 'scatter', nbp_glo, indices_g) |
---|
1501 | ENDDO |
---|
1502 | |
---|
1503 | DO m=1,npool |
---|
1504 | WRITE (part_str, '(I1)') m |
---|
1505 | var_name = 'freedoc_z1_'//part_str(1:LEN_TRIM(part_str)) |
---|
1506 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1507 | & DOC_g(:,:,1,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1508 | ENDDO |
---|
1509 | |
---|
1510 | DO m=1,npool |
---|
1511 | WRITE (part_str, '(I1)') m |
---|
1512 | var_name = 'freedoc_z2_'//part_str(1:LEN_TRIM(part_str)) |
---|
1513 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1514 | & DOC_g(:,:,2,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1515 | ENDDO |
---|
1516 | |
---|
1517 | DO m=1,npool |
---|
1518 | WRITE (part_str, '(I1)') m |
---|
1519 | var_name = 'freedoc_z3_'//part_str(1:LEN_TRIM(part_str)) |
---|
1520 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1521 | & DOC_g(:,:,3,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1522 | ENDDO |
---|
1523 | |
---|
1524 | DO m=1,npool |
---|
1525 | WRITE (part_str, '(I1)') m |
---|
1526 | var_name = 'freedoc_z4_'//part_str(1:LEN_TRIM(part_str)) |
---|
1527 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1528 | & DOC_g(:,:,4,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1529 | ENDDO |
---|
1530 | |
---|
1531 | DO m=1,npool |
---|
1532 | WRITE (part_str, '(I1)') m |
---|
1533 | var_name = 'freedoc_z5_'//part_str(1:LEN_TRIM(part_str)) |
---|
1534 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1535 | & DOC_g(:,:,5,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1536 | ENDDO |
---|
1537 | |
---|
1538 | DO m=1,npool |
---|
1539 | WRITE (part_str, '(I1)') m |
---|
1540 | var_name = 'freedoc_z6_'//part_str(1:LEN_TRIM(part_str)) |
---|
1541 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1542 | & DOC_g(:,:,6,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1543 | ENDDO |
---|
1544 | |
---|
1545 | DO m=1,npool |
---|
1546 | WRITE (part_str, '(I1)') m |
---|
1547 | var_name = 'freedoc_z7_'//part_str(1:LEN_TRIM(part_str)) |
---|
1548 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1549 | & DOC_g(:,:,7,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1550 | ENDDO |
---|
1551 | |
---|
1552 | DO m=1,npool |
---|
1553 | WRITE (part_str, '(I1)') m |
---|
1554 | var_name = 'freedoc_z8_'//part_str(1:LEN_TRIM(part_str)) |
---|
1555 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1556 | & DOC_g(:,:,8,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1557 | ENDDO |
---|
1558 | |
---|
1559 | DO m=1,npool |
---|
1560 | WRITE (part_str, '(I1)') m |
---|
1561 | var_name = 'freedoc_z9_'//part_str(1:LEN_TRIM(part_str)) |
---|
1562 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1563 | & DOC_g(:,:,9,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1564 | ENDDO |
---|
1565 | |
---|
1566 | DO m=1,npool |
---|
1567 | WRITE (part_str, '(I1)') m |
---|
1568 | var_name = 'freedoc_z10_'//part_str(1:LEN_TRIM(part_str)) |
---|
1569 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1570 | & DOC_g(:,:,10,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1571 | ENDDO |
---|
1572 | |
---|
1573 | DO m=1,npool |
---|
1574 | WRITE (part_str, '(I1)') m |
---|
1575 | var_name = 'freedoc_z11_'//part_str(1:LEN_TRIM(part_str)) |
---|
1576 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1577 | & DOC_g(:,:,11,ifree,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1578 | ENDDO |
---|
1579 | |
---|
1580 | DO m=1,npool |
---|
1581 | WRITE (part_str, '(I1)') m |
---|
1582 | var_name = 'adsdoc_z1_'//part_str(1:LEN_TRIM(part_str)) |
---|
1583 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1584 | & DOC_g(:,:,1,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1585 | ENDDO |
---|
1586 | |
---|
1587 | DO m=1,npool |
---|
1588 | WRITE (part_str, '(I1)') m |
---|
1589 | var_name = 'adsdoc_z2_'//part_str(1:LEN_TRIM(part_str)) |
---|
1590 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1591 | & DOC_g(:,:,2,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1592 | ENDDO |
---|
1593 | |
---|
1594 | DO m=1,npool |
---|
1595 | WRITE (part_str, '(I1)') m |
---|
1596 | var_name = 'adsdoc_z3_'//part_str(1:LEN_TRIM(part_str)) |
---|
1597 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1598 | & DOC_g(:,:,3,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1599 | ENDDO |
---|
1600 | |
---|
1601 | DO m=1,npool |
---|
1602 | WRITE (part_str, '(I1)') m |
---|
1603 | var_name = 'adsdoc_z4_'//part_str(1:LEN_TRIM(part_str)) |
---|
1604 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1605 | & DOC_g(:,:,4,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1606 | ENDDO |
---|
1607 | |
---|
1608 | DO m=1,npool |
---|
1609 | WRITE (part_str, '(I1)') m |
---|
1610 | var_name = 'adsdoc_z5_'//part_str(1:LEN_TRIM(part_str)) |
---|
1611 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1612 | & DOC_g(:,:,5,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1613 | ENDDO |
---|
1614 | |
---|
1615 | DO m=1,npool |
---|
1616 | WRITE (part_str, '(I1)') m |
---|
1617 | var_name = 'adsdoc_z6_'//part_str(1:LEN_TRIM(part_str)) |
---|
1618 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1619 | & DOC_g(:,:,6,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1620 | ENDDO |
---|
1621 | |
---|
1622 | DO m=1,npool |
---|
1623 | WRITE (part_str, '(I1)') m |
---|
1624 | var_name = 'adsdoc_z7_'//part_str(1:LEN_TRIM(part_str)) |
---|
1625 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1626 | & DOC_g(:,:,7,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1627 | ENDDO |
---|
1628 | |
---|
1629 | DO m=1,npool |
---|
1630 | WRITE (part_str, '(I1)') m |
---|
1631 | var_name = 'adsdoc_z8_'//part_str(1:LEN_TRIM(part_str)) |
---|
1632 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1633 | & DOC_g(:,:,8,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1634 | ENDDO |
---|
1635 | |
---|
1636 | DO m=1,npool |
---|
1637 | WRITE (part_str, '(I1)') m |
---|
1638 | var_name = 'adsdoc_z9_'//part_str(1:LEN_TRIM(part_str)) |
---|
1639 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1640 | & DOC_g(:,:,9,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1641 | ENDDO |
---|
1642 | |
---|
1643 | DO m=1,npool |
---|
1644 | WRITE (part_str, '(I1)') m |
---|
1645 | var_name = 'adsdoc_z10_'//part_str(1:LEN_TRIM(part_str)) |
---|
1646 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1647 | & DOC_g(:,:,10,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1648 | ENDDO |
---|
1649 | |
---|
1650 | DO m=1,npool |
---|
1651 | WRITE (part_str, '(I1)') m |
---|
1652 | var_name = 'adsdoc_z11_'//part_str(1:LEN_TRIM(part_str)) |
---|
1653 | CALL restput (rest_id_sto, var_name, nbp_glo, nvm , 1, itau_dep, & |
---|
1654 | & DOC_g(:,:,11,iadsorbed,m,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1655 | ENDDO |
---|
1656 | ! TF-DOC |
---|
1657 | CALL restput (rest_id_sto, 'interception_storage_DOC', nbp_glo, nvm , 1, itau_dep, & |
---|
1658 | & & interception_storage_g(:,:,icarbon), 'scatter', nbp_glo, indices_g) |
---|
1659 | !- |
---|
1660 | !- |
---|
1661 | CALL getin_dump |
---|
1662 | CALL restclo |
---|
1663 | ENDIF |
---|
1664 | |
---|
1665 | #ifdef CPP_PARA |
---|
1666 | CALL MPI_FINALIZE(ier) |
---|
1667 | #endif |
---|
1668 | WRITE(numout,*) "End of forcesoil." |
---|
1669 | !-------------------- |
---|
1670 | END PROGRAM forcesoil |
---|