CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Assigning values to a cartesian grid from a binary image (or stl)

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ngj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2014, 17:06
Cool Assigning values to a cartesian grid from a binary image (or stl)
  #1
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Dear all,

I stuck with the problem of assigning value to a field (let's call it alpha).

Let's say I have a very fine cartesian grid generated with blockMesh and that I want to assign value to a field alpha defined on this grid in order to match the binary image shown below. The cells in the black region will have the value 1 and the cells in the white region will have the value alpha=0.

I have a .stl file of this file and I am able to generate a grid with snappyHexMesh for either the black region. Then with mapField I can assign the value I want for alpha. However, the workflow is a little far-fetched.

Do you think of a more direct way to assign this value? Using snappyHexMesh and this *.stl file to assign values to my field alpha defined on a cartesian grid ?

Any ideas will be strongly appreciated.

Cheers,
Cyp

Cyp is offline   Reply With Quote

Old   August 5, 2014, 18:02
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Cyp,

I cannot check right here, but at least there is an option called surfaceToCellSet in some OF-version. In the more recent ones, I would expect that you can find it in connection with topoSet.

Note, that when using surfaceToCellSrt you define a stl-surface and a number of points. These are either inside or outside of the STL (additional flags), but the important thing is that you will probably need a lot of points, because the STL is by no means convex.

You might even be able to use surfaceToCell directly inside setField?


Good luck,

Niels
Cyp likes this.
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj 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
Simulating square cylinder using cartesian grid? zonexo Main CFD Forum 5 October 10, 2005 08:12
cartesian grid generation method Abu Taleb Main CFD Forum 7 April 14, 2001 09:49
Cartesian grid generation method Abu Taleb Main CFD Forum 0 April 8, 2001 12:15
Cartesian grid generation method Abu Taleb Main CFD Forum 0 April 8, 2001 12:03
Grid Independent Solution Chuck Leakeas Main CFD Forum 2 May 26, 2000 11:18


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