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

Options for setFields

Register Blogs Community New Posts Updated Threads Search

Like Tree16Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 26, 2011, 17:16
Default Options for setFields
  #1
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi all,

I need to define a setFieldsDict for a non-box region.

I am aware of swak4Foam and funkySetFields. However, I do not need all that sophistications. Is it possible to define parts (blocks) of the mesh for a zoneToCell instead of a boxToCell (just like the definition of porous media)? If yes, how can I do it? I need some descriptions .... like how to define the zones? (e.g. How to name the zone files?) How to add the zones in the setFieldsDict?

Best regards,
Hisham
Hisham is offline   Reply With Quote

Old   July 27, 2011, 12:13
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hisham View Post
I need to define a setFieldsDict for a non-box region.

I am aware of swak4Foam and funkySetFields. However, I do not need all that sophistications.
Well. I don't need the rasp on my pocket knife all the time, but should I ever get locked up then I don't have to ask the guard for one

But suite yourself

Quote:
Originally Posted by Hisham View Post
Is it possible to define parts (blocks) of the mesh for a zoneToCell instead of a boxToCell (just like the definition of porous media)? If yes, how can I do it? I need some descriptions .... like how to define the zones? (e.g. How to name the zone files?) How to add the zones in the setFieldsDict?
Replace "boxToCell" with a topoSetSource-name that surly doesn't exist ("Hisham" for instance). setFields will fail with a list of existing topoSetSources. Pick one that looks right for you (preferably with ToCell in the name). The next run OF will ask you for the missing parameters. With a little bit of common sense its possible to guess the meaning of those

Bernhard
gschaider is offline   Reply With Quote

Old   July 27, 2011, 15:52
Default
  #3
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Bernhard,

Thanks a lot for your response. You are great ... so as swak4Foam ..

It is just that I needed to do that thing quickly with the bread knife ...

I will use funkySetFields after all but I did not invest enough time in learning it until now and the task seemed easy enough for setFields ... But I guess it is a good chance to start learning it.

Thanks a lot for your great contributions!
I will try your idea (it seems like the way to go with OF)

Best regards,
Hisham
Hisham is offline   Reply With Quote

Old   July 27, 2011, 17:43
Default setFields zoneToCell (applications of setFields to mesh blocks)
  #4
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
I got it. I post here for future readers.

1. In the blockMeshDict, define the cellZone names for required blocks:
e.g. (from the damBreak example)

blocks
(
hex (0 1 5 4 12 13 17 16) cellZoneName (23 8 1) simpleGrading (1 1 1)
hex (2 3 7 6 14 15 19 18) (19 8 1) simpleGrading (1 1 1)
hex (4 5 9 8 16 17 21 20) (23 42 1) simpleGrading (1 1 1)
hex (5 6 10 9 17 18 22 21) cellZoneName (4 42 1) simpleGrading (1 1 1)
hex (6 7 11 10 18 19 23 22) (19 42 1) simpleGrading (1 1 1)
);


2. In the setFieldsDict,

defaultFieldValues
(
volScalarFieldValue alpha1 0
);

regions
(
zoneToCell
{
name "cellZoneName";
fieldValues
(
volScalarFieldValue alpha1 1
);
}
);
Hisham is offline   Reply With Quote

Old   September 21, 2011, 19:03
Default running the damBreak tutorial after using makeAxialMesh utility
  #5
New Member
 
Pallav Jha
Join Date: Apr 2011
Posts: 17
Rep Power: 14
Pallav is on a distinguished road
Hello Hisham and Bernhard,

I am working on a modified damBreak case (http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2007/HassanHemida/Hassan_Hemida_VOF.pdf) to study the free surface tracking.

I wanted to make the case axisymmetric; so I modified the mesh using blockMeshDict and then used setFields to assign alpha1 values.

I then used the makeAxialMesh utility, followed by collapseEdges, to make the case axisymmetric.

I also added the new patches to p_rgh, U, alpha1 files.

Then I run decomposePar. However, at this point, I get an error saying that "keyword frontAndBack_pos is not defined in 0/alpha1::boundary" (which makes sense because after I use setFields, the contents of alpha1 file change to numbers 1 or 0 )

Please let me know if you have any ideas to solve this problem.

Thanks and regards.

Pallav
Pallav is offline   Reply With Quote

