CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   DEFINE_DPM_OUTPUT udf (https://www.cfd-online.com/Forums/fluent/32923-define_dpm_output-udf.html)

K. Kevala January 28, 2004 17:40

DEFINE_DPM_OUTPUT udf
 
Hello,

I am trying to write a DEFINE_DPM_OUTPUT udf so that I can track particles as they move through my domain and also assign a strain rate to each particle at each location in the domain. (time dependant - moving mesh).

As a first step, I am writing a simple template just to see if I have the idea. I have written the following:

#include "udf.h"

DEFINE_DPM_OUTPUT(history,header,fp,p,t,plane) {

fp = fopen("myfile.txt","a+");

if(header)

fprintf(fp,"This is a test\n"); else{

if(p==NULL)

;

else{

fprintf(fp,"%10.6f",P_VEL(p)[0]);

fprintf(fp," %10.6f",P_POS(p)[0]);

}

}

}

When I interpret the UDF, I get the error message:

Error: D:\velocity_history.c: line 18: P_POS: undeclared variable

However, if I remove the last fprintf statement (containing the P_POS(p)[i] macro which is clearly defined in the manual as giving particle position for i=0,1,2 (and also in dpm.h), then there is no problem. Is the P_VEL(p) macro correct, but I am using P_POS(p) incorrectly? With just the P_POS(p) statement in my udf, Fluent interprets the udf ok and gives an output file that seems reasonable after I hook it into the report->dpm->summary gui. Thanks for any suggestions.

Karl

Robert Hart January 29, 2004 08:38

Re: DEFINE_DPM_OUTPUT udf
 
I just had a look in dpm.h, and somewhat oddly, you have

#define P_VEL(p)(p->state.V)

and

#define P_POS(p,i)(p->state.pos[i])

This seems to imply that you should use P_POS(p, 0) in your function above, but P_VEL(p)[0].

Go figure



All times are GMT -4. The time now is 07:40.