Ejemplo n.º 1
0
from pylagrit import PyLaGriT
import numpy

# Variables
nx = 50  # Number of points in x direction
dy = 0.25  # width of cells in y direction
distance = 12.34364319  # distance in x direction

l = PyLaGriT()

# Create base layer
layer = l.create_qua()
layer.createpts_xyz((nx, 2, 1), [0., 0., 0.], [distance, dy, 0.],
                    rz_switch=[1, 1, 1],
                    connect=True)
layer.setatt('itetclr', 12)
layer.minmax_xyz()

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

# Read in lidar top elevations
peat_surf_pts = l.read('surface_coords2.avs')
peat_surf_pts.addatt('z_save', vtype='vdouble', rank='scalar')
peat_surf_pts.copyatt('zic', 'z_save')
peat_surf_pts.setatt('zic', 0.)

# Interpolate surface elevations to layer mo
pset3.setatt('id_top_region', 4)
pset4.setatt('id_top_region', 5)

# Release the psets from memory
pset0.delete()
pset1.delete()
pset2.delete()
pset3.delete()
pset4.delete()

#********************************************
# 03 Build some surfaces to define stratigraphy.
# In a real model, the surfaces would come from some geologic framework model
# and would define geologic or hydro-geologic horizons and topography.
#********************************************
mosurf1 = lg.create_qua()  # Create the top surface
p1 = (-20, -20, 1000)
p2 = (4020, -20, 1500)
p3 = (4020, 4020, 2500)
p4 = (-20, 4020, 500)
pts = [p1, p2, p3, p4]
nnodes = (numX, numY, 1)
mosurf1.quadxy(nnodes, pts)
#mosurf1.paraview()
mosurf1.minmax_xyz()
mosurf1.dump('tmp_surf1_quad.inp')

mosurf2 = lg.create_qua()  # Create the bottom surface
p1 = (-20, -20, 1800)
p2 = (4020, -20, 2100)
p3 = (4020, 4020, 2800)