コード例 #1
0
        /// <summary>Removes biomass from live and dead biomass pools</summary>
        /// <param name="amount">The fractions of biomass to remove</param>
        /// <param name="Live">Live biomass pool</param>
        /// <param name="Dead">Dead biomass pool</param>
        /// <param name="removing">The removed pool to add to.</param>
        /// <param name="detaching">The amount of detaching material</param>
        private static double RemoveBiomassFromLiveAndDead(OrganBiomassRemovalType amount, Biomass Live, Biomass Dead, out Biomass removing, out Biomass detaching)
        {
            double remainingLiveFraction = 1.0 - (amount.FractionLiveToResidue + amount.FractionLiveToRemove);
            double remainingDeadFraction = 1.0 - (amount.FractionDeadToResidue + amount.FractionDeadToRemove);

            detaching = Live * amount.FractionLiveToResidue + Dead * amount.FractionDeadToResidue;
            removing  = Live * amount.FractionLiveToRemove + Dead * amount.FractionDeadToRemove;

            Live.Multiply(remainingLiveFraction);
            Dead.Multiply(remainingDeadFraction);
            return(remainingLiveFraction);
        }
コード例 #2
0
 private void KillLeavesUniformly(double fraction)
 {
     foreach (PerrenialLeafCohort L in Leaves)
     {
         Biomass Loss = new Biomass();
         Loss.SetTo(L.Live);
         Loss.Multiply(fraction);
         L.Dead.Add(Loss);
         L.Live.Subtract(Loss);
         L.AreaDead += L.Area * fraction;
         L.Area     *= (1 - fraction);
     }
 }
コード例 #3
0
ファイル: Cohorts.cs プロジェクト: lie112/ApsimX
 /// <summary>
 /// Reduce all live leaves' size by a given fraction.
 /// </summary>
 /// <param name="liveFraction">The fraction by which to reduce the size of live leaves.</param>
 /// <param name="deadFraction">The fraction by whith to reduce the size of dead leaves.</param>
 public void ReduceLeavesUniformly(double liveFraction, double deadFraction)
 {
     foreach (PerennialLeafCohort leaf in leaves)
     {
         leaf.Live.Multiply(liveFraction);
         leaf.Dead.Multiply(deadFraction);
         leaf.Area     *= liveFraction;
         leaf.AreaDead *= deadFraction;
     }
     live.Multiply(liveFraction);
     dead.Multiply(deadFraction);
     Lai     *= liveFraction;
     LaiDead *= deadFraction;
 }
コード例 #4
0
ファイル: Cohorts.cs プロジェクト: lie112/ApsimX
        /// <summary>
        /// Kill all leaves by a given fraction.
        /// </summary>
        /// <param name="fraction">The fraction to be removed from the leaves.</param>
        public void KillLeavesUniformly(double fraction)
        {
            Biomass loss = new Biomass();

            LaiDead += Lai * fraction;
            foreach (PerennialLeafCohort leaf in leaves)
            {
                loss.SetTo(leaf.Live);
                loss.Multiply(fraction);
                dead.Add(loss);
                live.Subtract(loss);
                leaf.Dead.Add(loss);
                leaf.Live.Subtract(loss);
                leaf.AreaDead += leaf.Area * fraction;
                leaf.Area     *= (1 - fraction);
            }
            Lai *= (1 - fraction);
        }
コード例 #5
0
ファイル: GenericOrgan.cs プロジェクト: MarkLieffering/ApsimX
        protected void OnDoActualPlantGrowth(object sender, EventArgs e)
        {
            if (Plant.IsAlive)
            {
                // Do senescence
                double senescedFrac = SenescenceRate.Value();
                if (Live.Wt * (1.0 - senescedFrac) < BiomassToleranceValue)
                {
                    senescedFrac = 1.0;  // remaining amount too small, senesce all
                }
                Biomass Loss = Live * senescedFrac;
                Live.Subtract(Loss);
                Dead.Add(Loss);
                Senesced.Add(Loss);

                // Do detachment
                double detachedFrac = DetachmentRateFunction.Value();
                if (Dead.Wt * (1.0 - detachedFrac) < BiomassToleranceValue)
                {
                    detachedFrac = 1.0;  // remaining amount too small, detach all
                }
                Biomass detaching = Dead * detachedFrac;
                Dead.Multiply(1.0 - detachedFrac);
                if (detaching.Wt > 0.0)
                {
                    Detached.Add(detaching);
                    SurfaceOrganicMatter.Add(detaching.Wt * 10, detaching.N * 10, 0, Plant.CropType, Name);
                }

                // Do maintenance respiration
                MaintenanceRespiration += Live.MetabolicWt * MaintenanceRespirationFunction.Value();
                Live.MetabolicWt       *= (1 - MaintenanceRespirationFunction.Value());
                MaintenanceRespiration += Live.StorageWt * MaintenanceRespirationFunction.Value();
                Live.StorageWt         *= (1 - MaintenanceRespirationFunction.Value());
            }
        }
コード例 #6
0
ファイル: PerennialLeaf.cs プロジェクト: her123/ApsimX
 private void KillLeavesUniformly(double fraction)
 {
     foreach (PerrenialLeafCohort L in Leaves)
     {
         Biomass Loss = new Biomass();
         Loss.SetTo(L.Live);
         Loss.Multiply(fraction);
         L.Dead.Add(Loss);
         L.Live.Subtract(Loss);
     }
 }
コード例 #7
0
ファイル: BiomassRemoval.cs プロジェクト: her123/ApsimX
        /// <summary>Removes biomass from live and dead biomass pools</summary>
        /// <param name="amount">The fractions of biomass to remove</param>
        /// <param name="Live">Live biomass pool</param>
        /// <param name="Dead">Dead biomass pool</param>
        /// <param name="Removed">The removed pool to add to.</param>
        /// <param name="Detached">The detached pool to add to.</param>
        /// <param name="detaching">The amount of detaching material</param>
        private static double RemoveBiomassFromLiveAndDead(OrganBiomassRemovalType amount, Biomass Live, Biomass Dead, out Biomass Removed, Biomass Detached, out Biomass detaching)
        {
            double remainingLiveFraction = 1.0 - (amount.FractionLiveToResidue + amount.FractionLiveToRemove);
            double remainingDeadFraction = 1.0 - (amount.FractionDeadToResidue + amount.FractionDeadToRemove);

            detaching = Live * amount.FractionLiveToResidue + Dead * amount.FractionDeadToResidue;
            Removed = Live * amount.FractionLiveToRemove + Dead * amount.FractionDeadToRemove;
            Detached.Add(detaching);

            Live.Multiply(remainingLiveFraction);
            Dead.Multiply(remainingDeadFraction);
            return remainingLiveFraction;
        }