Exemplo n.º 1
0
        public void BiomassSpinUp(List <Landis.Library.AgeOnlyCohorts.ICohort> ageCohorts, ActiveSite site)
        {
            if (ageCohorts.Count == 0)
            {
                return;
            }
            System.DateTime SpinUpDate;

            // OLD: SpinUpDate = PlugIn.StartDate.AddYears(-(ageCohorts[0].Age) + ((successionTimestep == 1) ? -1 : 0));

            SpinUpDate = PlugIn.StartDate.AddYears(-(ageCohorts[0].Age));

            while (SpinUpDate.CompareTo(PlugIn.StartDate) < 0)
            {
                //  Add those cohorts that were born at the current year
                foreach (Library.AgeOnlyCohorts.ICohort ageonlycohort in ageCohorts)
                {
                    if (PlugIn.StartDate.Year - SpinUpDate.Year == ageonlycohort.Age)
                    {
                        Cohort cohort = new Cohort(ageonlycohort.Species, 1, ConstantParameters.InitialFol, 0, ConstantParameters.InitialWood, ConstantParameters.InitialFol, ConstantParameters.InitialRoot, SpinUpDate.Year);

                        AddNewCohort(cohort, PlugIn.TStep);

                        if (siteoutput != null)
                        {
                            CohortOutput.WriteHeader(site, cohort);
                        }
                    }
                }
                GrowCohorts(SpinUpDate, SpinUpDate.AddYears(1), false);

                SpinUpDate = SpinUpDate.AddYears(1);
            }
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Grows all cohorts at a site for a specified number of years.  The
        /// dead pools at the site also decompose for the given time period.
        /// </summary>

        public void AddNewCohort(ISpecies species, ActiveSite site)
        {
            PlugIn.NewCohorts[site][species]++;
            Cohort cohort = new Cohort(species, 1, ConstantParameters.InitialFol, 0, 0, 0, 0, year, false);

            CohortOutput.WriteHeader(site, cohort);


            PlugIn.Cohorts[site].AddNewCohort(cohort);
        }
Exemplo n.º 3
0
        public static void GrowTree(DateTime date, int canopylayer, CohortBiomass cohortbiomass, float AboveCanopyRadiation)
        {
            cohortbiomass = ComputePhotosynthesis(date, canopylayer, cohortbiomass, AboveCanopyRadiation);

            CohortBiomass.Allocation(cohortbiomass);
            CohortBiomass.MaintenanceRespiration(cohortbiomass);

            ForestFloor.Litter[cohortbiomass.site].AddMass(FoliageSenescence(cohortbiomass), 0.1);
            ForestFloor.WoodyDebris[cohortbiomass.site].AddMass(WoodSenescence(cohortbiomass), 0.1);

            CohortOutput.WriteCohortData(date, cohortbiomass.site, cohortbiomass);
        }
Exemplo n.º 4
0
        public void AddNewCohort(ISpecies species, ActiveSite site)
        {
            //System.Console.WriteLine("AddNewCohort " + site + " " + species.Name);
            siteconditions[site].NewCohorts[species]++;

            Cohort cohort = new Cohort(species, 1, ConstantParameters.InitialFol, 0, ConstantParameters.InitialWood, 0, ConstantParameters.InitialRoot, year);

            siteconditions[site].Establishment.Establishments[species]++;


            if (HasSiteOutput[site] == true)
            {
                CohortOutput.WriteHeader(site, cohort);
            }

            siteconditions[site].AddNewCohort(cohort, PlugIn.TStep);
        }
        //---------------------------------------------------------------------

        /// <summary>
        /// Makes the set of biomass cohorts at a site based on the age cohorts
        /// at the site, using a specified method for computing a cohort's
        /// initial biomass.
        /// </summary>
        /// <param name="ageCohorts">
        /// A sorted list of age cohorts, from oldest to youngest.
        /// </param>
        /// <param name="site">
        /// Site where cohorts are located.
        /// </param>
        /// <param name="initialBiomassMethod">
        /// The method for computing the initial biomass for a new cohort.
        /// </param>

        public static ISiteCohorts MakeBiomassCohorts(List <Landis.Library.AgeOnlyCohorts.ICohort> ageCohorts, ActiveSite site)

        {
            PlugIn.Cohorts[site] = new Library.BiomassCohortsPnET.SiteCohorts();

            Hydrology.Initialize(site);

            Hydrology.AnnualTranspiration[site] = 0;
            CanopyBiomass.CanopyLAI[site]       = 0;

            if (ageCohorts.Count == 0)
            {
                return(PlugIn.Cohorts[site]);
            }

            System.DateTime SpinUpDate = PlugIn.StartDate.AddYears(-(ageCohorts[0].Age) + ((successionTimestep == 1) ? -1 : 0));

            while (SpinUpDate.CompareTo(PlugIn.StartDate) < 0)
            {
                CanopyBiomass.SubCanopyPAR[site] = Static.PAR0[SpinUpDate];

                //  Add those cohorts that were born at the current year
                foreach (Library.AgeOnlyCohorts.ICohort ageonlycohort in ageCohorts)
                {
                    if (PlugIn.StartDate.Year - SpinUpDate.Year == ageonlycohort.Age)
                    {
                        Cohort cohort = new Cohort(ageonlycohort.Species, 1, ConstantParameters.InitialFol, 0, 0, 0, 0, SpinUpDate.Year, true);
                        PlugIn.Cohorts[site].AddNewCohort(cohort);
                        CohortOutput.WriteHeader(site, cohort);
                        SiteOutput.WriteHeader(site);
                    }
                }

                PlugIn.GrowCohorts(site, SpinUpDate, SpinUpDate.AddYears(1), false);

                SpinUpDate = SpinUpDate.AddYears(1);
            }


            return(PlugIn.Cohorts[site]);
        }
Exemplo n.º 6
0
        //---------------------------------------------------------------------
        public override void Initialize()
        {
            cohorts        = PlugIn.ModelCore.Landscape.NewSiteVar <ISiteCohorts>();
            BiomassCohorts = new BiomassCohortsSiteVar(cohorts);
            baseCohorts    = new Landis.Library.Biomass.BaseCohortsSiteVar(BiomassCohorts);

            // Counts added cohorts per site and per species
            newcohorts = PlugIn.ModelCore.Landscape.NewSiteVar <Landis.Library.Biomass.Species.AuxParm <int> >();
            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                newcohorts[site] = new Landis.Library.Biomass.Species.AuxParm <int>(PlugIn.ModelCore.Species);
            }


            PlugIn.ModelCore.RegisterSiteVar(NewCohorts, "Succession.NewCohorts");
            PlugIn.ModelCore.RegisterSiteVar(cohorts, "Succession.BiomassCohortsPnET");
            PlugIn.ModelCore.RegisterSiteVar(BiomassCohorts, "Succession.BiomassCohorts");

            PlugIn.ModelCore.RegisterSiteVar(baseCohorts, "Succession.AgeCohorts");

            Edu.Wisc.Forest.Flel.Util.Directory.EnsureExists("output");
            CohortOutput.Initialize(parameters);
            SiteOutput.Initialize(parameters);
            CohortBiomass.Initialize(parameters);
            EstablishmentProbability.Initialize(parameters);
            CanopyBiomass.Initialize(parameters);
            Static.Initialize(parameters);
            Hydrology.Initialize(parameters);

            Timestep = parameters.Timestep;
            tstep    = parameters.Timestep;



            // Initialize Reproduction routines:
            // Reproduction.SufficientResources = SufficientLight;
            Reproduction.Establish         = Establish;
            Reproduction.AddNewCohort      = AddNewCohort;
            Reproduction.MaturePresent     = MaturePresent;
            Reproduction.PlantingEstablish = PlantingEstablish;
            base.Initialize(modelCore, parameters.SeedAlgorithm);

            InitialBiomass.Initialize(parameters);

            Cohort.DeathEvent += CohortDied;

            // TODO ARJAN !!
            //Landis.Extension.Succession.Biomass.AgeOnlyDisturbances.Module.Initialize(parameters.AgeOnlyDisturbanceParms);

            ForestFloor.Initialize(parameters);

            SiteOutput.Initialize(parameters);



            StartDate = new System.DateTime(parameters.StartYear, 1, 15);

            year  = StartDate.Year;
            month = StartDate.Month;

            InitializeSites(parameters.InitialCommunities, parameters.InitialCommunitiesMap, modelCore);
        }
