error about mesh.names

Mesh generators, CAD programs, and other tools
Post Reply
Guo
Posts: 6
Joined: 01 Aug 2022, 15:22
Antispam: Yes

error about mesh.names

Post by Guo »

Hello,

I am trying to run elmer via python. when I finish the mesh, I want to run ElmerSolver to generate the .vtu file, but I get this error:"ERROR:: ReadTargetNames: Requested the use of entity names but this file does not exits: ./mesh.names"

I can see the mesh.names when I write Elmer in FreeCAD, but not when I run it in python.

I want to know how can I get mesh.names? Thanks!

Here is my python code.

Code: Select all

from subprocess import call

GMSH_Path = "C:/Users/86138/fc_env_py39/Library/bin/gmsh.exe"
ELMER_GRID_PATH = "D:/Elmer/Elmer 9.0-Release/bin/ElmerGrid.exe"
ELMER_PATH = "D:/Elmer/Elmer 9.0-Release/bin/ElmerSolver.exe"

call([GMSH_Path, "D:/senior year/Bachelor/220601_B_GUO/devel/src/pythonProject/Model_Bone/Model3DBoneFillet-BodyFillet.step", "-3", "-optimize_netgen", "-format", "unv", "-save_all", "-o", "mesh.unv"])
call([ELMER_GRID_PATH, "8", "2", "mesh.unv", "-autoclean", "-3d", "-out", "D:/senior year/Bachelor/220601_B_GUO/devel/src/pythonProject/FEM Results/tube"])
call([ELMER_GRID_PATH, "2", "4", "mesh"])
call([ELMER_PATH, "case.sif"])
Starting program Elmergrid
Elmergrid reading in-line arguments
Lower dimensional boundaries will be removed
Materials and boundaries will be renumbered
Nodes that do not appear in any element will be removed
Output will be saved to file D:/senior year/Bachelor/220601_B_GUO/devel/src/pythonProject/FEM Results/tube.

Elmergrid loading data:
-----------------------
Reading mesh from universal mesh file mesh.unv.
First round for allocating data
There are 1079 nodes in the mesh
Element type range in mesh [202,504]
Reordering 6426 elements with indexes up to 6514
Allocating mesh with 1079 nodes and 6426 4-node elements in 3 dims.
Physical index interval is [1,154]
Second round for reading data
Reading node coordinates
Reading element topologies
Unknown mode line 15552: 2477
Moving bulk elements to boundary elements
Leading bulk elementtype is 504
Trailing bulk elementtype is 202
Checking that different dimensions have unique boundary tags!
Tag interval for boundaries: [1 154]
We have an overlap, applying offsets!
Replacing tag in 1-dim 1 -> 69
Replacing tag in 1-dim 2 -> 70
Replacing tag in 1-dim 3 -> 71
Replacing tag in 1-dim 4 -> 72
Replacing tag in 1-dim 5 -> 73
Replacing tag in 1-dim 6 -> 74
Replacing tag in 1-dim 7 -> 75
Replacing tag in 1-dim 8 -> 76
Replacing tag in 1-dim 9 -> 77
Replacing tag in 1-dim 10 -> 78
Replacing tag in 1-dim 11 -> 79
Replacing tag in 1-dim 12 -> 80
Replacing tag in 1-dim 13 -> 81
Replacing tag in 1-dim 14 -> 82
Replacing tag in 1-dim 15 -> 83
Replacing tag in 1-dim 16 -> 84
Replacing tag in 1-dim 17 -> 85
Replacing tag in 1-dim 18 -> 86
Replacing tag in 1-dim 19 -> 87
Replacing tag in 1-dim 20 -> 88
Replacing tag in 1-dim 21 -> 89
Replacing tag in 1-dim 22 -> 90
Replacing tag in 1-dim 23 -> 91
Replacing tag in 1-dim 24 -> 92
Replacing tag in 1-dim 25 -> 93
Replacing tag in 1-dim 26 -> 94
Replacing tag in 1-dim 27 -> 95
Replacing tag in 1-dim 28 -> 96
Replacing tag in 1-dim 29 -> 97
Replacing tag in 1-dim 30 -> 98
Replacing tag in 1-dim 31 -> 99
Replacing tag in 1-dim 32 -> 100
Replacing tag in 1-dim 33 -> 101
Replacing tag in 1-dim 34 -> 102
Replacing tag in 1-dim 35 -> 103
Replacing tag in 1-dim 36 -> 104
Replacing tag in 1-dim 37 -> 105
Replacing tag in 1-dim 38 -> 106
Replacing tag in 1-dim 39 -> 107
Replacing tag in 1-dim 40 -> 108
Replacing tag in 1-dim 41 -> 109
Replacing tag in 1-dim 42 -> 110
Replacing tag in 1-dim 43 -> 111
Replacing tag in 1-dim 44 -> 112
Replacing tag in 1-dim 45 -> 113
Replacing tag in 1-dim 46 -> 114
Replacing tag in 1-dim 47 -> 115
Replacing tag in 1-dim 48 -> 116
Replacing tag in 1-dim 49 -> 117
Replacing tag in 1-dim 50 -> 118
Replacing tag in 1-dim 51 -> 119
Replacing tag in 1-dim 52 -> 120
Replacing tag in 1-dim 53 -> 121
Replacing tag in 1-dim 54 -> 122
Replacing tag in 1-dim 55 -> 123
Replacing tag in 1-dim 56 -> 124
Replacing tag in 1-dim 57 -> 125
Replacing tag in 1-dim 58 -> 126
Replacing tag in 1-dim 59 -> 127
Replacing tag in 1-dim 60 -> 128
Replacing tag in 1-dim 61 -> 129
Replacing tag in 1-dim 62 -> 130
Replacing tag in 1-dim 63 -> 131
Replacing tag in 1-dim 64 -> 132
Replacing tag in 1-dim 65 -> 133
Replacing tag in 1-dim 66 -> 134
Replacing tag in 1-dim 67 -> 135
Replacing tag in 1-dim 68 -> 136
Replacing tag in 1-dim 69 -> 137
Replacing tag in 1-dim 70 -> 138
Replacing tag in 1-dim 71 -> 139
Replacing tag in 1-dim 72 -> 140
Replacing tag in 1-dim 73 -> 141
Replacing tag in 1-dim 74 -> 142
Replacing tag in 1-dim 75 -> 143
Replacing tag in 1-dim 76 -> 144
Replacing tag in 1-dim 77 -> 145
Replacing tag in 1-dim 78 -> 146
Replacing tag in 1-dim 79 -> 147
Replacing tag in 1-dim 80 -> 148
Replacing tag in 1-dim 81 -> 149
Replacing tag in 1-dim 82 -> 150
Replacing tag in 1-dim 83 -> 151
Replacing tag in 1-dim 84 -> 152
Replacing tag in 1-dim 85 -> 153
Replacing tag in 1-dim 86 -> 154
Replacing tag in 1-dim 87 -> 155
Replacing tag in 1-dim 88 -> 156
Replacing tag in 1-dim 89 -> 157
Replacing tag in 1-dim 90 -> 158
Replacing tag in 1-dim 91 -> 159
Replacing tag in 1-dim 92 -> 160
Replacing tag in 1-dim 93 -> 161
Replacing tag in 1-dim 94 -> 162
Replacing tag in 1-dim 95 -> 163
Replacing tag in 1-dim 96 -> 164
Replacing tag in 1-dim 97 -> 165
Replacing tag in 1-dim 98 -> 166
Replacing tag in 1-dim 99 -> 167
Replacing tag in 1-dim 100 -> 168
Replacing tag in 1-dim 101 -> 169
Replacing tag in 1-dim 102 -> 170
Replacing tag in 1-dim 103 -> 171
Replacing tag in 1-dim 104 -> 172
Replacing tag in 1-dim 105 -> 173
Replacing tag in 1-dim 106 -> 174
Replacing tag in 1-dim 107 -> 175
Replacing tag in 1-dim 108 -> 176
Replacing tag in 1-dim 109 -> 177
Replacing tag in 1-dim 110 -> 178
Replacing tag in 1-dim 111 -> 179
Replacing tag in 1-dim 112 -> 180
Replacing tag in 1-dim 113 -> 181
Replacing tag in 1-dim 114 -> 182
Replacing tag in 1-dim 115 -> 183
Replacing tag in 1-dim 116 -> 184
Replacing tag in 1-dim 117 -> 185
Replacing tag in 1-dim 118 -> 186
Replacing tag in 1-dim 119 -> 187
Replacing tag in 1-dim 120 -> 188
Replacing tag in 1-dim 121 -> 189
Replacing tag in 1-dim 122 -> 190
Replacing tag in 1-dim 123 -> 191
Replacing tag in 1-dim 124 -> 192
Replacing tag in 1-dim 125 -> 193
Replacing tag in 1-dim 126 -> 194
Replacing tag in 1-dim 127 -> 195
Replacing tag in 1-dim 128 -> 196
Replacing tag in 1-dim 129 -> 197
Replacing tag in 1-dim 130 -> 198
Replacing tag in 1-dim 131 -> 199
Replacing tag in 1-dim 132 -> 200
Replacing tag in 1-dim 133 -> 201
Replacing tag in 1-dim 134 -> 202
Replacing tag in 1-dim 135 -> 203
Replacing tag in 1-dim 136 -> 204
Replacing tag in 1-dim 137 -> 205
Replacing tag in 1-dim 138 -> 206
Replacing tag in 1-dim 139 -> 207
Replacing tag in 1-dim 140 -> 208
Replacing tag in 1-dim 141 -> 209
Replacing tag in 1-dim 142 -> 210
Replacing tag in 1-dim 143 -> 211
Replacing tag in 1-dim 144 -> 212
Replacing tag in 1-dim 145 -> 213
Replacing tag in 1-dim 146 -> 214
Replacing tag in 1-dim 147 -> 215
Replacing tag in 1-dim 148 -> 216
Replacing tag in 1-dim 149 -> 217
Replacing tag in 1-dim 150 -> 218
Replacing tag in 1-dim 151 -> 219
Replacing tag in 1-dim 152 -> 220
Replacing tag in 1-dim 153 -> 221
Replacing tag in 1-dim 154 -> 222
Renumbered tags for boundary elements!
There are 1886 (out of 6426) lower dimensional elements.
Node 635 belongs to maximum of 42 elements
Found correctly 1886 side elements.
Parent elements were reordered up to index 4540.
Moved 4540 elements (out of 6426) to new positions
The Universal mesh was loaded from file mesh.unv.

