コード例 #1
0
 public static void SubtractTranspiration(CohortBiomass cohortbiomass)
 {
     if (cohortbiomass.NetPsn <= 0)
     {
         return;
     }
     waterconsumption = (float)Math.Min(Hydrology.Water[cohortbiomass.site], cohortbiomass.Transpiration);
     Hydrology.Water[cohortbiomass.site] -= waterconsumption;
     Hydrology.AnnualTranspiration[cohortbiomass.site] += waterconsumption;
 }
コード例 #2
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);
        }
コード例 #3
0
        public static float WoodSenescence(CohortBiomass cohortbiomass)
        {
            rootsenescence             = cohortbiomass.Cohort.Root * RootTurnover[cohortbiomass.spc] / 12;
            cohortbiomass.Cohort.Root -= rootsenescence;
            ForestFloor.WoodyDebris[cohortbiomass.site].AddMass(rootsenescence, 0);

            woodsenescence             = cohortbiomass.Cohort.Wood * WoodTurnover[cohortbiomass.spc] / 12;
            cohortbiomass.Cohort.Wood -= woodsenescence;
            ForestFloor.WoodyDebris[cohortbiomass.site].AddMass(woodsenescence, 0);

            return(woodsenescence + rootsenescence);
        }
コード例 #4
0
        public static void Shuffle(ref List <CohortBiomass> Cohorts)
        {
            Random rng = new Random();
            int    n   = Cohorts.Count;

            while (n > 1)
            {
                int           k    = rng.Next(n--);
                CohortBiomass temp = Cohorts[n];
                Cohorts[n] = Cohorts[k];
                Cohorts[k] = temp;
            }
        }
コード例 #5
0
        public static void WriteCohortData(DateTime date, ActiveSite site, CohortBiomass cohortbiomass)
        {
            if (HasSiteOutput[cohortbiomass.Site] == false)
            {
                return;
            }


            FileName = "output/CohortData_" + site + "_" + cohortbiomass.Cohort.YearOfBirth + "_" + cohortbiomass.Cohort.Species.Name + Constants.ext;

            string contents = date.Year + delim +
                              date.Month + delim +
                              date.ToString("yyyy/MM") + delim +
                              cohortbiomass.Cohort.CanopyLayer + delim +
                              cohortbiomass.AboveCanopyRadiation + delim +
                              cohortbiomass.Cohort.Leaf_On + delim +
                              cohortbiomass.LAI + delim +
                              Static.GDD[date][cohortbiomass.Cohort.Species] + delim +
                              cohortbiomass.GrossPsn + delim +
                              cohortbiomass.FolResp + delim +
                              cohortbiomass.MaintResp + delim +
                              cohortbiomass.NetPsn + delim +
                              cohortbiomass.ReleasedNSC + delim +
                              cohortbiomass.Folalloc + delim +
                              cohortbiomass.WoodAlloc + delim +
                              cohortbiomass.RootAlloc + delim +
                              Static.VPD[date] + delim +
                              cohortbiomass.WUE + delim +
                              Static.DelAmax[date][cohortbiomass.Cohort.Species] + delim +
                              cohortbiomass.Transpiration + delim +
                              cohortbiomass.Cohort.Fol + delim +
                              //cohortbiomass.Cohort.FolShed + delim +
                              cohortbiomass.Cohort.Root + delim +
                              cohortbiomass.Cohort.Wood + delim +
                              cohortbiomass.Cohort.NSC + delim +
                              Hydrology.Water[cohortbiomass.Site] + delim +
                              cohortbiomass.WFPS + delim +
                              cohortbiomass.DWater + delim +
                              Static.DTempPSN[date][cohortbiomass.Cohort.Species] + delim +
                              Static.DTempResp[date][cohortbiomass.Cohort.Species] + delim +
                              cohortbiomass.Fage + delim +
                              cohortbiomass.fRad;

            System.IO.StreamWriter sw = System.IO.File.AppendText(FileName);
            sw.WriteLine(contents);

            sw.Close();
        }
コード例 #6
0
        public static float FoliageSenescence(CohortBiomass cohortbiomass)
        {
            if (date.DayOfYear > SenescStart[cohortbiomass.spc] && cohortbiomass.Cohort.Leaf_On == true)//
            {
                cohortbiomass.Cohort.Leaf_On = false;
                //cohortbiomass.Cohort.FolShed += FolReten[cohortbiomass.spc] * FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;
                //cohortbiomass.Cohort.Fol -= FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;

                cohortbiomass.Cohort.FolShed = FolReten[cohortbiomass.spc] * FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;
                cohortbiomass.Cohort.Fol    -= FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;

                return(FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol);// lost foliage
            }

            return(0);
        }
コード例 #7
0
        public static void Allocation(CohortBiomass cohortbiomass)
        {
            folalloc    = 0;
            woodalloc   = 0;
            rootalloc   = 0;
            releasednsc = 0;

            cohortbiomass.cohort.NSC += cohortbiomass.NetPsn;
            if (cohortbiomass.cohort.NSC < 0)
            {
                cohortbiomass.cohort.NSC = 0;
            }


            if (Static.GDD[date][cohortbiomass.spc] > GDDFolStart[cohortbiomass.spc] &&
                date.DayOfYear < SenescStart[cohortbiomass.spc])// &&
            {
                cohortbiomass.cohort.Leaf_On = true;

                cohortbiomass.cohort.Fol    += cohortbiomass.cohort.FolShed;
                cohortbiomass.cohort.FolShed = 0;

                releasednsc = DNSC[cohortbiomass.spc] * cohortbiomass.cohort.NSC;
                cohortbiomass.cohort.NSC -= releasednsc;

                if (Static.GDD[date][cohortbiomass.spc] < GDDFolEnd[cohortbiomass.spc])
                {
                    //System.Console.WriteLine("FRESP = " + ClimateDependentData.FResp[PlugIn.Date[cohortbiomass.site]][cohortbiomass.spc]);
                    folalloc = frad * releasednsc;
                }

                cohortbiomass.cohort.Fol += folalloc / ConstantParameters.CFracBiomass;

                RootPlusWoodAlloc = releasednsc - folalloc;

                if (cohortbiomass.cohort.Root / cohortbiomass.cohort.Biomass < RootStemRatio[cohortbiomass.spc])
                {
                    rootalloc = RootPlusWoodAlloc / ConstantParameters.CFracBiomass;
                    cohortbiomass.cohort.Root += rootalloc;
                }
                else
                {
                    woodalloc = RootPlusWoodAlloc / ConstantParameters.CFracBiomass;
                    cohortbiomass.cohort.Wood += woodalloc;
                }
            }
        }
コード例 #8
0
        public void SimulateCanopyLayers(DateTime date, int canopylayer, float radiation)
        {
            netpsn   = 0;
            grosspsn = 0;
            lai      = 0;

            if (Cohorts.Count() == 0)
            {
                belowcanopyradiation = radiation;
            }
            else
            {
                belowcanopyradiation = 0;
            }

            Shuffle(ref Cohorts);

            float SumLAI = 0;

            foreach (CohortBiomass cohortbiomass in Cohorts)
            {
                CohortBiomass.GrowTree(date, canopylayer, cohortbiomass, radiation);


                SumLAI += cohortbiomass.LAI;

                belowcanopyradiation += cohortbiomass.BelowCanopyRadiation / Cohorts.Count();

                netpsn   += cohortbiomass.NetPsn;
                grosspsn += cohortbiomass.GrossPsn;
                folresp  += cohortbiomass.FolResp;


                Hydrology.SubstractTranspiration(date, cohortbiomass.Site, cohortbiomass.Transpiration);
            }


            if (Cohorts.Count() > 0)
            {
                lai = SumLAI / (float)Cohorts.Count();
            }
            else
            {
                lai = 0;
            }
        }
コード例 #9
0
        /*
         * public static void DefineAgeLayers(ActiveSite site)
         * {
         *  canopy.Clear();
         *
         *  float SumFoliageBiomass = 0;
         *  foreach (ISpeciesCohorts speciesCohorts in PlugIn.Cohorts[site])
         *  {
         *      int index = 0;
         *      foreach (ICohort cohort in speciesCohorts)
         *      {
         *          SumFoliageBiomass += cohort.Fol;
         *
         *          int CanopyLayer = (int)(cohort.Age / CanopyLayerAgeSpan);
         *
         *          while (canopy.Count < CanopyLayer + 1)
         *          {
         *              canopy.Add(new CanopyLayerBiomass());
         *          }
         *
         *          canopy[CanopyLayer].Add(new CohortBiomass(site, PlugIn.Cohorts[site][cohort.Species].Get(index), index));
         *          index++;
         *      }
         *  }
         *
         *  for (int l = 0; l < canopy.Count; l++)
         *  {
         *      if (canopy[l].Count == 0)
         *      {
         *          canopy.Remove(canopy[l]);
         *          l--;
         *      }
         *  }
         *
         *  NumberOfCanopyLayers[site] = canopy.Count;
         *
         * }
         */

        public static void RemoveDeadCohorts(ActiveSite site)
        {
            foreach (ISpeciesCohorts speciesCohorts in PlugIn.Cohorts[site])
            {
                for (int index = 0; index < speciesCohorts.Count; index++)
                {
                    if (CohortBiomass.CohortIsDead(PlugIn.Cohorts[site][speciesCohorts.Species].Get(index)))
                    {
                        ForestFloor.WoodyDebris[site].AddMass(PlugIn.Cohorts[site][speciesCohorts.Species].Get(index).Biomass, 0.001);

                        DeadCohortAges[site][speciesCohorts.Species].Add(PlugIn.Cohorts[site][speciesCohorts.Species].Get(index).Age);
                        deadcohorts[site][speciesCohorts.Species]++;

                        PlugIn.Cohorts[site][speciesCohorts.Species].RemoveCohort(index, PlugIn.Cohorts[site][speciesCohorts.Species].Get(index), site, null);
                    }
                }
            }
        }
コード例 #10
0
        public static void WriteCohortData(DateTime date, ActiveSite site, CohortBiomass cohortbiomass)
        {
            if (HasSiteOutput[cohortbiomass.Site] == false) return;

            FileName = "output/CohortData_" + site + "_" + cohortbiomass.Cohort.YearOfBirth + "_" + cohortbiomass.Cohort.Species.Name + Constants.ext;

            string contents = date.Year + delim +
                              date.Month + delim +
                              date.ToString("yyyy/MM") + delim +
                              cohortbiomass.Cohort.CanopyLayer + delim +
                              cohortbiomass.AboveCanopyRadiation + delim +
                              cohortbiomass.Cohort.Leaf_On + delim +
                              cohortbiomass.LAI + delim +
                              Static.GDD[date][cohortbiomass.Cohort.Species] + delim +
                              cohortbiomass.GrossPsn + delim +
                              cohortbiomass.FolResp + delim +
                              cohortbiomass.MaintResp + delim +
                              cohortbiomass.NetPsn + delim +
                              cohortbiomass.ReleasedNSC + delim +
                              cohortbiomass.Folalloc + delim +
                              cohortbiomass.WoodAlloc + delim +
                              cohortbiomass.RootAlloc + delim +
                              Static.VPD[date] + delim +
                              cohortbiomass.WUE + delim +
                              Static.DelAmax[date][cohortbiomass.Cohort.Species] + delim +
                              cohortbiomass.Transpiration + delim +
                              cohortbiomass.Cohort.Fol + delim +
                              //cohortbiomass.Cohort.FolShed + delim +
                              cohortbiomass.Cohort.Root + delim +
                              cohortbiomass.Cohort.Wood + delim +
                              cohortbiomass.Cohort.NSC  + delim +
                              Hydrology.Water[cohortbiomass.Site] + delim +
                               cohortbiomass.WFPS + delim +
                              cohortbiomass.DWater + delim +
                              Static.DTempPSN[date][cohortbiomass.Cohort.Species] + delim +
                              Static.DTempResp[date][cohortbiomass.Cohort.Species] + delim +
                              cohortbiomass.Fage + delim +
                              cohortbiomass.fRad;

            System.IO.StreamWriter sw = System.IO.File.AppendText(FileName);
            sw.WriteLine(contents);

            sw.Close();
        }
