コード例 #1
0
ファイル: TestMvarSet.py プロジェクト: MPIBGC-TEE/bgc_md2
 def test_get_mvar_value(self):
     mvs = self.mvs
     res = mvs._get_single_mvar_value(TimeSymbol)
     self.assertEqual(res, TimeSymbol("t"))
     
     ## now get a variable that is not provided directly but computable in one step
     res = mvs._get_single_mvar_value(SmoothReservoirModel)
     ## now get a variable that is not provided directly but computable in two steps
     res = mvs._get_single_mvar_value(CompartmentalMatrix)
コード例 #2
0
ファイル: TestMvarSet.py プロジェクト: MPIBGC-TEE/bgc_md2
 def setUp(self):
     I_vl, I_vw = symbols("I_vl I_vw")
     vl, vw = symbols("vl vw")
     k_vl, k_vw = symbols("k_vl k_vw")
     self.provided_values=frozenset(
         [
             InFluxesBySymbol({vl: I_vl, vw: I_vw}),
             OutFluxesBySymbol({vl: k_vl * vl, vw: k_vw * vw}),
             InternalFluxesBySymbol({(vl, vw): k_vl * vl, (vw, vl): k_vw * vw}),
             TimeSymbol("t"),
             StateVariableTuple((vl, vw))
         ]
     )
     self.mvs=MVarSet(self.provided_values)
コード例 #3
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
    'k_1': 'decomposition rate of young pool'  # "yr^{-1}"
    ,
    'k_2': 'decomposition rate of old pool'  # "yr^{-1}"
    ,
    'i': 'mean annual carbon input'  # "kgC m^{-2}yr^{-1}"
    ,
    'h': 'humification coefficient',
    'r': 'climatic and edaphic factors'
}

for name in sym_dict.keys():
    var(name)
xi = r  #environmental effects multiplier
T = ImmutableMatrix([[-1, 0], [h, -1]])  #transition operator
N = diag(k_1, k_2)  #decomposition operator
t = TimeSymbol("t")  # unit: "year"
x = StateVariableTuple((Y, O))
u = InputTuple((i, 0))
B = CompartmentalMatrix(xi * T * N)
#        - "Bare fallow":
np1 = NumericParameterization(par_dict={
    k_1: 0.8,
    k_2: 0.00605,
    i: 0,
    h: 0.13,
    r: 1.32
},
                              func_dict=frozendict({}))
nsv1 = NumericStartValueDict({Y: 0.3, O: 3.96})

#        - "+N +straw":
コード例 #4
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
    var(name)

R = 8.314
Arrhenius = exp((E_p * (T_k - 298)) / (R * T_k * 298))
I = I_0 * exp(-k * L)
J_e = 1  #((alpha_q * I * J_m)/(sqrt((J_m)^2 * (alpha_q)^2 * I^2))) * ((C_i - Gamma)/(4*(C_i + 2 * Gamma))) #Fixme: had to set J_e to 1 because problem with sqrt AttributeError: 'Not' object has no attribute '_eval_power'
J_c = (V_m * (C_i - Gamma)) / (C_i + K_c * (1 + (O_x / K_o)))
A = Min(J_c, J_e) - R_d
g_l * A / ((C_i - Gamma) * (1 + (D / D_0)))
A_n = G_s * (C_a - C_i)
A_c = A_n * (1 - exp(-k * L)) / k
GPP = A_c * 3600 * 12 / 1000000  # Scaling expression from TECO fortran code, line 667.' # gC*day^{-1}
f_W = Min((0.5 * W), 1)
f_T = Q_10 * ((T - 10) / 10)
xi = f_W * f_T
t = TimeSymbol("t")  # unit: "day"
#x = StateVariableTuple((C_foliage, C_roots, C_wood, C_metlit, C_stlit, C_fastsom, C_slowsom, C_passsom))
x = StateVariableTuple((C_foliage, C_wood, C_roots, C_metlit, C_stlit,
                        C_fastsom, C_slowsom, C_passsom))
u = GPP
b = (b_foliage, b_roots, b_wood, 0, 0, 0, 0, 0)
Input = InputTuple(u * ImmutableMatrix(b))
B = CompartmentalMatrix(
    [[-cr_foliage, 0, 0, 0, 0, 0, 0, 0], [0, -cr_wood, 0, 0, 0, 0, 0, 0],
     [0, 0, -cr_root, 0, 0, 0, 0,
      0], [f_foliage2metlit, 0, f_roots2metlit, -cr_metlit, 0, 0, 0, 0],
     [f_foliage2stlit, f_wood2stlit, f_roots2stlit, 0, -cr_stlit, 0, 0, 0],
     [
         0, 0, 0, f_metlit2fastsom, f_stlit2fastsom, -cr_fastsom,
         f_slowsom2fastsom, f_passsom2fastsom
     ], [0, 0, 0, 0, f_stlit2slowsom, f_fastsom2slowsom, -cr_slowsom, 0],
コード例 #5
0
        'eta_w': 'Fixed partitioning ratio of available carbon allocated to wood',
        'gamma_f': 'Foliage turnover rate',
        'gamma_r': 'Roots turnover rate',
        'gamma_w': 'Wood turnover rate',
        'l_s': 'Fraction of litter partitioned to the soil',
        'l_p': 'Fraction of litter available for plant',
        's_p': 'Fraction of soil carbon available for plant',
        'l_dr': 'Litter decomposition/respiration',
        's_dr': 'Soil decomposition/respiration',
        'u': 'scalar function of photosynthetic inputs'
}
for name in sym_dict.keys():
    var(name)

#Model based on Fig. 1 in page 127 (3 in the PDF) of doi= "10.1016/0304-3800(88)90112-3", no ODEs in publication
t = TimeSymbol("t") #"the model has a daily and a yearly component. Allocation occurs yearly"
x = StateVariableTuple((C_f, C_r, C_w,C_frl,C_s))
b = ImmutableMatrix((eta_f, eta_w, eta_r))
Input = InputTuple(tuple(u * b)+(0,0))
A = CompartmentalMatrix(
[[-gamma_f,    0   ,    0   ,   (l_p*eta_f)  ,(s_p*eta_f)],
 [    0   ,-gamma_r,    0   ,   (l_p*eta_r)  ,(s_p*eta_r)],
 [    0   ,    0   ,-gamma_w,   (l_p*eta_w)  ,(s_p*eta_w)],
 [ gamma_f, gamma_r, gamma_w, -(l_p+l_s+l_dr),      0    ],
 [    0   ,    0   ,    0   ,       l_s      ,-(s_p+s_dr)]
])

## The following are default values suggested by this entry's creator only to be able to run the model:
np1 = NumericParameterization(
    par_dict={u: 1400, eta_f: 0.48, eta_r: 0.44, eta_w: 0.49, gamma_r: 3.03, gamma_f: 23.32, gamma_w: 0.04},
    func_dict=frozendict({})
コード例 #6
0
    'gamma_f': 'Foliage senescence rate'  #unit: "yr^{-1}" 
    ,
    'gamma_r': 'Roots senescence rate'  #unit: "yr^{-1}" 
    ,
    'gamma_w': 'Wood senescence rate'  #unit: "yr^{-1}" 
}
for name in sym_dict.keys():
    var(name)

x = StateVariableTuple((F, R, W))
u = G
b = (eta_f, eta_w, eta_r)

Input = InputTuple(u * ImmutableMatrix(b))
A = CompartmentalMatrix(diag(-gamma_f, -gamma_w, -gamma_r))
t = TimeSymbol("t")  #'yr'

# Commented out the following lines because original publication only has 3 parameter values
#np1 = NumericParameterization(
#    par_dict={
#    G: , #"Mg*ha^{-1}*yr^{-1}"
#    eta_f: 'Rational(1,3)',
#    eta_r: 'Rational(1,3)',
#    eta_w: 'Rational(1,3)',
#},
#    func_dict=frozendict({})
#    # state_var_units=gram/kilometer**2,
#    # time_unit=day
#)
#nsv1 = NumericStartValueDict({
#    F: , #"Mg/ha"
コード例 #7
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
    'I_S':
    'soil organic carbon input rate'  # "mg C cm^{-3} h^{-1}"
    ,
    'I_D':
    'dissolved organic carbon input rate'  # "mg C cm^{-3} h^{-1}"
}

for name in sym_dict.keys():
    var(name)
R = 0.008314  # "kJ mol^{-1} K^{-1}"
V_U = V_Umax * exp(-E_aU / (R * (T + 273)))  #
V = V_max * exp(-E_a / (R * (T + 273)))  #
E_C = epsilon_0 + epsilon_s * T  #
K_U = K_U0 + K_Us * T  # "mg C cm^{-3}"
K = K_0 + K_s * T  # "mg C cm^{-3}"
t = TimeSymbol("t")  # unit: "hour"
x = StateVariableTuple((S, D, B, E))
u = InputTuple((I_S, I_D, 0, 0))
T_M = ImmutableMatrix([[-1, 0, a_BS * r_B / (r_B + r_E), 0],
                       [1, -1, (1 - a_BS) * r_B / (r_B + r_E), 1],
                       [1, E_C, -1, 0], [0, 0, r_E / (r_B + r_E), -1]])
N = ImmutableMatrix([[V * E / (K + S), 0, 0, 0],
                     [0, V_U * B / (K_U + D), 0, 0], [0, 0, r_B + r_E, 0],
                     [0, 0, 0, r_L]])
B = CompartmentalMatrix((T_M * N))
#np1 = NumericParameterization(
#    par_dict={
#},
#    func_dict=frozendict({})
#)
#
コード例 #8
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
    ],
     [(A_S * (1 - C_RES_S)),
      -(f_GERM * gamma_GERM * (1 / Max(p, k_GERM))) - (1 / tau_S), 0, 0, 0, 0,
      0, 0, 0], [(A_L * (1 - C_RES_L)), 0, -(1 / tau_L), 0, 0, 0, 0, 0, 0],
     [(A_R * (1 - C_RES_R)), 0, 0, -(1 / tau_R), 0, 0, 0, 0, 0],
     [(A_WL * (1 - C_RES_WL)), 0, 0, 0, -(1 / tau_WL), 0, 0, 0, 0],
     [(A_WR * (1 - C_RES_WR)), 0, 0, 0, 0, -1 / tau_WR, 0, 0, 0],
     [
         LIT_A / C_A, LIT_S / C_S, LIT_L / C_L, LIT_R / C_R, 0, 0,
         -DEC_LIT / C_LIT, 0, 0
     ], [0, 0, 0, 0, LIT_WL / C_WL, LIT_WR / C_WR, 0, -DEC_CWD / C_CWD, 0],
     [
         0, 0, 0, 0, 0, 0, ((1 - c_lit_atm) * DEC_LIT) / C_LIT,
         ((1 - c_cwd_atm) * DEC_CWD) / C_CWD, -DEC_SOIL / C_SOIL
     ]])
t = TimeSymbol("t")  # "day"

np1 = NumericParameterization(
    par_dict={
        c_lit_atm: 0.77,
        c_cwd_atm: 0.2,
        tau_LIT: 2.05  # "yr"
        ,
        tau_CWD: 60  # "yr"
        ,
        tau_SOIL: 100  # "yr"
        ,
        Q_10h: 1.4
    },
    func_dict=frozendict({}))
コード例 #9
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
}

for name in sym_dict.keys():
    var(name)
k_1 = K_1 * exp(-3 * Ls)
k_3 = K_3 * exp(-3 * Ls)
k_5 = K_5 * (1 - 0.75 * Tx)
E_s = 0.85 - 0.68 * Tx
F_m = 0.85 - 0.018 * LN
F_s = 1 - F_m
alpha_51 = 0.55 * (1 - A_l)
alpha_53 = 0.45 * (1 - A_l)
alpha_61 = 0.7 * A_l
alpha_63 = alpha_61
alpha_65 = 1 - E_s - 0.004
t = TimeSymbol("t")  # unit: "year" #??? monthly
x = StateVariableTuple((C_1, C_2, C_3, C_4, C_5, C_6, C_7))
u = InputTuple((J_1 * F_s, J_1 * F_m, J_2 * F_s, J_2 * F_m, 0, 0, 0))
xi = f_T * f_W  #environmental effects multiplier (DEFAG)
A = ([-k_1, 0, 0, 0, 0, 0,
      0], [0, -K_2, 0, 0, 0, 0,
           0], [0, 0, -k_3, 0, 0, 0, 0], [0, 0, 0, -K_4, 0, 0, 0], [
               alpha_51 * k_1, 0.45 * K_2, alpha_53 * k_3, 0.45 * K_4, -k_5,
               0.42 * K_6, 0.45 * K_7
           ], [alpha_61 * k_1, 0, alpha_63 * k_3, 0, alpha_65 * k_5, -K_6,
               0], [0, 0, 0, 0, 0.004 * k_5, 0.03 * K_6, -K_7])
B = CompartmentalMatrix(xi * ImmutableMatrix(A))
#Original values without effects of temperature and soil moisture:
np1 = NumericParameterization(par_dict={
    K_1: 0.076,
    K_2: 0.28,
コード例 #10
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
    'fire_foliar_to_litter':    'internal flux ',
    'fire_wood_to_som':         'internal flux ',
    'wood_to_soilc':            'internal flux ',
    'fire_root_to_litter':      'internal flux ',
    'root_to_litter':           'internal flux ',
    'fire_litter_to_som':       'internal flux ',
    'litter_to_som':            'internal flux ',
}

# created from the mo
# to be able to use symbols directly 
for name in sym_dict.keys():
    var(name)


t = TimeSymbol('t')
ms = load_model_structure()
x = StateVariableTuple(tuple(Symbol(name) for name in ms.pool_names))


mvs = CMTVS(
    {
        BibInfo(# Bibliographical Information
           name="CARDAMOM",
           longName="?",
           version="?",
           entryAuthor="Holger Metzler",
           entryAuthorOrcid="",
           entryCreationDate="02/02/2021",
           doi="",
           #further_references=BibInfo(doi="10.5194/bg-10-2255-2013"),
コード例 #11
0
    'Senescence rate per unit fine roots biomass'
}

for name in sym_dict.keys():
    var(name)

Phi = Phi_0 * (1 - exp(-k * omega * F))
G = Phi * epsilon
eta_w = 1 - eta_f - eta_r

x = StateVariableTuple((F, R, W))
u = G
b = (eta_f, eta_r, eta_w)
Input = InputTuple(u * ImmutableMatrix(b))
A = CompartmentalMatrix(diag(-gamma_f, -gamma_r, 0))
t = TimeSymbol("t")  # units: days, years for allocation

#Parameter set:  "Chosen based on the performance of Pinus radiata at Puruki, New Zeland":
## eta_ are not mentioned in the paper... probably the different values they gave to them were part of the hypothesis
np1 = NumericParameterization(
    par_dict={
        k: 0.5,
        Phi_0: 2500,  #"MJ*m*^{-2}*year^{-1}" 
        omega: 5,  #"m*^2*kg^{-1}"
        gamma_r: 2,  #"kg^{-1}"
        gamma_f: 0.5
    },  #"kg^{-1}"
    func_dict=frozendict({}))

mvs = MVarSet({
    BibInfo(  # Bibliographical Information
コード例 #12
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
    'a_L': '',
    'a_R': '',
    'a_S': '',
    'gamma_f': '',
    'gamma_r': '',
    'gamma_w': ''
}

for name in sym_dict.keys():
    var(name)
C_i = (B_L / (a_0L * (B_R + B_S + B_L)))
C_delta = A_CC * C - R_g
a_L = ((1 - C_i) / (3 + a_0R + a_0S - Q_i - G_i - C_i))
a_R = ((1 + a_0R - G_i) / (3 + a_0R + a_0S - Q_i - G_i - C_i))
a_S = ((1 + a_0S - Q_i) / (3 + a_0R + a_0S - Q_i - G_i - C_i))
t = TimeSymbol("t")  # unit: "month"
x = StateVariableTuple((B_L, B_R, B_S))
u = C_delta
b = (a_L, a_R, a_S)
Input = InputTuple(u * ImmutableMatrix(b))
B = CompartmentalMatrix(diag(-gamma_f, -gamma_r, -gamma_w))
np1 = NumericParameterization(
    par_dict={
        a_0L: 0.3,
        a_0R: 0.5,
        a_0S: 0.2,
        Q_i: 1
    },
    #Q_i: 1 when light is highly available (See sup. material 1, pg 17)
    func_dict=frozendict({}))
コード例 #13
0
    'ExuM': 'maximal exudation rate',  # "\\mu gC hr^{-1}cm^{-3}"
    'ExuT': """time constant for exudation, 
                responsible for duration of exudation""",  # "hr^{-1}"
    'BGF':
    'constant background flux of substrate',  # "\\mu g C cm^{-3}hr^{-1}"
    'mu_S':
    'relative growth rate of bacteria (dependent on substrate concentration)',
    'Exu': 'exudation rate (dependent on time)',
}
for name in sym_dict.keys():
    var(name)

# t is not an instance of  symbol but of TimeSymbol, Therefore it can not
# created along with the other symbols but hast to be created before it appears
# in  any expressions.
t = TimeSymbol('t')  # in the original pub unit: "hour"

mu_S = mu_max * S / (K_s * theta + S)  # "hr^{-1}"
Exu = ExuM * exp(-ExuT * t)  # "hr^{-1}"
x = StateVariableTuple((X, S))
u = InputTuple((0, BGF + Exu))
T = ImmutableMatrix([[-1, Y], [K_r, -1]])
N = ImmutableMatrix([[D_max * K_d / (K_d + S / theta), 0],
                     [0, X / Y * mu_max / (K_s * theta + S)]])
B = CompartmentalMatrix(T * N)
# Original values from linked model (no nitrogen cycle considered in this model here):
np1 = NumericParameterization(par_dict={
    D_max: 0.26,
    Y: 0.44,
    K_s: 3.0,
    theta: 0.23,
コード例 #14
0
        ,'x': '"CO$_2$ to (BIO+HUM) ratio"'
        ,'gamma': 'litter input partitioning coefficient'
        ,'J': 'mean annual carbon input' # "t C ha^{-1}yr^{-1}"
        ,'a': 'flux coefficient to BIO'
        ,'b': 'flux coefficient to HUM'
        ,'f_T': 'function of temperature'
        ,'f_W': 'function of soil moisture'
}

for name in sym_dict.keys():
    var(name)
x = 1.67 * (1.85 + 1.60 * exp(-0.0786 * pClay))
gamma = DR/(1+DR)
a = 0.46/(1+x)
b = 0.54/(1+x)
t = TimeSymbol("t") # unit: "year" # ??? parameters are yearly, but it is run on monthly basis
x = StateVariableTuple((C_1, C_2, C_3, C_4, C_5))
u = InputTuple((J * ImmutableMatrix(5, 1, [gamma, 1-gamma, 0, 0, 0])))
xi = f_T * f_W # environmental effects multiplier
A = ImmutableMatrix([[  -k_1,    0 ,          0,         0, 0],
                     [     0,  -k_2,          0,         0, 0],
                     [ a*k_1, a*k_2, -k_3+a*k_3,     a*k_4, 0],
                     [ b*k_1, b*k_2,      b*k_3,-k_4+b*k_4, 0],
                     [     0,     0,          0,         0, 0]])
B = CompartmentalMatrix(xi * A)
# Original values without effects of temperature and soil moisture
# doi = {10.1007/978-3-642-61094-3_17},
np1 = NumericParameterization(
    par_dict={
              k_1: 10
              ,k_2: 0.3
コード例 #15
0
ファイル: createModel.py プロジェクト: MPIBGC-TEE/bgc_md2
from bgc_md2.helper import module_computers
from bgc_md2.resolve.mvars import (
    InFluxesBySymbol,
    OutFluxesBySymbol,
    InternalFluxesBySymbol,
    TimeSymbol,
    StateVariableTuple,
)
import bgc_md2.resolve.computers as bgc_c

var("I_vl I_vw vl vw k_vl k_vw")

mvs = CMTVS(
    {
        StateVariableTuple((vl, vw)),
        TimeSymbol("t"),
        InFluxesBySymbol({vl: I_vl, vw: I_vw}),
        OutFluxesBySymbol({vl: k_vl * vl, vw: k_vw * vw}),
        InternalFluxesBySymbol({(vl, vw): k_vl * vl, (vw, vl): k_vw * vw}),
    },

    computers=module_computers(bgc_c)
)
# -

# The last statement in the code defines a variable `mvs` which is 
# an instance of CMTVS which stands for `C`onnected`M`ulti`T`ype`V`ariable`S`et".
# It contains information in two forms. 
# 1. Variables of certain type (like InFluxesBySymbol)
# 2. a set of functions that "connect" these Variables and to other results we did not specify 
#    explicitly.
コード例 #16
0
x_nup = Min(1,(N_min/(F_nupmin*Delta_t)))
x_pup = Min(1,(P_lab/(F_pupmin*Delta_t)))
x_npup = Min(x_nup,x_pup)
x_nleaf = (n_leaf/(n_leaf+k_n))
x_pleaf = (p_leaf/(p_leaf+k_p))
x_npleaf = Min(x_nleaf,x_pleaf)
F_c = x_npleaf*x_npup*F_cmax #unit: "gC*m^{-2}*d^{-1}" 
u = F_c
x = StateVariableTuple((C_leaf, C_root, C_wood))
b = (a_leaf, a_root, a_wood)
Input = InputTuple(u * ImmutableMatrix(b))
A = CompartmentalMatrix(
    diag(-mu_leaf, -mu_root, -mu_wood)
)
t = TimeSymbol("t") #'day'
#        timeResolution = daily # or yearly? incongruent turnover units

# Commented out the following lines because original publication only has 3 parameter values
# In original publication: 
## See table 1 for parameter values; a_(leaf,wood,root) and 1/mu_(leaf,wood,root) are based on CASA
## 1/mu_(leaf,wood,root) = Mean residence time of plant tissue
## 1/n_max,leaf  and  1/p_max,leaf : maximal leaf N:C and P:C ratios = 1.2*mean (min is obtained by 0.8*mean)  
#    # mean estimates were obtained from Glopnet datasets for each biome (Wright et al., 2004)
#np1 = NumericParameterization(
#    par_dict={#"Evergreen needle leaf forest":
#    Delta_t: 1, 
#    k_n: 0.01, #"gN*(gC)^{-1}"
#    k_p: 0.0006, #"gP*(gC)^{-1}"
#    a_leaf: 0.42, 
#    a_root: 0.25, 
コード例 #17
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
x = StateVariableTuple((C_leaf, C_root, C_wood, C_j1, C_j2, C_j3, C_k1, C_k2, C_k3))
b = ImmutableMatrix((a_leaf, a_root, a_wood))
Input = InputTuple(tuple(u*b)+(0,0,0,0,0,0))
A = CompartmentalMatrix([
 [-mu_leaf*(b1l+b2l),         0        ,      0     ,          0         ,          0         ,           0        ,        0       ,        0       ,        0       ]
,[         0        ,-mu_root*(b1r+b2r),      0     ,          0         ,          0         ,           0        ,        0       ,        0       ,        0       ]
,[         0        ,         0        ,-mu_wood*b3w,          0         ,          0         ,           0        ,        0       ,        0       ,        0       ]
,[    mu_leaf*b1l   ,    mu_root*b1r   ,      0     ,-mu_j1*m_n*(c11+c21),          0         ,           0        ,        0       ,        0       ,        0       ]
,[    mu_leaf*b2l   ,    mu_root*b2r   ,      0     ,          0         ,-mu_j2*m_n*(c12+c22),           0        ,        0       ,        0       ,        0       ]
,[         0        ,         0        , mu_wood*b3w,          0         ,          0         ,-mu_j3*m_n*(c23+c33),        0       ,        0       ,        0       ]
,[         0        ,         0        ,      0     ,    mu_j1*m_n*c11   ,    mu_j2*m_n*c12   ,           0        ,-mu_k1*(d21+d31),    mu_k2*d12   ,    mu_k3*d13   ]
,[         0        ,         0        ,      0     ,    mu_j1*m_n*c21   ,    mu_j2*m_n*c22   ,    mu_j3*m_n*c23   ,    mu_k1*d21   ,-mu_k2*(d12+d32),    mu_k3*d23   ]
,[         0        ,         0        ,      0     ,          0         ,          0         ,    mu_j3*m_n*c33   ,    mu_k1*d31   ,    mu_k2*d32   ,-mu_k3*(d13+d23)]
])
### When not explicit in equations B1, B2, B3 (Appendix B), followed the fluxes from Fig 1. However, the soil fluxes are not clear.
t = TimeSymbol("t") #'day' # or 'year'? incongruent turnover units

# Commented out the following lines because original publication only has 3 parameter values
# In original publication: 
## See table 1 for parameter values; a_(leaf,wood,root) and 1/mu_(leaf,wood,root) are based on CASA
## 1/mu_(leaf,wood,root) = Mean residence time of plant tissue
## 1/n_max,leaf  and  1/p_max,leaf : maximal leaf N:C and P:C ratios = 1.2*mean (min is obtained by 0.8*mean)  
#    # mean estimates were obtained from Glopnet datasets for each biome (Wright et al., 2004)
#np1 = NumericParameterization(
#    par_dict={#"Evergreen needle leaf forest":
#    Delta_t: 1, 
#    k_n: 0.01, #"gN*(gC)^{-1}"
#    k_p: 0.0006, #"gP*(gC)^{-1}"
#    a_leaf: 0.42, 
#    a_root: 0.25, 
#    a_wood: 0.33, 
コード例 #18
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
F9 = MIC_k * Vmax_k4 * SOM_c / (Km_k4 + SOM_c)
F10 = MIC_k * tau_k
x = StateVariableTuple((LIT_m, LIT_s, MIC_r, MIC_k, SOM_p, SOM_c))

mvs = CMTVS(
    {
        BibInfo(  # Bibliographical Information
            name="MIMICS",
            longName="Microbial-Mineral Carbon Stabilization",
            version="1",
            entryAuthor="Carlos Sierra",
            entryAuthorOrcid="0000-0003-0009-4169",
            entryCreationDate="14/08/2018",
            doi="10.5194/bg-11-3899-2014",
            sym_dict=sym_dict),
        TimeSymbol("t"),  # unit: "hour"
        x,  # state vector of the complete system
        #    InFluxesBySymbol({})
        #    OutFluxesBySymbol({})
        InternalFluxesBySymbol({
            (LIT_m, MIC_r): F1,
            (LIT_s, MIC_r): F2,
            (SOM_p, MIC_r): F3,
            (SOM_c, MIC_r): F4,
            (MIC_r, SOM_p): F5,
            (LIT_m, MIC_k): F6,
            (LIT_s, MIC_k): F7,
            (SOM_p, MIC_k): F8,
            (SOM_c, MIC_k): F9,
            (MIC_k, SOM_c): F10
        })
コード例 #19
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
x = StateVariableTuple((C_L, C_S, C_R, C_D, C_H))
u = (G, 0, 0, 0, 0)
Input = InputTuple(u)  #f_v = u + A*x
A = CompartmentalMatrix([[
    -(gamma_N + gamma_W + gamma_T + (A_R + A_S + ((R_gL + R_mL) / C_L))), 0, 0,
    0, 0
], [A_S, -gamma_S - ((R_gS - R_mS) / C_S), 0, 0, 0],
                         [A_R, 0, -gamma_R - ((R_gR - R_mR) / C_R), 0, 0],
                         [
                             gamma_N + gamma_W + gamma_T, gamma_S, gamma_R,
                             -gamma_DH - (R_hD / C_D), 0
                         ], [0, 0, 0, gamma_DH, -(R_hH / C_H)]])
### Had to divide Respiration fluxes by state variables because the flux was not presented as a rate*state variable tuple.

t = TimeSymbol("t")

#    parameter_sets:
#        - "Original dataset of the publication":
#            values: {k_n: 0.5, omega: 0.8, epsilon_L: 0.35, epsilon_S: 0.1, epsilon_R: 0.55}
#            desc: Eastern US and Germany, cold broadleaf deciduous
#            doi: 10.1111/j.1365-2486.2004.00890.x

mvs = CMTVS(
    {
        BibInfo(  # Bibliographical Information
            name="CTEM",
            longName="Canadian Terrestrial Ecosystem Model",
            version="1",
            entryAuthor="Verónika Ceballos-Núñez",
            entryAuthorOrcid="0000-0002-0046-1160",
コード例 #20
0
ファイル: source.py プロジェクト: MPIBGC-TEE/bgc_md2
}

internal_fluxes = dict()

r_S, r_L = symbols("r_S r_L")
output_fluxes = {
    WP_S: r_S * WP_S,
    WP_L: r_L * WP_L
}

t = symbols("t")
srm = SmoothReservoirModel.from_state_variable_indexed_fluxes(
    state_vector,
    t,
    input_fluxes,
    output_fluxes,
    internal_fluxes
)

mvs = CMTVS(
    {
        InFluxesBySymbol(input_fluxes),
        OutFluxesBySymbol(output_fluxes),
        InternalFluxesBySymbol(internal_fluxes),
        TimeSymbol(t.name),
        StateVariableTuple(state_vector)
    },
    bgc_md2_computers()
)