Go to the documentation of this file.
   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" 
   46 femsystem_mutex assembly_mutex;
 
   48 void assemble_unconstrained_element_system(
const FEMSystem & _sys,
 
   49                                            const bool _get_jacobian,
 
   50                                            const bool _constrain_heterogeneously,
 
   75   const bool need_jacobian =
 
   76     (_get_jacobian || _constrain_heterogeneously);
 
   78   bool jacobian_computed =
 
   79     _sys.
time_solver->element_residual(need_jacobian, _femcontext);
 
   82   if (need_jacobian && !jacobian_computed)
 
   92   if (need_jacobian && jacobian_computed &&
 
  101       Real analytic_norm = analytic_jacobian.l1_norm();
 
  109       Real error_norm = analytic_jacobian.l1_norm();
 
  111       Real relative_error = error_norm /
 
  112         std::max(analytic_norm, numerical_norm);
 
  117                        << 
" detected in analytic jacobian on element " 
  118                        << _femcontext.
get_elem().
id() << 
'!' << std::endl;
 
  126                        << analytic_jacobian << std::endl;
 
  130           libmesh_error_msg(
"Relative error too large, exiting!");
 
  135   for (_femcontext.
side = 0; _femcontext.
side != n_sides;
 
  157 #endif // ifndef DEBUG 
  164         _sys.
time_solver->side_residual(need_jacobian, _femcontext);
 
  167       if (need_jacobian && !jacobian_computed)
 
  175           if (old_jacobian.
m())
 
  192       else if (need_jacobian && jacobian_computed &&
 
  201           Real analytic_norm = analytic_jacobian.l1_norm();
 
  209           Real error_norm = analytic_jacobian.l1_norm();
 
  211           Real relative_error = error_norm /
 
  212             std::max(analytic_norm, numerical_norm);
 
  217                            << 
" detected in analytic jacobian on element " 
  220                            << static_cast<unsigned int>(_femcontext.
side) << 
'!' << std::endl;
 
  228                            << analytic_jacobian << std::endl;
 
  231               libmesh_error_msg(
"Relative error too large, exiting!");
 
  245 #endif // ifdef DEBUG 
  249 void add_element_system(
const FEMSystem & _sys,
 
  250                         const bool _get_residual,
 
  251                         const bool _get_jacobian,
 
  252                         const bool _constrain_heterogeneously,
 
  253                         const bool _no_constraints,
 
  256 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  271   if (_get_residual && _get_jacobian)
 
  273       if (_constrain_heterogeneously)
 
  278       else if (!_no_constraints)
 
  285   else if (_get_residual)
 
  287       if (_constrain_heterogeneously)
 
  292       else if (!_no_constraints)
 
  297   else if (_get_jacobian)
 
  302       if (!_no_constraints)
 
  309 #endif // #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  336     femsystem_mutex::scoped_lock lock(assembly_mutex);
 
  349 class AssemblyContributions
 
  358                         bool constrain_heterogeneously,
 
  359                         bool no_constraints) :
 
  361     _get_residual(get_residual),
 
  362     _get_jacobian(get_jacobian),
 
  363     _constrain_heterogeneously(constrain_heterogeneously),
 
  364     _no_constraints(no_constraints) {}
 
  372     FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
  375     for (
const auto & elem : range)
 
  380         assemble_unconstrained_element_system
 
  381           (_sys, _get_jacobian, _constrain_heterogeneously, _femcontext);
 
  384           (_sys, _get_residual, _get_jacobian,
 
  385            _constrain_heterogeneously, _no_constraints, _femcontext);
 
  393   const bool _get_residual, _get_jacobian, _constrain_heterogeneously, _no_constraints;
 
  396 class PostprocessContributions
 
  403   PostprocessContributions(
FEMSystem & sys) : _sys(sys) {}
 
  411     FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
  414     for (
const auto & elem : range)
 
  425         for (_femcontext.
side = 0; _femcontext.
side != n_sides;
 
  448 class QoIContributions
 
  457                    const QoISet & qoi_indices) :
 
  458     qoi(sys.n_qois(), 0.), _sys(sys), _diff_qoi(diff_qoi),_qoi_indices(qoi_indices) {}
 
  463   QoIContributions(
const QoIContributions & other,
 
  465     qoi(other._sys.n_qois(), 0.), _sys(other._sys), _diff_qoi(other._diff_qoi) {}
 
  473     FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
  474     _diff_qoi.init_context(_femcontext);
 
  476     bool have_some_heterogenous_qoi_bc = 
false;
 
  477 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  478     std::vector<bool> have_heterogenous_qoi_bc(_sys.
n_qois(), 
false);
 
  480       if (_qoi_indices.has_index(q) &&
 
  483           have_heterogenous_qoi_bc[q] = 
true;
 
  484           have_some_heterogenous_qoi_bc = 
true;
 
  488     if (have_some_heterogenous_qoi_bc)
 
  491     for (
const auto & elem : range)
 
  497         bool elem_has_some_heterogenous_qoi_bc = 
false;
 
  499 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  500         const unsigned int n_dofs =
 
  503         std::vector<bool> elem_has_heterogenous_qoi_bc(_sys.
n_qois(), 
false);
 
  504         if (have_some_heterogenous_qoi_bc)
 
  508                 if (have_heterogenous_qoi_bc[q])
 
  514                           elem_has_some_heterogenous_qoi_bc = 
true;
 
  515                           elem_has_heterogenous_qoi_bc[q] = 
true;
 
  523         if (_diff_qoi.assemble_qoi_elements ||
 
  524             elem_has_some_heterogenous_qoi_bc)
 
  527         if (_diff_qoi.assemble_qoi_elements)
 
  528           _diff_qoi.element_qoi(_femcontext, _qoi_indices);
 
  533 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  534         if (elem_has_some_heterogenous_qoi_bc)
 
  536             _sys.
time_solver->element_residual(
false, _femcontext);
 
  540                 if (elem_has_heterogenous_qoi_bc[q])
 
  552         for (_femcontext.
side = 0; _femcontext.
side != n_sides;
 
  556             if (!_diff_qoi.assemble_qoi_sides ||
 
  557                 (!_diff_qoi.assemble_qoi_internal_sides &&
 
  563             _diff_qoi.side_qoi(_femcontext, _qoi_indices);
 
  567     this->_diff_qoi.thread_join( this->qoi, _femcontext.
get_qois(), _qoi_indices );
 
  570   void join (
const QoIContributions & other)
 
  572     libmesh_assert_equal_to (this->qoi.size(), other.qoi.size());
 
  573     this->_diff_qoi.thread_join( this->qoi, other.qoi, _qoi_indices );
 
  576   std::vector<Number> qoi;
 
  583   const QoISet _qoi_indices;
 
  586 class QoIDerivativeContributions
 
  592   QoIDerivativeContributions(
FEMSystem & sys,
 
  593                              const QoISet & qoi_indices,
 
  595                              bool include_liftfunc,
 
  596                              bool apply_constraints) :
 
  598     _qoi_indices(qoi_indices),
 
  600     _include_liftfunc(include_liftfunc),
 
  601     _apply_constraints(apply_constraints) {}
 
  609     FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
  610     _qoi.init_context(_femcontext);
 
  612     bool have_some_heterogenous_qoi_bc = 
false;
 
  613 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  614     std::vector<bool> have_heterogenous_qoi_bc(_sys.
n_qois(), 
false);
 
  615     if (_include_liftfunc || _apply_constraints)
 
  617         if (_qoi_indices.has_index(q) &&
 
  620             have_heterogenous_qoi_bc[q] = 
true;
 
  621             have_some_heterogenous_qoi_bc = 
true;
 
  625     if (have_some_heterogenous_qoi_bc)
 
  628     for (
const auto & elem : range)
 
  634         bool elem_has_some_heterogenous_qoi_bc = 
false;
 
  636 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  637         const unsigned int n_dofs =
 
  640         std::vector<bool> elem_has_heterogenous_qoi_bc(_sys.
n_qois(), 
false);
 
  641         if (have_some_heterogenous_qoi_bc)
 
  645                 if (have_heterogenous_qoi_bc[q])
 
  651                           elem_has_some_heterogenous_qoi_bc = 
true;
 
  652                           elem_has_heterogenous_qoi_bc[q] = 
true;
 
  665         if (_qoi.assemble_qoi_elements ||
 
  666             ((_include_liftfunc || _apply_constraints) &&
 
  667              elem_has_some_heterogenous_qoi_bc))
 
  670         if (_qoi.assemble_qoi_elements)
 
  671           _qoi.element_qoi_derivative(_femcontext, _qoi_indices);
 
  673 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  677         if ((_include_liftfunc || _apply_constraints) &&
 
  678             elem_has_some_heterogenous_qoi_bc)
 
  680             bool jacobian_computed = _sys.
time_solver->element_residual(
true, _femcontext);
 
  683             if (!jacobian_computed)
 
  695         if (_include_liftfunc && elem_has_some_heterogenous_qoi_bc)
 
  699                 if (elem_has_heterogenous_qoi_bc[q])
 
  706                         if (liftfunc_val != 
Number(0))
 
  721         for (_femcontext.
side = 0; _femcontext.
side != n_sides;
 
  725             if (!_qoi.assemble_qoi_sides ||
 
  726                 (!_qoi.assemble_qoi_internal_sides &&
 
  732             _qoi.side_qoi_derivative(_femcontext, _qoi_indices);
 
  739 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  740         std::vector<dof_id_type> original_dofs = _femcontext.
get_dof_indices();
 
  744           femsystem_mutex::scoped_lock lock(assembly_mutex);
 
  746 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  750           if (_apply_constraints)
 
  755             if (_qoi_indices.has_index(i))
 
  757 #ifdef LIBMESH_ENABLE_CONSTRAINTS 
  758                 if (_apply_constraints)
 
  761                     bool has_heterogenous_constraint = 
false;
 
  766                           has_heterogenous_constraint = 
true;
 
  772                     bool has_heterogenous_constraint =
 
  773                       elem_has_heterogenous_qoi_bc[i];
 
  778                     if (has_heterogenous_constraint)
 
  784                           (elem_jacobian_transpose);
 
  787                           (elem_jacobian_transpose,
 
  810   const QoISet & _qoi_indices;
 
  812   bool _include_liftfunc, _apply_constraints;
 
  827                       const std::string & name_in,
 
  828                       const unsigned int number_in)
 
  829   : 
Parent(es, name_in, number_in),
 
  830     fe_reinit_during_postprocess(true),
 
  832     verify_analytic_jacobians(0.0)
 
  851                           bool apply_heterogeneous_constraints,
 
  852                           bool apply_no_constraints)
 
  857 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  858   const char * log_name;
 
  859   if (get_residual && get_jacobian)
 
  860     log_name = 
"assembly()";
 
  861   else if (get_residual)
 
  862     log_name = 
"assembly(get_residual)";
 
  864     log_name = 
"assembly(get_jacobian)";
 
  866   LOG_SCOPE(log_name, 
"FEMSystem");
 
  887                    << 
"];" << std::endl;
 
  901       libMesh::err << 
"WARNING!  verify_analytic_jacobians was set " 
  902                    << 
"to absurdly large value of " 
  918      AssemblyContributions(*
this, get_residual, get_jacobian,
 
  919                            apply_heterogeneous_constraints,
 
  920                            apply_no_constraints));
 
  923   bool have_scalar = 
false;
 
  938       FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
  942       bool jacobian_computed =
 
  943         this->
time_solver->nonlocal_residual(get_jacobian, _femcontext);
 
  951           if (get_jacobian && !jacobian_computed)
 
  961           if (get_jacobian && jacobian_computed &&
 
  970               Real analytic_norm = analytic_jacobian.l1_norm();
 
  978               Real error_norm = analytic_jacobian.l1_norm();
 
  980               Real relative_error = error_norm /
 
  981                 std::max(analytic_norm, numerical_norm);
 
  986                                << 
" detected in analytic jacobian on nonlocal dofs!" 
  995                                << analytic_jacobian << std::endl;
 
  999                   libmesh_error_msg(
"Relative error too large, exiting!");
 
 1004             (*
this, get_residual, get_jacobian,
 
 1005              apply_heterogeneous_constraints, apply_no_constraints, _femcontext);
 
 1066   FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
 1099   LOG_SCOPE(
"postprocess()", 
"FEMSystem");
 
 1112                          PostprocessContributions(*
this));
 
 1119   LOG_SCOPE(
"assemble_qoi()", 
"FEMSystem");
 
 1125   const unsigned int Nq = this->
n_qois();
 
 1129   for (
unsigned int i=0; i != Nq; ++i)
 
 1135   QoIContributions qoi_contributions(*
this, *(this->
diff_qoi), qoi_indices);
 
 1148                                          bool include_liftfunc,
 
 1149                                          bool apply_constraints)
 
 1151   LOG_SCOPE(
"assemble_qoi_derivative()", 
"FEMSystem");
 
 1166                          QoIDerivativeContributions(*
this, qoi_indices,
 
 1169                                                     apply_constraints));
 
 1191   Real numerical_point_h = 0.;
 
 1195   const unsigned int n_dofs =
 
 1216           const unsigned int total_j = j + j_offset;
 
 1223           Real * coord = 
nullptr;
 
 1242           ((*time_solver).*(res))(
false, context);
 
 1256           ((*time_solver).*(res))(
false, context);
 
 1267                   numeric_jacobian(i,total_j) =
 
 1269                     2. / numerical_point_h;
 
 1276                   numeric_jacobian(i,total_j) =
 
 1292   LOG_SCOPE(
"numerical_elem_jacobian()", 
"FEMSystem");
 
 1300   LOG_SCOPE(
"numerical_side_jacobian()", 
"FEMSystem");
 
 1308   LOG_SCOPE(
"numerical_nonlocal_jacobian()", 
"FEMSystem");
 
 1333   return std::unique_ptr<DiffContext>(fc);
 
 1352   FEMContext & context = cast_ref<FEMContext &>(c);
 
 1363               FEBase * elem_fe = 
nullptr;
 
 1378             libmesh_error_msg(
"Unrecognized field type!");
 
 1390     libmesh_error_msg(
"_mesh_sys was nullptr!");
 
 1394     libmesh_not_implemented();
 
 1400   FEMContext & _femcontext = cast_ref<FEMContext &>(*con);
 
  
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
 
Real deltat
For time-dependent problems, this is the amount delta t to advance the solution in time.
 
virtual void zero()=0
Set all entries to zero.
 
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
 
void get_transpose(DenseMatrix< T > &dest) const
Put the tranposed matrix into dest.
 
unsigned int n_vars() const
 
unsigned char side
Current side for side_* to examine.
 
void elem_position_get()
Uses the geometry of elem to set the coordinate data specified by mesh_*_position configuration.
 
virtual void solve() override
Invokes the solver associated with the system.
 
const unsigned int invalid_uint
A number which is used quite often to represent an invalid or uninitialized value.
 
unsigned int _mesh_x_var
Variables from which to acquire moving mesh information.
 
virtual void init_context(DiffContext &) override
 
bool print_jacobian_norms
Set print_jacobian_norms to true to print |J| whenever it is assembled.
 
bool print_element_jacobians
Set print_element_jacobians to true to print each J_elem contribution.
 
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...
 
FEFamily family
The type of finite element.
 
NumericVector< Number > * rhs
The system matrix.
 
bool print_residual_norms
Set print_residual_norms to true to print |F| whenever it is assembled.
 
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
 
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
Constrains the element vector.
 
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...
 
bool print_element_solutions
Set print_element_solutions to true to print each U_elem input.
 
This class provides a specific system class.
 
bool has_heterogenous_adjoint_constraints(const unsigned int qoi_num) const
 
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
 
StoredRange< iterator_type, object_type > & reset(const iterator_type &first, const iterator_type &last)
Resets the StoredRange to contain [first,last).
 
bool has_index(std::size_t) const
Return whether or not this index is in the set to be calculated.
 
virtual void side_fe_reinit()
Reinitializes side FE objects on the current geometric element.
 
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
 
virtual element_iterator active_local_elements_begin()=0
 
bool is_time_evolving(unsigned int var) const
 
bool print_residuals
Set print_residuals to true to print F whenever it is assembled.
 
The libMesh namespace provides an interface to certain functionality in the library.
 
unsigned int n_vars() const
Number of variables in solution.
 
virtual void zero() override
Set every element in the vector to 0.
 
boostcopy::enable_if_c< ScalarTraits< T2 >::value, void >::type add(const T2 factor, const DenseMatrix< T3 > &mat)
Adds factor times mat to this matrix.
 
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
 
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
 
bool is_adjoint() const
Accessor for querying whether we need to do a primal or adjoint solve.
 
This class forms the foundation from which generic finite elements may be derived.
 
const std::vector< Real > & get_JxW() const
 
const Elem & get_elem() const
Accessor for current Elem object.
 
static const Real TOLERANCE
 
const Parallel::Communicator & comm() const
 
NumericVector< Number > & get_adjoint_rhs(unsigned int i=0)
 
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
 
bool print_solution_norms
Set print_residual_norms to true to print |U| whenever it is used in an assembly() call.
 
const FEType & type() const
 
System * _mesh_sys
System from which to acquire moving mesh information.
 
Number has_heterogenous_adjoint_constraint(const unsigned int qoi_num, const dof_id_type dof) const
 
bool use_fixed_solution
A boolean to be set to true by systems using elem_fixed_solution, for optional use by e....
 
const System * get_mesh_system() const
 
FEMSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
 
const Point & point(const unsigned int i) const
 
const std::vector< Number > & get_qois() const
Const accessor for QoI vector.
 
This class provides a specific system class.
 
virtual bool element_residual(bool request_jacobian, DiffContext &)=0
This method uses the DifferentiablePhysics element_time_derivative(), element_constraint(),...
 
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
Constrains the element vector.
 
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
 
unsigned int n_qois() const
Number of currently active quantities of interest.
 
Real numerical_jacobian_h
If calculating numeric jacobians is required, the FEMSystem will perturb each solution vector entry b...
 
NumericVector< Number > & add_adjoint_rhs(unsigned int i=0)
 
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
 
void numerical_jacobian(TimeSolverResPtr res, FEMContext &context) const
Uses the results of multiple res calls to numerically differentiate the corresponding jacobian.
 
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].
 
unsigned int n_variable_groups() const
 
virtual bool nonlocal_residual(bool request_jacobian, DiffContext &)=0
This method uses the DifferentiablePhysics nonlocal_time_derivative(), nonlocal_constraint(),...
 
This is the MeshBase class.
 
void parallel_for(const Range &range, const Body &body)
Execute the provided function object in parallel on the specified range.
 
const std::vector< DenseVector< Number > > & get_qoi_derivatives() const
Const accessor for QoI derivatives.
 
This class provides a specific system class.
 
std::vector< Number > qoi
Values of the quantities of interest.
 
processor_id_type n_processors() const
 
const VariableGroup & variable_group(unsigned int vg) const
Return a constant reference to VariableGroup vg.
 
bool has_elem() const
Test for current Elem object.
 
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
 
virtual void postprocess() override
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides.
 
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 numerical_side_jacobian(FEMContext &context) const
Uses the results of multiple side_residual() calls to numerically differentiate the corresponding jac...
 
virtual ~FEMSystem()
Destructor.
 
void set_deltat_pointer(Real *dt)
Points the _deltat member of this class at a timestep value stored in the creating System,...
 
void mesh_position_get()
Tells the FEMSystem to set the degree of freedom coefficients which should correspond to mesh nodal c...
 
const MeshBase & get_mesh() const
 
processor_id_type processor_id() const
 
void libmesh_ignore(const Args &...)
 
virtual void element_postprocess(DiffContext &)
Does any work that needs to be done on elem in a postprocessing loop.
 
bool print_jacobians
Set print_jacobians to true to print J whenever it is assembled.
 
virtual void solve() override
Invokes the solver associated with the system.
 
TimeSolver & get_time_solver()
 
virtual element_iterator active_local_elements_end()=0
 
unsigned int get_mesh_x_var() const
 
SparseMatrix< Number > * matrix
The system matrix.
 
void parallel_reduce(const Range &range, Body &body)
Execute the provided reduction operation in parallel on the specified range.
 
void set_is_adjoint(bool _is_adjoint_value)
Accessor for setting whether we need to do a primal or adjoint solve.
 
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...
 
void elem_position_set(Real theta)
Uses the coordinate data specified by mesh_*_position configuration to set the geometry of elem to th...
 
virtual unsigned int size() const override
 
virtual Real l1_norm() const =0
 
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.
 
This class provides all data required for a physics package (e.g.
 
unsigned int get_mesh_z_var() const
 
virtual void zero() override
Set every element in the matrix to 0.
 
This is the EquationSystems class.
 
virtual std::unique_ptr< DiffContext > build_context() override
Builds a FEMContext object with enough information to do evaluations on each element.
 
virtual node_iterator nodes_end()=0
 
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 FEType & variable_type(const unsigned int i) const
 
virtual void set_mesh_system(System *sys)
Tells the FEMContext that system sys contains the isoparametric Lagrangian variables which correspond...
 
void mesh_position_set()
Tells the FEMSystem to set the mesh nodal coordinates which should correspond to degree of freedom co...
 
bool is_adjoint() const
Accessor for querying whether we need to do a primal or adjoint solve.
 
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
 
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 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.
 
DifferentiableQoI * diff_qoi
Pointer to object to use for quantity of interest assembly evaluations.
 
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.
 
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.
 
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
 
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 node_iterator nodes_begin()=0
Iterate over all the nodes in the Mesh.
 
void set_mesh_y_var(unsigned int y_var)
Accessor for y-variable of moving mesh System.
 
Real verify_analytic_jacobians
If verify_analytic_jacobian is equal to zero (as it is by default), no numeric jacobians will be calc...
 
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
Constrains the element matrix and vector.
 
virtual Real hmin() const
 
static FEFieldType field_type(const FEType &fe_type)
 
const DenseMatrix< Number > & get_elem_jacobian() const
Const accessor for element Jacobian.
 
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...
 
const DenseVector< Number > & get_elem_solution() const
Accessor for element solution.
 
bool has_children() const
 
The StoredRange class defines a contiguous, divisible set of objects.
 
std::streamsize precision() const
Get the associated write precision.
 
const DifferentiablePhysics * get_physics() const
 
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
 
const DenseVector< Number > & get_elem_fixed_solution() const
Accessor for element fixed solution.
 
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.
 
bool postprocess_sides
If postprocess_sides is true (it is false by default), the postprocessing loop will loop over all sid...
 
bool print_solutions
Set print_solutions to true to print U whenever it is used in an assembly() call.
 
virtual void side_postprocess(DiffContext &)
Does any work that needs to be done on side of elem in a postprocessing loop.
 
virtual Real l1_norm() const =0
 
const DofMap & get_dof_map() const
 
dof_id_type n_dofs() const
 
auto l1_norm() const -> decltype(std::abs(T(0)))
 
const Elem * neighbor_ptr(unsigned int i) const
 
const std::vector< std::vector< OutputShape > > & get_phi() const
 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
 
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 numerical_nonlocal_jacobian(FEMContext &context) const
Uses the results of multiple side_residual() calls to numerically differentiate the corresponding jac...
 
virtual unsigned int n_sides() const =0
 
unsigned int get_mesh_y_var() const
 
virtual bool side_residual(bool request_jacobian, DiffContext &)=0
This method uses the DifferentiablePhysics side_time_derivative(), side_constraint(),...
 
void numerical_elem_jacobian(FEMContext &context) const
Uses the results of multiple element_residual() calls to numerically differentiate the corresponding ...
 
bool print_element_residuals
Set print_element_residuals to true to print each R_elem contribution.
 
virtual void update()
Update the local values to reflect the solution on neighboring processors.
 
virtual void zero()=0
Set all entries to 0.
 
bool compute_internal_sides
compute_internal_sides is false by default, indicating that side_* computations will only be done on ...
 
void set_mesh_z_var(unsigned int z_var)
Accessor for z-variable of moving mesh System.
 
void set_mesh_x_var(unsigned int x_var)
Accessor for x-variable of moving mesh System.
 
This class provides all data required for a physics package (e.g.