-
-
June 13, 2023 at 2:46 am
ISAR CHARMCHI
SubscriberHi, I am trying to model solidifiaction of water-sucrose solution and need to define property by UDFs. While I comiple them succesfully I cannot hook them. Just the density seems to hook succesfully. You can find my UDFs and the error that I get below. I thought it may be the issue of parallelization but I cannot find any guide in the UDF user manual. I think these UDFs series are also fine in parallel. I appreciate if you can guide me. I am also compiling them in HPC in 4 nodes.
#include "udf.h"
DEFINE_PROPERTY(cell_viscosity,c,t)
{
real mu_lam;
real temp = C_T(c,t);
if (temp > 259.25)
mu_lam = ((1.0 / (1.0 + 5.0 * pow(0.1, 3.4) * pow((temp / 273.15), 12.0))) * pow(10.0, (3.8 - 0.013 * temp) + 0.1 * (1.184 + 1.53 * pow(0.1, 4.5) * pow((temp / 273.15), -9.0) * pow(10.0, (0.87 * 0.1)))))/1000;
else
mu_lam = 1.;
return mu_lam;
}#include "udf.h"
DEFINE_PROPERTY(cell_density,c,t)
{
real rho;
real temp = C_T(c,t);
real liqfrac = (temp - 259.25)/(272.52 - 259.25);
if (temp > 272.52)
rho = 1020;
else if (temp > 259.25)
rho = liqfrac * 1020 + (1 - liqfrac) * 931;
else
rho = 931;
return rho;
}#include "udf.h"
DEFINE_PROPERTY(cell_heat_capacity,c,t)
{
real Cp;
real temp = C_T(c,t);
real liqfrac = (temp - 259.25)/(272.52 - 259.25);
if (temp > 272.52)
Cp = 3936;
else if (temp > 259.25)
Cp = liqfrac * 3936 + (1 - liqfrac) * (1116 + 3.34 * temp);
else
Cp = 1116 + 3.34 * temp;
return Cp;
}#include "udf.h"
DEFINE_PROPERTY(cell_ktc,c,t)
{
real ktc;
real temp = C_T(c,t);
real liqfrac = (temp - 259.25)/(272.52 - 259.25);
if (temp > 272.52)
ktc = 0.583 * (1 - 0.585 * 0.1) * (1 + 0.00224 * (temp - 273.15));
else if (temp > 259.25)
ktc = liqfrac * (0.583 * (1 - 0.585 * 0.1) * (1 + 0.00224 * (temp - 273.15))) + (1 - liqfrac) * (7.47 - 0.02925 * temp + 3.646e-5 * temp * temp );
else
ktc = 7.47 - 0.02925 * temp + 3.646e-5 * temp * temp ;
return ktc;
} -
June 13, 2023 at 3:38 am
ISAR CHARMCHI
SubscriberI also added C_UDMI(c,t,0) = mu_lam, C_UDMI(c,t,1) = rho, ... until 4 udmi but still doesn't work,
-
June 13, 2023 at 4:43 am
ISAR CHARMCHI
SubscriberI tried everything that I could think of: Write all of them in a file and compile and load with one file in one library didn't work. I write them separately compile them in different library didn't work. I write them separately compile them in one library didn't work. I compile them in my PC didn't work. In just one node didn't work. When I set the first property the other ones give the error above and for Cp is always the same error. I really have no idea. I thought because of the error is about the name but you have to set the name of function DEFINE_PROPERTY with just three variables. Please guide me through this:)
-
June 13, 2023 at 5:10 am
ISAR CHARMCHI
SubscriberI think the problem is specific heat but I checked materials.h and there is prop_Cp so I should be able to define it by UDF. I really don’t know what I am missing.
-
June 13, 2023 at 6:13 am
ISAR CHARMCHI
SubscriberI think I finally figured it out but have some question regarding cp: I wrote the code below for cp but as I undersdtand cp is not a field but depends on the temperature field that solver solved. I can define it as a parameter related to temperature like below: and how can I save in user define memory?
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp;
real liqfrac = (T – 259.25)/(272.52 – 259.25);
if (T > 272.52)
cp = 3936;
else if (T > 259.25)
cp = liqfrac * 3936 + (1 – liqfrac) * (1116 + 3.34 * T);
else
cp = 1116 + 3.34 * T;
*h = cp*(T-Tref);
return cp;
} -
June 13, 2023 at 2:46 pm
Rob
Ansys EmployeeWhy do you need it as a UDM?
-
June 13, 2023 at 2:48 pm
ISAR CHARMCHI
SubscriberUsed defined memory so that I can check the value later on the post-processing each time step. Also, specific heat is a cell-based value? T here is the same as C_T(c,t)?
-
June 13, 2023 at 3:00 pm
Rob
Ansys EmployeeYou can report/plot the cp directly when you open the data file.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

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.
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Difference between K-epsilon and K-omega Turbulence Model
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Suppress Fluent to open with GUI while performing in journal file
- Mesh Interfaces in ANSYS FLUENT
- Time Step Size and Courant Number
- error: Received signal SIGSEGV
-
7742
-
4502
-
2959
-
1449
-
1322
© 2023 Copyright ANSYS, Inc. All rights reserved.