4 #include "libmesh/getpot.h"     5 #include "libmesh/fe_base.h"     6 #include "libmesh/quadrature.h"     7 #include "libmesh/string_to_enum.h"     8 #include "libmesh/parallel.h"     9 #include "libmesh/fem_context.h"    20     this->add_variable (
"T", static_cast<Order>(_fe_order),
    21                         Utility::string_to_enum<FEFamily>(_fe_family));
    23   GetPot infile(
"l-shaped.in");
    24   exact_QoI[0] = infile(
"QoI_0", 0.0);
    25   exact_QoI[1] = infile(
"QoI_1", 0.0);
    31   this->time_evolving(T_var, 1);
    36   FEMContext & c = cast_ref<FEMContext &>(context);
    40   FEBase * elem_fe = 
nullptr;
    47   FEBase * side_fe = 
nullptr;
    55 #define optassert(X) {if (!(X)) libmesh_error_msg("Assertion " #X " failed.");}    64   FEMContext & c = cast_ref<FEMContext &>(context);
    68   FEBase * elem_fe = 
nullptr;
    72   const std::vector<Real> & JxW = elem_fe->get_JxW();
    75   const std::vector<std::vector<RealGradient>> & dphi = elem_fe->get_dphi();
    92   for (
unsigned int qp=0; qp != n_qpoints; qp++)
    98       for (
unsigned int i=0; i != n_T_dofs; i++)
    99         F(i) += JxW[qp] * (grad_T * dphi[i][qp]);
   101         for (
unsigned int i=0; i != n_T_dofs; i++)
   102           for (
unsigned int j=0; j != n_T_dofs; ++j)
   104             K(i,j) += JxW[qp] * (dphi[i][qp] * dphi[j][qp]);
   117   FEMContext & c = cast_ref<FEMContext &>(context);
   121   FEBase * side_fe = 
nullptr;
   125   const std::vector<Real> & JxW = side_fe->get_JxW();
   128   const std::vector<std::vector<Real>> & phi = side_fe->get_phi();
   131   const std::vector<Point > & qside_point = side_fe->get_xyz();
   144   for (
unsigned int qp=0; qp != n_qpoints; qp++)
   153       for (
unsigned int i=0; i != n_T_dofs; i++)
   154         F(i) += JxW[qp] * penalty * (T - u_dirichlet) * phi[i][qp];
   156         for (
unsigned int i=0; i != n_T_dofs; i++)
   157           for (
unsigned int j=0; j != n_T_dofs; ++j)
   159             K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp];
   171   computed_QoI[0] = 0.0;
   172   computed_QoI[1] = 0.0;
   176   this->comm().sum(computed_QoI[0]);
   178   this->comm().sum(computed_QoI[1]);
   186   const Real x1 = p(0);
   187   const Real x2 = p(1);
   189   Real theta = atan2(x2, x1);
   195   return pow(x1*x1 + x2*x2, 1./3.)*sin(2./3.*theta);
 virtual void init_context(DiffContext &context)
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian. 
Number side_value(unsigned int var, unsigned int qp) const
This class provides all data required for a physics package (e.g. 
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...
Number(* exact_solution)(const Point &p, const Parameters &, const std::string &, const std::string &)
static constexpr Real TOLERANCE
unsigned int n_dof_indices() const
Total number of dof indices on the element. 
virtual bool element_time_derivative(bool request_jacobian, DiffContext &context)
Adds the time derivative contribution on elem to elem_residual. 
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space. 
The libMesh namespace provides an interface to certain functionality in the library. 
void compute_jacobian(const NumericVector< Number > &, SparseMatrix< Number > &J, NonlinearImplicitSystem &system)
Defines a dense subvector for use in finite element computations. 
const std::vector< std::vector< OutputGradient > > & get_dphi() const
Gradient interior_gradient(unsigned int var, unsigned int qp) const
Defines a dense submatrix for use in Finite Element-type computations. 
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used...
virtual_for_inffe const std::vector< Real > & get_JxW() const
This class provides all data required for a physics package (e.g. 
unsigned int n_points() const
virtual void postprocess() override
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides...
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual. 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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...
LaplaceExactSolution exact_solution
virtual bool side_constraint(bool request_jacobian, DiffContext &context)
Adds the constraint contribution on side of elem to elem_residual. 
A Point defines a location in LIBMESH_DIM dimensional Real space. 
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used...
virtual void postprocess()
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides...
This class forms the foundation from which generic finite elements may be derived. 
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem. 
const QBase & get_side_qrule() const
Accessor for element side quadrature rule for the dimension of the current _elem. ...
const std::vector< std::vector< OutputShape > > & get_phi() const