Skip to content

Commit

Permalink
Merge pull request #26 from HamishBrownPFR/SmallerFixes
Browse files Browse the repository at this point in the history
Add residue coefficients from fitting
  • Loading branch information
JBris authored Apr 2, 2024
2 parents a372d78 + 805c4d3 commit 2c72e24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Binary file modified Prototype_V3.4.xlsm
Binary file not shown.
21 changes: 15 additions & 6 deletions SVSModel/Models/Residues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ public static string name()
public residue(double amountN, double Nconc, DateTime additionDate, SimulationType thisSim)
{
double CNR = 40/Nconc;
this.ANm = amountN * 0.8;
this.ANi = amountN * (CNR * 2.5)/100;
this.Km = 0.97 * Math.Exp(-0.12*CNR) + 0.03;
this.Ki = 0.9 * Math.Exp(-0.12 * CNR) + 0.1; ;
this.ANm = amountN * 81.614/100;
this.ANi = amountN * (4.8701+(CNR * 2.43475))/100;
this.Km = 0.041678 + (1.026182 - 0.041678) * Math.Exp(-0.123883 * CNR) ;
this.Ki = 0.112333 + (1.026182 - 0.041678) * Math.Exp(-0.130226 * CNR) ;
this.NetMineralisation = Functions.dictMaker(thisSim.simDates, new double[thisSim.simDates.Length]);
double sigmaFtm = 0;
foreach (DateTime d in thisSim.simDates)
{
if (d >= additionDate.AddDays(1))
{
double Ft = SoilOrganic.LloydTaylorTemp(thisSim.meanT[d]);
double Fm = SoilOrganic.QiuBeareCurtinWater(thisSim.RSWC[d]);
double Ft = VanHoffQ10(thisSim.meanT[d]);
double Fm = linearSoilWater(thisSim.RSWC[d]);
sigmaFtm += (Ft * Fm);
double mineralisation = ANm * (1 - Math.Exp(-Km * sigmaFtm));
double imobilisation = ANi * (1 - Math.Exp(-Ki * sigmaFtm));
Expand All @@ -94,5 +94,14 @@ public residue(double amountN, double Nconc, DateTime additionDate, SimulationTy
}
}

public static double VanHoffQ10(double temp)
{
return Math.Pow(2, ((temp - 30) / 10));
}
public static double linearSoilWater(double rwc)
{
return Math.Min(1, rwc * 2);
}

}
}

0 comments on commit 2c72e24

Please sign in to comment.