Elmergrid creating and manipulating meshes:
-------------------------------------------
Removing lower dimensional boundaries
Maximum elementtype is 504 and dimension 3
Minimum elementtype is 504 and dimension 3
Removed 534 (out of 1886) less than 2D boundary elements
All 1079 nodes were used by the mesh elements
Initial boundary interval [1,68]
boundary index unaltered 1 in 48 2D elements
boundary index unaltered 2 in 45 2D elements
boundary index unaltered 3 in 45 2D elements
boundary index unaltered 4 in 243 2D elements
boundary index unaltered 5 in 243 2D elements
boundary index unaltered 6 in 29 2D elements
boundary index unaltered 7 in 8 2D elements
boundary index unaltered 8 in 8 2D elements
boundary index unaltered 9 in 8 2D elements
boundary index unaltered 10 in 8 2D elements
boundary index unaltered 11 in 8 2D elements
boundary index unaltered 12 in 8 2D elements
boundary index unaltered 13 in 8 2D elements
boundary index unaltered 14 in 8 2D elements
boundary index unaltered 15 in 8 2D elements
boundary index unaltered 16 in 8 2D elements
boundary index unaltered 17 in 8 2D elements
boundary index unaltered 18 in 8 2D elements
boundary index unaltered 19 in 8 2D elements
boundary index unaltered 20 in 8 2D elements
boundary index unaltered 21 in 8 2D elements
boundary index unaltered 22 in 8 2D elements
boundary index unaltered 23 in 8 2D elements
boundary index unaltered 24 in 8 2D elements
boundary index unaltered 25 in 8 2D elements
boundary index unaltered 26 in 8 2D elements
boundary index unaltered 27 in 29 2D elements
boundary index unaltered 28 in 8 2D elements
boundary index unaltered 29 in 8 2D elements
boundary index unaltered 30 in 8 2D elements
boundary index unaltered 31 in 8 2D elements
boundary index unaltered 32 in 8 2D elements
boundary index unaltered 33 in 8 2D elements
boundary index unaltered 34 in 8 2D elements
boundary index unaltered 35 in 8 2D elements
boundary index unaltered 36 in 8 2D elements
boundary index unaltered 37 in 8 2D elements
boundary index unaltered 38 in 8 2D elements
boundary index unaltered 39 in 8 2D elements
boundary index unaltered 40 in 8 2D elements
boundary index unaltered 41 in 8 2D elements
boundary index unaltered 42 in 8 2D elements
boundary index unaltered 43 in 8 2D elements
boundary index unaltered 44 in 8 2D elements
boundary index unaltered 45 in 8 2D elements
boundary index unaltered 46 in 8 2D elements
boundary index unaltered 47 in 8 2D elements
boundary index unaltered 48 in 30 2D elements
boundary index unaltered 49 in 16 2D elements
boundary index unaltered 50 in 16 2D elements
boundary index unaltered 51 in 16 2D elements
boundary index unaltered 52 in 16 2D elements
boundary index unaltered 53 in 16 2D elements
boundary index unaltered 54 in 16 2D elements
boundary index unaltered 55 in 16 2D elements
boundary index unaltered 56 in 16 2D elements
boundary index unaltered 57 in 16 2D elements
boundary index unaltered 58 in 16 2D elements
boundary index unaltered 59 in 16 2D elements
boundary index unaltered 60 in 16 2D elements
boundary index unaltered 61 in 16 2D elements
boundary index unaltered 62 in 16 2D elements
boundary index unaltered 63 in 16 2D elements
boundary index unaltered 64 in 16 2D elements
boundary index unaltered 65 in 16 2D elements
boundary index unaltered 66 in 16 2D elements
boundary index unaltered 67 in 16 2D elements
boundary index unaltered 68 in 16 2D elements
Numbering of boundary types is already ok
Initial body interval [1,1]
Numbering of bodies is already ok
Renumbering of material types completed!

