libMesh
hp_coarsentest.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2017 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 // C++ includes
19 #include <limits> // for std::numeric_limits::max
20 #include <math.h> // for sqrt
21 
22 
23 // Local Includes
24 #include "libmesh/hp_coarsentest.h"
25 #include "libmesh/dense_matrix.h"
26 #include "libmesh/dense_vector.h"
27 #include "libmesh/dof_map.h"
28 #include "libmesh/fe_base.h"
29 #include "libmesh/fe_interface.h"
30 #include "libmesh/libmesh_logging.h"
31 #include "libmesh/elem.h"
32 #include "libmesh/error_vector.h"
33 #include "libmesh/mesh_base.h"
34 #include "libmesh/mesh_refinement.h"
35 #include "libmesh/quadrature.h"
36 #include "libmesh/system.h"
37 #include "libmesh/tensor_value.h"
38 
39 #ifdef LIBMESH_ENABLE_AMR
40 
41 namespace libMesh
42 {
43 
44 //-----------------------------------------------------------------
45 // HPCoarsenTest implementations
46 
48  const Elem * elem,
49  unsigned int var)
50 {
51  // If we have children, we need to add their projections instead
52  if (!elem->active())
53  {
54  libmesh_assert(!elem->subactive());
55  for (auto & child : elem->child_ref_range())
56  this->add_projection(system, &child, var);
57  return;
58  }
59 
60  // The DofMap for this system
61  const DofMap & dof_map = system.get_dof_map();
62 
63  // The type of finite element to use for this variable
64  const FEType & fe_type = dof_map.variable_type (var);
65 
66  const FEContinuity cont = fe->get_continuity();
67 
68  fe->reinit(elem);
69 
70  dof_map.dof_indices(elem, dof_indices, var);
71 
72  const unsigned int n_dofs =
73  cast_int<unsigned int>(dof_indices.size());
74 
76  fe_type, coarse, *xyz_values, coarse_qpoints);
77 
78  fe_coarse->reinit(coarse, &coarse_qpoints);
79 
80  const unsigned int n_coarse_dofs =
81  cast_int<unsigned int>(phi_coarse->size());
82 
83  if (Uc.size() == 0)
84  {
85  Ke.resize(n_coarse_dofs, n_coarse_dofs);
86  Ke.zero();
87  Fe.resize(n_coarse_dofs);
88  Fe.zero();
89  Uc.resize(n_coarse_dofs);
90  Uc.zero();
91  }
92  libmesh_assert_equal_to (Uc.size(), phi_coarse->size());
93 
94  // Loop over the quadrature points
95  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
96  {
97  // The solution value at the quadrature point
98  Number val = libMesh::zero;
99  Gradient grad;
100  Tensor hess;
101 
102  for (unsigned int i=0; i != n_dofs; i++)
103  {
104  dof_id_type dof_num = dof_indices[i];
105  val += (*phi)[i][qp] *
106  system.current_solution(dof_num);
107  if (cont == C_ZERO || cont == C_ONE)
108  grad.add_scaled((*dphi)[i][qp],system.current_solution(dof_num));
109  // grad += (*dphi)[i][qp] *
110  // system.current_solution(dof_num);
111  if (cont == C_ONE)
112  hess.add_scaled((*d2phi)[i][qp], system.current_solution(dof_num));
113  // hess += (*d2phi)[i][qp] *
114  // system.current_solution(dof_num);
115  }
116 
117  // The projection matrix and vector
118  for (unsigned int i=0; i != Fe.size(); ++i)
119  {
120  Fe(i) += (*JxW)[qp] *
121  (*phi_coarse)[i][qp]*val;
122  if (cont == C_ZERO || cont == C_ONE)
123  Fe(i) += (*JxW)[qp] *
124  (grad*(*dphi_coarse)[i][qp]);
125  if (cont == C_ONE)
126  Fe(i) += (*JxW)[qp] *
127  hess.contract((*d2phi_coarse)[i][qp]);
128  // Fe(i) += (*JxW)[qp] *
129  // (*d2phi_coarse)[i][qp].contract(hess);
130 
131  for (unsigned int j=0; j != Fe.size(); ++j)
132  {
133  Ke(i,j) += (*JxW)[qp] *
134  (*phi_coarse)[i][qp]*(*phi_coarse)[j][qp];
135  if (cont == C_ZERO || cont == C_ONE)
136  Ke(i,j) += (*JxW)[qp] *
137  (*dphi_coarse)[i][qp]*(*dphi_coarse)[j][qp];
138  if (cont == C_ONE)
139  Ke(i,j) += (*JxW)[qp] *
140  ((*d2phi_coarse)[i][qp].contract((*d2phi_coarse)[j][qp]));
141  }
142  }
143  }
144 }
145 
147 {
148  LOG_SCOPE("select_refinement()", "HPCoarsenTest");
149 
150  // The current mesh
151  MeshBase & mesh = system.get_mesh();
152 
153  // The dimensionality of the mesh
154  const unsigned int dim = mesh.mesh_dimension();
155 
156  // The number of variables in the system
157  const unsigned int n_vars = system.n_vars();
158 
159  // The DofMap for this system
160  const DofMap & dof_map = system.get_dof_map();
161 
162  // The system number (for doing bad hackery)
163  const unsigned int sys_num = system.number();
164 
165  // Check for a valid component_scale
166  if (!component_scale.empty())
167  {
168  if (component_scale.size() != n_vars)
169  libmesh_error_msg("ERROR: component_scale is the wrong size:\n" \
170  << " component_scale.size()=" \
171  << component_scale.size() \
172  << "\n n_vars=" \
173  << n_vars);
174  }
175  else
176  {
177  // No specified scaling. Scale all variables by one.
178  component_scale.resize (n_vars, 1.0);
179  }
180 
181  // Resize the error_per_cell vectors to handle
182  // the number of elements, initialize them to 0.
183  std::vector<ErrorVectorReal> h_error_per_cell(mesh.max_elem_id(), 0.);
184  std::vector<ErrorVectorReal> p_error_per_cell(mesh.max_elem_id(), 0.);
185 
186  // Loop over all the variables in the system
187  for (unsigned int var=0; var<n_vars; var++)
188  {
189  // Possibly skip this variable
190  if (!component_scale.empty())
191  if (component_scale[var] == 0.0) continue;
192 
193  // The type of finite element to use for this variable
194  const FEType & fe_type = dof_map.variable_type (var);
195 
196  // Finite element objects for a fine (and probably a coarse)
197  // element will be needed
198  fe = FEBase::build (dim, fe_type);
199  fe_coarse = FEBase::build (dim, fe_type);
200 
201  // Any cached coarse element results have expired
203  unsigned int cached_coarse_p_level = 0;
204 
205  const FEContinuity cont = fe->get_continuity();
206  libmesh_assert (cont == DISCONTINUOUS || cont == C_ZERO ||
207  cont == C_ONE);
208 
209  // Build an appropriate quadrature rule
210  qrule = fe_type.default_quadrature_rule(dim);
211 
212  // Tell the refined finite element about the quadrature
213  // rule. The coarse finite element need not know about it
214  fe->attach_quadrature_rule (qrule.get());
215 
216  // We will always do the integration
217  // on the fine elements. Get their Jacobian values, etc..
218  JxW = &(fe->get_JxW());
219  xyz_values = &(fe->get_xyz());
220 
221  // The shape functions
222  phi = &(fe->get_phi());
223  phi_coarse = &(fe_coarse->get_phi());
224 
225  // The shape function derivatives
226  if (cont == C_ZERO || cont == C_ONE)
227  {
228  dphi = &(fe->get_dphi());
229  dphi_coarse = &(fe_coarse->get_dphi());
230  }
231 
232  // The shape function second derivatives
233  if (cont == C_ONE)
234  {
235 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
236  d2phi = &(fe->get_d2phi());
237  d2phi_coarse = &(fe_coarse->get_d2phi());
238 #else
239  libmesh_error_msg("Minimization of H2 error without second derivatives is not possible.");
240 #endif
241  }
242 
243  // Iterate over all the active elements in the mesh
244  // that live on this processor.
245  for (const auto & elem : mesh.active_local_element_ptr_range())
246  {
247  // We're only checking elements that are already flagged for h
248  // refinement
249  if (elem->refinement_flag() != Elem::REFINE)
250  continue;
251 
252  const dof_id_type e_id = elem->id();
253 
254  // Find the projection onto the parent element,
255  // if necessary
256  if (elem->parent() &&
257  (coarse != elem->parent() ||
258  cached_coarse_p_level != elem->p_level()))
259  {
260  Uc.resize(0);
261 
262  coarse = elem->parent();
263  cached_coarse_p_level = elem->p_level();
264 
265  unsigned int old_parent_level = coarse->p_level();
266  (const_cast<Elem *>(coarse))->hack_p_level(elem->p_level());
267 
268  this->add_projection(system, coarse, var);
269 
270  (const_cast<Elem *>(coarse))->hack_p_level(old_parent_level);
271 
272  // Solve the h-coarsening projection problem
274  }
275 
276  fe->reinit(elem);
277 
278  // Get the DOF indices for the fine element
279  dof_map.dof_indices (elem, dof_indices, var);
280 
281  // The number of quadrature points
282  const unsigned int n_qp = qrule->n_points();
283 
284  // The number of DOFS on the fine element
285  const unsigned int n_dofs =
286  cast_int<unsigned int>(dof_indices.size());
287 
288  // The number of nodes on the fine element
289  const unsigned int n_nodes = elem->n_nodes();
290 
291  // The average element value (used as an ugly hack
292  // when we have nothing p-coarsened to compare to)
293  // Real average_val = 0.;
294  Number average_val = 0.;
295 
296  // Calculate this variable's contribution to the p
297  // refinement error
298 
299  if (elem->p_level() == 0)
300  {
301  unsigned int n_vertices = 0;
302  for (unsigned int n = 0; n != n_nodes; ++n)
303  if (elem->is_vertex(n))
304  {
305  n_vertices++;
306  const Node & node = elem->node_ref(n);
307  average_val += system.current_solution
308  (node.dof_number(sys_num,var,0));
309  }
310  average_val /= n_vertices;
311  }
312  else
313  {
314  unsigned int old_elem_level = elem->p_level();
315  (const_cast<Elem *>(elem))->hack_p_level(old_elem_level - 1);
316 
317  fe_coarse->reinit(elem, &(qrule->get_points()));
318 
319  const unsigned int n_coarse_dofs =
320  cast_int<unsigned int>(phi_coarse->size());
321 
322  (const_cast<Elem *>(elem))->hack_p_level(old_elem_level);
323 
324  Ke.resize(n_coarse_dofs, n_coarse_dofs);
325  Ke.zero();
326  Fe.resize(n_coarse_dofs);
327  Fe.zero();
328 
329  // Loop over the quadrature points
330  for (unsigned int qp=0; qp<qrule->n_points(); qp++)
331  {
332  // The solution value at the quadrature point
333  Number val = libMesh::zero;
334  Gradient grad;
335  Tensor hess;
336 
337  for (unsigned int i=0; i != n_dofs; i++)
338  {
339  dof_id_type dof_num = dof_indices[i];
340  val += (*phi)[i][qp] *
341  system.current_solution(dof_num);
342  if (cont == C_ZERO || cont == C_ONE)
343  grad.add_scaled((*dphi)[i][qp], system.current_solution(dof_num));
344  // grad += (*dphi)[i][qp] *
345  // system.current_solution(dof_num);
346  if (cont == C_ONE)
347  hess.add_scaled((*d2phi)[i][qp], system.current_solution(dof_num));
348  // hess += (*d2phi)[i][qp] *
349  // system.current_solution(dof_num);
350  }
351 
352  // The projection matrix and vector
353  for (unsigned int i=0; i != Fe.size(); ++i)
354  {
355  Fe(i) += (*JxW)[qp] *
356  (*phi_coarse)[i][qp]*val;
357  if (cont == C_ZERO || cont == C_ONE)
358  Fe(i) += (*JxW)[qp] *
359  grad * (*dphi_coarse)[i][qp];
360  if (cont == C_ONE)
361  Fe(i) += (*JxW)[qp] *
362  hess.contract((*d2phi_coarse)[i][qp]);
363 
364  for (unsigned int j=0; j != Fe.size(); ++j)
365  {
366  Ke(i,j) += (*JxW)[qp] *
367  (*phi_coarse)[i][qp]*(*phi_coarse)[j][qp];
368  if (cont == C_ZERO || cont == C_ONE)
369  Ke(i,j) += (*JxW)[qp] *
370  (*dphi_coarse)[i][qp]*(*dphi_coarse)[j][qp];
371  if (cont == C_ONE)
372  Ke(i,j) += (*JxW)[qp] *
373  ((*d2phi_coarse)[i][qp].contract((*d2phi_coarse)[j][qp]));
374  }
375  }
376  }
377 
378  // Solve the p-coarsening projection problem
380  }
381 
382  // loop over the integration points on the fine element
383  for (unsigned int qp=0; qp<n_qp; qp++)
384  {
385  Number value_error = 0.;
386  Gradient grad_error;
387  Tensor hessian_error;
388  for (unsigned int i=0; i<n_dofs; i++)
389  {
390  const dof_id_type dof_num = dof_indices[i];
391  value_error += (*phi)[i][qp] *
392  system.current_solution(dof_num);
393  if (cont == C_ZERO || cont == C_ONE)
394  grad_error.add_scaled((*dphi)[i][qp], system.current_solution(dof_num));
395  // grad_error += (*dphi)[i][qp] *
396  // system.current_solution(dof_num);
397  if (cont == C_ONE)
398  hessian_error.add_scaled((*d2phi)[i][qp], system.current_solution(dof_num));
399  // hessian_error += (*d2phi)[i][qp] *
400  // system.current_solution(dof_num);
401  }
402  if (elem->p_level() == 0)
403  {
404  value_error -= average_val;
405  }
406  else
407  {
408  for (unsigned int i=0; i<Up.size(); i++)
409  {
410  value_error -= (*phi_coarse)[i][qp] * Up(i);
411  if (cont == C_ZERO || cont == C_ONE)
412  grad_error.subtract_scaled((*dphi_coarse)[i][qp], Up(i));
413  // grad_error -= (*dphi_coarse)[i][qp] * Up(i);
414  if (cont == C_ONE)
415  hessian_error.subtract_scaled((*d2phi_coarse)[i][qp], Up(i));
416  // hessian_error -= (*d2phi_coarse)[i][qp] * Up(i);
417  }
418  }
419 
420  p_error_per_cell[e_id] += static_cast<ErrorVectorReal>
421  (component_scale[var] *
422  (*JxW)[qp] * TensorTools::norm_sq(value_error));
423  if (cont == C_ZERO || cont == C_ONE)
424  p_error_per_cell[e_id] += static_cast<ErrorVectorReal>
425  (component_scale[var] *
426  (*JxW)[qp] * grad_error.norm_sq());
427  if (cont == C_ONE)
428  p_error_per_cell[e_id] += static_cast<ErrorVectorReal>
429  (component_scale[var] *
430  (*JxW)[qp] * hessian_error.norm_sq());
431  }
432 
433  // Calculate this variable's contribution to the h
434  // refinement error
435 
436  if (!elem->parent())
437  {
438  // For now, we'll always start with an h refinement
439  h_error_per_cell[e_id] =
441  }
442  else
443  {
444  FEInterface::inverse_map (dim, fe_type, coarse,
446 
447  unsigned int old_parent_level = coarse->p_level();
448  (const_cast<Elem *>(coarse))->hack_p_level(elem->p_level());
449 
450  fe_coarse->reinit(coarse, &coarse_qpoints);
451 
452  (const_cast<Elem *>(coarse))->hack_p_level(old_parent_level);
453 
454  // The number of DOFS on the coarse element
455  unsigned int n_coarse_dofs =
456  cast_int<unsigned int>(phi_coarse->size());
457 
458  // Loop over the quadrature points
459  for (unsigned int qp=0; qp<n_qp; qp++)
460  {
461  // The solution difference at the quadrature point
462  Number value_error = libMesh::zero;
463  Gradient grad_error;
464  Tensor hessian_error;
465 
466  for (unsigned int i=0; i != n_dofs; ++i)
467  {
468  const dof_id_type dof_num = dof_indices[i];
469  value_error += (*phi)[i][qp] *
470  system.current_solution(dof_num);
471  if (cont == C_ZERO || cont == C_ONE)
472  grad_error.add_scaled((*dphi)[i][qp], system.current_solution(dof_num));
473  // grad_error += (*dphi)[i][qp] *
474  // system.current_solution(dof_num);
475  if (cont == C_ONE)
476  hessian_error.add_scaled((*d2phi)[i][qp], system.current_solution(dof_num));
477  // hessian_error += (*d2phi)[i][qp] *
478  // system.current_solution(dof_num);
479  }
480 
481  for (unsigned int i=0; i != n_coarse_dofs; ++i)
482  {
483  value_error -= (*phi_coarse)[i][qp] * Uc(i);
484  if (cont == C_ZERO || cont == C_ONE)
485  // grad_error -= (*dphi_coarse)[i][qp] * Uc(i);
486  grad_error.subtract_scaled((*dphi_coarse)[i][qp], Uc(i));
487  if (cont == C_ONE)
488  hessian_error.subtract_scaled((*d2phi_coarse)[i][qp], Uc(i));
489  // hessian_error -= (*d2phi_coarse)[i][qp] * Uc(i);
490  }
491 
492  h_error_per_cell[e_id] += static_cast<ErrorVectorReal>
493  (component_scale[var] *
494  (*JxW)[qp] * TensorTools::norm_sq(value_error));
495  if (cont == C_ZERO || cont == C_ONE)
496  h_error_per_cell[e_id] += static_cast<ErrorVectorReal>
497  (component_scale[var] *
498  (*JxW)[qp] * grad_error.norm_sq());
499  if (cont == C_ONE)
500  h_error_per_cell[e_id] += static_cast<ErrorVectorReal>
501  (component_scale[var] *
502  (*JxW)[qp] * hessian_error.norm_sq());
503  }
504 
505  }
506  }
507  }
508 
509  // Now that we've got our approximations for p_error and h_error, let's see
510  // if we want to switch any h refinement flags to p refinement
511 
512  // Iterate over all the active elements in the mesh
513  // that live on this processor.
514  for (auto & elem : mesh.active_local_element_ptr_range())
515  {
516  // We're only checking elements that are already flagged for h
517  // refinement
518  if (elem->refinement_flag() != Elem::REFINE)
519  continue;
520 
521  const dof_id_type e_id = elem->id();
522 
523  unsigned int dofs_per_elem = 0, dofs_per_p_elem = 0;
524 
525  // Loop over all the variables in the system
526  for (unsigned int var=0; var<n_vars; var++)
527  {
528  // The type of finite element to use for this variable
529  const FEType & fe_type = dof_map.variable_type (var);
530 
531  // FIXME: we're overestimating the number of DOFs added by h
532  // refinement
533  FEType elem_fe_type = fe_type;
534  elem_fe_type.order =
535  static_cast<Order>(fe_type.order + elem->p_level());
536  dofs_per_elem +=
537  FEInterface::n_dofs(dim, elem_fe_type, elem->type());
538 
539  elem_fe_type.order =
540  static_cast<Order>(fe_type.order + elem->p_level() + 1);
541  dofs_per_p_elem +=
542  FEInterface::n_dofs(dim, elem_fe_type, elem->type());
543  }
544 
545  const unsigned int new_h_dofs = dofs_per_elem *
546  (elem->n_children() - 1);
547 
548  const unsigned int new_p_dofs = dofs_per_p_elem -
549  dofs_per_elem;
550 
551  /*
552  libMesh::err << "Cell " << e_id << ": h = " << elem->hmax()
553  << ", p = " << elem->p_level() + 1 << "," << std::endl
554  << " h_error = " << h_error_per_cell[e_id]
555  << ", p_error = " << p_error_per_cell[e_id] << std::endl
556  << " new_h_dofs = " << new_h_dofs
557  << ", new_p_dofs = " << new_p_dofs << std::endl;
558  */
559  const Real p_value =
560  std::sqrt(p_error_per_cell[e_id]) * p_weight / new_p_dofs;
561  const Real h_value =
562  std::sqrt(h_error_per_cell[e_id]) /
563  static_cast<Real>(new_h_dofs);
564  if (p_value > h_value)
565  {
566  elem->set_p_refinement_flag(Elem::REFINE);
567  elem->set_refinement_flag(Elem::DO_NOTHING);
568  }
569  }
570 
571  // libMesh::MeshRefinement will now assume that users have set
572  // refinement flags consistently on all processors, but all we've
573  // done so far is set refinement flags on local elements. Let's
574  // make sure that flags on geometrically ghosted elements are all
575  // set to whatever their owners decided.
577 }
578 
579 } // namespace libMesh
580 
581 #endif // #ifdef LIBMESH_ENABLE_AMR
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition: fe_type.h:178
const std::vector< std::vector< Real > > * phi
The shape functions and their derivatives.
virtual void select_refinement(System &system) libmesh_override
This pure virtual function must be redefined in derived classes to take a mesh flagged for h refineme...
std::vector< float > component_scale
This vector can be used to "scale" certain variables in a system.
Definition: hp_selector.h:78
void add_projection(const System &, const Elem *, unsigned int var)
The helper function which adds individual fine element data to the coarse element projection...
A Node is like a Point, but with more information.
Definition: node.h:52
static unsigned int n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
Definition: fe_interface.C:414
bool subactive() const
Definition: elem.h:2275
bool active() const
Definition: elem.h:2257
virtual void zero() libmesh_override
Set every element in the matrix to 0.
Definition: dense_matrix.h:792
DenseVector< Number > Fe
unsigned int p_level() const
Definition: elem.h:2422
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1697
Real norm_sq() const
Definition: type_tensor.h:1270
void add_scaled(const TypeTensor< T2 > &, const T)
Add a scaled tensor to this tensor without creating a temporary.
Definition: type_tensor.h:777
void add_scaled(const TypeVector< T2 > &, const T)
Add a scaled value to this vector without creating a temporary.
Definition: type_vector.h:624
unsigned int dim
const std::vector< std::vector< Real > > * phi_coarse
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:350
virtual void zero() libmesh_override
Set every element in the vector to 0.
Definition: dense_vector.h:374
const Elem * parent() const
Definition: elem.h:2346
This is the base class from which all geometric element types are derived.
Definition: elem.h:89
MeshBase & mesh
const class libmesh_nullptr_t libmesh_nullptr
dof_id_type dof_number(const unsigned int s, const unsigned int var, const unsigned int comp) const
Definition: dof_object.h:810
const std::vector< std::vector< RealGradient > > * dphi_coarse
OrderWrapper order
The approximation order of the element.
Definition: fe_type.h:197
UniquePtr< QBase > qrule
The quadrature rule for the fine element.
const unsigned int n_vars
Definition: tecplot_io.C:68
The libMesh namespace provides an interface to certain functionality in the library.
UniquePtr< FEBase > fe
The finite element objects for fine and coarse elements.
const Number zero
.
Definition: libmesh.h:178
const std::vector< Point > * xyz_values
Quadrature locations.
virtual unsigned int size() const libmesh_override
Definition: dense_vector.h:87
long double max(long double a, double b)
DIE A HORRIBLE DEATH HERE typedef float ErrorVectorReal
DenseVector< Number > Uc
Coefficients for projected coarse and projected p-derefined solutions.
This is the MeshBase class.
Definition: mesh_base.h:68
SimpleRange< ChildRefIter > child_ref_range()
Returns a range with all children of a parent element, usable in range-based for loops.
Definition: elem.h:1699
libmesh_assert(j)
const std::vector< Real > * JxW
Mapping jacobians.
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:167
virtual dof_id_type max_elem_id() const =0
const dof_id_type n_nodes
Definition: tecplot_io.C:67
const MeshBase & get_mesh() const
Definition: system.h:2014
const DofMap & get_dof_map() const
Definition: system.h:2030
This is the MeshRefinement class.
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
static Point inverse_map(const unsigned int dim, const FEType &fe_t, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
Definition: fe_interface.C:569
bool make_flags_parallel_consistent()
Copy refinement flags on ghost elements from their local processors.
Real norm_sq() const
Definition: type_vector.h:940
DenseVector< Number > Up
UniquePtr< FEBase > fe_coarse
FEContinuity
defines an enum for finite element types to libmesh_assert a certain level (or type? Hcurl?) of continuity.
void subtract_scaled(const TypeVector< T2 > &, const T)
Subtract a scaled value from this vector without creating a temporary.
Definition: type_vector.h:698
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:192
unsigned int number() const
Definition: system.h:2006
CompareTypes< T, T2 >::supertype contract(const TypeTensor< T2 > &) const
Multiply 2 tensors together, i.e.
Definition: type_tensor.h:1175
UniquePtr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
Definition: fe_type.C:30
const Elem * coarse
The coarse element on which a solution projection is cached.
unsigned int mesh_dimension() const
Definition: mesh_base.C:148
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:776
Order
defines an enum for polynomial orders.
Definition: enum_order.h:32
const std::vector< std::vector< RealTensor > > * d2phi_coarse
unsigned int n_vars() const
Definition: system.h:2086
const std::vector< std::vector< RealTensor > > * d2phi
const std::vector< std::vector< RealGradient > > * dphi
std::vector< dof_id_type > dof_indices
Global DOF indices for fine elements.
Real p_weight
Because the coarsening test seems to always choose p refinement, we&#39;re providing an option to make h ...
std::vector< Point > coarse_qpoints
void cholesky_solve(const DenseVector< T2 > &b, DenseVector< T2 > &x)
For symmetric positive definite (SPD) matrices.
Definition: dense_matrix.C:911
void subtract_scaled(const TypeTensor< T2 > &, const T)
Subtract a scaled value from this tensor without creating a temporary.
Definition: type_tensor.h:847
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
uint8_t dof_id_type
Definition: id_types.h:64
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1917
static UniquePtr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
DenseMatrix< Number > Ke
Linear system for projections.