CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [Gmsh] Gmsh to foam (https://www.cfd-online.com/Forums/openfoam-meshing/207864-gmsh-foam.html)

Carmelo55 October 4, 2018 11:32

Gmsh to foam
 
Hello

I am trying to make a cube in GMSH, mesh it and then using gmshToFoam convert the code. But i dont know what is wrong. I am starting with gmsh and OpenFoam if someone could help me please.

GMSH.
// Gmsh project created on Thu Oct 04 16:20:25 2018
SetFactory("OpenCASCADE");
lc = 0.1;

//Puntos

Point (1) = {0,0,0,lc};
Point (2) = {1,0,0,lc};
Point (3) = {1,1,0,lc};
Point (4) = {0,1,0,lc};
Point (5) = {0,0,0.1,lc};
Point (6) = {1,0,0.1,lc};
Point (7) = {1,1,0.1,lc};
Point (8) = {0,1,0.1,lc};

//Lineas

//Block
Line (1) = {1,2};
Line (2) = {2,3};
Line (3) = {3,4};
Line (4) = {4,1};
Line (5) = {5,6};
Line (6) = {6,7};
Line (7) = {7,8};
Line (8) = {8,5};

//laterales

Line (9) = {5,1};
Line (10) = {6,2};
Line (11) = {7,3};
Line (12) = {8,4};

//Superficies


Curve Loop(14) = {4, 1, 2, 3};
Plane Surface(14) = {14};

Curve Loop(15) = {6, 7, 8, 5};
Plane Surface(15) = {15};

Curve Loop(16) = {4, -9, -8, 12};
Plane Surface(16) = {16};

Curve Loop(17) = {7, 12, -3, -11};
Plane Surface(17) = {17};

Curve Loop(18) = {6, 11, -2, -10};
Plane Surface(18) = {18};
//+
Curve Loop(19) = {10, -1, -9, 5};
Plane Surface(19) = {19};

Surface Loop(1) = {14, 16, 19, 18, 15, 17};
Volume(1) = {1};

Physical Surface("bottom") = {14};
Physical Surface("top") = {15};
Physical Surface("left") = {16};
Physical Surface("right") = {17};
Physical Surface("front") = {18};
Physical Surface("back") = {19};




//+
Physical Volume("internal") = {1};

////////////////////////////////////////////////////////////////////////

OpenFoam:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
|*---------------------------------------------------------------------------*|
|* OpenFOAM for Windows 18.06 (v1) *|
|* Built by CFD Support, www.cfdsupport.com (based on Symscape). *|
\*---------------------------------------------------------------------------*/
Build : dev-59be3e7
Exec : C:\OpenFOAM\18.06\cygwin64\opt\OpenFOAM\OpenFOAM-dev\platforms\cygwin64mingw-w64DPInt32Opt\bin\gmshToFoam.exe Cubomshtofoam.msh
Date : Oct 04 2018
Time : 16:26:35
Host : "DESKTOP-PLD6LT5"
PID : 9340
I/O : uncollated
Case : C:/OpenFOAM/18.06/Carmelo-dev/run/cavity
nProcs : 1
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Starting to read mesh format at line 2
Read format version 4 ascii 0

Starting to read physical names at line 5
Physical names:7
Surface 1 bottom
Surface 2 top
Surface 3 left
Surface 4 right
Surface 5 front
Surface 6 back
Volume 7 internal

Skipping tag $Entities at line 15
Starting to read points at line 45
Vertices to be read:27
Vertices read:18


--> FOAM FATAL IO ERROR:
wrong token type - expected word, found on line 0 the label 381

file: IStringStream.sourceFile at line 0.

From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::word&)
in file primitives/strings/word/wordIO.C at line 74.

FOAM exiting


Thanks and Best Regards.

BM_CFD November 6, 2018 03:25

The problem is I think due to how new version of gmsh is creating the mesh. Version 4.0 of gmsh creates the .msh file in ASCII v4 however gmshToFoam is created for ASCII v2. You can find the solution to this issue in the following discussion:

https://www.cfd-online.com/Forums/op...-openfoam.html

Regards


All times are GMT -4. The time now is 01:26.