Go to the documentation of this file.
20 #include "libmesh/boundary_info.h"
21 #include "libmesh/dof_map.h"
22 #include "libmesh/elem.h"
23 #include "libmesh/fe_base.h"
24 #include "libmesh/fe_interface.h"
25 #include "libmesh/fem_context.h"
26 #include "libmesh/libmesh_logging.h"
27 #include "libmesh/mesh_base.h"
28 #include "libmesh/quadrature.h"
29 #include "libmesh/system.h"
30 #include "libmesh/diff_system.h"
31 #include "libmesh/time_solver.h"
32 #include "libmesh/unsteady_solver.h"
45 _custom_solution(nullptr),
46 _boundary_info(sys.get_mesh().get_boundary_info()),
48 _dim(
cast_int<unsigned char>(sys.get_mesh().mesh_dimension())),
50 _elem_dims(sys.get_mesh().elem_dimensions()),
53 _extra_quadrature_order(sys.extra_quadrature_order)
66 _custom_solution(nullptr),
67 _boundary_info(sys.get_mesh().get_boundary_info()),
69 _dim(
cast_int<unsigned char>(sys.get_mesh().mesh_dimension())),
71 _elem_dims(sys.get_mesh().elem_dimensions()),
74 _extra_quadrature_order(extra_quadrature_order)
105 hardest_fe_type = fe_type;
108 return hardest_fe_type;
115 const unsigned int nv = sys.
n_vars();
119 for (
unsigned int i=0; i != nv; ++i)
187 for (
int i=0; i<4; ++i)
191 for (
int i=0; i<4; ++i)
192 _side_fe.push_back(std::map<
FEType, std::unique_ptr<FEAbstract>>());
200 unsigned int nv = sys.
n_vars();
203 bool have_scalar =
false;
205 for (
unsigned int i=0; i != nv; ++i)
225 for (
unsigned int i=0; i != nv; ++i)
260 #ifdef LIBMESH_ENABLE_DEPRECATED
263 libmesh_deprecated();
276 template<
typename OutputType,
282 const unsigned int n_dofs = cast_int<unsigned int>
293 const std::vector<std::vector
299 for (
unsigned int l=0; l != n_dofs; l++)
300 u += phi[l][qp] * coef(l);
305 template<
typename OutputType,
311 const unsigned int n_dofs = cast_int<unsigned int>
322 const std::vector<std::vector
329 for (
unsigned int l=0; l != n_dofs; l++)
330 du.add_scaled(dphi[l][qp], coef(l));
337 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
338 template<
typename OutputType,
344 const unsigned int n_dofs = cast_int<unsigned int>
355 const std::vector<std::vector
362 for (
unsigned int l=0; l != n_dofs; l++)
363 d2u.add_scaled(d2phi[l][qp], coef(l));
380 template<
typename OutputType>
382 OutputType & u)
const
385 &FEMContext::get_element_fe<typename TensorTools::MakeReal<OutputType>::type>,
390 template<
typename OutputType>
393 std::vector<OutputType> & u_vals)
const
398 const unsigned int n_dofs = cast_int<unsigned int>
406 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
409 const std::vector<std::vector<OutputShape>> & phi = fe->
get_phi();
414 OutputType & u = u_vals[qp];
419 for (
unsigned int l=0; l != n_dofs; l++)
420 u += phi[l][qp] * coef(l);
427 unsigned int qp)
const
438 template<
typename OutputType>
441 OutputType & du)
const
446 <OutputType>::type>::type>,
452 template<
typename OutputType>
455 std::vector<OutputType> & du_vals)
const
462 const unsigned int n_dofs = cast_int<unsigned int>
470 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
473 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe->
get_dphi();
478 OutputType & du = du_vals[qp];
483 for (
unsigned int l=0; l != n_dofs; l++)
484 du.add_scaled(dphi[l][qp], coef(l));
490 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
500 template<
typename OutputType>
502 OutputType & d2u)
const
509 <OutputType>::type>::type>::type>,
514 template<
typename OutputType>
517 std::vector<OutputType> & d2u_vals)
const
524 const unsigned int n_dofs = cast_int<unsigned int>
532 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
535 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe->
get_d2phi();
540 OutputType & d2u = d2u_vals[qp];
545 for (
unsigned int l=0; l != n_dofs; l++)
546 d2u.add_scaled(d2phi[l][qp], coef(l));
553 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
556 template<
typename OutputType>
558 OutputType & curl_u)
const
563 const unsigned int n_dofs = cast_int<unsigned int>
572 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
575 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe->
get_curl_phi();
580 for (
unsigned int l=0; l != n_dofs; l++)
581 curl_u.add_scaled(curl_phi[l][qp], coef(l));
587 template<
typename OutputType>
589 OutputType & div_u)
const
596 const unsigned int n_dofs = cast_int<unsigned int>
605 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
608 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputDivergence>> & div_phi = fe->
get_div_phi();
613 for (
unsigned int l=0; l != n_dofs; l++)
614 div_u += div_phi[l][qp] * coef(l);
621 unsigned int qp)
const
631 template<
typename OutputType>
634 OutputType & u)
const
637 &FEMContext::get_side_fe<typename TensorTools::MakeReal<OutputType>::type>,
642 template<
typename OutputType>
645 std::vector<OutputType> & u_vals)
const
650 const unsigned int n_dofs = cast_int<unsigned int>
658 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
661 const std::vector<std::vector<OutputShape>> & phi = the_side_fe->
get_phi();
666 OutputType & u = u_vals[qp];
671 for (
unsigned int l=0; l != n_dofs; l++)
672 u += phi[l][qp] * coef(l);
688 template<
typename OutputType>
690 OutputType & du)
const
697 const unsigned int n_dofs = cast_int<unsigned int>
706 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
709 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->
get_dphi();
714 for (
unsigned int l=0; l != n_dofs; l++)
715 du.add_scaled(dphi[l][qp], coef(l));
722 template<
typename OutputType>
725 std::vector<OutputType> & du_vals)
const
732 const unsigned int n_dofs = cast_int<unsigned int>
740 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
743 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = the_side_fe->
get_dphi();
748 OutputType & du = du_vals[qp];
753 for (
unsigned int l=0; l != n_dofs; l++)
754 du.add_scaled(dphi[l][qp], coef(l));
760 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
762 unsigned int qp)
const
773 template<
typename OutputType>
776 OutputType & d2u)
const
783 <OutputType>::type>::type>::type>,
789 template<
typename OutputType>
792 std::vector<OutputType> & d2u_vals)
const
799 const unsigned int n_dofs = cast_int<unsigned int>
807 this->get_side_fe<OutputShape>( var, the_side_fe, this->
get_elem_dim() );
810 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = the_side_fe->
get_d2phi();
815 OutputType & d2u = d2u_vals[qp];
820 for (
unsigned int l=0; l != n_dofs; l++)
821 d2u.add_scaled(d2phi[l][qp], coef(l));
829 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
842 template<
typename OutputType>
846 const Real tolerance)
const
851 const unsigned int n_dofs = cast_int<unsigned int>
860 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
867 const std::vector<std::vector<OutputShape>> & phi = fe_new->
get_phi();
871 for (
unsigned int l=0; l != n_dofs; l++)
872 u += phi[l][0] * coef(l);
890 template<
typename OutputType>
894 const Real tolerance)
const
901 const unsigned int n_dofs = cast_int<unsigned int>
910 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
917 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->
get_dphi();
921 for (
unsigned int l=0; l != n_dofs; l++)
922 grad_u.add_scaled(dphi[l][0], coef(l));
929 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
941 template<
typename OutputType>
945 const Real tolerance)
const
952 const unsigned int n_dofs = cast_int<unsigned int>
961 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
968 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->
get_d2phi();
972 for (
unsigned int l=0; l != n_dofs; l++)
973 hess_u.add_scaled(d2phi[l][0], coef(l));
978 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
981 template<
typename OutputType>
985 const Real tolerance)
const
990 const unsigned int n_dofs = cast_int<unsigned int>
999 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1006 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputShape>> & curl_phi = fe_new->
get_curl_phi();
1010 for (
unsigned int l=0; l != n_dofs; l++)
1011 curl_u.add_scaled(curl_phi[l][0], coef(l));
1029 template<
typename OutputType>
1031 OutputType & u)
const
1051 template<
typename OutputType>
1053 OutputType & du)
const
1060 <OutputType>::type>::type>,
1067 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1078 template<
typename OutputType>
1080 OutputType & d2u)
const
1087 <OutputType>::type>::type>::type>,
1090 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1104 template<
typename OutputType>
1106 OutputType & u)
const
1128 template<
typename OutputType>
1130 OutputType & du)
const
1136 <OutputType>::type>::type>,
1142 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1152 template<
typename OutputType>
1154 OutputType & d2u)
const
1161 <OutputType>::type>::type>::type>,
1164 #endif // ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1177 template<
typename OutputType>
1181 const Real tolerance)
const
1186 const unsigned int n_dofs = cast_int<unsigned int>
1195 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1202 const std::vector<std::vector<OutputShape>> & phi = fe_new->
get_phi();
1206 for (
unsigned int l=0; l != n_dofs; l++)
1207 u += phi[l][0] * coef(l);
1225 template<
typename OutputType>
1228 OutputType & grad_u,
1229 const Real tolerance)
const
1236 const unsigned int n_dofs = cast_int<unsigned int>
1245 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1252 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputGradient>> & dphi = fe_new->
get_dphi();
1256 for (
unsigned int l=0; l != n_dofs; l++)
1257 grad_u.add_scaled(dphi[l][0], coef(l));
1263 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
1276 template<
typename OutputType>
1279 OutputType & hess_u,
1280 const Real tolerance)
const
1287 const unsigned int n_dofs = cast_int<unsigned int>
1296 this->get_element_fe<OutputShape>( var, fe, this->
get_elem_dim() );
1303 const std::vector<std::vector<typename FEGenericBase<OutputShape>::OutputTensor>> & d2phi = fe_new->
get_d2phi();
1307 for (
unsigned int l=0; l != n_dofs; l++)
1308 hess_u.add_scaled(d2phi[l][0], coef(l));
1313 #endif // LIBMESH_ENABLE_SECOND_DERIVATIVES
1317 template<
typename OutputType>
1319 OutputType & u)
const
1327 template<
typename OutputType>
1329 OutputType & dudot)
const
1334 <OutputType>::type>::type>,
1338 template<
typename OutputType>
1340 OutputType & u)
const
1348 template<
typename OutputType>
1350 OutputType & u)
const
1360 template<
typename OutputType>
1362 OutputType & u)
const
1449 pr.second->reinit(&(this->
get_elem()), pts);
1452 pr.second->reinit(
nullptr);
1524 for (
unsigned int i=0; i !=
n_nodes; ++i)
1528 for (
unsigned int i=0; i !=
n_nodes; ++i)
1532 for (
unsigned int i=0; i !=
n_nodes; ++i)
1549 pr.second->get_fe_map().set_jacobian_tolerance(tol);
1553 pr.second->get_fe_map().set_jacobian_tolerance(tol);
1556 pr.second->get_fe_map().set_jacobian_tolerance(tol);
1602 for (
unsigned int i=0; i !=
n_nodes; ++i)
1603 const_cast<Elem &>(this->
get_elem()).point(i)(0) =
1607 for (
unsigned int i=0; i !=
n_nodes; ++i)
1608 const_cast<Elem &>(this->
get_elem()).point(i)(1) =
1612 for (
unsigned int i=0; i !=
n_nodes; ++i)
1613 const_cast<Elem &>(this->
get_elem()).point(i)(2) =
1657 #ifdef LIBMESH_ENABLE_AMR
1669 #endif // LIBMESH_ENABLE_AMR
1671 const unsigned int n_dofs = cast_int<unsigned int>
1673 const unsigned int n_qoi = sys.
n_qois();
1714 for (std::size_t q=0; q != n_qoi; ++q)
1721 unsigned int sub_dofs = 0;
1734 #ifdef LIBMESH_ENABLE_AMR
1745 #endif // LIBMESH_ENABLE_AMR
1751 const unsigned int n_dofs_var = cast_int<unsigned int>
1755 (sub_dofs, n_dofs_var);
1766 (sub_dofs, n_dofs_var);
1773 (sub_dofs, n_dofs_var);
1779 (sub_dofs, n_dofs_var);
1784 (sub_dofs, n_dofs_var);
1786 for (std::size_t q=0; q != n_qoi; ++q)
1788 (sub_dofs, n_dofs_var);
1790 for (
unsigned int j=0; j != i; ++j)
1792 const unsigned int n_dofs_var_j =
1793 cast_int<unsigned int>
1798 n_dofs_var, n_dofs_var_j);
1801 n_dofs_var_j, n_dofs_var);
1804 (sub_dofs, sub_dofs,
1809 sub_dofs += n_dofs_var;
1817 libmesh_assert_equal_to (sub_dofs, n_dofs);
1828 for (; localized_vec_it != localized_vec_end; ++localized_vec_it)
1836 unsigned int sub_dofs = 0;
1839 const unsigned int n_dofs_var = cast_int<unsigned int>
1845 localized_vec_it->second.second[i]->reposition
1846 (sub_dofs, n_dofs_var);
1848 sub_dofs += n_dofs_var;
1850 libmesh_assert_equal_to (sub_dofs, n_dofs);
1861 cast_int<unsigned char>(this->
_elem ? this->
_elem->
dim() : 0);
1880 const FEType fe_type )
const
1882 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1883 const bool fe_needs_inf =
1889 fe_type !=
_real_fe->get_fe_type())
1891 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1897 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1916 const FEType fe_type )
const
1918 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1919 const bool fe_needs_inf =
1927 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1933 #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
1950 template<
typename OutputShape>
1954 const Real tolerance)
const
1963 #ifdef LIBMESH_ENABLE_AMR
1968 fe_type.
order = static_cast<Order>(fe_type.
order - 1);
1970 fe_type.
order = static_cast<Order>(fe_type.
order + 1);
1972 #endif // LIBMESH_ENABLE_AMR
1984 std::vector<Point> coor(1, master_point);
1991 fe_new->
reinit (
nullptr, &coor);
2001 template void FEMContext::interior_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2003 std::vector<Number> &)
const;
2004 template void FEMContext::interior_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2006 std::vector<Gradient> &)
const;
2008 template void FEMContext::interior_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2010 std::vector<Gradient> &)
const;
2011 template void FEMContext::interior_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2013 std::vector<Tensor> &)
const;
2015 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2016 template void FEMContext::interior_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2018 std::vector<Tensor> &)
const;
2025 template void FEMContext::interior_curl<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2027 template void FEMContext::interior_div<Number>(
unsigned int,
unsigned int,
Number &)
const;
2029 template void FEMContext::side_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2030 template void FEMContext::side_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2032 std::vector<Number> &)
const;
2034 std::vector<Gradient> &)
const;
2036 template void FEMContext::side_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2038 std::vector<Gradient> &)
const;
2039 template void FEMContext::side_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2041 std::vector<Tensor> &)
const;
2044 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2045 template void FEMContext::side_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2047 std::vector<Tensor> &)
const;
2055 template void FEMContext::point_value<Number>(
unsigned int,
const Point &,
Number &,
const Real)
const;
2056 template void FEMContext::point_value<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2058 template void FEMContext::point_gradient<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2059 template void FEMContext::point_gradient<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2061 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2062 template void FEMContext::point_hessian<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2067 template void FEMContext::point_curl<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2069 template void FEMContext::fixed_interior_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2070 template void FEMContext::fixed_interior_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2072 template void FEMContext::fixed_interior_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2073 template void FEMContext::fixed_interior_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2075 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2076 template void FEMContext::fixed_interior_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2081 template void FEMContext::fixed_side_value<Number>(
unsigned int,
unsigned int,
Number &)
const;
2082 template void FEMContext::fixed_side_value<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2084 template void FEMContext::fixed_side_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2085 template void FEMContext::fixed_side_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2087 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2088 template void FEMContext::fixed_side_hessian<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2093 template void FEMContext::fixed_point_value<Number>(
unsigned int,
const Point &,
Number &,
const Real)
const;
2094 template void FEMContext::fixed_point_value<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2096 template void FEMContext::fixed_point_gradient<Gradient>(
unsigned int,
const Point &,
Gradient &,
const Real)
const;
2097 template void FEMContext::fixed_point_gradient<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2099 #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
2100 template void FEMContext::fixed_point_hessian<Tensor>(
unsigned int,
const Point &,
Tensor &,
const Real)
const;
2105 template void FEMContext::interior_rate<Number>(
unsigned int,
unsigned int,
Number &)
const;
2106 template void FEMContext::interior_rate<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2108 template void FEMContext::interior_rate_gradient<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2109 template void FEMContext::interior_rate_gradient<Tensor>(
unsigned int,
unsigned int,
Tensor &)
const;
2111 template void FEMContext::side_rate<Number>(
unsigned int,
unsigned int,
Number &)
const;
2112 template void FEMContext::side_rate<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2114 template void FEMContext::interior_accel<Number>(
unsigned int,
unsigned int,
Number &)
const;
2115 template void FEMContext::interior_accel<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
2117 template void FEMContext::side_accel<Number>(
unsigned int,
unsigned int,
Number &)
const;
2118 template void FEMContext::side_accel<Gradient>(
unsigned int,
unsigned int,
Gradient &)
const;
Manages consistently variables, degrees of freedom, and coefficient vectors.
Helper nested class for C++03-compatible "template typedef".
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
void init_internal_data(const System &sys)
Helper function used in constructors to set up internal data.
unsigned int n_vars() const
std::vector< boundary_id_type > boundary_ids(const Node *node) const
DenseSubVector< Number > & get_localized_subvector(const NumericVector< Number > &localized_vector, unsigned int var)
Return a reference to DenseSubVector localization of localized_vector at variable var contained in th...
Gradient fixed_point_gradient(unsigned int var, const Point &p) const
Gradient side_gradient(unsigned int var, unsigned int qp) const
unsigned char side
Current side for side_* to examine.
void elem_position_get()
Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration.
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
std::unique_ptr< FEGenericBase< RealGradient > > _real_grad_fe
virtual ~FEMContext()
Destructor.
virtual void nonlocal_reinit(Real theta) override
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new ...
FEMContext(const System &sys)
Constructor.
std::vector< std::unique_ptr< QBase > > _element_qrule
Quadrature rule for element interior.
void side_accel(unsigned int var, unsigned int qp, OutputType &u) const
unsigned int get_mesh_y_var() const
Accessor for y-variable of moving mesh System.
FEFamily family
The type of finite element.
virtual void elem_side_reinit(Real theta) override
Resets the current time in the context.
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.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
std::unique_ptr< QBase > _edge_qrule
Quadrature rules for element edges.
std::vector< boundary_id_type > side_boundary_ids() const
Lists the boundary ids found on the current side.
void side_gradients(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &side_gradients_vector) const
Fills a vector with the gradient of the solution variable var at all the quadrature points on the cur...
void set_time(Real time_in)
Set the time for which the current nonlinear_solution is defined.
virtual unsigned int n_nodes() const =0
Gradient fixed_side_gradient(unsigned int var, unsigned int qp) const
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
FEGenericBase< OutputShape > * build_new_fe(const FEGenericBase< OutputShape > *fe, const Point &p, const Real tolerance=TOLERANCE) const
Helper function to reduce some code duplication in the *_point_* methods.
void set_elem(const Elem *e)
Helper function to promote accessor usage.
void interior_gradients(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &interior_gradients_vector) const
Fills a vector with the gradient of the solution variable var at all the quadrature points in the cur...
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
The libMesh namespace provides an interface to certain functionality in the library.
virtual unsigned short dim() const =0
unsigned char get_side() const
Accessor for current side of Elem object.
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
This class forms the foundation from which generic finite elements may be derived.
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _side_fe
const System & get_system() const
Accessor for associated system.
virtual bool infinite() const =0
unsigned char get_elem_dim() const
const Elem & get_elem() const
Accessor for current Elem object.
const std::vector< std::vector< OutputTensor > > & get_d2phi() const
This class provides a specific system class.
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
const std::vector< std::vector< OutputGradient > > & get_dphi() const
void interior_accel(unsigned int var, unsigned int qp, OutputType &u) const
const std::vector< std::vector< OutputDivergence > > & get_div_phi() const
void interior_curl(unsigned int var, unsigned int qp, OutputType &curl_u) const
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > > _localized_vectors
Contains pointers to vectors the user has asked to be localized, keyed with pairs of element localize...
const BoundaryInfo & _boundary_info
Saved reference to BoundaryInfo on the mesh for this System.
Number point_value(unsigned int var, const Point &p) const
static std::unique_ptr< FEGenericBase > build_InfFE(const unsigned int dim, const FEType &type)
Builds a specific infinite element type.
const Point & point(const unsigned int i) const
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
int _extra_quadrature_order
The extra quadrature order for this context.
Number fixed_point_value(unsigned int var, const Point &p) const
unsigned char _elem_dim
Cached dimension of this->_elem.
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
void old_dof_indices(const Elem &elem, unsigned int n, std::vector< dof_id_type > &di, const unsigned int vn) const
Appends to the vector di the old global degree of freedom indices for elem.node_ref(n),...
void some_gradient(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_gradient methods.
std::vector< std::vector< FEAbstract * > > _side_fe_var
unsigned int n_qois() const
Number of currently active quantities of interest.
void use_unweighted_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to exactly integrate unweighted undistorted basis functions,...
Number fixed_side_value(unsigned int var, unsigned int qp) const
FEGenericBase< OutputShape > * cached_fe(const unsigned int elem_dim, const FEType fe_type) const
void point_curl(unsigned int var, const Point &p, OutputType &curl_u, const Real tolerance=TOLERANCE) const
void interior_rate(unsigned int var, unsigned int qp, OutputType &u) const
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
std::set< unsigned char > _elem_dims
Cached dimensions of elements in the mesh, plus dimension 0 if SCALAR variables are in use.
void some_hessian(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_hessian methods.
std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > >::iterator localized_vectors_iterator
Typedef for the localized_vectors iterator.
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
void side_rate(unsigned int var, unsigned int qp, OutputType &u) const
const std::set< unsigned int > & get_second_order_vars() const
static Point inverse_map(const unsigned int dim, const Elem *elem, const Point &p, const Real tolerance=TOLERANCE, const bool secure=true)
const Elem * _elem
Current element for element_* to examine.
void set_jacobian_tolerance(Real tol)
Calls set_jacobian_tolerance() on all the FE objects controlled by this class.
This is a generic class that defines a solver to handle time integration of DifferentiableSystems.
System * _mesh_sys
System from which to acquire moving mesh information.
bool has_elem() const
Test for current Elem object.
Tensor interior_hessian(unsigned int var, unsigned int qp) const
Real get_system_time() const
Accessor for the time variable stored in the system class.
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
static std::unique_ptr< FEAbstract > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
std::unique_ptr< FEGenericBase< Real > > _real_fe
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
This class defines a tensor in LIBMESH_DIM dimensional Real or Complex space.
TimeSolver & get_time_solver()
A Point defines a location in LIBMESH_DIM dimensional Real space.
std::vector< std::map< FEType, std::unique_ptr< FEAbstract > > > _element_fe
Finite element objects for each variable's interior, sides and edges.
Gradient point_gradient(unsigned int var, const Point &p) const
Tnew cast_int(Told oldvar)
void _do_elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
void side_values(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &side_values_vector) const
Fills a vector of values of the _system_vector at the all the quadrature points on the current elemen...
std::map< FEType, std::unique_ptr< FEAbstract > > _edge_fe
virtual Order default_order() const =0
Tensor side_hessian(unsigned int var, unsigned int qp) const
unsigned int get_mesh_x_var() const
Accessor for x-variable of moving mesh System.
void interior_values(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &interior_values_vector) const
Fills a vector of values of the _system_vector at the all the quadrature points in the current elemen...
static FEFamily map_fe_type(const Elem &elem)
std::unique_ptr< QBase > default_quadrature_rule(const unsigned int dim, const int extraorder=0) const
Tensor fixed_side_hessian(unsigned int var, unsigned int qp) const
void elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
void interior_hessians(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &d2u_vals) const
Fills a vector of hessians of the _system_vector at the all the quadrature points in the current elem...
const dof_id_type n_nodes
void interior_rate_gradient(unsigned int var, unsigned int qp, OutputType &u) const
FEType get_fe_type() const
const NumericVector< Number > * _custom_solution
Data with which to do algebra reinitialization.
This class provides all data required for a physics package (e.g.
void attach_quadrature_rules()
Helper function for attaching quadrature rules.
void use_default_quadrature_rules(int extra_quadrature_order=0)
Use quadrature rules designed to over-integrate a mass matrix, plus extra_quadrature_order.
const FEType & variable_type(const unsigned int i) const
void _update_time_from_system(Real theta)
Update the time in the context object for the given value of theta, based on the values of "time" and...
const typedef DenseSubVector< Number > &(DiffContext::* diff_subsolution_getter)(unsigned int) const
Helper typedef to simplify refactoring.
void resize(const unsigned int n)
Resize the vector.
Tensor point_hessian(unsigned int var, const Point &p) const
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
virtual void edge_fe_reinit()
Reinitializes edge FE objects on the current geometric element.
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh.
std::vector< std::unique_ptr< QBase > > _side_qrule
Quadrature rules for element sides The FEM context will try to find a quadrature rule that correctly ...
Gradient interior_gradient(unsigned int var, unsigned int qp) const
const Elem & get(const ElemType type_in)
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
OrderWrapper order
The approximation order of the element.
TensorTools::MakeReal< OutputType >::type value_shape
const std::vector< std::vector< OutputShape > > & get_curl_phi() const
virtual unsigned int time_order() const =0
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
std::vector< T > & get_values()
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
bool has_side_boundary_id(boundary_id_type id) const
Reports if the boundary id is found on the current side.
Number side_value(unsigned int var, unsigned int qp) const
AlgebraicType algebraic_type() const
This is the base class from which all geometric element types are derived.
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
Number fixed_interior_value(unsigned int var, unsigned int qp) const
FEType find_hardest_fe_type()
Helper function for creating quadrature rules.
void get_side_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in th...
void some_value(unsigned int var, unsigned int qp, OutputType &u) const
Helper function to reduce some code duplication in the *interior_value methods.
virtual void get(const std::vector< numeric_index_type > &index, T *values) const
Access multiple components at once.
const DofMap & get_dof_map() const
const DenseVector< Number > & get_elem_solution_rate() const
Accessor for element solution rate of change w.r.t.
const std::vector< std::vector< OutputShape > > & get_phi() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void reinit(const Elem *elem, const std::vector< Point > *const pts=nullptr, const std::vector< Real > *const weights=nullptr)=0
This is at the core of this class.
unsigned int get_mesh_z_var() const
Accessor for z-variable of moving mesh System.
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
bool _real_grad_fe_is_inf
virtual void elem_edge_reinit(Real theta) override
Resets the current time in the context.
unsigned char get_edge() const
Accessor for current edge of Elem object.
void interior_div(unsigned int var, unsigned int qp, OutputType &div_u) const
const DenseVector< Number > & get_elem_solution_accel() const
Accessor for element solution accel of change w.r.t.
Tensor fixed_interior_hessian(unsigned int var, unsigned int qp) const
std::vector< std::vector< FEAbstract * > > _element_fe_var
Pointers to the same finite element objects, but indexed by variable number.
virtual bool is_steady() const =0
Is this effectively a steady-state solver?
Number interior_value(unsigned int var, unsigned int qp) const
Tensor fixed_point_hessian(unsigned int var, const Point &p) const
std::vector< FEAbstract * > _edge_fe_var
virtual void elem_reinit(Real theta) override
Resets the current time in the context.
void side_hessians(unsigned int var, const NumericVector< Number > &_system_vector, std::vector< OutputType > &d2u_vals) const
Fills a vector of hessians of the _system_vector at the all the quadrature points on the current elem...
Gradient fixed_interior_gradient(unsigned int var, unsigned int qp) const
std::unique_ptr< QBase > unweighted_quadrature_rule(const unsigned int dim, const int extraorder=0) const