コード例 #11
0
        public static void WriteCohortData(DateTime date, ActiveSite site, CohortBiomass cohortbiomass, float water)
        {
            string     FileName  = OutputCohortFileName(site, cohortbiomass.Cohort);
            IEcoregion ecoregion = PlugIn.modelCore.Ecoregion[site];

            string contents = date.Year + delim +
                              date.Month + delim +
                              date.ToString("yyyy/MM") + delim +
                              cohortbiomass.Cohort.Age + delim +
                              cohortbiomass.Cohort.CanopyLayer + delim +
                              cohortbiomass.AboveCanopyRadiation + delim +
                              //StaticVariables.Leaf_On[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              cohortbiomass.SumLAI() + delim +
                              StaticVariables.GDD[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              StaticVariables.HDD[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              cohortbiomass.GrossPsn + delim +
                              cohortbiomass.FolResp + delim +
                              cohortbiomass.Autotrophicrespiration + delim +
                              cohortbiomass.NetPsn + delim +
                              cohortbiomass.ReleasedNSC + delim +
                              cohortbiomass.Folalloc + delim +
                              cohortbiomass.WoodAlloc + delim +
                              cohortbiomass.RootAlloc + delim +
                              StaticVariables.VPD[ecoregion, date] + delim +
                              cohortbiomass.WUE + delim +
                              cohortbiomass.Transpiration + delim +
                              cohortbiomass.Cohort.Fol + delim +
                              //cohortbiomass.Cohort.FolShed + delim +
                              cohortbiomass.Cohort.Root + delim +
                              cohortbiomass.Cohort.Wood + delim +
                              cohortbiomass.Cohort.NSC + delim +
                              cohortbiomass.FWater + delim +
                              StaticVariables.FTempPSN[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              StaticVariables.FTempResp[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              cohortbiomass.Fage + delim +
                              cohortbiomass.FRad + delim;



            System.IO.StreamWriter sw = System.IO.File.AppendText(FileName);
            sw.WriteLine(contents);

            sw.Close();
        }
コード例 #12
0
        public static void WriteCohortData(DateTime date, ActiveSite site, CohortBiomass cohortbiomass, float water)
        {
            string FileName = OutputCohortFileName(site, cohortbiomass.Cohort);
            IEcoregion ecoregion = PlugIn.modelCore.Ecoregion[site];

            string contents = date.Year + delim +
                              date.Month + delim +
                              date.ToString("yyyy/MM") + delim +
                              cohortbiomass.Cohort.Age + delim +
                              cohortbiomass.Cohort.CanopyLayer + delim +
                              cohortbiomass.AboveCanopyRadiation + delim +
                              //StaticVariables.Leaf_On[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              cohortbiomass.SumLAI() + delim +
                              StaticVariables.GDD[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              StaticVariables.HDD[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              cohortbiomass.GrossPsn + delim +
                              cohortbiomass.FolResp + delim +
                              cohortbiomass.Autotrophicrespiration + delim +
                              cohortbiomass.NetPsn + delim +
                              cohortbiomass.ReleasedNSC + delim +
                              cohortbiomass.Folalloc + delim +
                              cohortbiomass.WoodAlloc + delim +
                              cohortbiomass.RootAlloc + delim +
                              StaticVariables.VPD[ecoregion, date] + delim +
                              cohortbiomass.WUE + delim +
                              cohortbiomass.Transpiration + delim +
                              cohortbiomass.Cohort.Fol + delim +
                              //cohortbiomass.Cohort.FolShed + delim +
                              cohortbiomass.Cohort.Root + delim +
                              cohortbiomass.Cohort.Wood + delim +
                              cohortbiomass.Cohort.NSC + delim +
                              cohortbiomass.FWater + delim +
                              StaticVariables.FTempPSN[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              StaticVariables.FTempResp[ecoregion, cohortbiomass.Cohort.Species, date] + delim +
                              cohortbiomass.Fage + delim +
                              cohortbiomass.FRad + delim;

            System.IO.StreamWriter sw = System.IO.File.AppendText(FileName);
            sw.WriteLine(contents);

            sw.Close();
        }
 public void Add(CohortBiomass c)
 {
     Cohorts.Add(c);
 }
コード例 #14
0
        private static CohortBiomass ComputePhotosynthesis(DateTime Date, int canopylayer, CohortBiomass cohortbiomass, float AboveCanopyRadiation)
        {
            date = Date;
            cohortbiomass.cohort.CanopyLayer = canopylayer;

            abovecanopyradiation = AboveCanopyRadiation;

            cohortbiomass.lai = 0;
            grosspsn          = 0;
            folresp           = 0;
            netpsn            = 0;
            folresp           = 0;

            fage = 1 - cohortbiomass.cohort.Age / (cohortbiomass.cohort.Age + 1 / PsnAgeRed[cohortbiomass.spc]);

            WiltingPoint_mm = WiltingPoint[cohortbiomass.spc] * Hydrology.WHC[PlugIn.modelCore.Ecoregion[cohortbiomass.site]];

            wfps = (Hydrology.Water[cohortbiomass.site] - WiltingPoint_mm) / (Hydrology.WHC[PlugIn.ModelCore.Ecoregion[cohortbiomass.site]] - WiltingPoint_mm);

            dWater = (float)Math.Pow(Math.Max(0, wfps), GrowthMoistureSensitivity[cohortbiomass.spc]);

            frad = Get_frad(AboveCanopyRadiation, HalfSat[cohortbiomass.spc]);

            if (cohortbiomass.cohort.Fol > 0)
            {
                //float PosCBalMass = cohortbiomass.cohort.Fol;
                for (int ix = 1; ix <= IMAX; ix++)
                {
                    slwlayer             = SLWmax[cohortbiomass.spc] - (SLWDel[cohortbiomass.spc] * ix * (cohortbiomass.cohort.Fol / IMAX)); // SLW for this layer
                    cohortbiomass.lai   += (cohortbiomass.cohort.Fol / IMAX) / slwlayer;                                                     // cumulative LAI for whole canopy to this depth
                    belowcanopyradiation = AboveCanopyRadiation * (float)Math.Exp(-k[cohortbiomass.spc] * cohortbiomass.lai);                // light intensity at this level
                    frad = Get_frad(belowcanopyradiation, HalfSat[cohortbiomass.spc]);

                    netpsn += dWater * frad * fage * Static.DTempPSN[date][cohortbiomass.spc] * Static.RefNetPsn[date][cohortbiomass.spc] * (cohortbiomass.cohort.Fol / IMAX);

                    folresp += dWater * Static.DTempRespDay[date][cohortbiomass.spc] * Static.RefResp[date][cohortbiomass.spc] * (cohortbiomass.cohort.Fol / IMAX);
                } //for ix=1 to 50
            }     //if FolMass>0

            grosspsn = netpsn + folresp;


            //mm
            // Constants.MCO2 / Constants.MC: gCO2/gC
            transpiration = (grosspsn * (Constants.MCO2 / Constants.MC)) / Static.WUE_CO2_corr[date][cohortbiomass.spc];



            // wue based on Net Photosynthesis
            if (transpiration > 0)
            {
                cohortbiomass.wue = netpsn / transpiration;
            }
            else
            {
                cohortbiomass.wue = 0;
            }

            return(cohortbiomass);
        }
コード例 #15
0
 public void Add(CohortBiomass c)
 {
     Cohorts.Add(c);
 }
コード例 #16
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
        }
コード例 #17
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);
        }
コード例 #18
0
        public static float WoodSenescence(CohortBiomass cohortbiomass)
        {
            rootsenescence = cohortbiomass.Cohort.Root * RootTurnover[cohortbiomass.spc] / 12;
            cohortbiomass.Cohort.Root -= rootsenescence;
            ForestFloor.WoodyDebris[cohortbiomass.site].AddMass(rootsenescence, 0);

            woodsenescence = cohortbiomass.Cohort.Wood * WoodTurnover[cohortbiomass.spc] / 12;
            cohortbiomass.Cohort.Wood -= woodsenescence;
            ForestFloor.WoodyDebris[cohortbiomass.site].AddMass(woodsenescence, 0);

            return woodsenescence + rootsenescence;
        }
コード例 #19
0
 public static void SubtractTranspiration(CohortBiomass cohortbiomass)
 {
     if (cohortbiomass.NetPsn <= 0) return;
     waterconsumption =  (float)Math.Min(Hydrology.Water[cohortbiomass.site], cohortbiomass.Transpiration);
     Hydrology.Water[cohortbiomass.site] -= waterconsumption;
     Hydrology.AnnualTranspiration[cohortbiomass.site] += waterconsumption;
 }
コード例 #20
0
 public static void MaintenanceRespiration(CohortBiomass cohortbiomass)
 {
     cohortbiomass.maintresp = Math.Min(cohortbiomass.cohort.NSC, Static.DTempResp[date][cohortbiomass.spc] * MaintRespFrac[cohortbiomass.spc] * cohortbiomass.Cohort.Biomass);
     cohortbiomass.cohort.NSC -= cohortbiomass.MaintResp;
 }
コード例 #21
0
        public static float FoliageSenescence(CohortBiomass cohortbiomass)
        {
            if (date.DayOfYear > SenescStart[cohortbiomass.spc] && cohortbiomass.Cohort.Leaf_On == true)//
            {
                cohortbiomass.Cohort.Leaf_On = false;
                //cohortbiomass.Cohort.FolShed += FolReten[cohortbiomass.spc] * FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;
                //cohortbiomass.Cohort.Fol -= FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;

                cohortbiomass.Cohort.FolShed = FolReten[cohortbiomass.spc] * FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;
                cohortbiomass.Cohort.Fol -= FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;

                return FoliageTurnover[cohortbiomass.spc] * cohortbiomass.Cohort.Fol;// lost foliage
            }

            return 0;
        }
コード例 #22
0
        public static void Allocation(CohortBiomass cohortbiomass)
        {
            folalloc = 0;
            woodalloc = 0;
            rootalloc = 0;
            releasednsc = 0;

            cohortbiomass.cohort.NSC += cohortbiomass.NetPsn;
            if (cohortbiomass.cohort.NSC < 0) cohortbiomass.cohort.NSC = 0;

            if (Static.GDD[date][cohortbiomass.spc] > GDDFolStart[cohortbiomass.spc] &&
                date.DayOfYear < SenescStart[cohortbiomass.spc])// &&
            {
                cohortbiomass.cohort.Leaf_On = true;

                cohortbiomass.cohort.Fol +=  cohortbiomass.cohort.FolShed;
                cohortbiomass.cohort.FolShed = 0;

                releasednsc = DNSC[cohortbiomass.spc] * cohortbiomass.cohort.NSC;
                cohortbiomass.cohort.NSC -= releasednsc;

                if (Static.GDD[date][cohortbiomass.spc] < GDDFolEnd[cohortbiomass.spc])
                {
                    //System.Console.WriteLine("FRESP = " + ClimateDependentData.FResp[PlugIn.Date[cohortbiomass.site]][cohortbiomass.spc]);
                    folalloc =  frad * releasednsc;
                }

                cohortbiomass.cohort.Fol += folalloc / ConstantParameters.CFracBiomass;

                RootPlusWoodAlloc = releasednsc - folalloc;

                if (cohortbiomass.cohort.Root / cohortbiomass.cohort.Biomass < RootStemRatio[cohortbiomass.spc])
                {
                    rootalloc = RootPlusWoodAlloc / ConstantParameters.CFracBiomass;
                    cohortbiomass.cohort.Root += rootalloc;
                }
                else
                {
                    woodalloc = RootPlusWoodAlloc / ConstantParameters.CFracBiomass;
                    cohortbiomass.cohort.Wood += woodalloc;
                }

            }
        }
コード例 #23
0
 public static void MaintenanceRespiration(CohortBiomass cohortbiomass)
 {
     cohortbiomass.maintresp   = Math.Min(cohortbiomass.cohort.NSC, Static.DTempResp[date][cohortbiomass.spc] * MaintRespFrac[cohortbiomass.spc] * cohortbiomass.Cohort.Biomass);
     cohortbiomass.cohort.NSC -= cohortbiomass.MaintResp;
 }
コード例 #24
0
        private static CohortBiomass ComputePhotosynthesis(DateTime Date, int canopylayer, CohortBiomass cohortbiomass, float AboveCanopyRadiation)
        {
            date = Date;
            cohortbiomass.cohort.CanopyLayer = canopylayer;

            abovecanopyradiation = AboveCanopyRadiation;

            cohortbiomass.lai = 0;
            grosspsn = 0;
            folresp = 0;
            netpsn = 0;
            folresp = 0;

            fage = 1 - cohortbiomass.cohort.Age / (cohortbiomass.cohort.Age + 1 / PsnAgeRed[cohortbiomass.spc]);

            WiltingPoint_mm = WiltingPoint[cohortbiomass.spc] * Hydrology.WHC[PlugIn.modelCore.Ecoregion[cohortbiomass.site]];

            wfps = (Hydrology.Water[cohortbiomass.site] - WiltingPoint_mm) / (Hydrology.WHC[PlugIn.ModelCore.Ecoregion[cohortbiomass.site]] - WiltingPoint_mm);

            dWater = (float)Math.Pow(Math.Max(0, wfps), GrowthMoistureSensitivity[cohortbiomass.spc]);

            frad = Get_frad(AboveCanopyRadiation, HalfSat[cohortbiomass.spc]);

            if (cohortbiomass.cohort.Fol > 0)
            {

                //float PosCBalMass = cohortbiomass.cohort.Fol;
                for (int ix = 1; ix <= IMAX; ix++)
                {
                    slwlayer = SLWmax[cohortbiomass.spc] - (SLWDel[cohortbiomass.spc] * ix * (cohortbiomass.cohort.Fol / IMAX));                        // SLW for this layer
                    cohortbiomass.lai += (cohortbiomass.cohort.Fol / IMAX) / slwlayer;              // cumulative LAI for whole canopy to this depth
                    belowcanopyradiation = AboveCanopyRadiation * (float)Math.Exp(-k[cohortbiomass.spc] * cohortbiomass.lai);                             // light intensity at this level
                    frad = Get_frad(belowcanopyradiation, HalfSat[cohortbiomass.spc]);

                    netpsn += dWater * frad * fage * Static.DTempPSN[date][cohortbiomass.spc] * Static.RefNetPsn[date][cohortbiomass.spc] * (cohortbiomass.cohort.Fol / IMAX);

                    folresp += dWater * Static.DTempRespDay[date][cohortbiomass.spc] * Static.RefResp[date][cohortbiomass.spc] * (cohortbiomass.cohort.Fol / IMAX);

                }//for ix=1 to 50
            }//if FolMass>0

            grosspsn = netpsn + folresp;

            //mm
            // Constants.MCO2 / Constants.MC: gCO2/gC
            transpiration = (grosspsn * (Constants.MCO2 / Constants.MC)) / Static.WUE_CO2_corr[date][cohortbiomass.spc];

            // wue based on Net Photosynthesis
            if (transpiration > 0) cohortbiomass.wue = netpsn / transpiration;
            else cohortbiomass.wue = 0;

            return cohortbiomass;
        }
コード例 #25
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);
        }
コード例 #26
0
        //---------------------------------------------------------------------
        public override void Initialize()
        {
            PlugIn.ModelCore.UI.WriteLine("Initializing " + ExtensionName + " version " + typeof(PlugIn).Assembly.GetName().Version);

            /*Testing
             * Landis.Library.BiomassCohorts.Cohort C;
             * Cohort D;
             *
             * C = (Landis.Library.BiomassCohorts.Cohort)D;
             */


            hassiteoutput  = parameters.HasSiteOutput;
            siteconditions = PlugIn.ModelCore.Landscape.NewSiteVar <SiteConditions>();
            Edu.Wisc.Forest.Flel.Util.Directory.EnsureExists("output");

            //CohortOutput.Initialize(parameters);
            Hydrology.Initialize(parameters);
            StaticVariables.InitializeStatic(parameters);
            ForestFloor.Initialize(parameters);
            SiteConditions.Initialize(parameters);
            CohortBiomass.Initialize(parameters);

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

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

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

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

            InitializeSites(parameters.InitialCommunities, parameters.InitialCommunitiesMap, modelCore);

            EstablishmentProbability.Initialize(parameters);

            ISiteVar <ISiteCohorts> cohorts = PlugIn.ModelCore.Landscape.NewSiteVar <ISiteCohorts>();

            foreach (ActiveSite site in PlugIn.modelCore.Landscape)
            {
                cohorts[site] = siteconditions[site].Cohorts;
            }

            BiomassCohorts = new BiomassCohortsSiteVar(cohorts);
            baseCohorts    = new Landis.Library.Biomass.BaseCohortsSiteVar(BiomassCohorts);

            PlugIn.ModelCore.RegisterSiteVar(BiomassCohorts, "Succession.BiomassCohorts");

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


            ISiteVar <Pool> WoodyDebris = PlugIn.ModelCore.Landscape.NewSiteVar <Pool>();

            foreach (ActiveSite site in PlugIn.modelCore.Landscape)
            {
                WoodyDebris[site] = siteconditions[site].WoodyDebris;
            }
            PlugIn.ModelCore.RegisterSiteVar(WoodyDebris, "Succession.WoodyDebris");

            ISiteVar <Pool> Litter = PlugIn.ModelCore.Landscape.NewSiteVar <Pool>();

            foreach (ActiveSite site in PlugIn.modelCore.Landscape)
            {
                Litter[site] = siteconditions[site].WoodyDebris;
            }
            PlugIn.ModelCore.RegisterSiteVar(Litter, "Succession.Litter");
        }