|
[Sponsors] |
boundary condition in fluent, which is a function of density |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 28, 2017, 14:08 |
boundary condition in fluent, which is a function of density
|
#1 |
New Member
mohammad daneshmandi
Join Date: Dec 2017
Posts: 4
Rep Power: 8 |
Dear all
I want to add a boundary condition in fluent, which is a function of density. For this aim I wrote an UDF code to evaluate the density on the surface of boundary. But a segmentation error has occurred. I know what this error is but I do not know how to fix it and my algorithm is right or not? Thank you in advance for your help. #include "udf.h" DEFINE_PROFILE(inlet_pressure1,t,i) { real x[ND_ND]; real rr1; real vv; Thread *tf; face_t f; cell_t c; int n; begin_c_loop(c, t) /* loops over cells in a cell thread */ { rr1=C_R(c,t); c_face_loop(c, t, n) /* loops over all faces of a cell */ { f=C_FACE(c,t,n); tf=C_FACE_THREAD(c,t,n); vv=sqrt(pow (F_U(f,t),2)+pow (F_V(f,t),2)+pow (F_W(f,t),2)); F_PROFILE(f,tf,i)=40000000-0.5*rr1*pow (vv,2); } } end_c_loop(c, t) } |
|
December 28, 2017, 20:41 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
your problem was posted on forum several times. use search first.
initialize your case, than load udf best regards |
|
December 29, 2017, 12:09 |
|
#3 |
New Member
mohammad daneshmandi
Join Date: Dec 2017
Posts: 4
Rep Power: 8 |
I could not find the similar example and I am in a hurry, and I'm new member of CFD-online.
So can you please introduce one of the examples in forum? Ps: I initialized my case but again same error occured Best Regards Last edited by m.daneshmandi`; December 29, 2017 at 16:04. |
|
December 29, 2017, 12:54 |
|
#4 |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
"t" in DEFINE_PROFILE already means boundary contions, and you are looping it as it were a cell zone. Again, you are using it in a cell zone:
rr1=C_R(c,t); and in a face: F_U(f,t) which is wrong. I have not checked it and I am not sure what your idea is, but try this code: #include "udf.h" DEFINE_PROFILE(inlet_pressure1,t,i) { real rr1; real vv; face_t f; Thread *t0; cell_t c0; //I am not sure if there is a F_R(f,t) function for face density. If not, try the density of the adjacent cell, like this: t0 = THREAD_T0(t); c0=F_C0(f,t); rr1 = C_R(c0,t0); vv= sqrt(pow(F_U(f,t),2) + pow(F_V(f,t),2) + pow(F_W(f,t),2)); F_PROFILE(f,t,i)=40000000-0.5*rr1*pow(vv,2); } Last edited by upeksa; December 29, 2017 at 12:55. Reason: minor mistake |
|
December 29, 2017, 16:25 |
|
#5 |
New Member
mohammad daneshmandi
Join Date: Dec 2017
Posts: 4
Rep Power: 8 |
Thank you very much for your time and response.
I knew that density should be calculate in the grid points. But for my boundary condition, I should have it on a surafce. So that is why I wrote the loops. In your code, there is no loop, how do you think I can calculate the density for boundary condition? Bests |
|
December 30, 2017, 18:22 |
|
#6 | |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
Quote:
#include "udf.h" DEFINE_PROFILE(inlet_pressure1,t,i) { real rr1; real vv; face_t f; Thread *t0; cell_t c0; t0 = THREAD_T0(t); begin_f_loop(f,t) { c0=F_C0(f,t); rr1 = C_R(c0,t0); vv= sqrt(pow(F_U(f,t),2) + pow(F_V(f,t),2) + pow(F_W(f,t),2)); F_PROFILE(f,t,i)=40000000-0.5*rr1*pow(vv,2); } end_f_loop(f,t) } |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFD analaysis of Pelton turbine | amodpanthee | CFX | 31 | April 19, 2018 19:02 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 10:56 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |