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

UDF Error

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 6, 2023, 05:40
Default UDF Error
  #1
New Member
 
Fareeha Ahmed
Join Date: Apr 2023
Posts: 4
Rep Power: 3
Fareeha1 is on a distinguished road
Hi,

I have recently encountered an issue with my UDF for the two transport equations of the wet stem model in Ansys Fluent. Despite my best efforts, the software shuts down every time I attempt to interpret the UDF. Is there anyone who may have encountered similar problems in the past.
Is there something wrong with the UDF?
Fareeha1 is offline   Reply With Quote

Old   June 8, 2023, 09:15
Default
  #2
Member
 
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6
Siba11 is on a distinguished road
Hi. Can you please share your UDFs?

Also, try compiling it instead of interpreting.
Siba11 is offline   Reply With Quote

Old   June 9, 2023, 03:39
Default
  #3
New Member
 
Fareeha Ahmed
Join Date: Apr 2023
Posts: 4
Rep Power: 3
Fareeha1 is on a distinguished road
#include "udf.h"
#include <cmath>

const double R = 8.314;
const double M_m = 18.01528;

double LiquidMassFractionAndDropletGrowthRate(
double rho_l,
double rho_v,
double T_v,
double T_d,
double p,
double p_sat,
double sigma,
double h_vl,
double C_pv,
double alpha,
double gamma,
double droplet_radius)
{
// Calculate the Kelvin-Helmholtz critical radius.
double r_star = 2.0 * sigma / (rho_l * R * T_v * log(p / p_sat));

// Calculate the non-isothermal correction coefficient.
double C = 2.0 * (gamma - 1.0) / (gamma + 1.0) * h_vl / (R * T_v) * (h_vl / (R * T_v) - 0.5);

// Calculate the condensation coefficient.
double q_c = alpha * C;

// Calculate the nucleation rate.
double J_d = q_c / (1 + C) * sqrt(2.0 * sigma / (M_m * M_PI)) * exp(-(4.0 * M_PI * pow(r_star, 2) * sigma) / (3.0 * R * T_v));

// Calculate the droplet volume.
double V_d = 4.0 / 3.0 * M_PI * pow(droplet_radius, 3);

// Calculate the number of droplets per unit volume.
double N = 1.0 / ((1.0 - rho_v / rho_l) * V_d);

// Calculate the mass production rate.
double m_star = 4.0 / 3.0 * M_PI * rho_l * J_d * pow(r_star, 3) + 4.0 / 3.0 * M_PI * rho_l * N * pow(droplet_radius, 2) * dr_dt;

// Calculate the liquid mass fraction.
double beta = m_star / (rho_l * V_d * N);

// Calculate the droplet growth rate.
double lambda_v = C_pv * (gamma - 1.0) * T_v / gamma;
double Pr = 1.0; // Placeholder value for Pr, replace with appropriate value
double dr_dt = (lambda_v * (T_d - T_v)) / (h_vl * rho_l * droplet_radius) * ((1.0 - r_star / droplet_radius) / ((1.0 + 2.0 * phi * Kn) / Pr + 3.78 * (1.0 - psi) * Kn));

// Return the droplet growth rate.
return dr_dt;
}

DEFINE_ON_DEMAND(LiquidMassFractionAndDropletGrowt hRateUDF)
{
double growth_rate = LiquidMassFractionAndDropletGrowthRate(rho_l, rho_v, T_v, T_d, p, p_sat, sigma, h_vl, C_pv, alpha, gamma, droplet_radius);

Message("Droplet Growth Rate: %f\n", growth_rate);
}
Fareeha1 is offline   Reply With Quote

Old   June 10, 2023, 13:28
Default
  #4
Member
 
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6
Siba11 is on a distinguished road
Hi. All header files should be included within double inverted commas.

Also, inside the DEFINE_ON_DEMAND block, how are you obtaining the values of rho_l, rho_v, T_v, etc before you pass them as arguments?
Siba11 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 for DPM particle deposition modelingpa haghshenasfard Fluent UDF and Scheme Programming 10 September 15, 2019 02:03
Undeclared Identifier Errof UDF SteveGoat Fluent UDF and Scheme Programming 7 October 15, 2014 07:11
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 06:42
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 02:32
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


All times are GMT -4. The time now is 00:39.