x = np.concatenate((l_block, r_block), axis=0)
#-----
#  Y
#-----
y = x  #for now, same as x
#-----
#  Z
#-----
z = np.linspace(-L, 0., int(L) + 1)
"""
Build mesh
"""
#---- Create pylagrit object
lg = PyLaGriT()
#---- create mesh object using xyz arrays
m = lg.gridder(x, y, z)
#---- connect points
m.connect()

#---- visualize connected mesh using ParaView
# (assumes pylagritc is being used)
#--THIS NEEDS TO BE HERE     (otherwise mo1.inp file doesn't get created)
m.paraview(filename='fracture_region.inp')

# fault coordinates
cs = [[-0.0005, -10., 0.], [-0.0005, 10., 0.], [0.0005, 10., 0.],
      [0.0005, 10., -100.], [0.0005, -10., -100.], [-0.0005, 10., -100.],
      [-0.0005, -10., -100.], [-0.0005, -10., -100.]]
cs = np.array(cs)
# create surfaces of fault
ss = []
Beispiel #2
0
#  telx = np.concatenate((np.array([0.,df/2.]), np.logspace(log10(df),log10(xl),num=50,endpoint=True)))

#  y = np.concatenate((np.arange(-yl/2.,0+dy,dy), np.arange(dy,yl/2+dy,dy))) #half-model
#  y = np.arange(0,yl/2+dy,dy) #quarter-model
y = np.arange(0., yl+dy,dy)
z = np.arange(-zl, 0.+dz, dz)
#  z = np.concatenate((np.arange(-zl/2.,0+dz,dz), np.arange(dz,zl/2+dz,dz)))


mins = np.array([min(x), min(y), min(z)])
maxs = np.array([max(x), min(y), max(z)])
#  mins = np.array([min(x), min(z)])
#  maxs = np.array([max(x), max(z)])

#  m = l.gridder(x,y,z,connect=True)
m = l.gridder(telx,y,z,connect=True) #refines toward fracture plane
#  m = l.gridder(telx,z,elem_type='quad',connect=True) #refines toward fracture plane
#  m = l.gridder(telx,z,elem_type='quad') #refines toward fracture plane
#  m.connect()
m.setatt('imt',1) #matrix nodes material set to '1'




#---------------------------------------------------------------------- 
#            FRACTURE
#---------------------------------------------------------------------- 
fmins = np.array([min(x),min(y),min(z)])
#  fmaxs = np.array([df/2.,max(y),max(z)])
fmaxs = np.array([df,max(y),max(z)])
#  fmins = np.array([min(x),min(z)])
Beispiel #3
0
from pylagrit import PyLaGriT
import numpy as np

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)
Beispiel #4
0
#  X
#-----
# blocks on either side of the fracture
l_block = np.linspace(-dm, -df / 2, 10)  # left block
r_block = -1 * l_block[::-1]  # right block
# assemble
x = np.concatenate((l_block, r_block), axis=0)
#-----
#  Y
#-----
y = x  #for now, same as x
#-----
#  Z
#-----
z = np.linspace(-L, 0., int(L) + 1)
"""
Build mesh
"""
#---- Create pylagrit object
l = PyLaGriT()
#---- create mesh object using xyz arrays in gridder
m = l.gridder(x, y, z)
#---- connect points
m.connect()

#---- visualize connected mesh using ParaView
# (assumes pylagritc is being used)
#--THIS NEEDS TO BE HERE     (otherwise mo1.inp file doesn't get created)
m.paraview(
)  # will throw an error on server, can still view mo1.inp on locally mounted paraview
Beispiel #5
0
# Discretization
nx = 61
ny = 61
# Polygon delineation filename
polygon_file = '2d_mesh.avs'
# User parameters #######################

l = PyLaGriT()

# Read in polygon delineation mesh
mopoly = l.read(polygon_file)

# Create quad using polygon min and max coordinates
xs = np.linspace(mopoly.xmin, mopoly.xmax, nx)
ys = np.linspace(mopoly.ymin, mopoly.ymax, ny)
moquad = l.gridder(xs, ys, elem_type='quad', connect=True)
mopoly.setatt('itetclr', 1)

# Create extruded quad to tet and center at z=0
mopoly.extrude(1.0)
moprism = mopoly.extrude(1.0)
moprism.trans((0., 0., 0.), (0., 0., 0.5))
motet = moprism.grid2grid_prismtotet3()

# Clean up a little
mopoly.delete()
moprism.delete()

# Add attribute to moquad to store if in polygon or not
moquad.addatt('if_in_poly', vtype='vint')
moquad.setatt('if_in_poly', 0)  # Make sure attr starts as zero
Beispiel #6
0
from pylagrit import PyLaGriT
import numpy

x = numpy.arange(0, 10.1, 1)
y = x
z = [0, 1]

lg = PyLaGriT()
mqua = lg.gridder(x, y, z, elem_type='hex', connect=True)

mqua.rotateln([mqua.xmin - 0.1, 0, 0], [mqua.xmax + 0.1, 0, 0], 25)

mqua.dump_exo('rotated.exo')
mqua.dump_ats_xml('rotated.xml', 'rotated.exo')

mqua.paraview()
Beispiel #7
0


#  y = np.concatenate((np.arange(-yl/2.,0+dy,dy), np.arange(dy,yl/2+dy,dy))) #half-model
#  y = np.arange(0,yl/2+dy,dy) #quarter-model
y = np.arange(0,yl+dy,dy) #quarter-model
z = np.arange(-zl, 0.+dz, dz)
#  z = np.concatenate((np.arange(-zl/2.,0+dz,dz), np.arange(dz,zl/2+dz,dz)))


mins = np.array([min(x), min(y), min(z)])
maxs = np.array([max(x), max(y), max(z)])


#  m = l.gridder(telx,y,z,connect=True) #refines toward fracture plane
m = l.gridder(telx,y,z,connect=False) #refines toward fracture plane            #NEW

m.setatt('imt',2) #matrix nodes material set to '2'

l.sendline('filter / 1 0 0 /; rmpoint compress')
l.sendline('cmo printatt mo1 -all- minmax')



m.connect()

m.setatt('imt',2) #matrix nodes material set to '2'



Beispiel #8
0
x = np.concatenate((l_block, r_block), axis=0)
#-----
#  Y
#-----
y = x  #for now, same as x
#-----
#  Z
#-----
z = np.linspace(-L, 0., int(L) + 1)

#---- Define mesh objects
lg = PyLaGriT()
m = lg.gridder(x,
               y,
               z,
               connect=True,
               elem_type='hex',
               name='3Dfracture_mesh',
               filename='mesh.inp')
#  m = lg.create(name='3Dfracture_mesh')

# Define enclosing volume
box = lg.surface_box([-10., -10., -100.], [10., 10., 0.],
                     name='fullbox',
                     ibtype='reflect')

# NOT SURE IF NEED TO DEFINE INTERIOR INTERFACE(S)
#--- interfaces cannot be coincident w/ reflective boundaries
fractureplane = lg.surface_box([-0.5, -10.1, -100.1], [0.5, 10.1, 0.1],
                               name='fractureplane',
                               ibtype='intrface')
Beispiel #9
0
from pylagrit import PyLaGriT
import numpy

x = numpy.arange(0, 10.1, 1)
y = [0, 1]
#z = [0,1]

lg = PyLaGriT()
layer = lg.gridder(x=x, y=y, elem_type='quad', connect=True)
layer.rotateln([0, layer.ymin - 0.10, 0], [0, layer.ymax + 0.1, 0], 25)
layer.dump('tmp_lay_top.inp')

# Layer depths?
#           1   2   3    4    5    6    7   8    9   10
layers = [.1, 1.]
addnum = [4, 2]
#matnum = [2]*len(layers)
matnum = [2, 1]
layer_interfaces = numpy.cumsum(layers)

mtop = layer.copy()
stack_files = ['tmp_lay_top.inp 1,9']
#stack_files.append('tmp_lay_peat_bot.inp 1,33')

i = 1
for li, m, a in zip(layer_interfaces, matnum, addnum):
    layer.math('sub', 'zic', value=li, cmosrc=mtop)
    stack_files.append('tmp_lay' + str(i) + '.inp ' + str(int(m)) + ', ' +
                       str(a))
    layer.dump('tmp_lay' + str(i) + '.inp')
    i += 1