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;
47 FEBase * side_fe =
nullptr;
56#define optassert(X) {if (!(X)) libmesh_error_msg("Assertion " #X " failed.");}
65 FEMContext & c = cast_ref<FEMContext &>(context);
69 FEBase * elem_fe =
nullptr;
73 const std::vector<Real> & JxW = elem_fe->
get_JxW();
76 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->
get_dphi();
93 for (
unsigned int qp=0; qp != n_qpoints; qp++)
99 for (
unsigned int i=0; i != n_T_dofs; i++)
100 F(i) += JxW[qp] * (grad_T * dphi[i][qp]);
102 for (
unsigned int i=0; i != n_T_dofs; i++)
103 for (
unsigned int j=0; j != n_T_dofs; ++j)
105 K(i,j) += JxW[qp] * (dphi[i][qp] * dphi[j][qp]);
118 FEMContext & c = cast_ref<FEMContext &>(context);
122 FEBase * side_fe =
nullptr;
126 const std::vector<Real> & JxW = side_fe->
get_JxW();
129 const std::vector<std::vector<Real>> & phi = side_fe->
get_phi();
132 const std::vector<Point > & qside_point = side_fe->
get_xyz();
145 for (
unsigned int qp=0; qp != n_qpoints; qp++)
154 for (
unsigned int i=0; i != n_T_dofs; i++)
155 F(i) += JxW[qp] * penalty * (T - u_dirichlet) * phi[i][qp];
158 for (
unsigned int i=0; i != n_T_dofs; i++)
159 for (
unsigned int j=0; j != n_T_dofs; ++j)
161 K(i,j) += JxW[qp] * penalty * phi[i][qp] * phi[j][qp];
176 FEMSystem::postprocess();
188 const Real x1 = p(0);
189 const Real x2 = p(1);
191 Real theta = atan2(x2, x1);
197 return pow(x1*x1 + x2*x2, 1./3.)*sin(2./3.*theta);
virtual bool element_time_derivative(bool request_jacobian, DiffContext &context)
Adds the time derivative contribution on elem to elem_residual.
LaplaceExactSolution exact_solution
virtual void postprocess()
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides.
virtual bool side_constraint(bool request_jacobian, DiffContext &context)
Adds the constraint contribution on side of elem to elem_residual.
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.
const Parallel::Communicator & comm() const
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)