void AverageNusseltNumber::side_qoi( AssemblyContext& context, const unsigned int qoi_index ) { bool on_correct_side = false; for (std::set<libMesh::boundary_id_type>::const_iterator id = _bc_ids.begin(); id != _bc_ids.end(); id++ ) if( context.has_side_boundary_id( (*id) ) ) { on_correct_side = true; break; } if (!on_correct_side) return; libMesh::FEBase* side_fe; context.get_side_fe<libMesh::Real>(this->_T_var, side_fe); const std::vector<libMesh::Real> &JxW = side_fe->get_JxW(); const std::vector<libMesh::Point>& normals = side_fe->get_normals(); unsigned int n_qpoints = context.get_side_qrule().n_points(); libMesh::Number& qoi = context.get_qois()[qoi_index]; // Loop over quadrature points for (unsigned int qp = 0; qp != n_qpoints; qp++) { // Get the solution value at the quadrature point libMesh::Gradient grad_T = 0.0; context.side_gradient(this->_T_var, qp, grad_T); // Update the elemental increment dR for each qp qoi += (this->_scaling)*(this->_k)*(grad_T*normals[qp])*JxW[qp]; } // quadrature loop }
void ParsedInteriorQoI::element_qoi( AssemblyContext& context, const unsigned int qoi_index ) { libMesh::FEBase* element_fe; context.get_element_fe<libMesh::Real>(0, element_fe); const std::vector<libMesh::Real> &JxW = element_fe->get_JxW(); const std::vector<libMesh::Point>& x_qp = element_fe->get_xyz(); unsigned int n_qpoints = context.get_element_qrule().n_points(); /*! \todo Need to generalize this to the multiple QoI case */ libMesh::Number& qoi = context.get_qois()[qoi_index]; for( unsigned int qp = 0; qp != n_qpoints; qp++ ) { const libMesh::Number func_val = (*qoi_functional)(context, x_qp[qp], context.get_time()); qoi += func_val * JxW[qp]; } }