Beispiel #1
0
lg = PyLaGriT()

# Create base layer from x=10 to x=21 to match bert02 mesh
x = np.linspace(10., 21, (21. - 10.) / 0.25 + 1)
y = [0., 0.25]
top = lg.gridder(x, y, elem_type='quad', connect=True)

# Create top of mesh
# Collapse y values
top.addatt('y_save', type='vdouble', rank='scalar')
top.copyatt('yic', 'y_save')
top.setatt('yic', 0.)

# Read in top elevations
d = np.genfromtxt("./Topo_Profile_NS_ERT.csv", delimiter=",", names=True)
surf_pts = lg.points(x=d['Distance_m'], z=d['Z'], elem_type='quad')
surf_pts.addatt('z_save', type='vdouble', rank='scalar')
surf_pts.copyatt('zic', 'z_save')
surf_pts.setatt('zic', 0.)

# Interpolate surface elevations to top
top.addatt('z_val', type='vdouble', rank='scalar')
top.interpolate_voronoi('z_val', surf_pts, 'z_save')
top.copyatt('y_save', 'yic')
top.copyatt('z_val', 'zic')

# Save top
top.setatt('imt', 1)
top.setatt('itetclr', 1)
top.dump('tmp_lay_peat_top.inp')
surf_pts.delete()
Beispiel #2
0
# Create base layer, with x matching s from the csv file 
x = np.linspace(0.,29.75,(29.75-0.)/0.25+1)
y = [0.,0.25]
top = lg.gridder(x,y,elem_type='quad',connect=True)

# Create top of mesh
# Collapse y values
top.addatt('y_save',vtype='vdouble',rank='scalar')
top.copyatt('yic','y_save')
top.setatt('yic',0.)

# Read in top elevations
d = np.genfromtxt("transectNWSE.csv", delimiter=",", names=True)
coords = np.column_stack([d['s'],np.zeros_like(d['s']),d['z']])
surf_pts = lg.points(coords,elem_type='quad')
surf_pts.addatt('z_save',vtype='vdouble',rank='scalar')
surf_pts.copyatt('zic','z_save')
surf_pts.setatt('zic',0.)

# Interpolate surface elevations to top
top.addatt('z_val',vtype='vdouble',rank='scalar')
top.interpolate_voronoi('z_val',surf_pts,'z_save')
top.copyatt('y_save','yic')
top.copyatt('z_val','zic')

# Save top
top.setatt('imt',1)
top.setatt('itetclr',1)
top.dump('tmp_lay_peat_top.inp')
surf_pts.delete()