libMesh
Functions | Variables
adaptivity_ex3.C File Reference

Go to the source code of this file.

Functions

void assemble_laplace (EquationSystems &es, const std::string &system_name)
 
Number exact_solution (const Point &p, const Parameters &, const std::string &, const std::string &)
 
Gradient exact_derivative (const Point &p, const Parameters &, const std::string &, const std::string &)
 
int main (int argc, char **argv)
 

Variables

unsigned int dim = 2
 
unsigned int n_vars = 1
 
bool singularity = true
 

Function Documentation

◆ assemble_laplace()

void assemble_laplace ( EquationSystems es,
const std::string &  system_name 
)

Definition at line 708 of file adaptivity_ex3.C.

References libMesh::SparseMatrix< T >::add_matrix(), libMesh::NumericVector< T >::add_vector(), libMesh::FEGenericBase< OutputType >::build(), libMesh::FEType::default_quadrature_rule(), libMesh::System::get_dof_map(), libMesh::EquationSystems::get_mesh(), libMesh::EquationSystems::get_system(), libMesh::ImplicitSystem::get_system_matrix(), libMesh::libmesh_ignore(), mesh, libMesh::MeshBase::mesh_dimension(), n_vars, libMesh::PerfLog::pop(), libMesh::Utility::pow(), libMesh::PerfLog::push(), libMesh::Real, libMesh::DenseSubVector< T >::reposition(), libMesh::DenseSubMatrix< T >::reposition(), libMesh::DenseVector< T >::resize(), libMesh::DenseMatrix< T >::resize(), libMesh::ExplicitSystem::rhs, and singularity.

Referenced by main().

710 {
711  // Ignore unused parameter warnings when !LIBMESH_ENABLE_AMR.
712  libmesh_ignore(es, system_name);
713 
714 #ifdef LIBMESH_ENABLE_AMR
715  // It is a good idea to make sure we are assembling
716  // the proper system.
717  libmesh_assert_equal_to (system_name, "Laplace");
718 
719  // Declare a performance log. Give it a descriptive
720  // string to identify what part of the code we are
721  // logging, since there may be many PerfLogs in an
722  // application.
723  PerfLog perf_log ("Matrix Assembly", false);
724 
725  // Get a constant reference to the mesh object.
726  const MeshBase & mesh = es.get_mesh();
727 
728  // The dimension that we are running
729  const unsigned int mesh_dim = mesh.mesh_dimension();
730 
731  // Get a reference to the LinearImplicitSystem we are solving
732  LinearImplicitSystem & system = es.get_system<LinearImplicitSystem>("Laplace");
733 
734  // A reference to the DofMap object for this system. The DofMap
735  // object handles the index translation from node and element numbers
736  // to degree of freedom numbers. We will talk more about the DofMap
737  // in future examples.
738  const DofMap & dof_map = system.get_dof_map();
739 
740  // Get a constant reference to the Finite Element type
741  // for the first (and only) variable type in the system.
742  FEType fe_type = dof_map.variable_type(0);
743 
744  // Build a Finite Element object of the specified type. Since the
745  // FEBase::build() member dynamically creates memory we will
746  // store the object as a std::unique_ptr<FEBase>. This can be thought
747  // of as a pointer that will clean up after itself.
748  std::unique_ptr<FEBase> fe (FEBase::build(mesh_dim, fe_type));
749  std::unique_ptr<FEBase> fe_face (FEBase::build(mesh_dim, fe_type));
750 
751  // Quadrature rules for numerical integration.
752  std::unique_ptr<QBase> qrule(fe_type.default_quadrature_rule(mesh_dim));
753  std::unique_ptr<QBase> qface(fe_type.default_quadrature_rule(mesh_dim-1));
754 
755  // Tell the finite element object to use our quadrature rule.
756  fe->attach_quadrature_rule (qrule.get());
757  fe_face->attach_quadrature_rule (qface.get());
758 
759  // Here we define some references to cell-specific data that
760  // will be used to assemble the linear system.
761  // We begin with the element Jacobian * quadrature weight at each
762  // integration point.
763  const std::vector<Real> & JxW = fe->get_JxW();
764 
765  // The physical XY locations of the quadrature points on the element.
766  // These might be useful for evaluating spatially varying material
767  // properties or forcing functions at the quadrature points.
768  const std::vector<Point> & q_point = fe->get_xyz();
769 
770  // The element shape functions evaluated at the quadrature points.
771  const std::vector<std::vector<Real>> & phi = fe->get_phi();
772 
773  // The element shape function gradients evaluated at the quadrature
774  // points.
775  const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
776 
777  // Define data structures to contain the element matrix
778  // and right-hand-side vector contribution. Following
779  // basic finite element terminology we will denote these
780  // "Ke" and "Fe". More detail is in example 3.
783 
784  // This vector will hold the degree of freedom indices for
785  // the element. These define where in the global system
786  // the element degrees of freedom get mapped.
787  std::vector<dof_id_type> dof_indices;
788 
789  // The global system matrix
790  SparseMatrix<Number> & matrix = system.get_system_matrix();
791 
792  // Now we will loop over all the elements in the mesh. We will
793  // compute the element matrix and right-hand-side contribution. See
794  // example 3 for a discussion of the element iterators. Here we use
795  // the const_active_local_elem_iterator to indicate we only want
796  // to loop over elements that are assigned to the local processor
797  // which are "active" in the sense of AMR. This allows each
798  // processor to compute its components of the global matrix for
799  // active elements while ignoring parent elements which have been
800  // refined.
801  for (const auto & elem : mesh.active_local_element_ptr_range())
802  {
803  // Start logging the shape function initialization.
804  // This is done through a simple function call with
805  // the name of the event to log.
806  perf_log.push("elem init");
807 
808  // Get the degree of freedom indices for the
809  // current element. These define where in the global
810  // matrix and right-hand-side this element will
811  // contribute to.
812  dof_map.dof_indices (elem, dof_indices);
813 
814  // Compute the element-specific data for the current
815  // element. This involves computing the location of the
816  // quadrature points (q_point) and the shape functions
817  // (phi, dphi) for the current element.
818  fe->reinit (elem);
819 
820  const unsigned int n_dofs =
821  cast_int<unsigned int>(dof_indices.size());
822 
823  // Zero the element matrix and right-hand side before
824  // summing them. We use the resize member here because
825  // the number of degrees of freedom might have changed from
826  // the last element. Note that this will be the case if the
827  // element type is different (i.e. the last element was a
828  // triangle, now we are on a quadrilateral).
829  Ke.resize (n_dofs, n_dofs);
830 
831  Fe.resize (n_dofs);
832 
833  // Stop logging the shape function initialization.
834  // If you forget to stop logging an event the PerfLog
835  // object will probably catch the error and abort.
836  perf_log.pop("elem init");
837 
838  // Now we will build the element matrix. This involves
839  // a quadruple loop to integrate the test functions (i) against
840  // the trial functions (j) for each variable (v) at each
841  // quadrature point (qp).
842  //
843  // Now start logging the element matrix computation
844  perf_log.push ("Ke");
845 
846  std::vector<dof_id_type> dof_indices_u;
847  dof_map.dof_indices (elem, dof_indices_u, 0);
848  const unsigned int n_u_dofs = dof_indices_u.size();
849  libmesh_assert_equal_to (n_u_dofs, phi.size());
850  libmesh_assert_equal_to (n_u_dofs, dphi.size());
851 
852  for (unsigned int v=0; v != n_vars; ++v)
853  {
854  DenseSubMatrix<Number> Kuu(Ke);
855  Kuu.reposition (v*n_u_dofs, v*n_u_dofs, n_u_dofs, n_u_dofs);
856 
857  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
858  for (unsigned int i=0; i != n_u_dofs; i++)
859  for (unsigned int j=0; j != n_u_dofs; j++)
860  Kuu(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);
861 
862  // We need a forcing function to make the 1D case interesting
863  if (mesh_dim == 1)
864  {
865  DenseSubVector<Number> Fu(Fe);
866  Fu.reposition (v*n_u_dofs, n_u_dofs);
867 
868  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
869  {
870  Real x = q_point[qp](0);
871  Real f = singularity ? sqrt(3.)/9.*pow(-x, -4./3.) :
872  cos(x);
873  for (unsigned int i=0; i != n_u_dofs; ++i)
874  Fu(i) += JxW[qp]*phi[i][qp]*f;
875  }
876  }
877  }
878 
879  // Stop logging the matrix computation
880  perf_log.pop ("Ke");
881 
882  // The element matrix and right-hand-side are now built
883  // for this element. Add them to the global matrix and
884  // right-hand-side vector. The SparseMatrix::add_matrix()
885  // and NumericVector::add_vector() members do this for us.
886  // Start logging the insertion of the local (element)
887  // matrix and vector into the global matrix and vector
888  LOG_SCOPE_WITH("matrix insertion", "", perf_log);
889 
890  // Use heterogenously here to handle Dirichlet as well as AMR
891  // constraints.
892  dof_map.heterogenously_constrain_element_matrix_and_vector(Ke, Fe, dof_indices);
893  matrix.add_matrix (Ke, dof_indices);
894  system.rhs->add_vector (Fe, dof_indices);
895  }
896 
897  // That's it. We don't need to do anything else to the
898  // PerfLog. When it goes out of scope (at this function return)
899  // it will print its log to the screen. Pretty easy, huh?
900 #endif // #ifdef LIBMESH_ENABLE_AMR
901 }
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition: fe_type.h:196
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:396
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i]...
MeshBase & mesh
NumericVector< Number > * rhs
The system matrix.
const T_sys & get_system(std::string_view name) const
bool singularity
This is the MeshBase class.
Definition: mesh_base.h:75
Defines a dense subvector for use in finite element computations.
The PerfLog class allows monitoring of specific events.
Definition: perf_log.h:145
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:179
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
Definition: fe_type.C:34
void libmesh_ignore(const Args &...)
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix.
T pow(const T &x)
Definition: utility.h:328
unsigned int n_vars
Defines a dense submatrix for use in Finite Element-type computations.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MeshBase & get_mesh() const
void resize(const unsigned int new_m, const unsigned int new_n)
Resizes the matrix to the specified size and calls zero().
Definition: dense_matrix.h:895
unsigned int mesh_dimension() const
Definition: mesh_base.C:372
const DofMap & get_dof_map() const
Definition: system.h:2374
const SparseMatrix< Number > & get_system_matrix() const

◆ exact_derivative()

Gradient exact_derivative ( const Point p,
const Parameters ,
const std::string &  ,
const std::string &   
)

Definition at line 642 of file adaptivity_ex3.C.

References dim, libMesh::pi, libMesh::Utility::pow(), libMesh::Real, and singularity.

Referenced by main().

646 {
647  // Gradient value to be returned.
648  Gradient gradu;
649 
650  // x and y coordinates in space
651  const Real x = p(0);
652  const Real y = dim > 1 ? p(1) : 0.;
653 
654  if (singularity)
655  {
656  // We can't compute the gradient at x=0, it is not defined.
657  libmesh_assert_not_equal_to (x, 0.);
658 
659  // For convenience...
660  const Real tt = 2./3.;
661  const Real ot = 1./3.;
662 
663  // The value of the radius, squared
664  const Real r2 = x*x + y*y;
665 
666  // The boundary value, given by the exact solution,
667  // u_exact = r^(2/3)*sin(2*theta/3).
668  Real theta = atan2(y, x);
669 
670  // Make sure 0 <= theta <= 2*pi
671  if (theta < 0)
672  theta += 2. * libMesh::pi;
673 
674  // du/dx
675  gradu(0) = tt*x*pow(r2,-tt)*sin(tt*theta) - pow(r2,ot)*cos(tt*theta)*tt/(1.+y*y/x/x)*y/x/x;
676 
677  // du/dy
678  if (dim > 1)
679  gradu(1) = tt*y*pow(r2,-tt)*sin(tt*theta) + pow(r2,ot)*cos(tt*theta)*tt/(1.+y*y/x/x)*1./x;
680 
681  if (dim > 2)
682  gradu(2) = 1.;
683  }
684  else
685  {
686  const Real z = (dim > 2) ? p(2) : 0;
687 
688  gradu(0) = -sin(x) * exp(y) * (1. - z);
689  if (dim > 1)
690  gradu(1) = cos(x) * exp(y) * (1. - z);
691  if (dim > 2)
692  gradu(2) = -cos(x) * exp(y);
693  }
694 
695  return gradu;
696 }
unsigned int dim
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
bool singularity
T pow(const T &x)
Definition: utility.h:328
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real pi
.
Definition: libmesh.h:299

◆ exact_solution()

Number exact_solution ( const Point p,
const Parameters ,
const std::string &  ,
const std::string &   
)

Definition at line 602 of file adaptivity_ex3.C.

References dim, libMesh::pi, libMesh::Utility::pow(), libMesh::Real, and singularity.

Referenced by main().

