libMesh
variational_smoother_system.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 #ifndef LIBMESH_VARIATIONAL_SMOOTHER_SYSTEM_H
19 #define LIBMESH_VARIATIONAL_SMOOTHER_SYSTEM_H
20 
21 // libMesh includes
22 #include "libmesh/enum_fe_family.h"
23 #include "libmesh/fem_function_base.h"
24 #include "libmesh/fem_system.h"
25 #include "libmesh/libmesh_common.h"
26 
27 // C++ includes
28 #include <map>
29 #include <memory>
30 
31 namespace libMesh
32 {
33 
34 // FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
35 // but we must specify element residuals
37 {
47 public:
49  const std::string & name,
50  const unsigned int number)
51  : libMesh::FEMSystem(es, name, number),
52  _epsilon_squared(1e-10),
53  _ref_vol(1.),
54  _dilation_weight(0.5)
55  {}
56 
57  // Default destructor
58  ~VariationalSmootherSystem() override;
59 
63  virtual void assembly (bool get_residual,
64  bool get_jacobian,
65  bool apply_heterogeneous_constraints = false,
66  bool apply_no_constraints = false) override;
67 
69 
70 protected:
71 
72  // System initialization
73  virtual void init_data () override;
74 
75  // Context initialization
76  virtual void init_context (libMesh::DiffContext & context) override;
77 
78  // Element residual and jacobian calculations
79  // Time dependent parts
80  virtual bool element_time_derivative (bool request_jacobian,
81  libMesh::DiffContext & context) override;
82 
83  /* Computes the element reference volume used in the dilation metric
84  * The reference value is set to the averaged value of all elements' average |J|.
85  */
87 
90 
93 
96 };
97 
98 } // namespace libMesh
99 
100 #endif // LIBMESH_VARIATIONAL_SMOOTHER_SYSTEM_H
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used...
This is the EquationSystems class.
This class provides all data required for a physics package (e.g.
Definition: diff_context.h:55
virtual void assembly(bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) override
Assembly method to update the mesh based on the smoother solve.
The libMesh namespace provides an interface to certain functionality in the library.
This class provides a specific system class.
Definition: fem_system.h:53
Real _dilation_weight
The relative weight to give the dilation metric. The distortion metric is given weight 1 - _dilation_...
unsigned int number() const
Definition: system.h:2350
virtual bool element_time_derivative(bool request_jacobian, libMesh::DiffContext &context) override
Adds the time derivative contribution on elem to elem_residual.
Real _ref_vol
The reference volume for each element.
const Real _epsilon_squared
The small nonzero constant to prevent zero denominators (degenerate elements only) ...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
VariationalSmootherSystem(libMesh::EquationSystems &es, const std::string &name, const unsigned int number)
This is an FEMSystem to solve the optimization probelem posed by the VariationalMeshSmoother class...
virtual void init_context(libMesh::DiffContext &context) override
const std::string & name() const
Definition: system.h:2342