[cig-commits] r19539 - in short/3D/PyLith/branches/v1.6-stable: examples/3d/hex8 modulesrc/faults modulesrc/friction modulesrc/topology pylith/faults pylith/meshio pylith/perf pylith/topology tests/topology unittests/libtests/friction unittests/libtests/friction/data unittests/libtests/topology
brad at geodynamics.org
brad at geodynamics.org
Tue Jan 31 16:29:31 PST 2012
Author: brad
Date: 2012-01-31 16:29:31 -0800 (Tue, 31 Jan 2012)
New Revision: 19539
Modified:
short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg
short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/test.cfg
short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/Fault.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/FaultCohesive.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/FrictionModel.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/RateStateAgeing.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/SlipWeakening.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/StaticFriction.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/TimeWeakening.i
short/3D/PyLith/branches/v1.6-stable/modulesrc/topology/SubMesh.i
short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveDyn.py
short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveKin.py
short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultDyn.py
short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultKin.py
short/3D/PyLith/branches/v1.6-stable/pylith/perf/Fault.py
short/3D/PyLith/branches/v1.6-stable/pylith/perf/MemoryLogger.py
short/3D/PyLith/branches/v1.6-stable/pylith/perf/Mesh.py
short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py
short/3D/PyLith/branches/v1.6-stable/pylith/topology/MeshGenerator.py
short/3D/PyLith/branches/v1.6-stable/tests/topology/test_meshmem.py
short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/TestFrictionModel.cc
short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/data/SlipWeakeningData.cc
short/3D/PyLith/branches/v1.6-stable/unittests/libtests/topology/TestRefineUniform.cc
Log:
Tweaks to friction implementation for quasi-static problems. More work on memory logging.
Modified: short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/pylithapp.cfg 2012-02-01 00:29:31 UTC (rev 19539)
@@ -85,7 +85,7 @@
# Linear solver monitoring options.
ksp_monitor = true
-ksp_view = true
+#ksp_view = true
ksp_converged_reason = true
# Nonlinear solver monitoring options.
@@ -94,7 +94,7 @@
snes_max_it = 100
snes_monitor = true
snes_ls_monitor = true
-snes_view = true
+#snes_view = true
snes_converged_reason = true
# PETSc summary -- useful for performance information.
Modified: short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/test.cfg
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/test.cfg 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/examples/3d/hex8/test.cfg 2012-02-01 00:29:31 UTC (rev 19539)
@@ -119,12 +119,12 @@
[pylithapp.timedependent.interfaces.fault]
# The label corresponds to the name of the nodeset in CUBIT.
label = fault
-zero_tolerance = 1.0e-15
+zero_tolerance = 1.0e-12
# Use the rate-and-state aging friction model.
friction = pylith.friction.RateStateAgeing
friction.label = Rate and state
-friction.min_slip_rate = 1.0e-10
+friction.min_slip_rate = 1.0e-9
# We must define the quadrature information for fault cells.
# The fault cells are 2D (surface).
@@ -142,7 +142,7 @@
friction.db_properties = spatialdata.spatialdb.UniformDB
friction.db_properties.label = Rate Stete Ageing
friction.db_properties.values = [reference-friction-coefficient,reference-slip-rate,characteristic-slip-distance,constitutive-parameter-a,constitutive-parameter-b,cohesion]
-friction.db_properties.data = [0.4, 1.0e-9*m/s, 0.05*m, 0.01, 0.08, 0.0*Pa]
+friction.db_properties.data = [0.4, 1.0e-7*m/s, 2.0*m, 0.01, 0.02, 0.0*Pa]
# Set spatial database for the initial value of the state variable.
friction.db_initial_state = spatialdata.spatialdb.UniformDB
@@ -162,7 +162,7 @@
# fault constitutive model.
friction_pc_type = asm
friction_sub_pc_factor_shift_type = nonzero
-friction_ksp_max_it = 25
+friction_ksp_max_it = 50
friction_ksp_gmres_restart = 30
# Uncomment to view details of friction sensitivity solve.
#friction_ksp_monitor = true
@@ -170,15 +170,15 @@
friction_ksp_converged_reason = true
# Reduce convergence tolerances.
-ksp_rtol = 1.0e-18
-ksp_atol = 1.0e-18
+ksp_rtol = 1.0e-16
+ksp_atol = 1.0e-15
-snes_rtol = 1.0e-16
-snes_atol = 1.0e-16
+snes_rtol = 1.0e-14
+snes_atol = 1.0e-12
snes_max_it = 200
+info = 1
-
# ----------------------------------------------------------------------
# output
# ----------------------------------------------------------------------
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/Fault.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/Fault.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/Fault.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -65,13 +65,38 @@
*/
const char* label(void) const;
- /** Get the number of vertices on the fault.
+ /** Get dimension of mesh.
*
+ * @returns Dimension of mesh.
+ */
+ int dimension(void) const;
+
+ /** Get representative cone size for mesh.
+ *
+ * @returns Representative cone size for mesh.
+ */
+ int coneSize(void) const;
+
+ /** Get number of vertices in mesh.
+ *
+ * @returns Number of vertices in mesh.
+ */
+ int numVertices(void) const;
+
+ /** Get number of cells in mesh.
+ *
+ * @returns Number of cells in mesh.
+ */
+ int numCells(void) const;
+
+ /** Get the number of vertices associated with the fault (before
+ * fault mesh exists).
+ *
* @param mesh PETSc mesh
* @return Number of vertices on the fault.
*/
virtual
- int numVertices(const topology::Mesh& mesh) const = 0;
+ int numVerticesNoMesh(const topology::Mesh& mesh) const = 0;
/** Adjust mesh topology for fault implementation.
*
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/FaultCohesive.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/FaultCohesive.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/faults/FaultCohesive.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -63,12 +63,13 @@
*/
void faultMeshFilename(const char* filename);
- /** Get the number of vertices on the fault.
+ /** Get the number of vertices associated with the fault (before
+ * fault mesh exists).
*
* @param mesh PETSc mesh
* @return Number of vertices on the fault.
*/
- int numVertices(const topology::Mesh& mesh) const;
+ int numVerticesNoMesh(const topology::Mesh& mesh) const;
/** Adjust mesh topology for fault implementation.
*
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/FrictionModel.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/FrictionModel.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/FrictionModel.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -147,6 +147,21 @@
const double normalTraction);
+ /** Compute change in friction for a change in slip (Jacobian).
+ *
+ * @pre Must call retrievePropsAndVars for cell before calling
+ * calcFriction().
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ *
+ * @returns Change in friction for a chance in slip (dT/dD).
+ */
+ double calcFrictionSlope(const double slip,
+ const double slipRate,
+ const double normalTraction);
+
/** Compute friction at vertex.
*
* @pre Must call retrievePropsAndVars for cell before calling
@@ -240,6 +255,27 @@
const double* stateVars,
const int numStateVars) = 0;
+ /** Compute change in friction for a change in slip (Jacobian).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ *
+ * @returns Change in friction for a chance in slip (dT/dD).
+ */
+ virtual
+ double _calcFrictionSlope(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars) = 0;
+
/** Update state variables (for next time step).
*
* @param stateVars State variables at location.
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/RateStateAgeing.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/RateStateAgeing.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/RateStateAgeing.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -88,6 +88,44 @@
const double* stateVars,
const int numStateVars);
+ /** Compute change in friction for a change in slip (Jacobian).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ *
+ * @returns Change in friction for a chance in slip (dT/dD).
+ */
+ double _calcFrictionSlope(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars);
+
+ /** Update state variables (for next time step).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ */
+ void _updateStateVars(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ double* const stateVars,
+ const int numStateVars,
+ const double* properties,
+ const int numProperties);
+
}; // class RateStateAgeing
} // friction
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/SlipWeakening.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/SlipWeakening.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/SlipWeakening.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -87,6 +87,44 @@
const double* stateVars,
const int numStateVars);
+ /** Compute change in friction for a change in slip (Jacobian).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ *
+ * @returns Change in friction for a chance in slip (dT/dD).
+ */
+ double _calcFrictionSlope(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars);
+
+ /** Update state variables (for next time step).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ */
+ void _updateStateVars(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ double* const stateVars,
+ const int numStateVars,
+ const double* properties,
+ const int numProperties);
+
}; // class SlipWeakening
} // friction
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/StaticFriction.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/StaticFriction.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/StaticFriction.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -81,6 +81,26 @@
const double* stateVars,
const int numStateVars);
+ /** Compute change in friction for a change in slip (Jacobian).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ *
+ * @returns Change in friction for a chance in slip (dT/dD).
+ */
+ double _calcFrictionSlope(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars);
+
}; // class StaticFriction
} // friction
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/TimeWeakening.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/TimeWeakening.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/friction/TimeWeakening.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -81,6 +81,44 @@
const double* stateVars,
const int numStateVars);
+ /** Compute change in friction for a change in slip (Jacobian).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ *
+ * @returns Change in friction for a chance in slip (dT/dD).
+ */
+ double _calcFrictionSlope(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ const double* properties,
+ const int numProperties,
+ const double* stateVars,
+ const int numStateVars);
+
+ /** Update state variables (for next time step).
+ *
+ * @param slip Current slip at location.
+ * @param slipRate Current slip rate at location.
+ * @param normalTraction Normal traction at location.
+ * @param stateVars State variables at location.
+ * @param numStateVars Number of state variables.
+ * @param properties Properties at location.
+ * @param numProperties Number of properties.
+ */
+ void _updateStateVars(const double slip,
+ const double slipRate,
+ const double normalTraction,
+ double* const stateVars,
+ const int numStateVars,
+ const double* properties,
+ const int numProperties);
+
}; // class TimeWeakening
} // friction
Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/topology/SubMesh.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/topology/SubMesh.i 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/topology/SubMesh.i 2012-02-01 00:29:31 UTC (rev 19539)
@@ -81,6 +81,24 @@
*/
int dimension(void) const;
+ /** Get representative cone size for mesh.
+ *
+ * @returns Representative cone size for mesh.
+ */
+ int coneSize(void) const;
+
+ /** Get number of vertices in mesh.
+ *
+ * @returns Number of vertices in mesh.
+ */
+ int numVertices(void) const;
+
+ /** Get number of cells in mesh.
+ *
+ * @returns Number of cells in mesh.
+ */
+ int numCells(void) const;
+
/** Get MPI communicator associated with mesh.
*
* @returns MPI communicator.
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveDyn.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveDyn.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveDyn.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -91,7 +91,7 @@
"slip_rate",
"traction"]},
'cell': \
- {'info': ["distribution"],
+ {'info': ["partition"],
'data': []}}
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveKin.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/faults/FaultCohesiveKin.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -92,7 +92,7 @@
'data': ["slip",
"traction_change"]},
'cell': \
- {'info': ["distribution"],
+ {'info': ["partition"],
'data': []}}
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultDyn.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultDyn.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultDyn.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -59,8 +59,7 @@
"traction"])
vertexDataFields.meta['tip'] = "Names of vertex data fields to output."
- cellInfoFields = pyre.inventory.list("cell_info_fields",
- default=["distribution"])
+ cellInfoFields = pyre.inventory.list("cell_info_fields", default=[])
cellInfoFields.meta['tip'] = "Names of cell info fields to output."
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultKin.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultKin.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/OutputFaultKin.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -61,8 +61,7 @@
"traction_change"])
vertexDataFields.meta['tip'] = "Names of vertex data fields to output."
- cellInfoFields = pyre.inventory.list("cell_info_fields",
- default=["distribution"])
+ cellInfoFields = pyre.inventory.list("cell_info_fields", default=[])
cellInfoFields.meta['tip'] = "Names of cell info fields to output."
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/perf/Fault.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/perf/Fault.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/perf/Fault.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -26,19 +26,51 @@
"""
Fault object for holding mesh memory and performance information.
"""
- def __init__(self):
+ def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0):
"""
Constructor.
"""
+ self.dimension = dimension
+ self.coneSize = maxConeSize
+ self.nvertices = numVertices
+ self.ncells = numCells
+ self.cellType = None
+ self.initialize()
return
+ def initialize(self):
+ """
+ Initialize application.
+ """
+ from Mesh import cellTypes
+ try:
+ if self.coneSize > 0:
+ self.cellType = cellTypes[(self.dimension,self.coneSize)]
+ except:
+ raise ValueError("Unknown cell type '%s' for dim %d and cone size %d." %\
+ (self.cellType,self.dimension,self.coneSize))
+ return
+
+
def tabulate(self, memDict):
"""
Tabulate memory use.
"""
- memDict['Creation'] = 0
- memDict['Stratification'] = 0
- memDict['Coordinates'] = 0
+ dim = self.dimension
+ ncells = self.ncells
+ nvertices = self.nvertices
+ coneSize = self.coneSize
+
+ memDict['Creation'] = self.sizeInt * (2 * (coneSize*ncells + nvertices + ncells) + coneSize*ncells)
+ memDict['Stratification'] = 2 * self.sizeArrow * (nvertices + ncells)
+ memDict['Coordinates'] = (self.sizeDouble * dim * nvertices) + (2 * self.sizeInt * nvertices) + (2 * self.sizeInt * nvertices)
+
+ # coneSize for cohesive cell is 3*coneSize for fault (surface) cell
+ # :TODO: account for fault sieve
+ memDict['CohesiveCells'] = {'Creation': 0,
+ 'Stratification': 0}
+ memDict['CohesiveCells']['Creation'] = self.sizeInt * (2 * (3*coneSize*ncells + 3*nvertices + ncells) + 3*coneSize*ncells)
+ memDict['CohesiveCells']['Stratification'] = 2 * self.sizeArrow * (3*nvertices + ncells)
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/perf/MemoryLogger.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/perf/MemoryLogger.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -145,10 +145,12 @@
import pylith.perf.Field
if not stage in self.memory: self.memory[stage] = {}
+ if not 'Fields' in self.memory[stage]:
+ self.memory[stage]['Fields'] = {}
if not field is None:
fieldModel = pylith.perf.Field.Field(field.label(), field.sectionSize(),
field.chartSize())
- fieldModel.tabulate(self.memory[stage])
+ fieldModel.tabulate(self.memory[stage]['Fields'])
return
@@ -183,7 +185,8 @@
import pylith.perf.Fault
if not stage in self.memory: self.memory[stage] = {}
- faultModel = pylith.perf.Fault.Fault()
+ faultModel = pylith.perf.Fault.Fault(mesh.dimension(), mesh.coneSize(),
+ mesh.numVertices(), mesh.numCells())
faultModel.tabulate(self.memory[stage])
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/perf/Mesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/perf/Mesh.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/perf/Mesh.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -22,59 +22,65 @@
from Memory import Memory
+cellTypes = {(1,2): 'line2',
+ (1,3): 'line3',
+ (2,3): 'tri3',
+ (2,6): 'tri6',
+ (2,4): 'quad4',
+ (2,9): 'quad9',
+ (3,4): 'tet4',
+ (3,8): 'hex8',
+ (3,10): 'tet10',
+ (3,27): 'hex27'
+ }
+
+
class Mesh(Memory):
- cellTypes = {(1,2): 'line2',
- (1,3): 'line3',
- (2,3): 'tri3',
- (2,6): 'tri6',
- (2,4): 'quad4',
- (2,9): 'quad9',
- (3,4): 'tet4',
- (3,8): 'hex8',
- (3,10): 'tet10',
- (3,27): 'hex27'
- }
-
"""
Mesh object for holding mesh memory and performance information.
"""
- def __init__(self, dimension = 0, maxConeSize = 0, numVertices = 0, numCells = 0):
+
+ def __init__(self, dimension=0, maxConeSize=0, numVertices=0, numCells=0):
"""
Constructor.
"""
self.dimension = dimension
- self.coneSize = maxConeSize
+ self.coneSize = maxConeSize
self.nvertices = numVertices
- self.ncells = numCells
- self.cellType = None
+ self.ncells = numCells
+ self.cellType = None
self.initialize()
return
+
def cellTypeInfo(cls, cellType):
for k,cT in cls.cellTypes.iteritems():
if cT == cellType:
return k
raise ValueError("Unknown cell type '%s'." % cellType)
+
def initialize(self):
"""
Initialize application.
"""
try:
if self.coneSize > 0:
- self.cellType = self.cellTypes[(self.dimension,self.coneSize)]
+ self.cellType = cellTypes[(self.dimension,self.coneSize)]
except:
- raise ValueError("Unknown cell type '%s' for dim %d and cone size %d." % (self.cellType,self.dimension,self.coneSize))
+ raise ValueError("Unknown cell type '%s' for dim %d and cone size %d." %\
+ (self.cellType,self.dimension,self.coneSize))
return
+
def tabulate(self, memDict):
"""
Tabulate memory use.
"""
- memDict['Creation'] = self.sizeInt * (2 * (self.coneSize*self.ncells + self.nvertices + self.ncells) + self.coneSize*self.ncells)
+ memDict['Creation'] = self.sizeInt * (2 * (self.coneSize*self.ncells + self.nvertices + self.ncells) + self.coneSize*self.ncells)
memDict['Stratification'] = 2 * self.sizeArrow * (self.nvertices + self.ncells)
# Here we have data + atlas (could use uniform) + bc (could use Section)
- memDict['Coordinates'] = (self.sizeDouble * self.dimension * self.nvertices) + (2 * self.sizeInt * self.nvertices) + (2 * self.sizeInt * self.nvertices)
+ memDict['Coordinates'] = (self.sizeDouble * self.dimension * self.nvertices) + (2 * self.sizeInt * self.nvertices) + (2 * self.sizeInt * self.nvertices)
memDict['Overlap'] = 0 # Don't know overlap
memDict['RealSections'] = 0 # Real sections should be elsewhere
return
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/topology/Mesh.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -74,33 +74,6 @@
return
- def dimension(self):
- """
- Return the topological mesh dimension
- """
- return ModuleMesh.dimension(self)
-
-
- def coneSize(self):
- """
- Return the representative cone size, or number of vertices on a cell
- """
- return ModuleMesh.coneSize(self)
-
-
- def numVertices(self):
- """
- Return the number of vertices.
- """
- return ModuleMesh.numVertices(self)
-
-
- def numCells(self):
- """
- Return the number of cells.
- """
- return ModuleMesh.numCells(self)
-
def groupSizes(self):
"""
Return the name and number of vertices for each group
@@ -111,4 +84,5 @@
groups.append((name,ModuleMesh.groupSize(self, name)))
return groups
+
# End of file
Modified: short/3D/PyLith/branches/v1.6-stable/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/topology/MeshGenerator.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/topology/MeshGenerator.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -113,13 +113,13 @@
for interface in interfaces:
if 0 == comm.rank:
self._info.log("Counting vertices for fault '%s'." % interface.label())
- nvertices = interface.numVertices(mesh)
+ nvertices = interface.numVerticesNoMesh(mesh)
firstLagrangeVertex += nvertices
firstFaultCell += nvertices
if interface.useLagrangeConstraints():
firstFaultCell += nvertices
for interface in interfaces:
- nvertices = interface.numVertices(mesh)
+ nvertices = interface.numVerticesNoMesh(mesh)
if 0 == comm.rank:
self._info.log("Adjusting topology for fault '%s' with %d vertices." % \
(interface.label(), nvertices))
Modified: short/3D/PyLith/branches/v1.6-stable/tests/topology/test_meshmem.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/tests/topology/test_meshmem.py 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/tests/topology/test_meshmem.py 2012-02-01 00:29:31 UTC (rev 19539)
@@ -60,8 +60,9 @@
Run test.
"""
- filenameIn = "data/tet4.exo"
+ #filenameIn = "data/tet4.exo"
#filenameIn = "tri3_200m_gradient.exo"
+ filenameIn = "tet4_150m.exo"
from pylith.perf.MemoryLogger import MemoryLogger
self.logger = MemoryLogger()
@@ -135,22 +136,22 @@
mesh = dmesh
- # Refine mesh (if necessary)
- from pylith.topology.RefineUniform import RefineUniform
- refiner = RefineUniform()
- rmesh = refiner.refine(mesh)
- rmesh.memLoggingStage = "RefinedMesh"
+ if False: # Refine mesh (if necessary)
+ from pylith.topology.RefineUniform import RefineUniform
+ refiner = RefineUniform()
+ rmesh = refiner.refine(mesh)
+ rmesh.memLoggingStage = "RefinedMesh"
- print "Unrefined mesh logging stage",mesh.memLoggingStage
- self.logger.logMesh(mesh.memLoggingStage, mesh)
- material.ncells = MeshOps_numMaterialCells(mesh, material.id())
- self.logger.logMaterial(mesh.memLoggingStage, material)
+ print "Unrefined mesh logging stage",mesh.memLoggingStage
+ self.logger.logMesh(mesh.memLoggingStage, mesh)
+ material.ncells = MeshOps_numMaterialCells(mesh, material.id())
+ self.logger.logMaterial(mesh.memLoggingStage, material)
- self.logger.logMesh(rmesh.memLoggingStage, rmesh)
- material.ncells = MeshOps_numMaterialCells(rmesh, material.id())
- self.logger.logMaterial(rmesh.memLoggingStage, material)
+ self.logger.logMesh(rmesh.memLoggingStage, rmesh)
+ material.ncells = MeshOps_numMaterialCells(rmesh, material.id())
+ self.logger.logMaterial(rmesh.memLoggingStage, material)
- self._showStatus("After refining mesh")
+ self._showStatus("After refining mesh")
return
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/TestFrictionModel.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/TestFrictionModel.cc 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/TestFrictionModel.cc 2012-02-01 00:29:31 UTC (rev 19539)
@@ -356,7 +356,7 @@
const int numStateVars = 2;
const double stateVars[2] = { 0.5, 0.1 };
- const double stateVarsUpdatedE[2] = { 0.65, 0.5 };
+ const double stateVarsUpdatedE[2] = { 0.65, 0.25 };
// Set state variables to given values
@@ -715,7 +715,7 @@
const double tolerance = 1.0e-06;
for (int i=0; i < numVarsVertex; ++i) {
-#if 0 // DEBUGGING
+#if 1 // DEBUGGING
std::cout << "valE: " << stateVarsE[i]
<< ", val: " << stateVars[i]
<< std::endl;
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/data/SlipWeakeningData.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/data/SlipWeakeningData.cc 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/friction/data/SlipWeakeningData.cc 2012-02-01 00:29:31 UTC (rev 19539)
@@ -142,9 +142,9 @@
const double pylith::friction::SlipWeakeningData::_stateVarsUpdated[] = {
0.48,
- 0.4,
+ 0.12,
0.65,
- 0.5,
+ 0.25,
};
pylith::friction::SlipWeakeningData::SlipWeakeningData(void)
Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/topology/TestRefineUniform.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/topology/TestRefineUniform.cc 2012-02-01 00:29:20 UTC (rev 19538)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/topology/TestRefineUniform.cc 2012-02-01 00:29:31 UTC (rev 19539)
@@ -148,7 +148,7 @@
faultA.id(100);
if (0 != data.faultA) {
faultA.label(data.faultA);
- const int nvertices = faultA.numVertices(*mesh);
+ const int nvertices = faultA.numVerticesNoMesh(*mesh);
firstLagrangeVertex += nvertices;
firstFaultCell += 2*nvertices; // shadow + Lagrange vertices
} // if
@@ -157,7 +157,7 @@
faultB.id(101);
if (0 != data.faultB) {
faultA.label(data.faultB);
- const int nvertices = faultB.numVertices(*mesh);
+ const int nvertices = faultB.numVerticesNoMesh(*mesh);
firstLagrangeVertex += nvertices;
firstFaultCell += 2*nvertices; // shadow + Lagrange vertices
} // if
More information about the CIG-COMMITS
mailing list