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

I wrote a UDF to return the maximum velocity within 2 inches of a specified surface.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 21, 2022, 21:36
Default I wrote a UDF to return the maximum velocity within 2 inches of a specified surface.
  #1
New Member
 
Chris N.
Join Date: Sep 2022
Posts: 3
Rep Power: 4
cnemecek05 is on a distinguished road
I wrote a UDF to return the maximum velocity within 2 inches of a specified surface. To accomplish this, I defined a cell register to get all cells within 2 inches of that specified surface. I then used the register to separate out a new cell zone. The UDF loops over all cells within that new cell zone and returns the max velocity and cell centroid of where the max velocity occurs. I separated out the new cell zone for two reasons: 1) to reduce the number of cells to loop through and 2) to limit the cells to the surface of interest (ie, I wanted to exclude all other surfaces/walls other than the one I am interested in). Without separating out the cell zone, I would have had to loop over all cells in the entire domain and all face cells of the surface of interest to determine if the volume cell was within 2 inches.

I believe the above can be accomplished via expressions. However, I believe I can only return the maximum velocity within the cell register and not the location of that velocity using expressions.

Is there a way to accomplish the whole UDF (ie, find max velocity and location within 2 inches of desired surface) using expressions? Is there a better was to accomplish this via UDF? Is there a function that will calculate the distance between a face zone ID and cell or does that have to be programmed manually as described above (ie, looping over all cells and face cells)?

Can you give C_WALL_DIST(c,cell_thread) a face_thread instead of a cell_thread, where the face_thread would be the id a wall?
cnemecek05 is offline   Reply With Quote

Old   September 26, 2022, 01:30
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
the way you explained your case makes me doubting you have working code,
show your code if you need help
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   September 26, 2022, 16:28
Default
  #3
New Member
 
Chris N.
Join Date: Sep 2022
Posts: 3
Rep Power: 4
cnemecek05 is on a distinguished road
AlexanderZ - The attached UDF code does work for my applications. Was just wondering if there was a better way.
Attached Files
File Type: c getMaxVelocityAndLocation_v2.0.c (4.6 KB, 6 views)
cnemecek05 is offline   Reply With Quote

Reply

Tags
expressions, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No matching function error: Phase change source term added to interMixingFoam wavefunction OpenFOAM Programming & Development 2 February 4, 2022 08:46
UDF for inlet velocity alongwith UDF for properties akshayy224 FLUENT 0 February 1, 2018 10:17
Having trouble adapting serial UDF to work in parallel muyuntao Fluent UDF and Scheme Programming 1 November 10, 2015 14:42
Help! Delete the UDM codes in the UDF Messi Fluent UDF and Scheme Programming 2 January 28, 2014 10:01
[snappyHexMesh] Layers don't fully surround surface EVBUCF OpenFOAM Meshing & Mesh Conversion 14 August 20, 2012 05:31


All times are GMT -4. The time now is 17:23.