Beispiel #1
0
layer_interfaces = numpy.cumsum(layers)
i = 1
for li, m, a in zip(layer_interfaces, matnum, addnum):
    layer.math('sub', li, 'zic', cmosrc=peat_bot)
    stack_files.append('tmp_lay' + str(i) + '.inp ' + str(int(m)) + ', ' +
                       str(a))
    layer.dump('tmp_lay' + str(i) + '.inp')
    i += 1

layer.setatt('zic', -45.)
layer.dump('tmp_lay_bot.inp')
stack_files.append('tmp_lay_bot.inp 2')
stack_files.reverse()

# Create stacked layer mesh and fill
stack = l.create()
stack.stack_layers('avs', stack_files, flip_opt=True)
stack_hex = stack.stack_fill()

# Create boundary facesets, dictionary of PyLaGriT faceset objects is returned
fs = stack_hex.create_boundary_facesets(base_name='faceset_bounds',
                                        stacked_layers=True,
                                        reorder=True)

# Should add this to PyLaGriT, but I'm feeling lazy ;-)
stack_hex.sendline('quality volume itetclr')

# Write exo file with boundary facesets
stack_hex.dump_exo('arctic_siteb_2d.exo', facesets=fs.values())

# Write region and faceset identifier file for ats_xml
Beispiel #2
0
stack_files.append('tmp_lay4.inp')
nlayers.append(14)
matids.append(2)

layer.setatt('zic', -45.)
layer.dump('tmp_lay_bot.inp')
stack_files.append('tmp_lay_bot.inp 2')
nlayers.append(1)
matids.append(2)

# Create stacked layer mesh and fill
# Reverse arrays so that order is from bottom to top!!!
stack_files.reverse()
nlayers.reverse()
matids.reverse()
stack = lg.create()
stack.stack_layers(stack_files, nlayers=nlayers, matids=matids, flip_opt=True)
stack_hex = stack.stack_fill()

# Create boundary facesets, dictionary of PyLaGriT faceset objects is returned
fs = stack_hex.create_boundary_facesets(base_name='faceset_bounds',
                                        stacked_layers=True,
                                        reorder=True)

# Should add this to PyLaGriT, but I'm feeling lazy ;-)
stack_hex.sendline('quality volume itetclr')

# Write exo file with boundary facesets
stack_hex.dump_exo('arctic_siteb_2d.exo', facesets=fs.values())

# Write region and faceset identifier file for ats_xml
Beispiel #3
0
"""
Making a sphere object in pylagrit.
(For cavity/chimney).
"""

# Import PyLaGriT class from pylagrit module
from pylagrit import PyLaGriT
import numpy as np


l = PyLaGriT()
# create emppty mesh object data structure
m = l.create()

#  """
#  Define enclosing volume useing 'surface'
#  """
sph_surf =





Beispiel #4
0
                       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
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(x,y,z,connect=True)
m = l.gridder(telx, y, z, connect=True)  #refines toward fracture plane
m.setatt('imt', 1)  #matrix nodes material set to '1'

motet2 = l.create(name='motet2')

#----------------------------------------------------------------------
#         QUARTER-SPHERE CAVITY
#----------------------------------------------------------------------

# Cavity nodes (hemisphere formulation) -------------------------
cmins = np.array([0., 0 - radius / 2., -zl / 2. - radius / 2.])
cmaxs = np.array([radius / 2., radius / 2., -zl / 2. + radius / 2.])
#theta = angle in xy-plane measured from positive x-axis toward positive y-axis
#phi = angle measured from positive z-axis to positive y-axis
theta1 = 0
theta2 = 180
phi1 = 0
phi2 = 90  #360
Beispiel #5
0
from pylagrit import PyLaGriT
lg = PyLaGriT()
mesh = lg.create()
mins = (0, 0, 0)
maxs = (5, 5, 5)
eighth = mesh.surface_box(mins, maxs)
boolstr1 = 'le ' + eighth.name
boolstr2 = 'gt ' + eighth.name
reg1 = mesh.region(boolstr1)
reg2 = mesh.region(boolstr2)
mreg1 = mesh.mregion(boolstr1)
mreg2 = mesh.mregion(boolstr2)
mesh.createpts_brick_xyz((10, 10, 10), (0, 0, 0), (10, 10, 10))
mesh.rmregion(reg1)
mesh.dump('reg_test.gmv')
Beispiel #6
0
# Crank up pylagrit
lg = PyLaGriT()
# Read in elevations in avs fromat
m = lg.read(dem_file_base+'.avs')
# Take a look, change paraview exe
# Will need to use glyph filter to view points
#m.paraview(exe='paraview')

# Copy z values over to attribute
m.addatt('z_save',type='vdouble',rank='scalar')
m.copyatt('zic','z_save')
# Not sure why this has to be done, but not data elements don't get removed otherwise
m.setatt('zic',0.)

