Exemple #1
0
    rs.getRootSystemParameter().seedPos.z = -3  # -0.01
    rs.initialize()
    rs.simulate(
        simtime, False
    )  # simulate all, then use age dependent conductivities for predefined growth

    #     # Plot, using vtk
    #     vp.plot_roots(rs, "creationTime")
    """ set up xylem parameters """
    r = XylemFluxPython(rs)
    kr4 = kr1  # basal
    kr5 = kr1  # shoot borne
    r.setKrTables(
        [kr1[:, 1], kr1[:, 1], kr2[:, 1], kr3[:, 1], kr4[:, 1], kr5[:, 1]],
        [kr1[:, 0], kr1[:, 0], kr2[:, 0], kr3[:, 0], kr4[:, 0], kr5[:, 0]])
    r.setKx([kx, kx, kx, kx, kx, kx])

    #     """ for debugging """
    #     r.test()
    #     r.plot_conductivities()
    #     shoot_segs = rs.getShootSegments()
    #     print("Shoot segments", [str(s) for s in shoot_segs])
    #     print("Shoot type", rs.subTypes[0])
    """ numerical solution of transpiration -1 cm3/day"""
    krs_, l_, jc_ = [], [], []
    for t in np.linspace(10, simtime, simtime - 10 + 1):

        # l_.append(rs.getSummed("length")) # does not work, since rs is precomputed
        ana = pb.SegmentAnalyser(rs)
        ana.filter("creationTime", -1, t + 1.e-4)
        l_.append(
kz = 4.32e-2  # axial conductivity [cm^3/day]
kr = 1.728e-4  # radial conductivity [1/day]
p_s = -200  # static soil pressure [cm]
p0 = -500  # dircichlet bc at top
simtime = 14  # [day] for task b
""" root system """
rs = pb.MappedRootSystem()
path = "../../../modelparameter/rootsystem/"
name = "Anagallis_femina_Leitner_2010"  # Zea_mays_1_Leitner_2010
rs.readParameters(path + name + ".xml")
rs.initialize()
rs.simulate(simtime, False)
""" root problem """
r = XylemFluxPython(rs)
r.setKr([kr])
r.setKx([kz])
nodes = r.get_nodes()
soil_index = lambda x, y, z: 0
r.rs.setSoilGrid(soil_index)
""" Numerical solution """
rx = r.solve_dirichlet(0., p0, p_s, [p_s], True)
fluxes = r.segFluxes(simtime, rx, -200 * np.ones(rx.shape), False)  # cm3/day
print("Transpiration", r.collar_flux(simtime, rx, [p_s]), "cm3/day")
""" plot results """
plt.plot(rx, nodes[:, 2], "r*")
plt.xlabel("Xylem pressure (cm)")
plt.ylabel("Depth (m)")
plt.title("Xylem matric potential (cm)")
plt.show()
""" Additional vtk plot """
ana = pb.SegmentAnalyser(r.rs)
Exemple #3
0
nodes = r.get_nodes()
"""
    we can give a kr/kx:
        constant across type: r.setKx([[kz]])
        by type: r.setKx([[kz], [kz2], [kz3]])
        by type and subtype: r.setKx([[kz, kz2], [kza, kzb], [kzd, kzf]])
    att: the bud (from which the leaf grows) has to have a kz
        one of the above + time dependant:
            constant across type: r.setKx([[kz1, kz2, kr3]], [[age1, age2, age3]])
            by type: r.setKxTables([[[kz1, kz2, kr3],[kza, kzb, krc]]], [[[age1, age2, age3], [agea, ageb, agec]]])
            by type and subtype: r.setKxTables([[[kz1, kz2, kr3],[kza, kzb, krc]],[[kz1, kz2, kr3],[kza, kzb, krc]]],
                    [[[age1, age2, age3], [agea, ageb, agec]],[[age1, age2, age3], [agea, ageb, agec]]])
"""

r.setKr([[kr],[kr_stem],[gs]]) 
r.setKx([[kz]])
r.airPressure = p_a
# p_out = r.get_outer_matpot_matix(p_s, p_a) #create matrix to have p_a outer pressure for stem/leaves and p_s outer pressure for roots.
leavenodes = r.get_nodes_index(4) #only takes for nodes of leaves

# Numerical solution 
r.node_ind = r.get_nodes_index(4)
r.seg_ind = r.get_segments_index(4)
rx = r.solve_dirichlet(sim_time=0., value=p0, sxc=0., sxx=[p_s], cells=True) #water matric pot given per segment
print("Transpiration", r.collar_flux(simtime, rx, [p_s], [], True),"cm3/day")

fluxes = r.segFluxes(simtime, rx, [p_s], False, True)  # cm3/day
print(fluxes)
print()

# plot results