libMesh
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Attributes | List of all members
libMesh::DiffContext Class Reference

This class provides all data required for a physics package (e.g. More...

#include <diff_context.h>

Inheritance diagram for libMesh::DiffContext:
[legend]

Public Types

typedef std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > >::iterator localized_vectors_iterator
 Typedef for the localized_vectors iterator. More...
 

Public Member Functions

 DiffContext (const System &)
 Constructor. More...
 
virtual ~DiffContext ()
 Destructor. More...
 
virtual void elem_reinit (Real)
 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. More...
 
virtual void elem_side_reinit (Real)
 Gives derived classes the opportunity to reinitialize data needed for a side integration at a new point within a timestep. More...
 
virtual void elem_edge_reinit (Real)
 Gives derived classes the opportunity to reinitialize data needed for an edge integration at a new point within a timestep. More...
 
virtual void nonlocal_reinit (Real)
 Gives derived classes the opportunity to reinitialize data needed for nonlocal calculations at a new point within a timestep. More...
 
unsigned int n_vars () const
 Number of variables in solution. More...
 
const Systemget_system () const
 Accessor for associated system. More...
 
const DenseVector< Number > & get_elem_solution () const
 Accessor for element solution. More...
 
DenseVector< Number > & get_elem_solution ()
 Non-const accessor for element solution. More...
 
const DenseSubVector< Number > & get_elem_solution (unsigned int var) const
 Accessor for element solution of a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_solution (unsigned int var)
 Accessor for element solution of a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_solution_rate () const
 Accessor for element solution rate of change w.r.t. More...
 
DenseVector< Number > & get_elem_solution_rate ()
 Non-const accessor for element solution rate of change w.r.t. More...
 
const DenseSubVector< Number > & get_elem_solution_rate (unsigned int var) const
 Accessor for element solution rate for a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_solution_rate (unsigned int var)
 Accessor for element solution rate for a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_solution_accel () const
 Accessor for element solution accel of change w.r.t. More...
 
DenseVector< Number > & get_elem_solution_accel ()
 Non-const accessor for element solution accel of change w.r.t. More...
 
const DenseSubVector< Number > & get_elem_solution_accel (unsigned int var) const
 Accessor for element solution accel for a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_solution_accel (unsigned int var)
 Accessor for element solution accel for a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_fixed_solution () const
 Accessor for element fixed solution. More...
 
DenseVector< Number > & get_elem_fixed_solution ()
 Non-const accessor for element fixed solution. More...
 
const DenseSubVector< Number > & get_elem_fixed_solution (unsigned int var) const
 Accessor for element fixed solution of a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_fixed_solution (unsigned int var)
 Accessor for element fixed solution of a particular variable corresponding to the variable index argument. More...
 
const DenseVector< Number > & get_elem_residual () const
 Const accessor for element residual. More...
 
DenseVector< Number > & get_elem_residual ()
 Non-const accessor for element residual. More...
 
const DenseSubVector< Number > & get_elem_residual (unsigned int var) const
 Const accessor for element residual of a particular variable corresponding to the variable index argument. More...
 
DenseSubVector< Number > & get_elem_residual (unsigned int var)
 Non-const accessor for element residual of a particular variable corresponding to the variable index argument. More...
 
const DenseMatrix< Number > & get_elem_jacobian () const
 Const accessor for element Jacobian. More...
 
DenseMatrix< Number > & get_elem_jacobian ()
 Non-const accessor for element Jacobian. More...
 
const DenseSubMatrix< Number > & get_elem_jacobian (unsigned int var1, unsigned int var2) const
 Const accessor for element Jacobian of particular variables corresponding to the variable index arguments. More...
 
DenseSubMatrix< Number > & get_elem_jacobian (unsigned int var1, unsigned int var2)
 Non-const accessor for element Jacobian of particular variables corresponding to the variable index arguments. More...
 
const std::vector< Number > & get_qois () const
 Const accessor for QoI vector. More...
 
std::vector< Number > & get_qois ()
 Non-const accessor for QoI vector. More...
 
const std::vector< DenseVector< Number > > & get_qoi_derivatives () const
 Const accessor for QoI derivatives. More...
 
std::vector< DenseVector< Number > > & get_qoi_derivatives ()
 Non-const accessor for QoI derivatives. More...
 
const DenseSubVector< Number > & get_qoi_derivatives (std::size_t qoi, unsigned int var) const
 Const accessor for QoI derivative of a particular qoi and variable corresponding to the index arguments. More...
 
DenseSubVector< Number > & get_qoi_derivatives (std::size_t qoi, unsigned int var)
 Non-const accessor for QoI derivative of a particular qoi and variable corresponding to the index arguments. More...
 
const std::vector< dof_id_type > & get_dof_indices () const
 Accessor for element dof indices. More...
 
std::vector< dof_id_type > & get_dof_indices ()
 Non-const accessor for element dof indices. More...
 
const std::vector< dof_id_type > & get_dof_indices (unsigned int var) const
 Accessor for element dof indices of a particular variable corresponding to the index argument. More...
 
std::vector< dof_id_type > & get_dof_indices (unsigned int var)
 Accessor for element dof indices of a particular variable corresponding to the index argument. More...
 
unsigned int n_dof_indices () const
 Total number of dof indices on the element. More...
 
unsigned int n_dof_indices (unsigned int var) const
 Total number of dof indices of the particular variable corresponding to the index argument. More...
 
Real get_system_time () const
 Accessor for the time variable stored in the system class. More...
 
Real get_time () const
 Accessor for the time for which the current nonlinear_solution is defined. More...
 
void set_time (Real time_in)
 Set the time for which the current nonlinear_solution is defined. More...
 
Real get_elem_solution_derivative () const
 The derivative of the current elem_solution w.r.t. More...
 
Real get_elem_solution_rate_derivative () const
 The derivative of the current elem_solution_rate w.r.t. More...
 
Real get_elem_solution_accel_derivative () const
 The derivative of the current elem_solution_accel w.r.t. More...
 
Real get_fixed_solution_derivative () const
 The derivative of the current fixed_elem_solution w.r.t. More...
 
bool is_adjoint () const
 Accessor for querying whether we need to do a primal or adjoint solve. More...
 
bool & is_adjoint ()
 Accessor for setting whether we need to do a primal or adjoint solve. More...
 
void 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. More...
 
Real get_deltat_value ()
 
void add_localized_vector (NumericVector< Number > &localized_vector, const System &sys)
 Adds a vector to the map of localized vectors. More...
 
DenseVector< Number > & get_localized_vector (const NumericVector< Number > &localized_vector)
 Return a reference to DenseVector localization of localized_vector contained in the _localized_vectors map. More...
 
const DenseVector< Number > & get_localized_vector (const NumericVector< Number > &localized_vector) const
 const accessible version of get_localized_vector function More...
 
DenseSubVector< Number > & 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. More...
 
const DenseSubVector< Number > & get_localized_subvector (const NumericVector< Number > &localized_vector, unsigned int var) const
 const accessible version of get_localized_subvector function More...
 

Public Attributes

Real time
 For time-dependent problems, this is the time t for which the current nonlinear_solution is defined. More...
 
const Real system_time
 This is the time stored in the System class at the time this context was created, i.e. More...
 
Real elem_solution_derivative
 The derivative of elem_solution with respect to the current nonlinear solution. More...
 
Real 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. More...
 
Real 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. More...
 
Real 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. More...
 

Protected Attributes

std::map< const NumericVector< Number > *, std::pair< DenseVector< Number >, std::vector< std::unique_ptr< DenseSubVector< Number > > > > > _localized_vectors
 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. More...
 
DenseVector< Number_elem_solution
 Element by element components of nonlinear_solution as adjusted by a time_solver. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
 
DenseVector< Number_elem_solution_rate
 Element by element components of du/dt as adjusted by a time_solver. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_rates
 
DenseVector< Number_elem_solution_accel
 Element by element components of du/dt as adjusted by a time_solver. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_accels
 
DenseVector< Number_elem_fixed_solution
 Element by element components of nonlinear_solution at a fixed point in a timestep, for optional use by e.g. More...
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
 
DenseVector< Number_elem_residual
 Element residual vector. More...
 
DenseMatrix< Number_elem_jacobian
 Element jacobian: derivatives of elem_residual with respect to elem_solution. More...
 
std::vector< Number_elem_qoi
 Element quantity of interest contributions. More...
 
std::vector< DenseVector< Number > > _elem_qoi_derivative
 Element quantity of interest derivative contributions. More...
 
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
 
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subresiduals
 Element residual subvectors and Jacobian submatrices. More...
 
std::vector< std::vector< std::unique_ptr< DenseSubMatrix< Number > > > > _elem_subjacobians
 
std::vector< dof_id_type_dof_indices
 Global Degree of freedom index lists. More...
 
std::vector< std::vector< dof_id_type > > _dof_indices_var
 

Private Attributes

Real_deltat
 Defaults to nullptr, can optionally be used to point to a timestep value in the System-derived class responsible for creating this DiffContext. More...
 
const System_system
 A reference to the system this context is constructed with. More...
 
bool _is_adjoint
 Is this context to be used for a primal or adjoint solve? More...
 

Detailed Description

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.

Author
Roy H. Stogner
Date
2009

Definition at line 55 of file diff_context.h.

Member Typedef Documentation

◆ localized_vectors_iterator

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.

Constructor & Destructor Documentation

◆ DiffContext()

libMesh::DiffContext::DiffContext ( const System )
explicit

Constructor.

Optionally initializes required data structures.

◆ ~DiffContext()

virtual libMesh::DiffContext::~DiffContext ( )
virtual

Destructor.

Member Function Documentation

◆ add_localized_vector()

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.

◆ elem_edge_reinit()

virtual void libMesh::DiffContext::elem_edge_reinit ( Real  )
virtual

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.

88 {}

◆ elem_reinit()

virtual void libMesh::DiffContext::elem_reinit ( Real  )
virtual

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.

76 {}

◆ elem_side_reinit()

virtual void libMesh::DiffContext::elem_side_reinit ( Real  )
virtual

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.

82 {}

◆ get_deltat_value()

Real libMesh::DiffContext::get_deltat_value ( )
Returns
The value currently pointed to by this class's _deltat member

◆ get_dof_indices() [1/4]

const std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( ) const

Accessor for element dof indices.

Definition at line 367 of file diff_context.h.

References _dof_indices.

Referenced by AssemblyA0::boundary_assembly(), AssemblyA1::boundary_assembly(), A2::boundary_assembly(), AssemblyA2::boundary_assembly(), A3::boundary_assembly(), F0::boundary_assembly(), Output0::boundary_assembly(), SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), FirstOrderScalarSystemBase::element_time_derivative(), SecondOrderScalarSystemFirstOrderTimeSolverBase::element_time_derivative(), libMesh::VectorSetAction< Val >::insert(), A0::interior_assembly(), B::interior_assembly(), M0::interior_assembly(), A1::interior_assembly(), EIM_IP_assembly::interior_assembly(), AcousticsInnerProduct::interior_assembly(), A2::interior_assembly(), EIM_F::interior_assembly(), F0::interior_assembly(), OutputAssembly::interior_assembly(), AssemblyEIM::interior_assembly(), AssemblyF0::interior_assembly(), AssemblyF1::interior_assembly(), Ex6InnerProduct::interior_assembly(), Ex6EIMInnerProduct::interior_assembly(), FirstOrderScalarSystemBase::mass_residual(), SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual(), and libMesh::GenericProjector< FFunctor, GFunctor, FValue, ProjectionAction >::operator()().

