# (negative, y is negative)
tractions_bg_normal = density*gacc*(vertices[:,1])

# Background shear tractions are reverse (in 2-D right-lateral is negative)
# because the normal tractions are negative.
tractions_bg_shear = coef_friction*tractions_bg_normal

# Combine traction changes and background tractions
tractions_shear = tractions_bg_shear + tractions_change[:,0]
tractions_normal = tractions_bg_normal + tractions_change[:,1]

# Create coordinate system for spatial database
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(2)

# Create writer for spatial database file
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
writer = SimpleIOAscii()
writer.inventory.filename = "afterslip_tractions.spatialdb"
writer._configure()
writer.write({'points': vertices,
              'coordsys': cs,
              'data_dim': 1,
              'values': [{'name': "traction-shear",
                          'units': "Pa",
                          'data': tractions_shear},
                         {'name': "traction-normal",
                          'units': "Pa",
                          'data': tractions_normal}]})
Beispiel #2
0
#!/usr/bin/env python
"""
This script creates a spatial database for the initial stress and state
variables for a Drucker-Prager 3D elastoplastic material.
"""

material = "dp3d"

import numpy
import h5py

from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(3)

filenameH5 = "output/grav_static_%s-visco.h5" % material
filenameDB = "grav_statevars-%s.spatialdb" % material

# Open HDF5 file and get coordinates, cells, and stress.
h5 = h5py.File(filenameH5, "r")
vertices = h5['geometry/vertices'][:]
cells = numpy.array(h5['topology/cells'][:], dtype=numpy.int)
stress = h5['cell_fields/stress'][0,:,:]
strain = h5['cell_fields/total_strain'][0,:,:]
strainPlastic = h5['cell_fields/plastic_strain'][0,:,:]
h5.close()

# Get cell centers for output.
cellCoords = vertices[cells,:]
Beispiel #3
0
#!/usr/bin/env python
"""
This script creates a spatial database for the initial stress and state
variables for a Maxwell plane strain material.
"""

material = "maxps"

import numpy
import h5py

from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(2)

filenameH5 = "output/grav_static_%s-visco.h5" % material
filenameDB = "grav_statevars-%s.spatialdb" % material

# Open HDF5 file and get coordinates, cells, and stress.
h5 = h5py.File(filenameH5, "r")
vertices = h5['geometry/vertices'][:]
cells = numpy.array(h5['topology/cells'][:], dtype=numpy.int)
stress = h5['cell_fields/stress'][0,:,:]
strain = h5['cell_fields/total_strain'][0,:,:]
strainViscous = h5['cell_fields/viscous_strain'][0,:,:]
h5.close()

# Get cell centers for output.
cellCoords = vertices[cells,:]
Beispiel #4
0
#!/usr/bin/env python
"""
This script creates a spatial database for the initial stress and state
variables for a Maxwell 3D material.
"""

material = "max3d"

import numpy
import h5py

from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs._configure()
cs.setSpaceDim(3)

filenameH5 = "output/grav_static_%s-visco.h5" % material
filenameDB = "grav_statevars-%s.spatialdb" % material

# Open HDF5 file and get coordinates, cells, and stress.
h5 = h5py.File(filenameH5, "r")
vertices = h5['geometry/vertices'][:]
cells = numpy.array(h5['topology/cells'][:], dtype=numpy.int)
stress = h5['cell_fields/stress'][0, :, :]
strain = h5['cell_fields/total_strain'][0, :, :]
strainViscous = h5['cell_fields/viscous_strain'][0, :, :]
h5.close()

# Get cell centers for output.
cellCoords = vertices[cells, :]