36 #include "libmesh/utility.h"
37 #include "libmesh/string_to_enum.h"
38 #include "libmesh/getpot.h"
39 #include "libmesh/fem_system.h"
40 #include "libmesh/quadrature.h"
80 (
bool compute_jacobian,
84 const unsigned int n_u_dofs = context.get_dof_indices(_flow_vars.u()).size();
85 const unsigned int n_T_dofs = context.get_dof_indices(_temp_vars.T()).size();
88 const std::vector<libMesh::Real> &JxW =
89 context.get_element_fe(_flow_vars.u())->get_JxW();
92 const std::vector<std::vector<libMesh::Real> >& vel_phi =
93 context.get_element_fe(_flow_vars.u())->get_phi();
96 const std::vector<std::vector<libMesh::Real> >& T_phi =
97 context.get_element_fe(_temp_vars.T())->get_phi();
100 const std::vector<libMesh::Point>& u_qpoint =
101 context.get_element_fe(_flow_vars.u())->get_xyz();
104 libMesh::DenseSubVector<libMesh::Number> &Fr = context.get_elem_residual(_flow_vars.u());
105 libMesh::DenseSubVector<libMesh::Number> &Fz = context.get_elem_residual(_flow_vars.v());
108 libMesh::DenseSubMatrix<libMesh::Number> &KrT = context.get_elem_jacobian(_flow_vars.u(), _temp_vars.T());
109 libMesh::DenseSubMatrix<libMesh::Number> &KzT = context.get_elem_jacobian(_flow_vars.v(), _temp_vars.T());
117 unsigned int n_qpoints = context.get_element_qrule().n_points();
119 for (
unsigned int qp=0; qp != n_qpoints; qp++)
121 const libMesh::Number r = u_qpoint[qp](0);
125 T = context.interior_value(_temp_vars.T(), qp);
130 for (
unsigned int i=0; i != n_u_dofs; i++)
132 Fr(i) += -_rho*_beta_T*(T - _T_ref)*_g(0)*vel_phi[i][qp]*r*JxW[qp];
133 Fz(i) += -_rho*_beta_T*(T - _T_ref)*_g(1)*vel_phi[i][qp]*r*JxW[qp];
135 if (compute_jacobian && context.get_elem_solution_derivative())
137 for (
unsigned int j=0; j != n_T_dofs; j++)
139 const libMesh::Number val =
140 -_rho*_beta_T*vel_phi[i][qp]*T_phi[j][qp]*r*JxW[qp]
141 * context.get_elem_solution_derivative();
142 KrT(i,j) += val*_g(0);
143 KzT(i,j) += val*_g(1);
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.
Physics abstract base class. Defines API for physics to be added to MultiphysicsSystem.
static PhysicsName axisymmetric_boussinesq_buoyancy()
const VelocityVariable & _flow_vars
void read_input_options(const GetPot &input)
Read options from GetPot input file.
virtual void init_context(AssemblyContext &context)
Initialize context for added physics variables.
const PrimitiveTempFEVariables & _temp_vars
libMesh::Point _g
Gravitational vector.
libMesh::Number _T_ref
reference temperature
libMesh::Number _rho
density
AxisymmetricBoussinesqBuoyancy()
libMesh::Number _beta_T
coefficient of thermal expansion
virtual void element_time_derivative(bool compute_jacobian, AssemblyContext &context)
Source term contribution for AxisymmetricBoussinesqBuoyancy.