32 #include "libmesh/getpot.h"
33 #include "libmesh/fem_system.h"
34 #include "libmesh/quadrature.h"
40 _value( input(
"Physics/"+physics_name+
"/Function/value",
"DIE!") )
42 if( !input.have_variable(
"Physics/"+physics_name+
"/Function/value") )
44 libMesh::err <<
"Error: Must specify value for ParsedSourceTerm." << std::endl
45 <<
" Please specify Physics/"+physics_name+
"/Function/value" << std::endl;
61 for( std::vector<VariableIndex>::const_iterator v_it =
_vars.begin();
62 v_it !=
_vars.end(); ++v_it )
67 const unsigned int n_dofs = context.get_dof_indices(var).size();
70 const std::vector<libMesh::Real> &JxW =
71 context.get_element_fe(var)->get_JxW();
74 const std::vector<std::vector<libMesh::Real> >& phi =
75 context.get_element_fe(var)->get_phi();
77 const std::vector<libMesh::Point>& x_qp = context.get_element_fe(var)->get_xyz();
80 libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var);
82 libMesh::Real t = context.get_time();
90 unsigned int n_qpoints = context.get_element_qrule().n_points();
92 for (
unsigned int qp=0; qp != n_qpoints; qp++)
94 libMesh::Real value = (this->
_value)(x_qp[qp],t);
96 for (
unsigned int i=0; i != n_dofs; i++)
98 F_var(i) += value*phi[i][qp]*JxW[qp];
std::vector< VariableIndex > _vars
unsigned int VariableIndex
More descriptive name of the type used for variable indices.
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context, CachedValues &cache)
Time dependent part(s) of physics for element interiors.
libMesh::ParsedFunction< libMesh::Real > _value
Base class for generic source function term, f(x,y,z,t).
virtual ~ParsedSourceTerm()