# [deal.II] Apply Neumann Boundary condition

```Dear All,
I want to apply non-zero neumann boundary condition on the curved domain of
half of the circle. The way that I define my geometry, the boundary id and
apply the Neumann B.C is written as follow:```
```
*Defining boundary id for different sections of domain (half_hyper_ball):*

const double tol_boundary = 1e-12
for (typename Triangulation<dim> ::active_cell_iterator
cell=triangulation.begin_active();
cell!=triangulation.end(); ++cell)
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
if (cell->face(face)->at_boundary() == true)
{
const Point<dim> face_center = cell->face(face)->center();
if
(std::abs(std::sqrt(face_center[0]*face_center[0]+face_center[1]*face_center[1])
cell->face(face)->set_boundary_id (2); // faces on the outer
curved edge of the domain...
else
cell->face(face)->set_boundary_id (1);

*// Implying the mechanical boundary value to the curved surface of the
domain that appears on the right hand side *

for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell;
++face)
if (cell->face(face)->at_boundary() == true
&& cell->face(face)->boundary_id() == 2)
{
scratch.fe_face_values_ref.reinit(cell, face);
for (unsigned int f_q_point=0; f_q_point<n_q_points_f; ++f_q_point)
{
const double eta_orderM =
for (unsigned int i=0; i<dofs_per_cell; ++i)
{
const unsigned int i_group =fe.system_to_base_index(i).first.first;
if (i_group == u_dof)
{
const Tensor<1, dim> neumann_value = eta_orderM *
scratch.fe_face_values_ref.normal_vector(f_q_point);
const unsigned int component_i =
fe.system_to_component_index(i).first;
const double JxW = scratch.fe_face_values_ref.JxW(f_q_point);
data.cell_rhs(i) += neumann_value[component_i] *
scratch.fe_face_values_ref.shape_value(i, f_q_point) * JxW;
}
}
}
}
It would be very kind of you if you let me know whether this definition for
the Neumann boundary condition on the curved side of my domain is true or
not.
Bests,
Benhour

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see