How to use setField to create sphere

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

 July 25, 2008, 09:38 Hi For that purpose I recom #21 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,641 Rep Power: 25 Hi For that purpose I recommend that you look into funkySetField. At the present it is not ready for the 1.5 version, thus you need to apply it in 1.4.1. If you by a cylinder mean a circle in 2D, then you could turn off gravity and let viscosity do the job. Best regards, Niels __________________ Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.

 July 25, 2008, 14:12 Hi Thanks for the reply. If I #22 New Member   Diauddin Nammari Join Date: Mar 2009 Posts: 8 Rep Power: 8 Hi Thanks for the reply. If I don't want to use 1.4.1, I just installed 1.5 and just got it working Instead of going back is it possible to read the location of a cell at position ( x,y,z )and "update" the value of gamma from 0 to 1. I found after reading around in the discussion "mesh.findCell(x,y,z)" that would give me the ID of the cell, how do I use that cell location update its value.( I guess I can do write some primitive code that makes a cylinder of fluid). Best regard and have a good weekend D

 July 25, 2008, 15:03 Hi D Well, then you would p #23 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,641 Rep Power: 25 Hi D Well, then you would probably be able to do something like this: gamma[mesh.findCell(x,y,z)] = 1; assumed that (x,y,z) is with in the cylinder. But say that the cylinder is placed along the z-axis, then wouldn't something like this do the trick!?! scalar xC(0.0), yC(0.0); // Center values of for the cross section. forAll(gamma,gI) { if (sqr(mesh.C()[gI].component(0) - xC) + sqr(mesh.C()[gI].component(1) - yC) <= sqr(radius)) { gamma[gI] = 1; } } Simply put this before the time loop and initialize gamma to zero in /0/gamma. This is primitive but it would work and basicly do the same as funkySetField. / Niels __________________ Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.

 July 28, 2008, 03:19 Thanks very much Niels..hope y #24 New Member   Diauddin Nammari Join Date: Mar 2009 Posts: 8 Rep Power: 8 Thanks very much Niels..hope you had a good week That works wonderfully !

 September 10, 2009, 22:01 #25 Senior Member   J. Cai Join Date: Apr 2009 Posts: 180 Rep Power: 8 Hi, dear Nammari, how about your progress on making a cylinder fluid? I am interested in this point. Thanks in advance. best regards, Chiven

 March 10, 2011, 14:45 It has been ages #26 New Member   Diauddin Nammari Join Date: Mar 2009 Posts: 8 Rep Power: 8 Chiven, It worked well and I have managed to change it to make the problem a little more intresting, now I am trying to create "empty" tanks using snappyhexmesh, but not succsesful at all D

April 13, 2011, 09:54
#27
New Member

agr
Join Date: Apr 2011
Posts: 2
Rep Power: 0
Quote:
Thanks, Bernard, for the nice and promising utility.

Dear Bernard and All,

But I still cannot get - should one use funkySetFields instead of setFields or after?

I just placed your demo funkySetFields Dictionary in my case/system directory and run the funkySetFields utility. It returned me the error:
FOAM FATAL ERROR:
funkySetFields: time/latestTime option is required
What does that mean?

Regards,
Gallyam

April 14, 2011, 03:41
#28
Senior Member

Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
Hi Gallyam,

Quote:
 I just placed your demo funkySetFields Dictionary in my case/system directory and run the funkySetFields utility. It returned me the error: FOAM FATAL ERROR: funkySetFields: time/latestTime option is required What does that mean?
This means that funkySetFields wants to know where to write the new fields, i.e. in which time directory. If you just want to plug it into your 0 directory, use
Code:
`funkySetFields -time 0`
Quote:
 But I still cannot get - should one use funkySetFields instead of setFields or after?
Depends on what you want to do. If you just need funkySetFields to set a field according to an algorithm, e.g. as fuction of some coordinate, then funkySetFields is enough.
__________________
Regards, Gijs

 April 14, 2011, 05:04 #29 New Member   agr Join Date: Apr 2011 Posts: 2 Rep Power: 0 Hello, Gijsbert! Thanks a lot for your reply! Now it works. Regards, Gallyam

 October 29, 2011, 16:42 #30 Member   Jason Eason Join Date: Jan 2010 Location: Portage, Michigan Posts: 45 Rep Power: 7 I want to create a sphere using funkysetfields, but I'm not having any success. Could anyone show me the proper code to accomplish my goal? __________________ Debian Squeeze - OpenFOAM-2.1.x, Paraview-3.12.0

