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/)
-   -   [blockMesh] create a mesh without reading from dictionary file (https://www.cfd-online.com/Forums/openfoam-meshing/218907-create-mesh-without-reading-dictionary-file.html)

Jieren July 8, 2019 23:40

create a mesh without reading from dictionary file
 
Dear foamers,

I want to generate a new mesh (like a simple cubic one) with 3 vectors calculated from my program, but without referring to the 'blockMeshDict' file.

Details as below:

To generate a simple cubic blockmesh with all its vertices' positions: 8 vertices in total, which can be derived from two vectors, like (0,0,0) and (1,1,1).
The third vector, like (20,20,20) , represent the number of grids in each coordinate.

NO boundaries and patches are defined, neither the other mesh settings!
Cause it is just used for visualization.

To sum up, use 3 vectors to generate a very simple mesh in a program, without reading the 'blockMeshDict' file, and without using the 'blockMesh' utility (but may use it in another form, i am not sure about it...).

I've got these 3 vectors in my program, but they are case-dependent, it is cumbersome to edit the file every time....that's why I start to think it.

The mesh generated should be identity or similar to that using the 'blockMeshDict' file (as below) and 'blockMesh' utility.

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;

vertices //can be derived from two vectors (0,0,0) & (1,1,1)
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 1)
(1 0 1)
(1 1 1)
(0 1 1)
);

blocks //the third vector (20 20 20) is necessary
(
hex (0 1 2 3 4 5 6 7) (20 20 20) simpleGrading (1 1 1)
);

boundary //no defined boundary & patch, just for visualization
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

How to create the mesh with 3 known vectors within a program?
Should I generate a 'dictionary' object manually without IO, then use it for mesh generation? I am confused about it...


Any answer is welcomed,
thanks in advance!

Jieren

yambanshee July 9, 2019 03:44

Quote:

Originally Posted by Jieren (Post 738379)
Dear foamers,

I want to generate a new mesh (like a simple cubic one) with 3 vectors calculated from my program, but without referring to the 'blockMeshDict' file.

Details as below:

To generate a simple cubic blockmesh with all its vertices' positions: 8 vertices in total, which can be derived from two vectors, like (0,0,0) and (1,1,1).
The third vector, like (20,20,20) , represent the number of grids in each coordinate.

NO boundaries and patches are defined, neither the other mesh settings!
Cause it is just used for visualization.

To sum up, use 3 vectors to generate a very simple mesh in a program, without reading the 'blockMeshDict' file, and without using the 'blockMesh' utility (but may use it in another form, i am not sure about it...).

I've got these 3 vectors in my program, but they are case-dependent, it is cumbersome to edit the file every time....that's why I start to think it.

The mesh generated should be identity or similar to that using the 'blockMeshDict' file (as below) and 'blockMesh' utility.

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 1;

vertices //can be derived from two vectors (0,0,0) & (1,1,1)
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 1)
(1 0 1)
(1 1 1)
(0 1 1)
);

blocks //the third vector (20 20 20) is necessary
(
hex (0 1 2 3 4 5 6 7) (20 20 20) simpleGrading (1 1 1)
);

boundary //no defined boundary & patch, just for visualization
(
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

How to create the mesh with 3 known vectors within a program?
Should I generate a 'dictionary' object manually without IO, then use it for mesh generation? I am confused about it...


Any answer is welcomed,
thanks in advance!

Jieren

I would make the dictionary with your own script. I currently have a python script that creates my blockMeshDict for me, and then simply runs the blockMesh program


All times are GMT -4. The time now is 08:05.