Thank-you Markus!

I think that between your explanation and the step-27 tutorial I could implement it.

Thanks again.
Best
Isa

Markus Bürg escribió:
Hello Isa,

your code would then look like the following:

hp::DoFHandler<2> dof_handler_laplace, dof_handler_NS;
Triangulation<2>         triangulation;

FE_Q<2>                  fe_fc;
FE_Q<2>                  fe_velocity;
FE_Q<2>                  fe_pressure;
FESystem<2>              fe_total;
FE_Nothing<2> fe_n;
//In my construction method I did:

dof_handler_laplace(triangulation),
dof_handler_NS(triangulation),
fe_fc(2),
fe_velocity(2),
fe_pressure(2),
fe_total(fe_velocity,2, fe_pressure,1),
hp::FECollection<2> fe;
fe.push_back (fe_total);
fe.push_back (fe_fc);
fe.push_back (fe_n);

for (hp::DoFHandler<2>::active_cell_iterator cell = dof_handler_laplace.begin_active (); cell != dof_handler_laplace.end (); ++cell) if ((cell->material_id () == 3) || (cell->material_id () == 4) || (cell->material_id () == 5))
cell->set_active_fe_index (1);
else
cell->set_active_fe_index (2);
dof_handler_laplace.distribute_dofs(fe_fc);
DoFRenumbering::component_wise(dof_handler_laplace);
for (hp::DoFHandler<2>::active_cell_iterator cell = dof_handler_laplace.begin_active (); cell != dof_handler_laplace.end (); ++cell)
if (cell->material_id () != 4)
cell->set_active_fe_index (0);
else
cell->set_active_fe_index (2);
dof_handler_NS.distribute_dofs(fe_total);
DoFRenumbering::component_wise(dof_handler_NS);
For further inside on this approach, you should have a look in step-27. There the hp-namespace is used and you can see how it basically works.
If I used FECollection and FE_Nothing classes, I wouldn't know how to
create the construction method or the initialization one. How would it be?
I am not sure, where you face problems in these steps right now. So, have a look at step-27 and, if you then still have unsolved points, let us consider them in detail.
Besides, other doubts I have are the following ones:

(Regarding the picture I "draw" in my first email)

1) Regarding Navier-Stokes equations: If I put FE_System with FE_Q for
domains 1,2,3,5,6 and 7 and FE_Nothing for domain 4, I should put boundary
conditions on the line between 3 and 4 and on the line between 4 and 5,
shouldn't I?
But as they are not external boundaries I should use the method
DoFTools::extract_subdomain_dofs(,,,) in the following way;

DoFTools::extract_subdomain_dofs(dof_handler_NS,4, selected_dofsMEM);
DoFTools::extract_subdomain_dofs(dof_handler_NS,3, selected_dofsCLa);
DoFTools::extract_subdomain_dofs(dof_handler_NS,5, selected_dofsCLc);
for (unsigned int i=0;i<dof_handler.n_dofs();i++)
if ((selected_dofsMEM[i]==true)&&(selected_dofsCLa[i]==true)
     ||(selected_dofsMEM[i]==true)&&(selected_dofsCLc[i]==true))
          boundary_values[i]=0.0;
No, in your case this is not necessary, because you have homogeneous Dirichlet boundary conditions anyway. Since we are using continuous finite elements, deal.II enforces continuity across lines automatically. This also happens on the lines between domains 3 and 4 resp. 4 and 5. But since there are no degrees of freedom in domain 4 anymore, it enforces continuity to "nothing", hence to zero. So the degrees of freedom on these lines are already set to zero.
2) Regarding Laplace equation: If I put FE_Q for domains3,4 and 5 and
FE_Nothing for domain 1,2,6 and 7, I should put boundary conditions on the line between 2 and 3 and on the line between 5 and 6, shouldn't I? But as
they are not external boundaries I should use the method
DoFTools::extract_subdomain_dofs(,,,) in the following way;

DoFTools::extract_subdomain_dofs(dof_handler_NS,2, selected_dofsGDLa);
DoFTools::extract_subdomain_dofs(dof_handler_NS,3, selected_dofsCLa);
DoFTools::extract_subdomain_dofs(dof_handler_NS,5, selected_dofsCLc);
DoFTools::extract_subdomain_dofs(dof_handler_NS,6, selected_dofsCDLc);
for (unsigned int i=0;i<dof_handler.n_dofs();i++)
if ((selected_dofsGDLa[i]==true)&&(selected_dofsCLa[i]==true)
          boundary_values[i]=0.0;
f ((selected_dofsGDLc[i]==true)&&(selected_dofsCLc[i]==true)
          boundary_values[i]=0.0;
See point 1). The same explanation holds here.
3) And in order to create the assemble of matrices, I shouldn't do
anything with the cells that are using FE_Nothing, should I?
This does not matter anymore. You can just loop over all cells, since the hp::DoFHandler uses the correct finite element on every cell. So we do not have any degrees of freedom on the unwanted domains and, if you hit a cell located in the unwanted domains, the loop does not do anything.
4) Another question is if the way I used previously, i.e., without using
FECollection nor FE_Nothing, although being more complicated, didn't it do
the same that the scheme you have suggested?
Yes, it does basically the same thing, but much easier.

Best Regards,
Markus
_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii



_______________________________________________
dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii

Reply via email to