CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Regarding udf for boundary conditions in transient. (https://www.cfd-online.com/Forums/fluent-udf/196087-regarding-udf-boundary-conditions-transient.html)

Ram Prakash November 25, 2017 04:24

Regarding udf for boundary conditions in transient.
 
I want to write an udf to make use of the species mass fraction value at the outlet of the previous time step in inlet of the next time step continously in transient analysis. Since I am new in writing udf I read all the functions in the UDF manual of the fluent. Now I am clear in writing an udf for boundary condition profile. Can any tell me how to access the species mass fraction value of the outlet boundary when writing udf for the inlet boundary?

Sun November 27, 2017 07:34

To write your UDF for the boundary condition, you can use:
Code:

DEFINE_PROFILE
. To use the mass fraction of specie "i", you can use:
Code:

C_YI(c,t,i)
and for its value on the previous time step:
Code:

C_YI_M1(c,t,i)
cheers!

KaLium November 28, 2017 01:22

Quote:

Originally Posted by Sun (Post 672999)
To write your UDF for the boundary condition, you can use:
Code:

DEFINE_PROFILE
. To use the mass fraction of specie "i", you can use:
Code:

C_YI(c,t,i)
and for its value on the previous time step:
Code:

C_YI_M1(c,t,i)
cheers!

Does that work if he wants to read the previous values from outlet and add them to inlet?

Maybe he could use EXECUTE_AT_END - macro to save the outlet values and then use DEFINE_PROFILE in inlet?

Sun November 28, 2017 03:18

Yeah I guess it does make sense to fill the outlet face at the end, and then using DEFINE_PROFILE.

m.daneshmandi` December 28, 2017 13:04

boundary condition in fluent, which is a function of density
 
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)



}


All times are GMT -4. The time now is 10:28.