예제 #1
0
        /// <summary>
        /// Remove a fraction of the biomass.
        /// </summary>
        /// <param name="fractionToRemove">The fraction from each layer to remove.</param>
        /// <param name="sendToSoil">Send to soil?</param>
        /// <returns></returns>
        public BiomassAndNLayered RemoveBiomass(double fractionToRemove, bool sendToSoil)
        {
            var removed = new BiomassAndNLayered();

            removed.Wt = MathUtilities.Multiply_Value(dmLayer, fractionToRemove);
            removed.N  = MathUtilities.Multiply_Value(nLayer, fractionToRemove);
            for (int layer = 0; layer < dmLayer.Length; layer++)
            {
                dmLayer[layer] -= removed.Wt[layer];
                nLayer[layer]  -= removed.N[layer];
            }
            UpdateDM();

            if (sendToSoil)
            {
                DetachBiomass(removed.Wt, removed.N);
            }

            return(removed);
        }
예제 #2
0
        /// <summary>
        /// Remove a fraction of the biomass.
        /// </summary>
        /// <param name="fractionToRemove">The fraction from each layer to remove.</param>
        /// <param name="sendToSurfaceOrganicMatter">Send to surface organic matter?</param>
        /// <returns></returns>
        public BiomassAndNLayered RemoveBiomass(double fractionToRemove, bool sendToSurfaceOrganicMatter)
        {
            var removed = new BiomassAndNLayered();

            removed.Wt = MathUtilities.Multiply_Value(dmLayer, fractionToRemove);
            removed.N  = MathUtilities.Multiply_Value(nLayer, fractionToRemove);
            for (int layer = 0; layer < dmLayer.Length; layer++)
            {
                dmLayer[layer] -= removed.Wt[layer];
                nLayer[layer]  -= removed.N[layer];
            }
            UpdateDM();

            if (sendToSurfaceOrganicMatter)
            {
                surfaceOrganicMatter.Add(removed.Wt.Sum(), removed.N.Sum(), 0.0, species.Name, species.Name);
            }

            return(removed);
        }