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: bange...@colostate.edu
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.