Respected Prof. Wolfgang,

I really appreciate your taking the time to reply. Thank you very much.

Yes, by middle element I mean the central layer of the mesh.

Yes you are right. It turns out this is the problem.
I was creating a hyper_rectangle using grid generation class. Then 4 and 5 
corresponded to the -/+ z surface. 
(I used hard coded numbers as it saved time for looping over all the 
elements.)

Now when I am using the same mesh but now reading via read_ucd(), upon 
reading the documentation carefully, I saw that the ordering is changed. So 
4 and 5 now no more correspond to -/+ z surface.

However, If I call cell->face(4)->unit_cell_direction, it still gives 
output as 2, which means that this face is normal to z surface.
This normal direction is for the cell in the natural coordinates, right ? I 
think this is why I am not getting the constraints right.

So, in general, how should I know if the real cell face is normal to -/+ z 
direction ?

Will having a constraint such that both the dofs are locally relevant & not 
locally owned result in anything bad ? I think, it should have no effect 
atleast for that processor on which both these two dofs lie. 
Am I right here ?
- hide quoted text -


On Wednesday, September 7, 2016 at 4:24:52 PM UTC-4, Wolfgang Bangerth 
wrote:
>
>
> > Lets say I have a mesh with 10 X 10 X 3 elements. 
> > 
> > I want to apply constraints such that all the dofs on the +z surface of 
> the 
> > middle element are constrained to be equal to the corresponding dofs on 
> the -z 
> > surface of the middle element. 
>
> What is the "middle" element? The central layer of your mesh? 
>
>
> > std::map<unsignedint,bool>vertex_touched; 
> >  typenameDoFHandler<dim>::active_cell_iterator 
> >  cell =dof_handler.begin_active(), 
> >  endc =dof_handler.end(); 
> > 
> > 
> >  for(cell =dof_handler.begin_active();cell !=endc;++cell) 
> >  if(cell->is_ghost()||cell->is_locally_owned()) 
> >  for(unsignedintv =0;v <GeometryInfo<dim>::vertices_per_cell;++v) 
> >  vertex_touched[cell->vertex_index(v)]=false; 
> > 
> > 
> > 
> >  for(cell =dof_handler.begin_active();cell !=endc;++cell) 
> >  if(cell->is_ghost()||cell->is_locally_owned()) 
> >  { 
> >  boolcell_on_pm_z_face =false; 
> > 
> > // donot take into account the cells which are at the top and bottom 
> boundary. 
> > We only need to impose constraints on the middle element. 
> > 
> >  constintface_mz =4;constintface_pz =5; 
> >  if(cell->face(face_mz)->boundary_id()==minus_z_boundary_id || 
> >         cell->face(face_pz)->boundary_id()==plus_z_boundary_id) 
> >  { 
> >  cell_on_pm_z_face =true; 
> >  continue; 
> >  } 
>
> Does this ever trigger? You make the assumption that you know that the 
> faces 
> you care about are faces 4 or 5 of a cell. But that may not be the case. 
> In 
> other words, once you pass this block, on how many cells does the rest of 
> the 
> code run? 
>
> The rest of the code does not, at least trigger anything that looks 
> obviously 
> wrong. You need the constraints if at least one of the constraints you 
> want to 
> constrain are locally relevant (i.e., on a locally owned cell or a ghost 
> cell), which is what I think you get. 
>
> But then you also don't say what happens when you run the code. In which 
> way 
> is the result wrong? 
>
> Best 
>   Wolfgang 
>
>
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
>                             www: http://www.math.colostate.edu/~bangerth/ 
>

On Wednesday, September 7, 2016 at 4:24:52 PM UTC-4, Wolfgang Bangerth 
wrote:
>
>
> > Lets say I have a mesh with 10 X 10 X 3 elements. 
> > 
> > I want to apply constraints such that all the dofs on the +z surface of 
> the 
> > middle element are constrained to be equal to the corresponding dofs on 
> the -z 
> > surface of the middle element. 
>
> What is the "middle" element? The central layer of your mesh? 
>
>
> > std::map<unsignedint,bool>vertex_touched; 
> >  typenameDoFHandler<dim>::active_cell_iterator 
> >  cell =dof_handler.begin_active(), 
> >  endc =dof_handler.end(); 
> > 
> > 
> >  for(cell =dof_handler.begin_active();cell !=endc;++cell) 
> >  if(cell->is_ghost()||cell->is_locally_owned()) 
> >  for(unsignedintv =0;v <GeometryInfo<dim>::vertices_per_cell;++v) 
> >  vertex_touched[cell->vertex_index(v)]=false; 
> > 
> > 
> > 
> >  for(cell =dof_handler.begin_active();cell !=endc;++cell) 
> >  if(cell->is_ghost()||cell->is_locally_owned()) 
> >  { 
> >  boolcell_on_pm_z_face =false; 
> > 
> > // donot take into account the cells which are at the top and bottom 
> boundary. 
> > We only need to impose constraints on the middle element. 
> > 
> >  constintface_mz =4;constintface_pz =5; 
> >  if(cell->face(face_mz)->boundary_id()==minus_z_boundary_id || 
> >         cell->face(face_pz)->boundary_id()==plus_z_boundary_id) 
> >  { 
> >  cell_on_pm_z_face =true; 
> >  continue; 
> >  } 
>
> Does this ever trigger? You make the assumption that you know that the 
> faces 
> you care about are faces 4 or 5 of a cell. But that may not be the case. 
> In 
> other words, once you pass this block, on how many cells does the rest of 
> the 
> code run? 
>
> The rest of the code does not, at least trigger anything that looks 
> obviously 
> wrong. You need the constraints if at least one of the constraints you 
> want to 
> constrain are locally relevant (i.e., on a locally owned cell or a ghost 
> cell), which is what I think you get. 
>
> But then you also don't say what happens when you run the code. In which 
> way 
> is the result wrong? 
>
> Best 
>   Wolfgang 
>
>
>
> -- 
> ------------------------------------------------------------------------ 
> Wolfgang Bangerth          email:                 bang...@colostate.edu 
> <javascript:> 
>                             www: http://www.math.colostate.edu/~bangerth/ 
>
>

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