Adding inhomogeneity to Periodic BC

31 views
Skip to first unread message

Raghunandan Pratoori

unread,
Oct 22, 2021, 9:01:18 PM10/22/21
to deal.II User Group
Hello,

I have a cube with periodicity in all 3 directions. I want to add inhomogeneity in addition to Periodic BC on one face. Below is what I have done -

{
            IndexSet selected_dofs_z;
            std::set<types::boundary_id> boundary_ids_z = std::set<types::boundary_id>();
                boundary_ids_x.insert(4);
            DoFTools::extract_boundary_dofs(dof_handler, fe.component_mask(z_displacement),
                                            selected_dofs_z, boundary_ids_z);
            unsigned int nb_dofs_face_z = selected_dofs_z.n_elements();
            IndexSet::ElementIterator dofs_z = selected_dofs_z.begin();

            double relative_displacement_z = 1e-5;

            for(unsigned int i = 0; i < nb_dofs_face_z; i++)
            {
                constraints.add_line(*dofs_z);
                constraints.set_inhomogeneity(*dofs_z, relative_displacement_z));
                dofs_z++;
            }
        }
When I do this on single 8 noded element, I get the constraints as -
2 = 0.001
    3 0:  1
    4 1:  1
    5 = 0.002
    6 0:  1
    7 1:  1
    8 = 0.002
    9 0:  1
    10 1:  1
    11 = 0.003
    12 0:  1
    13 1:  1
    14 = 0.001
    15 0:  1
    16 1:  1
    17 = 0.001
    18 0:  1
    19 1:  1
    20 = 0.001
    21 0:  1
    22 1:  1
    23 = 0.001
When I should be getting -
2 = 0.001
    3 0:  1
    4 1:  1
    5 = 0.001
    6 0:  1
    7 1:  1
    8 = 0.001
    9 0:  1
    10 1:  1
    11 = 0.001
    12 0:  1
    13 1:  1
    14 = 0.001
    15 0:  1
    16 1:  1
    17 = 0.001
    18 0:  1
    19 1:  1
    20 = 0.001
    21 0:  1
    22 1:  1
    23 = 0.001
Is there a mistake in how I am using set_inhomogeneity?

Thanks in advance,
Raghunandan.

Raghunandan Pratoori

unread,
Oct 23, 2021, 5:08:39 PM10/23/21
to deal.II User Group
I realized that the above situation is arising because of close(). Is there a way to add inhomogeneity without it being added again because of periodic condition?

Best,
Reply all
Reply to author
Forward
0 new messages