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

how to plot new function or variable in fluent?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2014, 11:35
Default
  #21
New Member
 
Jups
Join Date: Jul 2014
Posts: 12
Rep Power: 11
Jups is on a distinguished road
Quote:
Originally Posted by Hershey View Post
Yes. Since your equation for q is the same in each source, it would be better to define it in DEFINE_ADJUST by saving the value as C_UDMI(c,t,0) = q. Then in the DEFINE_SOURCE you should just reference C_UDMI(c,t,0) instead of q.

In the DEFINE_ADJUST, there are a couple things you must do:

1. You must use begin_cell_loop(c,t) to loop through the cells for C_UDMI. Try looking at Google to fine this and an example.

2. Finally, since DEFINE_ADJUST is called at the beginning of every iteration (not time step), you will want to only calculate q for the first iteration. Look at the following link on how to do that:

http://www.cfd-online.com/Forums/flu...luent-5-a.html

thankyou Hersey,, later i will tell u how the progress..
Jups is offline   Reply With Quote

Old   July 11, 2014, 01:51
Default
  #22
New Member
 
Jups
Join Date: Jul 2014
Posts: 12
Rep Power: 11
Jups is on a distinguished road
SUN, HERSEY..
i have already try it..
i make q in DEFINE_ADJUST and i use time step 0.001..
it's work.. but the result is not what i want

Code:
#include "udf.h"
#define P 3000000
#define T 300
#define e 0.65
#define Rc 500
#define k 0.00013996
#define qe 0.0698337
double q, time, turq;


DEFINE_INIT(q_init,d)
{
cell_t c;
Thread *t;

thread_loop_c(t,d)
  {
    begin_c_loop_all(c,t)
     {
       C_T(c,t)=300;
       C_P(c,t)=100000;
       q = 0;
     }
    end_c_loop_all(c,t)
   }
}


DEFINE_ADJUST(adsorpsi,d)
{
cell_t c;
Thread *t;

thread_loop_c(t,d)
  {
    begin_c_loop_all(c,t)
     {

       time = CURRENT_TIME;
       turq = k*(qe-q);
       q = q+turq*time;

       C_UDMI(c,t,0) = q;
       C_UDMI(c,t,1) = turq;

     }
    end_c_loop_all(c,t)
   }
}



DEFINE_SOURCE(mass_source, c, t)
{
real source;

source = -((1-e)/e)*C_UDMI(c,t,1);

return source;
}



DEFINE_SOURCE(y_velocity, c, t)
{
real source;

source = -C_UDMI(c,t,1)*C_V(c,t);

return source;
}



DEFINE_SOURCE(radial_velocity, c, t)
{
real source;

source = -C_UDMI(c,t,1)*C_U(c,t);

return source;
}



DEFINE_SOURCE(energy_source, c, t)
{
real ha, source;

ha = 720.9272;
source = -C_UDMI(c,t,1)*Rc*H;

return source;
}
I attach 2 pictures..
my result is "iterasi udm adjust" pic..
and the result i want is "sahoo" pic..

my case use porosity..
i imagine the result should be is like this..
when the methane flow through inlet,, the pressure and temperature at above is more highly than below... like we say, the vessel is 100cm high..
the pressure and temp at 0cm is different than 100cm..
but my result is same..
have any idea?
Attached Images
File Type: jpg iterasi udm adjust.jpg (96.3 KB, 5 views)
File Type: jpg sahoo.JPG (29.6 KB, 5 views)
Jups is offline   Reply With Quote

Old   October 14, 2014, 01:30
Default hi
  #23
Member
 
Qureshi M Z I
Join Date: Sep 2013
Posts: 79
Rep Power: 12
m zahid is on a distinguished road
hi,

i am facing the similar problem. my UDF of source term is showing zero output. here is my Udf , if anybody know the problem please help me .

DEFINE_SOURCE(xmom,c,t,dS,eqn)
{
real x[ND_ND];
real source,ve;
C_CENTROID(x,c,t);
ve=sqrt((pow(C_U(c,t),2.0)+pow(C_V(c,t),2.0)+pow(C _W(c,t),2.0)));
source =-1.225*0.2*0.55* C_U(c,t)*ve;
C_UDMI(c,t,0)=source;
return source;
}


thanks
m zahid is offline   Reply With Quote

Old   October 14, 2014, 01:36
Default hi
  #24
Member
 
Qureshi M Z I
Join Date: Sep 2013
Posts: 79
Rep Power: 12
m zahid is on a distinguished road
hi
i am facing the similar problem. my UDF of source term is showing zero output. here is my Udf , if anybody know the problem please help me .

DEFINE_SOURCE(xmom,c,t,dS,eqn)
{
real x[ND_ND];
real source,ve;
C_CENTROID(x,c,t);
ve=sqrt((pow(C_U(c,t),2.0)+pow(C_V(c,t),2.0)+pow(C _W(c,t),2.0)));
source =-1.225*0.2*0.55* C_U(c,t)*ve;
C_UDMI(c,t,0)=source;
return source;
}


thanks
m zahid is offline   Reply With Quote

Old   October 14, 2014, 07:15
Default
  #25
Sun
Senior Member
 
Sun's Avatar
 
Join Date: Nov 2010
Posts: 103
Rep Power: 15
Sun is on a distinguished road
Make sure "ve" and "C_U(c,t)" are non-zero by printing them out. Also, add dS[eqn] (derivative of source term) before returning the source.
Cheers!
Sun is offline   Reply With Quote

Old   October 14, 2014, 23:12
Default hi
  #26
Member
 
Qureshi M Z I
Join Date: Sep 2013
Posts: 79
Rep Power: 12
m zahid is on a distinguished road
thanks for hint. SUN ,

now UDF working
m zahid is offline   Reply With Quote

Reply

Tags
new function, plot

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
heat transfer with RANS wall function, over a flat plate (validation with fluent) bruce OpenFOAM Running, Solving & CFD 6 January 20, 2017 06:22
LiencubiclowRemodel nzy102 OpenFOAM Bugs 14 January 10, 2012 08:53
Variable Density Function ryzd FLUENT 1 August 25, 2011 14:16
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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