-
-
June 1, 2024 at 3:27 amZwernjaydenSubscriber
I basically want to store the value of r, for each face, and plot it vs axial position. When I try this, its just a constant line at 0. I turned on a udm location and node memery location but is there anything else I have to do?
#include "udf.h"#includeÂ#define rho 950 // kg/m^3#define Hg 2033631 // J/Kg#define Hf -310000 // J/Kg#define T_ref 298 // K#define A1 0.01104 // m/s#define A2 3.9648 // m/s#define Cp 1500 // J/(Kg*K)#define E1 20557.188 // J/mol#define E2 55893.78 // J/mol#define R_u 8.314 // J/(mol*K)#define alpha 0.3ÂDEFINE_PROFILE(surface_temperature_profile, t, position){  face_t f;  real Ts, heat_flux, heat, a_face, Hv, r, Ts_old, Ts_new, error, Ts_new_prime, Area[ND_ND];  real radial_position;  real centroid[ND_ND];  int iter;  begin_f_loop(f, t)  {    Ts = F_T(f, t); // Current temperature at the face    heat = BOUNDARY_HEAT_FLUX(f, t); // Heat transfer at face f in watts    F_AREA(Area, f, t); // Get the area vector of the face    a_face = NV_MAG(Area); // Magnitude of the face area    // Calculate the radial position of the face centroid    F_CENTROID(centroid, f, t);    radial_position = centroid[1]; // Assuming the radial position is the y-coordinate in 2D axisymmetric    // Heat flux for the circumferential area    heat_flux = (heat*2*M_PI*radial_position) / a_face; // Heat flux in W/m^2    printf("Heat flux on face %d: %g W/m^2\n", f, heat_flux);    Ts_old = Ts;    iter = 0;    error = 1;    while (error > 1e-6 && iter < 100)    {      Hv = Hg - Hf + Cp * (Ts - T_ref); // Calculation heat of formation      r = (fabs(heat_flux)) / (Hv * rho); // Regression rate      if (Ts_old > 722)      {        Ts_new = E1 / (R_u * (log(A1) - log(r))); // New surface temperature for high temperature      }      else      {        Ts_new = E2 / (R_u * (log(A2) - log(r))); // New surface temperature for low temperature      }      error = fabs(Ts_new - Ts_old); // Error calculation      Ts_old = Ts_new; // Update Ts_old for next iteration      iter++; // Increment iteration count    }    Ts_new_prime = Ts + (alpha * (Ts_new - Ts));Âr = (fabs(heat_flux)) / (Hv * rho);// Store r in UDM    F_UDMI(f, t, 0) = r; // Assuming the UDM index is 0    printf("New Temp %d: %g K\n", f, Ts_new_prime);    printf("r_dot %d: %g mm/s\n", f, r*1000);    F_PROFILE(f, t, position) = Ts_new_prime; // Update the face temperature profile  }  end_f_loop(f, t)} -
June 3, 2024 at 11:10 amRobForum Moderator
https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v241/en/flu_udf/flu_udf_DataAccessMacros.html%23x1-5030004.2.9Â might explain the issue?
-
Viewing 1 reply thread
- The topic ‘Storing and plotting values in UDM’ is closed to new replies.
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
-
1281
-
591
-
544
-
524
-
366
Top Rated Tags
© 2024 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.