|
[Sponsors] |
October 8, 2005, 05:17 |
UDF - source terms
|
#1 |
Guest
Posts: n/a
|
Dear fluent users, My problem is application of source terms to a zone(s) inside a fluid domain.Here i want to know how to extract the nodal coordinates of the domain and using this x,y,z values of the complete domain, few no.of cells need to be selected to apply source terms. I have tried the following way but could not get it.
#include <"udf.h"> DEFINE_SOURCE(mom_source,c,t,dS,eqn) { Node *node; x = NODE_X(node); y = NODE_Y(node); real source,x,y; if (x<=0 && x>=10 ..........) */to pick the cells in the domain for the application of source terms*/ { source = 100; dS[eqn]= 0; } else source = 0; dS[eqn]= 0; } return source; } How to solve this problem of extracting the coordinates of the domain.Any suggestions are appreciated. In STAR-cd directly you can access the nodal cordinates by X,Y and Z varaibles through user coding.In fluent i find UDFs are not that user friendly as other softwares. Thanks in Advance. Fred |
|
October 10, 2005, 03:33 |
Re: UDF - source terms
|
#2 |
Guest
Posts: n/a
|
To access node values you will first have to loop over all cell nodes using c_node_loop macro. You could also use the cell center coordinates instead of all those node values wich is imho the better option.
RoM #include "udf.h" DEFINE_SOURCE(mom_source,c,t,dS,eqn) { real source,x,y; int n; Node *node; c_node_loop(c,t,n) /* loop over all cell nodes */ { node=C_NODE(c,t,n); x = NODE_X(node); y = NODE_Y(node); if (x<=0 && x>=10) /*to pick the cells in the domain for the application of source terms*/ { source = 100.0; dS[eqn]= 0.0; } else { source = 0.0; dS[eqn]= 0.0; } } return source; } /* better */ DEFINE_SOURCE(mom_source,c,t,dS,eqn) { real source,x[2]; C_CENTROID(x,c,t); /* store cell center coordinates in vector x : x[0]=x , x[1]=y */ if (x[0]<=0 && x[0]>=10) /*to pick the cells in the domain for the application of source terms*/ { source = 100.0; dS[eqn]= 0.0; } else { source = 0.0; dS[eqn]= 0.0; } return source; } |
|
October 11, 2005, 20:53 |
Re: UDF - source terms
|
#3 |
Guest
Posts: n/a
|
Fred
For instance, you can make the procedure following: If your equation is S = - 0.5 * A * B * u * u * ui Where A and B are constants, u is the velocity vector and ui is the velocity component. You can write the following UDF: DEFINE_SOURCE(x_mom, c, t, dS, eqn) { real con, source; real x; real y; con =0.5 * A*B; source = - con*fabs(sqrt(pow(C_U(c,t),2)+pow(C_V(c,t),2)))*C_ U(c,t); dS[eqn]= -2*con*fabs(sqrt(pow(C_U(c,t),2)+pow(C_V(c,t),2))); return source; } In GAMBIT you define the boundary of the FLUID REGION. After the compilation or interpretation of UDF source term in FLUENT, do: Define - Boundary Conditions â€" Fluid … Open Fluid Painel. Thus, set source term option, and introduce your UDF in the X-Momentum list(or Y and Z) list. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for source term in momentum equation | Enrico | FLUENT | 9 | May 30, 2014 11:34 |
UDF source term | jerome_ | FLUENT | 2 | July 11, 2011 11:55 |
Using source terms | jsm | Main CFD Forum | 4 | August 20, 2009 06:44 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 17:51 |
I have problem of UDF with turbulent premx source. | Z | FLUENT | 0 | February 16, 2005 03:34 |