From: Simone R. <sim...@gm...> - 2018-09-12 23:32:03
|
I tried adding a new node to the mesh. If I call: MeshTools::Generation::build_cube(mesh, 2, 2, 0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,TRI3); I simply add a new (copied) node to the mesh and change it in one element. That gives me the desired mesh with 10 vertices. Defining a system of linear Lagrangian elements on this mesh, the solution vector has 10 entries. All good. On the other hand, if before adding the node, I call MeshTools::Generation::build_cube(mesh, 1, 1, 0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0,TRI3); MeshRefinement refinement(mesh); refinement.uniformly_refine(); then the mesh object sees 10 vertices, but the solution vector has only 9 entries. Also the exporter does not recognize the additional node in the mesh. This is how I’m adding the node in both scenarios: Node * node = mesh.node_ptr(0); auto nodeID = mesh.node_ptr(0)->id(); Node * new_node = new Node(*node); new_node -> set_id(100); mesh.add_node(new_node); bool stop = false; for (int elc = 0; elc < mesh.n_elem() ; ++elc) { Elem * elem = mesh.elem_ptr(elc); for(int nn = 0; nn < elem->n_nodes(); ++nn) { int ID = elem->node_ptr(nn)->id(); if(ID == nodeID) { elem->set_node(nn) = new_node; stop = true; break; } } if(stop) break; } Do you have any suggestion? Thanks for the help, Simone > On Sep 11, 2018, at 12:58 PM, Roy Stogner <roy...@ic...> wrote: > > > On Tue, 11 Sep 2018, Rossi, Simone wrote: > >>> If you start with the 10 node mesh >>> on top and refine, then you will always have continuity of any C0 (or >>> C1) solution variables at the two shared domain corner nodes. >> This is what I would like to have. The idea is to introduce some random “cuts” in the mesh, where I can apply some boundary conditions. >> I thought the easiest way to achieve this would have been adding new duplicated nodes on the side using AMR. > > Yeah, if that's the effect you want, then a single refinement followed > by duplicating the non-corner internal boundary nodes is exactly what > you want to do. > >> Could I “break” the mesh, use AMR, and then stitch back the nodes together? > > You could but it would be more of a pain. Just do one refinement and > then break it afterward. Or, actually, you could also use TRI6 > instead of TRI3 and break the middle node between the two triangles. > --- > Roy > _______________________________________________ > Libmesh-users mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libmesh-users |