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

Help in this UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2019, 15:17
Default Help in this UDF
  #1
New Member
 
Zeeshan Ahmad Khan
Join Date: Sep 2018
Posts: 10
Rep Power: 7
zakmt293 is on a distinguished road
Greetings

Respected experts I hope this post would find you fine. I have some query regarding implementation of this UDF. Can some one point out any mistake as it compiles very best but segmentation violation occurs more faster than that.It is a multi phase problem with two phases of water and vapor. Face looping occur and information about adjacent cells is required.




# include "udf.h"
# include "mem.h"
# include "sg.h"

DEFINE_ADJUST(my_adjust,domain)
{
Domain *d;
Thread *t,*t0,*t1=NULL;
cell_t c,c0,c1=-1;
face_t f;
int phase_domain_index_p=0;
int phase_domain_index_s=1;
Thread *tp=THREAD_SUB_THREAD(t,phase_domain_index_p=0);
Thread *ts=THREAD_SUB_THREAD(t,phase_domain_index_s=1);
real xc[ND_ND];
real A[ND_ND],dr0[ND_ND],dr1[ND_ND], es[ND_ND],ds,A_by_es;
d=Get_Domain(1);
if (FLUID_THREAD_P(t)) return;
begin_f_loop(f,t)
{

INTERIOR_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0,dr1 )
t1=THREAD_T1(t);
c0=F_C0(f,t);
t0=THREAD_T0(t);
c1=F_C1(f,t);
if (C_VOF(c0,tp)>0 && C_VOF(c0,tp)<1)
{
Message("We have reached to desire objective\n");
}
end_f_loop(f,t)
}
}


Also if some one could guide me in this area as well. I want to loop over faces of my domain and through thread ids I want to know whether that faces belong to interior of domain or is a boundary face. If it belong to interior of my domain then through connectivity macros both c0 and c1 adjacent cell information would be retrived other wise only cell c0 for boundary face.
I would be thankful if someone can help me.An effective and easy way if recommended would make my day.
Thank You
zakmt293 is offline   Reply With Quote

Old   July 4, 2019, 00:18
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
first of all you didn't define thread which call t, probably you ant loop over all threads:
Code:
# include "udf.h"
# include "mem.h"
# include "sg.h"

DEFINE_ADJUST(my_adjust,domain)
{
Domain *d;
Thread *t,*t0,*t1=NULL;
cell_t c,c0,c1=-1;
face_t f;
int phase_domain_index_p=0;
int phase_domain_index_s=1;
Thread *tp=THREAD_SUB_THREAD(t,phase_domain_index_p=0);
Thread *ts=THREAD_SUB_THREAD(t,phase_domain_index_s=1);
real xc[ND_ND];
real A[ND_ND],dr0[ND_ND],dr1[ND_ND], es[ND_ND],ds,A_by_es;
d=Get_Domain(1);
thread_loop_f(t, d)
{
if (FLUID_THREAD_P(t)) return;
begin_f_loop(f,t)
{

INTERIOR_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0,dr1 )
t1=THREAD_T1(t);
c0=F_C0(f,t);
t0=THREAD_T0(t);
c1=F_C1(f,t);
if (C_VOF(c0,tp)>0 && C_VOF(c0,tp)<1)
{
Message("We have reached to desire objective\n");
}
end_f_loop(f,t)
}
}
}
how do you use this -> INTERIOR_FACE_GEOMETRY(f,t,A,ds,es,A_by_es,dr0,dr1 ) ????

may be you have other problems

best regards
zakmt293 likes this.
AlexanderZ is offline   Reply With Quote

Old   July 4, 2019, 00:49
Default
  #3
New Member
 
Zeeshan Ahmad Khan
Join Date: Sep 2018
Posts: 10
Rep Power: 7
zakmt293 is on a distinguished road
Greetings
Thank You Respected Alexander for your reply. Yes I want to loop over threads.
The looping would be on faces and it would like to find out whether a face belongs to interior or boundary face. If a face belongs to interior then information about Volume fraction in both adjacent cells c0 and c1 would be retrieved. If the face belongs to a boundary then information belonging to adjacent cell c0 with the boundary would be retrieved.

Have you got my point. I have changed the program with your recommendations but still it gives an error.
I would request if you can help me out. I would be very thankful.

Thank You
Best Regards
Ahmad
zakmt293 is offline   Reply With Quote

Old   July 5, 2019, 01:19
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
you may use
Code:
BOUNDARY_FACE_THREAD_P(t)
macro to check if it is boundary or interior

show here final version of code you use and console output with error
describe in details all your steps

best regards
AlexanderZ is offline   Reply With Quote

Old   July 5, 2019, 15:10
Default
  #5
New Member
 
Zeeshan Ahmad Khan
Join Date: Sep 2018
Posts: 10
Rep Power: 7
zakmt293 is on a distinguished road
Greetings

Respected Alexander Thank You for your valuable comments. I will reply you by tomorrow with my detailed homework.
I am very thankful for your value able suggestions.

Thank You
Ahmad
zakmt293 is offline   Reply With Quote

Reply

Tags
multiphase, udf


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
udf for one dimensional linear motion based on force maccheese Fluent UDF and Scheme Programming 2 September 1, 2019 02:18
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 12:43
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 00:53
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 22:14
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 04:01


All times are GMT -4. The time now is 02:19.