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"
21 Utility::string_to_enum<FEFamily>(
_fe_family));
23 GetPot infile(
"l-shaped.in");
28 FEMSystem::init_data();
36 FEMContext & c = cast_ref<FEMContext &>(context);
40 FEBase * elem_fe =
nullptr;
45 FEBase * side_fe =
nullptr;
52#define optassert(X) {if (!(X)) libmesh_error_msg("Assertion " #X " failed.");}
61 FEMContext & c = cast_ref<FEMContext &>(context);
65 FEBase * elem_fe =
nullptr;
69 const std::vector<Real> & JxW = elem_fe->
get_JxW();
72 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->
get_dphi();
89 for (
unsigned int qp=0; qp != n_qpoints; qp++)
95 for (
unsigned int i=0; i != n_T_dofs; i++)
98 for (
unsigned int i=0; i != n_T_dofs; i++)
99 for (
unsigned int j=0; j != n_T_dofs; ++j)
114 FEMContext & c = cast_ref<FEMContext &>(context);
118 FEBase * side_fe =
nullptr;
122 const std::vector<Real> & JxW = side_fe->
get_JxW();
125 const std::vector<std::vector<Real>> & phi = side_fe->
get_phi();
128 const std::vector<Point > & qside_point = side_fe->
get_xyz();
141 for (
unsigned int qp=0; qp != n_qpoints; qp++)
150 for (
unsigned int i=0; i != n_T_dofs; i++)
151 F(i) += JxW[qp] * penalty * (T - u_dirichlet) * phi[i][qp];
153 for (
unsigned int i=0; i != n_T_dofs; i++)
154 for (
unsigned int j=0; j != n_T_dofs; ++j)
156 K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp];
167 const Real x1 = p(0);
168 const Real x2 = p(1);
170 Real theta = atan2(x2, x1);
virtual bool element_time_derivative(bool request_jacobian, DiffContext &context)
Adds the time derivative contribution on elem to elem_residual.
LaplaceExactSolution exact_solution
virtual bool side_constraint(bool request_jacobian, DiffContext &context)
Adds the constraint contribution on side of elem to elem_residual.
std::vector< Number > parameters
virtual void init_context(DiffContext &context)
virtual void init_data()
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.
Defines a dense subvector for use in finite element computations.
This class provides all data required for a physics package (e.g.
unsigned int n_dof_indices() const
Total number of dof indices on the element.
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
virtual void time_evolving(unsigned int var, unsigned int order)
Tells the DiffSystem that variable var is evolving with respect to time.
virtual_for_inffe const std::vector< Real > & get_JxW() const
virtual_for_inffe const std::vector< Point > & get_xyz() const
This class forms the foundation from which generic finite elements may be derived.
const std::vector< std::vector< OutputShape > > & get_phi() const
const std::vector< std::vector< OutputGradient > > & get_dphi() 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...
Gradient interior_gradient(unsigned int var, unsigned int qp) const
Number side_value(unsigned int var, unsigned int qp) const
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem.
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 QBase & get_side_qrule() const
Accessor for element side quadrature rule for the dimension of the current _elem.
A Point defines a location in LIBMESH_DIM dimensional Real space.
unsigned int n_points() const
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.
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.
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void compute_jacobian(const NumericVector< Number > &, SparseMatrix< Number > &J, NonlinearImplicitSystem &system)