On 03/06/2014 06:44 AM, David Knezevic
On 03/06/2014 02:08 AM, Martin Luethi wrote:
David Knezevic <firstname.lastname@example.org> writes:
I've found a case where ExodusII_IO::write_discontinuous_exodusII has a
weird bug. The example is here (on dropbox):
visit shows the same problem (missing elements in exo) for
But the elements are in the Exodus File. You can inspect it with ncdump
(it's just a NetCDF file after all), and there are enough elements and
nodes within the file (same number as gmv).
num_nodes = 116240 ;
num_elem = 14530 ;
num_el_blk = 2 ;
num_side_sets = 3 ;
num_el_in_blk1 = 4280 ;
num_nod_per_el1 = 8 ;
num_el_in_blk2 = 10250 ;
num_nod_per_el2 = 8 ;
So in Exouds the elements are in two blocks (not sure why).
The elemnt conneciivities look the same in both cases. But maybe
elem_num_map in Exodus gets confused somehow, there are lots of zeroes
at the end of this block. The array serves as translation between
internally stored element numbers, and those shown in a viewer.
Do you have the Exodus file format documentation? It's expleined there.
Thanks, those comments are very helpful. (I'm cc'ing the list in case
anyone else is interested.)
Note that test_mesh.exo has two element blocks, so that might be what is
triggering the bug... When I use a single-element-block mesh (e.g. via
build_cube) in the example, it works fine. I'll look into it more.
I just created a pull request that resolves this. The problem was
that the node indexing in
write_elements_discontinuous was getting reset for each new
subdomain, and hence the second block of elements used the same
nodes as the first block of elements. So the mesh had the right
number of elements, but the two blocks were on top of each other.
Also, I noticed that there was a lot of repeated code in
ExodusII_IO_Helper in the functions:
* initialize_discontinuous and initialize
* write_nodal_coordinates_discontinuous and
* write_elements_discontinuous and
so to make it more "DRY" I got rid of the *_discontinuous functions
and added a "use_discontinuous" boolean to the other three