Hi all, 

I am learning grid generator how to set boundary condition on given domain.
It is very basic, but I couldn't even set boundary id for squared mesh 

I want to generate squared computational domain and I want to give boundary 
id of 1 to all the outer boundary of the square. 

So I used following lines 




GridGenerator::hyper_cube (triangulation, 0, 1);

            triangulation.refine_global ();

            

            std::cout << "Number of active cells: "<< 
triangulation.n_active_cells()<< std::endl;

            

            

            

            for (typename Triangulation<dim>::active_cell_iterator

                 cell=triangulation.begin_active();

                 cell!=triangulation.end(); ++cell)

            {

                for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; 
++f)

                {

                    

                

                    if ( cell->face(f)->center()[0]==0 )


                    {

                        cell->face(f)->set_all_boundary_ids(1);

                        

                    }

                    

                    if ( cell->face(f)->center()[0]==1 )

                        

                    {

                        cell->face(f)->set_all_boundary_ids(1);

                        

                    }

                    

                    if ( cell->face(f)->center()[1]==0 )

                        

                    {

                        cell->face(f)->set_all_boundary_ids(1);

                        

                    }

                    if ( cell->face(f)->center()[1]==1 )

                        

                    {

                        cell->face(f)->set_all_boundary_ids(1);

                        

                    }

                    

                    

                }


However, when I checked my boundary by giving arbitrary boundary value of 
 '5', the solution shape looks as follow which is obviously wrong..


Are my code lines wrong? I thought that the faces of cell is each edge of a 
cell, and examined whether their centers are x=0,1 or y=0,1. 

and If then, I set id on 1...



<https://lh3.googleusercontent.com/-toZV8W-J-lw/WCi4Kldx3KI/AAAAAAAAA88/OF-tsoWgJpILwNta9WdYtUEyxMx77EBsQCLcB/s1600/Screen%2BShot%2B2016-11-13%2Bat%2B12.59.38%2BPM.png>



Always thank you all you for fast response!


Jaekwang Kim 

-- 
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