/// <summary> /// Calculate a pH factor for C and N processes /// </summary> /// <param name="layer">The soil layer to calculate</param> /// <param name="index">Parameter indication whether pond exists</param> /// <param name="Parameters">Parameter data</param> /// <returns>Soil pH limiting factor (0-1)</returns> private double SoilpHFactor(int layer, int index, BrokenStickData Parameters) { bool DidInterpolate; return MathUtilities.LinearInterpReal(g.ph[layer], Parameters.xVals, Parameters.yVals, out DidInterpolate); }
/// <summary> /// Calculate a water filled pore space factor for denitrification processes /// </summary> /// <param name="layer">The soil layer to calculate</param> /// <param name="index">Parameter indication whether pond exists</param> /// <param name="Parameters">Parameter data</param> /// <returns>limiting factor due to water filled pore space (0-1)</returns> private double WaterFilledPoreSpaceFactor(int layer, int index, BrokenStickData Parameters) { // + Assumptions // index = 0 for aerobic conditions, 1 for anaerobic index -= 1; // use this untill can change the whole code. (index used to be [1-2] if (index == 0) { bool didInterpolate; // get the WFPS value (%) double WFPS = g.sw_dep[layer] / g.sat_dep[layer] * 100.0; // get the WFPS factor return MathUtilities.LinearInterpReal(WFPS, Parameters.xVals, Parameters.yVals, out didInterpolate); } else if (index == 1) // if pond is active return 1.0; else throw new Exception("SoilNitrogen.SoilMoistFactor - invalid value for \"index\" parameter"); }
/// <summary> /// Calculate a soil moist factor for C and N processes /// </summary> /// <param name="layer">The soil layer to calculate</param> /// <param name="index">Parameter indication whether pond exists</param> /// <param name="Parameters">Parameter data</param> /// <returns>Soil moisture limiting factor (0-1)</returns> private double SoilMoistFactor(int layer, int index, BrokenStickData Parameters) { // + Assumptions // index = 0 for aerobic conditions, 1 for anaerobic index -= 1; // use this untill can change the whole code. (index used to be [1-2] if (index == 0) { bool didInterpolate; // get the modified soil water variable double[] yVals = { 0.0, 1.0, 2.0, 3.0 }; double[] xVals = { 0.0, g.ll15_dep[layer], g.dul_dep[layer], g.sat_dep[layer] }; double myX = MathUtilities.LinearInterpReal(g.sw_dep[layer], xVals, yVals, out didInterpolate); // get the soil moist factor return MathUtilities.LinearInterpReal(myX, Parameters.xVals, Parameters.yVals, out didInterpolate); } else if (index == 1) // if pond is active return 1.0; else throw new Exception("SoilNitrogen.SoilMoistFactor - invalid value for \"index\" parameter"); }