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

 July 28, 2012, 03:23 Defining convergent center-oriented gravity field! please Help me #1 Senior Member     Mostafa Mahmoudi Join Date: Jan 2012 Posts: 322 Rep Power: 9 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 06:48.

 July 28, 2012, 05:54 #2 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,240 Blog Entries: 1 Rep Power: 18 what is "convergent gravity field"?

July 28, 2012, 06:41
#3
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by nimasam 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
 gravity.bmp (57.5 KB, 18 views)

 July 28, 2012, 08:00 #4 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,240 Blog Entries: 1 Rep Power: 18 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"

July 28, 2012, 08:14
#5
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by nimasam 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.

 July 29, 2012, 01:07 #6 Senior Member     A_R Join Date: Jun 2009 Posts: 120 Rep Power: 10 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.

July 29, 2012, 02:03
#7
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by niaz 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

July 29, 2012, 06:24
#8
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by niaz 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.

thank you

 July 29, 2012, 07:21 #9 Senior Member     A_R Join Date: Jun 2009 Posts: 120 Rep Power: 10 Dear mahmoud do you use blockmesh. if yes, send me your case to describe you

July 29, 2012, 10:39
#10
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by niaz 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

 July 29, 2012, 11:33 #11 Senior Member     A_R Join Date: Jun 2009 Posts: 120 Rep Power: 10 if you can please show it in the site for better understanding

July 29, 2012, 13:08
#12
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by niaz 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
 mantleC.png (42.6 KB, 10 views)

 July 29, 2012, 14:45 #13 Senior Member     A_R Join Date: Jun 2009 Posts: 120 Rep Power: 10 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

July 29, 2012, 15:04
#14
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by niaz 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

 July 29, 2012, 18:22 #15 Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 10,123 Blog Entries: 39 Rep Power: 110 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 __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide What am I doing/planning: blog/wiki Read this before sending me PM

July 30, 2012, 02:51
#16
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by wyldckat 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!

 July 30, 2012, 03:23 #17 Senior Member     A_R Join Date: Jun 2009 Posts: 120 Rep Power: 10 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.

July 30, 2012, 04:53
#18
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by niaz 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

 July 30, 2012, 05:33 #19 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,240 Blog Entries: 1 Rep Power: 18 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

July 30, 2012, 05:44
#20
Senior Member

Mostafa Mahmoudi
Join Date: Jan 2012
Posts: 322
Rep Power: 9
Quote:
 Originally Posted by nimasam 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!!!!!

 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 alessio.nz OpenFOAM 6 December 23, 2015 15:27 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 eelcovv OpenFOAM 0 June 8, 2010 11:35 taranov OpenFOAM Bugs 2 April 20, 2010 04:51 matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51

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