[cig-commits] r16049 - in short/3D/PyLith/branches/pylith-friction/tests: 1d/line2 2d/quad4

brad at geodynamics.org brad at geodynamics.org
Sat Nov 28 14:20:12 PST 2009


Author: brad
Date: 2009-11-28 14:20:11 -0800 (Sat, 28 Nov 2009)
New Revision: 16049

Added:
   short/3D/PyLith/branches/pylith-friction/tests/1d/line2/lgdeformtranslation.cfg
   short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/lgdeformrigidbody.cfg
   short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_gendb.py
   short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_soln.py
Log:
Setup some large deformation tests.

Added: short/3D/PyLith/branches/pylith-friction/tests/1d/line2/lgdeformtranslation.cfg
===================================================================
--- short/3D/PyLith/branches/pylith-friction/tests/1d/line2/lgdeformtranslation.cfg	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-friction/tests/1d/line2/lgdeformtranslation.cfg	2009-11-28 22:20:11 UTC (rev 16049)
@@ -0,0 +1,95 @@
+# -*- Python -*-
+[pylithapp]
+
+[pylithapp.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[pylithapp.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solverlinear = 1
+#meshioascii = 1
+#implicitelasticity = 1
+#quadrature = 1
+#fiatsimplex = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[pylithapp.mesh_generator]
+#debug = 1
+
+[pylithapp.mesh_generator.reader]
+filename = bar.mesh
+coordsys.space_dim = 1
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+dimension = 1
+bc = [bc]
+
+formulation = pylith.problems.ImplicitLgDeform
+formulation.solver = pylith.problems.SolverNonlinear
+
+[pylithapp.timedependent.formulation.time_step]
+total_time = 0.0*s
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+materials = [elastic]
+materials.elastic = pylith.materials.ElasticStrain1D
+
+[pylithapp.timedependent.materials.elastic]
+label = Elastic material
+id = 1
+db_properties.iohandler.filename = matprops.spatialdb
+quadrature.cell.shape = line
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.bc.bc]
+bc_dof = [0]
+label = end points
+db_initial = spatialdata.spatialdb.UniformDB
+db_initial.label = Dirichlet BC
+db_initial.values = [displacement-x]
+db_initial.data = [2.5*m]
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[pylithapp.petsc]
+ksp_rtol = 1.0e-8
+pc_type = asm
+# Change the preconditioner settings (must turn off
+# shift_positive_definite and turn on shift_nonzero).
+sub_pc_factor_shift_positive_definite = 0
+sub_pc_factor_shift_nonzero = 
+
+ksp_max_it = 100
+ksp_gmres_restart = 50
+#ksp_monitor = true
+#ksp_view = true
+#log_summary = true
+#start_in_debugger = true
+#snes_monitor = true
+#snes_view = true
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+[pylithapp.problem.formulation.output.output.writer]
+filename = lgdeformtranslation.vtk
+
+[pylithapp.timedependent.materials.elastic.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = lgdeformtranslation-elastic.vtk

Added: short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/lgdeformrigidbody.cfg
===================================================================
--- short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/lgdeformrigidbody.cfg	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/lgdeformrigidbody.cfg	2009-11-28 22:20:11 UTC (rev 16049)
@@ -0,0 +1,106 @@
+# -*- Python -*-
+[pylithapp]
+
+[pylithapp.launcher] # WARNING: THIS IS NOT PORTABLE
+command = mpirun -np ${nodes}
+
+# ----------------------------------------------------------------------
+# journal
+# ----------------------------------------------------------------------
+[pylithapp.journal.info]
+#timedependent = 1
+#implicit = 1
+#petsc = 1
+#solverlinear = 1
+#meshiocubit = 1
+#implicitelasticity = 1
+#quadrature2d = 1
+#fiatlagrange = 1
+
+# ----------------------------------------------------------------------
+# mesh_generator
+# ----------------------------------------------------------------------
+[pylithapp.mesh_generator]
+#debug = 1
+reader = pylith.meshio.MeshIOCubit
+
+[pylithapp.mesh_generator.reader]
+filename = mesh.exo
+coordsys.space_dim = 2
+
+# ----------------------------------------------------------------------
+# problem
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+dimension = 2
+bc = [x_neg,x_pos]
+
+formulation = pylith.problems.ImplicitLgDeform
+formulation.solver = pylith.problems.SolverNonlinear
+
+[pylithapp.timedependent.formulation.time_step]
+total_time = 0.0*s
+
+# ----------------------------------------------------------------------
+# materials
+# ----------------------------------------------------------------------
+[pylithapp.timedependent]
+materials = [elastic]
+materials.elastic = pylith.materials.ElasticPlaneStrain
+
+[pylithapp.timedependent.materials.elastic]
+label = Elastic material
+id = 1
+db_properties.iohandler.filename = matprops.spatialdb
+quadrature.cell = pylith.feassemble.FIATLagrange
+quadrature.cell.dimension = 2
+
+# ----------------------------------------------------------------------
+# boundary conditions
+# ----------------------------------------------------------------------
+[pylithapp.timedependent.bc.x_neg]
+bc_dof = [0,1]
+label = 21
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC -x edge
+db_initial.iohandler.filename = rigidbody_disp.spatialdb
+
+[pylithapp.timedependent.bc.x_pos]
+bc_dof = [0,1]
+label = 20
+db_initial = spatialdata.spatialdb.SimpleDB
+db_initial.label = Dirichlet BC +x edge
+db_initial.iohandler.filename = rigidbody_disp.spatialdb
+
+# ----------------------------------------------------------------------
+# PETSc
+# ----------------------------------------------------------------------
+[pylithapp.petsc]
+ksp_rtol = 1.0e-8
+pc_type = asm
+# Change the preconditioner settings (must turn off
+# shift_positive_definite and turn on shift_nonzero).
+sub_pc_factor_shift_positive_definite = 0
+sub_pc_factor_shift_nonzero = 
+
+ksp_max_it = 100
+ksp_gmres_restart = 50
+#ksp_monitor = true
+#ksp_view = true
+#snes_monitor = true
+#snes_view = true
+#ksp_converged_reason = true
+#snes_converged_reason = true
+#log_summary = true
+# start_in_debugger = true
+
+
+# ----------------------------------------------------------------------
+# output
+# ----------------------------------------------------------------------
+[pylithapp.problem.formulation.output.output.writer]
+filename = lgdeformrigidbody.vtk
+
+[pylithapp.timedependent.materials.elastic.output]
+cell_filter = pylith.meshio.CellFilterAvgMesh
+writer.filename = lgdeformrigidbody-elastic.vtk

Added: short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_gendb.py
===================================================================
--- short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_gendb.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_gendb.py	2009-11-28 22:20:11 UTC (rev 16049)
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/rigidbody_gendb.py
+##
+## @brief Python script to generate spatial database with displacement
+## boundary conditions for the rigid body motion test.
+
+import numpy
+
+class GenerateDB(object):
+  """
+  Python object to generate spatial database with displacement
+  boundary conditions for the rigid body motion test.
+  """
+  
+  def __init__(self):
+    """
+    Constructor.
+    """
+    return
+  
+  
+  def run(self):
+    """
+    Generate the database.
+    """
+    # Domain
+    x = numpy.arange(-4000.0, 4000.1, 1000.0)
+    y = numpy.arange(-4000.0, 4000.1, 1000.0)
+    npts = x.shape[0]
+
+    xx = x * numpy.ones( (npts, 1), dtype=numpy.float64)
+    yy = y * numpy.ones( (npts, 1), dtype=numpy.float64)
+    xy = numpy.zeros( (npts**2, 2), dtype=numpy.float64)
+    xy[:,0] = numpy.ravel(xx)
+    xy[:,1] = numpy.ravel(numpy.transpose(yy))
+
+    from rigidbody_soln import AnalyticalSoln
+    soln = AnalyticalSoln()
+    disp = soln.displacement(xy)
+
+    from spatialdata.geocoords.CSCart import CSCart
+    cs = CSCart()
+    cs.inventory.spaceDim = 2
+    cs._configure()
+    data = {'locs': xy,
+            'coordsys': cs,
+            'data_dim': 2,
+            'values': [{'name': "displacement-x",
+                        'units': "m",
+                        'data': numpy.ravel(disp[:,0])},
+                       {'name': "displacement-y",
+                        'units': "m",
+                        'data': numpy.ravel(disp[:,1])}]}
+
+    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
+    io = SimpleIOAscii()
+    io.inventory.filename = "rigidbody_disp.spatialdb"
+    io._configure()
+    io.write(data)
+    return
+
+# ======================================================================
+if __name__ == "__main__":
+  app = GenerateDB()
+  app.run()
+
+
+# End of file 

Added: short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_soln.py
===================================================================
--- short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_soln.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-friction/tests/2d/quad4/rigidbody_soln.py	2009-11-28 22:20:11 UTC (rev 16049)
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file tests/2d/quad4/rigidbody_soln.py
+##
+## @brief Analytical solution to rigid body motion problem.
+
+import numpy
+
+# Physical properties
+p_density = 2500.0
+p_vs = 3000.0
+p_vp = 5291.502622129181
+
+p_mu = p_density*p_vs**2
+p_lambda = p_density*p_vp**2 - 2*p_mu
+
+# Uniform stress field (plane strain)
+sxx = 0.0
+sxy = 0.0
+syy = 0.0
+szz = p_lambda/(2*p_lambda+2*p_mu)*(sxx+syy)
+
+# Uniform strain field
+exx = 0.0
+eyy = 0.0
+ezz = 0.0
+
+exy = 1.0/(2*p_mu) * (sxy)
+
+#print exx,eyy,exy,ezz
+#print -exx*p_lambda/(p_lambda+2*p_mu)
+
+# ----------------------------------------------------------------------
+class AnalyticalSoln(object):
+  """
+  Analytical solution to axial/shear displacement problem.
+  """
+
+  def __init__(self):
+    return
+
+
+  def displacement(self, locs):
+    """
+    Compute displacement field at locations.
+    """
+    u0 = 1000.0
+    v0 = 500.0
+    from math import pi
+    theta = -30.0/180.0*pi
+
+    (npts, dim) = locs.shape
+    disp = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    disp[:,0] = -locs[:,0] + \
+        u0 + numpy.cos(theta)*locs[:,0] + numpy.sin(theta)*locs[:,1]
+    disp[:,1] = -locs[:,1] + \
+        v0 - numpy.sin(theta)*locs[:,0] + numpy.cos(theta)*locs[:,1]
+    return disp
+
+
+  def strain(self, locs):
+    """
+    Compute strain field at locations.
+    """
+    (npts, dim) = locs.shape
+    strain = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    strain[:,0] = exx
+    strain[:,1] = eyy
+    strain[:,2] = exy
+    return strain
+  
+
+  def stress(self, locs):
+    """
+    Compute stress field at locations.
+    """
+    (npts, dim) = locs.shape
+    stress = numpy.zeros( (npts, 3), dtype=numpy.float64)
+    stress[:,0] = sxx
+    stress[:,1] = syy
+    stress[:,2] = sxy
+    return stress
+
+
+# End of file 



More information about the CIG-COMMITS mailing list