Dear all,

I am trying to solve the equations in step-20 with inhomogeneous neumann 
bcs on one of the boundaries and getting something very bizarre. 

I have a rectangular domain with the following:

1. Top boundary has homogeneous conditions: this is applied into the weak 
form like in step-20
2. Side boundaries have no flux conditions on u and I am using 
DoFTools::make_zero_boundary_constraints for this.
3. Bottom boundary (where the problem is), I need to impose a non-zero 
value for the neumann condition. 

Some notes at this point:
1. I have done some serious debugging already. 
2. I know the problem is in how I am imposing the bottom boundary condition 
- I know this because I have done some verification on the rest of the code 
using method of manufacture solutions (MMS) for the top dirichlet 
conditions and bottom AND side boundaries having all homogeneous neumann 
bcs (so not non-zero for the bottom like I need). I know that without the 
inhomogeneous neumann bc, the code works well with errors as expected when 
compared to the test analytical solution in the MMS.
3. I am aware that for the condition I am trying to impose on the bottom, 
u.n = g, where g is a non-zero constant,  the degrees of freedom on the 
faces are exactly the normal velocities, so I do the following:

I have tried to impose the inhomogeneous neumann bc from the ideas 
here: 
https://groups.google.com/forum/#!searchin/dealii/step-20$20neumann|sort:date/dealii/b7WG5noR7FY/z7CLuQBae0MJ
and used something like

std::map<types::global_dof_index, double> boundary_values; 
{
        types::global_dof_index n_dofs = dof_handler.n_dofs();
        std::vector<bool> componentVector(dim + 1, true);
        componentVector[dim] = false;
        std::vector<bool> selected_dofs(n_dofs);
        std::set< types::boundary_id > boundary_ids;
        boundary_ids.insert(2);
        boundary_ids.insert(3);
        DoFTools::extract_boundary_dofs(dof_handler, ComponentMask(
componentVector),
                selected_dofs, boundary_ids);

        for (types::global_dof_index i = 0; i < n_dofs; i++) {
            if (selected_dofs[i]) boundary_values[i] = -1.0;
        }
}
MatrixTools::apply_boundary_values(boundary_values,
        system_matrix, solution, system_rhs);

Please refer to the attached file, where you can see the non-constant 
boundary solution. 

Can anyone explain why this is happening? and what I am doing wrong here?

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to