Open millerta opened 2 months ago
As Erica noticed, the arrays for ssfacelist etc are being overwritten. Then when excre is called for exodus to write file, there is a seg fault. Making the arrays larger helps, but excre exits with an error.
The memory allocations for facesets are all tangled up in the Automatic portion of the code. This was a very early iteration for writing facesets which automatically detects and creates facesets on boundary and base mmgetblk lengths on this number. This Automatic detection part of the code is why the memory allocation and failures vary depending on the mesh and parameters. For dfn octree meshes, there are many more facesets internal to the mesh, than on the boundary.
A major fix would be to skip the Automatic facesets part of code and allocate as each file is read. A less invasive fix would leave the auto-detect memory allocation in place, but reallocate if needed as files are read.
Better debug options need to be in place and should be based on the user setting ie cmo/setatt/moname/idebug 5 I also recommend adding call mmverify() before exodus exre command. This would look like:
Found bndry elems and faces: 2736
auto_facesets true
auto_facesets false but output_facesets true
mmgetblk sselemlist length: 8208
mmgetblk ssfacelist length: 8208
******** write to faceset arrays *******
Total read from file: 8779
Set tag: 15 nfaces: 621
Current offset to start write: 8158
Set new offset: 8779
MMVERIFY: Array prolog overwritten
Array ssfacelist in dumpexodusII
Length= 8208 , Address= 94911463699280
MMVERIFY: Array epilog overwritten
Array ssfacelist in dumpexodusII
Length= 8208 , Address= 94911463699280
MMVERIFY: Array epilog overwritten
Array sselemlist in dumpexodusII
Length= 8208 , Address= 94911463633504
--------
Currently, the default memory length for exodus side set arrays is 3nouter1 where nouter1 are the number of faces on the mesh boundary. This is fixed by allocating more memory for the arrays, we get another chunk of 3nouter1 size.
Other arrays should have the same check and increment if needed. For instance, there is a limit of 1000 for the number of facesets.
dumpexodusII.f
call mmincblk
& ('sselemlist',isubname,ipsselemlist,ssinc,ierr)
if (ierr.ne.0) print*,"mmincblk sselemlist err: ",ierr
call mmgetlen(ipsselemlist,sslength,ierr)
if (ierr.ne.0) print*,"mmgetlen sselemlist err: ",ierr
call mmincblk
& ('ssfacelist',isubname,ipssfacelist,ssinc,ierr)
if (ierr.ne.0) print*,"mmincblk ssfacelist err: ",ierr
call mmgetlen(ipssfacelist,sslength,ierr)
Example for testing from Jeffrey located in /project/meshing/demos/exo_bug_jeffrey/output_9frac/octree_dfm New code on branch tam-debug