Hello,
I am trying to constrain one beam to another by using the Affine constraint
class. However, I have observed a discrepancy in the sparsity pattern thus
generated (with connectivity constraint - all dofs on boundary id 1 are
connected with all dofs of boundary id 2) which I am not able to
understand. Here's the code snippet that i use for connecting the beams:
std::vector<bool>
component_select(dof_handler.get_fe().n_components(),true);
std::set<types::boundary_id> id_boundary1 = {1};
std::set<types::boundary_id> id_boundary2 = {2};
const IndexSet connected_dofs1 =
DoFTools::extract_boundary_dofs(dof_handler,component_select,id_boundary1);
const IndexSet connected_dofs2 =
DoFTools::extract_boundary_dofs(dof_handler,component_select,id_boundary2);
std::cout << "Dof of beam 1: ";
connected_dofs1.print(std::cout);
std::cout << "should be constrained with dofs of beam 2: ";
connected_dofs2.print(std::cout);
constraints.add_lines(connected_dofs1);
std::cout << "Constrained dof1: " << connected_dofs1.nth_index_in_set(0) <<
"constrained dof2: "
<<connected_dofs2.nth_index_in_set(0) << std::endl;
constraints.add_entry(connected_dofs1.nth_index_in_set(0),connected_dofs2.nth_index_in_set(0),-1);
constraints.add_entry(connected_dofs1.nth_index_in_set(1),connected_dofs2.nth_index_in_set(1),-1);
constraints.add_entry(connected_dofs1.nth_index_in_set(2),connected_dofs2.nth_index_in_set(2),-1);
constraints.add_entry(connected_dofs1.nth_index_in_set(3),connected_dofs2.nth_index_in_set(3),-1);
constraints.add_entry(connected_dofs1.nth_index_in_set(4),connected_dofs2.nth_index_in_set(4),-1);
constraints.add_entry(connected_dofs1.nth_index_in_set(5),connected_dofs2.nth_index_in_set(5),-1);
constraints.close();
DynamicSparsityPattern dsp(all_dofs, all_dofs);
DoFTools::make_sparsity_pattern(dof_handler, dsp,constraints);
sparsity_pattern.copy_from(dsp);
system_matrix_network.reinit(sparsity_pattern);
std::ostringstream oss;
oss <<"sparsity_pattern.svg";
std::string filename = oss.str();
std::ofstream output(filename.c_str());
sparsity_pattern.print_svg(output);
The output I get is as follows:
Constrained dof of beam 1: {[12,17]}
Constrained dof of beam 2: {[18,23]}
Constrained dof1: 12 constrained dof2: 18
I have attached the png files of the sparsity pattern generated with and
without the above constraints. Image1.png is the sparsity pattern without
the above constraint and Image2.png is the sparsity pattern with the above
constraint.
As per the output, I expect that columns 18-23 in rows 12-17 should be
non-zero and vice versa. That is, the non-zero entries due to the above
constraints should have been as highlighted in green in Image2.png.
However, clearly, in Image2.png I see that this isn't the case. Columns
18-23 are non-zero in rows 6-11 (instead of rows 12-17) and vice versa
(highlighted in blue).
I am not able to figure out this discrepancy. Can someone help?
Thanks
Vinayak
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/4d53cde4-e2f7-4230-859a-1fce4074fa40n%40googlegroups.com.