Hello Huan Sun,

why do you create another matrix for the boundary conditions? You have already created the problem's matrix for this cell right above. Thus you can hand over just this matrix: constraints.distribute_local_to_global (local_rhs, local_dof_indices, rhs, local_matrix);

Best Regards,
Markus



Am 17.05.10 08:12, schrieb Huan Sun:
Hi all,

I was following tutorial 22 and 34 to implement inhomogeneous Dirichlet
boundary conditions using the ConsraintMatrix class but couldn't get it
right. I think the problem mainly lies in the assemblage part (i was
solving the basic Poisson's eq.)

        if(constraints.is_inhomogeneously_constrained
           (local_dof_indices[i])){
          for(unsigned int j=0; j<dofs_per_cell; ++j){
            matrix_for_bc(j,i) +=
              grad_basis_phi[i] * grad_basis_phi[j] *
              fe_values.JxW(q);
          }//j-loop
        }//if
     ...
     constraints.distribute_local_to_global(local_rhs,
                                           local_dof_indices,
                                           rhs,
                                           matrix_for_bc);

However, when I comment out the if statement, the program seems to work
correctly. The code is attached in this email.
Your help will be greatly appreciated.

Thanks!

Huan

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

Reply via email to