source: tags/ORCHIDEE_4_1/ORCHIDEE/src_stomate/sapiens_agriculture.f90 @ 7852

Last change on this file since 7852 was 7549, checked in by sebastiaan.luyssaert, 2 years ago

Contributes to ticket #797. Chenged the control of RDI in unmanaged forests to increase height growth especially the first decades following stand establishment

File size: 25.8 KB
Line 
1! ================================================================================================================================
2! MODULE       : sapiens_agriculture
3!
4! CONTACT      : orchidee-help _at_ ipsl.jussieu.fr
5!
6! LICENCE      : IPSL (2006)
7! This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
8!
9!>\BRIEF       Simple approach to harvesting croplands
10!!
11!!\n DESCRIPTION: None
12!!
13!! RECENT CHANGE(S): None
14!!
15!! REFERENCE(S) : None
16!!
17!! SVN          :
18!! $HeadURL: svn://forge.ipsl.jussieu.fr/orchidee/branches/ORCHIDEE-DOFOCO/ORCHIDEE/src_stomate/stomate_lpj.f90 $
19!! $Date: 2013-08-28 16:34:04 +0200 (Wed, 28 Aug 2013) $
20!! $Revision: 1438 $
21!! \n
22!_ ================================================================================================================================
23
24MODULE sapiens_agriculture
25
26  ! modules used:
27  USE stomate_data
28  USE constantes
29  USE grid
30  USE pft_parameters
31  USE function_library,    ONLY: cc_to_biomass, lai_to_biomass, &
32                           biomass_to_lai
33
34  IMPLICIT NONE
35
36  ! private & public routines
37
38  PRIVATE
39  PUBLIC crop_planting, crop_harvest, sapiens_agriculture_initialize
40
41  ! Variable declaration
42
43  LOGICAL, SAVE             :: firstcall_sapiens_agriculture = .TRUE.   !! first call flag
44!$OMP THREADPRIVATE(firstcall_sapiens_agriculture)
45  INTEGER(i_std), SAVE       :: printlev_loc                            !! Local level of text output for current module
46!$OMP THREADPRIVATE(printlev_loc)
47
48CONTAINS
49
50  !! ================================================================================================================================
51  !! SUBROUTINE   : sapiens_agriculture_initialize
52  !!
53  !>\BRIEF        Initialize module sapiens_agriculture
54  !!
55  !! DESCRIPTION  : This subroutine is called from stomate_initialize. It will initialize printlev_loc variable by
56  !!               reading PRINTLEV_sapiens_agriculture from run.def.
57  !!
58  !! RECENT CHANGE(S) :
59  !!
60  !! MAIN OUTPUT VARIABLE(S):
61  !!
62  !! REFERENCE(S) :
63  !!
64  !! FLOWCHART    : None
65  !! \n
66  !_ =============================================================================================================================
67
68  SUBROUTINE sapiens_agriculture_initialize()
69
70    !! Initialize local printlev
71    printlev_loc=get_printlev('sapiens_agriculture')
72
73    firstcall_sapiens_agriculture=.FALSE.
74
75  END SUBROUTINE sapiens_agriculture_initialize
76
77
78  !! ================================================================================================================================
79  !! SUBROUTINE   : crop_planting
80  !!
81  !>\BRIEF        Plant croplands
82  !!
83  !! DESCRIPTION  : Plant the crops when the weather is suitable. Uses begin_leaves to decide
84  !! when to plant a crop. To be used within the DOFOCO branch.
85  !!
86  !! RECENT CHANGE(S) :
87  !!
88  !! MAIN OUTPUT VARIABLE(S):
89  !!
90  !! REFERENCE(S) :
91  !!
92  !! FLOWCHART    : None
93  !! \n
94  !_ =============================================================================================================================
95
96  SUBROUTINE crop_planting(npts, dt, ipts, ivm, &
97       veget_max, PFTpresent, c0_alloc, when_growthinit, &
98       time_hum_min, everywhere, plant_status, &
99       circ_class_n, KF, leaf_frac, age, &
100       npp_longterm, lm_lastyearmax, circ_class_biomass, &
101       atm_to_bm, k_latosa_adapt)
102
103
104  !! 0. Variable and parameter declaration
105 
106  !! 0.1 Input variables
107 
108    INTEGER(i_std), INTENT(in)                         :: npts                 !! Domain size - number of grid cells (unitless)
109    INTEGER(i_std), INTENT(in)                         :: ipts                 !! specific pixel to plant (unitless)
110    INTEGER(i_std), INTENT(in)                         :: ivm                  !! specific pft to plant in the specific pixel
111                                                                               !! (unitless)
112    REAL(r_std), INTENT(in)                            :: dt                   !! time step (dt_days) 
113    REAL(r_std), DIMENSION(:,:), INTENT(in)            :: veget_max            !! "maximal" coverage fraction of a
114                                                                               !! PFT (LAI -> infinity) on ground
115                                                                               !! (0-1, unitless)
116    REAL(r_std), INTENT(in)                            :: c0_alloc             !! Root to sapwood tradeoff parameter
117
118
119  !! 0.2 Ouput variables
120
121
122  !! 0.3 Modified variables
123   
124    LOGICAL, DIMENSION(:,:), INTENT(inout)             :: PFTpresent           !! PFT exists (true/false)
125    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: plant_status         !! Growth and phenological status of the plant
126                                                                               !! Different stati are listed in constantes_var
127    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: when_growthinit      !! how many days since the
128                                                                               !! beginning of the growing season (days)
129    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: time_hum_min         !! time elapsed since strongest
130                                                                               !! moisture availability (days)
131    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: everywhere           !! is the PFT everywhere in the grid box or
132                                                                               !! very localized (after its introduction) (?)
133    REAL(r_std), DIMENSION(:,:,:), INTENT(inout)       :: circ_class_n         !! Number of individuals in each circ class
134                                                                               !! @tex $(ind m^{-2})$ @endtex
135    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: KF                   !! Scaling factor to convert sapwood mass
136                                                                               !! into leaf mass (m)
137    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: k_latosa_adapt       !! Leaf to sapwood area adapted for long
138                                                                               !! term water stress (m)
139    REAL(r_std), DIMENSION(:,:,:), INTENT(inout)       :: leaf_frac            !! fraction of leaves in leaf age
140                                                                               !! class (0-1, unitless)
141    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: age                  !! mean age (years)
142    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: npp_longterm         !! "long term" net primary productivity
143                                                                               !! @tex ($gC m^{-2} year^{-1}$) @endtex
144    REAL(r_std), DIMENSION(:,:), INTENT(inout)         :: lm_lastyearmax       !! last year's maximum leaf mass for each PFT
145                                                                               !! @tex ($gC m^{-2}$) @endtex
146    REAL(r_std), DIMENSION(:,:,:), INTENT(inout)       :: atm_to_bm            !! co2 taken up by carbohydrate
147                                                                               !! reserve at the beginning of the
148                                                                               !! growing season @tex ($gC m^{-2}
149                                                                               !! of total ground/day$) @endtex
150    REAL(r_std), DIMENSION(:,:,:,:,:), INTENT(inout)   :: circ_class_biomass   !! Biomass components of the model tree 
151                                                                               !! within a circumference class
152                                                                               !! class @tex $(g C ind^{-1})$ @endtex
153   
154  !! 0.4 Local variables
155   
156    REAL(r_std), DIMENSION(npts,nvm)                   :: LF                   !! Scaling factor to convert sapwood mass
157                                                                               !! into root mass (unitless)
158    REAL(r_std), DIMENSION(npts,nvm)                   :: histvar              !! controls the history output
159                                                                               !! level - 0: nothing is written;
160                                                                               !! 10: everything is written
161                                                                               !! (0-10, unitless)
162    REAL(r_std), DIMENSION(npts,nvm)                   :: lstress_fac          !! Light stress factor, based on total
163                                                                               !! transmitted light (unitless, 0-1)
164    REAL(r_std)                                        :: Cs_grass             !! Individual plant, sapwood compartment
165                                                                               !! @tex $(gC. ind^{-1})$ @endtex
166    REAL(r_std)                                        :: Cl_init              !! Initial leaf carbon required to start
167                                                                               !! the growing season
168                                                                               !! @tex $(gC tree^{-1})$ @endtex
169    REAL(r_std)                                        :: Cr_init              !! Initial root carbon required to start
170                                                                               !! the growing season
171                                                                               !! @tex $(gC tree^{-1})$ @endtex
172                                                                               !! relationships (m)
173    INTEGER(i_std)                                     :: iele                 !! index (unitless)
174    REAL(r_std)                                        :: k_latosa_tmp         !! Temporaray variable in the calculation of
175                                                                               !! k_latosa_adapt                                                       
176    REAL(r_std)                                        :: cn_leaf,cn_root,cn_wood !! C/N ratio of leaves, root and wood pool
177                                                                               !! (gC/gN)
178     
179!_ ================================================================================================================================
180
181
182    IF (printlev_loc>=3) WRITE(numout,*) 'Entering sapiens_crop_planting'
183
184
185    IF ( veget_max(ipts,ivm) .GT. min_stomate .AND. &
186         SUM(circ_class_n(ipts,ivm,:)) .LT. min_stomate) THEN
187
188       !! 1. Prescribe the crops
189 
190       ! Lightstress varies from 0 to 1 and is calculated from the canopy structure (veget)
191       ! Given that there is no vegetation at this point, the lightstress cannot be
192       ! calculated and is set to 1. However as soon as we grow a canopy it will
193       ! experience light stress and so KF should be adjusted. If this is not done, we
194       ! can't prescribe tall vegetation which is a useful feature to speed up
195       ! optimisation and testing. We will have iterate over light stress and KF to
196       ! prescribe vegetation that is in balance with its light environment.
197       lstress_fac(ipts,ivm) = un
198
199       ! For crops we assume that an individual crop is 1 m2 of crop. This is set
200       ! in nmaxplants in pft_parameters.f90. It could be set to another value but
201       ! with the current code this should not have any meaning. The cropland
202       ! does not necessarily covers the whole 1 m2 so adjust for the canopy cover
203       circ_class_n(ipts,ivm,1) = nmaxplants(ivm) * ha_to_m2 * canopy_cover(ivm)
204
205       ! Now we generate the size of a single crop sapling. We do not deal with
206       ! circumference classes for crops, but we want to keep the arrays the
207       ! same as for the trees so we put the sapling information into the first
208       ! circumference class
209
210       ! Calculate the sapwood to leaf mass in a similar way as has been done for trees.
211       ! For trees this approach had been justified by observations. For crops such
212       ! justification is not supported by observations but we didn't try to find it.
213       ! Needs more work by someone interested in crops. There might be a more elegant
214       ! solution making use of a well observed parameter.
215       ! The mass of the structural carbon relates to the mass of the leaves through
216       ! a prescribed parameter ::k_latosa
217       k_latosa_tmp = k_latosa_adapt(ipts,ivm) + (lstress_fac(ipts,ivm) * &
218            (k_latosa_max(ivm)-k_latosa_min(ivm)))
219
220       IF (sla_dyn) THEN
221          KF(ipts,ivm) = k_latosa_tmp / &
222               (slainit(ivm) * pipe_density(ivm) * tree_ff(ivm))
223       ELSE
224          KF(ipts,ivm) = k_latosa_tmp / &
225               (sla(ivm) * pipe_density(ivm) * tree_ff(ivm))
226       END IF
227
228       ! Calculate leaf to root area
229       LF(ipts,ivm) = c0_alloc * KF(ipts,ivm)
230
231       ! Debug
232       IF(printlev_loc>=4 .AND. ivm==test_pft)THEN
233          WRITE(numout,*) 'sapiens_agriculture'
234          WRITE(numout,*) 'KF, ', KF(ipts,ivm)
235          WRITE(numout,*) 'LF, c0_alloc, ', c0_alloc * KF(ipts,ivm), &
236               c0_alloc
237       ENDIF
238       !-
239
240       ! initialize everything to make sure there are not random values floating around
241       ! for ncirc = 1
242       circ_class_biomass(ipts,ivm,:,:,:) = zero
243       
244       ! Similar as for trees, the initial height of the vegetation can be calculated
245       ! from prescribed parameters. Use the function lai_to_biomass to account
246       ! for dynamic sla.
247       circ_class_biomass(ipts,ivm,1,ileaf,icarbon) = lai_to_biomass(&
248            height_init(ivm)/lai_to_height(ivm),ivm)
249       
250       ! Use allometric relationships to define the root mass based on leaf mass. Some
251       ! sapwood mass is needed to store the reserves.
252       circ_class_biomass(ipts,ivm,1,iroot,icarbon) = &
253            circ_class_biomass(ipts,ivm,1,ileaf,icarbon) / LF(ipts,ivm)
254       circ_class_biomass(ipts,ivm,1,isapabove,icarbon) = &
255            circ_class_biomass(ipts,ivm,1,ileaf,icarbon) / KF(ipts,ivm)
256
257       ! Pools that are defined in the same way for trees and grasses     
258       circ_class_biomass(ipts,ivm,1,ilabile,icarbon) = labile_to_total * &
259            ( circ_class_biomass(ipts,ivm,1,ileaf,icarbon) + &
260            fcn_root(ivm) *  circ_class_biomass(ipts,ivm,1,iroot,icarbon) + &
261            fcn_wood(ivm) * ( circ_class_biomass(ipts,ivm,1,isapabove,icarbon) +  &
262            circ_class_biomass(ipts,ivm,1,isapbelow,icarbon) + &
263            circ_class_biomass(ipts,ivm,1,icarbres,icarbon)))
264       
265       ! Allocate the required N for the phenological growth
266       ! Similar as to the carbon this is taken from the atmosphere
267       ! That is dealt with later in the code.
268       ! Calculate the C/N ratio
269       cn_leaf=cn_leaf_init(ivm)
270       cn_wood=cn_leaf/fcn_wood(ivm)
271       cn_root=cn_leaf/fcn_root(ivm) 
272       
273       ! Use the C/N ratio to calculate the N content for
274       ! all the biomass components.
275       circ_class_biomass(ipts,ivm,1,:,initrogen) = &
276            circ_class_biomass(ipts,ivm,1,:,icarbon) / cn_root
277
278       ! Overwrite the N content for the leaves and wood
279       ! components.
280       circ_class_biomass(ipts,ivm,1,ileaf,initrogen) = &
281            circ_class_biomass(ipts,ivm,1,ileaf,icarbon) / cn_leaf
282       circ_class_biomass(ipts,ivm,1,isapabove,initrogen) = &
283            circ_class_biomass(ipts,ivm,1,isapabove,icarbon) / cn_wood
284     
285       ! Some of the biomass components that exist for trees are undefined for grasses
286       circ_class_biomass(ipts,ivm,1,isapbelow,:) = zero
287       circ_class_biomass(ipts,ivm,1,iheartabove,:) = zero
288       circ_class_biomass(ipts,ivm,1,iheartbelow,:) = zero
289       circ_class_biomass(ipts,ivm,1,ifruit,:) = zero
290       circ_class_biomass(ipts,ivm,1,icarbres,:) = zero     
291           
292       ! Write initial values
293       IF (printlev_loc>=4) THEN
294          WRITE(numout,*) 'Crop prescribed biomass, carbon ', &
295               circ_class_biomass(ipts,ivm,1,:,icarbon)
296          WRITE(numout,*) 'Crop prescribed biomass, nitrogen ', &
297               circ_class_biomass(ipts,ivm,1,:,initrogen)
298       ENDIF
299       
300       ! Set leaf age classes -> all leaves will be current year leaves
301       leaf_frac(ipts,ivm,:) = zero
302       leaf_frac(ipts,ivm,1) = un
303       
304       ! Set time since last beginning of growing season but only
305       ! for the first day of the whole simulation. When the model
306       ! is initialized when_growthinit is set to undef. In subsequent
307       ! time steps it should have a value.
308       IF (when_growthinit(ipts,ivm) .EQ. undef) THEN
309          when_growthinit(ipts,ivm) = 200
310          time_hum_min(ipts,ivm) = 200
311       ENDIF
312       
313       ! The biomass to build the saplings is taken from the atmosphere, keep track of
314       ! the amount to calculate the C-balance closure
315       atm_to_bm(ipts,ivm,:) = atm_to_bm(ipts,ivm,:) + &
316            (SUM(cc_to_biomass(npts, ivm, &
317            circ_class_biomass(ipts,ivm,:,:,:), &
318            circ_class_n(ipts,ivm,:)),1) / dt )
319
320       !! 2.3 Declare PFT present
321       !! Now that the PFT has biomass it should be declared 'present'
322       !! everywhere in that grid box. Assign some additional properties
323       PFTpresent(ipts,ivm) = .TRUE.
324       everywhere(ipts,ivm) = un
325       age(ipts,ivm) = zero
326       npp_longterm(ipts,ivm) = npp_longterm_init
327       lm_lastyearmax(ipts,ivm) = zero
328
329       !! 4.3 reset when_growthinit counter: start of the growing season
330       when_growthinit(ipts,ivm) = zero
331       plant_status(ipts,ivm) = icanopy
332   
333    ELSE
334
335       ! PFT is not present, initialize the variables
336       ! At the plant level
337       circ_class_n(ipts,ivm,:) = zero
338       circ_class_biomass(ipts,ivm,:,:,:) = zero
339       
340    ENDIF ! veget_max gt min_stomate
341
342    IF (printlev_loc>=4) WRITE(numout,*) 'Leaving sapiens_crop_planting'
343
344  END SUBROUTINE crop_planting
345
346
347  !! ================================================================================================================================
348  !! SUBROUTINE   : crop_harvest
349  !!
350  !>\BRIEF        Harvest of croplands
351  !!
352  !! DESCRIPTION  : To take into account biomass harvest from crop (mainly
353  !! to take into account for the reduced litter input and then decreased
354  !! soil carbon. it is a constant (40\%) fraction of turnover. To be used
355  !! within the DOFOCO branch.
356  !!
357  !! RECENT CHANGE(S) : Harvest is stored in harvest_pool for further
358  !! modelling of product use
359  !!
360  !! MAIN OUTPUT VARIABLE(S): ::harvest_pool
361  !!
362  !! REFERENCE(S) :
363  !! - Piao, S., P. Ciais, P. Friedlingstein, N. de Noblet-Ducoudre, P. Cadule,
364  !!   N. Viovy, and T. Wang. 2009. Spatiotemporal patterns of terrestrial
365  !!   carbon cycle during the 20th century. Global Biogeochemical Cycles
366  !!   23:doi:10.1029/2008GB003339.
367  !!
368  !! FLOWCHART    : None
369  !! \n
370  !_ ================================================================================================================================
371
372  SUBROUTINE crop_harvest(npts, ipts, ivm, dt_days, &
373       veget_max, turnover, harvest_pool, harvest_type, &
374       harvest_cut, harvest_area, circ_class_biomass, &
375       circ_class_n, leaf_meanage) 
376
377
378    !! 0. Variable and parameter declaration
379
380    !! 0.1 Input variables
381
382    INTEGER, INTENT(in)                                :: npts              !! Domain size (unitless)
383    INTEGER(i_std), INTENT(in)                         :: ipts              !! specific pixel to plant (unitless)
384    INTEGER(i_std), INTENT(in)                         :: ivm               !! specific pft to plant in the specific pixel
385                                                                            !! (unitless)
386    REAL(r_std), INTENT(in)                            :: dt_days           !! Time step (days)
387    REAL(r_std), DIMENSION(:,:), INTENT(in)            :: veget_max         !! Fraction of the pixel covered by a PFT
388                                                                            !! @tex $(m^2 m^{-2})$ @endtex
389
390    !! 0.2 Output variables
391
392
393    !! 0.3 Modified variables
394
395    REAL(r_std), DIMENSION(:,:,:,:,:), INTENT(inout)  :: circ_class_biomass !! biomass @tex ($gC m^{-2}$) @endtex
396    REAL(r_std), DIMENSION(:,:,:,:),INTENT(inout)     :: turnover           !! Turnover rates
397                                                                            !! @tex $(gC m^{-2} dtslow^{-1})$ @endtex
398    REAL(r_std), DIMENSION(:,:,:,:), INTENT(inout)    :: harvest_pool       !! The wood and biomass that have been
399                                                                            !! havested by humans @tex $(gC)$ @endtex
400    REAL(r_std), DIMENSION(:,:), INTENT(inout)        :: harvest_type       !! Type of management that resulted
401                                                                            !! in the harvest (unitless)
402    REAL(r_std), DIMENSION(:,:), INTENT(inout)        :: harvest_cut        !! Type of cutting that was used for the harvest
403                                                                            !! (unitless)
404    REAL(r_std), DIMENSION(:,:), INTENT(inout)        :: harvest_area       !! Harvested area (m^{2})
405    REAL(r_std), DIMENSION(:,:,:), INTENT(inout)      :: circ_class_n       !! Density of individuals
406                                                                            !! @tex $(m^{-2})$ @endtex
407    REAL(r_std), DIMENSION(:,:), INTENT(inout)        :: leaf_meanage       !! mean age of the leaves (days)
408
409
410    !! 0.4 Local variables
411               
412
413 !_ ================================================================================================================================
414
415    IF(printlev_loc>=3) WRITE(numout,*) 'Entering sapiens_crop_harvest'
416
417    !! 1. Initialize
418    !  Reset harvest pool
419    IF(printlev>=4 .AND. ipts == test_grid .AND. ivm == test_pft)THEN
420       WRITE(numout,*) "Entering the crop_harvest routine: ", &
421            harvest_pool(ipts,ivm,:,:)
422    ENDIF
423
424    ! We should not reset!  Sometimes there is harvest in the harvest
425    ! pool, and our mass balance will not be closed if we eliminate it
426    ! here. It seems possible that we hit senesence twice in a single
427    ! year. This happened on a grid point near the equator.
428    ! harvest_pool(ipts,ivm,:,:) = zero
429
430
431    !! 2. Harvest croplands
432
433    ! NOTE that this is a quick fix rather than a final solution. The turnover
434    ! of crop biomass has for long be calculated and was assumed to entirely
435    ! return to the litter pools. This approach ignored crop harvest. Rather
436    ! than harvesting the aboveground biomass (or below ground for some
437    ! crops i.e. potatoes, beet, etc which is currently not accounted for) this
438    ! routine makes use of the turnover and diverts part of the turnover into
439    ! the harvest pool. By doing so it does not end up in the litter.
440
441    ! Assume all aboveground biomass is harvested and put it all in the first
442    ! diameter class.
443    harvest_pool(ipts,ivm,1,:) = harvest_pool(ipts,ivm,1,:) + &
444         harvest_ratio(ivm) * circ_class_n(ipts,ivm,1) *( circ_class_biomass(ipts,ivm,1,ileaf,:) + &
445         circ_class_biomass(ipts,ivm,1,icarbres,:) + circ_class_biomass(ipts,ivm,1,ilabile,:) + &
446         circ_class_biomass(ipts,ivm,1,ifruit,:) + circ_class_biomass(ipts,ivm,1,isapabove,:)) * &
447         veget_max(ipts,ivm) * area(ipts)
448
449    ! Associated harvest variables
450    harvest_type(ipts,ivm) = ifm_crop
451    harvest_cut(ipts,ivm) = icut_crop
452    harvest_area(ipts,ivm) = harvest_area(ipts,ivm) + &
453         veget_max(ipts,ivm) * area(ipts)
454
455    ! The belowground becomes litter. All roots remain on site.
456    ! Half (::harvest_ratio) of the other biomas pools was harvested.
457    turnover(ipts,ivm,iroot,:) = turnover(ipts,ivm,iroot,:) + &
458         circ_class_biomass(ipts,ivm,1,iroot,:)*circ_class_n(ipts,ivm,1)
459    turnover(ipts,ivm,ileaf,:) = turnover(ipts,ivm,ileaf,:) + &
460         (un - harvest_ratio(ivm)) * circ_class_biomass(ipts,ivm,1,ileaf,:)*&
461         circ_class_n(ipts,ivm,1)
462    turnover(ipts,ivm,icarbres,:) = turnover(ipts,ivm,icarbres,:) + &
463         (un - harvest_ratio(ivm)) * circ_class_biomass(ipts,ivm,1,icarbres,:)*&
464         circ_class_n(ipts,ivm,1)
465    turnover(ipts,ivm,ilabile,:) = turnover(ipts,ivm,ilabile,:) + &
466         (un - harvest_ratio(ivm)) * circ_class_biomass(ipts,ivm,1,ilabile,:)*&
467         circ_class_n(ipts,ivm,1)
468    turnover(ipts,ivm,ifruit,:) = turnover(ipts,ivm,ifruit,:) + &
469         (un - harvest_ratio(ivm)) * circ_class_biomass(ipts,ivm,1,ifruit,:)*&
470         circ_class_n(ipts,ivm,1)
471    turnover(ipts,ivm,isapabove,:) = turnover(ipts,ivm,isapabove,:) + &
472         (un - harvest_ratio(ivm)) * circ_class_biomass(ipts,ivm,1,isapabove,:)*&
473         circ_class_n(ipts,ivm,1)
474
475
476    ! Account for the pools that should not contain biomass for the moment
477    ! Do so to make sure the mass balance will be closed
478    turnover(ipts,ivm,isapbelow,:) = turnover(ipts,ivm,isapbelow,:) +  &
479         circ_class_biomass(ipts,ivm,1,isapbelow,:)*&
480         circ_class_n(ipts,ivm,1)
481    turnover(ipts,ivm,iheartabove,:) = turnover(ipts,ivm,iheartabove,:) +  &
482         circ_class_biomass(ipts,ivm,1,iheartabove,:)*&
483         circ_class_n(ipts,ivm,1)
484    turnover(ipts,ivm,iheartbelow,:) = turnover(ipts,ivm,iheartbelow,:) +  &
485         circ_class_biomass(ipts,ivm,1,iheartbelow,:)*&
486         circ_class_n(ipts,ivm,1)
487
488    ! Reset the biomass pools
489    circ_class_biomass(ipts,ivm,:,isapabove,:) = zero
490    circ_class_biomass(ipts,ivm,:,ileaf,:) = zero
491    circ_class_biomass(ipts,ivm,:,iroot,:) = zero
492    circ_class_biomass(ipts,ivm,:,ifruit,:) = zero
493    circ_class_biomass(ipts,ivm,:,icarbres,:) = zero
494    circ_class_biomass(ipts,ivm,:,ilabile,:) = zero
495               
496    ! These pools should always be empty for crops - just to be sure
497    circ_class_biomass(ipts,ivm,:,iheartbelow,:) = zero
498    circ_class_biomass(ipts,ivm,:,iheartabove,:) = zero
499    circ_class_biomass(ipts,ivm,:,isapbelow,:) = zero
500
501    ! No individuals left
502     circ_class_n(ipts,ivm,:) = zero
503
504    ! reset leaf age
505    leaf_meanage(ipts,ivm) = zero
506
507    IF(printlev_loc>=4) WRITE(numout,*) 'Leaving sapiens_crop_harvest'
508
509  END SUBROUTINE crop_harvest
510
511END MODULE sapiens_agriculture
Note: See TracBrowser for help on using the repository browser.