TAGGED: #fluent-#cfd-#ansys, cfd-udf-fleunt, dynamic-mesh
-
-
June 20, 2023 at 12:11 am
navarag kk
Subscriberi am trying to simulate a door opening due to fluid pressure. The inlet condition is velocity inlet of 10m/s. the udf code is compiling. the MI is constant. but I am not getting the door opening motion even after hooking the udf code and Define_adjust code.
the code is
#include "udf.h"#includestatic real omega_calc = 0.0;static real theta=1.082104136;/*need to check*//*extern real omega_out=0.0; */real torque_p;DEFINE_ADJUST(torque_calculation,domain){/* Variables used by serial, host, node versions */int surface_thread_id=9;/*door surface id from fluent*/real total_area=0.0;torque_p=0.0;Thread* thread;face_t face;real area[ND_ND];real NV_VEC(A);real w[ND_ND];thread = Lookup_Thread(domain,surface_thread_id);begin_f_loop(face,thread)/* If this is the node to which face "officially" belongs,*//* get the area vector and pressure and increment *//* the total area and total force values for this node */{F_AREA(area,face,thread);total_area += NV_MAG(area);F_AREA(A,face,thread);F_CENTROID(w,face,thread);torque_p += F_P(face,thread)*NVD_DOT(A,w[1],w[0],0);/*need to check -w[1],w[0] as per geometry*/}end_f_loop(face,thread)}DEFINE_CG_MOTION(move_flapper,dt,vel,omega,time,dtime){NV_S(omega, =, 0.0);node_to_host_real_1(torque_p);real torque, domega, omega_prev, omega_dot, omega_out;const real inertia = 3.2;/* Compute the torque due to pressure P and weight W *//*-----------------------------------------------------------------------*//*torque_w= -9.1469 * sin(theta); /* -g*L*W*sin(theta) */torque= torque_p ;domega = dtime * torque / inertia;omega_dot= torque / inertia;/* Calculate the angular velocity *//*-----------------------------------------------------------------------*/omega_prev = omega_calc;omega_calc = omega_calc + domega;omega_out = omega_calc;/* Calculate the angle theta (Taylor expansion) *//*-----------------------------------------------------------------------*/theta=theta + 0.5*dtime*(omega_prev+omega_calc);#if !RP_NODEMessage ("\ntorque_p = %f,", torque_p);Message ("\ntorque = %f,", torque);Message ("\ndomega = %f,", domega);Message ("\nomega_calc: %f\n", omega_calc);Message ("\n---------------------------------------");Message ("\ntheta: %f\n", theta);#endif} -
June 20, 2023 at 3:44 pm
SRP
Ansys EmployeeHi,
I suggest you to please check forum discussion on opening and closing of valve which is done using udf: https://forum.ansys.com/forums/topic/how-to-do-a-udf-to-simulate-the-opening-and-closing-of-compressor-valves/
Hope you will find this useful.
Thank you.
-
June 20, 2023 at 5:14 pm
navarag kk
SubscriberI am new to udf and that forum uses other macros which i havent used. Should i change my entire code or can i work on this code?
-
-
- 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.
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Difference between K-epsilon and K-omega Turbulence Model
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Suppress Fluent to open with GUI while performing in journal file
- Mesh Interfaces in ANSYS FLUENT
- Time Step Size and Courant Number
- error: Received signal SIGSEGV
-
7646
-
4468
-
2957
-
1427
-
1322
© 2023 Copyright ANSYS, Inc. All rights reserved.