TAGGED: fluent, pcm-charging-discharging, porosity, porous, udf
-
-
October 17, 2023 at 5:56 pm
Robbie Crosby
SubscriberHello, I am trying to create a UDF to fit a numerical model which must be applied as UDFs in ANSYS Fluent to model a phase change material in a porous medium. I have attached the mathematical model I am trying to follow as well as my current code. I am currently stuck on getting the interstitial heat transfer coefficient to come up as a UDF, that can be selected in ANSYS Fluent, for the non-equilibrium model of porous medium. Any help would be greatly appreciated. Should it be define_profile or define_property
#include "udf.h"
#include "mem.h"
#define Tsolidus 300.0
#define Tliquidus 304.0
#define L_f 250 //Latent heat of fusion
#define UDM_RHO_F_PREV 0 // UDM index for storing previous rho_f
#define UDM_LAMBDA_PREV 1 // UDM index for storing previous lambda
DEFINE_PROFILE(h_sfq, c, t)
{
real dl, epsilon, mu, nu, pr, rho_pcm, u, v, mu_pcm, k_pcm, Re_d, h_sfq, local_h_sfq;
cell_t cell;
dl = 0.0194; //Diameter Matlab
epsilon = 0.85; //Porosity Matlab
mu = C_MU_L(c, t); // Laminar viscosity
rho_pcm = C_R(c, t); // Density
nu = mu/rho_pcm; // Kinematic Viscosity
pr = nu/rng_alpha(1., mu, mu); // Prandtl Number
u = C_U(c, t);
v = C_V(c, t);
mu_pcm = C_MU_L(c ,t);
k_pcm = C_K_L(c, t);
Re_d = (rho_pcm * sqrt(u*u + v*v) *dl) / (epsilon * mu_pcm);
if (Re_d > 0 && Re_d <= 40)
local_h_sfq = (0.76 * pow(Re_d, 0.4) * pow(pr, 0.37) * k_pcm)/dl;
else if (Re_d > 40 && Re_d <= 1000)
local_h_sfq = (0.52 * pow(Re_d, 0.5) * pow(pr, 0.37) * k_pcm)/dl;
else if (Re_d > 1000 && Re_d <= 20000)
local_h_sfq = (0.26 * pow(Re_d, 0.6) * pow(pr, 0.37) * k_pcm)/dl;
else
return local_h_sfq;
}
-
October 27, 2023 at 11:31 am
Atharva Nagarkar
SubscriberHello,
The DEFINE_PROFILE macro is used to define a custom boundary profile or cell zone condition that varies as a function of spatial coordinates or time while you can use the DEFINE_PROPERTY to specify a custom material property in Ansys Fluent for single-phase and multiphase flows. Based on this, the DEFINE_PROPERTY macro would be more suited for your use.
Please find the links from the Ansys UDF Manual related to both these macros. Check sections 2.3.29 and 2.3.30. I would also request you to have a look at the examples given below these sections to understand the use of these DEFINE macros.
2.3. Model-Specific DEFINE Macros (ansys.com)
If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)
Thanks!
-
- 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.
- FLUENT
- Unable to open SC files
- PyMAPDL Course Element Plot
- How to apply Neumann Boundary Condition?
- Trouble with Sod Shock Tube Simulation Example
- Solidification and melting
- How to Use Field Function in ANSYS Fluent Lesson 1 Tutorial
- How to collect data and create plane on the hole
- Weld simulation in ANSYS
- CHEMKN mechanism technical problems
-
8808
-
4658
-
3153
-
1688
-
1478
© 2023 Copyright ANSYS, Inc. All rights reserved.