question about the neumann boundary

20 views
Skip to first unread message

Yunfei Huang

unread,
Aug 18, 2025, 10:38:29 AMAug 18
to deal.II User Group
Hi Everyone, 

Here, I have attempted to add the Neumann boundary conditions (forces) to the 2D elasticity problem. Now I can see that the top two layers of grids are under force. The force on the top layer is smaller than that on the second layer.  please see my attachment figure. 

My question is: should there be one layer or not in the boundary layer?
If it is only one layer, why did I get these results?

Here is my code: 
for (; cell!=endc; ++cell){
cell_matrix = 0;
cell_rhs = 0;

int traction_surface_id = 7;
for (unsigned int face=0; face<GeometryInfo<dim>::faces_per_cell; ++face)
if (cell->face(face)->at_boundary() &&
cell->face(face)->boundary_id() == traction_surface_id)
{
fe_face_values.reinit(cell, face);
boundary_force_neumann.vector_value_list(fe_face_values.get_quadrature_points(),
boundary_force_values);

for (unsigned int q_point=0; q_point<n_face_q_points; ++q_point)
{
for (unsigned int i = 0; i < dofs_per_cell; ++i)
{
const unsigned int component_i = fe.system_to_component_index(i).first;
// if (component_i==1)
cell_rhs(i) += fe_values.shape_value(i,q_point) *
boundary_force_values[q_point][component_i]*
// neumann_value[0][component_i]*
fe_values.JxW(q_point);
}
}
}

Best regards,

Yunfei 
Screenshot 2025-08-18 at 16.13.47.png

Luca Heltai

unread,
Aug 18, 2025, 10:56:44 AMAug 18
to Deal.II Users
Careful: you are still using

> fe_values.shape_value

but you should be using

> fe_face_values.shape_value

and

> fe_face_values.JxW(q_point);

You are now adding just *volumetric* forces on *some* quadrature points *inside* the cell, not on the boundary.

Best,
L.
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dealii+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/dealii/8d2c5d91-364f-46db-8f90-e38c75747cecn%40googlegroups.com.
> <Screenshot 2025-08-18 at 16.13.47.png>

Yunfei Huang

unread,
Aug 18, 2025, 11:03:37 AMAug 18
to dea...@googlegroups.com
Dear Mr. Heltai, 

Thanks a lot. it works now.

Best regards,

Yunfei 


Luca Heltai <luca....@gmail.com> 于2025年8月18日周一 16:56写道:
Reply all
Reply to author
Forward
0 new messages