|
[Sponsors] |
July 3, 2019, 16:17 |
Help in this UDF
|
#1 |
New Member
Zeeshan Ahmad Khan
Join Date: Sep 2018
Posts: 10
Rep Power: 8 |
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 |
|
July 4, 2019, 01:18 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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) } } } may be you have other problems best regards |
|
July 4, 2019, 01:49 |
|
#3 |
New Member
Zeeshan Ahmad Khan
Join Date: Sep 2018
Posts: 10
Rep Power: 8 |
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 |
|
July 5, 2019, 02:19 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you may use
Code:
BOUNDARY_FACE_THREAD_P(t) show here final version of code you use and console output with error describe in details all your steps best regards |
|
July 5, 2019, 16:10 |
|
#5 |
New Member
Zeeshan Ahmad Khan
Join Date: Sep 2018
Posts: 10
Rep Power: 8 |
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 |
|
Tags |
multiphase, udf |
|
|
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 03:18 |
Save output of udf in another udf! | JuanJoMex | FLUENT | 0 | February 8, 2018 13:43 |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |