Skip to content

Commit

Permalink
Merge pull request #6698 from jbrider/sorghum/refactor
Browse files Browse the repository at this point in the history
reorganizing code to current standards
  • Loading branch information
hol353 authored Aug 10, 2021
2 parents 832dac4 + 07ab592 commit f8156ae
Show file tree
Hide file tree
Showing 4 changed files with 1,020 additions and 1,156 deletions.
2 changes: 1 addition & 1 deletion Models/PMF/Arbitrator/Methods/C4NitrogenUptakeMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public List<ZoneWaterAndN> GetUptakeEstimates(SoilState soilstate, IArbitration[
var grainDemand = N.StructuralDemand[grainIndex] + N.MetabolicDemand[grainIndex];
//have to correct the leaf demand calculation
var leaf = Organs[leafIndex] as SorghumLeaf;
var leafAdjustment = leaf.calculateClassicDemandDelta();
var leafAdjustment = leaf.CalculateClassicDemandDelta();

//double NDemand = (N.TotalPlantDemand - N.TotalReallocation) / kgha2gsm * Plant.Zone.Area; //NOTE: This is in kg, not kg/ha, to arbitrate N demands for spatial simulations.
//old sorghum uses g/m^2 - need to convert after it is used to calculate actual diffusion
Expand Down
4 changes: 2 additions & 2 deletions Models/PMF/Arbitrator/SorghumArbitratorN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void DoAllocation(IArbitration[] Organs, double TotalSupply, ref double T

//calc leaf demand separately - old sorghum doesn't quite fit
var leaf = Organs[leafIndex] as SorghumLeaf;
var leafAdjustment = leaf.calculateClassicDemandDelta();
var leafAdjustment = leaf.CalculateClassicDemandDelta();

//var totalPlantNDemand = BAT.TotalPlantDemand + leafAdjustment - grainDemand; // to replicate calcNDemand in old sorghum

Expand Down Expand Up @@ -284,7 +284,7 @@ public double AllocateStructuralFromLeaf(SorghumLeaf leaf, int iSupply, int iSin
if (MathUtilities.IsPositive(StructuralRequirement))
{
bool forLeaf = iSupply == iSink;
double providedN = leaf.provideNRetranslocation(BAT, StructuralRequirement, forLeaf);
double providedN = leaf.ProvideNRetranslocation(BAT, StructuralRequirement, forLeaf);
BAT.StructuralAllocation[iSink] += providedN;

// Leaf's dltRetranslocatedN is negative (as in old apsim).
Expand Down
Loading

0 comments on commit f8156ae

Please sign in to comment.