neperfepx / neper

Polycrystal generation and meshing
http://neper.info
GNU General Public License v3.0
199 stars 53 forks source link

3D meshes with cohesive elements provides nodes that do not belong to main elements #375

Closed MiguelVCarvalho closed 2 years ago

MiguelVCarvalho commented 2 years ago

Description

When creating a 3D tetrahedral mesh with cohesive elements, the Nodes section in the .msh file provides nodes that are absent from the connectivity list of the main elements (4-node tetrahedron and 6-node prism in this case). Using gmsh 4.3.0, MeshFormat 2.2 0 8 and MeshVersion 2.2.1

Reproduce

Considering the .msh file produced by the case below, node 5, 15, 16 and 17 share the same coordinates. Analysing the tetrahedral and prism elements (element 59 to 80), node 5 and 15 do not appear in the connectivity table. They only appear in the 2-node line elements and so on.

This problem does not occur when creating a 3D mesh without cohesive elements or a 2D mesh with cohesive elements.

neper --rcfile none -T -n 2 -id 10 -dim 3 -morpho graingrowth -ori uniform -oricrysym cubic -regularization 1 -mloop 100 -o 1-phase_2-grain_tet4_10-seed_cohesive -format tess,ori,geo -oridescriptor e
neper --rcfile none -M -tmp /run/user/1000 1-phase_2-grain_tet4_10-seed_cohesive.tess -elttype tet -rcl 3.0 -dim 3 -order 1 -format msh,fepx -nset faces,edges,vertices -statelt vol -interface cohesive

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.2.1-27
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 12 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2021, and GNU GPL'd, by Romain Quey.
Info   : Ignoring initialization file.
Info   : ---------------------------------------------------------------
Info   : MODULE  -T loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -n 2 -id 10 -dim 3 -morpho graingrowth -ori uniform
         -oricrysym cubic -regularization 1 -mloop 100 -o
         1-phase_2-grain_tet4_10-seed_cohesive -format tess,ori,geo
         -oridescriptor e
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   : Creating domain...
Info   : Creating tessellation...
Info   :   - Setting seeds... 100%
Info   :   - Generating crystal orientations...
Info   :     > Crystal symmetry: cubic, no cut-off
Info   :     > Initial solution: f   =1.000000000
Info   :     > Iteration     16: fmin=0.000016947, f=0.000016947
Info   :     > Final solution  : f   =0.000016947 (16 iterations)
Info   :   - Running tessellation...
Info   :     > Initial solution: f   =21.993952244
Info   :     > Iteration    284: fmin=1.800335254 f=1.800335301  
Info   :     > Final solution  : f   =1.800335254 (284 iterations)
Info   :     > Reached `eps' criterion.
Info   : Regularizing tessellation...
Info   :   - 
Info   : Writing results...
Info   :     [o] Writing file `1-phase_2-grain_tet4_10-seed_cohesive.tess'...
Info   :     [o] Wrote file `1-phase_2-grain_tet4_10-seed_cohesive.tess'.
Info   :     [o] Writing file `1-phase_2-grain_tet4_10-seed_cohesive.geo'...
Info   :     [o] Wrote file `1-phase_2-grain_tet4_10-seed_cohesive.geo'.
Info   :     [o] Writing file `1-phase_2-grain_tet4_10-seed_cohesive.ori'...
Info   :     [o] Wrote file `1-phase_2-grain_tet4_10-seed_cohesive.ori'.
Info   : Elapsed time: 0.391 secs.
========================================================================

========================    N   e   p   e   r    =======================
Info   : A software package for polycrystal generation and meshing.
Info   : Version 4.2.1-27
Info   : Built with: gsl|muparser|opengjk|openmp|nlopt|libscotch (full)
Info   : Running on 12 threads.
Info   : <https://neper.info>
Info   : Copyright (C) 2003-2021, and GNU GPL'd, by Romain Quey.
Info   : Ignoring initialization file.
Info   : ---------------------------------------------------------------
Info   : MODULE  -M loaded with arguments:
Info   : [ini file] (none)
Info   : [com line] -tmp /run/user/1000
         1-phase_2-grain_tet4_10-seed_cohesive.tess -elttype tet -rcl 3.0
         -dim 3 -order 1 -format msh,fepx -nset faces,edges,vertices
         -statelt vol -interface cohesive
Info   : ---------------------------------------------------------------
Info   : Reading input data...
Info   :   - Reading arguments...
Info   : Loading input data...
Info   :   - Loading tessellation...
Info   :     [i] Parsing file `1-phase_2-grain_tet4_10-seed_cohesive.tess'...
Info   :     [i] Parsed file `1-phase_2-grain_tet4_10-seed_cohesive.tess'.
Info   : Meshing...
Info   :   - Preparing... (cl = 1.191) 100%
Info   :   - 0D meshing... 100%
Info   :   - 1D meshing... 100%
Info   :   - 2D meshing... 100% (0.79|0.84/91%| 9%| 0%) 
Info   :   - Fixing 2D-mesh pinches...
Info   :   - 3D meshing... 100% (0.82|0.82/100%| 0%| 0%)
Info   :   - Processing mesh at interfaces...
Info   :     > Making mesh discontinuous...
Info   :     > Adding cohesive elements...
Info   : Searching nsets and fasets...
Info   : Writing mesh results...
Info   :   - Preparing mesh...
Info   :   - Mesh properties:
Info   :     > Node number:       26
Info   :     > Elt  number:       20
Info   :     > Mesh volume:    1.000
Info   :   - Writing mesh...
Info   :     [o] Writing file `1-phase_2-grain_tet4_10-seed_cohesive.msh'...
Info   :     [o] Wrote file `1-phase_2-grain_tet4_10-seed_cohesive.msh'.
Info   :     [o] Writing file `1-phase_2-grain_tet4_10-seed_cohesive.intf'...
Info   :     [o] Wrote file `1-phase_2-grain_tet4_10-seed_cohesive.intf'.
Info   : Writing mesh statistics...
Info   :     [o] Writing file `1-phase_2-grain_tet4_10-seed_cohesive.stelt'...
Info   :     [o] Wrote file `1-phase_2-grain_tet4_10-seed_cohesive.stelt'.
Info   : Elapsed time: 0.703 secs.
========================================================================
rquey commented 2 years ago

I'll look into it.

When you report a bug, please remove all unnecessary options from the commands. Here,

neper --rcfile none -T -n 2 -id 10 -dim 3 -morpho graingrowth -ori uniform -oricrysym cubic -regularization 1 -mloop 100 -o 1-phase_2-grain_tet4_10-seed_cohesive -format tess,ori,geo -oridescriptor e
neper --rcfile none -M -tmp /run/user/1000 1-phase_2-grain_tet4_10-seed_cohesive.tess -elttype tet -rcl 3.0 -dim 3 -order 1 -format msh,fepx -nset faces,edges,vertices -statelt vol -interface cohesive

could be reduced to:

neper -T -n 2
neper -M n2-id1.tess -rcl 3 -interface cohesive

while still reproducing the same behavior (I'm keeping -rcl 3 to produce a small mesh).

It is less confusing and time-consuming for us, and it helps to isolate the bug.

Thanks.

MiguelVCarvalho commented 2 years ago

Thank you @rquey!

Sorry about that, I tried to exclude some arguments but I could have reduced it much more.. my bad :/.

rquey commented 2 years ago

Now fixed, but use -dim 3:msh, which will print only the 3D mesh (and exclude orphan nodes).

MiguelVCarvalho commented 2 years ago

Thank you @rquey!

Consider:

neper -T -n 2
neper -M n2-id1.tess -rcl 3 -dim 3:msh -interface cohesive -format msh,bcs

Using -dim 3:msh, removes the orphan nodes from the .msh file, as expected. However, the IDs are still related to the full nodes list. This is, the new number of nodes is 66 but the last node ID is 87 (related to the number of nodes without -dim 3:msh).

One could update the IDs to match the row indices of this array but the current ID is also used in the elements connectivity list and in the .bcs file too.

Is there a way to do that in neper, instead of doing it has a post-processing only when one wants to create a 3D mesh with cohesive elements? This is, always use -dim 3:msh and have the node IDs from 1 to 66 (in this case) and the connectivity list and boundary nodes updated accordingly.

rquey commented 2 years ago

@MiguelVCarvalho, I've done more investigation and made a proper fix for the "orphan nodes". The problem should not happen at all anymore. You don't need to use -dim 3:msh anymore - the default output will be correct.

MiguelVCarvalho commented 2 years ago

Thank you @rquey! It is now working as you mentioned :)

Just one thing, issue #377 still occurs if -dim 3:msh is not used in the -M module. Don't know if it is on purpose or not. Just pointing it out in case you didn't notice it ;).

rquey commented 2 years ago

Ah, correct. I won't fix this any time soon, so, you may want to keep -dim 3:msh.