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

The way of information transfer between Fluent solver and udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2019, 01:33
Smile The way of information transfer between Fluent solver and udf
  #1
New Member
 
Jim
Join Date: Jun 2019
Posts: 6
Rep Power: 6
CrystalEternity is on a distinguished road
Now I'm a little confused about how the two are passed on,especially vectors.
For example ,this is an UDF macro from FLUENT help .

/* UDF for computing the magnetic force on a charged particle */

#include "udf.h"

#define Q 1.0 /* particle electric charge */
#define BZ 3.0 /* z component of magnetic field */
#define TSTART 18.0 /* field applied at t = tstart */

/* Calculate magnetic force on charged particle. Magnetic */
/* force is particle charge times cross product of particle */
/* velocity with magnetic field: Fx= q*bz*Vy, Fy= -q*bz*Vx */

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
real bforce=0;
if(P_TIME(p)>=TSTART)
{
if(i==0) bforce=Q*BZ*P_VEL(p)[1];
else if(i==1) bforce=-Q*BZ*P_VEL(p)[0];
}
else
bforce=0.0;
/* an acceleration should be returned */
return (bforce/P_MASS(p));
}

About this macro,I would like to raise the following questions:
1.How does i identify and allocate variables
2.The explanation about I is that it represents the components in cartesian coordinate system, 0, 1 and 2 can be taken.When the variable is passed and calculated(especially vectors), is it done once or many times?
For example,When the UDF is called, a certain velocity component is obtained from the solver, and the acceleration in the direction is returned. By calling the macro three times, three returns are returned to realize the effect of lorentz force on the particle, or are there other explanations?
CrystalEternity is offline   Reply With Quote

Old   June 8, 2019, 21:59
Default
  #2
New Member
 
Jim
Join Date: Jun 2019
Posts: 6
Rep Power: 6
CrystalEternity is on a distinguished road
Is there anyone who can help answer these questions
CrystalEternity is offline   Reply With Quote

Reply

Tags
fluent, information transfer, 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
UDF to record FLUENT Solver variables... mariachi Fluent UDF and Scheme Programming 11 September 24, 2019 00:07
Fluent UDF for thermal NOx larsschwarzer Fluent UDF and Scheme Programming 1 July 18, 2014 08:39
How to disable a specific solver in FLUENT by UDF? r.mojtaba Fluent UDF and Scheme Programming 0 July 8, 2013 13:44
UDF to record FLUENT solver variables... mariachi FLUENT 1 February 3, 2010 22:18
What's a UDF? Farooq FLUENT 5 December 9, 2003 06:52


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