Elmergrid saving data with method 2:
-------------------------------------
Saving mesh in ElmerSolver format to directory D:/senior year/Bachelor/220601_B_GUO/devel/src/pythonProject/FEM Results/tube.
Reusing an existing directory
Saving 1079 coordinates to mesh.nodes.
Saving 4540 element topologies to mesh.elements.
Saving boundary elements to mesh.boundary.
Saving header info to mesh.header.

Thank you for using Elmergrid!
Send bug reports and feature wishes to elmeradm@csc.fi

Starting program Elmergrid
Elmergrid reading in-line arguments
Output will be saved to file mesh.

Elmergrid loading data:
-----------------------
Loading mesh in ElmerSolver format from root directory.
Loading header from mesh.header
Maximum elementtype index is: 504
Maximum number of nodes in element is: 4
Allocating for 1079 knots and 4540 elements.
Loading 1079 Elmer nodes from mesh.nodes
Loading 4540 bulk elements from mesh.elements
Loading 1352 boundary elements from mesh.boundary
Elmer mesh loaded successfully

Elmergrid creating and manipulating meshes:
-------------------------------------------

Elmergrid saving data with method 4:
-------------------------------------
Saving Gmsh mesh to mesh.msh.
Saving 1079 node coordinates.
Saving 4540 element topologies.
SaveMeshGmsh: All done

Thank you for using Elmergrid!
Send bug reports and feature wishes to elmeradm@csc.fi
ELMER SOLVER (v 9.0) STARTED AT: 2022/08/17 16:42:24
ParCommInit: Initialize #PEs: 1
MAIN:
MAIN: =============================================================
MAIN: ElmerSolver finite element software, Welcome!
MAIN: This program is free software licensed under (L)GPL
MAIN: Copyright 1st April 1995 - , CSC - IT Center for Science Ltd.
MAIN: Webpage http://www.csc.fi/elmer, Email elmeradm@csc.fi
MAIN: Version: 9.0 (Rev: Release, Compiled: 2022-06-15)
MAIN: Running one task without MPI parallelization.
MAIN: Running with just one thread per task.
MAIN: Lua interpreter linked in.
MAIN: =============================================================
MAIN:
MAIN:
MAIN: -------------------------------------
MAIN: Reading Model: case.sif
LoadInputFile: Scanning input file: case.sif
LoadInputFile: Scanning only size info
LoadInputFile: First time visiting
LoadInputFile: Reading base load of sif file
LoadInputFile: Loading input file: case.sif
LoadInputFile: Reading base load of sif file
LoadInputFile: Number of BCs: 2
LoadInputFile: Number of Body Forces: 0
LoadInputFile: Number of Initial Conditions: 0
LoadInputFile: Number of Materials: 1
LoadInputFile: Number of Equations: 1
LoadInputFile: Number of Solvers: 2
LoadInputFile: Number of Bodies: 1
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by area
ListTagKeywords: Setting weight for keywords!
ListTagKeywords: No parameters width suffix: normalize by volume
Loading user function library: [StressSolve]...[StressSolver_Init0]
Loading user function library: [ResultOutputSolve]...[ResultOutputSolver_Init0]
LoadMesh: Loading serial mesh!
ElmerAsciiMesh: Performing step: 1
ElmerAsciiMesh: Base mesh name: .
ReadHeaderFile: Reading header info from file: ./mesh.header
InitializeMesh: Number of nodes in mesh: 1079
InitializeMesh: Number of bulk elements in mesh: 4540
InitializeMesh: Number of boundary elements in mesh: 1352
InitializeMesh: Initial number of max element nodes: 4
ElmerAsciiMesh: Performing step: 2
ReadNodesFile: Reading nodes from file: ./mesh.nodes
MapCoordinates: Performing coordinate mapping
SetMeshDimension: Dimension of mesh is: 3
SetMeshDimension: Max dimension of mesh is: 3
ElmerAsciiMesh: Performing step: 3
ReadElementsFile: Reading bulk elements from file: ./mesh.elements
STOP 1
ElmerAsciiMesh: Performing step: 4
ReadBoundaryFile: Reading boundary elements from file: ./mesh.boundary
PermuteNodeNumbering: Performing node mapping
ERROR:: ReadTargetNames: Requested the use of entity names but this file does not exits: ./mesh.names

Process finished with exit code 0
Attachments
mesh.unv
(771.16 KiB) Downloaded 71 times
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: error about mesh.names

Post by kevinarden »

I believe to get the mesh.names file you have to create the names of the bodies and boundaries in gmsh using physical groups.

Using names is an option in Elmer, if you don't use names you reference bodies and boundaries by their number
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: error about mesh.names

Post by kevinarden »

This line in the sif tells Elmer to use mesh names and forces it to look for the mesh.name file

Use Mesh Names = Logical True

You can set this to false and reference boundaries and boundaries by their number

to get mesh.names you have to create them in the meshing tool.
Guo
Posts: 6
Joined: 01 Aug 2022, 15:22
Antispam: Yes

Re: error about mesh.names

Post by Guo »

How can I use python to create the names of the bodies and boundaries? My project is to automate this process.
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: error about mesh.names

Post by kevinarden »

The format of the file is below so you could just have python write the file
Otherwise you have to put the names into the mesh generation step where you use gmsh to make the mesh

The file format is:
! ----- names for bodies -----
$ beam = 1
$ hinge = 2
! ----- names for boundaries -----
$ load = 1
$ fixed = 2
$ beam = 3
$ master = 4
$ slave = 5
kevinarden
Posts: 2237
Joined: 25 Jan 2019, 01:28
Antispam: Yes

Re: error about mesh.names

Post by kevinarden »

in gmsh the names can be created using physical groups.
Example of a mesh with and without names in gmsh
hinge.geo
(1.87 KiB) Downloaded 79 times
nonamehinge.geo
(1.55 KiB) Downloaded 73 times
Guo
Posts: 6
Joined: 01 Aug 2022, 15:22
Antispam: Yes

Re: error about mesh.names

Post by Guo »

Thanks, this is very helpful to me!
Post Reply