CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

not able to use both snappyHexMesh and setFields utilities together

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By snak

Reply
 
LinkBack Thread Tools Display Modes
Old   May 22, 2015, 11:44
Default not able to use both snappyHexMesh and setFields utilities together
  #1
Member
 
Saideep
Join Date: Apr 2015
Location: UK, INDIA
Posts: 38
Rep Power: 2
Saideep is on a distinguished road
Hi Foamers;

Good day.
Back with some problem.

I try to use the interFOAM solver to analyse the behaviour of flow for different Ca(capillary) numbers in a homogeneous porous medium.

I created homogeneous circular pores using 'Blender' and had success in creating the required model domain. (Figure 1).

Then I try to use a setField utility to have an oil phase which is to be injected from the top of the model and I fail to create it. I end up with the same snappyHexMesh developed and the setFields values are not generated over the porous medium.

I would like to have something like in figure 2 (note don't bother about the phase names I interchange oil and air upon convenience), but with snappyhexmesh implemented onto it.

Additionally when I run setFields after running the snappyhexmesh I get the following though I have the specified file.

--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field alpha.air not found

Setting field region values
Adding cells with center within boxes 1((-0.25 7.865 -0.55) (7.85 8.125 0.55))
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field alpha.air not found



In short, I am not able to use both snappyHexMesh and setFields utilities together. Any help please!!
Attached Images
File Type: jpg PM.jpg (26.4 KB, 11 views)
File Type: jpg SF.jpg (8.7 KB, 12 views)
Saideep is offline   Reply With Quote

Old   May 22, 2015, 23:05
Default
  #2
New Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 25
Rep Power: 8
snak is on a distinguished road
Saideep,

Quote:
Originally Posted by Saideep View Post
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field alpha.air not found

Setting field region values
Adding cells with center within boxes 1((-0.25 7.865 -0.55) (7.85 8.125 0.55))
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field alpha.air not found
You need alpha.air file in a time directory.

snappyHexMesh creates a mesh. No field data.

A user prepares initial and boundary conditions.
setFields modifies field data. setFields does not create field data files.
snak is offline   Reply With Quote

Old   May 23, 2015, 05:21
Default
  #3
Member
 
Saideep
Join Date: Apr 2015
Location: UK, INDIA
Posts: 38
Rep Power: 2
Saideep is on a distinguished road
hi Sinji;
Many thanks for your reply.

Actually I do have the alpa.air file in the 0 time directory. For reference you can see the second figure posted in the first tread, where there is oil at the top.

So, what snappyhexmesh does is to mesh the required shape and creates that model domain in an other time directory in my case formed as 0.0002. Now i tried to copy all the 0(initial/ boundary condition) files into the newly created time step, but that too was not successful.

I am able to use both setFields and snappyexmes independently and when i try to use one after the other i only get the snappyhexmesh model.
Any ideas?

Saideep
Saideep is offline   Reply With Quote

Old   May 24, 2015, 07:07
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,251
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quick answer:
Code:
snappyHexMesh -overwrite
wyldckat is offline   Reply With Quote

Old   May 24, 2015, 21:01
Default
  #5
New Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 25
Rep Power: 8
snak is on a distinguished road
wyldckat,
Thank you for your quick answer,
and thank you very much for your tremendous contributions for the community.


Sideep,

If you have already checked your mesh from snappyHexMesh, you can do snappyHexMesh with overwrite option as wyldckat shown. With this option, you just get a mesh without other time directories.

If you want use the mesh you have already created with snappyHexMesh, copy files in polymesh directory of the latest time (0.0002, maybe) into constant/polyMesh. Then, delete unnecessary time directories which was made by snappyHexMesh.
wyldckat likes this.
snak is offline   Reply With Quote

Old   May 25, 2015, 07:23
Default
  #6
Member
 
Saideep
Join Date: Apr 2015
Location: UK, INDIA
Posts: 38
Rep Power: 2
Saideep is on a distinguished road
Thanks a lot Bruno and snak for your help this far!! I feel I am making some sort of progress to what I need. Always a pleasure to read and implement your suggestions.

Now as per your advise, I used the snappyHexMesh- overwrite and the data regarding the new mesh is copied to the 0 file {good so far}.

Problem 1: Within the snappyHexMesh dictionary, I include the name of my (.stl) file and name it(my case as fixedWalls).

geometry
{
lunati.stl
{
type triSurfaceMesh;
name fixedWalls;
}


But when I run the snappyHexMesh -overwrite and later the setFields I get an error related to the boundary name of the .stl stating:
"--> FOAM FATAL IO ERROR:
Cannot find patchField entry for fixedWalls".


But why do I include the .stl file name within my blockMesh.
Well, do I need to include it in my blockMesh Dict and 0 (U/p) files. In several examples I followed the name of the .stl file was never specified within their 0/ blockMeshDict files.

Problem 2: The number of cells are not equal and I can understand this as snappyHexMesh removes several cells it is not consistent anymore. I guess the correct pattern flow of using blockMesh -> snappyHexMesh -> setFields would correct this.

I would like to post my file here but the .stl file size is quite heavy even after compressing it exceeds the limit. Sorry for that!!

-Saideep
Saideep is offline   Reply With Quote

Old   May 25, 2015, 07:46
Default
  #7
New Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 25
Rep Power: 8
snak is on a distinguished road
Saideep,

Quote:
Originally Posted by Saideep View Post
Now as per your advise, I used the snappyHexMesh- overwrite and the data regarding the new mesh is copied to the 0 file {good so far}.
?

Information about the mesh is not stored in the 0 directory. It is in the constant/polyMesh directory.

You have to prepare files in the 0 directory. You have to write down your boundary conditions in files in the 0 directory. Do your files have fixedWalls entry for boundary condition?

Starting with small and simple example is good practice. You would grasp what you did and what you get easily. and you can share case files.
snak is offline   Reply With Quote

Old   May 25, 2015, 07:58
Default
  #8
Member
 
Saideep
Join Date: Apr 2015
Location: UK, INDIA
Posts: 38
Rep Power: 2
Saideep is on a distinguished road
Thanks a lot Bruno and Snak.

Well I finally succeed after a long fight. Actually the missing things and procedure mentioned in the above post were the cause for the delay in success. At last correction of the above 2 problems gave me what I required.

Just attached the final image. Will get back to you guys soon!!!

Another small comment seeing this post:
If you use the snappyHexMesh -overwrite, and by any chance you need to re run the snappyhexmesh it gives an error. Just go back to the polyMesh file and delete all dictionaries except the required 'blockMeshDict'. {saves some time!!}

-Saideep
Attached Images
File Type: jpg finalPIC.jpg (18.6 KB, 9 views)
Saideep is offline   Reply With Quote

Old   May 29, 2015, 18:02
Default
  #9
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,251
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Quote:
Originally Posted by Saideep View Post
Just go back to the polyMesh file and delete all dictionaries except the required 'blockMeshDict'.
Quick note: Or simply run blockMesh, which will replace the existing mesh.
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
setFields after snappyHexMesh mo.houssami OpenFOAM Pre-Processing 4 May 13, 2015 11:44
Able to run snappyHexMesh in parallel on local machine but unable to run on linux clu abhinav2601 OpenFOAM Meshing & Mesh Conversion 1 January 26, 2015 06:42
Setfields inoutlet and water and air patches erik023 OpenFOAM Pre-Processing 1 September 29, 2008 10:05


All times are GMT -4. The time now is 22:21.