[cig-commits] [commit] knepley/fix-fault-pc-multiple: Faults: Fix cusomt PC indexing - For multiple faults, cannot index into preconditioner matrix using section for just this fault. Must use section for all Lagrange dofs. (13161c0)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri Oct 24 09:10:58 PDT 2014
Repository : https://github.com/geodynamics/pylith
On branch : knepley/fix-fault-pc-multiple
Link : https://github.com/geodynamics/pylith/compare/0000000000000000000000000000000000000000...13161c0870cfee014e72cff400b61aec50f2f657
>---------------------------------------------------------------
commit 13161c0870cfee014e72cff400b61aec50f2f657
Author: Matthew G. Knepley <knepley at gmail.com>
Date: Fri Oct 24 11:11:14 2014 -0500
Faults: Fix cusomt PC indexing
- For multiple faults, cannot index into preconditioner matrix using section for just this fault. Must use section for all Lagrange dofs.
>---------------------------------------------------------------
13161c0870cfee014e72cff400b61aec50f2f657
libsrc/pylith/faults/FaultCohesiveLagrange.cc | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/libsrc/pylith/faults/FaultCohesiveLagrange.cc b/libsrc/pylith/faults/FaultCohesiveLagrange.cc
index 53575ee..b7c7c44 100644
--- a/libsrc/pylith/faults/FaultCohesiveLagrange.cc
+++ b/libsrc/pylith/faults/FaultCohesiveLagrange.cc
@@ -656,14 +656,14 @@ pylith::faults::FaultCohesiveLagrange::calcPreconditioner(PetscMat* const precon
topology::VecVisitorMesh areaVisitor(area);
const PetscScalar* areaArray = areaVisitor.localArray();
- topology::Field& dispRel = _fields->get("relative disp");
- PetscDM dispRelDM = dispRel.dmMesh();
- PetscSection dispRelGlobalSection = NULL;
- PetscErrorCode err = DMGetDefaultGlobalSection(dispRelDM, &dispRelGlobalSection);PYLITH_CHECK_ERROR(err);
+ PetscDM solnDM = fields->solution().dmMesh(), lagrangeDM = NULL;
+ PetscSection solnGlobalSection = NULL, lagrangeSection = NULL;
+ PetscInt lagrangeFields[1] = {1};
+ PetscErrorCode err;
- PetscDM solnDM = fields->solution().dmMesh();
- PetscSection solnGlobalSection = NULL;
err = DMGetDefaultGlobalSection(solnDM, &solnGlobalSection);PYLITH_CHECK_ERROR(err);
+ err = DMCreateSubDM(solnDM, 1, lagrangeFields, NULL, &lagrangeDM);PYLITH_CHECK_ERROR(err);
+ err = DMGetDefaultGlobalSection(lagrangeDM, &lagrangeSection);PYLITH_CHECK_ERROR(err);
_logger->eventEnd(setupEvent);
#if !defined(DETAILED_EVENT_LOGGING)
@@ -742,7 +742,7 @@ pylith::faults::FaultCohesiveLagrange::calcPreconditioner(PetscMat* const precon
// Set diagonal entries in preconditioned matrix.
PetscInt poff = 0;
- err = PetscSectionGetOffset(dispRelGlobalSection, v_fault, &poff);PYLITH_CHECK_ERROR(err);
+ err = PetscSectionGetOffset(lagrangeSection, e_lagrange, &poff);PYLITH_CHECK_ERROR(err);
for (int iDim=0; iDim < spaceDim; ++iDim) {
err = MatSetValue(*precondMatrix, poff+iDim, poff+iDim, precondVertexL[iDim], INSERT_VALUES);PYLITH_CHECK_ERROR(err);
@@ -763,6 +763,8 @@ pylith::faults::FaultCohesiveLagrange::calcPreconditioner(PetscMat* const precon
err = MatDestroy(&jacobianNP);PYLITH_CHECK_ERROR(err);
PetscLogFlops(numVertices*spaceDim*6);
+ err = DMDestroy(&lagrangeDM);PYLITH_CHECK_ERROR(err);
+
#if !defined(DETAILED_EVENT_LOGGING)
_logger->eventEnd(computeEvent);
#endif
More information about the CIG-COMMITS
mailing list