32 #include "libmesh/getpot.h"
33 #include "libmesh/fem_system.h"
34 #include "libmesh/quadrature.h"
42 if( !input.have_variable(
"Physics/"+physics_name+
"/Function/value") )
44 libMesh::err <<
"Error: Must specify value for ConstantSourceTerm." << std::endl
45 <<
" Please specify Physics/"+physics_name+
"/Function/value" << std::endl;
51 "Physics/"+physics_name+
"/Function/value",
_value);
57 for( std::vector<VariableIndex>::const_iterator v_it = _vars.begin();
58 v_it != _vars.end(); ++v_it )
63 const unsigned int n_dofs = context.get_dof_indices(var).size();
66 const std::vector<libMesh::Real> &JxW =
67 context.get_element_fe(var)->get_JxW();
70 const std::vector<std::vector<libMesh::Real> >& phi =
71 context.get_element_fe(var)->get_phi();
74 libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var);
82 unsigned int n_qpoints = context.get_element_qrule().n_points();
84 for (
unsigned int qp=0; qp != n_qpoints; qp++)
86 for (
unsigned int i=0; i != n_dofs; i++)
88 F_var(i) += (this->_value)*phi[i][qp]*JxW[qp];
virtual void set_parameter(libMesh::Number ¶m_variable, const GetPot &input, const std::string ¶m_name, libMesh::Number param_default)
Each subclass can simultaneously read a parameter value from.
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
Base class for generic source function term, f(x,y,z,t).
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context)
Time dependent part(s) of physics for element interiors.