I think lshaped.xda doesn't have any boundary IDs. You can check by 
printing them out: mesh.boundary_info->print_info();

Also, have a look at the output of equation_systems.print_info(), which 
will tell you how many constrained dofs you have (you need to make sure 
that it's not zero!)

You would normally set boundary IDs using a mesh generator, but in this 
case, you might want to add them manually by looping over the mesh and 
doing mesh.boundary_info->add_side on boundary sides.

David



On 08/13/2014 02:51 PM, Miguel Angel Salazar de Troya wrote:
> Hi all
>
> I want to use the mesh lshaped.xda that is used in several examples.
> Although I want to set the boundary conditions using the
> function add_dirichlet_boundary. Right now, I want to set all the
> boundaries to have a dirichlet condition of zero. This is what I do:
>
> // Create mesh (dim = 2)
>
> Mesh mesh(init.comm(),dim);
>
> // Read the mesh from a file
>
> mesh.read("lshaped.xda");
>
> // Get the set of boundary ids
>
> const std::set<boundary_id_type> boundary_ids =
> mesh.boundary_info->get_boundary_ids();
>
> // Create a vector storing the variable numbers which the BC applies to
> (u_var has been declared already)
>
> std::vector<unsigned int> vars;
> vars.push_back( u_var );
>
> // We want zero displacements
>
> ZeroFunction<Number> zero;
>
> // We must add the Dirichlet boundary condition _before_
> // we call equation_systems.init()
>
> system.get_dof_map().add_dirichlet_boundary(libMesh::DirichletBoundary(
> boundary_ids, vars, &zero ));
>
> My problem is that the solver doesn't converge. There must be a mistake in
> the way I add the BC because using a simple square mesh the code works well.
>
> Thanks in advance
> Miguel
>


------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to