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

Defining convergent gravity field! please Help me

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2012, 04:23
Default Defining convergent center-oriented gravity field! please Help me
  #1
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Hi everybody,
any one know how can I define a convergent (center-oriented) gravity field in OF? I have a sphere that have a convergent gravity field.

Thank you

Last edited by adambarfi; July 28, 2012 at 07:48.
adambarfi is offline   Reply With Quote

Old   July 28, 2012, 06:54
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
what is "convergent gravity field"?
nimasam is offline   Reply With Quote

Old   July 28, 2012, 07:41
Default
  #3
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by nimasam View Post
what is "convergent gravity field"?
Hi Nima,

Assume we want to solve convection heat transfer in a spherical body that it has a gravity field. for example the earth, the earth gravity vectors are perpendicular to the surface and they are intersecting each other at the center of sphere(earth- a center-oriented field).

Do you know how can I define such gravity field that varies with radius of sphere?

Thank you
Attached Images
File Type: bmp gravity.bmp (57.5 KB, 19 views)
adambarfi is offline   Reply With Quote

Old   July 28, 2012, 09:00
Default
  #4
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
it is possible with some pieces of coding:
i have an idea, instead of using a dimensionVector "g" , define a VolVectorField "g"
then, using funkySetField or setField utility to define a non-uniform "g"
nimasam is offline   Reply With Quote

Old   July 28, 2012, 09:14
Default
  #5
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by nimasam View Post
it is possible with some pieces of coding:
i have an idea, instead of using a dimensionVector "g" , define a VolVectorField "g"
then, using funkySetField or setField utility to define a non-uniform "g"
thank you, Nima

I will test it.
adambarfi is offline   Reply With Quote

Old   July 29, 2012, 02:07
Default
  #6
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17
niaz is on a distinguished road
Dear adam
it seems that your field is constant over time.
the simplest way is to look how the points are written in constant/points. then write a code with a programming language to create a non uniform distribution.
niaz is offline   Reply With Quote

Old   July 29, 2012, 03:03
Default
  #7
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by niaz View Post
Dear adam
it seems that your field is constant over time.
the simplest way is to look how the points are written in constant/points. then write a code with a programming language to create a non uniform distribution.
hi Niaz,
just now I'm trying!!!!!!!!

thank you
adambarfi is offline   Reply With Quote

Old   July 29, 2012, 07:24
Default
  #8
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by niaz View Post
Dear adam
it seems that your field is constant over time.
the simplest way is to look how the points are written in constant/points. then write a code with a programming language to create a non uniform distribution.
hi,
I try but I couldn't do it, I never did it before and I'm pretty a new user of OF.

can you give me more information about defining this field or an example?

thank you
adambarfi is offline   Reply With Quote

Old   July 29, 2012, 08:21
Default
  #9
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17
niaz is on a distinguished road
Dear mahmoud
do you use blockmesh. if yes, send me your case to describe you
niaz is offline   Reply With Quote

Old   July 29, 2012, 11:39
Default
  #10
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by niaz View Post
Dear mahmoud
do you use blockmesh. if yes, send me your case to describe you
Dear Niaz,

No, I create it with Gambit (.msh) and I've used fluent3DMeshToFoam. have you any idea???

Thank you
Mostafa Mahmoudi
adambarfi is offline   Reply With Quote

Old   July 29, 2012, 12:33
Default
  #11
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17
niaz is on a distinguished road
if you can please show it in the site for better understanding
niaz is offline   Reply With Quote

Old   July 29, 2012, 14:08
Default
  #12
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by niaz View Post
if you can please show it in the site for better understanding
its file size is about 19Mb. so I attach you a picture.
it is similar to the earth, it has a hot core and its surface is at ambient temperature. assume that the mantle of earth is a fluid. I want to solve the convection in mantle.

Thank you niaz
Mostafa Mahmoudi
Attached Images
File Type: png mantleC.png (42.6 KB, 10 views)
adambarfi is offline   Reply With Quote

Old   July 29, 2012, 15:45
Default
  #13
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17
niaz is on a distinguished road
Dear adam
if you set your center to (0 0 0) you can use your point for creating the fields.
you should define a vector field then use your points to calculate the vector.
gfield=g*(x/R*i+y/R*j+z/R*k)
R=(x2+y2+z2)^1/2
niaz is offline   Reply With Quote

Old   July 29, 2012, 16:04
Default
  #14
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by niaz View Post
Dear adam
if you set your center to (0 0 0) you can use your point for creating the fields.
you should define a vector field then use your points to calculate the vector.
gfield=g*(x/R*i+y/R*j+z/R*k)
R=(x2+y2+z2)^1/2
thank you niaz for your replies,
Where should I define this field? I never do anything such it before. do I apply it to g file in constant directory? please explain it for me with more details. how can I calculating the vector by using points? at least I have 1 million points.
a new problem is that my gravity is varying with depth!!!! it means that the gravity at 0.5R isn't equal to gravity at R!!!! What should I do????

again thank you niaz
adambarfi is offline   Reply With Quote

Old   July 29, 2012, 19:22
Default
  #15
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

This isn't the first time I see someone asking about changing how gravity works in OpenFOAM. But after a quick search, I only found this to be relevant: http://www.cfd-online.com/Forums/ope...tml#post360969 post #23
That particular post has an implementation that might be a good source of information or at least idea on how to do what you're looking for.

