Example #1
0
        public static ISiteVar <double> AnnualClimaticWaterDeficit; //Annual soil moisture calculation, defined as pet - aet


        //---------------------------------------------------------------------

        /// <summary>
        /// Initializes the module.
        /// </summary>
        public static void Initialize()
        {
            cohorts = PlugIn.ModelCore.Landscape.NewSiteVar <Library.LeafBiomassCohorts.SiteCohorts>();
            biomassCohortsSiteVar = Landis.Library.Succession.CohortSiteVar <Landis.Library.BiomassCohorts.ISiteCohorts> .Wrap(cohorts);

            baseCohortsSiteVar = Landis.Library.Succession.CohortSiteVar <Landis.Library.AgeOnlyCohorts.ISiteCohorts> .Wrap(cohorts);

            fineFuels = PlugIn.ModelCore.Landscape.NewSiteVar <double>();

            timeOfLast = PlugIn.ModelCore.Landscape.NewSiteVar <int>();

            // Dead biomass:
            surfaceDeadWood = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            soilDeadWood    = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();

            surfaceStructural = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            surfaceMetabolic  = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            soilStructural    = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            soilMetabolic     = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();

            // Soil Layers
            som1surface           = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            som1soil              = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            som2                  = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            som3                  = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            soilDepth             = PlugIn.ModelCore.Landscape.NewSiteVar <int>();
            soilDrain             = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilBaseFlowFraction  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilStormFlowFraction = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilFieldCapacity     = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilWiltingPoint      = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilPercentSand       = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilPercentClay       = PlugIn.ModelCore.Landscape.NewSiteVar <double>();

            // Other Layers
            stream     = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();
            sourceSink = PlugIn.ModelCore.Landscape.NewSiteVar <Layer>();

            // Other variables
            monthlyLAI       = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();
            mineralN         = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            resorbedN        = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            waterMovement    = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            availableWater   = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            liquidSnowPack   = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilWaterContent = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            decayFactor      = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            soilTemperature  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            anaerobicEffect  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            dryDays          = PlugIn.ModelCore.Landscape.NewSiteVar <int>();

            // Annual accumulators
            grossMineralization = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            ag_nppC             = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            bg_nppC             = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            litterfallC         = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            monthlyAGNPPC       = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();
            monthlyBGNPPC       = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();
            monthlyNEE          = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();
            monthlyStreamN      = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();
            AnnualNEE           = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            FireCEfflux         = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            FireNEfflux         = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            monthlyResp         = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();

            cohortLeafN  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortFRootN = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortLeafC  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortFRootC = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortWoodN  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortCRootN = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortWoodC  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            cohortCRootC = PlugIn.ModelCore.Landscape.NewSiteVar <double>();

            TotalWoodBiomass  = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            WoodMortality     = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            Nvol              = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            PrevYearMortality = PlugIn.ModelCore.Landscape.NewSiteVar <int>();
            totalNuptake      = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            monthlymineralN   = PlugIn.ModelCore.Landscape.NewSiteVar <double[]>();
            frassC            = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            lai           = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            annualPPT_AET = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            AnnualClimaticWaterDeficit = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            SmolderConsumption         = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            FlamingConsumption         = PlugIn.ModelCore.Landscape.NewSiteVar <double>();
            HarvestPrescriptionName    = PlugIn.ModelCore.GetSiteVar <string>("Harvest.PrescriptionName");
            //HarvestTime = PlugIn.ModelCore.GetSiteVar<int>("Harvest.TimeOfLastEvent");
            HarvestTime = PlugIn.ModelCore.Landscape.NewSiteVar <int>();

            CohortResorbedNallocation = PlugIn.ModelCore.Landscape.NewSiteVar <Dictionary <int, Dictionary <int, double> > >();

            PlugIn.ModelCore.RegisterSiteVar(cohorts, "Succession.LeafBiomassCohorts");
            PlugIn.ModelCore.RegisterSiteVar(baseCohortsSiteVar, "Succession.AgeCohorts");
            PlugIn.ModelCore.RegisterSiteVar(biomassCohortsSiteVar, "Succession.BiomassCohorts");
            PlugIn.ModelCore.RegisterSiteVar(SiteVars.FineFuels, "Succession.FineFuels");
            PlugIn.ModelCore.RegisterSiteVar(SiteVars.SmolderConsumption, "Succession.SmolderConsumption");
            PlugIn.ModelCore.RegisterSiteVar(SiteVars.FlamingConsumption, "Succession.FlamingConsumption");
            PlugIn.ModelCore.RegisterSiteVar(SiteVars.AnnualClimaticWaterDeficit, "Succession.CWD");


            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                surfaceDeadWood[site] = new Layer(LayerName.Wood, LayerType.Surface);
                soilDeadWood[site]    = new Layer(LayerName.CoarseRoot, LayerType.Soil);

                surfaceStructural[site] = new Layer(LayerName.Structural, LayerType.Surface);
                surfaceMetabolic[site]  = new Layer(LayerName.Metabolic, LayerType.Surface);
                soilStructural[site]    = new Layer(LayerName.Structural, LayerType.Soil);
                soilMetabolic[site]     = new Layer(LayerName.Metabolic, LayerType.Soil);
                som1surface[site]       = new Layer(LayerName.SOM1, LayerType.Surface);
                som1soil[site]          = new Layer(LayerName.SOM1, LayerType.Soil);
                som2[site] = new Layer(LayerName.SOM2, LayerType.Soil);
                som3[site] = new Layer(LayerName.SOM3, LayerType.Soil);

                stream[site]     = new Layer(LayerName.Other, LayerType.Other);
                sourceSink[site] = new Layer(LayerName.Other, LayerType.Other);

                monthlyAGNPPC[site]  = new double[12];
                monthlyBGNPPC[site]  = new double[12];
                monthlyNEE[site]     = new double[12];
                monthlyStreamN[site] = new double[12];
                monthlyResp[site]    = new double[12];
                monthlyLAI[site]     = new double[12];
                //monthlymineralN[site]       = new double[12];

                CohortResorbedNallocation[site] = new Dictionary <int, Dictionary <int, double> >();
            }
        }