Go to the documentation of this file.
20 #include "libmesh/fe_base.h"
21 #include "libmesh/fe_interface.h"
22 #include "libmesh/fem_context.h"
23 #include "libmesh/getpot.h"
24 #include "libmesh/mesh.h"
25 #include "libmesh/quadrature.h"
26 #include "libmesh/string_to_enum.h"
32 for (
auto & pr : input_contexts)
38 this->add_variable (
"u", static_cast<Order>(_fe_order),
39 Utility::string_to_enum<FEFamily>(_fe_family));
49 FEMContext & c = cast_ref<FEMContext &>(context);
59 FEMContext *& input_context = input_contexts[&c];
66 goal_func->init_context(*input_context);
76 FEMContext & c = cast_ref<FEMContext &>(context);
84 const std::vector<std::vector<Real>> & phi = c.
get_element_fe(0)->get_phi();
101 input_c.elem_fe_reinit();
103 for (
unsigned int qp=0; qp != n_qpoints; qp++)
107 Number ufunc = (*goal_func)(input_c, xyz[qp]);
109 for (
unsigned int i=0; i != n_u_dofs; i++)
110 F(i) += JxW[qp] * ((u - ufunc) * phi[i][qp]);
111 if (request_jacobian)
113 const Number JxWxD = JxW[qp] *
116 for (
unsigned int i=0; i != n_u_dofs; i++)
117 for (
unsigned int j=0; j != n_u_dofs; ++j)
118 K(i,j) += JxWxD * (phi[i][qp] * phi[j][qp]);
122 return request_jacobian;
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem.
virtual void init_context(DiffContext &) override
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
Defines a dense submatrix for use in Finite Element-type computations.
unsigned int n_points() const
The libMesh namespace provides an interface to certain functionality in the library.
Real get_elem_solution_derivative() const
The derivative of the current elem_solution w.r.t.
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
const Elem & get_elem() const
Accessor for current Elem object.
virtual void init_context(libMesh::DiffContext &context)
virtual bool element_time_derivative(bool request_jacobian, libMesh::DiffContext &context)
Adds the time derivative contribution on elem to elem_residual.
unsigned int n_dof_indices() const
Total number of dof indices on the element.
This class provides all data required for a physics package (e.g.
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.
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
Number interior_value(unsigned int var, unsigned int qp) const
This class provides all data required for a physics package (e.g.