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

Writing Particle Data

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 8, 2014, 23:38
Default Writing Particle Data
  #1
New Member
 
Sayan Bose
Join Date: Apr 2013
Posts: 17
Rep Power: 13
sayan_bose is on a distinguished road
I want to write particle variables in a separate text file, but the basic C code for writing a text file is not working under my DPM_BODY_FORCE macro. Fluent stops working at the time of particle update. Though the txt files are created they are completely blank. Can any one suggest anything.
sayan_bose is offline   Reply With Quote

Old   February 9, 2014, 06:04
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
I can suggest that you share your udf. If you want problems with your code to be solved, you have to share the code.
pakk is offline   Reply With Quote

Old   February 10, 2014, 12:40
Default
  #3
New Member
 
Sayan Bose
Join Date: Apr 2013
Posts: 17
Rep Power: 13
sayan_bose is on a distinguished road
This is the code....the dots basically is the mats of magnetic force which is important.........important is the code for the writing file.......which is making fluent exit during the particle update. How to resolve dis.





#include "udf.h"/* must be at the beginning of every UDF you write */
#include <stdio.h>

#define PI 3.14159265 /*Assighned value for Pie */
#define Kieff 3 /*Effective succeptibility */
#define xmag 12 /* x-loc of the magnet */
#define ymag 12 /* y-loc of the magnet */
#define zmag 12 /*z-loc of the magnet*/
#define lx 1.2 /*unit vector along x-for mag*/
#define ly 1.2 /*unit vector along y-for mag*/
#define lz 0 /*unit vector along z-for mag*/
#define I 1e5 /*current */
#define a 1e-6

DEFINE_DPM_BODY_FORCE(particle_body_force,p,i)
{
real muzero,Mag_const,vp,Mag_force,ax,ay,az;
real x,y,z,modr,rdotl,sqrs,s,sx,sy,sz,sxmod,symod,szmod ;
real numer,Denom01,Denom02,Denomx,Denom11,Denom12,Denom y,smod,unitsx,unitsy,unitsz;
real bforce,bforcex,bforcey,bforcez;

FILE *particle_data;
x=P_POS(p)[0]-xmag;
y=P_POS(p)[1]-ymag;
z=P_POS(p)[2]-zmag;
......................................
.......................................
............................................
...........................................
.....................................
............
particle_data=fopen("particle.txt","a");

if(i==0.)

{
bforcex=bforce*unitsx;
ax=bforcex/P_MASS(p);

}
else if(i==1.)
{
bforcey=bforce*unitsy;
ay=bforcey/P_MASS(p);

}
else if(i==2.)
{
bforcez=bforce*unitsz;
az=bforcez/P_MASS(p);

}
return((bforce)/P_MASS(p));
fprintf(particle_data,"%g\t %g\t %g\t %g\t %g\t \n",x[i],y[j],ax,ay,az);
fclose(particle_data);
}
sayan_bose is offline   Reply With Quote

Old   February 10, 2014, 14:05
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Create an empty file named "particle.txt" in the same folder, and see what happens.

(My hypothesis is that Fluent wants to add lines to this file, but cannot find it, does not know what to do and runs away screaming.)
pakk is offline   Reply With Quote

Reply


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
Access particle data in main function moritzhoefert OpenFOAM Programming & Development 2 September 15, 2017 10:31
[General] 2 datas on one plot Akuji ParaView 46 December 1, 2013 14:06
studying a valve case mina.basta OpenFOAM 33 August 30, 2013 04:46
Need experiment data to validate Lagrangian particle tracking model asal FLUENT 0 August 19, 2013 05:42
export time data for particle tracking yvonne CFX 2 March 30, 2012 12:19


All times are GMT -4. The time now is 23:41.