/// <summary> /// Utility to sum the specified propertie from all pore compartments in the pore layer input /// </summary> /// <param name="Compartments"></param> /// <param name="Property"></param> /// <returns>sum</returns> private double LayerSum(Pore[] Compartments, string Property) { double Sum = 0; foreach (Pore P in Compartments) { object o = ReflectionUtilities.GetValueOfFieldOrProperty(Property, P); if (o == null) throw new NotImplementedException(); Sum += (double)o; } return Sum; }
private void OnSimulationCommencing(object sender, EventArgs e) { ProfileLayers = Water.Thickness.Length; PoreCompartments = PoreBounds.Length - 1; AdsorptionCapacity = new double[ProfileLayers]; TransmissionCapacity = new double[ProfileLayers]; PercolationCapacityBelow = new double[ProfileLayers]; LayerHeight = new double[ProfileLayers]; Ksat = new double[ProfileLayers]; SWmm = new double[ProfileLayers]; SW = new double[ProfileLayers]; Diffusion = new double[ProfileLayers]; SaturatedWaterDepth = new double[ProfileLayers]; Pores = new Pore[ProfileLayers][]; PoreWater = new double[ProfileLayers][]; Capillarity = new double[ProfileLayers][]; HydraulicConductivityOut = new double[ProfileLayers][]; PsiUpper = new double[ProfileLayers][]; RelativePoreVolume = new double[ProfileLayers][]; Theta = new double[ProfileLayers][]; for (int l = 0; l < ProfileLayers; l++) { Pores[l] = new Pore[PoreCompartments]; PoreWater[l] = new double[PoreCompartments]; Capillarity[l] = new double[PoreCompartments]; HydraulicConductivityOut[l] = new double[PoreCompartments]; PsiUpper[l] = new double[PoreCompartments]; RelativePoreVolume[l] = new double[PoreCompartments]; Theta[l] = new double[PoreCompartments]; for (int c = PoreCompartments - 1; c >= 0; c--) { Pores[l][c] = new Pore(); PoreWater[l][c] = new double(); Capillarity[l][c] = new double(); HydraulicConductivityOut[l][c] = new double(); PsiUpper[l][c] = new double(); RelativePoreVolume[l][c] = new double(); Theta[l][c] = new double(); } } SetSoilProperties(); //Calls a function that applies soil parameters to calculate and set the properties for the soil Hourly = new HourlyData(); SubHourly = new SubHourlyData(); ProfileSaturation = MathUtilities.Sum(SaturatedWaterDepth); if (ReportDetail) { DoDetailReport("Initialisation", 0, 0); } }
/// <summary> /// Potential gradients moves water out of layers each time step /// </summary> private double Infiltrate(Pore P) { double PotentialAdsorbtion = Math.Min(P.HydraulicConductivityIn, P.AirDepth); return PotentialAdsorbtion; }