/// <summary> /// Calculates the variables to output /// </summary> /// <param name="cohortFunctionalGroupDefinitions">The functional group definitions of cohorts in the model</param> /// <param name="stockFunctionalGroupDefinitions">The functional group definitions of stocks in the model</param> /// <param name="ecosystemModelGrid">The model grid</param> /// <param name="cellIndices">The list of indices of active cells in the model grid</param> /// <param name="globalDiagnosticVariables">Global diagnostic variables</param> /// <param name="initialisation">The Madingley Model initialisation</param> public void CalculateOutputs(FunctionalGroupDefinitions cohortFunctionalGroupDefinitions, FunctionalGroupDefinitions stockFunctionalGroupDefinitions, ModelGrid ecosystemModelGrid, List <uint[]> cellIndices, SortedList <string, double> globalDiagnosticVariables, MadingleyModelInitialisation initialisation) { // Get all cohort functional group indices in the model int[] CohortFunctionalGroupIndices = cohortFunctionalGroupDefinitions.AllFunctionalGroupsIndex; // Get all stock functional group indices in the model int[] StockFunctionalGroupIndices = stockFunctionalGroupDefinitions.AllFunctionalGroupsIndex; // Reset total abundance, biomass and pool biomasses TotalAbundance = 0.0; TotalBiomass = 0.0; TotalLivingBiomass = 0.0; OrganicPoolOut = 0.0; RespiratoryPoolOut = 0.0; // Add total cohort biomass and total stock biomass to the total biomass tracker TotalLivingBiomass += ecosystemModelGrid.StateVariableGridTotal("Biomass", "NA", CohortFunctionalGroupIndices, cellIndices, "cohort", initialisation); TotalLivingBiomass += ecosystemModelGrid.StateVariableGridTotal("Biomass", "NA", StockFunctionalGroupIndices, cellIndices, "stock", initialisation); // Add total cohort abundance to the total abundance tracker TotalAbundance += ecosystemModelGrid.StateVariableGridTotal("Abundance", "NA", CohortFunctionalGroupIndices, cellIndices, "cohort", initialisation); // Get total organic pool biomass OrganicPoolOut = ecosystemModelGrid.GetEnviroGridTotal("Organic Pool", 0, cellIndices); // Get total respiratory pool biomass RespiratoryPoolOut = ecosystemModelGrid.GetEnviroGridTotal("Respiratory CO2 Pool", 0, cellIndices); // Get total of all biomass TotalBiomass = TotalLivingBiomass + RespiratoryPoolOut + OrganicPoolOut; // Get number of cohorts and stocks TotalNumberOfCohorts = globalDiagnosticVariables["NumberOfCohortsInModel"]; TotalNumberOfStocks = globalDiagnosticVariables["NumberOfStocksInModel"]; // Get numbers of cohort extinctions and productions NumberOfCohortsExtinct = globalDiagnosticVariables["NumberOfCohortsExtinct"]; NumberOfCohortsProduced = globalDiagnosticVariables["NumberOfCohortsProduced"]; NumberOfCohortsCombined = globalDiagnosticVariables["NumberOfCohortsCombined"]; }
/// <summary> /// Calculates the variables to output /// </summary> /// <param name="cohortFunctionalGroupDefinitions">The functional group definitions of cohorts in the model</param> /// <param name="stockFunctionalGroupDefinitions">The functional group definitions of stocks in the model</param> /// <param name="ecosystemModelGrid">The model grid</param> /// <param name="cellIndices">The list of indices of active cells in the model grid</param> /// <param name="globalDiagnosticVariables">Global diagnostic variables</param> /// <param name="initialisation">The Madingley Model initialisation</param> public void CalculateOutputs(FunctionalGroupDefinitions cohortFunctionalGroupDefinitions, FunctionalGroupDefinitions stockFunctionalGroupDefinitions, ModelGrid ecosystemModelGrid, List<uint[]> cellIndices, SortedList<string, double> globalDiagnosticVariables, MadingleyModelInitialisation initialisation) { // Get all cohort functional group indices in the model int[] CohortFunctionalGroupIndices = cohortFunctionalGroupDefinitions.AllFunctionalGroupsIndex; // Get all stock functional group indices in the model int[] StockFunctionalGroupIndices = stockFunctionalGroupDefinitions.AllFunctionalGroupsIndex; // Reset total abundance, biomass and pool biomasses TotalAbundance = 0.0; TotalBiomass = 0.0; TotalLivingBiomass = 0.0; OrganicPoolOut = 0.0; RespiratoryPoolOut = 0.0; // Add total cohort biomass and total stock biomass to the total biomass tracker TotalLivingBiomass += ecosystemModelGrid.StateVariableGridTotal("Biomass", "NA", CohortFunctionalGroupIndices, cellIndices, "cohort", initialisation); TotalLivingBiomass += ecosystemModelGrid.StateVariableGridTotal("Biomass", "NA", StockFunctionalGroupIndices, cellIndices, "stock", initialisation); // Add total cohort abundance to the total abundance tracker TotalAbundance += ecosystemModelGrid.StateVariableGridTotal("Abundance", "NA", CohortFunctionalGroupIndices, cellIndices, "cohort", initialisation); // Get total organic pool biomass OrganicPoolOut = ecosystemModelGrid.GetEnviroGridTotal("Organic Pool", 0, cellIndices); // Get total respiratory pool biomass RespiratoryPoolOut = ecosystemModelGrid.GetEnviroGridTotal("Respiratory CO2 Pool", 0, cellIndices); // Get total of all biomass TotalBiomass = TotalLivingBiomass + RespiratoryPoolOut + OrganicPoolOut; // Get number of cohorts and stocks TotalNumberOfCohorts = globalDiagnosticVariables["NumberOfCohortsInModel"]; TotalNumberOfStocks = globalDiagnosticVariables["NumberOfStocksInModel"]; // Get numbers of cohort extinctions and productions NumberOfCohortsExtinct = globalDiagnosticVariables["NumberOfCohortsExtinct"]; NumberOfCohortsProduced = globalDiagnosticVariables["NumberOfCohortsProduced"]; NumberOfCohortsCombined = globalDiagnosticVariables["NumberOfCohortsCombined"]; }