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

help me please

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 11, 2016, 14:34
Default help me please
  #1
Member
 
mahya
Join Date: Jul 2016
Posts: 45
Rep Power: 10
mahayheidari is on a distinguished road
hello i write this udf
now i want to add zeta
zeta = (-0.2*(Temp-273.15)-72.8)/1000
but when i compile it in fluent
show error that cant identify Temp
can you help me?
thanks

#include "udf.h"

DEFINE_PROFILE(slip_ncond_x,face_thread,i)
// x velocity for non conductive wall
{
face_t f;
cell_t neig;
Thread *cell_thread;
Domain *domain = Get_Domain(1);
real vel,normal_magnitude,E_normal_x,E_normal_y,E_repai red_x,E_repaired_y;
real NV_VEC(A);
real mu=0.001003;
real eps0=8.85e-12;
real eps=80.1;

//cell_thread=THREAD_T1(face_thread);
cell_thread=THREAD_T0(face_thread);

begin_f_loop(f,face_thread)
{
neig=F_C0(f,face_thread);
// Repair E component values............................................ .................................................. ...
F_AREA(A,f,face_thread);
//Message("x is %g\n", A[0]);

normal_magnitude=pow( pow(A[0],2)+pow(A[1],2),0.5);

if ( NULL != THREAD_STORAGE(cell_thread,SV_UDS_I(0)) && NULL != T_STORAGE_R_NV(cell_thread,SV_UDSI_G(0)) )
{
E_normal_x=ND_DOT(-C_UDSI_G(neig,cell_thread,0)[0],-C_UDSI_G(neig,cell_thread,0)[1],0,A[0],A[1],0)/pow(normal_magnitude,2)*A[0];
E_normal_y=ND_DOT(-C_UDSI_G(neig,cell_thread,0)[0],-C_UDSI_G(neig,cell_thread,0)[1],0,A[0],A[1],0)/pow(normal_magnitude,2)*A[1];

E_repaired_x=-C_UDSI_G(neig,cell_thread,0)[0]-E_normal_x;
E_repaired_y=-C_UDSI_G(neig,cell_thread,0)[1]-E_normal_y;
}
else
E_repaired_x = 0 ;
//.................................................. .................................................. ........................
F_PROFILE(f,face_thread,i)=-eps0*eps*zeta_p*E_repaired_x/mu;
}
end_f_loop(f,face_thread)
}
mahayheidari is offline   Reply With Quote

Old   October 11, 2016, 14:52
Default
  #2
New Member
 
Sorin Munteanu
Join Date: Apr 2013
Posts: 27
Rep Power: 14
Sorin is on a distinguished road
Hi,

If you could provide the following, I might be able to help:
- your original UDF (or an equivalent that you can post) that compiles fine
- the code that you intend to add and the location where you want to add it
- the error message that you get

Without such information, I might guess that the variable Temp is either not declared or declared in a different scope that the scope where it is using. If this were the case your error should be something similar with "Error: your_udf.c: line xx: Temp: undeclared variable".

Without seeing your code I can just guess.

Thank you

Sorin




Quote:
Originally Posted by mahayheidari View Post
hello i write this udf
now i want to add zeta
zeta = (-0.2*(Temp-273.15)-72.8)/1000
but when i compile it in fluent
show error that cant identify Temp
can you help me?
thanks

#include "udf.h"

DEFINE_PROFILE(slip_ncond_x,face_thread,i)
// x velocity for non conductive wall
{
face_t f;
cell_t neig;
Thread *cell_thread;
Domain *domain = Get_Domain(1);
real vel,normal_magnitude,E_normal_x,E_normal_y,E_repai red_x,E_repaired_y;
real NV_VEC(A);
real mu=0.001003;
real eps0=8.85e-12;
real eps=80.1;

//cell_thread=THREAD_T1(face_thread);
cell_thread=THREAD_T0(face_thread);

begin_f_loop(f,face_thread)
{
neig=F_C0(f,face_thread);
// Repair E component values............................................ .................................................. ...
F_AREA(A,f,face_thread);
//Message("x is %g\n", A[0]);

normal_magnitude=pow( pow(A[0],2)+pow(A[1],2),0.5);

if ( NULL != THREAD_STORAGE(cell_thread,SV_UDS_I(0)) && NULL != T_STORAGE_R_NV(cell_thread,SV_UDSI_G(0)) )
{
E_normal_x=ND_DOT(-C_UDSI_G(neig,cell_thread,0)[0],-C_UDSI_G(neig,cell_thread,0)[1],0,A[0],A[1],0)/pow(normal_magnitude,2)*A[0];
E_normal_y=ND_DOT(-C_UDSI_G(neig,cell_thread,0)[0],-C_UDSI_G(neig,cell_thread,0)[1],0,A[0],A[1],0)/pow(normal_magnitude,2)*A[1];

E_repaired_x=-C_UDSI_G(neig,cell_thread,0)[0]-E_normal_x;
E_repaired_y=-C_UDSI_G(neig,cell_thread,0)[1]-E_normal_y;
}
else
E_repaired_x = 0 ;
//.................................................. .................................................. ........................
F_PROFILE(f,face_thread,i)=-eps0*eps*zeta_p*E_repaired_x/mu;
}
end_f_loop(f,face_thread)
}
Sorin 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



All times are GMT -4. The time now is 20:47.