Exemplo n.º 7
0
        public void CalculatePhotosynthesis(DateTime date, ActiveSite site, Hydrology hydrology, ForestFloor forestfloor, SiteOutput siteoutput)
        {
            autotrophicrespiration = 0;
            grosspsn     = 0;
            netpsn       = 0;
            totalnsc     = 0;
            totalroot    = 0;
            totalfoliage = 0;
            totalbiomass = 0;
            maxbiom      = 0;
            maxage       = 0;
            for (int canopylayer = canopy.Length - 1; canopylayer >= 0; canopylayer--)
            {
                for (int ix = 0; ix < IMAX; ix++)
                {
                    if (canopy[canopylayer] == null)
                    {
                        continue;
                    }

                    for (int coh = canopy[canopylayer].Count - 1; coh >= 0; coh--)
                    {
                        CohortBiomass CB = canopy[canopylayer][coh];

                        if (ix == 0)
                        {
                            forestfloor.WoodyDebris.AddMass(CB.WoodSenescence(), KWdLit[CB.Cohort.Species]);
                            forestfloor.Litter.AddMass(CB.FoliageSenescence(date, PlugIn.modelCore.Ecoregion[site], CB.Cohort.Species), ForestFloor.KNwdLitter[PlugIn.modelCore.Ecoregion[site], CB.Cohort.Species]);
                        }

                        float transpiration_lyr = 0;



                        bool cohortisalive = CB.ComputePhotosynthesis(date, PlugIn.modelCore.Ecoregion[site], ix, (int)IMAX, hydrology, ref transpiration_lyr);

                        if (CB.Cohort.Age > MaxAge)
                        {
                            maxage = CB.Cohort.Age;
                        }
                        if (MaxBiom < CB.Cohort.Biomass)
                        {
                            maxbiom = CB.Cohort.Biomass;
                        }

                        autotrophicrespiration += CB.Autotrophicrespiration;
                        netpsn   += CB.NetPsn;
                        grosspsn += CB.GrossPsn;

                        if (cohortisalive == false)
                        {
                            deadcohorts.Add(CB.Cohort);
                            forestfloor.WoodyDebris.AddMass(CB.Cohort.Biomass, KWdLit[CB.Cohort.Species]);
                            forestfloor.Litter.AddMass(CB.Cohort.Fol, ForestFloor.KNwdLitter[PlugIn.modelCore.Ecoregion[site], CB.Cohort.Species]);
                        }

                        transpiration += transpiration_lyr;

                        if (transpiration_lyr > hydrology.Water)
                        {
                            IncrementIMAX(site, date);

                            return;
                        }
                        else
                        {
                            hydrology.SubtractTranspiration(date, transpiration_lyr);
                        }

                        if (ix == 0)
                        {
                            totalbiomass += CB.Cohort.Biomass;
                            totalfoliage += CB.Cohort.Fol;
                            totalnsc     += CB.Cohort.NSC;
                            totalroot    += CB.Cohort.Root;

                            CB.MaintenanceRespiration(PlugIn.modelCore.Ecoregion[site], date);


                            if (siteoutput != null)
                            {
                                //System.Console.WriteLine("WriteCohortData\t" + site.ToString() + "\t" + date.ToString());
                                CohortOutput.WriteCohortData(date, site, canopy[canopylayer][coh], hydrology.Water);
                            }
                        }
                    }
                }
            }//IMAX
        }