/// <summary>
 /// Adds some biomass for a species to the WOOD litter pools at a site.
 /// </summary>
 public static void AddWoodLitter(double woodBiomass,
                                  ISpecies species,
                                  ActiveSite site)
 {
     if (woodBiomass > 0)
     {
         WoodLayer.PartitionResidue(woodBiomass,
                                    FunctionalType.Table[SpeciesData.FuncType[species]].WoodDecayRate,
                                    SpeciesData.WoodCN[species],
                                    SpeciesData.WoodLignin[species],
                                    LayerName.Wood,
                                    LayerType.Surface,
                                    site);
     }
 }
Esempio n. 2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Kills coarse roots and add the biomass to the Wood Debris pool.
        /// </summary>
        public static void AddCoarseRootLitter(double abovegroundWoodBiomass, ICohort cohort,
                                               ISpecies species,
                                               ActiveSite site)
        {
            double coarseRootBiomass = CalculateCoarseRoot(cohort, abovegroundWoodBiomass); // Ratio above to below

            if (coarseRootBiomass > 0)
            {
                WoodLayer.PartitionResidue(coarseRootBiomass,
                                           FunctionalType.Table[SpeciesData.FuncType[species]].WoodDecayRate,
                                           SpeciesData.CoarseRootCN[species],
                                           SpeciesData.CoarseRootLignin[species],
                                           LayerName.CoarseRoot,
                                           LayerType.Soil,
                                           site);
            }
        }
        /// <summary>
        /// Grows all cohorts at a site for a specified number of years.
        /// Litter is decomposed following the Century model.
        /// </summary>
        public static ISiteCohorts Run(ActiveSite site,
                                       int years,
                                       bool isSuccessionTimeStep)
        {
            ISiteCohorts siteCohorts = SiteVars.Cohorts[site];
            IEcoregion   ecoregion   = PlugIn.ModelCore.Ecoregion[site];

            for (int y = 0; y < years; ++y)
            {
                Year = y + 1;

                if (Climate.Future_MonthlyData.ContainsKey(PlugIn.FutureClimateBaseYear + y + PlugIn.ModelCore.CurrentTime - years))
                {
                    ClimateRegionData.AnnualWeather[ecoregion] = Climate.Future_MonthlyData[PlugIn.FutureClimateBaseYear + y - years + PlugIn.ModelCore.CurrentTime][ecoregion.Index];
                }

                SiteVars.ResetAnnualValues(site);

                if (y == 0 && SiteVars.FireSeverity != null && SiteVars.FireSeverity[site] > 0)
                {
                    FireEffects.ReduceLayers(SiteVars.FireSeverity[site], site);
                }

                // Next, Grow and Decompose each month
                int[] months = new int[12] {
                    6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5
                };

                if (OtherData.CalibrateMode)
                {
                    //months = new int[12]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; This output will not match normal mode due to differences in initialization
                    months = new int[12] {
                        6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5
                    }
                }
                ;

                PlugIn.AnnualWaterBalance = 0;

                for (MonthCnt = 0; MonthCnt < 12; MonthCnt++)
                {
                    // Calculate mineral N fractions based on coarse root biomass.  Only need to do once per year.
                    if (MonthCnt == 0)
                    {
                        AvailableN.CalculateMineralNfraction(site);
                    }

                    Month = months[MonthCnt];

                    SiteVars.MonthlyAGNPPcarbon[site][Month] = 0.0;
                    SiteVars.MonthlyBGNPPcarbon[site][Month] = 0.0;
                    SiteVars.MonthlyNEE[site][Month]         = 0.0;
                    SiteVars.MonthlyResp[site][Month]        = 0.0;
                    SiteVars.MonthlyStreamN[site][Month]     = 0.0;
                    SiteVars.SourceSink[site].Carbon         = 0.0;
                    SiteVars.TotalWoodBiomass[site]          = Century.ComputeWoodBiomass(site);

                    double ppt = ClimateRegionData.AnnualWeather[ecoregion].MonthlyPrecip[Century.Month];

                    double monthlyNdeposition;
                    if (PlugIn.AtmosNintercept != -1 && PlugIn.AtmosNslope != -1)
                    {
                        monthlyNdeposition = PlugIn.AtmosNintercept + (PlugIn.AtmosNslope * ppt);
                    }
                    else
                    {
                        monthlyNdeposition = ClimateRegionData.AnnualWeather[ecoregion].MonthlyNDeposition[Century.Month];
                    }

                    ClimateRegionData.MonthlyNDeposition[ecoregion][Month] = monthlyNdeposition;
                    ClimateRegionData.AnnualNDeposition[ecoregion]        += monthlyNdeposition;
                    SiteVars.MineralN[site] += monthlyNdeposition;

                    double liveBiomass = (double)ComputeLivingBiomass(siteCohorts);
                    double baseFlow, stormFlow, AET;
                    SoilWater.Run(y, Month, liveBiomass, site, out baseFlow, out stormFlow, out AET);

                    PlugIn.AnnualWaterBalance += ppt - AET;

                    // Calculate N allocation for each cohort
                    AvailableN.SetMineralNallocation(site);

                    if (MonthCnt == 11)
                    {
                        siteCohorts.Grow(site, (y == years && isSuccessionTimeStep), true);
                    }
                    else
                    {
                        siteCohorts.Grow(site, (y == years && isSuccessionTimeStep), false);
                    }

                    WoodLayer.Decompose(site);
                    LitterLayer.Decompose(site);
                    SoilLayer.Decompose(site);

                    // Volatilization loss as a function of the mineral N which remains after uptake by plants.
                    // ML added a correction factor for wetlands since their denitrification rate is double that of wetlands
                    // based on a review paper by Seitziner 2006.

                    double volatilize = (SiteVars.MineralN[site] * PlugIn.DenitrificationRate);

                    SiteVars.MineralN[site]            -= volatilize;
                    SiteVars.SourceSink[site].Nitrogen += volatilize;
                    SiteVars.Nvol[site] += volatilize;

                    SoilWater.Leach(site, baseFlow, stormFlow);

                    SiteVars.MonthlyNEE[site][Month] -= SiteVars.MonthlyAGNPPcarbon[site][Month];
                    SiteVars.MonthlyNEE[site][Month] -= SiteVars.MonthlyBGNPPcarbon[site][Month];
                    SiteVars.MonthlyNEE[site][Month] += SiteVars.SourceSink[site].Carbon;
                    SiteVars.FineFuels[site]          = (SiteVars.SurfaceStructural[site].Carbon + SiteVars.SurfaceMetabolic[site].Carbon) * 2.0;
                }
            }

            ComputeTotalCohortCN(site, siteCohorts);

            return(siteCohorts);
        }