Old   September 22, 2011, 00:50
Default
  #6
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Pallav,

It would be a good idea to compress your case into a single file and attach it to your post. A full copy paste of your error message (use the quote tags from the toolbar) also makes things easier. By doing that it is easier for others to give ideas on what may be wrong!

Also, starting a new post would be a good idea, in case there is no post that is not about the same problem (e.g. the same error message).

Back to your problem: Does it run without decomposePar?

Best regards,
Hisham
Hisham is offline   Reply With Quote

Old   September 22, 2011, 04:55
Default
  #7
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
I imagine you need to run the setFields after you change the mesh.... not before.
Hisham is offline   Reply With Quote

Old   September 22, 2011, 05:29
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Pallav View Post
Hello Hisham and Bernhard,

I am working on a modified damBreak case (http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2007/HassanHemida/Hassan_Hemida_VOF.pdf) to study the free surface tracking.

I wanted to make the case axisymmetric; so I modified the mesh using blockMeshDict and then used setFields to assign alpha1 values.

I then used the makeAxialMesh utility, followed by collapseEdges, to make the case axisymmetric.

I also added the new patches to p_rgh, U, alpha1 files.

Then I run decomposePar. However, at this point, I get an error saying that "keyword frontAndBack_pos is not defined in 0/alpha1::boundary" (which makes sense because after I use setFields, the contents of alpha1 file change to numbers 1 or 0 )

Please let me know if you have any ideas to solve this problem.

Thanks and regards.

Pallav
If he asks for these boundary conditions then give them to him. Either by editing them by hand or by adding a scipt like pyFoamCreateBoundaryPatches.py
gschaider is offline   Reply With Quote

Old   September 23, 2011, 01:56
Default
  #9
New Member
 
Pallav Jha
Join Date: Apr 2011
Posts: 17
Rep Power: 14
Pallav is on a distinguished road
Quote:
Originally Posted by Hisham View Post
I imagine you need to run the setFields after you change the mesh.... not before.
Thanks a lot Hisham. This did it.
Pallav is offline   Reply With Quote

Old   February 20, 2012, 11:59
Default SetFields
  #10
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
Dear friends

For the HeatTransfer->buoyantBoussinsqSimpleFoam->HotRoom problem:
I wrote

1. In the blockMeshDict:

blocks
(
hex (0 1 2 3 4 5 6 7) cellZoneName (20 20 20) simpleGrading (1 1 1)
);

2. In the setFieldsDict,

defaultFieldValues
(
volScalarFieldValue alphat 0
);

