|
[Sponsors] |
June 6, 2023, 06:40 |
UDF Error
|
#1 |
New Member
Fareeha Ahmed
Join Date: Apr 2023
Posts: 4
Rep Power: 3 |
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? |
|
June 8, 2023, 10:15 |
|
#2 |
Member
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6 |
Hi. Can you please share your UDFs?
Also, try compiling it instead of interpreting. |
|
June 9, 2023, 04:39 |
|
#3 |
New Member
Fareeha Ahmed
Join Date: Apr 2023
Posts: 4
Rep Power: 3 |
#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); } |
|
June 10, 2023, 14:28 |
|
#4 |
Member
Odisha
Join Date: Jan 2020
Posts: 59
Rep Power: 6 |
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? |
|
|
|
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 03:03 |
Undeclared Identifier Errof UDF | SteveGoat | Fluent UDF and Scheme Programming | 7 | October 15, 2014 08:11 |
ParaView for OF-1.6-ext | Chrisi1984 | OpenFOAM Installation | 0 | December 31, 2010 07:42 |
Installation OF1.5-dev | ttdtud | OpenFOAM Installation | 46 | May 5, 2009 03:32 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |