CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[blockMesh] create a mesh without reading from dictionary file

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By yambanshee

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 8, 2019, 23:40
Lightbulb create a mesh without reading from dictionary file
  #1
New Member
 
Jie Ren
Join Date: Jun 2019
Posts: 2
Rep Power: 0
Jieren is on a distinguished road
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
Jieren is offline   Reply With Quote

Old   July 9, 2019, 03:44
Default
  #2
Senior Member
 
Zander Meiring
Join Date: Jul 2018
Posts: 125
Rep Power: 7
yambanshee is on a distinguished road
Quote:
Originally Posted by Jieren View Post
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
Jieren likes this.
yambanshee is offline   Reply With Quote

Reply

Tags
mesh adaption, mesh generation


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
[swak4Foam] swak4foam for OpenFOAM 4.0 mnikku OpenFOAM Community Contributions 80 May 17, 2022 08:06
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 08:46
SimpleFoam cannot open include file Marija OpenFOAM Running, Solving & CFD 1 October 28, 2020 10:35
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59


All times are GMT -4. The time now is 19:16.