示例#1
0
""" 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 * 0, kr, kr, kr, kr, kr])
r.setKx([kz, kz, kz, kz, kz, kz])
nodes = r.get_nodes()
soil_index = lambda x, y, z: 0
r.rs.setSoilGrid(soil_index)
""" Numerical solution """
rx = r.solve_dirichlet(simtime, p0, p_s, [p_s], True)
# trans = -1.185
# rx = r.solve_neumann(simtime, trans, [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)
ana.addData("rx", rx)
ana.addData("fluxes", np.maximum(fluxes, -1.e-3))  # cut off for vizualisation
vp.plot_roots(ana, "rx", "Xylem matric potential (cm)")  # "fluxes", subType
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)
ana.addData("rx", rx)
ana.addData("fluxes", np.maximum(fluxes, -1.e-3))  # cut off for vizualisation
vp.plot_roots(ana, "rx", "Xylem matric potential (cm)")  # "fluxes"
示例#3
0
            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 
plt.plot(rx, nodes[:, 2] , "r*")
plt.xlabel("Xylem pressure (cm)")
plt.ylabel("Depth (cm)")
plt.title("Xylem matric potential (cm)")
plt.show()

plt.plot(fluxes, nodes[1:, 2] , "r*")
plt.xlabel("Fluxes")