|
[Sponsors] |
November 13, 2009, 14:22 |
UDF force on a face
|
#1 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
Hi, I have a question:
I wanna calculate the entire force on a blade with Fluent for linux. The problem is a 2d rotating blade. Blade are modelling as an edge (and edge-shadow). I write this UDF (It's my first UDF!!!! :-S ): #include "udf.h" DEFINE_ON_DEMAND(force_on_demand) { real force = 0.; real NV_VEC(A); int IDblades = 10; face_t f; Thread *f_thread; Domain *d; d = Get_Domain(3); /* Fluid ID */ f_thread = Lookup_Thread(d, IDblades); begin_f_loop(f,f_thread) { F_AREA(A,f,f_thread); force += F_P(f,f_thread) * NV_MAG(A); } end_f_loop(f,f_thread) printf("\n FORCE = %g \n", force); */ } but Fluent stamp an error : fluent.6.3.26 received a fatal signal (segmentation violation) Error Object: #f Can somebody help me??!?!?!??!?! Thanks! |
|
November 13, 2009, 16:57 |
Check for errors
|
#2 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Try to replace
Code:
d = Get_Domain(3); /* Fluid ID */ f_thread = Lookup_Thread(d, IDblades); Code:
d = Get_Domain(3); /* Fluid ID */ if(NULL == d) Error("Something wrong with your domain id!\n"); f_thread = Lookup_Thread(d, IDblades); if(NULL == f_thread || !BOUNDARY_FACE_THREAD_P(f_thread)) Error("Something wrong with your face id!\n"); |
|
November 13, 2009, 18:00 |
|
#3 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
HI dmoroian;
I replace it, but Fluent finds an error in: if(NULL == f_thread || !BOUNDARY_FACE_THREAD_P(f_thread)) Error("Something wrong with your face id!\n"); So I write replace it only with: d = Get_Domain(3); /* Fluid ID */ if(NULL == d) Error("Something wrong with your domain id!\n"); f_thread = Lookup_Thread(d, IDblades); if(NULL == f_thread) Error("Something wrong with your face id!\n"); This code runs on Fluent, but before running Fluent show this Error: Error: C:\Documents and Settings\Enrico\Desktop\UDF windows\define_on_demand.c: line 32: function "CX_Primitive_Error" not found (pc=39). Error: C:\Documents and Settings\Enrico\Desktop\UDF windows\define_on_demand.c: line 32: function "CX_Primitive_Error" not found (pc=67). .entry Of course I can do it through menu, but I have to calculate the mean-time moment coefficient on the blades, so I'm starting with easier code. (Do you know if there is any way to do it through menu?). Thanks! |
|
November 13, 2009, 18:17 |
|
#4 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
HI! Sorry... I'm a beginner with UDF! Now I write this code :
#include "udf.h" DEFINE_ON_DEMAND(force_on_demand) { real force = 0.; real NV_VEC(A); int IDblades = 10; face_t f; Thread *f_thread; Domain *d; d = Get_Domain(3); /* Fluid ID */ if(NULL == d) printf("Something wrong with your domain id!\n"); f_thread = Lookup_Thread(d, IDblades); if(NULL == f_thread) printf("Something wrong with your face id!\n"); begin_f_loop(f,f_thread) { F_AREA(A,f,f_thread); force += F_P(f,f_thread) * NV_MAG(A); } end_f_loop(f,f_thread) /*printf("\n FORCE = %g \n", force);*/ } Then I compile it (Define User-Defined Function Interpreted), and Fluent doesn't report any errors. When I do "Execute on demand" Fluent report this message: Something wrong with your domain id! Something wrong with your face id! Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () SO... something wrong! .... :-S |
|
November 13, 2009, 18:27 |
|
#5 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
I replace ID fluid domain with ID default-interior domain, and Fluent report FORCE!!!! =)
I have another question: do you know how can I calculate the moment-coefficient of the blade? ( the blade is a 1d blade, so I have also the blade-shadow). I have to calculate it in order to get the mean-time moment coefficient of the blade. THANKS! |
|
November 15, 2009, 04:59 |
what is the difference between the cavitation model and the evaporation UDF?
|
#6 |
New Member
qiyang
Join Date: Nov 2009
Posts: 3
Rep Power: 17 |
I want to the process of the evaporation of water .So fluent may be a good tool.The problem is there is a interior cavitation model in fluent,and you can also write your own C files ,in other words ,the UDF program.BUt is there any difference between them?
|
|
November 15, 2009, 06:29 |
|
#7 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
Sorry but, I can't answer... I never solve problem like that.
I have a question for you. Is it possible to match to the VISCOUS FORCE by UDF script? I need to sum viscous force and pressur force. The command for pressur force is F_P(..), are there any command for viscous force? |
|
November 15, 2009, 07:28 |
|
#8 |
Member
Join Date: Mar 2009
Posts: 49
Rep Power: 17 |
you can let Fluent caluclate the moment-coefficient -> monitors
but you have to set proper reference values and the depth of the blade before.... |
|
November 15, 2009, 08:35 |
|
#9 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
Yes, of course I can do that through Moment-coefficient - monitors, but I need Moment coefficient in a UDF in order to obtain the time average cm.
So I wrote a UDF function and I'm able to calculate the PRESSURE force through the command F_P (then I multiply F_P * moment arm = MOMENT), but I'm unable to calculate the VISCOUS force. Do you know how I can do it? |
|
November 15, 2009, 11:53 |
|
#10 |
Senior Member
Herman
Join Date: Nov 2009
Posts: 122
Rep Power: 17 |
I solve my own problem with
Wall_Shear_Force_X = F_STORAGE_R_N3V(f,f_thread,SV_WALL_SHEAR)[0]; Wall_Shear_Force_Y = F_STORAGE_R_N3V(f,f_thread,SV_WALL_SHEAR)[1]; ( I find these funcions on the web; they are NOT on UDF manual!!!! ) |
|
March 23, 2011, 11:48 |
|
#11 |
Member
Join Date: Apr 2010
Location: Pisa / Italy
Posts: 62
Rep Power: 16 |
Hi enry,
i have to calculate pressure moment on my body. I've written begin_f_loop(f,t) { F_CENTROID(x,f,t); F_AREA(A,f,t); NV_D(force, = ,A[0]*F_P(f,t),A[1]*F_P(f,t),0); NV_CROSS(Mp,x,force); NV_V(Mp_t,+=,Mp); } end_f_loop(f,t) but something is wrong.... how did you calculate your pressure moments? thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Netgen] Import netgen mesh to OpenFOAM | hsieh | OpenFOAM Meshing & Mesh Conversion | 32 | September 13, 2011 06:50 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 15:00 |
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues | michele | OpenFOAM Meshing & Mesh Conversion | 2 | July 15, 2005 05:15 |