CGX on Windows can not generate tetrahedral

hi,

i receive some error messages when using Tetgen mesher in CGX, try add path to environmental variable still did not work.

any hints and suggestion?

 Tet-mesh body:B052

+surf:S038
+surf:S040
+surf:S046
-surf:S048
-surf:S034
+surf:S044
The system cannot find the batch label specified - tetgen
 Try to read TG file

 reading Tetgen format
 MODEL NAME:  mesh.1ERROR: The input file "mesh.1.node" could not be opened.

Has this file actually been created in the directory youā€™re calling cgx from?

thank you for looking into my problems, no file is created.

input of *fbd file,


valu ldiv 10

pnt P01 0.00 100.00 0.00
pnt P02 0.00 0.00 0.00
pnt P03 100.00 100.00 0.00
pnt P04 100.00 0.00 0.00
pnt P05 0.00 100.00 100.00
pnt P06 0.00 0.00 100.00
pnt P07 100.00 0.00 100.00
pnt P08 100.00 100.00 100.00

line L01 P01 P02 ldiv
line L02 P03 P01 ldiv
line L03 P04 P03 ldiv
line L04 P02 P04 ldiv
line L05 P05 P06 ldiv
line L06 P06 P07 ldiv
line L07 P07 P08 ldiv
line L08 P08 P05 ldiv
line L09 P02 P06 ldiv
line L010 P01 P05 ldiv
line L011 P03 P08 ldiv
line L012 P04 P07 ldiv

seta A013 l L01 L02 L03 L04 
surf S014 A013 
seta A015 l L05 L06 L07 L08 
surf S016 A015 
seta A017 l L01 L09 L05 L010 
surf S018 A017 
seta A019 l L02 L010 L08 L011 
surf S020 A019 
seta A021 l L03 L011 L07 L012 
surf S022 A021 
seta A023 l L04 L012 L06 L09 
surf S024 A023 

seta V025 s S014 S016 S018 S020 S022 S024 
body B026 V025 

plot ba all

elty all te10
mesh all

CGX output logs reported,

>"C:\PROGRA~2\BCONVE~1\CalculiX\bin\cgx.bat" -b "04exp.fbd"
on a Windows 7 machine, nodename USER-PC, release 6, version 6.1 Service Pack 1 7601, machine 601 
 The win HOME was detected:C:\Users\user
parameters:3 arguments:2
GL_MAX_EVAL_ORDER:32, mesh threads:1
 04exp.fbd opened

 reading file
create surf: S014 + BLEND + L01 + L02 + L03 + L04
create surf: S016 + BLEND + L05 + L06 + L07 + L08
create surf: S018 + BLEND + L01 + L05 + L09 + L010
create surf: S020 + BLEND + L02 + L08 + L010 + L011
create surf: S022 + BLEND + L03 + L07 + L011 + L012
create surf: S024 + BLEND + L04 + L06 + L09 + L012
 please wait for 'ready'


shape:H001 H001 0
shape:H002 H002 2
shape:H003 H003 4
shape:H004 H004 6
shape:H005 H005 8
shape:H006 H006 10

surf:S014 NURBS:N001 patch0
surf:S016 NURBS:N002 patch0
surf:S018 NURBS:N003 patch0
surf:S020 NURBS:N004 patch0
surf:S022 NURBS:N005 patch0
surf:S024 NURBS:N006 patch0




 Tet-mesh body:B026

+surf:S014
+surf:S016
+surf:S022
-surf:S024
+surf:S018
+surf:S020
 Try to read TG file

 reading Tetgen format
 MODEL NAME:  mesh.1ERROR: The input file "mesh.1.node" could not be opened.

-surf:S014
-surf:S016
-surf:S022
+surf:S024
-surf:S018
-surf:S020
 Try to read TG file

 reading Tetgen format
 MODEL NAME:  mesh.1ERROR: The input file "mesh.1.node" could not be opened.

ERROR: No mesh-file found

 ERROR: No tet-mesh could be created for body:B026
  The temporary surface mesh is not deleted and can be used for debugging.
 The files nodnr_ng_cgx.out elemnr_ng_cgx.out provide the link between ng and cgx entity numbers.
 makeSurfaces
 getElemNormalen
 realloc_colNr
 add the faces
 updateDispLists
 delSet
 ready
 done 

gtol calculated:1.000000e-03

Tl;dr:

  1. Locate the tetgen binary. (I suspect it is in C:\PROGRA~2\BCONVE~1\CalculiX\bin)
  2. Edit the environment variable Path, and add the location of the tetgen binary.

On my machine (FreeBSD 13.2, CalculiX 2.21) I could run your fbd file just fine.

So I looked into what cgx was doing using the truss(1) program that tells me what system calls are being used. What I saw was that cgx reads the input, writes some files and searches for and then calls the tetgen program. Now tetgen produces a bunch of output. Later cgx writes its own output.

When I run your example, I see the output from tetgen that is missing from your output;

Opening mesh.smesh.
Delaunizing verticesā€¦
Delaunay seconds: 0
Creating surface mesh ā€¦
Surface mesh seconds: 0
Recovering boundariesā€¦
Boundary recovery seconds: 0
Removing exterior tetrahedra ā€¦
Exterior tets removal seconds: 0
Recovering Delaunaynessā€¦
Delaunay recovery seconds: 0
Refining meshā€¦
Refinement seconds: 0
Optimizing meshā€¦
Optimization seconds: 0

Writing mesh.1.node.
Writing mesh.1.ele.
Writing mesh.1.face.
Writing mesh.1.edge.

Output seconds: 0
Total running seconds: 0

Statistics:

Input points: 128
Input facets: 252
Input segments: 378
Input holes: 0
Input regions: 0

Mesh points: 129
Mesh tetrahedra: 303
Mesh faces: 732
Mesh faces on exterior boundary: 252
Mesh faces on input facets: 252
Mesh edges on input segments: 378
Steiner points inside domain: 1

Since your cgx run cannot find the output file that tetgen should have produced, and since the output from tetgen isnā€™t shown, I suspect that (a) cgx either did not find tetgen or (b) that the tetgen run failed in some way.
Since there is no tetgen output at all, (a) seems more likely.

Looking at the source code of cgx, the way it calls tetgen requires that the directory where the tetgen binary can be found in the Path environment variable.

So;

  1. Locate the tetgen binary. (I suspect it is in C:\PROGRA~2\BCONVE~1\CalculiX\bin)
  2. Edit the environment variable Path, and add the location of the tetgen binary.
1 Like

thanks for test and reporting, it seems another possible reason in tetgen not working properly since both steps you suggested still not work.

prpbably in *.bat file of cmdStartup files setting by bConverged need to modify, but i did not know how.

@echo off

rem   Modify this file to change your startup settings for the CalculiX command window.

set CYGWIN=nodosfilewarning
set PRINTF_EXPONENT_DIGITS=2
set VERSION=2.21
set HOME=C:\Users\user\DOWNLO~1
set CALCULIX_ROOT=C:\PROGRA~2\BCONVE~1
set PATH=%CALCULIX_ROOT%\CalculiX\bin;%CALCULIX_ROOT%\translation\bin;%CALCULIX_ROOT%\common\Python;%CALCULIX_ROOT%\gnuplot\bin;%PATH%

set CCX_NPROC_STIFFNESS=2
set CCXDOCS=ms-its:%CALCULIX_ROOT%\common\help\bConverged.chm::/ccx.pdf
set CGXDOCS=ms-its:%CALCULIX_ROOT%\common\help\bConverged.chm::/cgx.pdf
set CGXTERMVIEWER=start ""
set BROWSER=start "" hh.exe

set "arg=%~1"
if not defined arg goto startup
if /i %1==ccx goto ccx
if /i %1==cgx goto cgx
goto end

:ccx
:cgx
  "%CALCULIX_ROOT%\CalculiX\%~1\%~1.exe" %2 %3 %4 %5 %6
  goto end

:startup
  cd /d %HOME% ..
  cls
  advise usage
  goto end

:end

Some questions;

  1. Did you locate tetgen.exe?
  2. And you put the location where it is in your Path?

Then open a cmd window, and type tetgen -h<enter>.

You should see the online help for tetgen. For me that starts like this:

TetGen
A Quality Tetrahedral Mesh Generator and 3D Delaunay Triangulator
Version 1.5
August 18, 2018

If you get a message like this:

ā€˜tetgenā€™ is not recognized as an internal or external command, operable program or batch file.

Then you did not put the correct location in the Path.
Make sure that there are e.g. no extra spaces in the string that you added to the path!

If you get another error message, please report back what it is.

it seems the path was properly defined, but i still not known why TetGen failed to run in CGX

You will probably have to close the cmd window from which you were running cgx and open a new one for it to pick up any change in Path.

If that doesnā€™t solve the problem, you will probably have to run cgx under some kind of debugger/system call tracer so you can see what happens when it tries to run tetgen. Since Iā€™m not a windows user I cannot really advise you what to use here.

xyont, I just copied your code and run it. It worked on my (Linux) side. So it is indeed just an access problem. As a quick fix you could copy the tetgen program into your working folder (And maybe also cgx). And you could contact Rafal Brzegowy. His mail should be either written on www.dhondt.de or in the README in his calculix_for_win package.

2 Likes

ok, Iā€™ll try to contact Itā€™s clearly shown related to specific Windows and predefined setting since not a problem on Linux.

The call to tetgen happens in generateTet.cpp. It is a system call to ā€˜tetgenā€™ with some arguments:

sprintf(buffer, ā€œtetgen -qYO%da%e mesh.smeshā€,5, (teth/scale->w)(teth/scale->w)(teth/scale->w)/5.);
system(buffer);

1 Like

Many thanks, it seems to be working. Some permission did not pass, but not a problem.

prnt se
1     all stat:o n:682 e:299 f:252 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
3     Nall stat:c n:682 e:0 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
4     Eall stat:c n:0 e:299 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0
5     +C3D10 stat:c n:0 e:299 f:0 p:0 l:0 c:0 s:0 b:0 L:0 S:0 se:0 sh:0 v:0