Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 24 additions & 28 deletions src/sipnet/sipnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
largely based on PnET
*/

#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#include "common/context.h"
#include "common/exitCodes.h"
#include "common/logging.h"
#include "common/util.h"

#include "sipnet.h"
#include "events.h"
#include "outputItems.h"
#include "runmean.h"
#include "sipnet.h"
#include "state.h"

#define C_WEIGHT 12.0 // molecular weight of carbon
Expand Down Expand Up @@ -1084,27 +1084,21 @@ double calcTempEffect(double tsoil) {
*/
void calcSoilMaintRespiration(double tsoil, double water, double whc) {

// TBD We seem to be conflating maintResp and rSoil in the non-microbe
// case, need to dig in. With that said...

if (!ctx.microbes) {
double moistEffect = calcMoistEffect(water, whc);
double moistEffect = calcMoistEffect(water, whc);

// :: from [1], remainder of eq (A20)
// See calcMoistEffect() for first part of eq (A20) calculation
double tempEffect = calcTempEffect(tsoil);
// :: from [1], remainder of eq (A20)
// See calcMoistEffect() for first part of eq (A20) calculation
double tempEffect = calcTempEffect(tsoil);

// Effects of tillage, if any
double tillageEffect = 1 + eventTrackers.d_till_mod;
// Effects of tillage, if any
double tillageEffect = 1 + eventTrackers.d_till_mod;

// Put it all together!
fluxes.maintRespiration = envi.soil * params.baseSoilResp * moistEffect *
tempEffect * tillageEffect;
// Put it all together!
fluxes.soilMaintRespiration = envi.soil * params.baseSoilResp * moistEffect *
tempEffect * tillageEffect;

// With no microbes, rSoil flux is just the maintenance respiration
fluxes.rSoil = fluxes.maintRespiration;
}
// else fluxes.rSoil = 0.0?
// With no microbes, rSoil flux is just the maintenance respiration
fluxes.rSoil = fluxes.soilMaintRespiration;
}

/*!
Expand Down Expand Up @@ -1137,12 +1131,19 @@ void calcMicrobeFluxes(double tsoil, double water, double whc,
// respiration is determined by microbe biomass
// :: from [4], eq (5.12) with addition of moisture effect
// [TAG:UNKNOWN_PROVENANCE] moistEffect
tempEffect = params.baseMicrobeResp * pow(params.microbeQ10, tsoil / 10);
fluxes.maintRespiration = envi.microbeC * moistEffect * tempEffect;
tempEffect = pow(params.microbeQ10, tsoil / 10);
fluxes.microbeMaintRespiration =
envi.microbeC * params.baseMicrobeResp * moistEffect * tempEffect;

// rSoil is maintenance respiration + growth (microbe) respiration
// :: from [4], eq (5.10) for microbe term
fluxes.rSoil = fluxes.microbeMaintRespiration +
(1 - params.efficiency) * fluxes.microbeIngestion;

} else {
fluxes.microbeIngestion = 0.0;
fluxes.soilPulse = 0.0;
fluxes.microbeMaintRespiration = 0.0;
// fluxes.maintRespiration is otherwise set, do not set to zero here
}
}
Expand Down Expand Up @@ -1566,13 +1567,8 @@ void updatePoolsForSoil(void) {
// :: eq (5.11) used for soilPulse, and
// :: eq (5.12) used for maintRespiration
envi.microbeC += (microbeEff * fluxes.microbeIngestion + fluxes.soilPulse -
fluxes.maintRespiration) *
fluxes.microbeMaintRespiration) *
climate->length;

// rSoil is maintenance resp + growth (microbe) resp
// :: from [4], eq (5.10) for microbe term
fluxes.rSoil =
fluxes.maintRespiration + (1 - microbeEff) * fluxes.microbeIngestion;
} else {
if (ctx.litterPool) {
// :: from [2], litter model description
Expand Down
6 changes: 4 additions & 2 deletions src/sipnet/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,13 +514,15 @@ typedef struct FluxVars {

// Microbes [3]
// microbes on: microbial maintenance respiration rate
// microbes off: equivalent to rSoil, calc'd as described in [1], eq (A20)
// (g C m-2 ground area day^-1)
double maintRespiration;
double microbeMaintRespiration;
// Flux that microbes remove from soil (mg C g soil day)
// TBD I highly doubt those units; this is calc'd as
// (g C * m-2) * (day-1) * (unitless terms)
double microbeIngestion;
// microbes off: soil respiration equivalent to rSoil, calc'd as described in
// [1], eq (A20) (g C m-2 ground area day^-1)
double soilMaintRespiration;
// Exudates into the soil
double soilPulse;

Expand Down