CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   How to use setField to create sphere (http://www.cfd-online.com/Forums/openfoam-pre-processing/62049-how-use-setfield-create-sphere.html)

sega April 25, 2008 09:27

Hallo World. I'm trying to
 
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?

gschaider April 25, 2008 09:46

Beware: Advertising of own stu
 
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

mkraposhin April 25, 2008 10:05

Hi, Sebastian, you can do t
 
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!

sega April 30, 2008 04:38

Which one may be the easier wa
 
Which one may be the easier way?

jaswi April 30, 2008 05:04

Hi Sebastian As far as I u
 
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.

http://www.cfd-online.com/OpenFOAM_D...ges/1/7511.jpg

With Regards
Jaswinder

sega April 30, 2008 05:43

Sending me the code would be g
 
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.

jaswi April 30, 2008 05:51

Hi Sebastian This is just
 
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

gschaider April 30, 2008 06:49

Hi! The most recent version
 
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

sega April 30, 2008 07:03

I have seen the file, but what
 
I have seen the file, but what is subversion?
I'm not yet familiar with the Linux environment..

sega April 30, 2008 12:00

Ok, after installing subversio
 
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?

msrinath80 April 30, 2008 13:57

Nothing is wrong. It compiled
 
Nothing is wrong. It compiled fine. Those are just warnings NOT errors.

msrinath80 April 30, 2008 13:59

oops, what are those segfault
 
oops, what are those segfault messages doing up there? Did you follow the instructions correctly?

msrinath80 April 30, 2008 14:04

Try this: Go into the folde
 
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.

sega April 30, 2008 15:01

I don't know but it looks like
 
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?

msrinath80 April 30, 2008 15:13

Try a simple test case and see
 
Try a simple test case and see. In any case I would not be too reassured with those segfault messages in there.

carlodean July 2, 2008 10:08

Hi everybody, I had problems
 
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

gschaider July 2, 2008 11:19

Hi Carlo! You mean you're u
 
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

carlodean July 2, 2008 11:21

Yes I used ./insertGenerated a
 
Yes I used ./insertGenerated and I got the file with svn (from the Wiki page.

carlo

ash July 2, 2008 11:47

Hi, Carlo... I have
 
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... http://www.cfd-online.com/OpenFOAM_D...part/happy.gif

nammari July 25, 2008 08:29

Hi, I was wondering if you
 
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


All times are GMT -4. The time now is 14:01.