[cig-commits] r16540 - in short/3D/PyLith/trunk: modulesrc/materials pylith pylith/materials
willic3 at geodynamics.org
willic3 at geodynamics.org
Mon Apr 12 19:27:49 PDT 2010
Author: willic3
Date: 2010-04-12 19:27:48 -0700 (Mon, 12 Apr 2010)
New Revision: 16540
Added:
short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i
short/3D/PyLith/trunk/pylith/materials/DruckerPrager3D.py
Modified:
short/3D/PyLith/trunk/modulesrc/materials/Makefile.am
short/3D/PyLith/trunk/modulesrc/materials/materials.i
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/materials/PowerLaw3D.py
short/3D/PyLith/trunk/pylith/materials/__init__.py
Log:
Added Python and bindings for DruckerPrager3D.
Need to add unit tests.
Added: short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i (rev 0)
+++ short/3D/PyLith/trunk/modulesrc/materials/DruckerPrager3D.i 2010-04-13 02:27:48 UTC (rev 16540)
@@ -0,0 +1,218 @@
+// -*- C++ -*-
+//
+// ----------------------------------------------------------------------
+//
+// Brad T. Aagaard
+// U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ----------------------------------------------------------------------
+//
+
+/** @file modulesrc/materials/DruckerPrager3D.i
+ *
+ * @brief Python interface to C++ DruckerPrager3D object.
+ */
+
+namespace pylith {
+ namespace materials {
+
+ class pylith::materials::DruckerPrager3D : public ElasticMaterial
+ { // class DruckerPrager3D
+
+ // PUBLIC METHODS /////////////////////////////////////////////////
+ public :
+
+ /// Default constructor
+ DruckerPrager3D(void);
+
+ /// Destructor
+ ~DruckerPrager3D(void);
+
+ /** Set current time step.
+ *
+ * @param dt Current time step.
+ */
+ void timeStep(const double dt);
+
+ /** Set whether elastic or inelastic constitutive relations are used.
+ *
+ * @param flag True to use elastic, false to use inelastic.
+ */
+ void useElasticBehavior(const bool flag);
+
+ // PROTECTED METHODS //////////////////////////////////////////////
+ protected :
+
+ /** Compute properties from values in spatial database.
+ *
+ * Order of values in arrays matches order used in dbValues() and
+ * parameterNames().
+ *
+ * @param propValues Array of property values.
+ * @param dbValues Array of database values.
+ */
+ void _dbToProperties(double* const propValues,
+ const pylith::double_array& dbValues) const;
+
+ /** Nondimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _nondimProperties(double* const values,
+ const int nvalues) const;
+
+ /** Dimensionalize properties.
+ *
+ * @param values Array of property values.
+ * @param nvalues Number of values.
+ */
+ void _dimProperties(double* const values,
+ const int nvalues) const;
+
+ /** Compute initial state variables from values in spatial database.
+ *
+ * @param stateValues Array of state variable values.
+ * @param dbValues Array of database values.
+ */
+ void _dbToStateVars(double* const stateValues,
+ const pylith::double_array& dbValues) const;
+
+ /** Nondimensionalize state variables..
+ *
+ * @param values Array of state variables.
+ * @param nvalues Number of values.
+ */
+ void _nondimStateVars(double* const values,
+ const int nvalues) const;
+
+ /** Dimensionalize state variables.
+ *
+ * @param values Array of state variables.
+ * @param nvalues Number of values.
+ */
+ void _dimStateVars(double* const values,
+ const int nvalues) const;
+
+ /** Compute density from properties.
+ *
+ * @param density Array for density.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ */
+ void _calcDensity(double* const density,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars);
+
+ /** Compute stress tensor from properties and state variables. If
+ * the state variables are from the previous time step, then the
+ * computeStateVars flag should be set to true so that the state
+ * variables are updated (but not stored) when computing the stresses.
+ *
+ * @param stress Array for stress tensor.
+ * @param stressSize Size of stress tensor.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param totalStrain Total strain at location.
+ * @param strainSize Size of strain tensor.
+ * @param initialStress Initial stress values.
+ * @param initialStressSize Size of initial stress array.
+ * @param initialStrain Initial strain values.
+ * @param initialStrainSize Size of initial strain array.
+ * @param computeStateVars Flag indicating to compute updated
+ * state variables.
+ */
+ void _calcStress(double* const stress,
+ const int stressSize,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars,
+ const double* totalStrain,
+ const int strainSize,
+ const double* initialStress,
+ const int initialStressSize,
+ const double* initialStrain,
+ const int initialStrainSize,
+ const bool computeStateVars);
+
+ /** Compute derivatives of elasticity matrix from properties.
+ *
+ * @param elasticConsts Array for elastic constants.
+ * @param numElasticConsts Number of elastic constants.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param totalStrain Total strain at location.
+ * @param strainSize Size of strain tensor.
+ * @param initialStress Initial stress values.
+ * @param initialStressSize Size of initial stress array.
+ * @param initialStrain Initial strain values.
+ * @param initialStrainSize Size of initial strain array.
+ */
+ void _calcElasticConsts(double* const elasticConsts,
+ const int numElasticConsts,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars,
+ const double* totalStrain,
+ const int strainSize,
+ const double* initialStress,
+ const int initialStressSize,
+ const double* initialStrain,
+ const int initialStrainSize);
+
+ /** Get stable time step for implicit time integration.
+ *
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ *
+ * @returns Time step
+ */
+ double _stableTimeStepImplicit(const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars) const;
+
+ /** Update state variables (for next time step).
+ *
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param totalStrain Total strain at location.
+ * @param strainSize Size of strain tensor.
+ * @param initialStress Initial stress values.
+ * @param initialStressSize Size of initial stress array.
+ * @param initialStrain Initial strain values.
+ * @param initialStrainSize Size of initial strain array.
+ */
+ void _updateStateVars(double* const stateVars,
+ const int numStateVars,
+ const double* properties,
+ const int numProperties,
+ const double* totalStrain,
+ const int strainSize,
+ const double* initialStress,
+ const int initialStressSize,
+ const double* initialStrain,
+ const int initialStrainSize);
+
+ }; // class DruckerPrager3D
+
+ } // materials
+} // pylith
+
+// End of file
Modified: short/3D/PyLith/trunk/modulesrc/materials/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/Makefile.am 2010-04-13 02:18:08 UTC (rev 16539)
+++ short/3D/PyLith/trunk/modulesrc/materials/Makefile.am 2010-04-13 02:27:48 UTC (rev 16540)
@@ -29,7 +29,8 @@
MaxwellIsotropic3D.i \
MaxwellPlaneStrain.i \
GenMaxwellIsotropic3D.i \
- PowerLaw3D.i
+ PowerLaw3D.i \
+ DruckerPrager3D.i
swigincludedir = $(pkgdatadir)/swig/$(subpackage)
swiginclude_HEADERS = \
Modified: short/3D/PyLith/trunk/modulesrc/materials/materials.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/materials/materials.i 2010-04-13 02:18:08 UTC (rev 16539)
+++ short/3D/PyLith/trunk/modulesrc/materials/materials.i 2010-04-13 02:27:48 UTC (rev 16540)
@@ -30,6 +30,7 @@
#include "pylith/materials/MaxwellPlaneStrain.hh"
#include "pylith/materials/GenMaxwellIsotropic3D.hh"
#include "pylith/materials/PowerLaw3D.hh"
+#include "pylith/materials/DruckerPrager3D.hh"
#include "pylith/utils/arrayfwd.hh"
#include "pylith/utils/sievetypes.hh"
@@ -70,6 +71,7 @@
%include "MaxwellPlaneStrain.i"
%include "GenMaxwellIsotropic3D.i"
%include "PowerLaw3D.i"
+%include "DruckerPrager3D.i"
// End of file
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2010-04-13 02:18:08 UTC (rev 16539)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2010-04-13 02:27:48 UTC (rev 16540)
@@ -73,6 +73,7 @@
materials/MaxwellIsotropic3D.py \
materials/MaxwellPlaneStrain.py \
materials/PowerLaw3D.py \
+ materials/DruckerPrager3D.py \
meshio/__init__.py \
meshio/CellFilter.py \
meshio/CellFilterAvgMesh.py \
Added: short/3D/PyLith/trunk/pylith/materials/DruckerPrager3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/DruckerPrager3D.py (rev 0)
+++ short/3D/PyLith/trunk/pylith/materials/DruckerPrager3D.py 2010-04-13 02:27:48 UTC (rev 16540)
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/materials/DruckerPrager3D.py
+##
+## @brief Python object implementing 3-D isotropic Drucker-Prager
+## elastoplastic material.
+##
+## Factory: material.
+
+from ElasticMaterial import ElasticMaterial
+from materials import DruckerPrager3D as ModuleDruckerPrager3D
+
+# DruckerPrager3D class
+class DruckerPrager3D(ElasticMaterial, ModuleDruckerPrager3D):
+ """
+ Python object implementing 3-D isotropic Drucker-Prager elastoplastic
+ material.
+
+ Factory: material.
+ """
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="druckerprager3d"):
+ """
+ Constructor.
+ """
+ ElasticMaterial.__init__(self, name)
+ self.availableFields = \
+ {'vertex': \
+ {'info': [],
+ 'data': []},
+ 'cell': \
+ {'info': ["mu", "lambda", "density",
+ "alpha_yield", "beta", "alpha_flow"],
+ 'data': ["total_strain", "stress", "plastic_strain"]}}
+ self._loggingPrefix = "MaDP3D "
+ return
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _createModuleObj(self):
+ """
+ Call constructor for module object for access to C++ object.
+ """
+ ModuleDruckerPrager3D.__init__(self)
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def material():
+ """
+ Factory associated with DruckerPrager3D.
+ """
+ return DruckerPrager3D()
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/materials/PowerLaw3D.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/PowerLaw3D.py 2010-04-13 02:18:08 UTC (rev 16539)
+++ short/3D/PyLith/trunk/pylith/materials/PowerLaw3D.py 2010-04-13 02:27:48 UTC (rev 16540)
@@ -10,7 +10,7 @@
# ----------------------------------------------------------------------
#
-## @file pylith/materials/PowerLaw1D.py
+## @file pylith/materials/PowerLaw3D.py
##
## @brief Python object implementing 3-D isotropic power-law
## viscoelastic material.
Modified: short/3D/PyLith/trunk/pylith/materials/__init__.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/__init__.py 2010-04-13 02:18:08 UTC (rev 16539)
+++ short/3D/PyLith/trunk/pylith/materials/__init__.py 2010-04-13 02:27:48 UTC (rev 16540)
@@ -25,6 +25,7 @@
'Material',
'MaxwellIsotropic3D',
'PowerLaw3D',
+ 'DruckerPrager3D',
]
More information about the CIG-COMMITS
mailing list