import py_rootbox as rb # from pyevtk.hl import gridToVTK import numpy as np import matplotlib.pyplot as plt from matplotlib import ticker import matplotlib.colors as colors def v2a(vd): # rb.std_vector_double_ to numpy array l = np.zeros(len(vd)) for i in range(0, len(vd)): l[i] = vd[i] return l rootsystem = rb.RootSystem() name = "Anagallis_straight_simple" # # Open plant and root parameter from a file # rootsystem.openFile(name) for i in range(0, 10): p = rootsystem.getRootTypeParameter(i + 1) p.gf = 2 # linear growth function # # Initialize # rootsystem.initialize()
import py_rootbox as rb from rb_tools import * import sys import numpy as np import matplotlib.pyplot as plt import csv rs = rb.RootSystem() #name = "Triticum_aestivum_a_Bingham_2011" # is this the same as your wheat, Shehan? name = "Zea_mays_1_Leitner_2010" rs.openFile(name) # Pore Geometry x_ = (-10, -5, 1, 15) # not 0, otherwise we start in crack y_ = (0, 0, 0, 0) x_ = (-10, -5) y_ = (0, 0) crack = rb.SDF_PlantBox(1.0, 100, 160) # cm cracks_ = rb.std_vector_SDF_() py_cracks = [] for i in range(0, len(y_)): v = rb.Vector3d(x_[i], y_[i], 0) py_cracks.append(rb.SDF_RotateTranslate(crack, v)) cracks_.append(py_cracks[-1]) cracks = rb.SDF_Union(cracks_) rs.setPoreGeometry(cracks) # Increased elongation within the pores maxS = 20 # twice the elongation rate within the pore
def simulate(name, simtime): rs = rb.RootSystem() rs.openFile(name, "params/") rs.initialize() rs.simulate(simtime, True) return rs