32 #include "libmesh/getpot.h"
33 #include "libmesh/fem_system.h"
34 #include "libmesh/quadrature.h"
43 "Physics/"+physics_name+
"/Function/value",
49 for( std::vector<VariableIndex>::const_iterator v_it =
_vars.begin();
50 v_it !=
_vars.end(); ++v_it )
54 context.get_element_fe(var)->get_JxW();
55 context.get_element_fe(var)->get_phi();
56 context.get_element_fe(var)->get_xyz();
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();
79 const std::vector<libMesh::Point>& x_qp = context.get_element_fe(var)->get_xyz();
82 libMesh::DenseSubVector<libMesh::Number> &F_var = context.get_elem_residual(var);
84 libMesh::Real t = context.get_time();
92 unsigned int n_qpoints = context.get_element_qrule().n_points();
94 for (
unsigned int qp=0; qp != n_qpoints; qp++)
96 libMesh::Real value = (this->_value)(x_qp[qp],t);
98 for (
unsigned int i=0; i != n_dofs; i++)
100 F_var(i) += 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.
libMesh::ParsedFunction< libMesh::Real > _value
Base class for generic source function term, f(x,y,z,t).
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context)
Time dependent part(s) of physics for element interiors.