CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

problem with using a curve for mesh refinement

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By boffin5
  • 1 Post By olesen
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 1, 2022, 16:17
Default problem with using a curve for mesh refinement
  #1
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 260
Rep Power: 6
boffin5 is on a distinguished road
Hi,

It's been a while since I used OF, so of course I'm having a problem with something I've done before.
I want to use a curve on a body to refine the mesh. The way I did it before, was a sequence in Paraview, as follows:


- use filter 'feature edges' and apply
- use tiny icon 'select cells' to capture the desired edge
- use the icon 'extract selection' and apply
- go to File-Save Data, name the file, and save in ascii format
- this saves the file in vtk format

Then, in a terminal, I run the command surfaceFeatureConvert filename.vtk filename.eMesh

However, this time I get the result: "Fatal File IO. Wrong token type - expected int32_t, found the word 'OFFSETS'

A search in this forum and elsewhere, hasn't provided any info. Has anyone seen (and I hope solved) this?


Alan w
boffin5 is offline   Reply With Quote

Old   February 1, 2022, 17:42
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
You should write it as obj file rather than VTK. There were a variety of changes in VTK I think. You can simply check if this works by using an eMesh and convert it to an vtk first. Open the vtk file and check the file-syntax. After that you can compare it with your vtk syntax written by paraview. Maybe you can simply resolve it or if possible, use the obj export (if possible).

Alternatively, if you have your surface and you know where the edge is located (e.g., by intersecting with a plan), you can use surfaceBooleanFeatures and create the edge on the fly.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 2, 2022, 11:49
Default Thank You Tobi
  #3
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 260
Rep Power: 6
boffin5 is on a distinguished road
What an honor it is to be helped by one of the stars of CFD! I will run with this help, and I have also benefited from your videos!
It was interesting in how you used Salome in the smoking pipe example, and I will likely have a similar scenario, in which case I will query you for sure.

Alan w
Tobi likes this.
boffin5 is offline   Reply With Quote

Old   February 2, 2022, 11:58
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by boffin5 View Post
Hi,

It's been a while since I used OF, so of course I'm having a problem with something I've done before.
I want to use a curve on a body to refine the mesh. The way I did it before, was a sequence in Paraview, as follows:


- use filter 'feature edges' and apply
- use tiny icon 'select cells' to capture the desired edge
- use the icon 'extract selection' and apply
- go to File-Save Data, name the file, and save in ascii format
- this saves the file in vtk format

Then, in a terminal, I run the command surfaceFeatureConvert filename.vtk filename.eMesh

However, this time I get the result: "Fatal File IO. Wrong token type - expected int32_t, found the word 'OFFSETS'

A search in this forum and elsewhere, hasn't provided any info. Has anyone seen (and I hope solved) this?


Alan w

Probably not your first thought, but VTK legacy format has actually been updated to accommodate changes in the underling vtkCellArray class. These files are not version "2.0", but more like "5.1" in the header.

Should be supported with OpenFOAM-v2106 and later:
https://develop.openfoam.com/Develop.../-/issues/2094
Tobi likes this.
olesen is offline   Reply With Quote

Old   February 2, 2022, 13:57
Default
  #5
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 260
Rep Power: 6
boffin5 is on a distinguished road
Thanks Olesen,


In Paraview I tried to save the curve data in obj format, but that option isn't available. So I still out of luck. Regarding v2106, I am using OpenFoam 8, so that would not apply?


To expand on my problem, the terminal error message reads:


Header : "# vtk DataFile Version 5.1"
Title : "vtk output"
dataType : "ASCII"
line:4 tagATASET
geomType : UNSTRUCTURED_GRID
line:5 tag:POINTS
Reading 2 numbers representing 2 coordinates.
line:7 tag:METADATA
line:14 tag:CELLS
Reading 2 cells or faces.
--> FOAM FATAL IO ERROR:
wrong token type - expected int32_t, found on line 15 the word 'OFFSETS'
file: edge1.vtk at line 15.
From function Foam::Istream& Foam:perator>>(Foam::Istream&, int32_t&)
in file primitives/ints/int32/int32IO.C at line 62.


And here is the edge1.vtk text:


# vtk DataFile Version 5.1
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 2 double
0.54138797522 -0.19449999928 0.33799999952 0.54138797522 0.19449999928 0.33799999952
METADATA
INFORMATION 2
NAME L2_NORM_RANGE LOCATION vtkDataArray
DATA 2 0.667215 0.667215
NAME L2_NORM_FINITE_RANGE LOCATION vtkDataArray
DATA 2 0.667215 0.667215
CELLS 2 2
OFFSETS vtktypeint64
0 2
CONNECTIVITY vtktypeint64
0 1
CELL_TYPES 1
3
CELL_DATA 1
SCALARS STLSolidLabeling float
LOOKUP_TABLE default
0
METADATA
INFORMATION 0
FIELD FieldData 1
vtkOriginalCellIds 1 1 vtkIdType
27
POINT_DATA 2
FIELD FieldData 1
vtkOriginalPointIds 1 2 vtkIdType
28 29



Quite frustrating, as this process worked for me a couple of months ago!
boffin5 is offline   Reply With Quote

Old   February 2, 2022, 14:37
Default
  #6
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 260
Rep Power: 6
boffin5 is on a distinguished road
Would this problem be resolved by upgrading to OpenFOAM 9?
boffin5 is offline   Reply With Quote

Old   February 3, 2022, 03:04
Default
  #7
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by boffin5 View Post
Would this problem be resolved by upgrading to OpenFOAM 9?
No using the openfoam.org version will not do it, perhaps time to try using the openfoam.com version?

Also consider reading my post about the OpenFOAM Foundation Ltd (https://olesenm.github.io/2020/11/11...de-provenance/)
olesen is offline   Reply With Quote

Old   February 3, 2022, 16:24
Default
  #8
Senior Member
 
Alan w
Join Date: Feb 2021
Posts: 260
Rep Power: 6
boffin5 is on a distinguished road
Curve for mesh refinement problem solved!


Thanks for the help Olesen, but installing OpenFOAM 9 was the key. However, you didn't know the history of my situation. I can't recall why, but a couple of months ago I installed the latest version of ParaView, and started using it in lieu of the canned version in OF8. Until the current problem, everything was fine.


Prior to this, I was using successfully using curves for mesh refinement, but it seems that the vtk files produced by the newer standalone ParaView were no longer compatible with OF8. By using the ParaView included with OF9, the convert utility works, and I am back in business!


So I will be removing OF8, unless you can give me a reason not to.
Your supporting of the openfoam.com version notwithstanding, I have learned on and have been using the .org version, and am accustomed to it. But I have noted you as a resource, so stay tuned.


Alan w
boffin5 is offline   Reply With Quote

Old   February 3, 2022, 17:41
Default
  #9
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Haaaa ... I was thinking that, you Mark, are the guy which knows about that stuff. A question, so the VTK was updated (so my assumption was right). However, we also updated the VTK stuff in the v21xx versions, right? Hence, extracting the line in Paraview as *.obj file and us our version (ESI-OpenCFD), it should work, right?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   February 4, 2022, 08:47
Default
  #10
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by boffin5 View Post
Thanks Olesen,

In Paraview I tried to save the curve data in obj format, but that option isn't available. So I still out of luck. Regarding v2106, I am using OpenFoam 8, so that would not apply?

...

Quite frustrating, as this process worked for me a couple of months ago!

Actually the process you had working a few months ago very likely involved an older version of paraview/VTK. If you have newer version of these, you automatically get the updated legacy format when writing, or at least until this has bee adopted (https://discourse.vtk.org/t/can-we-w...mat-with-vtk-9).


If you cannot use OpenFOAM-v2106 or OpenFOAM-v2112 for your main workflow, you can also use it for that operation only. Assuming, for example, that you either have the ubuntu or rpm packages installed, or can use docker.
Example,
Code:
$ openfoam-docker / surfaceFeatureConvert file1.vtk file.eMesh


// OR (for system installed version)

 
$ openfoam2112  / surfaceFeatureConvert file1.vtk file.eMesh

Or downgrade your paraview...
Tobi likes this.
olesen is offline   Reply With Quote

Old   February 4, 2022, 08:50
Default
  #11
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Tobi View Post
A question, so the VTK was updated (so my assumption was right). However, we also updated the VTK stuff in the v21xx versions, right?

Yes, the handling of reading VTK legacy files was updated in the v21xx versions before the OpenFOAM users really noticed there was going to be a problem.
olesen is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SU2-7.0.1 on ubuntu 18.04 hyunko SU2 Installation 7 March 16, 2020 04:37
OpenFOAM error Vinay Kumar V Main CFD Forum 0 February 20, 2020 09:17
[Gmsh] Extrude on gmsh Pedro Felix OpenFOAM Meshing & Mesh Conversion 0 October 30, 2019 12:33
[snappyHexMesh] sHM refinement away from surface nholt OpenFOAM Meshing & Mesh Conversion 1 June 14, 2016 14:36
[snappyHexMesh] problems using snappyHexMesh 2.1.0 on a supercomputer Sunxing OpenFOAM Meshing & Mesh Conversion 9 September 20, 2014 09:30


All times are GMT -4. The time now is 02:25.