|
[Sponsors] |
April 13, 2015, 22:32 |
UDF on cluster
|
#1 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Hi All
I am compiling a UDF then saving the case file for submission to cluster. But it returns an error file saying the UDF file doesnt exist when I submit the job to cluster. It works until it tries to load the UDF file but then crashes. I have tried changing the format from dos2unix in the submission file for the cluster but this does not solve the problem. Been searching on this forum as well but couldn't find a specific answer. Any help? Why is there a need to load the UDF file again anyways if i already loaded it and then saved the case file. |
|
April 14, 2015, 10:04 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Your udf code is not saved inside the cas-file, only a link to the udf code is saved in the cas-file.
If you only copy the cas-file to the cluster, the cluster will see the link to the udf code, but can not find the udf code (because it is not on the cluster). You should also copy the udf-code to the cluster and compile it there. |
|
April 14, 2015, 12:04 |
|
#3 |
Senior Member
Tanjina Afrin
Join Date: May 2013
Location: South Carolina
Posts: 169
Rep Power: 13 |
Please go through the Ansys UDF manual...... there you will find the steps to do the UDF compilation in cluster. in summary, you have to copy the UDF to cluster and compiled the UDF on cluster ( as you do in your PC). Compiled in your PC and then copy that file to cluster will not work.
|
|
April 15, 2015, 00:15 |
|
#4 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Yes that is actually what I had been doing compiling in windows and just copying the file in the cluster then. This is the wrong way of doing it.
Compiling it in windows and then again in cluster also does not work. The way to do it is just save the case file in cluster (without hooking the UDF) then compile it in the input file which is submitted to the cluster. If it is compiled in Windows as well, it tends to crash even before it tries to compile it on the cluster. I suppose because the case file written in Windows has the UDF compiled in it but the cluster gets confused. Also, the UDF manual explains to copy the src files from the installation directory, copy "make" files and so on which is not required I think because when you compile the UDF, Fluent automatically creates all the files which are stated in steps for compiling a UDF in Windows as well as Linux which can be found in the libudf folder created when you compile a UDF. I found that all the files the UDF manual says you have to copy/create are already made in that folder by Fluent, and this i suppose is a bit misleading from my understanding. (Any comments on this?) Thanks |
|
February 7, 2020, 15:20 |
|
#5 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 7 |
Hello
Could you please share the coding for compiling a udf while submitting to a cluster? I am not good in coding. |
|
February 9, 2020, 16:00 |
No code needed
|
#6 |
Senior Member
|
You don't need coding to be able to compile or load a UDF. Just a few text commands will do the job.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 10, 2020, 18:55 |
|
#7 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 7 |
I have found the commands. Thank you.
I reached pseudo-steady state in transient simulation. Then increased the inlet velocity and continued this job further, however, this time with a udf for drag coefficient. I am facing issues while compiling in another server. The steps that I have used are listed below. 1) Compiled a 'test' case file in the server. 2) I could see the newly generated libudf in the server folder. 3) Compiled and loaded the actual case and data file in my computer. Transferred this to the server folder. 4) Started the simulation in the server. The job stopped immediately and I checked the error file. The details in the error file is shown below. However, the simulation converges when I don't use the udf. sched_setaffinity() call failed: Invalid argument sched_setaffinity() call failed: Invalid argument Error at host: floating point exception Error at Node 2: floating point exception Error at Node 5: floating point exception Error at Node 0: floating point exception Error at Node 1: floating point exception Error at Node 4: floating point exception Error at Node 7: floating point exception Error at Node 6: floating point exception Error at Node 3: floating point exception Error: floating point exception Error Object: #f Is the procedure incorrect or do I have to work on my time step size and mesh? |
|
February 10, 2020, 22:33 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show your UDF,
show log file after code compilation most likely you have problems with code
__________________
best regards ****************************** press LIKE if this message was helpful |
|
February 11, 2020, 04:20 |
Architecture
|
#9 |
Senior Member
|
It is quite possible that the hardware architectures or the OS on your computer and the server are different. If that is the case, then you will have to compile the UDF on the server. The one compiled on your computer will not work. You also have to ensure that the UDF is parallelized and compiled in parallel if you are running the simulation in parallel.
The error that you are receiving has got nothing to do with the UDF. This is about affinity of the processors.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 11, 2020, 17:12 |
|
#10 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 7 |
Hello AlexanderZ
1) udf is shown below. I think I have written the udf incorrectly. Looks like I have interchanged the gas and liquid phase values while calculating the diameter of air bubble (should be thread_f instead of thread_g and to calculate rho_f it should be thread_g instead of thread_f). Kindly correct me if I have understood it wrong. #include "udf.h" /*#define pi 4.*atan(1.)*/ DEFINE_EXCHANGE_PROPERTY(drag_coefficient, cell, mix_thread, s_col, f_col) { Thread* thread_f, * thread_g; real x_vel_f, x_vel_g, y_vel_f, y_vel_g, z_vel_f, z_vel_g; real rho_f, diam, ci_K, fi_n, fac; real slip_x, slip_y, slip_z, abs_v; real reyp, c_D; thread_f = THREAD_SUB_THREAD(mix_thread, s_col); /* liquid phase */ thread_g = THREAD_SUB_THREAD(mix_thread, f_col); /* gas phase*/ x_vel_f = C_U(cell, thread_f); y_vel_f = C_V(cell, thread_f); z_vel_f = C_W(cell, thread_f); x_vel_g = C_U(cell, thread_g); y_vel_g = C_V(cell, thread_g); z_vel_g = C_W(cell, thread_g); slip_x = x_vel_g - x_vel_f; slip_y = y_vel_g - y_vel_f; slip_z = z_vel_g - z_vel_f; diam = C_PHASE_DIAMETER(cell, thread_g); rho_f = C_R(cell, thread_f); ci_K = 0.32; fi_n = 0.68; abs_v = sqrt(slip_x * slip_x + slip_y * slip_y + slip_z * slip_z); fac = 2 - fi_n; reyp = rho_f * pow(abs_v, fac) * pow(diam, fi_n) / (ci_K); if (reyp < 135) c_D = ((16 / reyp) * (1 + (0.173 * pow(reyp, 0.657)))) + (0.413 / (1 + (16300 * pow(reyp, -1.09)))); else c_D = 0.95; return c_D; } 2) Got the below error. sched_setaffinity() call failed: Invalid argument sched_setaffinity() call failed: Invalid argument Error at host: floating point exception Error at Node 2: floating point exception Error at Node 5: floating point exception Error at Node 0: floating point exception Error at Node 1: floating point exception Error at Node 4: floating point exception Error at Node 7: floating point exception Error at Node 6: floating point exception Error at Node 3: floating point exception Error: floating point exception Error Object: #f |
|
February 11, 2020, 17:18 |
|
#11 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 7 |
Hello vinerm
I compiled a test file on the server to obtain the libudf in the server folder. I compiled and loaded the udf separately in the actual file that I want to work with using my computer. Submitted this new udf loaded file to the server to run the simulation. Could it be that I have compiled it twice is the reason for the issue? And yes simulation is running in parallel. IS there any different method to parallelize a udf? |
|
February 11, 2020, 17:44 |
Compilation
|
#12 |
Senior Member
|
UDF compilation is conversion of the source code to binary executable and linkable format and these formats are OS specific. If the OS on your computer and the cluster are same, then the compiled library from your computer will work with cluster as well, otherwise it won't.
Compilation twice is not an issue; it overwrites the library, provided the library is not in use at the time of compilation. To parallelize the UDF, all you need to do is add #if !RP_HOST after opening braces and #endif before closing braces
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
February 11, 2020, 18:03 |
|
#13 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 7 |
Hello vinerm
I tried to run the simulation separately in the server and in my computer with the udf. In either case, the simulation ends due to divergence, reporting floating point exception. But, without the udf it converges and runs well. So if it was the OS mismatch issue, should the simulation not run properly when I try it in my computer alone without linking to the server? And about the parallelization, is the udf not automatically parallelized if I open and save my case file in parallel mode followed by compiling it using a cluster where I specify the number of processors in the .sh file? In which file should the code that you have mentioned be used? Last edited by melj; February 11, 2020 at 20:09. |
|
February 12, 2020, 03:40 |
|
#14 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
this code doesn't need to be parallelized
UDF library is suitable for parallel when: 1. it has parallelized code 2. compiled successfully from Fluent in parallel regime compile UDF both in your machine and on cluster to avoid any probems with version mismatch use your home machine and fix issues with UDF first, then use cluster if you think (should be thread_f instead of thread_g and to calculate rho_f it should be thread_g instead of thread_f) try it and see, what happens from manual you can find Code:
DEFINE_EXCHANGE_PROPERTY(custom_lift,c,t,i,j) { /* i -- liquid-phase; j -- vapor-phase */ TRY to change c_D to any other name for example my_drag_coefficient
__________________
best regards ****************************** press LIKE if this message was helpful |
|
February 12, 2020, 13:48 |
|
#15 |
Member
mln
Join Date: Dec 2019
Posts: 39
Rep Power: 7 |
Thank you AlexanderZ. I will try the changes.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem loading UDF library in parallel cluster | Veera Gutti | FLUENT | 8 | July 26, 2016 08:24 |
udf for multiple reaction | alihosseini63 | Fluent UDF and Scheme Programming | 0 | July 4, 2013 19:37 |
Help me to check my UDF | Liufeng_ustb | Fluent UDF and Scheme Programming | 2 | May 7, 2013 11:25 |
parse error while interpreting udf | Kristin | Fluent UDF and Scheme Programming | 3 | March 15, 2012 07:43 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |