Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sannyschulz committed Sep 28, 2023
1 parent 5f23c7a commit 52a8736
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions hermes/nitro.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,12 @@ func nmove(wdt float64, subd int, zeit int, g *GlobalVarsMain, l *NitroSharedVar
func resid(g *GlobalVarsMain, l *NitroSharedVars, ln *NitroBBBSharedVars, hPath *HFilePath) (NDI, NSA, NLA, NUSA, NULA, NRESID float64) {
// ------------------------------- Mineralisationspotentiale aus Vorfruchtresiduen ---------------------------------------
// Input:
// Dauerkult$ = D = Dauerkultur
// JN(AKF) = Anteil der exportierten Pflanzenrückstände (Fraktion), 0= Verbleib auf dem Feld
// PESUM = aufgenommene N-Menge der Pflanze (kg N/ha)
// LEGUM(AKF) = fixierte N-Menge aus Leguminosen (kg N/ha)
// Dauerkult$ = D = Dauerkultur / Permanent crop
// JN(AKF) = Anteil der exportierten Pflanzenrückstände(Fraktion) / Fraction of crop residues that are removed from the field
// 0 = Verbleib auf dem Feld / all residues remain on the field
// 1 = vollständige Entfernung / all above ground residues are removed from the field
// 2 = komplette Pflanze beibt auf dem Feld / complete plant remains on the field, no yield is harvested
// PESUM = aufgenommene N-Menge der Pflanze (kg N/ha) / N amount taken up by the crop (kg N/ha)

CRONAM := hPath.cropn
_, scanner, _ := Open(&FileDescriptior{FilePath: CRONAM, UseFilePool: true})
Expand All @@ -821,7 +823,10 @@ func resid(g *GlobalVarsMain, l *NitroSharedVars, ln *NitroBBBSharedVars, hPath
ln.NAGB = g.PESUM - (g.PESUM * NWURA)
}
var DGM, DGU float64
// DGM = N amount from crop residues (kg N/ha)
// DGU = N amount from roots (kg N/ha)
if g.JN[g.AKF.Index] == 0 {
// all residues remain on the field
if g.DAUERKULT == 'D' {
DGM = (g.OBMAS - 820) * g.GEHOB
DGU = 0
Expand All @@ -830,6 +835,7 @@ func resid(g *GlobalVarsMain, l *NitroSharedVars, ln *NitroBBBSharedVars, hPath
DGM = (1 - g.JN[g.AKF.Index]) * (g.PESUM - g.PESUM*(1-NWURA)*NERNT/(NERNT+KOSTRO*NKOPP) - g.PESUM*NWURA)
}
} else if g.JN[g.AKF.Index] == 1 {
// all residues are removed from the field
if g.DAUERKULT == 'D' {
if g.FRUCHT[g.AKF.Index] == AA {
DGM = 0
Expand All @@ -843,9 +849,11 @@ func resid(g *GlobalVarsMain, l *NitroSharedVars, ln *NitroBBBSharedVars, hPath
DGU = g.PESUM * NWURA
}
} else if g.JN[g.AKF.Index] == 2 {
// complete plant remains on the field, no yield is harvested
DGU = g.PESUM * NWURA
DGM = g.PESUM - DGU
} else {
// JN is a fraction between 0 and 1 of residues that are removed from the field
if g.DAUERKULT == 'D' {
DGU = g.PESUM * NWURA * 0.74
DGM = g.PESUM - (g.OBMAS * g.JN[g.AKF.Index] * g.GEHOB)
Expand All @@ -860,12 +868,12 @@ func resid(g *GlobalVarsMain, l *NitroSharedVars, ln *NitroBBBSharedVars, hPath
if DGU < 0 {
DGU = 0
}
NSA = DGM * NFAST
NUSA = DGU * NFAST
NLA = DGM * (1 - NFAST)
NULA = DGU * (1 - NFAST)
NSA = DGM * NFAST // N amount from above ground crop residues that decompose fast(kg N/ha)
NUSA = DGU * NFAST // N amount from roots that decompose fast(kg N/ha)
NLA = DGM * (1 - NFAST) // N amount from above ground crop residues that decompose slow(kg N/ha)
NULA = DGU * (1 - NFAST) // N amount from roots that decompose slow(kg N/ha)
NDI = 0.0
NRESID = DGM
NRESID = DGM // N residue from above ground crops(kg N/ha)
return NDI, NSA, NLA, NUSA, NULA, NRESID
}

Expand Down

0 comments on commit 52a8736

Please sign in to comment.