CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums

Udf code for acoustic model analysis

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

Rate this Entry

Udf code for acoustic model analysis

Posted April 7, 2024 at 09:38 by Joshua_1102
Updated April 7, 2024 at 11:02 by Joshua_1102 (adding information)

Greetings, I am Lok Yong Kheng, currently pursuing a bachelor's degree in Mechanical Engineering.

I have encountered a challenge with my Computational Fluid Dynamics (CFD) simulation. I am seeking assistance with the user-defined function (UDF) code for analyzing the acoustic model in a 2D Transient Thermoacoustic Refrigeration Model. Specifically, I am unable to obtain results for Sound Pressure Level and Acoustic Pressure post-simulation. This difficulty arises from the application of boundary conditions using UDF code, including inlet conditions (x-velocity - inlet_velocity_nx, y-velocity - inlet_velocity_ny) and outlet conditions (pressure - outlet_pressure_np), along with the implementation of dynamic mesh code (velocityair1_comp9). I am hopeful that someone knowledgeable about resolving this issue can provide insights in response to my inquiry on the discussion forum.

Thank you.

The attachement below is my current udf code for boundary condition and dynamic motion:

#include "udf.h"

DEFINE_PROFILE(inlet_velocity_nx,thread,position)
{
face_t f;
real t=CURRENT_TIME;

begin_f_loop(f,thread)
{
F_PROFILE(f,thread,position)=4.218*cos(148.2831732 *t);

}

end_f_loop(f,thread)
}

DEFINE_PROFILE(inlet_velocity_ny,thread,position)
{
face_t f;
real t=CURRENT_TIME;

begin_f_loop(f,thread)
{
F_PROFILE(f,thread,position)=0.0049378*cos(148.283 1732*t);

}

end_f_loop(f,thread)
}

DEFINE_PROFILE(outlet_pressure_np,thread,position)
{
face_t f;
real t=CURRENT_TIME;

begin_f_loop(f,thread)
{
F_PROFILE(f,thread,position)=1227.316*cos(148.2831 732*t);

}

end_f_loop(f,thread)
}


DEFINE_CG_MOTION(velocityair1_comp9,dt,vel,omega,t ime,dtime)
{
real freq= 23.6;
real y =2.0*M_PI*freq;
real Ycomp=0.000025;
NV_S(vel,=,0.0);
NV_S(omega,=,0.0);
vel[1] = y*Ycomp*cos(y*time);
}
Posted in Uncategorized
Views 159 Comments 0 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 0

Comments

 

All times are GMT -4. The time now is 13:48.