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

How to use setField to create sphere

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

Like Tree1Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   April 25, 2008, 09:27
Default Hallo World. I'm trying to
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Hallo World.

I'm trying to place a spherical bubble into my mesh.
I thought about doing this with setting the parameter gamma with setFields.

But I just know the command boxToCell and a bubble isn't really like a box ..

Any ideas?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 25, 2008, 09:46
Default Beware: Advertising of own stu
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Beware: Advertising of own stuff

Look on the message-board or the Wiki for a thing called funkySetFields. I think there is even an example how to set a sphere with it somewhere

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 25, 2008, 10:05
Default Hi, Sebastian, you can do t
  #3
Senior Member
 
mkraposhin's Avatar
 
Matvej Kraposhin
Join Date: Mar 2009
Location: Moscow, Russian Federation
Posts: 172
Rep Power: 8
mkraposhin is on a distinguished road
Hi, Sebastian,

you can do that with such steps:

1) Create spherical surface (for example, with Netgen)
2) Export this surface to stl-formal
3) use option surface surfaceToCell (like in cellSetDict)
4) run foamToVTK . . -cellSet <your_cell_set_name>
5) preview <your_cell_set_name> in paraview
6) Enjoy!
mkraposhin is offline   Reply With Quote

Old   April 30, 2008, 04:38
Default Which one may be the easier wa
  #4
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Which one may be the easier way?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 30, 2008, 05:04
Default Hi Sebastian As far as I u
  #5
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
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
jaswi is offline   Reply With Quote

Old   April 30, 2008, 05:43
Default Sending me the code would be g
  #6
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Sending me the code would be great.
Send it to NOSPAM.sebastian.gatzka@stud.tu-darmstadt.de

(without the NOSPAM.) :-)

Thanks a lot ...

What is your setup in the picture used for?
I would like to simulate a rising bubble to investigate it's terminal velocity.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 30, 2008, 05:51
Default Hi Sebastian This is just
  #7
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
Hi Sebastian

This is just a trial setup to see how one can initialize the bubble and use interFoam to simulate bubble rising. it lacks the proper physics setup

It would be nice if you could share your experience one you have simulated the rising bubble up to its terminal velocity.

I send you the code right now.

Let me know if it won't compile or some other help required to initialize the bubble.

With Regards
Jaswi
jaswi is offline   Reply With Quote

Old   April 30, 2008, 06:49
Default Hi! The most recent version
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi!

The most recent version of funkySetFields can be downloaded via the subversion command in the Downloads section of
http://openfoamwiki.net/index.php/Co...funkySetFields

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   April 30, 2008, 07:03
Default I have seen the file, but what
  #9
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
I have seen the file, but what is subversion?
I'm not yet familiar with the Linux environment..
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 30, 2008, 12:00
Default Ok, after installing subversio
  #10
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Ok, after installing subversion and flex (not knowing what these are exactly doing) I get this strange listing, wenn running wmake funkySetFields:

