- Notifications
You must be signed in to change notification settings - Fork299
Issue loading quad4 nodal data from ExodusII#4340
-
summaryTwo nodes in a quadrilateral loaded from ExodusII have the wrong description of problemI checked this with both libMesh 1.7.8 and the development version (as of this morning). I'm loading nodal ExodusII data and, at some point in the process, two nodes of a quadrilateral get each-other's node numbers. More precisely, I start with (via but later on libMesh appears to renumber things. The solitary element is read as i.e., the nodes 2 and 3 have the wrong I have absolutely no idea what causes this. Is this some sort of obscure issue related to not supplying the node number map, or something else in the ExodusII file? exodus fileI narrowed this problem down to a one-element mesh (I started in 3d with hexahedra, the problem is the same there). Here's the test file (via netcdftest {dimensions:len_name=256 ;time_step=UNLIMITED ;// (1 currently)num_dim=2 ;num_nodes=4 ;num_elem=1 ;num_el_blk=1 ;num_el_in_blk1=1 ;num_nod_per_el1=4 ;num_nod_var=4 ;variables:doubletime_whole(time_step) ;inteb_status(num_el_blk) ;inteb_prop1(num_el_blk) ;eb_prop1:name="ID" ;doublecoordx(num_nodes) ;doublecoordy(num_nodes) ;chareb_names(num_el_blk,len_name) ;eb_names:_FillValue="" ;charcoor_names(num_dim,len_name) ;coor_names:_FillValue="" ;intconnect1(num_el_in_blk1,num_nod_per_el1) ;connect1:elem_type="QUAD4" ;charname_nod_var(num_nod_var,len_name) ;name_nod_var:_FillValue="" ;doublevals_nod_var1(time_step,num_nodes) ;doublevals_nod_var2(time_step,num_nodes) ;doublevals_nod_var3(time_step,num_nodes) ;doublevals_nod_var4(time_step,num_nodes) ;// global attributes: :api_version=9.04f ; :version=9.04f ; :floating_point_word_size=8 ; :file_size=1 ; :maximum_name_length=32 ; :int64_status=0 ; :title="test" ;data:time_whole=0 ;eb_status=1 ;eb_prop1=1 ;coordx=0,1,0,1 ;coordy=0,0,1,1 ;eb_names="" ;coor_names="","" ;connect1=1,2,4,3 ;name_nod_var="X1","X2","exp","monomial" ;vals_nod_var1=0,1,0,1 ;vals_nod_var2=0,0,1,1 ;vals_nod_var3=1,2.71828182845905,2.71828182845905,7.38905609893065 ;vals_nod_var4=0,0,0,1 ;} source codeThere's probably a better way to do this, but since #include<libmesh/equation_systems.h>#include<libmesh/exodusII_io.h>#include<libmesh/elem.h>#include<libmesh/node.h>#include<libmesh/numeric_vector.h>#include<libmesh/replicated_mesh.h>intmain(int argc,char **argv) {usingnamespacelibMesh; LibMeshInitinit(argc, argv); ReplicatedMeshmesh(init.comm()); ExodusII_IOexodus_io(mesh); exodus_io.read("test.e"); mesh.prepare_for_use(); EquationSystemsequation_systems(mesh); System &X1_system = equation_systems.add_system<System>("X1"); X1_system.add_variable("X1",FEType(1)); System &X2_system = equation_systems.add_system<System>("X2"); X2_system.add_variable("X2",FEType(1)); equation_systems.init(); exodus_io.copy_nodal_solution(X1_system,"X1","X1"); exodus_io.copy_nodal_solution(X2_system,"X2","X2");constauto &X1 = *X1_system.solution;constauto &X2 = *X2_system.solution;const Elem *elem = mesh.elem_ptr(0); std::cout <<"volume =" << elem->volume() << std::endl;for (unsignedint node_n =0; node_n < elem->n_nodes(); ++node_n) { elem->node_ptr(node_n)->print_info(std::cout); }for (constauto *node : mesh.node_ptr_range()) { std::cout <<"id =" << node->id() << std::endl; std::cout <<"node =" << (*node)(0) <<"," << (*node)(1) << std::endl; std::cout <<"field =" <<X1(node->dof_number(X1_system.number(),0,0)) <<"," <<X2(node->dof_number(X2_system.number(),0,0)) << std::endl; }} executable output |
BetaWas this translation helpful?Give feedback.
All reactions
It looks to me like the mesh has been automatically renumbered, which libmesh does duringprepare_for_use() unless you explicitly tell it not to. Did you try calling
mesh.allow_renumbering(false);before reading in the exo file? I don't know exactly what version of libmesh we first settled on that API, but it should definitely work in the latest master.
Replies: 1 comment 5 replies
-
It looks to me like the mesh has been automatically renumbered, which libmesh does during before reading in the exo file? I don't know exactly what version of libmesh we first settled on that API, but it should definitely work in the latest master. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yup, that's exactly it! Thank you! |
BetaWas this translation helpful?Give feedback.
All reactions
-
That was easier than I thought it would be - I didn't think libMesh would renumber nodes. |
BetaWas this translation helpful?Give feedback.
All reactions
-
The "allowed to renumber by default" behavior has unfortunately been around forever, and in hindsight it is obviously surprising and non-intuitive for most users when it happens. Our attempt to work around it in a backwards-compatible way is that MeshBase API, but we should probably also add a comment to the docs for |
BetaWas this translation helpful?Give feedback.
All reactions
-
Those are good ideas - I'll add some more docs to#4341. |
BetaWas this translation helpful?Give feedback.
All reactions
-
I disagree with "unfortunately" - renumbering by default was one of our last bastions of defense of "will handle transient adaptivity efficiently" applied mathematicians' libMesh, after we hit it big with engineers who unwittingly pushed it in the direction of "is this a nodal variable or an elemental variable? those are the two possibilities, right?" libMesh. But I really love#4341. When we do conflict with the engineer types' code (both outside the library and inside) that definitely needs to result in friendly error messages, not corrupted data. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1