[cig-commits] r22113 - in short/3D/PyLith/trunk: libsrc/pylith/faults pylith/problems

brad at geodynamics.org brad at geodynamics.org
Mon May 20 12:53:49 PDT 2013


Author: brad
Date: 2013-05-20 12:53:48 -0700 (Mon, 20 May 2013)
New Revision: 22113

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
Log:
Added creating components for constraints if splitting fields.

Modified: short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc	2013-05-20 19:14:13 UTC (rev 22112)
+++ short/3D/PyLith/trunk/libsrc/pylith/faults/FaultCohesiveLagrange.cc	2013-05-20 19:53:48 UTC (rev 22113)
@@ -157,7 +157,8 @@
     PetscInt dof;
     err = PetscSectionGetFieldDof(fieldSection, p, 1, &dof);PYLITH_CHECK_ERROR(err);
     if (!dof) {
-      err = PetscSectionSetFieldDof(fieldSection, p, 0, spaceDim);PYLITH_CHECK_ERROR(err);
+      err = PetscSectionGetDof(fieldSection, p, &dof);PYLITH_CHECK_ERROR(err);assert(spaceDim == dof);
+      err = PetscSectionSetFieldDof(fieldSection, p, 0, dof);PYLITH_CHECK_ERROR(err);
     } // if
   } // for
 

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2013-05-20 19:14:13 UTC (rev 22112)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2013-05-20 19:53:48 UTC (rev 22113)
@@ -519,24 +519,18 @@
     if 1:
       solution = self.fields.get("dispIncr(t->t+dt)")
       solution.addField("displacement", dimension)
+      if self.splitFields():
+        solution.addField("constraints", dimension)
       solution.setupFields()
       solution.newSection(solution.VERTICES_FIELD, dimension)
       solution.updateDof("displacement", solution.VERTICES_FIELD, dimension)
 
       solution.vectorFieldType(solution.VECTOR)
       solution.scale(lengthScale.value)
-      if self.splitFields():
-        for integrator in self.integrators:
-          integrator.splitField(solution)
-      for constraint in self.constraints:
-        constraint.setConstraintSizes(solution)
-      solution.allocate()
-      for constraint in self.constraints:
-        constraint.setConstraints(solution)
-      for integrator in self.integrators:
-        integrator.checkConstraints(solution)
     else:
       solution.addField("displacement", dimension)
+      if self.splitFields():
+        solution.addField("constraints", dimension)
       solution.addField("pressure", 1)
       solution.addField("temperature", 1)
       solution.setupFields()
@@ -545,13 +539,17 @@
       solution.updateDof("temperature",  solution.VERTICES_FIELD, 1)
       solution.vectorFieldType("displacement", solution.VECTOR)
       solution.scale("displacement", lengthScale.value)
-      for constraint in self.constraints:
-        constraint.setConstraintSizes(solution)
-      solution.allocate()
-      for constraint in self.constraints:
-        constraint.setConstraints(solution)
+
+    if self.splitFields():
       for integrator in self.integrators:
-        integrator.checkConstraints(solution)
+        integrator.splitField(solution)
+    for constraint in self.constraints:
+      constraint.setConstraintSizes(solution)
+    solution.allocate()
+    for constraint in self.constraints:
+      constraint.setConstraints(solution)
+    for integrator in self.integrators:
+      integrator.checkConstraints(solution)
 
     #memoryLogger.stagePop()
 



More information about the CIG-COMMITS mailing list