Dear all
I have a code that works fine. Now, I am working to change the code structure to use “workstream”. The new code works fine without adaptive refinement. However, when the mesh is refined and the triangulation has hanging node, a constant residual error remains during Newton iteration. I cant find source of the problem.
There are two “constraints matrix”. On of them for “Newton update” and one for “hanging nodes”. The constraints matrix are merged and is used to determine error as:
BlockVector<double> error_ud(dofs_per_block);
for (unsigned int i = 0; i < dof_handler_ref.n_dofs(); ++i)
if (!constraints_update.is_constrained(i))
error_ud(i) = system_rhs(i);
error_update.norm = error_ud.l2_norm();
Regards
Pasha
I have a code that works fine. Now, I am working to change the code structure to use “workstream”. The new code works fine without adaptive refinement. However, when the mesh is refined and the triangulation has hanging node, a constant residual error remains during Newton iteration. I cant find source of the problem
Dear Denis
I checked the the system residual assembly process. For a triangulation with 28 cells, the dof index 17 is belong to cells 2, 5, 8 and 27. The corresponding cell_rhs values for this index are,
cell cell_rhs value
2 2.88462e+00
5 2.88462e+00
8 -2.88462e+00
27 -1.44231e+00
This dof is not constrained. When the following assembly method is used:
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(data.local_dof_indices[i]) += data.cell_rhs(i);
the system_rhs(17) = 1.4423076, however, using the following method,
constraints_update.distribute_local_to_global(data.cell_rhs,
data.local_dof_indices, system_rhs);
the system_rhs(17) = -1.33e-15. This is the source of the problem because I have used the second method in the previous code and the first one (similar to step-44) in the new code. I cant understand why the results are different.
Regards
P.
I checked the the system residual assembly process. For a triangulation with 28 cells, the dof index 17 is belong to cells 2, 5, 8 and 27. The corresponding cell_rhs values for this index are,
cell cell_rhs value
2 2.88462e+00
5 2.88462e+00
8 -2.88462e+00
27 -1.44231e+00
This dof is not constrained. When the following assembly method is used:
for (unsigned int i = 0; i < dofs_per_cell; ++i)
system_rhs(data.local_dof_indices[i]) += data.cell_rhs(i);
the system_rhs(17) = 1.4423076, however, using the following method,
constraints_update.distribute_local_to_global(data.cell_rhs,
data.local_dof_indices, system_rhs);
the system_rhs(17) = -1.33e-15. This is the source of the problem because I have used the second method in the previous code and the first one (similar to step-44) in the new code. I cant understand why the results are different.
Dear Daniel
After solving constraints_update.distribute is called. In addition, after assembling the system matrix and residual vector using the first method, constraints_update.condense is called before solving the system. After that the solution is updated and the new residual is calculated based on the first method, so in error calculation the constraints are considered as,
BlockVector<double> error_res(dofs_per_block);
for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
if (!constraints_update.is_constrained(i))
error_res(i) = system_rhs(i);
error_residual.norm = error_res.l2_norm();
constraints update
1 = 0
3 = 0
11 = 0
21 = 0
22 10: 5.00000e-01
22 14: 5.00000e-01
23 15: 5.00000e-01
24 14: 5.00000e-01
24 16: 5.00000e-01
25 15: 5.00000e-01
25 17: 5.00000e-01
26 16: 5.00000e-01
26 40: 5.00000e-01
27 17: 5.00000e-01
27 41: 5.00000e-01
42 = 0
43 = 1.00000e-04
45 = 1.00000e-04
46 = 0
49 = 1.00000e-04
51 = 1.00000e-04
53 = 1.00000e-04
55 = 0
56 40: 5.00000e-01
57 41: 5.00000e-01
57 59: 5.00000e-01
58 = 0
69 = 0
70 = 0
72 = 0
78 = 0
79 = 0
80 = 0
93 87: 5.00000e-01
93 89: 5.00000e-01
94 89: 5.00000e-01
94 90: 5.00000e-01
95 90: 5.00000e-01
95 102: 5.00000e-01
110 102: 5.00000e-01
110 111: 5.00000e-01
constraints hanging nodes
22 10: 5.00000e-01
22 14: 5.00000e-01
23 11: 5.00000e-01
23 15: 5.00000e-01
24 14: 5.00000e-01
24 16: 5.00000e-01
25 15: 5.00000e-01
25 17: 5.00000e-01
26 16: 5.00000e-01
26 40: 5.00000e-01
27 17: 5.00000e-01
27 41: 5.00000e-01
56 40: 5.00000e-01
56 58: 5.00000e-01
57 41: 5.00000e-01
57 59: 5.00000e-01
93 87: 5.00000e-01
93 89: 5.00000e-01
94 89: 5.00000e-01
94 90: 5.00000e-01
95 90: 5.00000e-01
95 102: 5.00000e-01
110 102: 5.00000e-01
110 111: 5.00000e-01
Thank you.
Pasha