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);
63 for( std::vector<VariableIndex>::const_iterator v_it =
_vars.begin();
64 v_it !=
_vars.end(); ++v_it )
69 const unsigned int n_dofs = context.get_dof_indices(var).size();
72 const std::vector<libMesh::Real> &JxW =
73 context.get_element_fe(var)->get_JxW();
76 const std::vector<std::vector<libMesh::Real> >& phi =
77 context.get_element_fe(var)->get_phi();
80 libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var);
88 unsigned int n_qpoints = context.get_element_qrule().n_points();
90 for (
unsigned int qp=0; qp != n_qpoints; qp++)
92 for (
unsigned int i=0; i != n_dofs; i++)
94 F_var(i) += (this->
_value)*phi[i][qp]*JxW[qp];
std::vector< VariableIndex > _vars
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.
virtual ~ConstantSourceTerm()
Base class for generic source function term, f(x,y,z,t).
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors.