示例#1
0
        //----------------------- Public methods -----------------------

        /// <summary>Initialise this root instance (and tissues).</summary>
        /// <param name="zone">The zone the roots belong to.</param>
        /// <param name="minimumLiveWt">Minimum live DM biomass for this organ (kg/ha).</param>
        public void Initialise(Zone zone, double minimumLiveWt)
        {
            // link to soil models parameters
            soil = zone.FindInScope <Soil>();
            if (soil == null)
            {
                throw new Exception($"Cannot find soil in zone {zone.Name}");
            }

            soilPhysical = soil.FindInScope <IPhysical>();
            if (soilPhysical == null)
            {
                throw new Exception($"Cannot find soil physical in soil {soil.Name}");
            }

            waterBalance = soil.FindInScope <ISoilWater>();
            if (waterBalance == null)
            {
                throw new Exception($"Cannot find a water balance model in soil {soil.Name}");
            }

            soilCropData = soil.FindDescendant <SoilCrop>(species.Name + "Soil");
            if (soilCropData == null)
            {
                throw new Exception($"Cannot find a soil crop parameterisation called {species.Name + "Soil"}");
            }

            nutrient = zone.FindInScope <INutrient>();
            if (nutrient == null)
            {
                throw new Exception($"Cannot find SoilNitrogen in zone {zone.Name}");
            }

            no3 = zone.FindInScope("NO3") as ISolute;
            if (no3 == null)
            {
                throw new Exception($"Cannot find NO3 solute in zone {zone.Name}");
            }

            nh4 = zone.FindInScope("NH4") as ISolute;
            if (nh4 == null)
            {
                throw new Exception($"Cannot find NH4 solute in zone {zone.Name}");
            }

            // initialise soil related variables
            zoneName             = soil.Parent.Name;
            nLayers              = soilPhysical.Thickness.Length;
            mySoilNH4Available   = new double[nLayers];
            mySoilNO3Available   = new double[nLayers];
            mySoilWaterAvailable = new double[nLayers];

            // save minimum DM and get target root distribution
            MinimumLiveDM      = minimumLiveWt;
            TargetDistribution = RootDistributionTarget();

            // initialise tissues
            Live.Initialise();
            Dead.Initialise();
        }
示例#2
0
        /// <summary>Constructor, initialise tissues for the roots.</summary>
        /// <param name="zone">The zone the roots belong in.</param>
        /// <param name="initialDM">Initial dry matter weight</param>
        /// <param name="initialDepth">Initial root depth</param>
        /// <param name="minLiveDM">The minimum biomass for this organ</param>
        public void Initialise(Zone zone, double initialDM, double initialDepth,
                               double minLiveDM)
        {
            soil = zone.FindInScope <Soil>();
            if (soil == null)
            {
                throw new Exception($"Cannot find soil in zone {zone.Name}");
            }

            nutrient = zone.FindInScope <INutrient>();
            if (nutrient == null)
            {
                throw new Exception($"Cannot find SoilNitrogen in zone {zone.Name}");
            }

            no3 = zone.FindInScope("NO3") as ISolute;
            if (no3 == null)
            {
                throw new Exception($"Cannot find NO3 solute in zone {zone.Name}");
            }
            nh4 = zone.FindInScope("NH4") as ISolute;
            if (nh4 == null)
            {
                throw new Exception($"Cannot find NH4 solute in zone {zone.Name}");
            }

            // save the parameters for this organ
            nLayers       = soil.Thickness.Length;
            minimumLiveDM = minLiveDM;
            dulMM         = soil.DULmm;
            ll15MM        = soil.LL15mm;
            Live          = tissue[0];
            Dead          = tissue[1];

            // Link to soil and initialise variables
            zoneName           = soil.Parent.Name;
            mySoilNH4Available = new double[nLayers];
            mySoilNO3Available = new double[nLayers];

            // Initialise root DM, N, depth, and distribution
            Depth = initialDepth;
            CalculateRootZoneBottomLayer();
            TargetDistribution = RootDistributionTarget();

            double[] initialDMByLayer = MathUtilities.Multiply_Value(CurrentRootDistributionTarget(), initialDM);
            double[] initialNByLayer  = MathUtilities.Multiply_Value(initialDMByLayer, NConcOptimum);

            // Initialise the live tissue.
            Live.Initialise(initialDMByLayer, initialNByLayer);
            Dead.Initialise(null, null);
        }
        /// <summary>Constructor, initialise tissues for the roots.</summary>
        /// <param name="zone">The zone the roots belong in.</param>
        /// <param name="initialDM">Initial dry matter weight</param>
        /// <param name="initialDepth">Initial root depth</param>
        /// <param name="minLiveDM">The minimum biomass for this organ</param>
        public void Initialise(Zone zone, double initialDM, double initialDepth,
                               double minLiveDM)
        {
            soil = zone.FindInScope <Soil>();
            if (soil == null)
            {
                throw new Exception($"Cannot find soil in zone {zone.Name}");
            }

            soilPhysical = soil.FindInScope <IPhysical>();
            if (soilPhysical == null)
            {
                throw new Exception($"Cannot find soil physical in soil {soil.Name}");
            }

            waterBalance = soil.FindInScope <ISoilWater>();
            if (waterBalance == null)
            {
                throw new Exception($"Cannot find a water balance model in soil {soil.Name}");
            }

            soilCropData = soil.FindDescendant <SoilCrop>(species.Name + "Soil");
            if (soilCropData == null)
            {
                throw new Exception($"Cannot find a soil crop parameterisation called {species.Name + "Soil"}");
            }

            nutrient = zone.FindInScope <INutrient>();
            if (nutrient == null)
            {
                throw new Exception($"Cannot find SoilNitrogen in zone {zone.Name}");
            }

            no3 = zone.FindInScope("NO3") as ISolute;
            if (no3 == null)
            {
                throw new Exception($"Cannot find NO3 solute in zone {zone.Name}");
            }
            nh4 = zone.FindInScope("NH4") as ISolute;
            if (nh4 == null)
            {
                throw new Exception($"Cannot find NH4 solute in zone {zone.Name}");
            }

            // link to soil and initialise related variables
            zoneName           = soil.Parent.Name;
            nLayers            = soilPhysical.Thickness.Length;
            dulMM              = soilPhysical.DULmm;
            ll15MM             = soilPhysical.LL15mm;
            mySoilNH4Available = new double[nLayers];
            mySoilNO3Available = new double[nLayers];

            // save minimum DM and get target root distribution
            Depth         = initialDepth;
            minimumLiveDM = minLiveDM;
            CalculateRootZoneBottomLayer();
            TargetDistribution = RootDistributionTarget();

            // initialise tissues
            double[] initialDMByLayer = MathUtilities.Multiply_Value(CurrentRootDistributionTarget(), initialDM);
            double[] initialNByLayer  = MathUtilities.Multiply_Value(initialDMByLayer, NConcOptimum);
            Live = tissue[0];
            Dead = tissue[1];
            Live.Initialise(initialDMByLayer, initialNByLayer);
            Dead.Initialise(null, null);
        }