Good luck!
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   July 30, 2012, 03:51
Default
  #16
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by wyldckat View Post
Greetings to all!

This isn't the first time I see someone asking about changing how gravity works in OpenFOAM. But after a quick search, I only found this to be relevant: http://www.cfd-online.com/Forums/ope...tml#post360969 post #23
That particular post has an implementation that might be a good source of information or at least idea on how to do what you're looking for.

Good luck!
Bruno
Thank you wyldckat,

that was great, I got many ideas from it!
all of posts were about time dependence of gravity, but my problem is varying it with depth. it is independent of time. how can I apply it? of course, after defining my gravity pattern!!!! because I have problems in defining a center-oriented gravity field yet!
adambarfi is offline   Reply With Quote

Old   July 30, 2012, 04:23
Default
  #17
Senior Member
 
niaz's Avatar
 
A_R
Join Date: Jun 2009
Posts: 122
Rep Power: 17
niaz is on a distinguished road
Dear adam
please look at your points in constant folder. your points are written in the form of (x y z).
you need to drive a unit vector which I discuss in last post.
niaz is offline   Reply With Quote

Old   July 30, 2012, 05:53
Default
  #18
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by niaz View Post
Dear adam
please look at your points in constant folder. your points are written in the form of (x y z).
you need to drive a unit vector which I discuss in last post.
hi niaz,

this is a portion of points file:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       vectorField;
    location    "constant/polyMesh";
    object      points;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


43003
(
(-0.01847759065 0.007653668647 0)
(-0.01779042759 0.007552721936 0.005143644393)
(-0.01960468925 0.003159255628 0.002382281129)
(0.007679387991 -0.006329673946 -0.01734826296)
(0.01688526706 -0.01020474922 0.003278848865)
(-0.01834319804 0.002810689581 0.007458358384)
(-0.01584939034 0.006818828176 0.01011436642)
(-0.01460689264 0.01135644457 0.007594067049)
(-0.01592745136 0.01184211524 0.002465887277)
(-0.01597723029 0.01167792986 -0.002890340183)
(-0.01295887432 0.01522695429 -0.0004554552274)
(-0.01220887115 0.01514557064 0.004642752982)
(-0.01213174065 0.01012345964 0.01226117587)
(-0.01034525646 0.01425080084 0.009481051856)
(-0.01950515249 0.003259328014 -0.00298760896)
(-0.01772160189 0.007511999119 -0.005432742923)
(-0.01591634427 0.001975366477 0.01194855273)
(-0.01287687011 0.005423605639 0.01430981195)
(-0.01940682589 -0.001585931407 0.004567267278)
(-0.01994415536 -0.00137345384 -0.0005867635026)
(-0.01762641938 -0.001868149175 0.009263873847)
(-0.009026652487 0.01777835472 0.001565135287)
(-0.007606758639 0.01740382727 0.006264504705)
(-0.00769419341 0.01248809659 0.01359583875)
(-0.005493030072 0.01606271423 0.01057430056)
(-0.008817764601 0.008133616155 0.01600285336)
(-0.01261059616 0.0005972273644 0.01551180788)
(-0.009091657511 0.003292598427 0.01750715737)
(-0.01806927596 0.003124101276 -0.007983812223)
(-0.0190956556 -0.001197339263 -0.005824286735)
(-0.01901153672 -0.005970452141 0.001707387688)
(-0.01888850544 -0.005639026881 -0.003380197942)
(-0.01249883992 0.01462668367 -0.005462520073)
.
.
.
.
my problem is how can I do it? how can I establish a relation between g and this points?

thank you
adambarfi is offline   Reply With Quote

Old   July 30, 2012, 06:33
Default
  #19
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
hi dear adam
as my friend niaz told you before, you need a unit vector.
unit vector can be find like that:
(r-r0)/|r-r0|
which r is the position vector in each point and r0 is the position vector of your center,
as i before said i guess you should define a volVectorField instead of dimensionedVector (Burno post give you the idea how to implement it), then you can define easily such a function with funkySetFields or groovyBC
nimasam is offline   Reply With Quote

Old   July 30, 2012, 06:44
Default
  #20
Senior Member
 
adambarfi's Avatar
 
Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 15
adambarfi is on a distinguished road
Send a message via Yahoo to adambarfi Send a message via Skype™ to adambarfi
Quote:
Originally Posted by nimasam View Post
hi dear adam
as my friend niaz told you before, you need a unit vector.
unit vector can be find like that:
(r-r0)/|r-r0|
which r is the position vector in each point and r0 is the position vector of your center,
as i before said i guess you should define a volVectorField instead of dimensionedVector (Burno post give you the idea how to implement it), then you can define easily such a function with funkySetFields or groovyBC
thank you Nima,

I hope that I can do it. I will be here soon!!!!!
adambarfi is offline   Reply With Quote

Reply


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
problems after decomposing for running alessio.nz OpenFOAM 7 March 5, 2021 05:49
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Turbulence dampening due to magnetic field in LES and RAS eelcovv OpenFOAM 0 June 8, 2010 12:35
Zero size field taranov OpenFOAM Bugs 2 April 20, 2010 05:51
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51


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