CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

boundary condition in fluent, which is a function of density

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2017, 13:08
Default boundary condition in fluent, which is a function of density
  #1
New Member
 
mohammad daneshmandi
Join Date: Dec 2017
Posts: 4
Rep Power: 8
m.daneshmandi` is on a distinguished road
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)



}
m.daneshmandi` is offline   Reply With Quote

Old   December 28, 2017, 19:41
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
your problem was posted on forum several times. use search first.

initialize your case, than load udf

best regards
AlexanderZ is offline   Reply With Quote

Old   December 29, 2017, 11:09
Default
  #3
New Member
 
mohammad daneshmandi
Join Date: Dec 2017
Posts: 4
Rep Power: 8
m.daneshmandi` is on a distinguished road
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 15:04.
m.daneshmandi` is offline   Reply With Quote

Old   December 29, 2017, 11:54
Default
  #4
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
"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 11:55. Reason: minor mistake
upeksa is offline   Reply With Quote

Old   December 29, 2017, 15:25
Default
  #5
New Member
 
mohammad daneshmandi
Join Date: Dec 2017
Posts: 4
Rep Power: 8
m.daneshmandi` is on a distinguished road
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
m.daneshmandi` is offline   Reply With Quote

Old   December 30, 2017, 17:22
Default
  #6
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
Quote:
Originally Posted by m.daneshmandi` View Post
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
My bad, you are right:

#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)
}
upeksa is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFD analaysis of Pelton turbine amodpanthee CFX 31 April 19, 2018 18:02
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 09:56
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


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