Ejemplo n.º 1
0
""" Parameters """
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 """
Ejemplo n.º 2
0
""" Parameters """
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 * 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)")
Ejemplo n.º 3
0
p_s = np.linspace(-200, -400,
                  2001)  # 2 meter down, from -200 to -400, resolution in mm
soil_index = lambda x, y, z: int(-10 * z
                                 )  # maps to p_s (hydrostatic equilibirum)
rs.setSoilGrid(soil_index)

path = "../../../modelparameter/rootsystem/"
name = "Anagallis_femina_Leitner_2010"  # Zea_mays_1_Leitner_2010
rs.setSeed(1)
rs.readParameters(path + name + ".xml")
rs.initialize()
rs.simulate(simtime, False)
p_s = np.linspace(-200, -400, 2001)  # 2 meter down, resolution in mm
""" set up xylem parameters """
r = XylemFluxPython(rs)
r.setKr([kr])  # or use setKrTables, see XylemFlux.h
r.setKx([kz])
""" numerical solution of transpiration -1 cm3/day"""
rx = r.solve_neumann(
    simtime, -1, p_s,
    True)  # True: matric potential given per cell (not per segment)
print("solved")

fluxes = r.segFluxes(simtime, rx, p_s, False,
                     True)  # cm3/day (double simTime,  rx,  sx,  approx, cells
print("Transpiration", r.collar_flux(simtime, rx, p_s), np.sum(fluxes),
      "cm3/day")
suf = np.array(fluxes) / -1.  # [1]
""" Additional vtk plot """
ana = pb.SegmentAnalyser(r.rs)
ana.addData("SUF", np.minimum(suf, 1.e-2))  # cut off for vizualisation
Ejemplo n.º 4
0
r = XylemFluxPython(rs) 
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()