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

Get boundary face cell coordinate adjacent side wall

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 10, 2025, 07:00
Default Get boundary face cell coordinate adjacent side wall
  #1
New Member
 
soohoha
Join Date: Apr 2023
Posts: 5
Rep Power: 4
soohoha is on a distinguished road
Hello,
I want to find the coordinates of the boundary face cells adjacent to the side wall for a condensation simulation.

Since my inlet geometry is too complex, creating a film is very difficult. Therefore, I am trying to write a UDF to set the liquid volume fraction to 1 for cells located within 0.001 mm in the y-direction from the adjacent side wall.

Before implementing this, I first attempted to extract the first cell adjacent to the side wall using a connectivity macro. Then, I planned to use c_face_loop for this cell and apply if(THREAD_ID(C_FACE_THREAD(c0, t0, j)) to sort only the faces belonging to the same thread as the inlet boundary face.

However, when I run the code, only the thread corresponding to the side wall is being extracted, and not the inlet boundary face. Could you help me resolve this issue?

Here is my udf code
{
#include "udf.h"
#include "mem.h"
#include "sg_mphase.h"

const int WALLIDS[] = { 171 }; // side wall id
#define NUM_WALLIDS (sizeof(WALLIDS) / sizeof(WALLIDS[0]))
#define inlet_id 5 // inlet boundary conditions id

DEFINE_ON_DEMAND(mark_boundary_cells_all)
{
#if !RP_HOST
Domain *domain = Get_Domain(1);
Thread *t;
Thread *t0;
Thread *inlet_thread;
face_t f;
face_t face;
cell_t c0;

int i;
int j;

for (i = 0; i < NUM_WALLIDS; ++i)
{
int wall_id = WALLIDS[i];
t = Lookup_Thread(domain, wall_id);
inlet_thread = Lookup_Thread(domain, inlet_id);
Message("inlet thread %d\n", inlet_thread);

begin_f_loop(f, t)
{
c0 = F_C0(f, t);
t0 = F_C0_THREAD(f, t);
if (t0 != NULL)
{
C_UDMI(c0, t0, 0) = 1.0;
}

c_face_loop(c0, t0, j)
{
if (THREAD_ID(C_FACE_THREAD(c0, t0, j) == inlet_thread)
{
F_UDMI(c0, t0, 1) = 1.0;
/*Message("Face_thread_id = %d\n", THREAD_ID(C_FACE_THREAD(c0, t0, j));*/
}
face = C_FACE(c0, t0, j);
}
}
end_f_loop(f, t);
}
#endif
}
}
soohoha is offline   Reply With Quote

Reply

Tags
multiphase, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[Other] refineWallLayer Error Yuby OpenFOAM Meshing & Mesh Conversion 2 November 11, 2021 11:04
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 07:38
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
[Gmsh] Import problem ARC OpenFOAM Meshing & Mesh Conversion 0 February 27, 2010 10:56
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15


All times are GMT -4. The time now is 21:25.