October 29, 2011, 18:47
#31
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by JulytoNovember I want to create a sphere using funkysetfields, but I'm not having any success. Could anyone show me the proper code to accomplish my goal?
funkySetFields -create -field test -time 0 -expression "mag(pos()-vector(1,0,0))<2 ? 1 : 0"

.... for instance

 November 1, 2011, 19:35 #32 Member   Jason Eason Join Date: Jan 2010 Location: Portage, Michigan Posts: 45 Rep Power: 7 Thank you for your help, sorry it took so long for me to respond. Could you better help me understand the vector component of that expression? I'm not certain what purpose the vector(1,0,0) serves. __________________ Debian Squeeze - OpenFOAM-2.1.x, Paraview-3.12.0

November 2, 2011, 13:26
#33
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
Quote:
 Originally Posted by JulytoNovember Thank you for your help, sorry it took so long for me to respond. Could you better help me understand the vector component of that expression? I'm not certain what purpose the vector(1,0,0) serves.
The purpose is to show how to do it in a general way (with a center of the sphere that is not the origin of the coordinate system). WHERE the center is in this concrete example is left as an exercise to the reader.

 November 3, 2011, 09:11 #34 Member   Duong A. Hoang Join Date: Apr 2009 Location: Delft, Netherlands Posts: 92 Rep Power: 8 Hi Sebastian, You can do that easily with setFields like 18 defaultFieldValues 19 ( 20 volScalarFieldValue alpha1 0 21 ); 22 23 regions 24 ( 25 sphereToCell 26 { 27 centre (0.05 0.1 0.5); 28 radius 0.01; 29 fieldValues 30 ( 31 volScalarFieldValue alpha1 1 32 ); 33 } 34 ); cheers, Duong krishtej23 likes this.

 February 17, 2012, 08:49 rising bubble #35 New Member   navid Join Date: Feb 2012 Posts: 3 Rep Power: 5 Hi Jaswi and Sebastian, i followed your posts about using funkysetfield for rising bubble case, may i ask for Jaswi code? i want to simulate rising bubble and investigate terminal velocity like u (Sebastain). i am confuse with using setfield too. thanks in advance

February 20, 2012, 04:39
#36
New Member

anonymous
Join Date: Apr 2010
Posts: 14
Rep Power: 7
Quote:
 Originally Posted by jaswi Hi Sebastian As far as I understand you are using interFoam and you want to initialize the gamma field with a spherical bubble. If that is the case then funkySetFields is the best choice as it allows you to do that in a very simple way. Let me know if you still trying to do that as I can send you the code (courtesy Bernhard) which compiles with the 1.4.1 version. With Regards Jaswinder
Can you send me the input files and the grid files shown in that picture? My email address:shenchao.sx@gmail.com
Thank you!

February 9, 2013, 13:19
#37
Member

Guifan Li
Join Date: Apr 2011
Location: New York City, U.S.
Posts: 96
Rep Power: 6
Quote:
 Originally Posted by shchao Can you send me the input files and the grid files shown in that picture? My email address:shenchao.sx@gmail.com Thank you!
Dear shchao,

How is going with your bubble rising from the water. I am currently working on the same thing, however, I am not able to figure out how to design a 3D bubble from the above picture given. Just wondering does someone has sent you the code for that? I have figured out the 2D model but not the 3D one.

If you have the code, do you think you can send me a copy for that? my email address is liguifan@gmail.com
Appreciated!

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post harly OpenFOAM Native Meshers: blockMesh 7 November 6, 2013 17:28 joakim OpenFOAM Bugs 17 October 30, 2009 08:18 tian OpenFOAM Pre-Processing 2 May 18, 2009 04:06 senthil FLUENT 3 June 1, 2006 05:22 tie FLUENT 0 July 5, 2005 14:29

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