Beispiel #1
0
        //---------------------------------------------------------------------

        public override void Run()
        {
            if (PlugIn.ModelCore.CurrentTime > 0)
            {
                SiteVars.InitializeDisturbances();
            }

            ClimateRegionData.AnnualNDeposition = new Ecoregions.AuxParm <double>(PlugIn.ModelCore.Ecoregions);

            //base.RunReproductionFirst();

            base.Run();

            if (Timestep > 0)
            {
                ClimateRegionData.SetAllEcoregions_FutureAnnualClimate(ModelCore.CurrentTime);
            }

            if (ModelCore.CurrentTime % Timestep == 0)
            {
                // Write monthly log file:
                // Output must reflect the order of operation:
                int[] months = new int[12] {
                    6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5
                };

                if (OtherData.CalibrateMode)
                {
                    months = new int[12] {
                        6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5
                    }
                }
                ;

                for (int i = 0; i < 12; i++)
                {
                    int month = months[i];
                    Outputs.WriteMonthlyLogFile(month);
                }
                Outputs.WritePrimaryLogFile(PlugIn.ModelCore.CurrentTime);
                Outputs.WriteShortPrimaryLogFile(PlugIn.ModelCore.CurrentTime);
                Outputs.WriteMaps();
                Establishment.LogEstablishment();
            }
        }
Beispiel #2
0
        //---------------------------------------------------------------------

        public override void Initialize()
        {
            PlugIn.ModelCore.UI.WriteLine("Initializing {0} ...", ExtensionName);
            Timestep            = parameters.Timestep;
            SuccessionTimeStep  = Timestep;
            sufficientLight     = parameters.LightClassProbabilities;
            ProbEstablishAdjust = parameters.ProbEstablishAdjustment;
            MetadataHandler.InitializeMetadata(Timestep, modelCore, SoilCarbonMapNames, SoilNitrogenMapNames, ANPPMapNames, ANEEMapNames, TotalCMapNames); //,LAIMapNames, ShadeClassMapNames);
            //CohortBiomass.SpinupMortalityFraction = parameters.SpinupMortalityFraction;

            //Initialize climate.
            Climate.Initialize(parameters.ClimateConfigFile, false, modelCore);
            FutureClimateBaseYear = Climate.Future_MonthlyData.Keys.Min();

            ClimateRegionData.Initialize(parameters);
            SpeciesData.Initialize(parameters);
            Util.ReadSoilDepthMap(parameters.SoilDepthMapName);
            Util.ReadSoilDrainMap(parameters.SoilDrainMapName);
            Util.ReadSoilBaseFlowMap(parameters.SoilBaseFlowMapName);
            Util.ReadSoilStormFlowMap(parameters.SoilStormFlowMapName);
            Util.ReadFieldCapacityMap(parameters.SoilFieldCapacityMapName);
            Util.ReadWiltingPointMap(parameters.SoilWiltingPointMapName);
            Util.ReadPercentSandMap(parameters.SoilPercentSandMapName);
            Util.ReadPercentClayMap(parameters.SoilPercentClayMapName);
            Util.ReadSoilCNMaps(parameters.InitialSOM1CSurfaceMapName,
                                parameters.InitialSOM1NSurfaceMapName,
                                parameters.InitialSOM1CSoilMapName,
                                parameters.InitialSOM1NSoilMapName,
                                parameters.InitialSOM2CMapName,
                                parameters.InitialSOM2NMapName,
                                parameters.InitialSOM3CMapName,
                                parameters.InitialSOM3NMapName);
            Util.ReadDeadWoodMaps(parameters.InitialDeadSurfaceMapName, parameters.InitialDeadSoilMapName);

            AtmosNslope         = parameters.AtmosNslope;
            AtmosNintercept     = parameters.AtmosNintercept;
            Latitude            = parameters.Latitude;
            DenitrificationRate = parameters.Denitrif;
            DecayRateSurf       = parameters.DecayRateSurf;
            DecayRateSOM1       = parameters.DecayRateSOM1;
            DecayRateSOM2       = parameters.DecayRateSOM2;
            DecayRateSOM3       = parameters.DecayRateSOM3;

            ShadeLAI = parameters.MaximumShadeLAI; //.MinRelativeBiomass;
            OtherData.Initialize(parameters);
            FunctionalType.Initialize(parameters);
            FireEffects.Initialize(parameters);

            //  Cohorts must be created before the base class is initialized
            //  because the base class' reproduction module uses the core's
            //  SuccessionCohorts property in its Initialization method.
            Library.LeafBiomassCohorts.Cohorts.Initialize(Timestep, new CohortBiomass());

            // Initialize Reproduction routines:
            Reproduction.SufficientResources = SufficientLight;
            Reproduction.Establish           = Establish;
            Reproduction.AddNewCohort        = AddNewCohort;
            Reproduction.MaturePresent       = MaturePresent;
            base.Initialize(modelCore, parameters.SeedAlgorithm);
            Landis.Library.LeafBiomassCohorts.Cohort.PartialDeathEvent += CohortPartialMortality;
            Landis.Library.BiomassCohorts.Cohort.DeathEvent            += CohortDied;
            AgeOnlyDisturbances.Module.Initialize(parameters.AgeOnlyDisturbanceParms);

            //InitialBiomass.Initialize(Timestep);
            InitializeSites(parameters.InitialCommunities, parameters.InitialCommunitiesMap, modelCore);

            if (parameters.CalibrateMode)
            {
                Outputs.CreateCalibrateLogFile();
            }
            Establishment.InitializeLogFile();

            B_MAX = 0;
            foreach (ISpecies species in ModelCore.Species)
            {
                if (SpeciesData.Max_Biomass[species] > B_MAX)
                {
                    B_MAX = SpeciesData.Max_Biomass[species];
                }
            }

            foreach (ActiveSite site in PlugIn.ModelCore.Landscape)
            {
                Century.ComputeTotalCohortCN(site, SiteVars.Cohorts[site]);
            }

            Outputs.WritePrimaryLogFile(0);
            Outputs.WriteShortPrimaryLogFile(0);
        }