//--------------------------------------------------------------------- public static void AddResorbedN(ICohort cohort, double deadLeafRootsBiomass, ActiveSite site)//, int month) { // Resorbed N: We are assuming that any leaves dropped as a function of normal // growth and maintenance (e.g., fall senescence) will involve resorption of leaf N. double resorbedN = AvailableN.CalculateResorbedN(site, cohort.Species, deadLeafRootsBiomass); //, month); //double resorbedN = AvailableN.CalculateResorbedN(site, cohort.Species, cohort.LeafBiomass); //, month); double previouslyResorbedN = GetResorbedNallocation(cohort, site); AvailableN.SetResorbedNallocation(cohort, resorbedN + previouslyResorbedN, site); return; }
public static void AdjustAvailableN(ICohort cohort, ActiveSite site, double[] actualANPP) { // Because Growth used some Nitrogen, it must be subtracted from the appropriate pools, either resorbed or mineral. double totalNdemand = AvailableN.CalculateCohortNDemand(cohort.Species, site, cohort, actualANPP); double adjNdemand = totalNdemand; double resorbedNused = 0.0; //double mineralNused = 0.0; // Use resorbed N first and only if it is spring time unless you are evergreen. double leafLongevity = SpeciesData.LeafLongevity[cohort.Species]; if ((leafLongevity <= 1.0 && Main.Month > 2 && Main.Month < 6) || leafLongevity > 1.0) { double resorbedNallocation = Math.Max(0.0, AvailableN.GetResorbedNallocation(cohort, site)); resorbedNused = resorbedNallocation - Math.Max(0.0, resorbedNallocation - totalNdemand); AvailableN.SetResorbedNallocation(cohort, Math.Max(0.0, resorbedNallocation - totalNdemand), site); adjNdemand = Math.Max(0.0, totalNdemand - resorbedNallocation); } // Reduce available N after taking into account that some N may have been provided // via resorption (above). double Nuptake = 0.0; if (SiteVars.MineralN[site] >= adjNdemand) { SiteVars.MineralN[site] -= adjNdemand; //mineralNused = adjNdemand; Nuptake = adjNdemand; } else { adjNdemand = SiteVars.MineralN[site]; //mineralNused = SiteVars.MineralN[site]; SiteVars.MineralN[site] = 0.0; Nuptake = SiteVars.MineralN[site]; } SiteVars.TotalNuptake[site] += Nuptake; if (OtherData.CalibrateMode && PlugIn.ModelCore.CurrentTime > 0) { //Outputs.CalibrateLog.Write("{0:0.00}, {1:0.00}, {2:0.00}, {3:0.00},", deltaWood, deltaLeaf, totalMortality[0], totalMortality[1]); Outputs.CalibrateLog.Write("{0:0.00},{1:0.00},{2:0.00},", resorbedNused, Nuptake, totalNdemand); } }