CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

modify gravity

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By pakk
  • 1 Post By silent2608

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2013, 03:11
Default modify gravity
  #1
New Member
 
Sumit Tambe
Join Date: Feb 2013
Posts: 8
Rep Power: 13
Tamsu is on a distinguished road
I want to define x component of gravity as a sinusoidal function of time, how to do it?
Any UDF? what is Journal file and how do i use it here?
Or is there any way by which I can modify body force term in N-S equations?
Tamsu is offline   Reply With Quote

Old   April 2, 2013, 03:25
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by Tamsu View Post
I want to define x component of gravity as a sinusoidal function of time, how to do it?
Any UDF? what is Journal file and how do i use it here?
Or is there any way by which I can modify body force term in N-S equations?
You can use DEFINE_SOURCE to add your gravity momentum source(N/m3) into x momentum equation.
gearboy is offline   Reply With Quote

Old   April 2, 2013, 03:38
Default
  #3
New Member
 
Sumit Tambe
Join Date: Feb 2013
Posts: 8
Rep Power: 13
Tamsu is on a distinguished road
[QUOTE=gearboy;417743]You can use DEFINE_SOURCE to add your gravity momentum source(N/m3) into x momentum equation.

Thanx a lot, got it. used CURRENT_TIME as time variable. UDF Manual also helped.

Last edited by Tamsu; April 2, 2013 at 06:40.
Tamsu is offline   Reply With Quote

Old   November 5, 2014, 06:27
Default
  #4
New Member
 
Join Date: Sep 2014
Posts: 3
Rep Power: 12
nspal1312 is on a distinguished road
I am facing same problem...
Can u tell me steps to follow?
Plz mail me udf for this
nirajpaliwal1312@gmail.com
nspal1312 is offline   Reply With Quote

Old   November 5, 2014, 06:40
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Quote:
Originally Posted by nspal1312 View Post
I am facing same problem...
Can u tell me steps to follow?
You can use DEFINE_SOURCE to add your gravity momentum source(N/m3) into x momentum equation.
Use CURRENT_TIME as time variable. UDF Manual can also help.
Quote:
Plz mail me udf for this
nirajpaliwal1312@gmail.com
This will of course never happen. You can get help on writing your udf here, but I don't think a stranger will do all the work for you and mail it to you. I'd be surprised if these requests on message boards ever work.
stuart23 and Sun like this.
pakk is offline   Reply With Quote

Old   November 6, 2014, 07:36
Default
  #6
Senior Member
 
Stuart Buckingham
Join Date: May 2010
Location: United Kingdom
Posts: 267
Rep Power: 26
stuart23 will become famous soon enoughstuart23 will become famous soon enough
Quote:
Originally Posted by pakk View Post
This will of course never happen. You can get help on writing your udf here, but I don't think a stranger will do all the work for you and mail it to you. I'd be surprised if these requests on message boards ever work.
Quote Of The Day
stuart23 is offline   Reply With Quote

Old   January 30, 2016, 14:00
Default
  #7
New Member
 
Join Date: Nov 2015
Posts: 17
Rep Power: 11
silent2608 is on a distinguished road
This thread is pretty old but since I found it through google I think others will, too.

I'm a Fluent / UDF beginner myself, but the following works for me. I verified results with manually using gravity in Fluent GUI. It works perfectly in my vof 2phase case. My UDF has a little bit different purpose but it's easy to adjust. Interpret UDF like always, go to cell zone conditions, select "Source Terms" and add it as x/y/z momentum however you like.

Code:
#include "udf.h"
DEFINE_SOURCE(gravity_source,c,t,dS,eqn)
{
real gravity;
real source;
real flow_time = RP_Get_Real("flow-time");

    if (flow_time < 0.1)
    {    
        gravity = 0.;
    }
    else
    {
        gravity = 9.81;
    }

/* gravity*cr(ct) is gravity*density = N/m³ = specific weight = F(g) on a unit of volume of a fluid */
source = gravity*C_R(c,t);
return source;
}
In my case it simply activates gravity in +x direction after 0.1s flow time. If you need varying gravity just use a function for gravity instead of a constant. For example remove if / else and use flow_time in sine function for gravity.
BlnPhoenix likes this.
silent2608 is offline   Reply With Quote

Old   August 21, 2017, 03:02
Default
  #8
New Member
 
Jayanta Barman
Join Date: Aug 2017
Posts: 1
Rep Power: 0
jbarman013 is on a distinguished road
Quote:
Originally Posted by silent2608 View Post
This thread is pretty old but since I found it through google I think others will, too.

I'm a Fluent / UDF beginner myself, but the following works for me. I verified results with manually using gravity in Fluent GUI. It works perfectly in my vof 2phase case. My UDF has a little bit different purpose but it's easy to adjust. Interpret UDF like always, go to cell zone conditions, select "Source Terms" and add it as x/y/z momentum however you like.

Code:
#include "udf.h"
DEFINE_SOURCE(gravity_source,c,t,dS,eqn)
{
real gravity;
real source;
real flow_time = RP_Get_Real("flow-time");

    if (flow_time < 0.1)
    {    
        gravity = 0.;
    }
    else
    {
        gravity = 9.81;
    }

/* gravity*cr(ct) is gravity*density = N/m³ = specific weight = F(g) on a unit of volume of a fluid */
source = gravity*C_R(c,t);
return source;
}
In my case it simply activates gravity in +x direction after 0.1s flow time. If you need varying gravity just use a function for gravity instead of a constant. For example remove if / else and use flow_time in sine function for gravity.
Hey, this didn't work for me. It shows an error that flow_time is an undeclared variable. Could you help me with that please?
jbarman013 is offline   Reply With Quote

Reply

Tags
body force, gravity, udf


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
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 07:09
UDF to modify gravity via M_gravity[ND_ND] or DEFINE_ADJUST jpo Fluent UDF and Scheme Programming 19 March 20, 2020 15:34
Modify gravity Tamsu FLUENT 0 April 2, 2013 03:08
UDF to modify gravity vector ? jpo Fluent UDF and Scheme Programming 3 January 24, 2012 10:10
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


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