Particle Tracking
Hellow everybody,
I'm trying to develop a simple model to implement on the wall conditions. My idea is quite simple. I would like to get the velocity, position (X, Y, Z) and diameter of the particle the reaches all the wall boundary condition in my domain. Thinking about it I 'm using the DEFINE_DPM_BC to get those values export to a file and abort the trajectory of the particle. Here I post the simple UDF that I did to compile and export the values for a single injection. #include "udf.h" DEFINE_DPM_BC(bc_leitura_imp, p, t, f, f_normal, dim) { real vx, px; real vy, py; real vz, pz; FILE *fp; vx=P_VEL(p)[0] ; vy=P_VEL(p)[1] ; vz=P_VEL(p)[2] ; px=P_POS(p)[0] ; py=P_POS(p)[1] ; pz=P_POS(p)[2] ; fp = fopen("teste_export.txt","a+"); fprintf(fp,"Vel X %f\n", vx); fprintf(fp, "Vel Y %f\n", vy); fprintf(fp, "Vel Z %f\n", vz); fprintf(fp,"Pos X %f\n", px); fprintf(fp, "Pos Y %f\n", py); fprintf(fp, "Pos Z %f\n", pz); fclose(fp); return PATH_ABORT; } Now I'm trying to improve that code to do the same with a group of particle. So I would like to have the positions, velocities and so on of all the particles that reaches the wall bounday condition. To make it possible I used the GROUP injection type. But the code above doesn't work anymore. I made some changes. I thought that would be necessary to have a loop around all the cells in the wall face making use of the code below. #include "udf.h" DEFINE_DPM_BC(bc_leitura_imp, p, t, f, f_normal, dim) { real vx, px; real vy, py; real vz, pz; cell_t c ; FILE *fp; begin_c_loop (c,t) { Particle *pi; begin_particle_cell_loop (pi,c,t) { vx=pi->state.V[0] ; vy=pi->state.V[1] ; vz=pi->state.V[2] ; px=pi->state.pos[0] ; py=pi->state.pos[1] ; pz=pi->state.pos[2] ; fp = fopen("teste_export.txt","a+"); fprintf(fp,"Vel X %f\n", vx); fprintf(fp, "Vel Y %f\n", vy); fprintf(fp, "Vel Z %f\n", vz); fprintf(fp,"Pos X %f\n", px); fprintf(fp, "Pos Y %f\n", py); fprintf(fp, "Pos Z %f\n", pz); fclose(fp); } end_particle_cell_loop (pi,c,t) } end_c_loop (c,t) return PATH_ABORT; } And it didn't work. The error log is 'int' differs in levels of indirection from 'struct thread_struct *' error LNK2001: unresolved external symbol _RP_THREAD error LNK2001: unresolved external symbol _RP_CELL Does anybody have tryed something like this before?? Thanks Lourival |
Re: Particle Tracking
As a new user I discovered that the first UDF was correct and it wasn't necessary to creat loop and those things.
If I want to print or acess variables for each particle in the stream just vx=p->state.V[0] ; vy=p->state.V[1] ; vz=p->state.V[2] ; px=p->state.pos[0] ; py=p->state.pos[1] ; pz=p->state.pos[2] ; fp = fopen("teste_export.txt","a+"); /* Cria um arquivo para escrever e associa com fp*/ fprintf(fp,"Vel X %f\n", vx); fprintf(fp, "Vel Y %f\n", vy); fprintf(fp, "Vel Z %f\n", vz); fprintf(fp,"Pos X %f\n", px); fprintf(fp, "Pos Y %f\n", py); fprintf(fp, "Pos Z %f\n", pz); fclose(fp); return PATH_ABORT; And after the FLUENT has reached the convergence goes to the Display -> Particle Tracks -> Select the injection and click on Display, that we will get the information about all the particles in the group. |
All times are GMT -4. The time now is 11:24. |