コード例 #1
0
        //---------------------------------------------------------------------

        private double UpdateDeadBiomass(ICohort cohort, double actualANPP, double totalMortality, ActiveSite site, double newBiomass)
        {
            ISpecies species       = cohort.Species;
            double   leafLongevity = SpeciesData.LeafLongevity[species];
            double   cohortBiomass = newBiomass; // Mortality is for the current year's biomass.
            double   leafFraction  = ComputeFractionANPPleaf(species);

            // First, deposit the a portion of the leaf mass directly onto the forest floor.
            // In this way, the actual amount of leaf biomass is added for the year.
            // In addition, add the equivalent portion of fine roots to the surface layer.

            // 0.8 was used to calibrate the model to steady-state Nitrogen.  Without this reduction, total N
            // increases by 0.038% each year.
            // Remove jan 2020 to more closely match code with the current Biomass succession model

            //double annualLeafANPP = actualANPP * leafFraction * 0.8;
            double annualLeafANPP = actualANPP * leafFraction;

            // --------------------------------------------------------------------------------
            // The next section allocates mortality from standing (wood and leaf) biomass, i.e.,
            // biomass that has accrued from previous years' growth.

            // Subtract annual leaf growth as that was taken care of above.
            totalMortality -= annualLeafANPP;

            // Assume that standing foliage is equal to this years annualLeafANPP * leaf longevity
            // minus this years leaf ANPP.  This assumes that actual ANPP has been relatively constant
            // over the past 2 or 3 years (if coniferous).

            double standing_nonwood = (annualLeafANPP * leafLongevity) - annualLeafANPP;
            double standing_wood    = Math.Max(0, cohortBiomass - standing_nonwood);

            double fractionStandingNonwood = standing_nonwood / cohortBiomass;

            //  Assume that the remaining mortality is divided proportionally
            //  between the woody mass and non-woody mass (Niklaus & Enquist,
            //  2002).   Do not include current years growth.
            double mortality_nonwood = Math.Max(0.0, totalMortality * fractionStandingNonwood);
            double mortality_wood    = Math.Max(0.0, totalMortality - mortality_nonwood);

            if (mortality_wood < 0 || mortality_nonwood < 0)
            {
                throw new ApplicationException("Error: Woody input is < 0");
            }

            //  Total mortality not including annual leaf litter
            M_noLeafLitter = (int)mortality_wood;

            SiteVars.soilClass[site].CollectBiomassMortality(species, cohort.Age, mortality_wood, (mortality_nonwood + annualLeafANPP), 0);

            //add root biomass information - now calculated based on both woody and non-woody biomass
            Roots.CalculateRootTurnover(site, species, cohortBiomass);
            SiteVars.soilClass[site].CollectBiomassMortality(species, cohort.Age, Roots.CoarseRootTurnover, Roots.FineRootTurnover, 1);

            //if biomass is going down, then we need to capture a decrease in the roots as well.
            if (cohortBiomass < cohort.Biomass)
            {
                double preMortRoots  = Roots.CalculateRootBiomass(site, species, cohort.Biomass);
                double preMortCoarse = Roots.CoarseRoot;
                double preMortFine   = Roots.FineRoot;
                double TotRoots      = Roots.CalculateRootBiomass(site, species, cohortBiomass);
                if (preMortRoots > TotRoots) //if the root biomass went down, then we need to allocate that difference.
                {                            //We will allocate the total root decline to the different pools based on the relative proportions
                    //prior to the decline. (Note that we are not calculating actual declines for each type because
                    //sometimes if we are changing calculation methods, we may change the allocation and may cause a large
                    //decrease in one pool and an increase in the other.)
                    double diffFine   = (preMortFine / preMortRoots) * (preMortRoots - TotRoots);
                    double diffCoarse = (preMortRoots - TotRoots) - diffFine;
                    SiteVars.soilClass[site].CollectBiomassMortality(species, cohort.Age, diffCoarse, diffFine, 1);

                    //write a note to the file if the allocation changes unexpectedly, but not during spin-up
                    if (((preMortCoarse - Roots.CoarseRoot) < 0 || (preMortFine - Roots.FineRoot) < 0) && PlugIn.ModelCore.CurrentTime > 0)
                    {
                        string strCombo = "from: " + preMortCoarse;
                        strCombo += " to: " + Roots.CoarseRoot;
                        string strCombo2 = "from: " + preMortFine;
                        strCombo2 += " to: " + Roots.FineRoot;
                        PlugIn.ModelCore.UI.WriteLine("Root Dynamics: Overall root biomass declined but note change in coarse root allocation " + strCombo + " and fine root allocation" + strCombo2);
                    }
                }
                else if (PlugIn.ModelCore.CurrentTime > 0)
                {
                    //write a note to the file if the root biomass increases while abio decreases, but not during spin-up
                    string strCombo = "from: " + cohort.Biomass;
                    strCombo += " to: " + cohortBiomass;
                    string strCombo2 = "from: " + preMortRoots;
                    strCombo2 += " to: " + TotRoots;
                    PlugIn.ModelCore.UI.WriteLine("Root Dynamics: Note that aboveground biomass decreased " + strCombo + " but root biomass increased " + strCombo2);
                }
            }

            if (PlugIn.ModelCore.CurrentTime == 0)
            {
                SiteVars.soilClass[site].CollectBiomassMortality(species, cohort.Age, standing_wood, standing_nonwood, 3);
                Roots.CalculateRootTurnover(site, species, (standing_wood + standing_nonwood));
                SiteVars.soilClass[site].CollectBiomassMortality(species, cohort.Age, Roots.CoarseRootTurnover, Roots.FineRootTurnover, 4);
            }

            return(annualLeafANPP + mortality_nonwood + mortality_wood);
        }