-
-
October 5, 2018 at 11:48 am
Karthik K R
SubscriberHow can i introduce a UDF of density and depth.
That is density varying linearly with depth. -
October 5, 2018 at 11:49 am
Karthik K R
SubscriberIn order to get a linearly stratified medium.
Thanks
Karthik -
October 5, 2018 at 12:01 pm
Karthik R
AdministratorHello,
Please check out the DEFINE_PROPERTY UDF macro in the Fluent Customization manual. There are some examples such as defining viscosity as a function of temperature, and density function for compressible fluids. You might want to make density a function of your coordinate which indicates depth.
You might also want to look into this example - "UDF for specifying an x-momentum source term in a spatially dependent porous media". This will give you some idea as to how to use the centroid macro in such UDFs.
I hope this helps.
Best Regards,
Karthik
-
October 6, 2018 at 6:32 am
Karthik K R
SubscriberCan any one please help me writing the UDF function
Its a function of detph
Density varies linearly with depth
Assuming the fuction as f(x) -
October 6, 2018 at 6:33 am
Karthik K R
SubscriberDepth is the y-coordinate -
October 6, 2018 at 10:03 pm
Karthik R
AdministratorHello,
I'd strongly recommend you go through the Fluent customization manual. It contains several examples. You might find a similar UDF which you can make small modifications to suit your needs. I've found this approach to writing UDFs extremely useful. I'll let other members of this community weigh in their opinions.
Thank you.
Best Regards,
Karthik
-
October 7, 2018 at 6:40 am
Karthik K R
SubscriberI am very new to this .. it will be really helpful if any body could help me..please.. -
October 7, 2018 at 12:31 pm
raul.raghav
SubscriberKKR, attached is a snippet of the UDF you need.
DEFINE_PROPERTY(density_function,c,t)
{
real rho;
real y, x[ND_ND];
C_CENTROID(x,c,t);
y = x[1];
rho = /*define your function rho(y)*/ ;
return rho;
}
And as Karthik (Kremella) mentioned, you need to go through the given examples to write your own UDFs. And if you are writing a complicated UDF, you can ask specific questions and users of the community would be of help. Good luck!
-
October 7, 2018 at 12:35 pm
Karthik K R
SubscriberThanks a lot for the replay... -
October 7, 2018 at 7:18 pm
DrAmine
Ansys EmployeeWhat is the fluid used here? Are you trying to model atmospheric problem? Using DEFINE_PROPERTY for density is generally only suitable for temperature depdendency or for compressible liquid (small compressibility).
-
October 8, 2018 at 3:44 am
Karthik K R
SubscriberFluid is water.. and i want to create a linearly density stratified medium. That is density increases linearly with depth(y axis). I want simulate sea condition (pycnocline) -
October 8, 2018 at 7:41 am
Karthik K R
SubscriberThis code is not working properly.
There is an error 'undefined variable x) -
October 8, 2018 at 7:42 am
Karthik K R
SubscriberCan you please verify and debug the code. -
October 8, 2018 at 7:50 am
DrAmine
Ansys EmployeeFirst of all ANSYS Stuff colleagues are not here to debug your code as this is mainly your task. We are here only to provide guidance.
The snipped provided has to work:
#include "udf.h"
DEFINE_PROPERTY(density_function,c,t)
{
real rho;
real y, x[ND_ND];
C_CENTROID(x,c,t);
y = x[1];
rho =y*1000 ;/*define your function rho(y)*/
return rho;
}
You might past you final function here.
-
October 8, 2018 at 7:53 am
Karthik K R
SubscriberI have done the same . But there is an error can 'undefined variable x') -
October 8, 2018 at 8:15 am
DrAmine
Ansys EmployeePaste your UDF here.
-
October 8, 2018 at 8:59 am
Karthik K R
SubscriberError: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64).nnThe system cannot find the path specified.
nnC:UsersSunayanDesktopKARNAV20.7 successfulGEOM AND MESH1_filesdp0FFFFluentlibudfwin643ddp_hostlibudf.dll -
October 8, 2018 at 9:00 am
Karthik K R
Subscriberwhile I complied my code this error popped up. how can I rectify this problem.
-
October 8, 2018 at 9:28 am
DrAmine
Ansys EmployeeYou go under Mange to unload any loaded libraries. Then you comple the UDF once again and load it.
-
October 8, 2018 at 9:29 am
DrAmine
Ansys EmployeeYou go under Mange to unload any loaded libraries. Then you comple the UDF once again and load it.
-
October 8, 2018 at 9:58 am
Karthik K R
Subscriberyes I did that still there is problem
-
October 8, 2018 at 9:59 am
Karthik K R
SubscriberError: The UDF library you are trying to load (C:UsersSunayanDesktopKARNAV20.7 successfulGEOM AND MESH1_filesdp0FFFFluentlibudf) is not compiled for 3ddp on the current platform (win64).nnThe system cannot find the path specified.
nnC:UsersSunayanDesktopKARNAV20.7 successfulGEOM AND MESH1_filesdp0FFFFluentC:UsersSunayanDesktopKARNAV20.7 successfulGEOM AND MESH1_filesdp0FFFFluentlibudfwin643ddplibudf.dll
Error Object: #f
-
October 8, 2018 at 10:27 am
DrAmine
Ansys EmployeeTerminate Fluent. Compile and try again. You can even try Standalone.
-
October 10, 2018 at 1:51 am
Karthik K R
SubscriberThank you raul.raghav,abenhadj for the advice.thank you very much. -
October 10, 2018 at 5:19 am
DrAmine
Ansys EmployeeYou are welcome and thanks for marking this issue as resolved.
-
- 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
-
2524
-
2066
-
1279
-
1096
-
457
© 2023 Copyright ANSYS, Inc. All rights reserved.