void GRINS::BoundaryConditions::apply_neumann_axisymmetric( libMesh::FEMContext& context, const CachedValues& cache, const bool request_jacobian, const GRINS::VariableIndex var, const libMesh::Real sign, std::tr1::shared_ptr<GRINS::NeumannFuncObj> neumann_func ) const { // The number of local degrees of freedom const unsigned int n_var_dofs = context.dof_indices_var[var].size(); // Element Jacobian * quadrature weight for side integration. const std::vector<libMesh::Real> &JxW_side = context.side_fe_var[var]->get_JxW(); // The var shape functions at side quadrature points. const std::vector<std::vector<libMesh::Real> >& var_phi_side = context.side_fe_var[var]->get_phi(); // Physical location of the quadrature points const std::vector<libMesh::Point>& var_qpoint = context.side_fe_var[var]->get_xyz(); const std::vector<libMesh::Point> &normals = context.side_fe_var[var]->get_normals(); libMesh::DenseSubVector<libMesh::Number> &F_var = *context.elem_subresiduals[var]; // residual libMesh::DenseSubMatrix<libMesh::Number> &K_var = *context.elem_subjacobians[var][var]; // jacobian unsigned int n_qpoints = context.side_qrule->n_points(); for (unsigned int qp=0; qp != n_qpoints; qp++) { const libMesh::Point bc_value = neumann_func->value( context, cache, qp ); const libMesh::Point jac_value = neumann_func->derivative( context, cache, qp ); const libMesh::Number r = var_qpoint[qp](0); for (unsigned int i=0; i != n_var_dofs; i++) { F_var(i) += sign*r*JxW_side[qp]*bc_value*normals[qp]*var_phi_side[i][qp]; if (request_jacobian) { for (unsigned int j=0; j != n_var_dofs; j++) { K_var(i,j) += sign*r*JxW_side[qp]*jac_value*normals[qp]* var_phi_side[i][qp]*var_phi_side[j][qp]; } } } } // End quadrature loop // Now must take care of the case that the boundary condition depends on variables // other than var. std::vector<VariableIndex> other_jac_vars = neumann_func->get_other_jac_vars(); if( (other_jac_vars.size() > 0) && request_jacobian ) { for( std::vector<VariableIndex>::const_iterator var2 = other_jac_vars.begin(); var2 != other_jac_vars.end(); var2++ ) { libMesh::DenseSubMatrix<libMesh::Number> &K_var2 = *context.elem_subjacobians[var][*var2]; // jacobian const unsigned int n_var2_dofs = context.dof_indices_var[*var2].size(); const std::vector<std::vector<libMesh::Real> >& var2_phi_side = context.side_fe_var[*var2]->get_phi(); for (unsigned int qp=0; qp != n_qpoints; qp++) { const libMesh::Number r = var_qpoint[qp](0); const libMesh::Point jac_value = neumann_func->derivative( context, cache, qp, *var2 ); for (unsigned int i=0; i != n_var_dofs; i++) { for (unsigned int j=0; j != n_var2_dofs; j++) { K_var2(i,j) += sign*r*JxW_side[qp]*jac_value*normals[qp]* var_phi_side[i][qp]*var2_phi_side[j][qp]; } } } } // End loop over auxillary Jacobian variables } return; }