-
-
August 16, 2024 at 1:47 amkiran.purushothamakeshavanSubscriber
I get this error when I use run simulation with this UDF:
#include "udf.h"#include "dpm.h"#include#define Rho_air 1.225#define mu 0.5#define PI 3.14#define VISC 1.7894e-05 // dynamic viscosity of air#define Rho_p 1550FILE *fp1;DEFINE_DPM_DRAG(particle_drag_force, Re, p){  Â  real b1, b2, b3, b4, Cd, drag_force, A, radius, df;  real shf = 1;  real nf, ff;  Thread* tcell = P_CELL_THREAD(p);  cell_t c = P_CELL(p);  real relVel[ND_3], dvtdn, fluidVel[ND_3];  // Fluid velocity  NV_D(fluidVel, =, C_U(c, tcell), C_V(c, tcell), C_W(c, tcell));  // Assign fluid velocity components to vector  // Relative velocity  NV_VV(relVel, =, fluidVel, -, P_VEL(p));             // Calculate relative velocity of flow on particle by subtracting absolute particle velocity from fluid velocity  dvtdn = NV_MAG(relVel);                      // Calculate relative velocity magnitude  radius = P_DIAM(p) / 2.0;  A = PI * radius * radius;  b1 = exp(2.3288 - 6.4581 * shf + 2.4456 * pow(shf, 2));  b2 = 0.0964 + 0.5565 * shf;  b3 = exp(4.905 - 13.8944 * shf + 18.4222 * pow(shf, 2) - 10.2599 * pow(shf, 3));  b4 = exp(1.4681 + 12.2584 * shf - 20.7322 * pow(shf, 2) + 15.8855 * pow(shf, 3));  Cd = (24 * (1 + b1 * pow(Re, b2)) / Re) + (b3 * Re / (b4 + Re));  // Store drag force and other quantities in UDMs  df = (1 / 2) * Rho_p * A * Cd * (dvtdn * dvtdn);  // Store quantities in UDMs  C_UDMI(c, tcell, 0) = df;      // Store drag force  C_UDMI(c, tcell, 1) = dvtdn;     // Store relative velocity  nf = C_P(c, tcell) * A;    // Calculate some quantity 'nf'  C_UDMI(c, tcell, 2) = nf;      // Store 'nf'  ff = mu * nf;         // Calculate some quantity 'ff'  C_UDMI(c, tcell, 3) = ff;      // Store 'ff'  C_UDMI(c, tcell, 4) = C_P(c, tcell); // Store cell pressure  P_USER_REAL(p, 0) = df;  P_USER_REAL(p, 1) = dvtdn;  P_USER_REAL(p, 2) = nf;  P_USER_REAL(p, 3) = ff;  P_USER_REAL(p, 4) = C_P(c, tcell);  fp1=fopen ("Impact1.txt" , "a") ;  fprintf( fp1 , "%f %f %f %f %f\n", P_USER_REAL(p, 0), P_USER_REAL(p, 1), P_USER_REAL(p, 2), P_USER_REAL(p, 3), P_USER_REAL(p, 4));  fclose(fp1);  // Calculate drag force  drag_force = (18 * Cd * Re) / 24;         // is this taking the reynolds number of the particle or the flow?  return drag_force;}ÂCan you please tell me what this error is??ÂThanks,
Kiran -
October 15, 2024 at 3:09 pmRobForum Moderator
Were there any compilation warnings? I'm not going to debug code.Â
-
Viewing 1 reply thread
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
- Non-Intersected faces found for matching interface periodic-walls
- Script error Code: 800a000d
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Fluent fails with Intel MPI protocol on 2 nodes
- Cyclone (Stairmand) simulation using RSM
- error udf
- Diesel with Ammonia/Hydrogen blend combustion
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script Error
Top Contributors
-
1351
-
599
-
591
-
540
-
366
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.