Error: Index exceeds the number of array elements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Error: Index exceeds the number of array elements

ebryant
I am running FEATool Multiphysics 1.15.3 Build 22.04.109 on Windows 10 Home. Windows is installed on my MacBook Pro using Bootcamp.

I am using Python to construct a model in Gmsh. I have Gmsh export that as a .msh file and I then read it into FEATool using Grid -> Import Grid -> Gmsh Format... When I try to view the boundaries for the model I get this error:

Index exceeds the number of array elements. Index must not exceed 10.

To reproduce:

python index_test_case.py
Start FEATool
Select 3D
Click 'OK'
Select Grid -> Import Grid -> Gmsh Format...
Choose indext_test_case.msh
Select Grid -> Grid Generation...
Choose the 'Robust' grid generation algorithm
Click 'Generate'
Click 'OK'
Select Boundary -> Boundary Settings...
Click boundary #11
Error: Index exceeds the number of array elements. Index must not exceed 10.
Note, also, that the model no longer renders. Instead, only the boundary numbers are shown.

If either of the two cylinders or the box is removed from the model then the grid generation works fine and the boundaries do not exceed the array elements.

This looks very similar to a post from about a year ago: http://forum.featool.com/Index-exceeds-array-bounds-after-split-object-td969.html

index_test_case.py
index_test_case.msh
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

ebryant
Following the suggestion from the earlier ticket I referenced, it looks like I do have a workaround. If I import the Gmsh model, export it in 'FEniCS/Dolfin Format', and load it back in I do not get the error.

This workflow seems to work:

python index_test_case.py
Start FEATool
Select 3D
Click 'OK'
Select Grid -> Import Grid -> Gmsh Format...
Choose indext_test_case.msh
Select Grid -> Export Grid -> FEniCS/Dolfin Format...
save as index_test_case.xml
Start FEATool
Select 3D
Click 'OK'
Select Grid -> Import Grid -> FEniCS/Dolfin Format...
Choose indext_test_case.xml
Select Grid -> Grid Generation...
Choose the 'Robust' grid generation algorithm
Click 'Generate'
Click 'OK'
Select Boundary -> Boundary Settings...
It works! :)

I'll try this workflow.
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

Precise Simulation
Administrator
This post was updated on .
Thank you for reporting the issue and workaround. This type of error is generally due to failing trying to match new meshed boundaries with the old mesh, which will hopefully be improved in the future. I'm not sure yet why exporting and reimporting from FEniCS xml mesh format helps though.

That said, I'm not quite sure if your workflow is optimal here. The issue is that importing a mesh, and then re-meshing it will generally cause some degeneration in quality, as the original geometry/boundary information is not preserved in mesh formats and lost (curved surfaces are approximated by polygons etc). So I would generally recommend trying one of the following workflows:

1) Create your finished geometry and mesh entirely in gmsh, and then import the final mesh into FEATool (no remeshing in FEATool).

2) Create your geometry in gmsh (or another CAD program), and export it as a BREP or STEP CAD file. Then import the geometry into FEATool and mesh it there.

3) Create both geometry and mesh entirely in FEATool (as both gmsh and FEATool uses the same geometry engine/kernel, OpenCASCADE, technically the created geometries should be equivalent).
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

ebryant
Thank you for the suggested workflows. I had initially tried #1. I load the gmsh mesh into FEATool, select my boundaries, and solve. If I do that I get this message from the solver repeated 20 times (once per iteration):

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =  2.271233e-18.

I found that by re-meshing it in FEATool (the workflow I described above) the solver would work without issues.

I get that same warning if I try to use workflow #1 [using Navier-Stokes equations] on the index_test_case.msh file attached above.

I'll experiment with workflow #2.
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

ebryant
Workflow #2 runs into a directory naming issue. On my Windows installation my User directory is "Erik B". Because there is a space in it I am not able to load the BREP model.

Start FEATool
Select 3D
Click 'OK'
Select Grid -> Import Grid -> Gmsh Format...
Choose c:\Users\Erik B\dev\indext_test_case.msh

Geometry import failed.

File import/conversion error.

Geomtool system call returned error, IER = 1

GEOMTool 2.0.0 Build 22.04.099
> ERROR: Could not find/open file "C:\Users\Erik"


If I move the BREP file to C:\Users\ErikB\file.brep I get this error when I try to import it:

Geometry import failed.

File import/conversion error.

Geomtool system call returned error, IER = 11

GEOMTool 2.0.0 Build 22.04.099
Imported C:\Users\ErikB\file.brep
> ERROR: Unknown filetype "C:\Users\Erik"


It looks like there are at least two levels of file access where the space is not being escaped. One where it is trying to read the BREP file from the filesystem and another where a secondary something (library, plugin?) is being loaded after the BREP file is read in.

Any thoughts on how to get around this?
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

Precise Simulation
Administrator
Thank you for submitting the issue details. There should be an update available next week addressing some of these issues as spaces in file names. I'm not sure about why your second case doesn't work though, as I haven't been able to reproduce it yet.
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

ebryant
I have reimaged my Windows Installation and no longer have a space in my username. Things are working much better. Thanks for the quick work on the update. Let me know when it comes out if you want me to re-test.
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

Precise Simulation
Administrator
ebryant wrote
I have reimaged my Windows Installation and no longer have a space in my username. Things are working much better. Thanks for the quick work on the update. Let me know when it comes out if you want me to re-test.
There is now a bug-fix FEATool update available (version 1.15.4) which should address some of the issues you have found.

Furthermore, looking at the "Grid Statistics..." in the "Grid" menu for the gmsh mesh ("index_test_case.msh"); the minimum quality of grid cells seem to be 0.00619636, which is likely you get a warning about a singular matrix when solving. Distorted mesh elements (<< 0.1 quality) can lead to poor approximation and solving, and should be avoided if possible. So when meshing (whether using gmsh or other mesh generators) it is good to take care that a high quality mesh is generated.

Also, "index_test_case" mesh here consists of three disconnected subdomains, that is the two cylinders are not connected to the base plate (even if they touch). Typically one would want domains to be connected in a simulation (so the physics interact). If this is the case you might need to apply a join/union operation to the geometry object before meshing.
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

ebryant
Thank you for submitting the issue details. There should be an update available next week addressing some of these issues as spaces in file names. I'm not sure about why your second case doesn't work though, as I haven't been able to reproduce it yet.
The second case was still using FEATools that I had installed and was running as my user ("Erik B"). The only difference was instead of trying to load the file from a directory that had a space in it ("C:\Users\Erik B") I loaded the file from a new directory with no space in the name ("C:\Users\ErikB"). FEATool was able to get a little bit further in the loading process, but still errored.
Reply | Threaded
Open this post in threaded view
|

Re: Error: Index exceeds the number of array elements

ebryant
In reply to this post by Precise Simulation
Furthermore, looking at the "Grid Statistics..." in the "Grid" menu for the gmsh mesh ("index_test_case.msh"); the minimum quality of grid cells seem to be 0.00619636, which is likely you get a warning about a singular matrix when solving.
Thanks! I made a much finer mesh and that fixed it.

Also, "index_test_case" mesh here consists of three disconnected subdomains, that is the two cylinders are not connected to the base plate (even if they touch). Typically one would want domains to be connected in a simulation (so the physics interact).
I've updated my gmsh script to union the objects before exporting to the .brep / .msh files. Now FEATool sees it as a single, composite object. Thanks for the pointer!