Skip to content

Variational smoother now uses libMesh solver and constraint system #4191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: devel
Choose a base branch
from

Conversation

pbehne
Copy link
Contributor

@pbehne pbehne commented Jun 12, 2025

Previously, the VariationalMeshSmoother set up and solved the
optimization problem using logic branches for each element type and a
separate solver than what libMesh provides.

This PR introduces two new objects to incorporate the variational
smoother's solve process into the rest of libMesh: the FEMSystem-derived
VariationalSmootherSystem and the Constraint-derived
VariationalSmootherConstraint.

The VariationalSmootherSystem computes the residual and analytic
Jacobian for the optimization solve. The analytic Jacobian was verified
to be correct when compared to finite difference estimations.

The VariationalSmootherConstraint currently constrains boundary nodes
and, if requested, subdomain boundary nodes to not move during the
smoothing process. Less strict sliding boundary node constraints will be
introduced in a future PR.

These changes allowed for a massive cleanup of the VariationalMeshSmootherClass.

Ref. #4082

roystgnr and others added 22 commits June 12, 2025 12:28
This fixes a hard-to-replicate PetscDiffSolver failure for me.
Previously, the VariationalMeshSmoother set up and solved the
optimization problem using logic branches for each element type and a
separate solver than what libMesh provides.

This commit introduces two new objects to incorporate the variational
smoother's solve process into the rest of libMesh: the FEMSystem-derived
VariationalSmootherSystem and the Constraint-derived
VariationalSmootherConstraint.

The VariationalSmootherSystem computes the residual and analytic
Jacobian for the optimization solve. The analytic Jacobian was verified
to be correct when compared to finite difference estimations.

The VariationalSmootherConstraint currently constrains boundary nodes
and, if requested, subdomain boundary nodes to not move during the
smoothing process. Less strict sliding boundary node constraints will be
introduced in a future PR.

Ref. libMesh#4082
Now that libMesh-base FEMSystem and Constraint objects are used for the smoother, all the old hardcoded smoother code is removed. In additional to general cleanup, support for adapt_data, area_of_interest, and more advanced metric types was removed. These features were untested and likely wouldn’t work. They can be re-introduced in future PRs. Ref libMesh#4082.
@roystgnr
Copy link
Member

Ooh - we never talked about the parallel case. That's going to be slightly harder to fix than bad whitespace or a shadowing error.

For now, what we want to do is copy the variational smoother solution vector (which is PARALLEL, with a GHOSTED current_local_solution copy) into a SERIAL vector before using the results from there. That's also the long-term solution for serial (including ReplicatedMesh) meshes, but at some point we might also want to write a code path that sets up the proper ghosting (algebraic ghosting will need to match geometric ghosting, even if the latter has been expanded) on distributed meshes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants