|
[Sponsors] |
July 22, 2021, 06:16 |
Need help regarding 6DOF udf with face loop
|
#1 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
Hello Dear,
I hope this thread will find you well. I am doing a very simple test where i use 6dof udf but in that udf i want to get the velocity from the actual results. The main problem is complex but i receive the same error as shown below. I also wrote the UDF here below for reference. The thing is when i do not use a loop then it works fine but i need to have a loop to get the velocity or some other variable from the results. I hope you understand the problem and give me feedback asap with your experience. Thank you. UDF: /************************************************** ***** SDOF property compiled UDF with external forces/moments ************************************************** *****/ #include "udf.h" static real acc = 4.631; static real mass = 5; static real velocity; DEFINE_SDOF_PROPERTIES(acce, prop, dt, time, dtime) { prop[SDOF_MASS] =5; prop[SDOF_IXX] = 5.2e-5; prop[SDOF_IYY] = 4.1667e-3; prop[SDOF_IZZ] = 1; prop[SDOF_ZERO_TRANS_X] = False;/* boolean, allow translation in x-direction */ prop[SDOF_ZERO_TRANS_Y] = True; /* boolean, suppress translation in y-direction */ prop[SDOF_ZERO_TRANS_Z] = True; /* boolean, suppress translation in z-direction */ prop[SDOF_ZERO_ROT_X] = True; /* boolean, suppress rotation around x-axis */ prop[SDOF_ZERO_ROT_Y] = True; /* boolean, suppress rotation around y-axis */ prop[SDOF_ZERO_ROT_Z] = True; /* boolean, allow rotation around z-axis */ { if(time >= 0) { Thread *f_thread; face_t f; velocity=0; begin_f_loop(f, f_thread) { velocity += F_U(f, f_thread); } end_f_loop(f, f_thread) Message("\nV1 %d /n",velocity); prop[SDOF_LOAD_F_X] = mass*acc; } } } Error: "V1 0 /n ========================= ============== ================================================== ================================================== ============ Node 5: Process 20896: Receiv============================================ ============== ======================================== Node 1: Proc=================ess 20948: Received signal ====================SIGSEGV. ================================================== ============================================ ========================================= =============================Node 3: Process 20648: Received si=ed signal gn======================SIGSEGV. ================================================== =al SI========G=============================== S==EG====V. ======= No====== ============ Node 0: Prde 2: Process 17612: Received sig=====================o========================= ======================================== ============ncess 1936: Received signal Sal SIGSEGV. =========================IGSEGV. ================================================== ================================================== ======== Node 4: ===========Process 10852: Rece======ived signal SIGSEGV.=== ================================================== ======================= ================== 999999: mpt_accept: error: accept failed: No such file or directory" |
|
July 22, 2021, 07:00 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Can you give the version without that gives no errors?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 22, 2021, 07:23 |
|
#3 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
Hello Pakk,
Thank you and for example the following code which i just verified and it works but not with the loop. /************************************************** ***** SDOF property compiled UDF with external forces/moments ************************************************** *****/ #include "udf.h" #include "mem.h" #include "metric.h" static real acc = 4.631; static real mass = 5; DEFINE_SDOF_PROPERTIES(acce, prop, dt, time, dtime) { prop[SDOF_MASS] = 5; prop[SDOF_IXX] = 5.2e-5; prop[SDOF_IYY] = 4.1667e-3; prop[SDOF_IZZ] = 1; prop[SDOF_ZERO_TRANS_X] = False;/* boolean, allow translation in x-direction */ prop[SDOF_ZERO_TRANS_Y] = True; /* boolean, suppress translation in y-direction */ prop[SDOF_ZERO_TRANS_Z] = True; /* boolean, suppress translation in z-direction */ prop[SDOF_ZERO_ROT_X] = True; /* boolean, suppress rotation around x-axis */ prop[SDOF_ZERO_ROT_Y] = True; /* boolean, suppress rotation around y-axis */ prop[SDOF_ZERO_ROT_Z] = False; /* boolean, allow rotation around z-axis */ { if (time>=0 && time<=0.12) { prop[SDOF_LOAD_F_X] = mass*acc; } } } |
|
July 22, 2021, 09:01 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
That is very strange, because your loop should not do anything...
Do you get errors if you remove the Message line? Or replace %d (which is wrong) by %f?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 22, 2021, 10:40 |
|
#5 | |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
Quote:
": warning C4700: The uninitialized local variable "f_thread" was used." But in my code as you see that i have initialized that then why is it giving a warning? I am really grateful for your help. |
||
July 22, 2021, 11:39 |
|
#6 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
I have resolved the initial issue but still facing some other issue. As i am trying to resolve that as and well and if i could not do it then again post here so please answer that if you can. As i need to have the velocity of the moving object which we can also see in dynamic mesh in Center of Gravity Velocity. But the velocity i am getting from UDF loop in 6DOF properties is not equal to centre of gravity velocity Vx. Thank you and update you whatever happens.
|
|
July 22, 2021, 12:37 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You are not calculating the average velocity. You are summing velocities...
If you want to do this: sum velocity*volume, and divide by the total volume.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 22, 2021, 12:44 |
|
#8 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
Yes you are right in the first program i was not. But that was just to keep things simpler as the program was not running and i am having an error. Now it runs and i have changed the program but still need to add things. I will calculate the total no of faces of the domain and then divide the velocity by that to get the velocity of the domain. I will update once i verify that which i hope i can. Thank you and have a nice day.
|
|
July 22, 2021, 14:38 |
|
#9 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Don't do that, that is not a good average. Sum velocity*area and divide by sum of area.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 23, 2021, 01:21 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
/************************************************** ***** SDOF property compiled UDF with external forces/moments ************************************************** *****/ #include "udf.h" static real acc = 4.631; static real mass = 5; static real velocity; DEFINE_SDOF_PROPERTIES(acce, prop, dt, time, dtime) { Thread *f_thread; face_t f; Domain *domain; int nid; prop[SDOF_MASS] =5; prop[SDOF_IXX] = 5.2e-5; prop[SDOF_IYY] = 4.1667e-3; prop[SDOF_IZZ] = 1; prop[SDOF_ZERO_TRANS_X] = False;/* boolean, allow translation in x-direction */ prop[SDOF_ZERO_TRANS_Y] = True; /* boolean, suppress translation in y-direction */ prop[SDOF_ZERO_TRANS_Z] = True; /* boolean, suppress translation in z-direction */ prop[SDOF_ZERO_ROT_X] = True; /* boolean, suppress rotation around x-axis */ prop[SDOF_ZERO_ROT_Y] = True; /* boolean, suppress rotation around y-axis */ prop[SDOF_ZERO_ROT_Z] = True; /* boolean, allow rotation around z-axis */ domain = THREAD_DOMAIN (DT_THREAD (dt)); nid = THREAD_ID (DT_THREAD (dt)); f_thread = Lookup_Thread (domain, nid); velocity=0; begin_f_loop(f, f_thread) { velocity += F_U(f, f_thread); } end_f_loop(f, f_thread) # if RP_NODE velocity = PRF_GRSUM1(velocity); # endif Message0("\nV1 %d /n",velocity); prop[SDOF_LOAD_F_X] = mass*acc; } }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
July 23, 2021, 02:18 |
|
#11 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Still the %d which I told you is wrong, and still the unweighted sum which I told you is wrong. Why are you showing this wrong code?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 23, 2021, 05:55 |
|
#12 | |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
Quote:
I have wrote the code with area and tried where i have walls moving in x-direction and it worked. But i have only one message command in my code and in console it shows more than 4 times which i do not understand. But the problem is that when i apply the same in my Overset model then it gives the errors and in compiling there are no warnings or errors. I have attached the code below. Please take a look and help me in this regard. /************************************************** ***** SDOF property compiled UDF with external forces/moments ************************************************** *****/ #include "udf.h" static real acc = 4.631; static real mass = 5; static real velocity, vel, areatot; DEFINE_SDOF_PROPERTIES(acce, prop, dt, time, dtime) { prop[SDOF_MASS] =5; prop[SDOF_IXX] = 8.333e-4; prop[SDOF_IYY] = 4.1667e-3; prop[SDOF_IZZ] = 5.2e-5; prop[SDOF_ZERO_TRANS_X] = False;/* boolean, allow translation in x-direction */ prop[SDOF_ZERO_TRANS_Y] = True; /* boolean, suppress translation in y-direction */ prop[SDOF_ZERO_TRANS_Z] = True; /* boolean, suppress translation in z-direction */ prop[SDOF_ZERO_ROT_X] = True; /* boolean, suppress rotation around x-axis */ prop[SDOF_ZERO_ROT_Y] = True; /* boolean, suppress rotation around y-axis */ prop[SDOF_ZERO_ROT_Z] = False; /* boolean, allow rotation around z-axis */ { Thread *t; face_t f; real A[ND_ND]; t = DT_THREAD(dt); velocity=0.0; vel=0; areatot=0; begin_f_loop(f, t) { F_AREA(A,f,t); areatot += NV_MAG(A); velocity += F_U(f, t)* NV_MAG(A); } end_f_loop(f, t) vel = velocity/areatot; Message ("v = %f, velocity= %f, Area Total = %f \n", vel, velocity, areatot); prop[SDOF_LOAD_F_X] = mass*acc; } } Error: v = -nan(ind), velocity= 0.000000, Area Total = 0.000000 ============= ============== ============== ================================================== ========================= ================================================== ================================================== ==== ================================================ ====No== Node============================================== ==de 3: Process 15 1256: Received signal ===SIG=SEGV. ================================================== ================================================ Node 2=======================================: Process 8==== == ============300: Received sNode 4: =====ignal Process 16916: Received===============SIG signal SEGV. ============================SIGSEGV. =========================== Node 0================================================= ============================== : P================================rocess 17156: Received signal SIGSEGV. ================================================== ============================= ==================== Node 5: Process= 16700: Recei=ved signal SIGSEGV===. ================================================== ================:============== Process 16904: Received signal SIGSEGV. ==================== ================================================== =============== The fl process could not be started. |
||
July 23, 2021, 07:12 |
|
#13 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You are correct, I'm sorry, I should have read better!
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 23, 2021, 08:57 |
|
#14 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
||
July 23, 2021, 12:53 |
|
#15 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You have multiple nodes, you need to let them communicate. AlexanderZ showed how.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 26, 2021, 09:47 |
|
#16 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
[QUOTE=AlexanderZ;808774][CODE]
Hello AlexanderZ, thank you so much for your reply and it helped me a lot. But i have a problem where i am using overset model and now what i did that i define the motion on walls and for overset fluid domain i defined relative motion and UDF with only properties e.e mass, rotation and translation. Is this the right way to do it because when i define the same udf with motion on both then i get errors. 2nd thing is that i have attached the code below when i used my calculation for (#if !RP_HOST) and solving it parallel but in results i have variable output 6 times and every variable has a different value. If you can help me to get the one value which should be equal to the one we can see in dynamic mesh window. What i understood from manual that all variable values which i see in console are from different nodes and now i want to let them communicate so get the right value which i do not know yet. And for writing a file with variables like time and velocity should i also use #if !RP_HOST or #if RP_NODE, etc.? The results are as follows. Initially the variable V1 has 6 different values but after some time only one has a value and other has ind value which i do not understand. And in later stages the value is equal to the one in dynamic mesh. I need to have only one accurate value which you can see in 2nd results which i can use further in my program for comparison. , First results V1 0.004384 Area Total 0.001615 /n done. Updating mesh at time level N... V1 0.004380 Area Total 0.009207 /n V1 0.004389 Area Total 0.004913 /n V1 0.004389 Area Total 0.005528 /n V1 0.004385 Area Total 0.001727 /n V1 0.004380 Area Total 0.000947 /ndone. 2nd Results V1 -nan(ind) Area Total 0.000000 /n done. Updating mesh at time level N... V1 -nan(ind) Area Total 0.000000 /n V1 0.030577 Area Total 0.023936 /n V1 -nan(ind) Area Total 0.000000 /n V1 -nan(ind) Area Total 0.000000 /n V1 -nan(ind) Area Total 0.000000 /ndone. your help will really appreciated. thank you. /************************************************** ***** SDOF property compiled UDF with external forces/moments ************************************************** *****/ #include "udf.h" static real acc = 4.631; static real mass = 5; static real velocity, vel, area_tot, area[3]; DEFINE_SDOF_PROPERTIES(acce, prop, dt, time, dtime) { prop[SDOF_MASS] =5; prop[SDOF_IXX] = 8.333e-4; prop[SDOF_IYY] = 4.1667e-3; prop[SDOF_IZZ] = 5.2e-5; prop[SDOF_ZERO_TRANS_X] = False;/* boolean, allow translation in x-direction */ prop[SDOF_ZERO_TRANS_Y] = True; /* boolean, suppress translation in y-direction */ prop[SDOF_ZERO_TRANS_Z] = True; /* boolean, suppress translation in z-direction */ prop[SDOF_ZERO_ROT_X] = True; /* boolean, suppress rotation around x-axis */ prop[SDOF_ZERO_ROT_Y] = True; /* boolean, suppress rotation around y-axis */ prop[SDOF_ZERO_ROT_Z] = False; /* boolean, allow rotation around z-axis */ { #if !RP_HOST Thread *t; face_t f; Domain *domain; int nid; domain = THREAD_DOMAIN (DT_THREAD (dt)); nid = THREAD_ID (DT_THREAD (dt)); t = Lookup_Thread (domain, nid); velocity=0.0; area_tot=0; #endif #if !RP_HOST begin_f_loop(f, t) if (PRINCIPAL_FACE_P(f, t)) { F_AREA(area,f,t); area_tot += NV_MAG(area); velocity += F_U(f, t)*NV_MAG(area); } end_f_loop(f, t) /*area_tot=PRF_GRSUM1(noface); velocity=PRF_GRSUM1(velocity);*/ #if RP_NODE vel = velocity/area_tot; Message("\nV1 %f Area Total %f /n",vel, area_tot); #endif #endif |
|
July 26, 2021, 15:20 |
|
#17 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You added lines where the nodes communicate (PRF_GRSUM1), but they are comments! The solution is right there, why did you remove that part of the code?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
July 27, 2021, 03:54 |
|
#18 | |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
Quote:
Also in writing a string when i use #if RP_NODE and fprintf to write the time and velocity then i still have more than one value for one time step and also there is a value of zero at every time step. These are two confusion which i am facing right now. It would be really nice if you could explain it as i have read the manual and it was really helpful to understand nodes, serial, host, etc. but not understood the above mentioned confusions. Thank you and have a nice day. |
||
July 27, 2021, 10:41 |
|
#19 |
New Member
Burhan Ibrar
Join Date: Dec 2018
Posts: 21
Rep Power: 8 |
||
July 27, 2021, 16:55 |
|
#20 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Hi Burhan,
Well done resolving the issues. Just to help people who visit this thread in future, please could you post a working version of your code? Thanks. Ed |
|
Tags |
6dof, face loop |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF ——wrong on the thread or cell loop? | Steve-Tian | Fluent UDF and Scheme Programming | 2 | April 21, 2019 22:39 |
Fluent UDF for Micro Flow Face Slip Velocity | daniel_george_carter | Fluent UDF and Scheme Programming | 0 | May 12, 2013 06:39 |
UDF for Heat Exchanger model | francois louw | FLUENT | 2 | July 16, 2010 03:21 |
I want to use pressure of 1 face in udf that compiled on other face | iman_1844 | Fluent UDF and Scheme Programming | 3 | June 10, 2010 13:55 |
NACA0012 geometry/design software needed | Franny | Main CFD Forum | 13 | July 7, 2007 16:57 |