Class AMPSomFunctions

java.lang.Object
net.simplace.sim.components.experimental.som.AMPSomFunctions

public class AMPSomFunctions extends Object
  • Constructor Details

    • AMPSomFunctions

      public AMPSomFunctions()
  • Method Details

    • calculateRates

      public static Double[] calculateRates(Double t, Double[] states, Double[] parameters)
      Wrapper function for rate calculation for the ODE solving function As generic ODE solving methods operate on a single state array, this function converts the state array to human readable state variables, calls the specific rate calculation function and converts the calculated rates back to an array.
      Parameters:
      t - time
      states -
      parameters -
      Returns:
    • calculateSOMRates

    • minImm

      public static AMPSomFunctions.MinImm minImm(Double[] CNDom, double CNFreemicrob, Double[] NMin, double CUE, double NUE, Double[] PotentialUptakeDocByMic)
      Calculate the amount of N mineralized or immobilized, depending on N available in DOM and Nmin
      Parameters:
      CNDom -
      CNFreemicrob -
      NMin -
      CUE -
      NUE -
      PotentialUptakeDocByMic -
      Returns:
    • calculateBioturbation

      public static Double[] calculateBioturbation(Double[] State, Double[] SoilLayerDepth, Double[] DbAdjacentMean, Double[] dz)
      Calculates bioturbation for a state
      Parameters:
      State -
      SoilLayerDepth -
      DbAdjacentMean -
      dz -
      Returns:
    • bioDiff

      public static AMPSomFunctions.BioDiffusion bioDiff(double Db0, double DbEFoldDepth, Double[] SoilLayerDepth)
      Calculates biodiffusion coefficients The biodiffusion coefficients per layer are calculated. As they are later involved when calculating numerically second derivatives, they are also interpolated at the mid of layers (and first and last value are mirrored at top and bottom of layers). Additionaly the thickness of layers between the midpoints is returned.
      Parameters:
      Db0 - biodiffusion
      DbEFoldDepth -
      SoilLayerDepth -
      Returns:
    • harmonicMean

      public static double harmonicMean(double a, double b)
      Calculates the harmonic mean of two values
      Parameters:
      a -
      b -
      Returns:
      harmonic mean
    • tempRateMod

      public static AMPSomFunctions.TempRateMod tempRateMod(Double[] Tmean, boolean includeTempAdsorption)
      A function to calculate the effect of temperature
      Parameters:
      Tmean -
      includeTempAdsorption -
      Returns:
      f_T the rate modifier used for POM and necromass decomposition and for the uptake of DOM by microbes. f_T2 is used for DOM and necromass adsorption
    • moistureRateMod

      public static Double[] moistureRateMod(Double[] SWC, Double[] SWCOpt, Double[] kSWC, Double[] porosity, Double[] ns)
      A function to calculate the effect of soil water content (SWC) on POM and necromass decomposition and the uptake of DOM by microbes. The equation is from Yan et al 2018
      Parameters:
      SWC -
      SWCOpt -
      kSWC -
      porosity -
      ns -
      Returns:
    • rhizosphereVolume

      public static Double[] rhizosphereVolume(double fineRootBeta, double fineRootLength, double exudationDist, double exudationK, Double[] SoilLayerDepth)
      Calculates rhizosphere volume
      Parameters:
      fineRootBeta -
      fineRootLength -
      exudationDist -
      exudationK -
      SoilLayerDepth -
      Returns:
      rhizosphere volume
    • rhizosphereVolume

      public static Double[] rhizosphereVolume(double fineRootBeta, Double[] fineRootLengthPerLayer, double exudationDist, double exudationK, Double[] SoilLayerDepth)
      Calculates rhizosphere volume Takes fine root lenght per layer
      Parameters:
      fineRootBeta -
      fineRootLengthPerLayer -
      exudationDist -
      exudationK -
      SoilLayerDepth -
      Returns:
      rhizosphere volume
    • calculateD13C

      public static double calculateD13C(double C12, double C13)
    • calculateD14C

      public static double calculateD14C(double C12, double C14, double d13C, int year)
    • adsParameters

      public static AMPSomFunctions.AdsParameters adsParameters(double KDesDomInit, double KDesNecroInit, double VMaxAdsDom, double VMaxAdsNecro, Double[] BulkDensity, Double[] LayerThickness, Double[] RhizosphereVolumeFraction)
    • calculateCMinMaxProfile

      public static Double[] calculateCMinMaxProfile(Double[] ClayPercentage, Double[] SiltPercentage, Double[] BulkDensity, Double[] LayerThickness)
    • kmDepthProf

      public static AMPSomFunctions.CorrectedK kmDepthProf(double KPom, double KDom, double KNecro, double KAdsDom, double KAdsNecro, Double[] LayerThickness, Double[] BulkDensity)
      Correct parameters to soil layer thickness
      Parameters:
      KPom -
      KDom -
      KNecro -
      KAdsDom -
      KAdsNecro -
      LayerThickness -
      BulkDensity -
      Returns:
    • atmospheric14C12CRatio

      public static double atmospheric14C12CRatio(double AtmosphericD14C, double AtmospericD13C)
    • distributeLitter

      public static AMPSomFunctions.LitterRates distributeLitter(Double litterdepth, double CDom, double NDom, double CPom, double NPom, Double[] LayerDepth, double c14c12ratio)
    • isotopicInputs

      public static AMPSomFunctions.IsotopicInputs isotopicInputs(Double[] DeadRootsC, Double[] ExudatesC, double d13C_atmosphere, double atm_ratio_14C_12C, double d13C_BGveg, double d13C_rhizodeposits)
      Splits biomass inputs into C12 and C14 isotopes
      Parameters:
      DeadRootsC -
      ExudatesC -
      d13C_atmosphere -
      atm_ratio_14C_12C -
      d13C_BGveg -
      d13C_rhizodeposits -
      Returns:
    • soilLayers

      public static AMPSomFunctions.SoilLayers soilLayers(Double[] SoilLayerDepth)
    • rootInputsNoSimplace

      public static Double[] rootInputsNoSimplace(double betaRoots, Double[] SoilLayerDepth, double BGVeg, boolean calculateRootProfileAssymptotically)
      Distributes total below ground biomass to layers. May be used when there is no below ground biomass per layer input. Presently only asymptotic distribution is implemented.
      Parameters:
      betaRoots -
      SoilLayerDepth -
      BGVeg -
      calculateRootProfileAssymptotically -
      Returns:
    • isotopicInputsNonSimplace

      public static AMPSomFunctions.IsotopicInputs isotopicInputsNonSimplace(double BGVeg, double d13C_atmosphere, double atm_ratio_14C_12C, double d13C_BGveg, double d13C_rhizodeposits, double Fdoc_rhizo, double betaRoots, Double[] SoilLayerDepth, boolean calculateRootProfileAssymptotically)
      Calculates isotopes from above ground biomass and below ground biomass and distributes it per layer May be used when there is no below ground biomass per layer input. Presently only asymptotic distribution is implemented.
      Parameters:
      AGVeg -
      BGVeg -
      d13C_atmosphere -
      atm_ratio_14C_12C -
      d13C_AGveg -
      d13C_BGveg -
      d13C_rhizodeposits -
      Fdoc_rhizo -
      betaRoots -
      SoilLayerDepth -
      calculateRootProfileAssymptotically -
      Returns:
    • calculateExudatesPerLayer

      public static Double[] calculateExudatesPerLayer(double rwrt, Double[] totalRootBmPerLayer, double exudateFraction)
      Calculate daily root exudates per layer from daily root increment
      Parameters:
      rwrt - daily increment in root biomass [g m^-2 d^-1]
      totalRootBmPerLayer - total root biomass in each layer [g m^-2]
      exudateFraction - fraction of root biomass increment that is exudated [-]
      Returns:
      exudates per layer [g m^-2 d^-1]
    • calculateDomFlows

      public static AMPSomFunctions.DomFlows calculateDomFlows(AMPSomFunctions.DomVariablesArray soilDom, AMPSomFunctions.DomVariablesScalar inflowDom, AMPSomFunctions.DomVariablesScalar bottomDomConcentration, Double[] waterFlow, Double[] waterContent, Double[] waterContentResidual, double movingFraction)