368  { return _dof_indices; }
std::vector< dof_id_type > _dof_indices
Global Degree of freedom index lists.
Definition: diff_context.h:637

◆ get_dof_indices() [2/4]

std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( )

Non-const accessor for element dof indices.

Definition at line 373 of file diff_context.h.

References _dof_indices.

374  { return _dof_indices; }
std::vector< dof_id_type > _dof_indices
Global Degree of freedom index lists.
Definition: diff_context.h:637

◆ get_dof_indices() [3/4]

const std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( unsigned int  var) const

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.

381  {
382  libmesh_assert_greater(_dof_indices_var.size(), var);
383  return _dof_indices_var[var];
384  }
std::vector< std::vector< dof_id_type > > _dof_indices_var
Definition: diff_context.h:638

◆ get_dof_indices() [4/4]

std::vector<dof_id_type>& libMesh::DiffContext::get_dof_indices ( unsigned int  var)

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.

391  {
392  libmesh_assert_greater(_dof_indices_var.size(), var);
393  return _dof_indices_var[var];
394  }
std::vector< std::vector< dof_id_type > > _dof_indices_var
Definition: diff_context.h:638

◆ get_elem_fixed_solution() [1/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( ) const

Accessor for element fixed solution.

Definition at line 215 of file diff_context.h.

References _elem_fixed_solution.

216  { return _elem_fixed_solution; }
DenseVector< Number > _elem_fixed_solution
Element by element components of nonlinear_solution at a fixed point in a timestep, for optional use by e.g.
Definition: diff_context.h:603

◆ get_elem_fixed_solution() [2/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( )

Non-const accessor for element fixed solution.

Definition at line 221 of file diff_context.h.

References _elem_fixed_solution.

222  { return _elem_fixed_solution; }
DenseVector< Number > _elem_fixed_solution
Element by element components of nonlinear_solution at a fixed point in a timestep, for optional use by e.g.
Definition: diff_context.h:603

◆ get_elem_fixed_solution() [3/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( unsigned int  var) const

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.

229  {
230  libmesh_assert_greater(_elem_fixed_subsolutions.size(), var);
231  libmesh_assert(_elem_fixed_subsolutions[var]);
232  return *(_elem_fixed_subsolutions[var]);
233  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
Definition: diff_context.h:604

◆ get_elem_fixed_solution() [4/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_fixed_solution ( unsigned int  var)

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.

240  {
241  libmesh_assert_greater(_elem_fixed_subsolutions.size(), var);
242  libmesh_assert(_elem_fixed_subsolutions[var]);
243  return *(_elem_fixed_subsolutions[var]);
244  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_fixed_subsolutions
Definition: diff_context.h:604

◆ get_elem_jacobian() [1/4]

const DenseMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( ) const

◆ get_elem_jacobian() [2/4]

DenseMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( )

Non-const accessor for element Jacobian.

Definition at line 289 of file diff_context.h.

References _elem_jacobian.

290  { return _elem_jacobian; }
DenseMatrix< Number > _elem_jacobian
Element jacobian: derivatives of elem_residual with respect to elem_solution.
Definition: diff_context.h:615

◆ get_elem_jacobian() [3/4]

const DenseSubMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( unsigned int  var1,
unsigned int  var2 
) const

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.

297  {
298  libmesh_assert_greater(_elem_subjacobians.size(), var1);
299  libmesh_assert_greater(_elem_subjacobians[var1].size(), var2);
300  libmesh_assert(_elem_subjacobians[var1][var2]);
301  return *(_elem_subjacobians[var1][var2]);
302  }
std::vector< std::vector< std::unique_ptr< DenseSubMatrix< Number > > > > _elem_subjacobians
Definition: diff_context.h:632

◆ get_elem_jacobian() [4/4]

DenseSubMatrix<Number>& libMesh::DiffContext::get_elem_jacobian ( unsigned int  var1,
unsigned int  var2 
)

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.

309  {
310  libmesh_assert_greater(_elem_subjacobians.size(), var1);
311  libmesh_assert_greater(_elem_subjacobians[var1].size(), var2);
312  libmesh_assert(_elem_subjacobians[var1][var2]);
313  return *(_elem_subjacobians[var1][var2]);
314  }
std::vector< std::vector< std::unique_ptr< DenseSubMatrix< Number > > > > _elem_subjacobians
Definition: diff_context.h:632

◆ get_elem_residual() [1/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_residual ( ) const

◆ get_elem_residual() [2/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_residual ( )

Non-const accessor for element residual.

Definition at line 255 of file diff_context.h.

References _elem_residual.

256  { return _elem_residual; }
DenseVector< Number > _elem_residual
Element residual vector.
Definition: diff_context.h:609

◆ get_elem_residual() [3/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_residual ( unsigned int  var) const

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.

263  {
264  libmesh_assert_greater(_elem_subresiduals.size(), var);
265  libmesh_assert(_elem_subresiduals[var]);
266  return *(_elem_subresiduals[var]);
267  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subresiduals
Element residual subvectors and Jacobian submatrices.
Definition: diff_context.h:631

◆ get_elem_residual() [4/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_residual ( unsigned int  var)

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.

274  {
275  libmesh_assert_greater(_elem_subresiduals.size(), var);
276  libmesh_assert(_elem_subresiduals[var]);
277  return *(_elem_subresiduals[var]);
278  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subresiduals
Element residual subvectors and Jacobian submatrices.
Definition: diff_context.h:631

◆ get_elem_solution() [1/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_solution ( ) const

Accessor for element solution.

Definition at line 111 of file diff_context.h.

References _elem_solution.

112  { return _elem_solution; }
DenseVector< Number > _elem_solution
Element by element components of nonlinear_solution as adjusted by a time_solver. ...
Definition: diff_context.h:581

◆ get_elem_solution() [2/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_solution ( )

Non-const accessor for element solution.

Definition at line 117 of file diff_context.h.

References _elem_solution.

118  { return _elem_solution; }
DenseVector< Number > _elem_solution
Element by element components of nonlinear_solution as adjusted by a time_solver. ...
Definition: diff_context.h:581

◆ get_elem_solution() [3/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution ( unsigned int  var) const

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.

125  {
126  libmesh_assert_greater(_elem_subsolutions.size(), var);
127  libmesh_assert(_elem_subsolutions[var]);
128  return *(_elem_subsolutions[var]);
129  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
Definition: diff_context.h:582

◆ get_elem_solution() [4/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution ( unsigned int  var)

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.

136  {
137  libmesh_assert_greater(_elem_subsolutions.size(), var);
138  libmesh_assert(_elem_subsolutions[var]);
139  return *(_elem_subsolutions[var]);
140  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolutions
Definition: diff_context.h:582

◆ get_elem_solution_accel() [1/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( ) const

Accessor for element solution accel of change w.r.t.

time.

Definition at line 180 of file diff_context.h.

References _elem_solution_accel.

181  { return _elem_solution_accel; }
DenseVector< Number > _elem_solution_accel
Element by element components of du/dt as adjusted by a time_solver.
Definition: diff_context.h:595

◆ get_elem_solution_accel() [2/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( )

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.

188  { return _elem_solution_accel; }
DenseVector< Number > _elem_solution_accel
Element by element components of du/dt as adjusted by a time_solver.
Definition: diff_context.h:595

◆ get_elem_solution_accel() [3/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( unsigned int  var) const

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.

195  {
196  libmesh_assert_greater(_elem_subsolution_accels.size(), var);
197  libmesh_assert(_elem_subsolution_accels[var]);
198  return *(_elem_subsolution_accels[var]);
199  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_accels
Definition: diff_context.h:596

◆ get_elem_solution_accel() [4/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_accel ( unsigned int  var)

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.

206  {
207  libmesh_assert_greater(_elem_subsolution_accels.size(), var);
208  libmesh_assert(_elem_subsolution_accels[var]);
209  return *(_elem_subsolution_accels[var]);
210  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_accels
Definition: diff_context.h:596

◆ get_elem_solution_accel_derivative()

Real libMesh::DiffContext::get_elem_solution_accel_derivative ( ) const

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.

Referenced by SecondOrderScalarSystemSecondOrderTimeSolverBase::mass_residual(), and SecondOrderScalarSystemFirstOrderTimeSolverBase::mass_residual().

Real 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: diff_context.h:514

◆ get_elem_solution_derivative()

Real libMesh::DiffContext::get_elem_solution_derivative ( ) const

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.

437  { return elem_solution_derivative; }
Real elem_solution_derivative
The derivative of elem_solution with respect to the current nonlinear solution.
Definition: diff_context.h:500

◆ get_elem_solution_rate() [1/4]

const DenseVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( ) const

Accessor for element solution rate of change w.r.t.

time.

Definition at line 145 of file diff_context.h.

References _elem_solution_rate.

146  { return _elem_solution_rate; }
DenseVector< Number > _elem_solution_rate
Element by element components of du/dt as adjusted by a time_solver.
Definition: diff_context.h:588

◆ get_elem_solution_rate() [2/4]

DenseVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( )

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.

153  { return _elem_solution_rate; }
DenseVector< Number > _elem_solution_rate
Element by element components of du/dt as adjusted by a time_solver.
Definition: diff_context.h:588

◆ get_elem_solution_rate() [3/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( unsigned int  var) const

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.

160  {
161  libmesh_assert_greater(_elem_subsolution_rates.size(), var);
162  libmesh_assert(_elem_subsolution_rates[var]);
163  return *(_elem_subsolution_rates[var]);
164  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_rates
Definition: diff_context.h:589

◆ get_elem_solution_rate() [4/4]

DenseSubVector<Number>& libMesh::DiffContext::get_elem_solution_rate ( unsigned int  var)

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.

171  {
172  libmesh_assert_greater(_elem_subsolution_rates.size(), var);
173  libmesh_assert(_elem_subsolution_rates[var]);
174  return *(_elem_subsolution_rates[var]);
175  }
std::vector< std::unique_ptr< DenseSubVector< Number > > > _elem_subsolution_rates
Definition: diff_context.h:589

◆ get_elem_solution_rate_derivative()

Real libMesh::DiffContext::get_elem_solution_rate_derivative ( ) const

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 SecondOrderScalarSystemSecondOrderTimeSolverBase::damping_residual(), SecondOrderScalarSystemFirstOrderTimeSolverBase::damping_residual(), and FirstOrderScalarSystemBase::mass_residual().

Real 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: diff_context.h:507

◆ get_fixed_solution_derivative()

Real libMesh::DiffContext::get_fixed_solution_derivative ( ) const

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.

464  { return fixed_solution_derivative; }
Real fixed_solution_derivative
The derivative of elem_fixed_solution with respect to the nonlinear solution, for use by systems cons...
Definition: diff_context.h:521

◆ get_localized_subvector() [1/2]

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.

◆ get_localized_subvector() [2/2]

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

◆ get_localized_vector() [1/2]

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.

◆ get_localized_vector() [2/2]

const DenseVector<Number>& libMesh::DiffContext::get_localized_vector ( const NumericVector< Number > &  localized_vector) const

const accessible version of get_localized_vector function

◆ get_qoi_derivatives() [1/4]

const std::vector<DenseVector<Number> >& libMesh::DiffContext::get_qoi_derivatives ( ) const

Const accessor for QoI derivatives.

Definition at line 331 of file diff_context.h.

References _elem_qoi_derivative.

332  { return _elem_qoi_derivative; }
std::vector< DenseVector< Number > > _elem_qoi_derivative
Element quantity of interest derivative contributions.
Definition: diff_context.h:625

◆ get_qoi_derivatives() [2/4]

std::vector<DenseVector<Number> >& libMesh::DiffContext::get_qoi_derivatives ( )

Non-const accessor for QoI derivatives.

Definition at line 337 of file diff_context.h.

References _elem_qoi_derivative.

338  { return _elem_qoi_derivative; }
std::vector< DenseVector< Number > > _elem_qoi_derivative
Element quantity of interest derivative contributions.
Definition: diff_context.h:625

◆ get_qoi_derivatives() [3/4]

const DenseSubVector<Number>& libMesh::DiffContext::get_qoi_derivatives ( std::size_t  qoi,
unsigned int  var 
) const

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.

345  {
346  libmesh_assert_greater(_elem_qoi_subderivatives.size(), qoi);
347  libmesh_assert_greater(_elem_qoi_subderivatives[qoi].size(), var);
348  libmesh_assert(_elem_qoi_subderivatives[qoi][var]);
349  return *(_elem_qoi_subderivatives[qoi][var]);
350  }
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
Definition: diff_context.h:626

◆ get_qoi_derivatives() [4/4]

DenseSubVector<Number>& libMesh::DiffContext::get_qoi_derivatives ( std::size_t  qoi,
unsigned int  var 
)

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.

357  {
358  libmesh_assert_greater(_elem_qoi_subderivatives.size(), qoi);
359  libmesh_assert_greater(_elem_qoi_subderivatives[qoi].size(), var);
360  libmesh_assert(_elem_qoi_subderivatives[qoi][var]);
361  return *(_elem_qoi_subderivatives[qoi][var]);
362  }
std::vector< std::vector< std::unique_ptr< DenseSubVector< Number > > > > _elem_qoi_subderivatives
Definition: diff_context.h:626

◆ get_qois() [1/2]

const std::vector<Number>& libMesh::DiffContext::get_qois ( ) const

Const accessor for QoI vector.

Definition at line 319 of file diff_context.h.

References _elem_qoi.

320  { return _elem_qoi; }
std::vector< Number > _elem_qoi
Element quantity of interest contributions.
Definition: diff_context.h:620

◆ get_qois() [2/2]

std::vector<Number>& libMesh::DiffContext::get_qois ( )

Non-const accessor for QoI vector.

Definition at line 325 of file diff_context.h.

References _elem_qoi.

326  { return _elem_qoi; }
std::vector< Number > _elem_qoi
Element quantity of interest contributions.
Definition: diff_context.h:620

◆ get_system()

const System& libMesh::DiffContext::get_system ( ) const

Accessor for associated system.

Definition at line 105 of file diff_context.h.

References _system.

106  { return _system; }
const System & _system
A reference to the system this context is constructed with.
Definition: diff_context.h:658

◆ get_system_time()

Real libMesh::DiffContext::get_system_time ( ) const

Accessor for the time variable stored in the system class.

Definition at line 415 of file diff_context.h.

References system_time.

416  { return system_time; }
const Real system_time
This is the time stored in the System class at the time this context was created, i...
Definition: diff_context.h:494

◆ get_time()

Real libMesh::DiffContext::get_time ( ) const

Accessor for the time for which the current nonlinear_solution is defined.

Definition at line 421 of file diff_context.h.

References time.

422  { return time; }
Real time
For time-dependent problems, this is the time t for which the current nonlinear_solution is defined...
Definition: diff_context.h:485

◆ is_adjoint() [1/2]

bool libMesh::DiffContext::is_adjoint ( ) const

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.

471  { return _is_adjoint; }
bool _is_adjoint
Is this context to be used for a primal or adjoint solve?
Definition: diff_context.h:663

◆ is_adjoint() [2/2]

bool& libMesh::DiffContext::is_adjoint ( )

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.

478  { return _is_adjoint; }
bool _is_adjoint
Is this context to be used for a primal or adjoint solve?
Definition: diff_context.h:663

◆ n_dof_indices() [1/2]

unsigned int libMesh::DiffContext::n_dof_indices ( ) const

Total number of dof indices on the element.

Definition at line 399 of file diff_context.h.

References _dof_indices.

400  { return cast_int<unsigned int>(_dof_indices.size()); }
std::vector< dof_id_type > _dof_indices
Global Degree of freedom index lists.
Definition: diff_context.h:637

◆ n_dof_indices() [2/2]

unsigned int libMesh::DiffContext::n_dof_indices ( unsigned int  var) const

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.

407  {
408  libmesh_assert_greater(_dof_indices_var.size(), var);
409  return cast_int<unsigned int>(_dof_indices_var[var].size());
410  }
std::vector< std::vector< dof_id_type > > _dof_indices_var
Definition: diff_context.h:638

◆ n_vars()

unsigned int libMesh::DiffContext::n_vars ( ) const

Number of variables in solution.

Definition at line 99 of file diff_context.h.

References _dof_indices_var.

100  { return cast_int<unsigned int>(_dof_indices_var.size()); }
std::vector< std::vector< dof_id_type > > _dof_indices_var
Definition: diff_context.h:638

◆ nonlocal_reinit()

virtual void libMesh::DiffContext::nonlocal_reinit ( Real  )
virtual

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.

94 {}

◆ set_deltat_pointer()

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.

◆ set_time()

void libMesh::DiffContext::set_time ( Real  time_in)

Set the time for which the current nonlinear_solution is defined.

Definition at line 427 of file diff_context.h.

References time.

428  { time = time_in; }
Real time
For time-dependent problems, this is the time t for which the current nonlinear_solution is defined...
Definition: diff_context.h:485

Member Data Documentation

◆ _deltat

Real* libMesh::DiffContext::_deltat
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.

◆ _dof_indices

std::vector<dof_id_type> libMesh::DiffContext::_dof_indices
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().

◆ _dof_indices_var

std::vector<std::vector<dof_id_type> > libMesh::DiffContext::_dof_indices_var
protected

Definition at line 638 of file diff_context.h.

Referenced by get_dof_indices(), n_dof_indices(), and n_vars().

◆ _elem_fixed_solution

DenseVector<Number> libMesh::DiffContext::_elem_fixed_solution
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 get_elem_fixed_solution().

◆ _elem_fixed_subsolutions

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_fixed_subsolutions
protected

Definition at line 604 of file diff_context.h.

Referenced by get_elem_fixed_solution().

◆ _elem_jacobian

DenseMatrix<Number> libMesh::DiffContext::_elem_jacobian
protected

Element jacobian: derivatives of elem_residual with respect to elem_solution.

Definition at line 615 of file diff_context.h.

Referenced by get_elem_jacobian().

◆ _elem_qoi

std::vector<Number> libMesh::DiffContext::_elem_qoi
protected

Element quantity of interest contributions.

Definition at line 620 of file diff_context.h.

Referenced by get_qois().

◆ _elem_qoi_derivative

std::vector<DenseVector<Number> > libMesh::DiffContext::_elem_qoi_derivative
protected

Element quantity of interest derivative contributions.

Definition at line 625 of file diff_context.h.

Referenced by get_qoi_derivatives().

◆ _elem_qoi_subderivatives

std::vector<std::vector<std::unique_ptr<DenseSubVector<Number> > > > libMesh::DiffContext::_elem_qoi_subderivatives
protected

Definition at line 626 of file diff_context.h.

Referenced by get_qoi_derivatives().

◆ _elem_residual

DenseVector<Number> libMesh::DiffContext::_elem_residual
protected

Element residual vector.

Definition at line 609 of file diff_context.h.

Referenced by get_elem_residual().

◆ _elem_solution

DenseVector<Number> libMesh::DiffContext::_elem_solution
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 get_elem_solution().

◆ _elem_solution_accel

DenseVector<Number> libMesh::DiffContext::_elem_solution_accel
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 get_elem_solution_accel().

◆ _elem_solution_rate

DenseVector<Number> libMesh::DiffContext::_elem_solution_rate
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 get_elem_solution_rate().

◆ _elem_subjacobians

std::vector<std::vector<std::unique_ptr<DenseSubMatrix<Number> > > > libMesh::DiffContext::_elem_subjacobians
protected

Definition at line 632 of file diff_context.h.

Referenced by get_elem_jacobian().

◆ _elem_subresiduals

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subresiduals
protected

Element residual subvectors and Jacobian submatrices.

Definition at line 631 of file diff_context.h.

Referenced by get_elem_residual().

◆ _elem_subsolution_accels

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subsolution_accels
protected

Definition at line 596 of file diff_context.h.

Referenced by get_elem_solution_accel().

◆ _elem_subsolution_rates

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subsolution_rates
protected

Definition at line 589 of file diff_context.h.

Referenced by get_elem_solution_rate().

◆ _elem_subsolutions

std::vector<std::unique_ptr<DenseSubVector<Number> > > libMesh::DiffContext::_elem_subsolutions
protected

Definition at line 582 of file diff_context.h.

Referenced by get_elem_solution().

◆ _is_adjoint

bool libMesh::DiffContext::_is_adjoint
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().

◆ _localized_vectors

std::map<const NumericVector<Number> *, std::pair<DenseVector<Number>, std::vector<std::unique_ptr<DenseSubVector<Number> > > > > libMesh::DiffContext::_localized_vectors
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.

◆ _system

const System& libMesh::DiffContext::_system
private

A reference to the system this context is constructed with.

Definition at line 658 of file diff_context.h.

Referenced by get_system().

◆ elem_solution_accel_derivative

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 get_elem_solution_accel_derivative().

◆ elem_solution_derivative

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 get_elem_solution_derivative().

◆ elem_solution_rate_derivative

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 get_elem_solution_rate_derivative().

◆ fixed_solution_derivative

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 get_fixed_solution_derivative().

◆ system_time

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().

◆ 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().


The documentation for this class was generated from the following file: