Skip to content

Instantly share code, notes, and snippets.

@linjorejoy
Created June 3, 2022 11:51
Show Gist options
  • Save linjorejoy/b94e1708d3b90ec73d9adcff9c992b10 to your computer and use it in GitHub Desktop.
Save linjorejoy/b94e1708d3b90ec73d9adcff9c992b10 to your computer and use it in GitHub Desktop.
The User Defined Function (UDF) Code used to model the alternating velocity of air flow in the vortex generator created by a sinusoidally oscillating diaphragm.
#include "udf.h"
DEFINE_PROFILE(unsteady_velocity,thread,position) {
face_t f;
real t=CURRENT_TIME;
begin_f_loop(f,thread) {
F_PROFILE(f,thread,position)=6*sin(30*t);
} end_f_loop(f,thread)
}
@linjorejoy
Copy link
Author

Info About the Code

Sl No. Code Definition Remark
1 #include "udf.h" file inclusion directive will cause the udf.h file to be included with your source code.
2 DEFINE_PROFILE(unsteady_velocity,thread,position) Custom Boundary Profile define a custom boundary profile that varies as a function of spatial coordinates or time.
unsteady _velocity Parameter of DEFINE_PROFILE Generates profile for X velocity
3 face_t f Data Type face_t is an integer data type that identifies a particular face within a face thread.
4 real t=CURRENT_TIME To look up real flow time Finds real flow time and stores it in variable t
5 begin_f_loop(f,thread) face looping macro loops over all interior and boundary zone faces in a compute node
6 F_PROFILE(f,thread,position)= Define the face for UDF Uses integer position to set X velocity face value in memory
7 6sin(30t) Parameters definition 6: Maximum Velocity in sinusoidal flow(m/s) 30: Frequency of Oscillation(Hz)
8 end_f_loop(f,thread) face looping macro Ends the loop

@linjorejoy
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment