示例#1
0
# A[1, 1] = -1
# A[2, 2] = -1
# A[3, 3] = -1
# A[4, 4] = -1
# A[5, 5] = -1
# A[6, 6] = -1
# A[7, 7] = -1
# A[8, 8] = -1
#
k = ImmutableMatrix.diag(
    [
        kleaf(t),
        kfroot(t),
        #   kwood,
        #   kmet,
        #   kstr,
        #   kcwd,
        #   kfast,
        #   kslow,
        #   kpass,
    ],
    unpack=True,
)
epsilon_leaf = (1 + xk_leaf_cold(t) / kleaf(t) + xk_leaf_dry(t) / kleaf(t)
                )  # Leaf environmental scalar: casa_cnp.F90 Line 975-976
xi = ImmutableMatrix.diag(
    [
        epsilon_leaf,  # casa_cnp.F90: Line 975-976
        1,  # casa_cnp.F90: Line 978
        # 1,                                                                 # casa_cnp.F90: Line 979
        # xk_opt_litter*xk_temp*xk_water*xk_n_limit(t),                      # casa_cnp.F90: Line 880, 1030
        # xk_opt_litter*xk_temp*xk_water*xk_n_limit(t)*exp(-3*f_lign_leaf),  # casa_cnp.F90: Line 880, 1031-1032
示例#2
0
    'f_slowsom2passsom': 'Transfer coefficient from Slow to Passive SOM',
    'lig_leaf': '?',
    'lig_wood': '?',
    'clay': '?',
    'silt': '?',
}

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

NPP = Function('NPP')

x = StateVariableTuple((C_leaf, C_root, C_wood, C_metlit, C_stlit, CWD, C_mic,
                        C_slowsom, C_passsom))
K = ImmutableMatrix.diag([
    k_leaf, k_root, k_wood, k_metlit, k_stlit, k_CWD, k_mic, k_slowsom,
    k_passsom
])
A = ImmutableMatrix(
    [[-1, 0, 0, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0, 0, 0, 0],
     [0, 0, -1, 0, 0, 0, 0,
      0, 0], [f_leaf2metlit, f_root2metlit, 0, -1, 0, 0, 0, 0, 0],
     [f_leaf2stlit, f_root2stlit, 0, 0, -1, 0, 0, 0, 0],
     [0, 0, f_wood2CWD, 0, 0, -1, 0, 0,
      0], [0, 0, 0, f_metlit2mic, f_stlit2mic, 0, -1, 0, 0],
     [0, 0, 0, 0, f_stlit2slowsom, f_CWD2slowsom, f_mic2slowsom, -1, 0],
     [0, 0, 0, 0, 0, f_CWD2passsom, f_mic2passsom, f_slowsom2passsom,
      -1]])  # tranfer

B = CompartmentalMatrix(A * K)
t = TimeSymbol("t")  # unit: "day"
u = NPP(t)
示例#3
0
f_slowsom2passsom = 0.45 * (0.003 + 0.009 * clay)

temp_leaf = k_leaf
temp_wood = k_wood
temp_root = k_root
temp_metlit = k_metlit
temp_stlit = k_metlit / (5.75 * exp(-3.0 * lig_leaf))
temp_CWD = k_metlit / 20.6
temp_mic = k_mic
temp_slowsom = k_slowsom
temp_passsom = k_passsom

x = StateVariableTuple((C_leaf, C_root, C_wood, C_metlit, C_stlit, C_CWD,
                        C_mic, C_slowsom, C_passsom))
K = ImmutableMatrix.diag([
    temp_leaf, temp_root, temp_wood, temp_metlit, temp_stlit, temp_CWD,
    temp_mic, temp_slowsom, temp_passsom
])
A = ImmutableMatrix(
    [[-1, 0, 0, 0, 0, 0, 0, 0, 0], [0, -1, 0, 0, 0, 0, 0, 0, 0],
     [0, 0, -1, 0, 0, 0, 0,
      0, 0], [f_leaf2metlit, f_root2metlit, 0, -1, 0, 0, 0, 0, 0],
     [f_leaf2stlit, f_root2stlit, 0, 0, -1, 0, 0, 0, 0],
     [0, 0, f_wood2CWD, 0, 0, -1, 0, 0,
      0], [0, 0, 0, f_metlit2mic, f_stlit2mic, 0, -1, 0, 0],
     [0, 0, 0, 0, f_stlit2slowsom, f_CWD2slowsom, f_mic2slowsom, -1, 0],
     [0, 0, 0, 0, 0, f_CWD2passsom, f_mic2passsom, f_slowsom2passsom,
      -1]])  # tranfer

B = CompartmentalMatrix(A * K)
t = TimeSymbol("t")  # unit: "day"
u = NPP(t)