|
[Sponsors] |
March 21, 2014, 12:16 |
Parallelize UDF? Which kind of UDF?
|
#1 |
Senior Member
Join Date: Feb 2011
Posts: 140
Rep Power: 15 |
Dear all,
I am a bit confused about which kind of UDF I have to parallelize, when I use several nodes for calculation. I was told that I don't have to parallelize a viscosity UDF (DEFINE-PROPERTY), since the calculation only uses information from the same cell. Now, I also wrote a UDF for a velocity an mass fraction profile (DEFINE_PROFILE) at the inlet of my geometry and a UDF to define my mass diffusion coefficent depending on the strain rate (DEFINE_DIFFUSIVITY). I didn't parallelize them, but they seem to work. I now read that DEFINE_PROFILE udfs should be parallelized as well. Is this true? And what about the diffusivity? And would I have gotten an error message, if the udf didn't have worked in parallel mode, or shouldn't I trust the results now? Thank you for any help! Lilly |
|
March 21, 2014, 12:30 |
|
#2 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
I'm also curious about this question, as I also worked with udfs and parallel cores without changing the code, and also to me it seems all was ok.
All I can say is that the need of parallelizing an udf depends also on the way the mesh is partitioned among the different nodes; for example, if the inlet belongs only to a single node and you apply the udf, I think it doesn't need to be parallelized; on the contrary it should be parallelized if the inlet is divided among different nodes (..but I'm not 100% sure). Awaiting for other replies. Daniele |
|
March 21, 2014, 15:33 |
|
#3 |
Super Moderator
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,385
Blog Entries: 23
Rep Power: 29 |
Hope this can help https://dl.dropboxusercontent.com/u/...n-parallel.pdf
|
|
March 24, 2014, 03:28 |
|
#4 |
Senior Member
Join Date: Feb 2011
Posts: 140
Rep Power: 15 |
Thank you Daniele and thank you diamondx for your help!
Your replies helped me a lot and the link is really helpful! So maybe you can also help me with another question (since I am really bad with C). This is my udf: #include "udf.h" #include "math.h" #define MU_INF 0.035 #define N_INF 1 #define DELTA_MU 0.25 #define DELTA_N 0.45 #define A 50 #define B 3 #define C 50 #define D 4 #define Dconst 1.5e-10 real mu; real lambda; real n; real strain; real d; DEFINE_PROPERTY(cell_viscosity, c, t) { strain = C_STRAIN_RATE_MAG(c, t); lambda = MU_INF+DELTA_MU*exp(-(1.+fabs(strain)/A)*exp(-B/fabs(strain))); n = N_INF-DELTA_N*exp(-(1.+fabs(strain)/C)*exp(-D/fabs(strain))); mu = 0.1*lambda*pow(fabs(strain),(n-1.)); return mu; } DEFINE_DIFFUSIVITY(diffusivity, c, t, i) { strain = C_STRAIN_RATE_MAG(c, t); d = 0.53*Dconst+5.292e-9*strain; return d; }
Lilly |
|
March 24, 2014, 04:39 |
|
#5 | |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
Quote:
Probably you would have error if you define that values as integer. For the second point, reading diamondx's document I understand that you have not to parallelize the udf, since, as you're writing, they are only working at each single cell. Daniele |
||
March 25, 2014, 03:05 |
|
#6 |
Senior Member
Join Date: Feb 2011
Posts: 140
Rep Power: 15 |
Thanks a million for this information and all your help, Daniele!
I am relieved to hear that! I hope I'll get better with C language and udfs soon... I wish you all the best! Lilly |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF using c_face_loop(c,t,i) | frederic | FLUENT | 3 | January 17, 2017 00:17 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
Simulation with UDF for species mass fraction and velocity profile | virgy | Fluent UDF and Scheme Programming | 8 | February 7, 2012 05:30 |
UDF programming | fullmonty | FLUENT | 5 | June 30, 2011 03:40 |
Kind attn:problem in DEFINE_SOURCE in my UDF | Phanindra | FLUENT | 1 | February 23, 2007 10:03 |