20#include "libmesh/dof_map.h"
21#include "libmesh/elem.h"
22#include "libmesh/equation_systems.h"
23#include "libmesh/fe_base.h"
24#include "libmesh/fem_context.h"
25#include "libmesh/fem_system.h"
26#include "libmesh/libmesh_logging.h"
27#include "libmesh/mesh_base.h"
28#include "libmesh/numeric_vector.h"
29#include "libmesh/parallel_algebra.h"
30#include "libmesh/parallel_ghost_sync.h"
31#include "libmesh/quadrature.h"
32#include "libmesh/sparse_matrix.h"
33#include "libmesh/time_solver.h"
34#include "libmesh/unsteady_solver.h"
35#include "libmesh/fe_interface.h"
41femsystem_mutex assembly_mutex;
43void assemble_unconstrained_element_system(
const FEMSystem & _sys,
44 const bool _get_jacobian,
45 const bool _constrain_heterogeneously,
70 const bool need_jacobian =
71 (_get_jacobian || _constrain_heterogeneously);
73 bool jacobian_computed =
74 _sys.
time_solver->element_residual(need_jacobian, _femcontext);
77 if (need_jacobian && !jacobian_computed)
87 if (need_jacobian && jacobian_computed &&
96 Real analytic_norm = analytic_jacobian.l1_norm();
104 Real error_norm = analytic_jacobian.l1_norm();
106 Real relative_error = error_norm /
107 std::max(analytic_norm, numerical_norm);
112 <<
" detected in analytic jacobian on element "
113 << _femcontext.
get_elem().
id() <<
'!' << std::endl;
121 << analytic_jacobian << std::endl;
125 libmesh_error_msg(
"Relative error too large, exiting!");
130 for (_femcontext.
side = 0; _femcontext.
side != n_sides;
159 _sys.
time_solver->side_residual(need_jacobian, _femcontext);
162 if (need_jacobian && !jacobian_computed)
170 if (old_jacobian.
m())
187 else if (need_jacobian && jacobian_computed &&
196 Real analytic_norm = analytic_jacobian.l1_norm();
204 Real error_norm = analytic_jacobian.l1_norm();
206 Real relative_error = error_norm /
207 std::max(analytic_norm, numerical_norm);
212 <<
" detected in analytic jacobian on element "
215 <<
static_cast<unsigned int>(_femcontext.
side) <<
'!' << std::endl;
223 << analytic_jacobian << std::endl;
226 libmesh_error_msg(
"Relative error too large, exiting!");
245 const bool _get_residual,
246 const bool _get_jacobian,
247 const bool _constrain_heterogeneously,
248 const bool _no_constraints,
251#ifdef LIBMESH_ENABLE_CONSTRAINTS
280 if (_get_residual && _get_jacobian)
282 if (constrain_in_solver)
284 if (_constrain_heterogeneously)
289 else if (!_no_constraints)
295 else if (!_no_constraints)
303 else if (_get_residual)
305 if (constrain_in_solver)
307 if (_constrain_heterogeneously)
312 else if (!_no_constraints)
317 else if (!_no_constraints)
324 else if (_get_jacobian)
329 if (!_no_constraints)
332 !constrain_in_solver);
363 femsystem_mutex::scoped_lock lock(assembly_mutex);
376class AssemblyContributions
385 bool constrain_heterogeneously,
386 bool no_constraints) :
388 _get_residual(get_residual),
389 _get_jacobian(get_jacobian),
390 _constrain_heterogeneously(constrain_heterogeneously),
391 _no_constraints(no_constraints) {}
399 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
402 for (
const auto & elem : range)
407 assemble_unconstrained_element_system
408 (_sys, _get_jacobian, _constrain_heterogeneously, _femcontext);
411 (_sys, _get_residual, _get_jacobian,
412 _constrain_heterogeneously, _no_constraints, _femcontext);
420 const bool _get_residual, _get_jacobian, _constrain_heterogeneously, _no_constraints;
423class PostprocessContributions
430 PostprocessContributions(
FEMSystem & sys) : _sys(sys) {}
438 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
441 for (
const auto & elem : range)
452 for (_femcontext.
side = 0; _femcontext.
side != n_sides;
475class QoIContributions
484 const QoISet & qoi_indices) :
485 qoi(sys.n_qois(), 0.), _sys(sys), _diff_qoi(diff_qoi),_qoi_indices(qoi_indices) {}
490 QoIContributions(
const QoIContributions & other,
492 qoi(other._sys.n_qois(), 0.), _sys(other._sys), _diff_qoi(other._diff_qoi) {}
500 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
501 _diff_qoi.init_context(_femcontext);
503 bool have_some_heterogenous_qoi_bc =
false;
504#ifdef LIBMESH_ENABLE_CONSTRAINTS
505 std::vector<bool> have_heterogenous_qoi_bc(_sys.
n_qois(),
false);
507 if (_qoi_indices.has_index(q) &&
508 _sys.get_dof_map().has_heterogenous_adjoint_constraints(q))
510 have_heterogenous_qoi_bc[q] =
true;
511 have_some_heterogenous_qoi_bc =
true;
515 if (have_some_heterogenous_qoi_bc)
518 for (
const auto & elem : range)
524 bool elem_has_some_heterogenous_qoi_bc =
false;
526#ifdef LIBMESH_ENABLE_CONSTRAINTS
527 const unsigned int n_dofs =
530 std::vector<bool> elem_has_heterogenous_qoi_bc(_sys.
n_qois(),
false);
531 if (have_some_heterogenous_qoi_bc)
535 if (have_heterogenous_qoi_bc[q])
538 if (_sys.get_dof_map().has_heterogenous_adjoint_constraint
539 (q, _femcontext.get_dof_indices()[d]) !=
Number(0))
541 elem_has_some_heterogenous_qoi_bc =
true;
542 elem_has_heterogenous_qoi_bc[q] =
true;
550 if (_diff_qoi.assemble_qoi_elements ||
551 elem_has_some_heterogenous_qoi_bc)
554 if (_diff_qoi.assemble_qoi_elements)
555 _diff_qoi.element_qoi(_femcontext, _qoi_indices);
560#ifdef LIBMESH_ENABLE_CONSTRAINTS
561 if (elem_has_some_heterogenous_qoi_bc)
563 _sys.
time_solver->element_residual(
false, _femcontext);
567 if (elem_has_heterogenous_qoi_bc[q])
570 this->qoi[q] -= _femcontext.get_elem_residual()(d) *
571 _sys.get_dof_map().has_heterogenous_adjoint_constraint(q, _femcontext.get_dof_indices()[d]);
579 for (_femcontext.
side = 0; _femcontext.
side != n_sides;
583 if (!_diff_qoi.assemble_qoi_sides ||
584 (!_diff_qoi.assemble_qoi_internal_sides &&
590 _diff_qoi.side_qoi(_femcontext, _qoi_indices);
594 this->_diff_qoi.thread_join( this->qoi, _femcontext.
get_qois(), _qoi_indices );
597 void join (
const QoIContributions & other)
599 libmesh_assert_equal_to (this->qoi.size(), other.qoi.size());
600 this->_diff_qoi.thread_join( this->qoi, other.qoi, _qoi_indices );
603 std::vector<Number> qoi;
610 const QoISet _qoi_indices;
613class QoIDerivativeContributions
619 QoIDerivativeContributions(
FEMSystem & sys,
620 const QoISet & qoi_indices,
622 bool include_liftfunc,
623 bool apply_constraints) :
625 _qoi_indices(qoi_indices),
627 _include_liftfunc(include_liftfunc),
628 _apply_constraints(apply_constraints) {}
636 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
637 _qoi.init_context(_femcontext);
639 bool have_some_heterogenous_qoi_bc =
false;
640#ifdef LIBMESH_ENABLE_CONSTRAINTS
641 std::vector<bool> have_heterogenous_qoi_bc(_sys.
n_qois(),
false);
642 if (_include_liftfunc || _apply_constraints)
644 if (_qoi_indices.has_index(q) &&
645 _sys.get_dof_map().has_heterogenous_adjoint_constraints(q))
647 have_heterogenous_qoi_bc[q] =
true;
648 have_some_heterogenous_qoi_bc =
true;
652 if (have_some_heterogenous_qoi_bc)
655 for (
const auto & elem : range)
661 bool elem_has_some_heterogenous_qoi_bc =
false;
663#ifdef LIBMESH_ENABLE_CONSTRAINTS
664 const unsigned int n_dofs =
667 std::vector<bool> elem_has_heterogenous_qoi_bc(_sys.
n_qois(),
false);
668 if (have_some_heterogenous_qoi_bc)
672 if (have_heterogenous_qoi_bc[q])
675 if (_sys.get_dof_map().has_heterogenous_adjoint_constraint
676 (q, _femcontext.get_dof_indices()[d]) !=
Number(0))
678 elem_has_some_heterogenous_qoi_bc =
true;
679 elem_has_heterogenous_qoi_bc[q] =
true;
692 if (_qoi.assemble_qoi_elements ||
693 ((_include_liftfunc || _apply_constraints) &&
694 elem_has_some_heterogenous_qoi_bc))
697 if (_qoi.assemble_qoi_elements)
698 _qoi.element_qoi_derivative(_femcontext, _qoi_indices);
700#ifdef LIBMESH_ENABLE_CONSTRAINTS
704 if ((_include_liftfunc || _apply_constraints) &&
705 elem_has_some_heterogenous_qoi_bc)
707 bool jacobian_computed = _sys.
time_solver->element_residual(
true, _femcontext);
710 if (!jacobian_computed)
722 if (_include_liftfunc && elem_has_some_heterogenous_qoi_bc)
726 if (elem_has_heterogenous_qoi_bc[q])
733 if (liftfunc_val !=
Number(0))
736 _femcontext.get_qoi_derivatives()[q](j) -=
737 _femcontext.get_elem_jacobian()(i,j) *
748 for (_femcontext.
side = 0; _femcontext.
side != n_sides;
752 if (!_qoi.assemble_qoi_sides ||
753 (!_qoi.assemble_qoi_internal_sides &&
759 _qoi.side_qoi_derivative(_femcontext, _qoi_indices);
766#ifdef LIBMESH_ENABLE_CONSTRAINTS
767 std::vector<dof_id_type> original_dofs = _femcontext.
get_dof_indices();
771 femsystem_mutex::scoped_lock lock(assembly_mutex);
773#ifdef LIBMESH_ENABLE_CONSTRAINTS
777 if (_apply_constraints)
782 if (_qoi_indices.has_index(i))
784#ifdef LIBMESH_ENABLE_CONSTRAINTS
785 if (_apply_constraints)
788 bool has_heterogenous_constraint =
false;
790 if (_sys.get_dof_map().has_heterogenous_adjoint_constraint
791 (i, _femcontext.get_dof_indices()[d]) !=
Number(0))
793 has_heterogenous_constraint =
true;
799 bool has_heterogenous_constraint =
800 elem_has_heterogenous_qoi_bc[i];
805 if (has_heterogenous_constraint)
811 (elem_jacobian_transpose);
814 (elem_jacobian_transpose,
837 const QoISet & _qoi_indices;
839 bool _include_liftfunc, _apply_constraints;
854 const std::string & name_in,
855 const unsigned int number_in)
856 :
Parent(es, name_in, number_in),
857 fe_reinit_during_postprocess(true),
859 verify_analytic_jacobians(0.0)
876 bool apply_heterogeneous_constraints,
877 bool apply_no_constraints)
882#ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING
883 const char * log_name;
884 if (get_residual && get_jacobian)
885 log_name =
"assembly()";
886 else if (get_residual)
887 log_name =
"assembly(get_residual)";
889 log_name =
"assembly(get_jacobian)";
891 LOG_SCOPE(log_name,
"FEMSystem");
912 <<
"];" << std::endl;
926 libMesh::err <<
"WARNING! verify_analytic_jacobians was set "
927 <<
"to absurdly large value of "
942 AssemblyContributions(*
this, get_residual, get_jacobian,
943 apply_heterogeneous_constraints,
944 apply_no_constraints));
947 bool have_scalar =
false;
962 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
966 bool jacobian_computed =
967 this->
time_solver->nonlocal_residual(get_jacobian, _femcontext);
975 if (get_jacobian && !jacobian_computed)
985 if (get_jacobian && jacobian_computed &&
1004 Real relative_error = error_norm /
1005 std::max(analytic_norm, numerical_norm);
1010 <<
" detected in analytic jacobian on nonlocal dofs!"
1019 << analytic_jacobian << std::endl;
1023 libmesh_error_msg(
"Relative error too large, exiting!");
1028 (*
this, get_residual, get_jacobian,
1029 apply_heterogeneous_constraints, apply_no_constraints, _femcontext);
1090 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
1094 for (
const auto & elem :
mesh.active_local_element_ptr_range())
1116 (this->
comm(), mesh.nodes_begin(),
mesh.nodes_end(), sync_object);
1123 LOG_SCOPE(
"postprocess()",
"FEMSystem");
1135 PostprocessContributions(*
this));
1142 LOG_SCOPE(
"assemble_qoi()",
"FEMSystem");
1148 const unsigned int Nq = this->
n_qois();
1152 for (
unsigned int i=0; i != Nq; ++i)
1158 QoIContributions qoi_contributions(*
this, *(this->
get_qoi()), qoi_indices);
1166 this->
set_qoi(std::move(global_qoi));
1172 bool include_liftfunc,
1173 bool apply_constraints)
1175 LOG_SCOPE(
"assemble_qoi_derivative()",
"FEMSystem");
1189 QoIDerivativeContributions(*
this, qoi_indices,
1192 apply_constraints));
1214 Real numerical_point_h = 0.;
1218 const unsigned int n_dofs =
1239 const unsigned int total_j = j + j_offset;
1246 Real * coord =
nullptr;
1265 ((*time_solver).*(res))(
false, context);
1279 ((*time_solver).*(res))(
false, context);
1290 numeric_jacobian(i,total_j) =
1292 2. / numerical_point_h;
1299 numeric_jacobian(i,total_j) =
1315 LOG_SCOPE(
"numerical_elem_jacobian()",
"FEMSystem");
1323 LOG_SCOPE(
"numerical_side_jacobian()",
"FEMSystem");
1331 LOG_SCOPE(
"numerical_nonlocal_jacobian()",
"FEMSystem");
1339 auto fc = std::make_unique<FEMContext>(*
this);
1351 fc->set_deltat_pointer( &
deltat );
1375 FEMContext & context = cast_ref<FEMContext &>(c);
1386 FEBase * elem_fe =
nullptr;
1407 libmesh_error_msg(
"Unrecognized field type!");
1418 libmesh_error_msg_if(!
_mesh_sys,
"_mesh_sys was nullptr!");
1422 libmesh_not_implemented();
1428 FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
1432 for (
const auto & elem :
mesh.active_local_element_ptr_range())
std::streamsize precision() const
Get the associated write precision.
Defines a dense matrix for use in Finite Element-type computations.
void get_transpose(DenseMatrix< T > &dest) const
Put the tranposed matrix into dest.
void swap(DenseMatrix< T > &other_matrix)
STL-like swap method.
std::enable_if< ScalarTraits< T2 >::value, void >::type add(const T2 factor, const DenseMatrix< T3 > &mat)
Adds factor times mat to this matrix.
virtual void zero() override final
Sets all elements of the matrix to 0 and resets any decomposition flag which may have been previously...
Defines a dense vector for use in Finite Element-type computations.
virtual void zero() override final
Set every element in the vector to 0.
virtual unsigned int size() const override final
This class provides all data required for a physics package (e.g.
const std::vector< Number > & get_qois() const
Const accessor for QoI vector.
unsigned int n_vars() const
Number of variables in solution.
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
void set_deltat_pointer(Real *dt)
Points the _deltat member of this class at a timestep value stored in the creating System,...
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
This class provides a specific system class.
unsigned int get_mesh_y_var() const
unsigned int get_mesh_x_var() const
const System * get_mesh_system() const
unsigned int _mesh_x_var
Variables from which to acquire moving mesh information.
bool is_time_evolving(unsigned int var) const
bool compute_internal_sides
compute_internal_sides is false by default, indicating that side_* computations will only be done on ...
unsigned int get_mesh_z_var() const
System * _mesh_sys
System from which to acquire moving mesh information.
This class provides a specific system class.
virtual void finalize_derivative(NumericVector< Number > &derivatives, std::size_t qoi_index)
Method to finalize qoi derivatives which require more than just a simple sum of element contributions...
virtual void parallel_op(const Parallel::Communicator &communicator, std::vector< Number > &sys_qoi, std::vector< Number > &local_qoi, const QoISet &qoi_indices)
Method to populate system qoi data structure with process-local qoi.
This class provides a specific system class.
bool print_jacobians
Set print_jacobians to true to print J whenever it is assembled.
virtual bool get_constrain_in_solver()
const DifferentiablePhysics * get_physics() const
bool postprocess_sides
If postprocess_sides is true (it is false by default), the postprocessing loop will loop over all sid...
bool print_residuals
Set print_residuals to true to print F whenever it is assembled.
Real deltat
For time-dependent problems, this is the amount delta t to advance the solution in time.
bool print_element_jacobians
Set print_element_jacobians to true to print each J_elem contribution.
bool print_solution_norms
Set print_residual_norms to true to print |U| whenever it is used in an assembly() call.
virtual void element_postprocess(DiffContext &)
Does any work that needs to be done on elem in a postprocessing loop.
bool print_solutions
Set print_solutions to true to print U whenever it is used in an assembly() call.
bool print_element_solutions
Set print_element_solutions to true to print each U_elem input.
bool print_residual_norms
Set print_residual_norms to true to print |F| whenever it is assembled.
TimeSolver & get_time_solver()
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
bool print_element_residuals
Set print_element_residuals to true to print each R_elem contribution.
bool print_jacobian_norms
Set print_jacobian_norms to true to print |J| whenever it is assembled.
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
const DifferentiableQoI * get_qoi() const
virtual void solve() override
Invokes the solver associated with the system.
virtual void side_postprocess(DiffContext &)
Does any work that needs to be done on side of elem in a postprocessing loop.
void heterogeneously_constrain_element_residual(DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element residual.
void heterogeneously_constrain_element_jacobian_and_residual(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, NumericVector< Number > &solution_local) const
Constrains the element Jacobian and residual.
Number has_heterogenous_adjoint_constraint(const unsigned int qoi_num, const dof_id_type dof) const
Backwards compatibility with misspelling.
void constrain_element_matrix(DenseMatrix< Number > &matrix, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix.
void constrain_nothing(std::vector< dof_id_type > &dofs) const
Does not actually constrain anything, but modifies dofs in the same way as any of the constrain funct...
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
Constrains the element vector.
void heterogenously_constrain_element_vector(const DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true, int qoi_index=-1) const
void heterogenously_constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true, int qoi_index=-1) const
void constrain_element_matrix_and_vector(DenseMatrix< Number > &matrix, DenseVector< Number > &rhs, std::vector< dof_id_type > &elem_dofs, bool asymmetric_constraint_rows=true) const
Constrains the element matrix and vector.
const Point & point(const unsigned int i) const
bool has_children() const
virtual Real hmin() const
virtual unsigned int n_sides() const =0
const Elem * neighbor_ptr(unsigned int i) const
This is the EquationSystems class.
NumericVector< Number > * rhs
The system matrix.
virtual_for_inffe const std::vector< Real > & get_JxW() const
This class forms the foundation from which generic finite elements may be derived.
const std::vector< std::vector< OutputShape > > & get_phi() const
static FEFieldType field_type(const FEType &fe_type)
This class provides all data required for a physics package (e.g.
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
const std::set< unsigned char > & elem_dimensions() const
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
unsigned char side
Current side for side_* to examine.
const Elem & get_elem() const
Accessor for current Elem object.
void elem_position_get()
Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration.
void elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
bool has_elem() const
Test for current Elem object.
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
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.
virtual void solve() override
Invokes the solver associated with the system.
bool fe_reinit_during_postprocess
If fe_reinit_during_postprocess is true (it is true by default), FE objects will be reinit()ed with t...
virtual void assemble_qoi(const QoISet &indices=QoISet()) override
Runs a qoi assembly loop over all elements, and if assemble_qoi_sides is true over all sides.
void numerical_side_jacobian(FEMContext &context) const
Uses the results of multiple side_residual() calls to numerically differentiate the corresponding jac...
Real numerical_jacobian_h
If calculating numeric jacobians is required, the FEMSystem will perturb each solution vector entry b...
virtual void assembly(bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) override
Prepares matrix or rhs for matrix assembly.
void mesh_position_get()
Tells the FEMSystem to set the degree of freedom coefficients which should correspond to mesh nodal c...
void numerical_elem_jacobian(FEMContext &context) const
Uses the results of multiple element_residual() calls to numerically differentiate the corresponding ...
virtual std::unique_ptr< DiffContext > build_context() override
Builds a FEMContext object with enough information to do evaluations on each element.
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
Real numerical_jacobian_h_for_var(unsigned int var_num) const
If numerical_jacobian_h_for_var(var_num) is changed from its default value (numerical_jacobian_h),...
void mesh_position_set()
Tells the FEMSystem to set the mesh nodal coordinates which should correspond to degree of freedom co...
FEMSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
void numerical_nonlocal_jacobian(FEMContext &context) const
Uses the results of multiple side_residual() calls to numerically differentiate the corresponding jac...
void numerical_jacobian(TimeSolverResPtr res, FEMContext &context) const
Uses the results of multiple res calls to numerically differentiate the corresponding jacobian.
virtual void postprocess() override
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides.
virtual void init_context(DiffContext &) override
virtual void assemble_qoi_derivative(const QoISet &qoi_indices=QoISet(), bool include_liftfunc=true, bool apply_constraints=true) override
Runs a qoi derivative assembly loop over all elements, and if assemble_qoi_sides is true over all sid...
Real verify_analytic_jacobians
If verify_analytic_jacobian is equal to zero (as it is by default), no numeric jacobians will be calc...
FEFamily family
The type of finite element.
const SparseMatrix< Number > & get_system_matrix() const
SparseMatrix< Number > * matrix
The system matrix.
This is the MeshBase class.
const ConstElemRange & active_local_element_stored_range() const
virtual Real l1_norm() const =0
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
virtual void zero()=0
Set all entries to zero.
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
processor_id_type n_processors() const
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
bool has_index(std::size_t) const
Return whether or not this index is in the set to be calculated.
virtual Real l1_norm() const =0
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
virtual void add_matrix(const DenseMatrix< T > &dm, const std::vector< numeric_index_type > &rows, const std::vector< numeric_index_type > &cols)=0
Add the full matrix dm to the SparseMatrix.
virtual void zero()=0
Set all entries to 0.
The StoredRange class defines a contiguous, divisible set of objects.
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
std::unique_ptr< NumericVector< Number > > current_local_solution
All the values I need to compute my contribution to the simulation at hand.
void set_qoi(unsigned int qoi_index, Number qoi_value)
dof_id_type n_dofs() const
const FEType & variable_type(const unsigned int i) const
std::vector< Number > get_qoi_values() const
Returns a copy of qoi, not a reference.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
unsigned int n_qois() const
Number of currently active quantities of interest.
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
virtual void update()
Update the local values to reflect the solution on neighboring processors.
unsigned int n_variable_groups() const
const DofMap & get_dof_map() const
const MeshBase & get_mesh() const
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
void set_is_adjoint(bool _is_adjoint_value)
Accessor for setting whether we need to do a primal or adjoint solve.
bool is_adjoint() const
Accessor for querying whether we need to do a primal or adjoint solve.
virtual bool nonlocal_residual(bool request_jacobian, DiffContext &)=0
This method uses the DifferentiablePhysics nonlocal_time_derivative(), nonlocal_constraint(),...
virtual bool element_residual(bool request_jacobian, DiffContext &)=0
This method uses the DifferentiablePhysics element_time_derivative(), element_constraint(),...
virtual bool side_residual(bool request_jacobian, DiffContext &)=0
This method uses the DifferentiablePhysics side_time_derivative(), side_constraint(),...
const FEType & type() const
void sync_dofobject_data_by_id(const Communicator &comm, const Iterator &range_begin, const Iterator &range_end, SyncFunctor &sync)
Request data about a range of ghost dofobjects uniquely identified by their id.
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided reduction operation in parallel on the specified range.
void parallel_for(const Range &range, const Body &body, unsigned int n_threads=libMesh::n_threads())
Execute the provided function object in parallel on the specified range.
The libMesh namespace provides an interface to certain functionality in the library.
void libmesh_ignore(const Args &...)
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value for an unsigned int...
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...