|
[Sponsors] |
February 9, 2014, 00:38 |
Writing Particle Data
|
#1 |
New Member
Sayan Bose
Join Date: Apr 2013
Posts: 17
Rep Power: 13 |
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.
|
|
February 9, 2014, 07:04 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
I can suggest that you share your udf. If you want problems with your code to be solved, you have to share the code.
|
|
February 10, 2014, 13:40 |
|
#3 |
New Member
Sayan Bose
Join Date: Apr 2013
Posts: 17
Rep Power: 13 |
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); } |
|
February 10, 2014, 15:05 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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.) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Access particle data in main function | moritzhoefert | OpenFOAM Programming & Development | 2 | September 15, 2017 11:31 |
[General] 2 datas on one plot | Akuji | ParaView | 46 | December 1, 2013 15:06 |
studying a valve case | mina.basta | OpenFOAM | 33 | August 30, 2013 05:46 |
Need experiment data to validate Lagrangian particle tracking model | asal | FLUENT | 0 | August 19, 2013 06:42 |
export time data for particle tracking | yvonne | CFX | 2 | March 30, 2012 13:19 |