|
[Sponsors] |
July 4, 2012, 17:26 |
udf for gradient
|
#1 |
New Member
honglin wang
Join Date: May 2012
Posts: 4
Rep Power: 14 |
#include "udf.h"
FILE *fid; real flow; real x; real p; real g; real xc[ND_ND]; DEFINE_EXECUTE_AT_END(EXECUTE_AT_END) { Domain *d; Thread *t ; face_t f; cell_t c; d=Get_Domain(1); t= Lookup_Thread(d, 6); fid=fopen("flux.dat","w"); begin_f_loop(f, t) { c= F_C0(f, t); flow = F_FLUX(f,t); /* fprintf(fid,"MASS FLOW RATE:%g\n",flow);*/ } end_f_loop(f,t) begin_c_loop(c,t) { C_CENTROID(xc,c,t); x=xc[0]; p = C_P(c,t); g = C_P_RG(c,t)[0]; fprintf(fid,"x-coordinate:%g\t",x); fprintf(fid,"Static PRESSURE:%g\t",p); fprintf(fid,"PRESSURE GRADIENT:%g\n",g); } end_c_loop(c,t) fclose(fid); } There have error at the end of one time steps. g = C_P_RG(c,t)[0]; it may be have some problem. If I remove it ,the result is right. Please help me!!!!!!!!!! Thank you ! |
|
July 6, 2012, 09:46 |
|
#2 |
New Member
Join Date: Jan 2010
Location: Netherlands
Posts: 28
Rep Power: 16 |
did you enable the gradient macros using text commands?
solve/set/expert Keep temporary solver memory from being freed? Yes Also to use C_P_RG() you have to use the second order discretization scheme for pressure. Alternatively, you can use C_P_G(c,t)[0] which need not have a second order discretization scheme. Hope that helps. |
|
July 6, 2012, 11:08 |
|
#3 |
New Member
honglin wang
Join Date: May 2012
Posts: 4
Rep Power: 14 |
Thanks for your reply. I am so glad for response.
of course. Keep temporary solver memory from being freed? Yes my cas use desity solve. I had checked the result of radient use showgrad.c, but tht result only have C_P_RG() ,not C_P_G() . Do you have further advice? Thanks again. Best regards lin |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 22:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |