Open baagaard-usgs opened 10 months ago
It will not let me push to your branch. I am not sure what is wrong. Here is the diff that fixes it
141add-refine-tests *$:/PETSc3/cig/pylith-git$ git log -1 -p
commit 9da7a4f5e51dfefd3d8139f980d3ef55c91536e0 (HEAD -> add-refine-tests)
Author: Matthew G. Knepley <knepley@gmail.com>
Date: Sun Feb 4 11:19:41 2024 -0500
Refine: Must order cohesive supports after refinement
diff --git a/libsrc/pylith/topology/RefineUniform.cc b/libsrc/pylith/topology/RefineUniform.cc
index efd90cda9..be5e45059 100644
--- a/libsrc/pylith/topology/RefineUniform.cc
+++ b/libsrc/pylith/topology/RefineUniform.cc
@@ -79,6 +79,7 @@ pylith::topology::RefineUniform::refine(Mesh* const newMesh,
err = DMDestroy(&dmCur);PYLITH_CHECK_ERROR(err);
} // for
+ err = DMPlexReorderCohesiveSupports(dmNew);PYLITH_CHECK_ERROR(err);
newMesh->setDM(dmNew);
@@ -117,6 +118,7 @@ pylith::topology::RefineUniform::refine(Mesh* const newMesh,
topology::MeshOps::checkTopology(*newMesh);
// newMesh->view("REFINED_MESH", "::ascii_info_detail");
+ err = DMViewFromOptions(dmNew, NULL, "-pylith_ref_dm_view");PYLITH_CHECK_ERROR(err);
PYLITH_METHOD_END;
} // refine
This fix resolves the issue.
tests/fullscale/linearelasticity/faults-2d
MeshOps.cc
for computing the centroid of a celltests/mmstests/linearelasticity/faults-2d
Describe the bug
Refinement appears to be working for simulations without faults. However, the residual is wrong for refinement in simulations with a fault. The PyLith Jacobian looks correct but the finite-difference Jacobian does not; this is consistent with the residual being wrong. I don't see anything wrong in the topology or the labels. My wild guess is that we are taking the wrong path in the code when assembling the residual for a hybrid cell for the Lagrange multiplier field.
Update: Originally I thought the bug was only associated with meshes from Gmsh, but this does not appear to be the case as the same ASCII mesh also generates the error.
To Reproduce
PETSc branch:
knepley/pylith-4.0
PyLith fork:https://github.com/baagaard-usgs/pylith.git
PyLith branch:add-refine-tests
Diagram of mesh refinedmesh.pdf
PyLith Jacobian
Finite-difference Jacobian