-
-
September 11, 2018 at 1:31 am
birbara2
SubscriberI get 0 velocity inlet when using UDF
-
September 11, 2018 at 9:13 am
Nownesh
Ansys EmployeeHello,
Can you check if you are accessing variables at cell or face? You want the DEFINE_PROFILE macro that's described in the ANSYS Customisation manual.
-
September 12, 2018 at 5:15 pm
birbara2
Subscriber#include "udf.h"
DEFINE_PROFILE(inlet_velocity,thread,nv)
{
float position[3];
float x,y,z;
face_t f;
begin_f_loop(f,thread)
{
F_CENTROID(position,f,thread);
x= position[0];
y=position[1];
z=position[2];
F_PROFILE(f,thread,nv)=0.1;
}
end_f_loop(f,thread)
}
This is my UDF. Anything wrong with it? -
September 13, 2018 at 10:32 am
Rob
Ansys EmployeeHave a look in the UDF manual as there's an example there. You also need to hook the UDF up to the velocity inlet after you interpret or compile it.
-
September 13, 2018 at 6:14 pm
Konstantine Kourbatski
Ansys EmployeeProfile distribution will not be immediately visible when post-processing the variable using either Fluent’s native post-processing or CFD-post. Post-processing functions in Fluent and CFD-post operate on flow variables stored at cell centers, and they will not show profile distribution which is applied to cell faces.
One workaround for a profile to become visible in post-processing is to iterate the solution to a certain degree of convergence. In a converged solution, flow variables at centers of the cells adjacent to the boundary will have values close to those specified at the boundary faces, and their post-processing interpolation to the boundary will show a distribution close to that of the specified profile. This workaround may not be always practical especially for large cases when it is desirable to confirm correctness of a profile distribution before investing into converging a solution.
In addition, since cell centered values are calculated by solving discretized flow equations, they are not exactly equal to face values, and post-processed boundary distribution will deviate slightly from its prescribe profile. This discrepancy will be negligible if the mesh next to the boundary is fine enough, but it can be noticeable on a coarser mesh.
Another approach of displaying a profile distribution is to extract exact cell face values specified at the boundary using a user-defined function (UDF), store them into a user-defined memory (UDM) location and post-process this UDM without node value, which will yield a profile distribution exactly as it was specified.
Check using either of these approach a distribution of your profile
-
September 13, 2018 at 6:49 pm
Raef.Kobeissi
SubscriberHi,
Have a look at this example:
-
September 18, 2018 at 6:55 pm
birbara2
SubscriberThis example shows using a profile type. For my case, I am compiling the UDF then using it instead of a "constant" inlet velocity
-
September 19, 2018 at 1:48 am
Karthik R
AdministratorHello,
When you compile the UDF, do you see any errors? Are you able to use the UDF being added in the drop-down list in your velocity inlet boundary condition panel? Are you able to select it and hook it to the boundary condition?
There are UDF samples in the Fluent Customization Manual for velocity inlet boundary condition. You could try one of those to make sure UDF work on your system and that you have all the prerequisites installed for successfully compiling your UDF.
Thank you.
Best Regards,
Karthik
-
September 19, 2018 at 2:55 pm
birbara2
SubscriberI am able to interpret it and hook it up to the BC. I think it should be a convergence problem maybe. Is the absolute criteria for convergence always a good way to go? Continuity doesn't seem to converge to 1e-3...
-
September 19, 2018 at 3:51 pm
Karthik R
AdministratorHello,
This seems to be a completely different issue. Could you please create a new post and explain what you are attempting to model? Convergence issues can be because of several reasons - incorrect boundary conditions, improper model set-up, bad initial conditions, non-linearity in model, and mesh issues. You will have to explain your model set-up and its application better.
Creating a new post will provide your question better visibility on the community.
Thank you.
Best Regards,
Karthik
-
September 19, 2018 at 3:52 pm
birbara2
SubscriberOk should I close this one then? or just leave it as is?
-
September 19, 2018 at 3:53 pm
birbara2
Subscriberand one last question, is there any limitation on the type of functions the UDF supports? exponential , cosine, sine and so on...?
-
September 19, 2018 at 3:58 pm
Karthik R
AdministratorHello,
No, there is no limitation on the type of functions you can code using UDFs.
About this post, it is recommended that you like useful responses and mark the most useful response that resolved your original question as 'Is Solution'. This will greatly benefit someone who has a similar question.
Here are the Guidelines for Posting on the Community
Hope this helps.
Best Regards,
Karthik
-
- You must be logged in to reply to this topic.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Difference between K-epsilon and K-omega Turbulence Model
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error in cfd post
-
2600
-
2086
-
1317
-
1108
-
459
© 2023 Copyright ANSYS, Inc. All rights reserved.