# Create connected quad mesh surface
m2 = lg.create()
#m2.createpts_xyz((nx,ny,1),[xx.min(),yy.min(),0.],[xx.max(),yy.max(),0],rz_switch=[1,1,1],connect=True)
m2.createpts_xyz((nx,ny,1),[xx.min(),yy.min(),0.],[xx.max(),yy.max(),0],rz_switch=[1,1,1])
# Create temporary z value attribute
m2.addatt('z_save',type='vdouble',rank='scalar')
# Interpolate elevations to z_save
m2.interpolate_voronoi('z_save',m,'z_save')
# Find nodes associated with nodata
pdel = m2.pset_attribute('z_save',-9999)
# Create element set from these nodes and remove elements
edel = pdel.eltset()
m2.rmpoint_eltset(edel)
# Copy temp z values over to actual a values
#m2.copyatt('z_save','zic')
# Take a look to make sure everything is ok
#m2.paraview(exe='paraview')
#wz_i.delete()

# Second pass refinement
w_zone = mo.intersect_elements(mowells, 'w_zone')
wz_i = mo.eltset_attribute('w_zone', 0, 'gt')  #Non-zero indicates intersection
wz_i.refine()
mo.setatt('w_zone', 0)
#wz_i.delete()

mohex = mo.grid2grid_tree_to_fe()  #Quadtree or octree grid to grid

#mo.status (brief=True)

# Identify the column of vertices closest to the well center.
#Well1
mo_pts1 = lg.create()
mo_pts1.createpts_rtz((2, 2, 1000), (0, 0, 3100), (Radius, 360, 2200))
mo_pts1.trans((0, 0, 0), (Well1X, Well1Y, 0))

#Well2
mo_pts2 = lg.create()
mo_pts2.createpts_rtz((2, 2, 1000), (0, 0, 3100), (Radius, 360, 2200))
mo_pts2.trans((0, 0, 0), (Well2X, Well2Y, 0))

mo_pts = lg.merge([mo_pts1, mo_pts2])
mo_pts.filter()
mo_pts.rmpoint_compress()

# Compute a distance field attribute
mo.compute_distance(mo_pts, option='distance_field', attname='dfield_well')
Beispiel #8
0
from pylagrit import PyLaGriT
l = PyLaGriT()
mhex = l.read_fehm('fehm.grid')
#mhex.paraview()

mtet = l.create(elem_type='tet')
mtet = mhex.copypts()
mtet.connect()
mtet.paraview()


"""
https://lanl.github.io/LaGriT/pages/docs/tutorial.html
This tutorial explains how to generate a grid in a
unit cube containing two materials separated by a
plane. (translated from LaGriT to PyLaGriT)
"""

from pylagrit import PyLaGriT
import numpy as np
"""
(1) Define mesh objects
---------------------------------------------------
- create a 3D tetrahedral mesh object and name it 3dmesh
"""
lg = PyLaGriT()
m = lg.create(name='3Dmesh')
"""
(2) Define an enclosing volume
---------------------------------------------------
- Define an enclosing volume using the surface command
- Since we are defining an exterior boundary, the boundary type is reflect.
"""
#  # not really sure how to do this in pylagrit...
#  mini = 0.0
#  maxi = 1.0
#  x = np.array([mini,maxi])
#  y = x
#  z = y
#
#  cube = lg.gridder(x,y,z)
Beispiel #10
0
from pylagrit import PyLaGriT
l = PyLaGriT()

# Create 2x2x2 cell mesh
m = l.create()
m.createpts_dxyz((0.5,0.5,0.5),(0.,0.,0.),(1.,1.,1.),rz_switch=[1,1,1],connect=True)
m.paraview()
#m.gmv()

# Create 2x2x2 mesh where maxs will be truncated to nearest value under given maxs
m_under = l.create()
m_under.createpts_dxyz((0.4,0.4,0.4),(0.,0.,0.),(1.,1.,1.),rz_switch=[1,1,1],connect=True)
m_under.paraview()
#m_under.gmv()

# Create 3x3x3 mesh where maxs will be truncated to nearest value over given maxs
m_over = l.create()
m_over.createpts_dxyz((0.4,0.4,0.4),(0.,0.,0.),(1.,1.,1.),clip='over',rz_switch=[1,1,1],connect=True)
m_over.paraview()
#m_over.gmv()

# Create 3x3x3 mesh where x and y maxs will be truncated to nearest value over given maxs
# and z min will be truncated  to nearest value 
m_mixed = l.create()
m_mixed.createpts_dxyz((0.4,0.4,0.4),(0.,0.,-1.),(1.,1.,0.),hard_bound=('min','min','max'),clip=('under','under','over'),rz_switch=[1,1,1],connect=True)
m_mixed.paraview()
#m_over.gmv()