source: branches/ORCHIDEE_3_CMIP6/ORCHIDEE/src_stomate/lpj_pftinout.f90 @ 7599

Last change on this file since 7599 was 5639, checked in by josefine.ghattas, 6 years ago

Nitrogen is in the trunk!

  • Copied branches/ORCHIDEE-CN at revision 5638 into ORCHIDEE
  • Copied branches/ORCHIDEE-CN_CONFIG at revision 5637 in ORCHIDEE_OL

See ticket #469

  1. Vuichard, J Ghattas
  • Property svn:keywords set to HeadURL Date Author Revision
File size: 25.1 KB
Line 
1! =================================================================================================================================
2! MODULE       : lpj_pftinout
3!
4! CONTACT      : orchidee-help _at_ listes.ipsl.fr
5!
6! LICENCE      : IPSL (2006)
7! This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
8!
9!>\BRIEF       Introduce and eliminate PFT's from pixel
10!!
11!! \n DESCRIPTION: None
12!!
13!! RECENT CHANGE(S) : None
14!!
15!! REFERENCE(S) :
16!! - Sitch, S., B. Smith, et al. (2003), Evaluation of ecosystem dynamics,
17!!        plant geography and terrestrial carbon cycling in the LPJ dynamic
18!!        global vegetation model, Global Change Biology, 9, 161-185.\n
19!! - Thonicke, K., S. Venevsky, et al. (2001), The role of fire disturbance
20!!        for global vegetation dynamics: coupling fire into a Dynamic Global
21!!        Vegetation Model, Global Ecology and Biogeography, 10, 661-677.\n
22!! - Haxeltine, A. and I. C. Prentice (1996), BIOME3: An equilibrium
23!!        terrestrial biosphere model based on ecophysiological constraints,
24!!        resource availability, and competition among plant functional types,
25!!        Global Biogeochemical Cycles, 10(4), 693-709.\n
26!! - Smith, B., I. C. Prentice, et al. (2001), Representation of vegetation
27!!        dynamics in the modelling of terrestrial ecosystems: comparing two
28!!        contrasting approaches within European climate space,
29!!        Global Ecology and Biogeography, 10, 621-637.\n
30!!
31!! SVN          :
32!! $HeadURL$
33!! $Date$
34!! $Revision$
35!! \n
36!_ ==============================================================================================================================
37
38MODULE lpj_pftinout
39
40  ! modules used:
41
42  USE ioipsl_para
43  USE stomate_data
44  USE pft_parameters
45  USE constantes
46  USE grid
47  USE function_library,    ONLY: biomass_to_lai
48
49  IMPLICIT NONE
50
51  ! private & public routines
52
53  PRIVATE
54  PUBLIC pftinout,pftinout_clear
55
56  LOGICAL, SAVE                       :: firstcall_pftinout = .TRUE.                !! first call
57!$OMP THREADPRIVATE(firstcall_pftinout)
58
59CONTAINS
60
61
62!! ================================================================================================================================
63!! SUBROUTINE  : pftinout_clear
64!!
65!>\BRIEF       Set flag ::firstcall_pftinout to true and initialize the variables
66!_ ================================================================================================================================
67
68  SUBROUTINE pftinout_clear
69    firstcall_pftinout = .TRUE.
70  END SUBROUTINE pftinout_clear
71
72!! ================================================================================================================================
73!! SUBROUTINE  : pftinout
74!!
75!>\BRIEF       Introduce and eliminate PFT's from pixel
76!!
77!! DESCRIPTION**3 : Introduction and elimination of PFTs on the basis of climate condition.
78!! For natural and woody PFTs the foliage projected coverage is calculated as follows:
79!! \latexonly
80!!  \input{equation_lpj_pftinout.tex}
81!! \endlatexonly
82!! \n
83!! where FPC is foliage projective cover (::fpc_nat), CN crown area (::cn_ind,
84!! @tex $ m^{2} $ @endtex), IND number of individuals (::ind, @tex $ m^{-2} $ @endtex,
85!! FRAC total fraction occupied by natural vegetation (::fracnat),
86!! @tex $ LM_{rm max} $ @endtex maximum leaf mass in last year
87!! (::lm_lastyearmax, @tex $ g C m^{-2} $ @endtex), SLA specific leaf area (sla,
88!! @tex $ m^{2} (g C)^{-1} $ @endtex), and coff coefficient (::ext_coeff). ::ext_coeff
89!! describes a property of the canopy (i.e. law of Lambert-Beer) and is defined in **2
90!!
91!! The foliage projective cover feeds into the calculation of the space available for
92!! expansion of existing and dispersion of new PFTs within a gridbox. In turn, available
93!! space is use to calculate the number of individuals with a PFT.
94!!
95!! Saplings are introduced under the condition that winter temperature is
96!! moderate, plant age is older than 1.25, (and for some PFTs at least one adjacent grid
97!! box exists for expansion), new saplings are introduced for narural PFT. In the simulation of
98!! agricultural grassland, if target PFT does not exist in the gridbox, it is introduced
99!! regardless of climate condition. When a new PFT is introduced CO_2 is taken from the
100!! atmosphere to account for CO_2 present in the seed and required by the germinated seeds
101!! to establish a sapling. These initial phases in ontology are not accounted for. However,
102!! by taking this small amount of CO2 from the atmosphere, mass balance closure for C is
103!! preserved.
104!!
105!! PFTs are eliminated under the condition that they are no longer adapted to the critical
106!! temperatures in winter. When a PFT is eliminated its number of indiviuals is set to zero and
107!! the rest of the elimination process is taken care of in lpj_kill.f90.
108!!
109!! RECENT CHANGE(S) : None
110!!
111!! MAIN OUTPUT VARIABLE(S): :: avail_tree (space availability for trees, unitless),   
112!! :: avail_grass (space availability for grasses, unitless), :: biomass (biomass, \f$gC m^{-2}\f$)
113!! and :: ind (density of individuals, \f$m^{-2}\f$)   
114!!
115!! REFERENCE(S) : None
116!!
117!! FLOWCHART    :
118!! \latexonly
119!!   \includegraphics[scale = 0.6]{pftinout.png}
120!! \endlatexonly
121!! \n
122!_ ================================================================================================================================
123
124
125
126
127
128
129  SUBROUTINE pftinout (npts, dt, adapted, regenerate, bm_sapl_2D, &
130       neighbours, veget_cov_max, &
131       biomass, ind, cn_ind, age, leaf_frac, npp_longterm, lm_lastyearmax, senescence, &
132       PFTpresent, everywhere, when_growthinit, need_adjacent, RIP_time, &
133       co2_to_bm, n_to_bm,&
134       avail_tree, avail_grass)
135   
136  !! 0. Variable and parameter declaration
137   
138    !! 0.1 Input variables
139   
140    INTEGER(i_std), INTENT(in)                                :: npts            !! Domain size - number of pixels (unitless)           
141    REAL(r_std), INTENT(in)                                   :: dt              !! Time step of vegetation dynamics for stomate
142                                                                                 !! (days)               
143    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)              :: adapted         !! Winter not too cold (unitless)   
144    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)              :: regenerate      !! Winter sufficiently cold (unitless) 
145    REAL(r_std),DIMENSION(npts,nvm,nparts,nelements), INTENT(in) :: bm_sapl_2D   !! Spatialized biomass of sapling
146    INTEGER(i_std), DIMENSION(npts,NbNeighb), INTENT(in)      :: neighbours      !! Indices of the 8 neighbours of each grid point
147                                                                                 !! (unitless); 1=North and then clockwise.
148    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: veget_cov_max   !! "maximal" coverage fraction of a PFT (LAI ->
149                                                                                 !! infinity) on ground (unitless)       
150
151    !! 0.2 Output variables
152
153    REAL(r_std), DIMENSION(npts), INTENT(out)                 :: avail_tree      !! Space availability for trees (unitless)   
154    REAL(r_std), DIMENSION(npts), INTENT(out)                 :: avail_grass     !! Space availability for grasses (unitless)     
155
156
157    !! 0.3 Modified variables   
158
159    REAL(r_std), DIMENSION(npts,nvm,nparts,nelements), INTENT(inout) :: biomass  !! Biomass (gC m^{-2})     
160    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: ind             !! Density of individuals (m^{-2})
161    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)              :: cn_ind          !! Crown area of individuals (m^2)
162    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: age             !! Mean age (years)           
163    REAL(r_std), DIMENSION(npts,nvm,nleafages), INTENT(inout) :: leaf_frac       !! Fraction of leaves in leaf age class (unitless) 
164    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: npp_longterm    !! "long term" net primary productivity
165                                                                                 !! (gC m^{-2} year^{-1})   
166    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: lm_lastyearmax  !! Last year's maximum leaf mass, for each PFT
167                                                                                 !! (gC m^{-2}) 
168    LOGICAL, DIMENSION(npts,nvm), INTENT(inout)               :: senescence      !! Plant senescent for deciduous trees; .FALSE.
169                                                                                 !! if PFT is introduced or killed     
170    LOGICAL, DIMENSION(npts,nvm), INTENT(inout)               :: PFTpresent      !! PFT exists   
171    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: everywhere      !! is the PFT everywhere in the grid box or very
172                                                                                 !! localized (unitless) 
173    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: when_growthinit !! how many days ago was the beginning of the
174                                                                                 !! growing season (days)
175    LOGICAL, DIMENSION(npts,nvm), INTENT(inout)               :: need_adjacent   !! in order for this PFT to be introduced, does it
176                                                                                 !! have to be present in an adjacent grid box?   
177    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: RIP_time        !! How much time ago was the PFT eliminated for
178                                                                                 !! the last time (years)   
179    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: co2_to_bm       !! C biomass uptaken (gC m^{-2} day^{-1})   
180    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)           :: n_to_bm       !! N biomass uptaken (gN m^{-2} day^{-1})   
181 
182    !! 0.4 Local variables
183
184    REAL(r_std), DIMENSION(npts)                              :: avail           !! availability           
185    INTEGER(i_std)                                            :: i,j,m           !! indices     
186    REAL(r_std), DIMENSION(npts)                              :: sumfrac_wood    !! total woody vegetation cover     
187    INTEGER(i_std), DIMENSION(npts)                           :: n_present       !! number of adjacent grid cells where PFT is
188                                                                                 !! ubiquitous       
189    LOGICAL, DIMENSION(npts)                                  :: can_introduce   !! we can introduce this PFT   
190    REAL(r_std), DIMENSION(npts)                              :: fracnat         !! no real need for dimension(ntps) except for
191                                                                                 !! vectorisation         
192!_ ================================================================================================================================
193
194    IF (printlev>=3) WRITE(numout,*) 'Entering pftinout'
195
196  !! 1. Messages   
197
198    IF ( firstcall_pftinout ) THEN
199
200       WRITE(numout,*) 'pftinout: Minimum space availability: ', min_avail
201
202       firstcall_pftinout = .FALSE.
203
204    ENDIF
205
206  !! 2. Total woody fpc and space avaibility on grid
207
208    ! Only natural part of the grid cell\n
209    ! S. Zaehle bug correction MERGE: need to subtract agricultural area!
210    ! fraction of agricultural surface
211
212    !! 2.1 only natural PFT
213    fracnat(:) = un
214    DO j = 2,nvm ! Loop over # PFTs
215       IF ( .NOT. natural(j) ) THEN
216          fracnat(:) = fracnat(:) - veget_cov_max(:,j)
217       ENDIF
218    ENDDO ! Loop over # PFTs
219
220    !! 2.2 Total woody fractional plant cover
221    sumfrac_wood(:) = zero
222    DO j = 2,nvm ! Loop over # PFTs
223       ! S. Zaehle problem here: agriculture, not convinced that this representation of LPJ is correct
224       ! if agriculture is present, ind must be recalculated to correspond to the natural density...
225       ! since ind is per grid cell, can be achived by discounting for agricultura fraction
226       IF ( natural(j).AND.is_tree(j) ) THEN
227          WHERE(fracnat(:).GT.min_stomate) 
228                sumfrac_wood(:) = sumfrac_wood(:) + cn_ind(:,j) * ind(:,j) / fracnat(:) & 
229                     * ( un - exp( - biomass_to_lai(lm_lastyearmax(:,j),npts,j) * ext_coeff(j) ) )
230                !lai changed to lm_last
231          ENDWHERE
232       ENDIF
233    ENDDO ! Loop over # PFTs
234
235    !! 2.3 Space availability
236    avail_grass(:) = MAX( ( un - sumfrac_wood(:) ), min_avail )
237    avail_tree(:) = MAX( ( fpc_crit - sumfrac_wood(:) ), min_avail )
238
239  !! 3. Time since last elimination (y)
240
241    RIP_time = RIP_time + dt / one_year
242
243  !! 4. Agicultural PFTs
244
245    ! Agricultural PFTs are only present if they are prescribed
246    DO j = 2,nvm ! Loop over # PFTs
247       
248       IF ( .NOT. natural(j) ) THEN
249         
250          IF (printlev>=4) WRITE(numout,*) 'pftinout: Agricultural PFTs'
251         
252          !! 4.1 Agricultural trees
253          !      Agricultural trees are not treated for the moment
254          IF ( is_tree(j) ) THEN
255
256             CALL ipslerr_p(3,'pftinout','Agricultural trees not treated.','','')
257
258          !! 4.2 Initialization of agricultural grass lands
259          !      Initialize parameter values of prescribed agricultural PFTs
260          ELSE
261
262             DO i = 1, npts ! Loop over # pixels - domain size
263
264                IF ( ( veget_cov_max(i,j) .GT. min_stomate ) .AND. ( .NOT. PFTpresent(i,j) ) ) THEN
265
266                   ! prescribed, but not yet there.
267                   ind(i,j) = veget_cov_max(i,j)
268                   biomass(i,j,:,:) = bm_sapl_2D(i,j,:,:) * ind(i,j) /veget_cov_max(i,j) 
269                   co2_to_bm(i,j) =  co2_to_bm(i,j) +SUM( biomass(i,j,:,icarbon) ) / dt
270                   n_to_bm(i,j) =  n_to_bm(i,j) +SUM( biomass(i,j,:,initrogen) ) / dt
271                   PFTpresent(i,j) = .TRUE.
272                   everywhere(i,j) = un
273                   senescence(i,j) = .FALSE.
274                   age(i,j) = zero
275
276                ENDIF  ! prescribed, but PFT not yet present
277
278             ENDDO ! Loop over # pixels - domain size
279
280          ENDIF
281
282       ENDIF ! not natural
283
284    ENDDO ! Loop over # PFTs
285
286  !! 5 Eliminate PFTs
287
288    DO j = 2,nvm ! Loop over # PFTs
289
290       ! only for natural PFTs
291       IF ( natural(j) ) THEN
292
293          ! Number of individuals are set to zero in the condition of cold winter   
294          ! 'adapted_crit' critical value for being adapted = 1.-(1./euler); see 'stomate_constants.f90'
295          WHERE (  PFTpresent(:,j) .AND. ( adapted(:,j) .LT. adapted_crit ) )
296
297             ! PFT there, but not adapted any more (ex: winter too cold): kill
298             ! set number of individuals to zero - rest will be done in lpj_kill
299             ind(:,j) = zero
300
301          ENDWHERE
302
303       ENDIF ! natural
304
305    ENDDO ! Loop over # PFTs
306
307  !! 6. Introduce PFTs
308
309    DO j = 2,nvm ! Loop over # PFTs
310
311       IF ( natural(j) ) THEN
312
313          ! space availability for this PFT
314          IF ( is_tree(j) ) THEN
315             avail(:) = avail_tree(:)
316          ELSE
317             avail(:) = avail_grass(:)
318          ENDIF
319         
320          !! 6.1 Check if PFT not present but (adapted and regenerative)     
321          can_introduce(:) = .FALSE.
322         
323          IF ( NbNeighb /= 8 ) THEN
324             CALL ipslerr(3, "pftinout", "This routine needs to be adapted to non rectengular grids", &
325                  &           "Talk to Jan Polcher", " ")
326          ENDIF
327
328          DO i = 1, npts ! Loop over # pixels - domain size
329
330             IF ( .NOT. PFTpresent(i,j) .AND. &
331                  ( adapted(i,j) .GT. adapted_crit ) .AND. &
332                  ( regenerate(i,j) .GT. regenerate_crit )  ) THEN
333
334                ! Seed are available nearby
335                IF ( need_adjacent(i,j) ) THEN
336
337                   !! 6.1.1 Climate allows introduction of the PFT but dispersion requires the
338                   !        presence of seeds. Seed are considered available if at least one
339                   !        neighbouring pixel is entirely invaded by the PFT. If that condition is
340                   !        satisfied, the PFT can establish in the new pixel.
341                   ! Count number of totally invaded neighbours.
342                   ! no loop so that it can vectorize
343                   n_present(i) = 0
344                   IF ( neighbours(i,1) .GT. 0 ) THEN
345                      IF ( everywhere(neighbours(i,1),j) .GE. un-min_stomate ) THEN
346                         n_present(i) = n_present(i)+1
347                      ENDIF
348                   ENDIF
349                   IF ( neighbours(i,3) .GT. 0 ) THEN
350                      IF ( everywhere(neighbours(i,3),j) .GE. un-min_stomate ) THEN
351                         n_present(i) = n_present(i)+1
352                      ENDIF
353                   ENDIF
354                   IF ( neighbours(i,5) .GT. 0 ) THEN
355                      IF ( everywhere(neighbours(i,5),j) .GE. un-min_stomate ) THEN
356                         n_present(i) = n_present(i)+1
357                      ENDIF
358                   ENDIF
359                   IF ( neighbours(i,7) .GT. 0 ) THEN
360                      IF ( everywhere(neighbours(i,7),j) .GE. un-min_stomate ) THEN
361                         n_present(i) = n_present(i)+1
362                      ENDIF
363                   ENDIF
364
365                   IF ( n_present(i) .GT. 0 ) THEN
366
367                      ! PFT is ubiquitous in at least one adjacent grid box
368                      can_introduce(i) = .TRUE.
369
370                   ENDIF
371
372                ELSE
373
374                   !! 6.1.2 No seed (trees) required for dispersion
375                   !        The PFT can establish without the presence of seed trees in
376                   !        neighbouring pixels.
377                   can_introduce(i) = .TRUE.
378
379                ENDIF ! do we have to look at the neighbours?
380
381             ENDIF ! we'd like to introduce the PFT
382
383          ENDDO ! Loop over # pixels - domain size
384
385          !! 6.2 Has the PFT been eliminated lately?
386          !      Additional test whether the PFT has been eliminated lately, i.e.
387          !      less than 1.25 years ago. Do not only take full years as success of
388          !      introduction, as introduction might depend on season.
389          WHERE ( RIP_time(:,j) .LT. RIP_time_min )
390
391             ! PFT was eliminated lately - cannot reintroduce
392             can_introduce(:) = .FALSE.
393
394          ENDWHERE
395
396          !! 6.3 Introduce that PFT where possible
397          !      "can_introduce" means that it either exists in neighbouring grid boxes
398          !      or that we do not look at neighbours, that it has not been eliminated
399          !      lately, and, of course, that the climate is good for that PFT.
400          WHERE ( can_introduce(:) )
401             
402             PFTpresent(:,j) = .TRUE.
403             
404             senescence(:,j) = .FALSE.
405             
406             ! introduce at least a few saplings, even if canopy is closed
407             ! initial density of individuals (ind_0) = 0.02, see 'stomate_constant.f90'
408             ind(:,j) = ind_0 * (dt/one_year) * avail(:)
409             
410             WHERE(veget_cov_max(:,j) .GT. min_stomate)
411                biomass(:,j,ileaf,icarbon) = bm_sapl_2D(:,j,ileaf,icarbon) * ind(:,j) /veget_cov_max(:,j)
412                biomass(:,j,isapabove,icarbon) = bm_sapl_2D(:,j,isapabove,icarbon) * ind(:,j) /veget_cov_max(:,j)
413                biomass(:,j,isapbelow,icarbon) = bm_sapl_2D(:,j,isapbelow,icarbon) * ind(:,j)/veget_cov_max(:,j)
414                biomass(:,j,iheartabove,icarbon) = bm_sapl_2D(:,j,iheartabove,icarbon) * ind(:,j)/veget_cov_max(:,j)
415                biomass(:,j,iheartbelow,icarbon) = bm_sapl_2D(:,j,iheartbelow,icarbon) * ind(:,j)/veget_cov_max(:,j)
416                biomass(:,j,iroot,icarbon) = bm_sapl_2D(:,j,iroot,icarbon) * ind(:,j)/veget_cov_max(:,j)
417                biomass(:,j,ifruit,icarbon) = bm_sapl_2D(:,j,ifruit,icarbon) * ind(:,j)/veget_cov_max(:,j)
418                biomass(:,j,icarbres,icarbon) = bm_sapl_2D(:,j,icarbres,icarbon) * ind(:,j)/veget_cov_max(:,j)
419                biomass(:,j,ilabile,icarbon) = bm_sapl_2D(:,j,ilabile,icarbon) * ind(:,j)/veget_cov_max(:,j)
420
421                biomass(:,j,ileaf,initrogen) = bm_sapl_2D(:,j,ileaf,initrogen) * ind(:,j) /veget_cov_max(:,j)
422                biomass(:,j,isapabove,initrogen) = bm_sapl_2D(:,j,isapabove,initrogen) * ind(:,j) /veget_cov_max(:,j)
423                biomass(:,j,isapbelow,initrogen) = bm_sapl_2D(:,j,isapbelow,initrogen) * ind(:,j)/veget_cov_max(:,j)
424                biomass(:,j,iheartabove,initrogen) = bm_sapl_2D(:,j,iheartabove,initrogen) * ind(:,j)/veget_cov_max(:,j)
425                biomass(:,j,iheartbelow,initrogen) = bm_sapl_2D(:,j,iheartbelow,initrogen) * ind(:,j)/veget_cov_max(:,j)
426                biomass(:,j,iroot,initrogen) = bm_sapl_2D(:,j,iroot,initrogen) * ind(:,j)/veget_cov_max(:,j)
427                biomass(:,j,ifruit,initrogen) = bm_sapl_2D(:,j,ifruit,initrogen) * ind(:,j)/veget_cov_max(:,j)
428                biomass(:,j,icarbres,initrogen) = bm_sapl_2D(:,j,icarbres,initrogen) * ind(:,j)/veget_cov_max(:,j)
429                biomass(:,j,ilabile,initrogen) = bm_sapl_2D(:,j,ilabile,initrogen) * ind(:,j)/veget_cov_max(:,j)
430             ELSEWHERE             
431                biomass(:,j,ileaf,icarbon) = bm_sapl_2D(:,j,ileaf,icarbon) * ind(:,j)
432                biomass(:,j,isapabove,icarbon) = bm_sapl_2D(:,j,isapabove,icarbon) * ind(:,j)
433                biomass(:,j,isapbelow,icarbon) = bm_sapl_2D(:,j,isapbelow,icarbon) * ind(:,j)
434                biomass(:,j,iheartabove,icarbon) = bm_sapl_2D(:,j,iheartabove,icarbon) * ind(:,j)
435                biomass(:,j,iheartbelow,icarbon) = bm_sapl_2D(:,j,iheartbelow,icarbon) * ind(:,j)
436                biomass(:,j,iroot,icarbon) = bm_sapl_2D(:,j,iroot,icarbon) * ind(:,j)
437                biomass(:,j,ifruit,icarbon) = bm_sapl_2D(:,j,ifruit,icarbon) * ind(:,j)
438                biomass(:,j,icarbres,icarbon) = bm_sapl_2D(:,j,icarbres,icarbon) * ind(:,j)
439                biomass(:,j,ilabile,icarbon) = bm_sapl_2D(:,j,ilabile,icarbon) * ind(:,j) 
440
441                biomass(:,j,ileaf,initrogen) = bm_sapl_2D(:,j,ileaf,initrogen) * ind(:,j)
442                biomass(:,j,isapabove,initrogen) = bm_sapl_2D(:,j,isapabove,initrogen) * ind(:,j)
443                biomass(:,j,isapbelow,initrogen) = bm_sapl_2D(:,j,isapbelow,initrogen) * ind(:,j)
444                biomass(:,j,iheartabove,initrogen) = bm_sapl_2D(:,j,iheartabove,initrogen) * ind(:,j)
445                biomass(:,j,iheartbelow,initrogen) = bm_sapl_2D(:,j,iheartbelow,initrogen) * ind(:,j)
446                biomass(:,j,iroot,initrogen) = bm_sapl_2D(:,j,iroot,initrogen) * ind(:,j)
447                biomass(:,j,ifruit,initrogen) = bm_sapl_2D(:,j,ifruit,initrogen) * ind(:,j)
448                biomass(:,j,icarbres,initrogen) = bm_sapl_2D(:,j,icarbres,initrogen) * ind(:,j)
449                biomass(:,j,ilabile,initrogen) = bm_sapl_2D(:,j,ilabile,initrogen) * ind(:,j) 
450             END WHERE
451           
452             co2_to_bm(:,j) = &
453                  co2_to_bm(:,j) +  &
454                  ( biomass(:,j,ileaf,icarbon) + biomass(:,j,isapabove,icarbon) + &
455                  biomass(:,j,isapbelow,icarbon) + biomass(:,j,iheartabove,icarbon) + &
456                  biomass(:,j,iheartbelow,icarbon) + biomass(:,j,iroot,icarbon) + &
457                  biomass(:,j,ifruit,icarbon) + biomass(:,j,icarbres,icarbon)+ &
458                  biomass(:,j,ilabile,icarbon) )/dt
459
460             n_to_bm(:,j) = &
461                  n_to_bm(:,j) +  &
462                  ( biomass(:,j,ileaf,initrogen) + biomass(:,j,isapabove,initrogen) + &
463                  biomass(:,j,isapbelow,initrogen) + biomass(:,j,iheartabove,initrogen) + &
464                  biomass(:,j,iheartbelow,initrogen) + biomass(:,j,iroot,initrogen) + &
465                  biomass(:,j,ifruit,initrogen) + biomass(:,j,icarbres,initrogen)+ &
466                  biomass(:,j,ilabile,initrogen) )/dt
467
468             when_growthinit(:,j) = large_value
469
470             age(:,j) = zero
471
472             ! all leaves are young
473             leaf_frac(:,j,1) = un
474
475             ! non-zero "long term" npp and last year's leaf mass for saplings -
476             ! so they won't be killed off by gap or kill
477             npp_longterm(:,j) = npp_longterm_init
478
479             lm_lastyearmax(:,j) = bm_sapl_2D(:,j,ileaf,icarbon) * ind(:,j)
480
481          ENDWHERE    ! we can introduce the PFT
482
483          !! 6.4 Expansion of the PFT within the grid box
484          !      PFT expansion/dispersion to a new grid box should not be confused with
485          !      expansion in areal coverage
486          IF ( treat_expansion ) THEN
487
488             WHERE ( can_introduce(:) )
489
490                ! low value at the beginning
491                everywhere(:,j) = everywhere_init
492             ENDWHERE
493
494          ELSE
495
496             ! expansion is not treated
497             WHERE ( can_introduce(:) )
498                everywhere(:,j) = un
499             ENDWHERE
500
501          ENDIF ! treat expansion
502
503       ENDIF ! only natural PFTs
504
505    ENDDO ! Loop over # PFTs
506
507  !! 7. If a PFT has been present once in a grid box, we suppose that it will survive
508
509    !   If a PFT has been present once in a grid box, we suppose that it will survive
510    !   in isolated places (e.g., an oasis) within that grid box, even if it gets
511    !   officially eliminated from it later. That means that if climate becomes favorable
512    !   again, it will not need to get seeds from adjacent grid cells.
513    WHERE ( PFTpresent )
514       need_adjacent = .FALSE.
515    ENDWHERE
516
517    IF (printlev>=4) WRITE(numout,*) 'Leaving pftinout'
518
519  END SUBROUTINE pftinout
520
521END MODULE lpj_pftinout
Note: See TracBrowser for help on using the repository browser.