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

Cell Loop within Face Loop

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2025, 14:53
Default Cell Loop within Face Loop
  #1
Member
 
Rodrigo Villarreal
Join Date: Nov 2016
Posts: 40
Rep Power: 10
rodrigovime is on a distinguished road
Hello everyone,
I'm having a SIGSEV error while trying to nest a cell loop within a face loop in a DEFINE_PROFILE macro to sum a cell source to each face element, below there is a minimal example of what I'm trying to do:

DEFINE_PROFILE(blabla,thread,i)
{
Thread *tc;
cell_t c;
face_t f;
real source;
real SV;
real vector_face[ND_ND];
real vector_cell[ND_ND];
real diff[ND_ND];
begin_f_loop(f,thread)
F_CENTROID(vector_face,f,thread);
begin_c_loop(c,tc)
{
C_CENTROID(vector_cell, c, tc);
NV_VV(diff, =, vector_face, -, vector_cell);
SV=C_UDMI(c,tc,0);
source+=SV/pow(NV_MAG(diff),2.0);
}
end_c_loop(c,tc)
F_PROFILE(f,thread,i) = source;
end_f_loop(f,thread)
}
Is this the correct way to do so?
Thanks for your answer
rodrigovime is offline   Reply With Quote

Old   March 12, 2025, 19:50
Default
  #2
Member
 
Rodrigo Villarreal
Join Date: Nov 2016
Posts: 40
Rep Power: 10
rodrigovime is on a distinguished road
I managed to do so, it was lacking the thread of the whole domain, for a DEFINE_PROFILE macro it needs the pointer of the domain.
----------------------------
DEFINE_PROFILE(Stereo,thread,i)
{
Domain *d;
d = Get_Domain(1);
Thread *tc;
cell_t c;
face_t f;
begin_f_loop(f,thread)
thread_loop_c(tc,d)
{
begin_c_loop(c,tc)
{
DO STUFF FOR EACH CELL
}
end_c_loop(c,tc)
}
F_PROFILE(f,thread,i) =APPLY TO EACH FACE
end_f_loop(f,thread)
}
----------------------------
rodrigovime is offline   Reply With Quote

Reply

Tags
cell loop macros, face loop, fluent, 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] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
Seakeeping Solver:Crashed akbarbagusd Fidelity CFD 0 November 5, 2021 12:42
how to set periodic boundary conditions Ganesh FLUENT 15 November 18, 2020 06:09
udf problem jane Fluent UDF and Scheme Programming 37 February 20, 2018 04:17
decomposePar problem: Cell 0contains face labels out of range (Again)) limonegiallo OpenFOAM Pre-Processing 4 August 28, 2017 05:18


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