regions
(
zoneToCell
{
name "cellZoneName";
fieldValues
(
volScalarFieldValue alphat 1
);
}

But its not working, could you help me?
Goutam is offline   Reply With Quote

Old   February 20, 2012, 12:54
Default
  #11
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Goutam

It is easier to help if you post the error message generated by OF.

In the case you outlined, it is easier to assign a uniform internal field value for alphat in its file in the 0 directory (for the whole domain is a single zone)

I have introduced the editions you wrote and it worked fine. It is highly probable that you need to copy the T.org file to a T file in the 0 directory:

Code:
:~/openfoam210/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0$ cp T.org T
Best regards,
Hisham
Hisham is offline   Reply With Quote

Old   February 21, 2012, 05:34
Default
  #12
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
Dear Hisham,

Thanks for your reply. I have copied T.org to T before I run the problem. I did this. When I run setFields, I got the following massage:

FOAM Warning:

From function zoneToFace:: combine (topoSet&, const bool) in file sets/faceSources/zoneToFace/zoneToFace.C at line 86.

Cannot find any faceZone named cellZoneName

Valid names are
0
(
)
Setting patchField values of volScalarField alphat

End

What I will do, can you please help me? I am trying to solve this for the last 7 days.
Can I send you my files? I set the model for laminar instead of turbulent and I did the changes that required. Only, setFields option are not working when I use cellZoneName.
Goutam is offline   Reply With Quote

Old   February 21, 2012, 05:42
Default
  #13
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
From the error message, it seems that the problem lies in the zoneToFace assignment in the setFieldsDict.

Please zip the case up in one file and attach it to a reply!

or maybe paste the setFieldsDict file in your reply

Hisham
Hisham is offline   Reply With Quote

Old   February 21, 2012, 06:28
Default Hot Room laminar case
  #14
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
Dear Hisham

Please see the attached zip file.

Thanks

Goutam
Attached Files
File Type: zip Hot Room_laminar case.zip (10.7 KB, 110 views)
Goutam is offline   Reply With Quote

Old   February 21, 2012, 06:49
Default
  #15
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
I'm not sure what you want to do exactly. But the error is generated because you provide a zoneToCell data to a zoneToFace keyword. So you either have to change the line number 25 of the setFieldsDict to "zoneToCell" instead of "zoneToFace" or else provide valid data to the zoneToFace function
Hisham is offline   Reply With Quote

Old   February 21, 2012, 07:05
Default
  #16
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
Quote:
Originally Posted by Hisham View Post
I'm not sure what you want to do exactly. But the error is generated because you provide a zoneToCell data to a zoneToFace keyword. So you either have to change the line number 25 of the setFieldsDict to "zoneToCell" instead of "zoneToFace" or else provide valid data to the zoneToFace function
Dear Hisham,

Firstly, I want to use bouyant force for the laminar case for 3D geometry. I found that this is the nearest solver to do this. Before, I used icoFoam solver for p, U and T, but for buoyant force, its not working.

When I consider a pipe flow problem, then the setFields command is not working. I did meshing in Fluent and I use fluentMeshToFoam file.msh command. After that I checked the meshing by checkMesh command. its fine.

Regards

Goutam
Goutam is offline   Reply With Quote

Old   February 21, 2012, 07:13
Default
  #17
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
The error messages from OF are very helpful ... just read them carefully to figure out your next step

Good luck with your work
Hisham is offline   Reply With Quote

Old   February 21, 2012, 07:18
Default
  #18
Senior Member
 
Goutam Saha
Join Date: Dec 2011
Location: UK
Posts: 131
Rep Power: 14
Goutam is on a distinguished road
Quote:
Originally Posted by Hisham View Post
The error messages from OF are very helpful ... just read them carefully to figure out your next step

Good luck with your work
Dear Hisham

Thanks for your kind help.
Goutam is offline   Reply With Quote

Old   January 28, 2014, 09:37
Default Options for setFields
  #19
New Member
 
James Feng
Join Date: Dec 2013
Posts: 21
Rep Power: 12
fengjq is on a distinguished road
I like the "zoneToCell" option, better than the "boxToCell" one. Can we use the "zoneToCell" option for the wedge cells in an axisymmetric case?
fengjq is offline   Reply With Quote

Old   March 24, 2018, 21:22
Default setFields for multiple components of a phase
  #20
Member
 
Viraj Belekar
Join Date: Jun 2016
Posts: 68
Rep Power: 9
viraj20feb is on a distinguished road
Hello everyone,

I am using reactingTwoPhaseEulerFoam for two multicomponent phases analysis. I want to use interfaceCompositionPhaseChangePhaseSystem utility in OpenFOAM to take care of one of the components of a phase.

My geometry is a cylindrical vessel. I want to set the volume fraction in such a way that the bottom 45% part of the vessel contains 60% volume fraction of component A of phase 1 and 1% volume fraction of component B of phase 1 and the rest 39% in the bottom 45% fill volume of the vessel is all phase 2. The upper 55% is 100% phase 2.

What I was thinking is define the entire internal field with for the entire volume of the cylinder with 60% component A of phase 1, 1% of component B of phase 1 and 39% of phase 2. Then I am trying to use setFieldsDict for the above 55% volume to be 100% phase 2 so that it deletes the above mentioned combination for the above 55% of the vessel and replaces it entirely with phase 2.

But this doesn't work! Can anyone please help me with this?

Thanks
Viraj
viraj20feb is offline   Reply With Quote

Reply

Tags
setfields, setfieldsdict, zonetocell


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
Remeshing with User Defined Options ChristianF CFX 2 September 24, 2014 09:19
How do I select solver options for external flow over an aircraft by fluent? hadieliasi FLUENT 5 May 2, 2011 03:54
Post processing: Hard-copy save options and image quality beguxa FLUENT 3 November 10, 2010 17:41
It would be nice to have application options abbreviated! lakeat OpenFOAM Running, Solving & CFD 0 September 16, 2009 22:22
Surface tension options for VOF models chapelle FLUENT 4 September 20, 2005 03:49


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