Making dependency list for source file ValueExpressionParser.yy
could not open file ValueExpressionParser.tab.hh for source file ValueExpressionParser.yy
Segmentation fault (core dumped)
Making dependency list for source file ValueExpressionLexer.ll
could not open file ValueExpressionParser.tab.hh for source file ValueExpressionLexer.ll
Segmentation fault (core dumped)
Making dependency list for source file ValueExpressionDriver.C
could not open file ValueExpressionParser.tab.hh for source file ValueExpressionDriver.C
Segmentation fault (core dumped)
Making dependency list for source file funkySetFields.C
could not open file ValueExpressionParser.tab.hh for source file funkySetFields.C
Segmentation fault (core dumped)
SOURCE=ValueExpressionParser.yy ; rm -f Make/linuxGccDPOpt/ValueExpressionParser.C Make/linuxGccDPOpt/ValueExpressionParser.tab.hh; bison -ra -v -d $SOURCE ; mv *.tab.cc Make/linuxGccDPOpt/ValueExpressionParser.C ; mv *.tab.hh Make/linuxGccDPOpt/ValueExpressionParser.tab.hh ; mv *.hh Make/linuxGccDPOpt ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c Make/linuxGccDPOpt/ValueExpressionParser.C -o Make/linuxGccDPOpt/ValueExpressionParser.o
ValueExpressionParser.tab.cc: In member function 'unsigned char ve::ValueExpressionParser::yytranslate_(int)':
ValueExpressionParser.tab.cc:1865: warning: use of old-style cast
SOURCE=ValueExpressionLexer.ll ; rm Make/linuxGccDPOpt/ValueExpressionLexer.C ; flex -f $SOURCE ; mv *.c Make/linuxGccDPOpt/ValueExpressionLexer.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c Make/linuxGccDPOpt/ValueExpressionLexer.C -o Make/linuxGccDPOpt/ValueExpressionLexer.o
rm: Entfernen von &bdquo;Make/linuxGccDPOpt/ValueExpressionLexer.C" nicht möglich: No such file or directory
lex.ve.c:340: warning: use of old-style cast
lex.ve.c:410: warning: use of old-style cast
lex.ve.c:410: warning: use of old-style cast
lex.ve.c: In function 'int velex(ve::ValueExpressionParser::semantic_type*, ve::location*, ValueExpressionDriver&)':
lex.ve.c:6854: warning: use of old-style cast
lex.ve.c:6854: warning: use of old-style cast
lex.ve.c:6871: warning: use of old-style cast
lex.ve.c:6884: warning: use of old-style cast
lex.ve.c:7224: warning: use of old-style cast
lex.ve.c: In function 'int yy_get_next_buffer()':
lex.ve.c:7403: warning: use of old-style cast
lex.ve.c:7426: warning: use of old-style cast
lex.ve.c:7439: warning: use of old-style cast
lex.ve.c:7439: warning: use of old-style cast
lex.ve.c:7460: warning: use of old-style cast
lex.ve.c:7460: warning: use of old-style cast
lex.ve.c: In function 'yy_state_type yy_get_previous_state()':
lex.ve.c:7515: warning: use of old-style cast
lex.ve.c:7515: warning: use of old-style cast
lex.ve.c: In function 'int yyinput()':
lex.ve.c:7633: warning: use of old-style cast
lex.ve.c: In function 'yy_buffer_state* ve_create_buffer(FILE*, int)':
lex.ve.c:7732: warning: use of old-style cast
lex.ve.c:7741: warning: use of old-style cast
lex.ve.c: In function 'void ve_delete_buffer(yy_buffer_state*)':
lex.ve.c:7767: warning: use of old-style cast
lex.ve.c:7770: warning: use of old-style cast
lex.ve.c:7772: warning: use of old-style cast
lex.ve.c: In function 'void veensure_buffer_stack()':
lex.ve.c:7939: warning: use of old-style cast
lex.ve.c:7957: warning: use of old-style cast
lex.ve.c: In function 'yy_buffer_state* ve_scan_buffer(char*, yy_size_t)':
lex.ve.c:7983: warning: use of old-style cast
lex.ve.c: In function 'yy_buffer_state* ve_scan_bytes(const char*, int)':
lex.ve.c:8036: warning: use of old-style cast
lex.ve.c: In function 'void yy_push_state(int)':
lex.ve.c:8072: warning: use of old-style cast
lex.ve.c:8075: warning: use of old-style cast
lex.ve.c:8075: warning: use of old-style cast
lex.ve.c: In function 'int yy_init_globals()':
lex.ve.c:8243: warning: use of old-style cast
lex.ve.c:8256: warning: use of old-style cast
lex.ve.c:8257: warning: use of old-style cast
lex.ve.c: In function 'void* vealloc(yy_size_t)':
lex.ve.c:8333: warning: use of old-style cast
lex.ve.c: In function 'void* verealloc(void*, yy_size_t)':
lex.ve.c:8345: warning: use of old-style cast
lex.ve.c:8345: warning: use of old-style cast
lex.ve.c: In function 'void vefree(void*)':
lex.ve.c:8350: warning: use of old-style cast
lex.ve.c: At global scope:
lex.ve.c:8059: warning: 'void yy_push_state(int)' defined but not used
lex.ve.c:8088: warning: 'void yy_pop_state()' defined but not used
lex.ve.c:8100: warning: 'int yy_top_state()' defined but not used
SOURCE=ValueExpressionDriver.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/ValueExpressionDriver.o
SOURCE=funkySetFields.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/funkySetFields.o
g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -IMake/linuxGccDPOpt -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/meshTools/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude -fPIC -pthread Make/linuxGccDPOpt/ValueExpressionParser.o Make/linuxGccDPOpt/ValueExpressionLexer.o Make/linuxGccDPOpt/ValueExpressionDriver.o Make/linuxGccDPOpt/funkySetFields.o -L/home/sega/OpenFOAM/OpenFOAM-1.4.1/lib/linuxGccDPOpt \
-lfiniteVolume -lmeshTools -lOpenFOAM -ldl -lm -o /home/sega/OpenFOAM/sega-1.4.1/applications/bin/linuxGccDPOpt/funkySetFields


Whats wrong with that?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 30, 2008, 13:57
Default Nothing is wrong. It compiled
  #11
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 698
Rep Power: 12
msrinath80 is on a distinguished road
Nothing is wrong. It compiled fine. Those are just warnings NOT errors.
msrinath80 is offline   Reply With Quote

Old   April 30, 2008, 13:59
Default oops, what are those segfault
  #12
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 698
Rep Power: 12
msrinath80 is on a distinguished road
oops, what are those segfault messages doing up there? Did you follow the instructions correctly?
msrinath80 is offline   Reply With Quote

Old   April 30, 2008, 14:04
Default Try this: Go into the folde
  #13
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 698
Rep Power: 12
msrinath80 is on a distinguished road
Try this:

Go into the folder that contains the file insertGenerated.sh. Then type:

./insertGenerated.sh

Then type:

cd ..

Followed by:

./Allwmake

That worked for me even though I am using Bison v 2.3.
msrinath80 is offline   Reply With Quote

Old   April 30, 2008, 15:01
Default I don't know but it looks like
  #14
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
I don't know but it looks like the tool is working.
I could run funkyFieldSets and got the error message, that two arguments are needed.

Doesn't that look like it's working?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 30, 2008, 15:13
Default Try a simple test case and see
  #15
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 698
Rep Power: 12
msrinath80 is on a distinguished road
Try a simple test case and see. In any case I would not be too reassured with those segfault messages in there.
msrinath80 is offline   Reply With Quote

Old   July 2, 2008, 10:08
Default Hi everybody, I had problems
  #16
New Member
 
Carlo De Angelis
Join Date: Mar 2009
Posts: 10
Rep Power: 8
carlodean is on a distinguished road
Hi everybody,
I had problems in installing funkysetfield on my laptop.
I made what Srinath Madhavan suggested on this forum.
But I had this error message:

from /home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/finiteVolume/lnInclude/volFields.H:38,
from ValueExpressionParser.yy:9,
from ValueExpressionParser.C:38:
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:58: error: ISO C++ forbids declaration of 'ostream' with no type
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:58: error: expected ';' before '&' token
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:64: error: ISO C++ forbids declaration of 'ostream' with no type
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:64: error: expected ';' before '&' token
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:70: error: expected `;' before 'const'
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:70: error: ISO C++ forbids declaration of 'ostream' with no type
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:70: error: expected ';' before '&' token
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:76: error: expected `;' before 'public'
/home/carlo/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/OSstream.H:83: error: expected `)' before '&' token
ValueExpressionParser.yy:328: error: expected `}' at end of input
ValueExpressionParser.yy:328: error: expected unqualified-id at end of input
ValueExpressionParser.yy:328: error: expected `}' at end of input
make: *** [Make/linuxGccDPOpt/ValueExpressionParser.o] Error 1


It is not everything because it's very long.
I don't know what's the problem 'cause I made the same things on another computer and everything worked fine.
Maybe someone could help me.
Thank you.
Carlo
carlodean is offline   Reply With Quote

Old   July 2, 2008, 11:19
Default Hi Carlo! You mean you're u
  #17
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Carlo!

You mean you're using the pre-generated files (./insertGenerated) and you'Re getting the sources from the SVN? Obviously I forgot to update the generated stuff after the last batch of changes. I updated this in the SVN

Bernhard

PS: I wasn't aware that people were still using these generated stuff
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 2, 2008, 11:21
Default Yes I used ./insertGenerated a
  #18
New Member
 
Carlo De Angelis
Join Date: Mar 2009
Posts: 10
Rep Power: 8
carlodean is on a distinguished road
Yes I used ./insertGenerated and I got the file with svn (from the Wiki page.

carlo
carlodean is offline   Reply With Quote

Old   July 2, 2008, 11:47
Default Hi, Carlo... I have
  #19
ash
New Member
 
Arun Shourie
Join Date: Mar 2009
Location: Singapore
Posts: 12
Rep Power: 8
ash is on a distinguished road
Hi, Carlo...
I have a method. Of course, this may be tough or already been implemented in other executables. I have used this method in one my test cases. This works fine. Also i miss placed that test case, some where. Try this method and its cool. At the end you will feel like you have programmed something useful.

I am sure that you have used the executable, "setShock" which is being employed in sonicFoam. Just extend it a little bit. Just get the value of the center of the sphere and radius as input. Then add the lines such that it satisfies the sphere equation when considered at that point, which is (x-a)^2 + (y-b)^2 + (z-c)^2 = r^2. Where a,b,c and r obviously the inputs given. Check the condition, if the cell center you are considering is greater than 'radius' given or not.... End of story.

Just give it a try, instead of relying on some code, which you cant understand...
ash is offline   Reply With Quote

Old   July 25, 2008, 08:29
Default Hi, I was wondering if you
  #20
New Member
 
Diauddin Nammari
Join Date: Mar 2009
Posts: 8
Rep Power: 8
nammari is on a distinguished road
Hi,

I was wondering if you could help, I'm a "newbie" to OpenFoam I have playing with it a little and would like to setup a case in which i have a circular volume of fluid and "drop" it (at the moment i am using interFoam). I managed use Setfields to create a "square" volume of fluid. How can I use Setfields to create a cylinder of fluid? or is there something else ?
Hope to hear from you soon
Ciao
D
nammari 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
Create a mesh for flow around a sphere harly OpenFOAM Native Meshers: blockMesh 7 November 6, 2013 17:28
SetField problem in OpenFoam 14 joakim OpenFOAM Bugs 17 October 30, 2009 08:18
How to use SetField tian OpenFOAM Pre-Processing 2 May 18, 2009 04:06
cd of sphere senthil FLUENT 3 June 1, 2006 05:22
Sphere tie FLUENT 0 July 5, 2005 14:29


All times are GMT -4. The time now is 12:13.