Ejemplo n.º 1
0
        /// <summary>
        /// Calculates the assimilation values for each pathway
        /// </summary>
        private void UpdateAssimilation(Transpiration t, bool updateT)
        {
            foreach (var p in pathways)
            {
                t.Leaf.temperature = p.Temperature;
                t.Water.LeafTemp   = p.Temperature;

                var func = t.UpdateA(assimilation, p);
                assimilation.UpdatePartialPressures(p, t.Leaf, func);

                if (!(assimilation is AssimilationC3))
                {
                    t.UpdateA(assimilation, p);
                }

                if (updateT)
                {
                    t.UpdateTemperature(p);
                }

                if (double.IsNaN(p.CO2Rate) || double.IsNaN(p.WaterUse))
                {
                    p.CO2Rate  = 0;
                    p.WaterUse = 0;
                }
            }
        }
Ejemplo n.º 2
0
        public void UpdatePathway(IAssimilation assimilation, AssimilationPathway pathway)
        {
            var func = assimilation.GetFunction(pathway, Leaf);

            if (Limited)
            {
                var molarMassWater = 18;
                var g_to_kg        = 1000;
                var hrs_to_seconds = 3600;

                pathway.WaterUse = MaxRate * Fraction;
                var WaterUseMolsSecond = pathway.WaterUse / molarMassWater * g_to_kg / hrs_to_seconds;

                Resistance = Water.LimitedWaterResistance(pathway.WaterUse);
                var Gt = Water.TotalCO2Conductance(Resistance);

                func.Ci = Canopy.AirCO2 - WaterUseMolsSecond * Canopy.AirCO2 / (Gt + WaterUseMolsSecond / 2.0);
                func.Rm = 1 / (Gt + WaterUseMolsSecond / 2) + 1.0 / Leaf.GmT;

                pathway.CO2Rate = func.Value();

                assimilation.UpdateIntercellularCO2(pathway, Gt, WaterUseMolsSecond);
            }
            else
            {
                pathway.IntercellularCO2 = Pathway.IntercellularToAirCO2Ratio * Canopy.AirCO2;

                func.Ci = pathway.IntercellularCO2;
                func.Rm = 1 / Leaf.GmT;

                pathway.CO2Rate = func.Value();

                Resistance       = Water.UnlimitedWaterResistance(pathway.CO2Rate, Canopy.AirCO2, pathway.IntercellularCO2);
                pathway.WaterUse = Water.HourlyWaterUse(Resistance);
            }

            assimilation.UpdatePartialPressures(pathway, Leaf, func);
        }