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

Parallelize UDF? Which kind of UDF?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree5Likes
  • 1 Post By Lilly
  • 1 Post By ghost82
  • 3 Post By diamondx

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2014, 12:16
Default Parallelize UDF? Which kind of UDF?
  #1
Senior Member
 
Join Date: Feb 2011
Posts: 140
Rep Power: 14
Lilly is on a distinguished road
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
ghost82 likes this.
Lilly is offline   Reply With Quote

Old   March 21, 2014, 12:30
Default
  #2
Senior Member
 
ghost82's Avatar
 
Daniele
Join Date: Oct 2010
Location: Italy
Posts: 1,016
Rep Power: 25
ghost82 will become famous soon enough
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
Lilly likes this.
ghost82 is offline   Reply With Quote

Old   March 21, 2014, 15:33
Default
  #3
Super Moderator
 
diamondx's Avatar
 
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,385
Blog Entries: 23
Rep Power: 27
diamondx will become famous soon enough
Hope this can help https://dl.dropboxusercontent.com/u/...n-parallel.pdf
macfly, ghost82 and Lilly like this.
__________________
Regards,
New to ICEM CFD, try this document --> https://goo.gl/KAOIwm
Ali
diamondx is offline   Reply With Quote

Old   March 24, 2014, 03:28
Default
  #4
Senior Member
 
Join Date: Feb 2011
Posts: 140
Rep Power: 14
Lilly is on a distinguished road
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;
}


  • I just realized I didn't but a point behind the defined values of N_INF A B C D (so if I got it right it's an integer instead of a floating point number). I already used this udf in several simulations and I didn't realize something strange. Do you know whether Fluent does have problems with this or whether the solution of the udf would be different, if I would have defined A B C D and N_INF as integer?
  • Concerning my original question: I hope I also got it right, that I don't have to parallelize the viscosity and diffusivity udf, since they are only working at each single cell and don't need to correspond? I guess it's the same for the Macro C_STRAIN_RATE_MAG(c, t) I used there, isn't it?
Thank you for any help!
Lilly
Lilly is offline   Reply With Quote

Old   March 24, 2014, 04:39
Default
  #5
Senior Member
 
ghost82's Avatar
 
Daniele
Join Date: Oct 2010
Location: Italy
Posts: 1,016
Rep Power: 25
ghost82 will become famous soon enough
Quote:
Originally Posted by Lilly View Post
  • I just realized I didn't but a point behind the defined values of N_INF A B C D (so if I got it right it's an integer instead of a floating point number). I already used this udf in several simulations and I didn't realize something strange. Do you know whether Fluent does have problems with this or whether the solution of the udf would be different, if I would have defined A B C D and N_INF as integer?
  • Concerning my original question: I hope I also got it right, that I don't have to parallelize the viscosity and diffusivity udf, since they are only working at each single cell and don't need to correspond? I guess it's the same for the Macro C_STRAIN_RATE_MAG(c, t) I used there, isn't it?
Hi, your undefined "integer" values will be automatically converted because you defined the other variables as real, and in C language you cannot perform operations between integer and real values.
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
ghost82 is offline   Reply With Quote

Old   March 25, 2014, 03:05
Default
  #6
Senior Member
 
Join Date: Feb 2011
Posts: 140
Rep Power: 14
Lilly is on a distinguished road
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
Lilly is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 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


All times are GMT -4. The time now is 12:32.