|
libMesh
|
This is an implementation of Larisa Branets' smoothing algorithms. More...
#include <mesh_smoother_vsmoother.h>
Public Member Functions | |
| VariationalMeshSmoother (UnstructuredMesh &mesh, Real dilation_weight=0.5, const bool preserve_subdomain_boundaries=true, const Real relative_residual_tolerance=TOLERANCE *TOLERANCE, const Real absolute_residual_tolerance=TOLERANCE *TOLERANCE, const unsigned int verbosity=0) | |
| Constructor. | |
| virtual | ~VariationalMeshSmoother ()=default |
| Destructor. | |
| virtual void | setup () |
| Setup method that creates equation systems, system, and constraints, to be called just prior to smoothing. | |
| virtual void | smooth () override |
| Redefinition of the smooth function from the base class. | |
| const MeshQualityInfo & | get_mesh_info () const |
| Getter for the _system's _mesh_info attribute. | |
| void | set_quadrature_type (QuadratureType qt) |
| Set the quadrature rule type used by the underlying VariationalSmootherSystem to integrate the distortion-dilation metric. | |
Protected Attributes | |
| UnstructuredMesh & | _mesh |
Private Member Functions | |
| VariationalSmootherSystem * | system () const |
| Getter for _system to protect against dangling pointers. | |
Private Attributes | |
| const unsigned int | _verbosity |
| verbosity setting | |
| const Real | _dilation_weight |
| Smoother control variables. | |
| const bool | _preserve_subdomain_boundaries |
| Whether subdomain boundaries are subject to change via smoothing. | |
| std::unique_ptr< DistributedMesh > | _mesh_copy |
| Mesh copy to avoid multiple EquationSystems. | |
| std::unique_ptr< EquationSystems > | _equation_systems |
| EquationsSystems object associated with the smoother. | |
| VariationalSmootherSystem * | _system |
| std::unique_ptr< VariationalSmootherConstraint > | _constraint |
| Constraints imposed on the smoothing process. | |
| bool | _setup_called |
| Attribute the keep track of whether the setup method has been called. | |
| Real | _relative_residual_tolerance |
| Solver relative residual tolerance. | |
| Real | _absolute_residual_tolerance |
| Solver absolute residual tolerance. | |
| QuadratureType | _quadrature_type = QGAUSS |
| Quadrature rule type used to integrate the distortion-dilation metric. | |
This is an implementation of Larisa Branets' smoothing algorithms.
The initial implementation was done by her, the adaptation to libmesh was completed by Derek Gaston. The code was heavily refactored into something more closely resembling C++ by John Peterson in 2014. The code eventually fell out of use and stopped functioning. Patrick Behne reimplemented the smoother in 2025.
Here are the relevant publications: 1) L. Branets, G. Carey, "Extension of a mesh quality metric for elements with a curved boundary edge or surface", Journal of Computing and Information Science in Engineering, vol. 5(4), pp.302-308, 2005.
2) L. Branets, G. Carey, "A local cell quality metric and variational grid smoothing algorithm", Engineering with Computers, vol. 21, pp.19-28, 2005.
3) L. Branets, "A variational grid optimization algorithm based on a local cell quality metric", Ph.D. thesis, The University of Texas at Austin, 2005.
Notes:
1) The smoother supports tangled meshes. However, not all untangling solves converge. In other words, we are able to untangle SOME tangled meshes, but not ANY tangled mesh.
Definition at line 75 of file mesh_smoother_vsmoother.h.
| libMesh::VariationalMeshSmoother::VariationalMeshSmoother | ( | UnstructuredMesh & | mesh, |
| Real | dilation_weight = 0.5, |
||
| const bool | preserve_subdomain_boundaries = true, |
||
| const Real | relative_residual_tolerance = TOLERANCE * TOLERANCE, |
||
| const Real | absolute_residual_tolerance = TOLERANCE * TOLERANCE, |
||
| const unsigned int | verbosity = 0 |
||
| ) |
Constructor.
| mesh | Mesh to smooth by minimizing the distortion-dilation metric. |
| dilation_wiehgt | Weight to give the dilation metric. The distortion metric is given 1 - dilation_weight. |
| preserve_subdomain_boundaries | Whether the smoother is to preserve or modify sobdomain boundaries. |
| relative_residual_tolerance | Solver setting for the relative residual tolerance. |
| absolute_residual_tolerance | Solver setting for the absolute residual tolerance. |
| verbosity | Smoother verbosity option specifying how much information is output. The verbosity levels and the corresponding information output are as follows: |
verbosity = 0 : No information
verbosity > 15: Prints:
The VariationalSmootherSystem and VariationalSmootherConstraint classes use the same verbosity value as this VariationalMeshSmoother class. For details on what those systems print, refer to the documentation for the _verbosity attribute in each class.
Definition at line 52 of file mesh_smoother_vsmoother.C.
|
virtualdefault |
Destructor.
| const MeshQualityInfo & libMesh::VariationalMeshSmoother::get_mesh_info | ( | ) | const |
Getter for the _system's _mesh_info attribute.
Definition at line 197 of file mesh_smoother_vsmoother.C.
References _setup_called, _system, and libMesh::VariationalSmootherSystem::get_mesh_info().
Referenced by MeshSmootherTest::testVariationalSmoother().
|
inline |
Set the quadrature rule type used by the underlying VariationalSmootherSystem to integrate the distortion-dilation metric.
The default (QGAUSS) samples the element interior only, which can miss degeneracies localized at element corners (e.g. an element collapsing toward one of its nodes). A vertex-sampling rule such as QTRAP, QSIMPSON, QNODAL, or QGAUSS_LOBATTO evaluates the metric at the element nodes so a folding corner is penalized (and flagged as tangled) as it should be. Must be called before smooth()/setup(). See VariationalSmootherSystem::set_quadrature_type() for details and caveats.
Definition at line 143 of file mesh_smoother_vsmoother.h.
References _quadrature_type.
Referenced by MeshSmootherTest::testVariationalQuadratureHourglass().
|
virtual |
Setup method that creates equation systems, system, and constraints, to be called just prior to smoothing.
Definition at line 64 of file mesh_smoother_vsmoother.C.
References _absolute_residual_tolerance, _constraint, _dilation_weight, _equation_systems, libMesh::MeshSmoother::_mesh, _mesh_copy, _preserve_subdomain_boundaries, _quadrature_type, _relative_residual_tolerance, _setup_called, _system, _verbosity, libMesh::System::attach_constraint_object(), libMesh::MeshBase::cache_elem_data(), libMesh::MeshBase::elem_dimensions(), libMesh::VariationalSmootherSystem::get_dilation_weight(), libMesh::MeshBase::Preparation::has_cached_elem_data, libMesh::MeshBase::preparation(), libMesh::DiffSolver::quiet, libMesh::VariationalSmootherSystem::set_quadrature_type(), libMesh::VariationalSmootherSystem::set_verbosity(), system(), libMesh::DifferentiableSystem::time_solver, and libMesh::DiffSolver::verbose.
Referenced by smooth(), and MeshSmootherTest::testVariationalSmoother().
|
overridevirtual |
Redefinition of the smooth function from the base class.
All this does is call the smooth function in this class which takes an int, using a default value of 1.
Implements libMesh::MeshSmoother.
Definition at line 159 of file mesh_smoother_vsmoother.C.
References _equation_systems, libMesh::MeshSmoother::_mesh, _mesh_copy, _setup_called, libMesh::ParallelObject::comm(), libMesh::make_range(), libMesh::MeshBase::node_ref(), setup(), libMesh::VariationalSmootherSystem::solve(), libMesh::Parallel::sync_dofobject_data_by_id(), and system().
Referenced by main(), MeshSmootherTest::testVariationalQuadratureHourglass(), MeshSmootherTest::testVariationalSmoother(), and MeshSmootherTest::testVariationalSmootherRegression().
|
inlineprivate |
Getter for _system to protect against dangling pointers.
Definition at line 189 of file mesh_smoother_vsmoother.h.
References _system, and libMesh::libmesh_assert().
|
private |
Solver absolute residual tolerance.
Definition at line 214 of file mesh_smoother_vsmoother.h.
Referenced by setup().
|
private |
Constraints imposed on the smoothing process.
Definition at line 199 of file mesh_smoother_vsmoother.h.
Referenced by setup().
|
private |
Smoother control variables.
Definition at line 155 of file mesh_smoother_vsmoother.h.
Referenced by setup().
|
private |
EquationsSystems object associated with the smoother.
Definition at line 175 of file mesh_smoother_vsmoother.h.
|
protectedinherited |
Definition at line 61 of file mesh_smoother.h.
Referenced by libMesh::LaplaceMeshSmoother::allgather_graph(), libMesh::LaplaceMeshSmoother::init(), setup(), libMesh::LaplaceMeshSmoother::smooth(), and smooth().
|
private |
Mesh copy to avoid multiple EquationSystems.
Definition at line 169 of file mesh_smoother_vsmoother.h.
|
private |
Whether subdomain boundaries are subject to change via smoothing.
Definition at line 160 of file mesh_smoother_vsmoother.h.
Referenced by setup().
|
private |
Quadrature rule type used to integrate the distortion-dilation metric.
Definition at line 220 of file mesh_smoother_vsmoother.h.
Referenced by set_quadrature_type(), and setup().
|
private |
Solver relative residual tolerance.
Definition at line 209 of file mesh_smoother_vsmoother.h.
Referenced by setup().
|
private |
Attribute the keep track of whether the setup method has been called.
Definition at line 204 of file mesh_smoother_vsmoother.h.
Referenced by get_mesh_info(), setup(), and smooth().
|
private |
Definition at line 184 of file mesh_smoother_vsmoother.h.
Referenced by get_mesh_info(), setup(), and system().
|
private |