Hi!
I have a question regarding BoundaryInfo on inner edges. My situation is
the following:
1) I generate a mesh: a 2x2 square (element numbers are 0..3, boundary ids
are 0..3)
2) I refine the mesh once, so I get 16 more elements
If I look at the original mesh, the element 0 (bottom left one) has a
boundary id 0 on local edge 0 and boundary id 3 on local edge 3. Local
edges 1 and 2 have -1234 (=invalid id). That is perfectly fine.
However, there is something strange on the refined mesh. The element 4
(the very bottom left one - child of element 0) has the same info as its
parent - that is still ok. But, if I look at the elements 5, 6, 7 which
are the three remaining child elements of element 0, they do have the same
boundary info like element 0, i.e. local edges 0 and 3 have the same
boundary ids. I would expect that element 5 would have only boundary info
associated with local edge 0, element 6 only with edge 3 and element 7
would not have this info at all since it is an interior element. In other
words, the child elements inherit the boundary info from the parent
element. Attached is simple code that shows this behavior.
Maybe, I'm supposed to call something in order to get the proper boundary
infos?
Thank you,
--
David Andrs
#include "libmesh.h"
#include "mesh.h"
#include "mesh_generation.h"
#include "mesh_refinement.h"
#include "elem_range.h"
#include "error_vector.h"
#include "boundary_info.h"
void print_info(Mesh & mesh)
{
// print out
ConstElemRange range(mesh.active_local_elements_begin(),
mesh.active_local_elements_end(), 1);
for (ConstElemRange::const_iterator el = range.begin() ; el != range.end();
++el)
{
const Elem *e = (*el);
std::cout << "elem id = " << e->id() << ": ";
for (unsigned int i = 0; i < e->n_nodes(); i++)
{
const Point & pt = e->point(i);
std::cout << " (" << pt(0) << ", " << pt(1) << ", " << pt(2) << ")";
}
std::cout << std::endl;
for (unsigned int side = 0; side < e->n_sides(); side++)
{
std::cout << " side = " << side << ": ";
std::cout << " ";
short int bnd_id = mesh.boundary_info->boundary_id (e, side);
std::cout << " " << bnd_id << std::endl;
}
}
}
int main(int argc, char * argv[])
{
LibMeshInit init(argc, argv);
Mesh mesh;
// generate mesh
int nx = 2, ny = 2;
MeshTools::Generation::build_square(mesh, nx, ny, 0, 1, 0, 1, QUAD4);
print_info(mesh);
// refine me
std::cout << "----------------------------------------" << std::endl;
MeshRefinement mr(mesh);
mr.refine_fraction() = 1.0;
mr.coarsen_fraction() = 0.0;
mr.max_h_level() = 10;
ErrorVector ev(mesh.n_local_elem(), 0.5);
mr.flag_elements_by_error_fraction (ev);
mr.refine_and_coarsen_elements();
mesh.boundary_info->build_node_list_from_side_list();
print_info(mesh);
return 0;
}
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users