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

probelm about UDF marco called "CX_Find_Cell_With_Point"

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 28, 2020, 21:56
Lightbulb probelm about UDF marco called "CX_Find_Cell_With_Point"
  #1
New Member
 
Hongli LIU
Join Date: Jun 2020
Posts: 3
Rep Power: 2
SCU-CFDer is on a distinguished road
Hi, everybody in this wonderful community.
My recent research goal is to obtain the scalar values of neighborhood cells around a specific cell.
To realize this, I wrote a UDF coupling CX_Find_Cell_With_Point and begin_c_loop. The UDF tries to obtain the pressure of a neighborhood cell around a specific cell. Unfortunately, the UDF failed to run.
Can anybody give some advice? The UDF is posted as follows:

#include <udf.h>
#include "cxndsearch.h"

static ND_Search *domain_table = NULL;

DEFINE_ADJUST(test, domain)
{
cell_t c,c1;
Thread *t, *t1;
CX_Cell_Id *cx_cell;
real P[3];
real P_Cell[3];
real PR;
thread_loop_c (t,domain)
{
begin_c_loop(c,t)
{
domain_table = CX_Start_ND_Point_Search(domain_table,TRUE,-1);
C_CENTROID(P_Cell,c,t); /*obtain the postion of specific cell*/
P[0]=P_Cell[0]+0.001; /* obtain the postion of cell on the right side*/
P[1]=P_Cell[1];
P[2]=0;
cx_cell = CX_Find_Cell_With_Point(domain_table,P,0.0);
c1 = RP_CELL(cx_cell);
t1 = RP_THREAD(cx_cell);
domain_table = CX_End_ND_Point_Search(domain_table);
C_UDMI(c,t,0)=C_P(c1,t1); /* storage the value of pressure*/
}
end_c_loop(c,t);
}
}
SCU-CFDer is offline   Reply With Quote

Old   June 29, 2020, 04:22
Default
  #2
New Member
 
Hongli LIU
Join Date: Jun 2020
Posts: 3
Rep Power: 2
SCU-CFDer is on a distinguished road
Hello,friends.
I guess that I found the reason. The issue may come from the wrong use of CX_Start_ND_Point_Search. Whatever, I corrected my UDF. And it works. The corrected UDF is posted here:

#include <udf.h>
#include "cxndsearch.h"
static ND_Search *domain_table = NULL;
DEFINE_ADJUST(test, domain)
{
cell_t c,c1;
Thread *t, *t1, **pt;
CX_Cell_Id *cx_cell;
real P[3];
real P_Cell[3];
real vof;
real dx=0.2e-3; /*mesh size x direction*/
real dy=0.2e-3; /*mesh size y direction*/
domain_table = CX_Start_ND_Point_Search(domain_table,TRUE,-1);
thread_loop_c (t,domain)
{
begin_c_loop(c,t)
{
C_CENTROID(P_Cell,c,t); /*position of speicific cell*/
P[0]=P_Cell[0]+dx; /*position of cell on the right side*/
P[1]=P_Cell[1];
P[2]=0;
cx_cell = CX_Find_Cell_With_Point(domain_table,P,0.0);
if(cx_cell)
{
c1 = RP_CELL(cx_cell);
t1 = RP_THREAD(cx_cell);
pt = THREAD_SUB_THREADS(t1);
C_UDMI(c,t,0)=C_VOF(c1,pt[0]);
}
else
{
C_UDMI(c,t,0)=0;
}
end_c_loop(c,t);
}
}
domain_table = CX_End_ND_Point_Search(domain_table);
}
SCU-CFDer is offline   Reply With Quote

Reply

Tags
udf;define_adjust;fluent

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
UDF for vapor pressure anuarun Fluent UDF and Scheme Programming 7 July 2, 2020 20:59
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 02:30
Probelm with source term UDF (fluent) alinik FLUENT 0 October 30, 2016 15:54
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 04:03


All times are GMT -4. The time now is 00:27.