606 {
607  const Real x = p(0);
608  const Real y = (dim > 1) ? p(1) : 0.;
609 
610  if (singularity)
611  {
612  // The exact solution to the singular problem,
613  // u_exact = r^(2/3)*sin(2*theta/3).
614  Real theta = atan2(y, x);
615 
616  // Make sure 0 <= theta <= 2*pi
617  if (theta < 0)
618  theta += 2. * libMesh::pi;
619 
620  // Make the 3D solution similar
621  const Real z = (dim > 2) ? p(2) : 0;
622 
623  return pow(x*x + y*y, 1./3.)*sin(2./3.*theta) + z;
624  }
625  else
626  {
627  // The exact solution to a nonsingular problem,
628  // good for testing ideal convergence rates
629  const Real z = (dim > 2) ? p(2) : 0;
630 
631  return cos(x) * exp(y) * (1. - z);
632  }
633 }
unsigned int dim
bool singularity
T pow(const T &x)
Definition: utility.h:328
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real pi
.
Definition: libmesh.h:299

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 123 of file adaptivity_ex3.C.

References libMesh::DofMap::add_algebraic_ghosting_functor(), libMesh::DofMap::add_dirichlet_boundary(), libMesh::MeshRefinement::add_p_to_h_refinement(), libMesh::System::add_variable(), libMesh::MeshBase::all_complete_order(), libMesh::MeshBase::all_second_order(), libMesh::MeshTools::Modification::all_tri(), assemble_laplace(), libMesh::System::attach_assemble_function(), libMesh::ExactErrorEstimator::attach_exact_deriv(), libMesh::ExactSolution::attach_exact_deriv(), libMesh::ExactErrorEstimator::attach_exact_value(), libMesh::ExactSolution::attach_exact_value(), libMesh::MeshTools::Generation::build_extrusion(), libMesh::MeshTools::Generation::build_line(), libMesh::MeshBase::clear(), libMesh::MeshRefinement::coarsen_fraction(), libMesh::ExactSolution::compute_error(), libMesh::default_solver_package(), dim, libMesh::PatchRecoveryErrorEstimator::estimate_error(), libMesh::UniformRefinementEstimator::estimate_error(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::SmoothnessEstimator::estimate_smoothness(), exact_derivative(), exact_grad(), exact_solution(), libMesh::ExactSolution::extra_quadrature_order(), libMesh::LinearImplicitSystem::final_linear_residual(), libMesh::MeshRefinement::flag_elements_by_error_fraction(), libMesh::System::get_dof_map(), libMesh::ExactSolution::h1_error(), libMesh::TriangleWrapper::init(), libMesh::INVALID_SOLVER_PACKAGE, libMesh::ExactSolution::l2_error(), libMesh::libmesh_assert(), libMesh::libmesh_isnan(), libMesh::MeshRefinement::max_h_level(), libMesh::ErrorVector::mean(), mesh, libMesh::LinearImplicitSystem::n_linear_iterations(), n_vars, libMesh::out, libMesh::ErrorVector::plot_error(), libMesh::Utility::pow(), libMesh::MeshBase::read(), libMesh::Real, libMesh::MeshRefinement::refine_and_coarsen_elements(), libMesh::MeshRefinement::refine_fraction(), libMesh::HPSingularity::select_refinement(), libMesh::HPCoarsenTest::select_refinement(), libMesh::HPSingularity::singular_points, singularity, libMesh::LinearImplicitSystem::solve(), libMesh::MeshRefinement::switch_h_to_p_refinement(), libMesh::TOLERANCE, libMesh::MeshRefinement::uniformly_p_refine(), libMesh::MeshRefinement::uniformly_refine(), libMesh::JumpErrorEstimator::use_unweighted_quadrature_rules, and libMesh::ExodusII_IO::write_equation_systems().

124 {
125  // Initialize libMesh.
126  LibMeshInit init (argc, argv);
127 
128  // This example requires a linear solver package.
129  libmesh_example_requires(libMesh::default_solver_package() != INVALID_SOLVER_PACKAGE,
130  "--enable-petsc, --enable-trilinos, or --enable-eigen");
131 
132  // Single precision is inadequate for p refinement
133  libmesh_example_requires(sizeof(Real) > 4, "--disable-singleprecision");
134 
135  // Skip adaptive examples on a non-adaptive libMesh build
136 #ifndef LIBMESH_ENABLE_AMR
137  libmesh_example_requires(false, "--enable-amr");
138 #else
139 
140  // Parse the input file
141  GetPot input_file("adaptivity_ex3.in");
142 
143  // But allow the command line to override it.
144  input_file.parse_command_line(argc, argv);
145 
146  // Read in parameters from the input file
147  const unsigned int max_r_steps = input_file("max_r_steps", 3);
148  const unsigned int max_r_level = input_file("max_r_level", 3);
149  const Real refine_percentage = input_file("refine_percentage", 0.5);
150  const Real coarsen_percentage = input_file("coarsen_percentage", 0.5);
151  const unsigned int uniform_refine = input_file("uniform_refine",0);
152  const std::string refine_type = input_file("refinement_type", "h");
153  const std::string approx_type = input_file("approx_type", "LAGRANGE");
154  const unsigned int approx_order = input_file("approx_order", 1);
155  n_vars = input_file("n_vars", n_vars);
156  const std::string element_type = input_file("element_type", "tensor");
157  const int extra_error_quadrature = input_file("extra_error_quadrature", 0);
158  const int max_linear_iterations = input_file("max_linear_iterations", 5000);
159 
160 #ifdef LIBMESH_HAVE_EXODUS_API
161  const bool output_intermediate = input_file("output_intermediate", false);
162 #endif
163 
164  // If libmesh is configured without second derivative support, we
165  // can't run this example with Hermite elements and will therefore
166  // fail gracefully.
167 #if !defined(LIBMESH_ENABLE_SECOND_DERIVATIVES)
168  libmesh_example_requires(approx_type != "HERMITE", "--enable-second");
169 #endif
170 
171  dim = input_file("dimension", 2);
172  const std::string indicator_type = input_file("indicator_type", "kelly");
173  singularity = input_file("singularity", true);
174  const bool extrusion = input_file("extrusion",false);
175  const bool complete = input_file("complete",false);
176  libmesh_error_msg_if(extrusion && dim < 3, "Extrusion option is only for 3D meshes");
177 
178  // Skip higher-dimensional examples on a lower-dimensional libMesh build
179  libmesh_example_requires(dim <= LIBMESH_DIM, "2D/3D support");
180 
181  // Output file for plotting the error as a function of
182  // the number of degrees of freedom.
183  std::string approx_name = "";
184  if (element_type == "tensor")
185  approx_name += "bi";
186  if (approx_order == 1)
187  approx_name += "linear";
188  else if (approx_order == 2)
189  approx_name += "quadratic";
190  else if (approx_order == 3)
191  approx_name += "cubic";
192  else if (approx_order == 4)
193  approx_name += "quartic";
194 
195  std::string output_file = approx_name;
196  output_file += "_";
197  output_file += refine_type;
198  if (uniform_refine == 0)
199  output_file += "_adaptive.m";
200  else
201  output_file += "_uniform.m";
202 
203  std::ofstream out (output_file.c_str());
204  out << "% dofs L2-error H1-error" << std::endl;
205  out << "e = [" << std::endl;
206 
207  // Create a mesh, with dimension to be overridden later, on the
208  // default MPI communicator.
209  Mesh mesh(init.comm());
210 
211  // Create an equation systems object.
212  EquationSystems equation_systems (mesh);
213 
214  // Declare the system we will solve, named Laplace
215  LinearImplicitSystem & system =
216  equation_systems.add_system<LinearImplicitSystem> ("Laplace");
217 
218  // If we're doing HP refinement, then we'll need to be able to
219  // evaluate data on elements' siblings in HPCoarsenTest, which means
220  // we should instruct our system's DofMap to distribute that data.
221  // Create and add (and keep around! the DofMap will only be holding
222  // a pointer to it!) a SiblingCoupling functor to provide that
223  // instruction.
224  SiblingCoupling sibling_coupling;
225  if (refine_type == "hp")
226  system.get_dof_map().add_algebraic_ghosting_functor(sibling_coupling);
227 
228  // Read in the mesh
229  if (dim == 1)
231  else if (dim == 2 || extrusion == true)
232  mesh.read("lshaped.xda");
233  else
234  mesh.read("lshaped3D.xda");
235 
236  // Use triangles if the config file says so
237  if (element_type == "simplex")
239 
240  if (extrusion)
241  {
242  Mesh flat_mesh = mesh;
243  mesh.clear();
244  MeshTools::Generation::build_extrusion(mesh, flat_mesh, 1, {0,0,1});
245  }
246 
247  // Use highest-order elements if the config file says so.
248  if (complete)
250  // Otherwise, we used first order elements to describe the geometry,
251  // but we may need second order elements to hold the degrees
252  // of freedom
253  else if (approx_order > 1 || refine_type != "h")
255 
256  // Mesh Refinement object
257  MeshRefinement mesh_refinement(mesh);
258  mesh_refinement.refine_fraction() = refine_percentage;
259  mesh_refinement.coarsen_fraction() = coarsen_percentage;
260  mesh_refinement.max_h_level() = max_r_level;
261 
262  // Adds the variable "u" to "Laplace", using
263  // the finite element type and order specified
264  // in the config file
265  unsigned int u_var =
266  system.add_variable("u", static_cast<Order>(approx_order),
267  Utility::string_to_enum<FEFamily>(approx_type));
268 
269  std::vector<unsigned int> all_vars(1, u_var);
270 
271  // For benchmarking purposes, add more variables if requested.
272  for (unsigned int var_num=1; var_num < n_vars; ++var_num)
273  {
274  std::ostringstream var_name;
275  var_name << "u" << var_num;
276  unsigned int next_var =
277  system.add_variable(var_name.str(),
278  static_cast<Order>(approx_order),
279  Utility::string_to_enum<FEFamily>(approx_type));
280  all_vars.push_back(next_var);
281  }
282 
283  // Give the system a pointer to the matrix assembly
284  // function.
286 
287  // Add Dirichlet boundary conditions
288  WrappedFunction<Number> exact_val(system, exact_solution);
290  DirichletBoundary exact_bc({0} , all_vars, exact_val, exact_grad);
291  system.get_dof_map().add_dirichlet_boundary(exact_bc);
292 
293  // Initialize the data structures for the equation system.
294  equation_systems.init();
295 
296  // Set linear solver max iterations
297  equation_systems.parameters.set<unsigned int>("linear solver maximum iterations")
298  = max_linear_iterations;
299 
300  // Linear solver tolerance.
301  equation_systems.parameters.set<Real>("linear solver tolerance") =
302  std::pow(TOLERANCE, 2.5);
303 
304  // Prints information about the system to the screen.
305  equation_systems.print_info();
306 
307  // Construct ExactSolution object and attach solution functions
308  ExactSolution exact_sol(equation_systems);
309  exact_sol.attach_exact_value(exact_solution);
310  exact_sol.attach_exact_deriv(exact_derivative);
311 
312  // Use higher quadrature order for more accurate error results
313  exact_sol.extra_quadrature_order(extra_error_quadrature);
314 
315  // Compute the initial error
316  exact_sol.compute_error("Laplace", "u");
317 
318  // Print out the error values
319  libMesh::out << "Initial L2-Error is: "
320  << exact_sol.l2_error("Laplace", "u")
321  << std::endl;
322  libMesh::out << "Initial H1-Error is: "
323  << exact_sol.h1_error("Laplace", "u")
324  << std::endl;
325 
326  // A refinement loop.
327  for (unsigned int r_step=0; r_step<max_r_steps; r_step++)
328  {
329  libMesh::out << "Beginning Solve " << r_step << std::endl;
330 
331  // Solve the system "Laplace", just like example 2.
332  system.solve();
333 
334  libMesh::out << "System has: "
335  << equation_systems.n_active_dofs()
336  << " degrees of freedom."
337  << std::endl;
338 
339  libMesh::out << "Linear solver converged at step: "
340  << system.n_linear_iterations()
341  << ", final residual: "
342  << system.final_linear_residual()
343  << std::endl;
344 
345 #ifdef LIBMESH_HAVE_EXODUS_API
346  // After solving the system write the solution
347  // to a ExodusII-formatted plot file.
348  if (output_intermediate)
349  {
350  std::ostringstream outfile;
351  outfile << "lshaped_" << r_step << ".e";
352  ExodusII_IO (mesh).write_equation_systems (outfile.str(),
353  equation_systems);
354  }
355 #endif // #ifdef LIBMESH_HAVE_EXODUS_API
356 
357  // Compute the error.
358  exact_sol.compute_error("Laplace", "u");
359 
360  // The error should at least be sane, but it isn't if the solver
361  // failed badly enough
362  if (libmesh_isnan(exact_sol.l2_error("Laplace", "u")))
363  libmesh_error_msg("NaN solve result");
364 
365  // Print out the error values
366  libMesh::out << "L2-Error is: "
367  << exact_sol.l2_error("Laplace", "u")
368  << std::endl;
369  libMesh::out << "H1-Error is: "
370  << exact_sol.h1_error("Laplace", "u")
371  << std::endl;
372 
373  // Compute any discontinuity. There should be none.
374  {
376 
377  // This is a subclass of JumpErrorEstimator, based on
378  // measuring discontinuities across sides between
379  // elements, and we can tell it to use a cheaper
380  // "unweighted" quadrature rule when numerically
381  // integrating those discontinuities.
383 
384  ErrorVector disc_error;
385  disc.estimate_error(system, disc_error);
386 
387  Real mean_disc_error = disc_error.mean();
388 
389  libMesh::out << "Mean discontinuity error = " << mean_disc_error << std::endl;
390 
391  // FIXME - this test fails when solving with Eigen?
392 #ifdef LIBMESH_ENABLE_PETSC
393  libmesh_assert_less (mean_disc_error, 1e-14);
394 #endif
395  }
396 
397  // Print to output file
398  out << equation_systems.n_active_dofs() << " "
399  << exact_sol.l2_error("Laplace", "u") << " "
400  << exact_sol.h1_error("Laplace", "u") << std::endl;
401 
402  // Possibly refine the mesh
403  if (r_step+1 != max_r_steps)
404  {
405  libMesh::out << " Refining the mesh..." << std::endl;
406 
407  if (uniform_refine == 0)
408  {
409 
410  // The ErrorVector is a particular StatisticsVector
411  // for computing error information on a finite element mesh.
412  ErrorVector error;
413 
414  if (indicator_type == "exact")
415  {
416  // The ErrorEstimator class interrogates a
417  // finite element solution and assigns to each
418  // element a positive error value.
419  // This value is used for deciding which elements to
420  // refine and which to coarsen.
421  // For these simple test problems, we can use
422  // numerical quadrature of the exact error between
423  // the approximate and analytic solutions.
424  // However, for real problems, we would need an error
425  // indicator which only relies on the approximate
426  // solution.
427  ExactErrorEstimator error_estimator;
428 
429  error_estimator.attach_exact_value(exact_solution);
430  error_estimator.attach_exact_deriv(exact_derivative);
431 
432  // We optimize in H1 norm, the default
433  // error_estimator.error_norm = H1;
434 
435  // Compute the error for each active element using
436  // the provided indicator. Note in general you
437  // will need to provide an error estimator
438  // specifically designed for your application.
439  error_estimator.estimate_error (system, error);
440  }
441  else if (indicator_type == "patch")
442  {
443  // The patch recovery estimator should give a
444  // good estimate of the solution interpolation
445  // error.
446  PatchRecoveryErrorEstimator error_estimator;
447 
448  error_estimator.estimate_error (system, error);
449  }
450  else if (indicator_type == "uniform")
451  {
452  // Error indication based on uniform refinement
453  // is reliable, but very expensive.
454  UniformRefinementEstimator error_estimator;
455 
456  error_estimator.estimate_error (system, error);
457  }
458  else
459  {
460  libmesh_assert_equal_to (indicator_type, "kelly");
461 
462  // The Kelly error estimator is based on
463  // an error bound for the Poisson problem
464  // on linear elements, but is useful for
465  // driving adaptive refinement in many problems
466  KellyErrorEstimator error_estimator;
467 
468  // This is a subclass of JumpErrorEstimator, based on
469  // measuring gradient discontinuities across sides
470  // between elements, and we can tell it to use a
471  // cheaper "unweighted" quadrature rule when
472  // numerically integrating those discontinuities.
473  error_estimator.use_unweighted_quadrature_rules = true;
474 
475  error_estimator.estimate_error (system, error);
476  }
477 
478  // Write out the error distribution
479  std::ostringstream ss;
480  ss << r_step;
481 #ifdef LIBMESH_HAVE_EXODUS_API
482 # ifdef LIBMESH_HAVE_NEMESIS_API
483  std::string error_output = "error_" + ss.str() + ".n";
484  std::string smoothness_output = "smoothness_" + ss.str() + ".n";
485 # else
486  std::string error_output = "error_" + ss.str() + ".e";
487  std::string smoothness_output = "smoothness_" + ss.str() + ".e";
488 # endif
489 #else
490  std::string error_output = "error_" + ss.str() + ".gmv";
491  std::string smoothness_output = "smoothness_" + ss.str() + ".gmv";
492 #endif
493  error.plot_error(error_output, mesh);
494 
495  if (refine_type == "hp")
496  {
497  ErrorVector smoothness;
498  SmoothnessEstimator estimate_smoothness;
499  estimate_smoothness.estimate_smoothness(system, smoothness);
500  std::string data_type = "smoothness";
501  smoothness.plot_error(smoothness_output, mesh, data_type);
502  }
503 
504  // This takes the error in error and decides which elements
505  // will be coarsened or refined. Any element within 20% of the
506  // maximum error on any element will be refined, and any
507  // element within 10% of the minimum error on any element might
508  // be coarsened. Note that the elements flagged for refinement
509  // will be refined, but those flagged for coarsening _might_ be
510  // coarsened.
511  mesh_refinement.flag_elements_by_error_fraction (error);
512 
513  // If we are doing adaptive p refinement, we want
514  // elements flagged for that instead.
515  if (refine_type == "p")
516  mesh_refinement.switch_h_to_p_refinement();
517  // If we are doing "matched hp" refinement, we
518  // flag elements for both h and p
519  else if (refine_type == "matchedhp")
520  mesh_refinement.add_p_to_h_refinement();
521  // If we are doing hp refinement, we
522  // try switching some elements from h to p
523  else if (refine_type == "hp")
524  {
525  HPCoarsenTest hpselector;
526  hpselector.select_refinement(system);
527  }
528  // If we are doing "singular hp" refinement, we
529  // try switching most elements from h to p
530  else if (refine_type == "singularhp")
531  {
532  // This only differs from p refinement for
533  // the singular problem
535  HPSingularity hpselector;
536  // Our only singular point is at the origin
537  hpselector.singular_points.push_back(Point());
538  hpselector.select_refinement(system);
539  }
540  else
541  libmesh_error_msg_if(refine_type != "h",
542  "Unknown refinement_type = " << refine_type);
543 
544  // This call actually refines and coarsens the flagged
545  // elements.
546  mesh_refinement.refine_and_coarsen_elements();
547  }
548 
549  else if (uniform_refine == 1)
550  {
551  if (refine_type == "h" || refine_type == "hp" ||
552  refine_type == "matchedhp")
553  mesh_refinement.uniformly_refine(1);
554  if (refine_type == "p" || refine_type == "hp" ||
555  refine_type == "matchedhp")
556  mesh_refinement.uniformly_p_refine(1);
557  }
558 
559  // This call reinitializes the EquationSystems object for
560  // the newly refined mesh. One of the steps in the
561  // reinitialization is projecting the solution,
562  // old_solution, etc... vectors from the old mesh to
563  // the current one.
564  equation_systems.reinit ();
565  }
566  }
567 
568 #ifdef LIBMESH_HAVE_EXODUS_API
569  // Write out the solution
570  // After solving the system write the solution
571  // to a ExodusII-formatted plot file.
572  ExodusII_IO (mesh).write_equation_systems ("lshaped.e",
573  equation_systems);
574 #endif // #ifdef LIBMESH_HAVE_EXODUS_API
575 
576  // Close up the output file.
577  out << "];" << std::endl;
578  out << "hold on" << std::endl;
579  out << "plot(e(:,1), e(:,2), 'bo-');" << std::endl;
580  out << "plot(e(:,1), e(:,3), 'ro-');" << std::endl;
581  // out << "set(gca,'XScale', 'Log');" << std::endl;
582  // out << "set(gca,'YScale', 'Log');" << std::endl;
583  out << "xlabel('dofs');" << std::endl;
584  out << "title('" << approx_name << " elements');" << std::endl;
585  out << "legend('L2-error', 'H1-error');" << std::endl;
586  // out << "disp('L2-error linear fit');" << std::endl;
587  // out << "polyfit(log10(e(:,1)), log10(e(:,2)), 1)" << std::endl;
588  // out << "disp('H1-error linear fit');" << std::endl;
589  // out << "polyfit(log10(e(:,1)), log10(e(:,3)), 1)" << std::endl;
590 #endif // #ifndef LIBMESH_ENABLE_AMR
591 
592  // All done.
593  return 0;
594 }
This class handles the computation of the L2 and/or H1 error for the Systems in the EquationSystems o...
Wrap a libMesh-style function pointer into a FunctionBase object.
void build_extrusion(UnstructuredMesh &mesh, const MeshBase &cross_section, const unsigned int nz, RealVectorValue extrusion_vector, QueryElemSubdomainIDBase *elem_subdomain=nullptr)
Meshes the tensor product of a 1D and a 1D-or-2D domain.
This is the EquationSystems class.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
void assemble_laplace(EquationSystems &es, const std::string &system_name)
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
MPI_Datatype data_type
virtual void select_refinement(System &system) override
This pure virtual function must be redefined in derived classes to take a mesh flagged for h refineme...
static constexpr Real TOLERANCE
unsigned int dim
The ErrorVector is a specialization of the StatisticsVector for error data computed on a finite eleme...
Definition: error_vector.h:50
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:52
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
MeshBase & mesh
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:90
virtual void solve() override
Assembles & solves the linear system A*x=b.
void attach_exact_value(unsigned int sys_num, FunctionBase< Number > *f)
Clone and attach an arbitrary functor which computes the exact value of the system sys_num solution a...
bool libmesh_isnan(T x)
bool singularity
This class measures discontinuities between elements for debugging purposes.
Gradient exact_grad(const Point &, const Parameters &, const std::string &, const std::string &)
Definition: mysystems.h:25
std::list< Point > singular_points
This list, to be filled by the user, should include all singular points in the solution.
Definition: hp_singular.h:83
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override
This function uses the exact solution function to estimate the error on each cell.
SolverPackage default_solver_package()
Definition: libmesh.C:1117
void all_tri(MeshBase &mesh)
Subdivides any non-simplex elements in a Mesh to produce simplex (triangular in 2D, tetrahedral in 3D) elements.
void plot_error(const std::string &filename, const MeshBase &mesh, const std::string &data_type="error") const
Plots a data file, of a type determined by looking at the file extension in filename, of the error values on the active elements of mesh.
Definition: error_vector.C:210
T pow(const T &x)
Definition: utility.h:328
Implements (adaptive) mesh refinement algorithms for a MeshBase.
unsigned int n_vars
unsigned int n_linear_iterations() const
This class implements the Smoothness estimate.
virtual void write_equation_systems(const std::string &fname, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Writes out the solution for no specific time or timestep.
Definition: exodusII_io.C:2033
This class implements a `‘brute force’&#39; error estimator which integrates differences between the cu...
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override
This function uses the Patch Recovery error estimate to estimate the error on each cell...
libmesh_assert(ctx)
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1357
Number exact_solution(const Point &p, const Parameters &, const std::string &, const std::string &)
void attach_assemble_function(void fptr(EquationSystems &es, const std::string &name))
Register a user function to use in assembling the system matrix and RHS.
Definition: system.C:2161
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override
This function does uniform refinements and a solve to get an improved solution on each cell...
virtual void estimate_smoothness(const System &system, ErrorVector &smoothness_per_cell, const NumericVector< Number > *solution_vector=nullptr)
This function uses the Legendre expansion of solution to estimate coefficient decay to quantify the s...
virtual void clear()
Deletes all the element and node data that is currently stored.
Definition: mesh_base.C:920
virtual void select_refinement(System &system)
This pure virtual function must be redefined in derived classes to take a mesh flagged for h refineme...
Definition: hp_singular.C:36
Gradient exact_derivative(const Point &p, const Parameters &, const std::string &, const std::string &)
This class implements the Kelly error indicator which is based on the flux jumps between elements...
This class uses the error estimate given by different types of derefinement (h coarsening or p reduct...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This class adds coupling (for use in send_list construction) between active elements and all descenda...
This class implements an "error estimator" based on the difference between the approximate and exact ...
virtual void all_complete_order()
Calls the range-based version of this function with a range consisting of all elements in the mesh...
Definition: mesh_base.C:1650
This class implements the Patch Recovery error indicator.
OStreamProxy out
bool use_unweighted_quadrature_rules
This boolean flag allows you to use "unweighted" quadrature rules (sized to exactly integrate unweigh...
void all_second_order(const bool full_ordered=true)
Calls the range-based version of this function with a range consisting of all elements in the mesh...
Definition: mesh_base.C:1645
void build_line(UnstructuredMesh &mesh, const unsigned int nx, const Real xmin=0., const Real xmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
A specialized build_cube() for 1D meshes.
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
virtual void estimate_error(const System &system, ErrorVector &error_per_cell, const NumericVector< Number > *solution_vector=nullptr, bool estimate_parent_error=false) override
This function uses the derived class&#39;s jump error estimate formula to estimate the error on each cell...
This class uses a user-provided list of singularity locations to choose between h refining and p elev...
Definition: hp_singular.h:49
void attach_exact_deriv(unsigned int sys_num, FunctionBase< Gradient > *g)
Clone and attach an arbitrary functor which computes the exact gradient of the system sys_num solutio...
void add_algebraic_ghosting_functor(GhostingFunctor &evaluable_functor, bool to_mesh=true)
Adds a functor which can specify algebraic ghosting requirements for use with distributed vectors...
Definition: dof_map.C:2090
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
const DofMap & get_dof_map() const
Definition: system.h:2374
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:39
virtual Real mean() const override
Definition: error_vector.C:69

Variable Documentation

◆ dim

unsigned int dim = 2

Definition at line 114 of file adaptivity_ex3.C.

Referenced by libMesh::ExactSolution::_compute_error(), libMesh::FEMContext::_do_elem_position_set(), libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::MeshFunction::_gradient_on_elem(), libMesh::FEInterface::all_shape_derivs(), libMesh::FEInterface::all_shapes(), alternative_fe_assembly(), assemble(), LinearElasticity::assemble(), assemble_1D(), AssembleOptimization::assemble_A_and_F(), libMesh::ClawSystem::assemble_advection_matrices(), libMesh::ClawSystem::assemble_avg_coupling_matrices(), assemble_biharmonic(), libMesh::ClawSystem::assemble_boundary_condition_matrices(), assemble_cd(), assemble_divgrad(), assemble_elasticity(), assemble_ellipticdg(), assemble_func(), assemble_graddiv(), assemble_helmholtz(), assemble_mass(), assemble_matrices(), assemble_poisson(), assemble_SchroedingerEquation(), assemble_shell(), assemble_stokes(), assemble_wave(), libMesh::FEMContext::attach_quadrature_rules(), libMesh::FEGenericBase< FEOutputType< T >::type >::build(), libMesh::FEGenericBase< FEOutputType< T >::type >::build_InfFE(), libMesh::EquationSystems::build_parallel_solution_vector(), libMesh::EquationSystems::build_variable_names(), libMesh::System::calculate_norm(), libMesh::JumpErrorEstimator::coarse_n_flux_faces_increment(), libMesh::FEGenericBase< FEOutputType< T >::type >::coarsened_dof_values(), SolutionFunction< dim >::component(), SolutionGradient< dim >::component(), libMesh::FEMap::compute_affine_map(), libMesh::FEInterface::compute_data(), libMesh::FEMap::compute_edge_map(), compute_enriched_soln(), libMesh::InfFE< Dim, T_radial, T_map >::compute_face_functions(), libMesh::FEXYZMap::compute_face_map(), libMesh::FEMap::compute_face_map(), libMesh::FEXYZ< Dim >::compute_face_values(), compute_jacobian(), libMesh::FEMap::compute_map(), libMesh::FEMap::compute_null_map(), compute_residual(), libMesh::FEGenericBase< FEOutputType< T >::type >::compute_shape_functions(), libMesh::InfFE< Dim, T_radial, T_map >::compute_shape_functions(), libMesh::FEXYZ< Dim >::compute_shape_functions(), libMesh::FEMap::compute_single_point_map(), compute_stresses(), LinearElasticityWithContact::compute_stresses(), LinearElasticity::compute_stresses(), LargeDeformationElasticity::compute_stresses(), libMesh::VariationalSmootherConstraint::constrain(), libMesh::VariationalSmootherConstraint::constrain_node_to_line(), libMesh::VariationalSmootherConstraint::constrain_node_to_plane(), libMesh::InfFERadial::decay(), libMesh::InfFERadial::decay_deriv(), libMesh::FEType::default_quadrature_rule(), libMesh::MeshBase::detect_interior_parents(), libMesh::VariationalSmootherConstraint::determine_constraint(), libMesh::MeshFunction::discontinuous_value(), libMesh::FEMContext::elem_fe_reinit(), libMesh::FEMContext::elem_position_get(), NavierSystem::element_constraint(), NavierSystem::element_time_derivative(), SolidSystem::element_time_derivative(), libMesh::VariationalSmootherSystem::element_time_derivative(), HeatSystem::element_time_derivative(), libMesh::RBEIMConstruction::enrich_eim_approximation_on_interiors(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::OldSolutionValue< Output, point_output >::eval_at_node(), libMesh::OldSolutionCoefs< Output, point_output >::eval_mixed_derivatives(), libMesh::OldSolutionValue< Output, point_output >::eval_mixed_derivatives(), exact_derivative(), exact_solution(), fe_assembly(), libMesh::DynaIO::find_elem_definition(), libMesh::ElemInternal::find_interior_neighbors(), libMesh::EquationSystems::find_variable_numbers(), libMesh::MeshRefinement::flag_elements_by_elem_fraction(), libMesh::MeshRefinement::flag_elements_by_nelem_target(), NavierSystem::forcing(), form_functionA(), form_functionB(), form_matrixA(), libMesh::ClawSystem::get_advection_matrix(), libMesh::ClawSystem::get_avg_matrix(), libMesh::ClawSystem::get_boundary_condition_matrix(), libMesh::FEMContext::get_element_fe(), libMesh::FEMContext::get_element_qrule(), libMesh::FEMContext::get_side_fe(), libMesh::FEMContext::get_side_qrule(), libMesh::QGrundmann_Moller::gm_rule(), libMesh::MeshFunction::hessian(), libMesh::FEInterface::ifem_compute_data(), libMesh::FEInterface::ifem_inverse_map(), libMesh::FEInterface::ifem_map(), libMesh::FEInterface::ifem_n_dofs(), libMesh::FEInterface::ifem_n_dofs_at_node(), libMesh::FEInterface::ifem_n_dofs_per_elem(), libMesh::FEInterface::ifem_n_shape_functions(), libMesh::FEInterface::ifem_nodal_soln(), libMesh::FEInterface::ifem_shape(), libMesh::FEInterface::ifem_shape_deriv(), libMesh::LaplacianErrorEstimator::init_context(), libMesh::VariationalSmootherSystem::init_context(), HilbertSystem::init_context(), libMesh::DiscontinuityMeasure::init_context(), libMesh::WrappedFunctor< Output >::init_context(), HeatSystem::init_context(), libMesh::KellyErrorEstimator::init_context(), libMesh::FEMSystem::init_context(), libMesh::RBEIMConstruction::init_context(), libMesh::OldSolutionBase< Output, point_output >::init_context(), NavierSystem::init_data(), SolidSystem::init_data(), libMesh::FEMContext::init_internal_data(), libMesh::FEMap::init_reference_to_physical_map(), libMesh::LaplacianErrorEstimator::internal_side_integration(), libMesh::InfFEMap::inverse_map(), libMesh::FEMap::inverse_map(), libMesh::FEInterface::inverse_map(), LaplaceYoung::jacobian(), LargeDeformationElasticity::jacobian(), libMesh::PointLocatorNanoflann::kdtree_get_pt(), libMesh::InverseDistanceInterpolation< KDDim >::PointListAdaptor< KDDim >::kdtree_get_pt(), libMesh::VectorOfNodesAdaptor::kdtree_get_pt(), libMesh::SmoothnessEstimator::legepoly(), libMesh::LIBMESH_DEFAULT_VECTORIZED_FE(), main(), libMesh::InfFEMap::map(), libMesh::FEMap::map(), libMesh::FEInterface::map(), libMesh::HCurlFETransformation< OutputShape >::map_curl(), libMesh::H1FETransformation< OutputShape >::map_curl(), libMesh::H1FETransformation< OutputShape >::map_d2phi(), libMesh::FEMap::map_deriv(), libMesh::HDivFETransformation< OutputShape >::map_div(), libMesh::H1FETransformation< OutputShape >::map_div(), libMesh::H1FETransformation< OutputShape >::map_dphi(), libMesh::H1FETransformation< OutputShape >::map_phi(), libMesh::HDivFETransformation< OutputShape >::map_phi(), libMesh::HCurlFETransformation< OutputShape >::map_phi(), NavierSystem::mass_residual(), libMesh::FEInterface::n_dofs(), libMesh::FEInterface::n_dofs_at_node(), libMesh::FEInterface::n_dofs_at_node_function(), libMesh::FEInterface::n_dofs_per_elem(), libMesh::FEInterface::n_shape_functions(), libMesh::FEInterface::nodal_soln(), OverlappingCouplingFunctor::operator()(), libMesh::OverlapCoupling::operator()(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::MeshFunction::operator()(), libMesh::BoundaryProjectSolution::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SortAndCopy::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectVertices::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectEdges::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectSides::operator()(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::ProjectInteriors::operator()(), libMesh::System::point_gradient(), NavierSystem::postprocess(), libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh(), libMesh::RBParametrizedFunction::preevaluate_parametrized_function_on_mesh_sides(), libMesh::VariationalSmootherSystem::prepare_for_smoothing(), process_cmd_line(), libMesh::QClough::QClough(), libMesh::QGauss::QGauss(), libMesh::QGrid::QGrid(), libMesh::QGrundmann_Moller::QGrundmann_Moller(), libMesh::QMonomial::QMonomial(), libMesh::QNodal::QNodal(), libMesh::QSimpson::QSimpson(), libMesh::QTrap::QTrap(), libMesh::rational_fe_weighted_shapes(), libMesh::rational_fe_weighted_shapes_derivs(), libMesh::FE< Dim, LAGRANGE_VEC >::reinit(), libMesh::JumpErrorEstimator::reinit_sides(), LaplaceYoung::residual(), LargeDeformationElasticity::residual(), LinearElasticityWithContact::residual_and_jacobian(), libMesh::FEMap::resize_quadrature_map_vectors(), SolidSystem::save_initial_mesh(), libMesh::BoundingBox::scale(), libMesh::HPCoarsenTest::select_refinement(), ElasticitySystem::set_dim(), libMesh::OverlapCoupling::set_quadrature_rule(), PerElemTest< elem_type >::setUp(), setup(), libMesh::FEInterface::shape(), libMesh::FEInterface::shape_deriv(), libMesh::FEInterface::shape_deriv_function(), libMesh::FEInterface::shape_function(), libMesh::FEInterface::shape_second_deriv(), libMesh::FEInterface::shape_second_deriv_function(), libMesh::FEInterface::shapes(), NavierSystem::side_constraint(), libMesh::FEMContext::side_fe_reinit(), libMesh::FEInterface::side_nodal_soln(), libMesh::PatchRecoveryErrorEstimator::specpoly(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::SubFunctor::SubFunctor(), InfFERadialTest::testInfQuants(), InfFERadialTest::testInfQuants_numericDeriv(), PointLocatorTest::testLocator(), QuadratureTest::testPolynomials(), SlitMeshRefinedSystemTest::testRestart(), InfFERadialTest::testSides(), InfFERadialTest::testSingleOrder(), SlitMeshRefinedSystemTest::testSystem(), MeshSmootherTest::testVariationalSmoother(), libMesh::FEType::unweighted_quadrature_rule(), libMesh::FEMContext::use_default_quadrature_rules(), libMesh::FEMContext::use_unweighted_quadrature_rules(), libMesh::MeshTools::volume(), libMesh::ExodusII_IO::write_as_dimension(), libMesh::ExodusII_IO_Helper::write_as_dimension(), libMesh::EnsightIO::write_scalar_ascii(), and libMesh::EnsightIO::write_vector_ascii().

◆ n_vars

unsigned int n_vars = 1

Definition at line 117 of file adaptivity_ex3.C.

Referenced by libMesh::UniformRefinementEstimator::_estimate_error(), libMesh::DofMap::allgather_recursive_constraints(), assemble_laplace(), libMesh::WrappedFunction< Output >::component(), libMesh::DofMap::create_dof_constraints(), libMesh::RBEIMEvaluation::distribute_bfs(), libMesh::JumpErrorEstimator::estimate_error(), libMesh::AdjointResidualErrorEstimator::estimate_error(), libMesh::ExactErrorEstimator::estimate_error(), libMesh::ErrorEstimator::estimate_errors(), libMesh::RBEIMEvaluation::gather_bfs(), libMesh::RBEIMEvaluation::get_interior_basis_function_as_vec_helper(), libMesh::RBEIMEvaluation::get_interior_basis_function_sizes(), libMesh::LaplacianErrorEstimator::init_context(), libMesh::DiscontinuityMeasure::init_context(), libMesh::KellyErrorEstimator::init_context(), libMesh::PetscDMWrapper::init_petscdm(), libMesh::RadialBasisInterpolation< KDDim, RBF >::interpolate_field_data(), main(), libMesh::RBEIMEvaluation::node_distribute_bfs(), libMesh::RBEIMEvaluation::node_gather_bfs(), libMesh::WrappedFunction< Output >::operator()(), libMesh::WeightedPatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::SmoothnessEstimator::EstimateSmoothness::operator()(), libMesh::PatchRecoveryErrorEstimator::EstimateError::operator()(), libMesh::RadialBasisInterpolation< KDDim, RBF >::prepare_for_use(), libMesh::InterMeshProjection::project_system_vectors(), libMesh::System::project_vector(), libMesh::System::projection_matrix(), libMesh::RBEIMEvaluation::read_in_interior_basis_functions(), libMesh::RBEIMEvaluation::read_in_node_basis_functions(), libMesh::RBEIMEvaluation::read_in_side_basis_functions(), libMesh::JumpErrorEstimator::reinit_sides(), libMesh::HPCoarsenTest::select_refinement(), libMesh::RBEIMEvaluation::side_distribute_bfs(), libMesh::RBEIMEvaluation::side_gather_bfs(), libMesh::MEDITIO::write_ascii(), libMesh::GMVIO::write_ascii_new_impl(), libMesh::GMVIO::write_ascii_old_impl(), libMesh::GMVIO::write_binary(), libMesh::GMVIO::write_discontinuous_gmv(), libMesh::UCDIO::write_header(), libMesh::RBEIMEvaluation::write_out_interior_basis_functions(), libMesh::RBEIMEvaluation::write_out_node_basis_functions(), libMesh::RBEIMEvaluation::write_out_side_basis_functions(), libMesh::GmshIO::write_post(), and libMesh::GnuPlotIO::write_solution().

◆ singularity

bool singularity = true

Definition at line 120 of file adaptivity_ex3.C.

Referenced by assemble_laplace(), exact_derivative(), exact_solution(), and main().