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

UDF source using divergence of velocity

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 2, 2014, 15:09
Smile UDF source using divergence of velocity
  #1
New Member
 
ajenecheng
Join Date: Dec 2012
Posts: 2
Rep Power: 0
ajene is on a distinguished road
hello,
I want to calculate the velocity divergence of a specific cell as a source term, but there is
access violation:
Error:
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\2ddp\fl1450s.exe 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: #f





can you give me some advice? the UDF is as follow:

DEFINE_SOURCE(UDS_s_p2, c_UDS_s_p2,t_UDS_s_p2, ds_UDS_s_p2, eqn_UDS_s_p2)
{
real source_UDS_s_p2;
Thread *mix_t_UDS_s_p2;
Thread *t_UDS_s_liquid_p2;


real NV_VEC(A_TOL),NV_VEC(VEC),NV_VEC(VEC0),NV_VEC(VEC1 ),NV_VEC(A);
real div_V;
Thread *tf;
int f,n;
cell_t c0, c1 = -1;
Thread *t0, *t1 = NULL;


source_UDS_s_p2=0.0;
div_V=0;
mix_t_UDS_s_p2=THREAD_SUPER_THREAD(t_UDS_s_p2);
t_UDS_s_liquid_p2= THREAD_SUB_THREAD(mix_t_UDS_s_p2, 0);

c_face_loop( c_UDS_s_p2, mix_t_UDS_s_p2,n) /*loop the faces of a specific cell*/
{
f=C_FACE( c_UDS_s_p2,mix_t_UDS_s_p2,n); /* retrive the ID of face on liquid level */
tf=C_FACE_THREAD( c_UDS_s_p2,mix_t_UDS_s_p2,n); /* retrive the thread of face on liquid level */

c0 = F_C0(f,tf);
t0 = F_C0_THREAD(f,tf);
F_AREA(A,f,tf);
if (BOUNDARY_FACE_THREAD_P(tf))
{
NV_D(VEC,=,F_U(f,tf),F_V(f,tf),F_W(f,tf));
}

else
{
c1 = F_C1(f,tf);
t1 = F_C1_THREAD(f,tf);
NV_D(VEC0,=,C_U(c0,t0),C_V(c0,t0),C_W(c0,t0)) ;
NV_D(VEC1,=,C_U(c1,t1),C_V(c1,t1),C_W(c1,t1));
NV_VS_VS(VEC,=,VEC0,*,0.5,+,VEC1,*,0.5);
}
div_V+=NV_DOT(A,VEC); /* intergration of area dot velocity for all the faces in the cell */
}

div_V/=C_VOLUME(c_UDS_s_p2,mix_t_UDS_s_p2);

source_UDS_s_p2 =+ div_V;
}

ds_UDS_s_p2[eqn_UDS_s_p2]=0.0;
return source_UDS_s_p2;
}
ajene is offline   Reply With Quote

Reply

Tags
loop, source, velocity divergence


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
wmake compiling new solver mksca OpenFOAM Programming & Development 14 June 22, 2018 07:29
HELP! adding a mass source to VOF eqn. by UDF??? ROOZBEH FLUENT 5 December 3, 2016 18:53
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44


All times are GMT -4. The time now is 05:24.