#include <diff_context.h>
Public Types | |
typedef std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > >::iterator | localized_vectors_iterator |
Public Attributes | |
Real | time |
const Real | system_time |
Real | elem_solution_derivative |
Real | elem_solution_rate_derivative |
Real | elem_solution_accel_derivative |
Real | fixed_solution_derivative |
Private Attributes | |
Real * | _deltat |
const System & | _system |
bool | _is_adjoint |
This class provides all data required for a physics package (e.g. a DifferentiableSystem subclass) to perform local element residual and jacobian integrations.
This class is part of the new DifferentiableSystem framework, which is still experimental. Users of this framework should beware of bugs and future API changes.
Definition at line 55 of file diff_context.h.
typedef std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<std::unique_ptr<DenseSubVector<Number> > > > >::iterator libMesh::DiffContext::localized_vectors_iterator |
Typedef for the localized_vectors iterator
Definition at line 544 of file diff_context.h.
|
explicit |
Constructor. Optionally initializes required data structures.
Definition at line 30 of file diff_context.C.
References _elem_fixed_solution, _elem_fixed_subsolutions, _elem_jacobian, _elem_qoi, _elem_qoi_derivative, _elem_qoi_subderivatives, _elem_residual, _elem_solution, _elem_solution_accel, _elem_solution_rate, _elem_subjacobians, _elem_subresiduals, _elem_subsolution_accels, _elem_subsolution_rates, _elem_subsolutions, libMesh::DifferentiablePhysics::get_second_order_vars(), libMesh::DifferentiableSystem::get_time_solver(), libMesh::TimeSolver::is_steady(), libMesh::System::n_vars(), libMesh::System::qoi, libMesh::UnsteadySolver::time_order(), and libMesh::System::use_fixed_solution.
|
virtual |
void libMesh::DiffContext::add_localized_vector | ( | NumericVector< Number > & | localized_vector, |
const System & | sys | ||
) |
Adds a vector to the map of localized vectors. We can later evaluate interior_values, interior_gradients and side_values for these fields these vectors represent.
Definition at line 119 of file diff_context.C.
References _localized_vectors, and libMesh::System::n_vars().
|
inlinevirtual |
Gives derived classes the opportunity to reinitialize data needed for an edge integration at a new point within a timestep
Reimplemented in libMesh::FEMContext.
Definition at line 88 of file diff_context.h.
|
inlinevirtual |
Gives derived classes the opportunity to reinitialize data (FE objects in FEMSystem, for example) needed for an interior integration at a new point within a timestep
Reimplemented in libMesh::FEMContext.
Definition at line 76 of file diff_context.h.
Referenced by libMesh::EulerSolver::element_residual(), libMesh::Euler2Solver::element_residual(), and libMesh::NewmarkSolver::element_residual().
|
inlinevirtual |
Gives derived classes the opportunity to reinitialize data needed for a side integration at a new point within a timestep
Reimplemented in libMesh::FEMContext.
Definition at line 82 of file diff_context.h.
Referenced by libMesh::EulerSolver::side_residual(), libMesh::Euler2Solver::side_residual(), and libMesh::NewmarkSolver::side_residual().
Real libMesh::DiffContext::get_deltat_value | ( | ) |
_deltat
member Definition at line 111 of file diff_context.C.
References _deltat.
Referenced by libMesh::FEMContext::_update_time_from_system().
|
inline |
Accessor for element dof indices
Definition at line 367 of file diff_context.h.
References _dof_indices.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::FEMContext::fixed_point_gradient(), libMesh::FEMContext::fixed_point_hessian(), libMesh::FEMContext::fixed_point_value(), libMesh::VectorSetAction< Val >::insert(), libMesh::MatrixFillAction< ValIn, ValOut >::insert(), libMesh::FEMContext::interior_curl(), libMesh::FEMContext::interior_div(), libMesh::FEMContext::interior_gradients(), libMesh::FEMContext::interior_hessians(), libMesh::FEMContext::interior_values(), libMesh::FEMSystem::mesh_position_get(), libMesh::DGFEMContext::neighbor_side_fe_reinit(), libMesh::FEMSystem::numerical_jacobian(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), libMesh::FEMContext::point_curl(), libMesh::FEMContext::point_gradient(), libMesh::FEMContext::point_hessian(), libMesh::FEMContext::point_value(), libMesh::FEMContext::pre_fe_reinit(), libMesh::FEMContext::side_gradient(), libMesh::FEMContext::side_gradients(), libMesh::FEMContext::side_hessians(), libMesh::FEMContext::side_values(), libMesh::FEMContext::some_gradient(), libMesh::FEMContext::some_hessian(), and libMesh::FEMContext::some_value().
|
inline |
Non-const accessor for element dof indices
Definition at line 373 of file diff_context.h.
References _dof_indices.
|
inline |
Accessor for element dof indices of a particular variable corresponding to the index argument.
Definition at line 380 of file diff_context.h.
References _dof_indices_var.
|
inline |
Accessor for element dof indices of a particular variable corresponding to the index argument.
Definition at line 390 of file diff_context.h.
References _dof_indices_var.
|
inline |
Accessor for element fixed solution.
Definition at line 215 of file diff_context.h.
References _elem_fixed_solution.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::SteadySolver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::FEMContext::fixed_interior_gradient(), libMesh::FEMContext::fixed_interior_hessian(), libMesh::FEMContext::fixed_interior_value(), libMesh::FEMContext::fixed_point_gradient(), libMesh::FEMContext::fixed_point_hessian(), libMesh::FEMContext::fixed_point_value(), libMesh::FEMContext::fixed_side_gradient(), libMesh::FEMContext::fixed_side_hessian(), libMesh::FEMContext::fixed_side_value(), and libMesh::FEMContext::pre_fe_reinit().
|
inline |
Non-const accessor for element fixed solution.
Definition at line 221 of file diff_context.h.
References _elem_fixed_solution.
|
inline |
Accessor for element fixed solution of a particular variable corresponding to the variable index argument.
Definition at line 228 of file diff_context.h.
References _elem_fixed_subsolutions.
|
inline |
Accessor for element fixed solution of a particular variable corresponding to the variable index argument.
Definition at line 239 of file diff_context.h.
References _elem_fixed_subsolutions.
|
inline |
Const accessor for element Jacobian.
Definition at line 283 of file diff_context.h.
References _elem_jacobian.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::FEMSystem::assembly(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::EigenTimeSolver::element_residual(), libMesh::EigenTimeSolver::nonlocal_residual(), libMesh::FEMSystem::numerical_jacobian(), libMesh::FEMContext::pre_fe_reinit(), and libMesh::EigenTimeSolver::side_residual().
|
inline |
Non-const accessor for element Jacobian.
Definition at line 289 of file diff_context.h.
References _elem_jacobian.
|
inline |
Const accessor for element Jacobian of particular variables corresponding to the variable index arguments.
Definition at line 296 of file diff_context.h.
References _elem_subjacobians.
|
inline |
Non-const accessor for element Jacobian of particular variables corresponding to the variable index arguments.
Definition at line 308 of file diff_context.h.
References _elem_subjacobians.
|
inline |
Const accessor for element residual.
Definition at line 249 of file diff_context.h.
References _elem_residual.
Referenced by libMesh::Euler2Solver::_general_residual(), libMesh::FEMSystem::assembly(), libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::FEMSystem::numerical_jacobian(), and libMesh::FEMContext::pre_fe_reinit().
|
inline |
Non-const accessor for element residual.
Definition at line 255 of file diff_context.h.
References _elem_residual.
|
inline |
Const accessor for element residual of a particular variable corresponding to the variable index argument.
Definition at line 262 of file diff_context.h.
References _elem_subresiduals.
|
inline |
Non-const accessor for element residual of a particular variable corresponding to the variable index argument.
Definition at line 273 of file diff_context.h.
References _elem_subresiduals.
|
inline |
Accessor for element solution.
Definition at line 111 of file diff_context.h.
References _elem_solution.
Referenced by libMesh::FEMContext::_do_elem_position_set(), libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::SteadySolver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::FEMContext::elem_position_get(), libMesh::FEMContext::interior_curl(), libMesh::FEMContext::interior_div(), libMesh::FEMContext::interior_gradient(), libMesh::FEMContext::interior_hessian(), libMesh::FEMContext::interior_value(), libMesh::FEMSystem::mesh_position_get(), libMesh::FEMSystem::numerical_jacobian(), libMesh::FEMContext::point_curl(), libMesh::FEMContext::point_gradient(), libMesh::FEMContext::point_hessian(), libMesh::FEMContext::point_value(), libMesh::FEMContext::pre_fe_reinit(), libMesh::FEMContext::side_gradient(), libMesh::FEMContext::side_hessian(), and libMesh::FEMContext::side_value().
|
inline |
Non-const accessor for element solution.
Definition at line 117 of file diff_context.h.
References _elem_solution.
|
inline |
Accessor for element solution of a particular variable corresponding to the variable index argument.
Definition at line 124 of file diff_context.h.
References _elem_subsolutions.
|
inline |
Accessor for element solution of a particular variable corresponding to the variable index argument.
Definition at line 135 of file diff_context.h.
References _elem_subsolutions.
|
inline |
Accessor for element solution accel of change w.r.t. time.
Definition at line 180 of file diff_context.h.
References _elem_solution_accel.
Referenced by libMesh::NewmarkSolver::_general_residual(), libMesh::FEMContext::interior_accel(), libMesh::FEMContext::pre_fe_reinit(), libMesh::FirstOrderUnsteadySolver::prepare_accel(), and libMesh::FEMContext::side_accel().
|
inline |
Non-const accessor for element solution accel of change w.r.t. time.
Definition at line 187 of file diff_context.h.
References _elem_solution_accel.
|
inline |
Accessor for element solution accel for a particular variable corresponding to the variable index argument.
Definition at line 194 of file diff_context.h.
References _elem_subsolution_accels.
|
inline |
Accessor for element solution accel for a particular variable corresponding to the variable index argument.
Definition at line 205 of file diff_context.h.
References _elem_subsolution_accels.
|
inline |
The derivative of the current elem_solution_accel w.r.t. the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_elem_solution_accel_derivative() is 0.
Definition at line 454 of file diff_context.h.
References elem_solution_accel_derivative.
|
inline |
The derivative of the current elem_solution w.r.t. the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_elem_solution_derivative() is 0.
Definition at line 436 of file diff_context.h.
References elem_solution_derivative.
Referenced by libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns().
|
inline |
Accessor for element solution rate of change w.r.t. time.
Definition at line 145 of file diff_context.h.
References _elem_solution_rate.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::FEMContext::interior_rate(), libMesh::FEMContext::pre_fe_reinit(), libMesh::FirstOrderUnsteadySolver::prepare_accel(), and libMesh::FEMContext::side_rate().
|
inline |
Non-const accessor for element solution rate of change w.r.t. time.
Definition at line 152 of file diff_context.h.
References _elem_solution_rate.
|
inline |
Accessor for element solution rate for a particular variable corresponding to the variable index argument.
Definition at line 159 of file diff_context.h.
References _elem_subsolution_rates.
|
inline |
Accessor for element solution rate for a particular variable corresponding to the variable index argument.
Definition at line 170 of file diff_context.h.
References _elem_subsolution_rates.
|
inline |
The derivative of the current elem_solution_rate w.r.t. the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_elem_solution_rate_derivative() is 0.
Definition at line 445 of file diff_context.h.
References elem_solution_rate_derivative.
Referenced by libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), and libMesh::FirstOrderUnsteadySolver::prepare_accel().
|
inline |
The derivative of the current fixed_elem_solution w.r.t. the unknown solution. Corresponding Jacobian contributions should be multiplied by this amount, or may be skipped if get_fixed_elem_solution_derivative() is 0.
Definition at line 463 of file diff_context.h.
References fixed_solution_derivative.
DenseSubVector< Number > & libMesh::DiffContext::get_localized_subvector | ( | const NumericVector< Number > & | localized_vector, |
unsigned int | var | ||
) |
Return a reference to DenseSubVector localization of localized_vector at variable var contained in the _localized_vectors map
Definition at line 148 of file diff_context.C.
References _localized_vectors.
Referenced by libMesh::FEMContext::interior_gradients(), libMesh::FEMContext::interior_hessians(), libMesh::FEMContext::interior_values(), libMesh::FEMContext::side_gradients(), libMesh::FEMContext::side_hessians(), and libMesh::FEMContext::side_values().
const DenseSubVector< Number > & libMesh::DiffContext::get_localized_subvector | ( | const NumericVector< Number > & | localized_vector, |
unsigned int | var | ||
) | const |
const accessible version of get_localized_subvector function
Definition at line 154 of file diff_context.C.
References _localized_vectors.
DenseVector< Number > & libMesh::DiffContext::get_localized_vector | ( | const NumericVector< Number > & | localized_vector | ) |
Return a reference to DenseVector localization of localized_vector contained in the _localized_vectors map
Definition at line 134 of file diff_context.C.
References _localized_vectors.
const DenseVector< Number > & libMesh::DiffContext::get_localized_vector | ( | const NumericVector< Number > & | localized_vector | ) | const |
const accessible version of get_localized_vector function
Definition at line 140 of file diff_context.C.
References _localized_vectors.
|
inline |
Const accessor for QoI derivatives.
Definition at line 331 of file diff_context.h.
References _elem_qoi_derivative.
Referenced by libMesh::FEMContext::pre_fe_reinit().
|
inline |
Non-const accessor for QoI derivatives.
Definition at line 337 of file diff_context.h.
References _elem_qoi_derivative.
|
inline |
Const accessor for QoI derivative of a particular qoi and variable corresponding to the index arguments.
Definition at line 344 of file diff_context.h.
References _elem_qoi_subderivatives.
|
inline |
Non-const accessor for QoI derivative of a particular qoi and variable corresponding to the index arguments.
Definition at line 356 of file diff_context.h.
References _elem_qoi_subderivatives.
|
inline |
|
inline |
Non-const accessor for QoI vector.
Definition at line 325 of file diff_context.h.
References _elem_qoi.
|
inline |
Accessor for associated system.
Definition at line 105 of file diff_context.h.
References _system.
Referenced by libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), and libMesh::DGFEMContext::neighbor_side_fe_reinit().
|
inline |
Accessor for the time variable stored in the system class.
Definition at line 415 of file diff_context.h.
References system_time.
Referenced by libMesh::FEMContext::_update_time_from_system().
|
inline |
Accessor for the time for which the current nonlinear_solution is defined.
Definition at line 421 of file diff_context.h.
References time.
|
inline |
Accessor for querying whether we need to do a primal or adjoint solve
Definition at line 470 of file diff_context.h.
References _is_adjoint.
Referenced by libMesh::FEMSystem::build_context().
|
inline |
Accessor for setting whether we need to do a primal or adjoint solve
Definition at line 477 of file diff_context.h.
References _is_adjoint.
|
inline |
Total number of dof indices on the element
Definition at line 399 of file diff_context.h.
References _dof_indices.
|
inline |
Total number of dof indices of the particular variable corresponding to the index argument
Definition at line 406 of file diff_context.h.
References _dof_indices_var.
|
inline |
Number of variables in solution.
Definition at line 99 of file diff_context.h.
References _dof_indices_var.
Referenced by libMesh::FirstOrderUnsteadySolver::compute_second_order_eqns(), libMesh::LaplacianErrorEstimator::init_context(), libMesh::DiscontinuityMeasure::init_context(), libMesh::KellyErrorEstimator::init_context(), and libMesh::FEMSystem::numerical_jacobian().
|
inlinevirtual |
Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new point within a timestep
Reimplemented in libMesh::FEMContext.
Definition at line 94 of file diff_context.h.
Referenced by libMesh::EulerSolver::nonlocal_residual(), libMesh::Euler2Solver::nonlocal_residual(), and libMesh::NewmarkSolver::nonlocal_residual().
void libMesh::DiffContext::set_deltat_pointer | ( | Real * | dt | ) |
Points the _deltat member of this class at a timestep value stored in the creating System, for example DiffSystem::deltat
Definition at line 103 of file diff_context.C.
References _deltat.
Referenced by libMesh::FEMSystem::build_context(), libMesh::DifferentiableSystem::build_context(), and libMesh::FEMSystem::init_context().
|
inline |
Set the time for which the current nonlinear_solution is defined.
Definition at line 427 of file diff_context.h.
References time.
Referenced by libMesh::FEMContext::_update_time_from_system().
|
private |
Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class responsible for creating this DiffContext.
In DiffSystem's build_context() function, is assigned to point to the deltat member of that class.
Accessible via public get_deltat()/set_deltat() methods of this class.
Always test for nullptr before using!
Definition at line 653 of file diff_context.h.
Referenced by get_deltat_value(), and set_deltat_pointer().
|
protected |
Global Degree of freedom index lists
Definition at line 637 of file diff_context.h.
Referenced by get_dof_indices(), and n_dof_indices().
|
protected |
Definition at line 638 of file diff_context.h.
Referenced by get_dof_indices(), n_dof_indices(), and n_vars().
|
protected |
Element by element components of nonlinear_solution at a fixed point in a timestep, for optional use by e.g. stabilized methods
Definition at line 603 of file diff_context.h.
Referenced by DiffContext(), and get_elem_fixed_solution().
|
protected |
Definition at line 604 of file diff_context.h.
Referenced by DiffContext(), libMesh::FEMContext::fixed_point_gradient(), libMesh::FEMContext::fixed_point_hessian(), libMesh::FEMContext::fixed_point_value(), and get_elem_fixed_solution().
|
protected |
Element jacobian: derivatives of elem_residual with respect to elem_solution
Definition at line 615 of file diff_context.h.
Referenced by DiffContext(), and get_elem_jacobian().
|
protected |
Element quantity of interest contributions
Definition at line 620 of file diff_context.h.
Referenced by DiffContext(), and get_qois().
|
protected |
Element quantity of interest derivative contributions
Definition at line 625 of file diff_context.h.
Referenced by DiffContext(), and get_qoi_derivatives().
|
protected |
Definition at line 626 of file diff_context.h.
Referenced by DiffContext(), get_qoi_derivatives(), and libMesh::FEMContext::pre_fe_reinit().
|
protected |
Element residual vector
Definition at line 609 of file diff_context.h.
Referenced by DiffContext(), and get_elem_residual().
|
protected |
Element by element components of nonlinear_solution as adjusted by a time_solver
Definition at line 581 of file diff_context.h.
Referenced by DiffContext(), and get_elem_solution().
|
protected |
Element by element components of du/dt as adjusted by a time_solver
Definition at line 595 of file diff_context.h.
Referenced by DiffContext(), and get_elem_solution_accel().
|
protected |
Element by element components of du/dt as adjusted by a time_solver
Definition at line 588 of file diff_context.h.
Referenced by DiffContext(), and get_elem_solution_rate().
|
protected |
Definition at line 632 of file diff_context.h.
Referenced by DiffContext(), and get_elem_jacobian().
|
protected |
Element residual subvectors and Jacobian submatrices
Definition at line 631 of file diff_context.h.
Referenced by DiffContext(), and get_elem_residual().
|
protected |
Definition at line 596 of file diff_context.h.
Referenced by DiffContext(), and get_elem_solution_accel().
|
protected |
Definition at line 589 of file diff_context.h.
Referenced by DiffContext(), and get_elem_solution_rate().
|
protected |
Definition at line 582 of file diff_context.h.
Referenced by DiffContext(), get_elem_solution(), libMesh::FEMContext::interior_curl(), libMesh::FEMContext::interior_div(), libMesh::FEMContext::point_curl(), libMesh::FEMContext::point_gradient(), libMesh::FEMContext::point_hessian(), libMesh::FEMContext::point_value(), and libMesh::FEMContext::side_gradient().
|
private |
Is this context to be used for a primal or adjoint solve?
Definition at line 663 of file diff_context.h.
Referenced by is_adjoint().
|
protected |
Contains pointers to vectors the user has asked to be localized, keyed with pairs of element localized versions of that vector and per variable views
Definition at line 575 of file diff_context.h.
Referenced by add_localized_vector(), get_localized_subvector(), get_localized_vector(), and libMesh::FEMContext::pre_fe_reinit().
|
private |
A reference to the system this context is constructed with
Definition at line 658 of file diff_context.h.
Referenced by get_system().
Real libMesh::DiffContext::elem_solution_accel_derivative |
The derivative of elem_solution_accel with respect to the current nonlinear solution, for use by systems with non default mass_residual terms.
Definition at line 514 of file diff_context.h.
Referenced by libMesh::NewmarkSolver::_general_residual(), get_elem_solution_accel_derivative(), and libMesh::FirstOrderUnsteadySolver::prepare_accel().
Real libMesh::DiffContext::elem_solution_derivative |
The derivative of elem_solution with respect to the current nonlinear solution.
Definition at line 500 of file diff_context.h.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::EigenTimeSolver::element_residual(), get_elem_solution_derivative(), and libMesh::EigenTimeSolver::side_residual().
Real libMesh::DiffContext::elem_solution_rate_derivative |
The derivative of elem_solution_rate with respect to the current nonlinear solution, for use by systems with non default mass_residual terms.
Definition at line 507 of file diff_context.h.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::NewmarkSolver::_general_residual(), libMesh::EigenTimeSolver::element_residual(), get_elem_solution_rate_derivative(), and libMesh::EigenTimeSolver::side_residual().
Real libMesh::DiffContext::fixed_solution_derivative |
The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems constructing jacobians with elem_fixed_solution based methods
Definition at line 521 of file diff_context.h.
Referenced by libMesh::EulerSolver::_general_residual(), libMesh::Euler2Solver::_general_residual(), libMesh::SteadySolver::_general_residual(), and get_fixed_solution_derivative().
const Real libMesh::DiffContext::system_time |
This is the time stored in the System class at the time this context was created, i.e. the time at the beginning of the current timestep. This value gets set in the constructor and unlike DiffContext::time, is not tweaked mid-timestep by transient solvers: it remains equal to the value it was assigned at construction.
Definition at line 494 of file diff_context.h.
Referenced by get_system_time().
Real libMesh::DiffContext::time |
For time-dependent problems, this is the time t for which the current nonlinear_solution is defined. FIXME - this needs to be tweaked mid-timestep by all transient solvers!
Definition at line 485 of file diff_context.h.
Referenced by get_time(), libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()(), and set_time().