20#include "libmesh/getpot.h"
24#include "libmesh/fe_base.h"
25#include "libmesh/fe_interface.h"
26#include "libmesh/fem_context.h"
27#include "libmesh/mesh.h"
28#include "libmesh/quadrature.h"
29#include "libmesh/string_to_enum.h"
30#include "libmesh/system.h"
31#include "libmesh/equation_systems.h"
32#include "libmesh/zero_function.h"
33#include "libmesh/const_function.h"
34#include "libmesh/dirichlet_boundaries.h"
35#include "libmesh/dof_map.h"
36#include "libmesh/numeric_vector.h"
37#include "heatsystem.h"
43 GetPot infile(
"heat.in");
44 _k = infile(
"k", 1.0);
65 FEMContext & c = cast_ref<FEMContext &>(context);
67 FEBase * elem_fe =
nullptr;
78 FEBase * side_fe =
nullptr;
91 const_cast<System &
>(sys).get_adjoint_solution(0);
98 const_cast<System &
>(sys).get_adjoint_solution(1);
111 FEMContext & c = cast_ref<FEMContext &>(context);
115 FEBase * elem_fe =
nullptr;
119 const std::vector<Real> & JxW = elem_fe->
get_JxW();
122 const std::vector<std::vector<Real>> & phi = elem_fe->
get_phi();
123 const std::vector<std::vector<RealGradient>> & dphi = elem_fe->
get_dphi();
133 const std::vector<Point > & q_point = elem_fe->
get_xyz();
149 for (
unsigned int qp=0; qp != n_qpoints; qp++)
155 const Real x = q_point[qp](0);
160 for (
unsigned int i=0; i != n_u_dofs; i++)
162F(i) += JxW[qp] * ( ( -sigma * (grad_T * dphi[i][qp]) ) + (f * phi[i][qp]) );
166 for (
unsigned int i=0; i != n_u_dofs; i++)
167 for (
unsigned int j=0; j != n_u_dofs; ++j)
168 K(i,j) += JxW[qp] * -sigma * (dphi[i][qp] * dphi[j][qp]);
176 return std::make_unique<SigmaPhysics>(*
this);
virtual void init_data(System &sys)
virtual std::unique_ptr< DifferentiablePhysics > clone_physics() override
Copy of this object.
virtual void init_context(DiffContext &context) override
virtual bool element_time_derivative(bool request_jacobian, DiffContext &context) override
Adds the time derivative contribution on elem to elem_residual.
Function that returns a single value that never changes.
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.
bool is_adjoint() const
Accessor for querying whether we need to do a primal or adjoint solve.
unsigned int n_dof_indices() const
Total number of dof indices on the element.
const System & get_system() const
Accessor for associated system.
void add_localized_vector(NumericVector< Number > &localized_vector, const System &sys)
Adds a vector to the map of localized vectors.
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.
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
void add_adjoint_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary, unsigned int q)
Adds a copy of the specified Dirichlet boundary to the system, corresponding to the adjoint problem d...
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
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.
This class provides a specific system class.
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
unsigned int n_points() const
Manages consistently variables, degrees of freedom, and coefficient vectors.
const DofMap & get_dof_map() const
This class defines a vector in LIBMESH_DIM dimensional Real or Complex space.
ConstFunction that simply returns 0.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void compute_jacobian(const NumericVector< Number > &, SparseMatrix< Number > &J, NonlinearImplicitSystem &system)