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

UDF in Cell Zone (Adjacent Cells)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 11, 2022, 05:27
Default UDF in Cell Zone (Adjacent Cells)
  #1
New Member
 
Join Date: Jul 2022
Posts: 2
Rep Power: 0
joshuawong2011 is on a distinguished road
Hello,

I am hooking a UDF onto a phase cell zone condition to fix the velocities in each cell which will depend on the adjacent cells' density. I am using DEFINE_PROFILE(name,thread,i) for this purpose. My workflow to achieve this in the UDF is:
  1. Loop over all cells.
  2. Within the loop, loop over all faces of each cell to get the face index and thread using C_FACE and C_FACE_THREAD
  3. Using the face index and thread obtained, get the adjacent cell index and thread using F_C0, F_C0_THREAD and F_C1, F_C1_THREAD.
  4. Using the cell index and thread, get the adjacent cell density (C_R).

I drafted my UDF with guidance from the manual. My problem is that when I try to initialize my case in Fluent, I get a an error "Received signal SIGSEGV". I have checked that the c_loop works using that Message, but when I enable the c_face_loop, initializing the case gives me the error. Interestingly, when I initialize the c_loop with check1, the error happens as well but initializing with check2 has no problem (the difference being that check2 is initialized during declaration.**

real check1, check2 =0;
begin_c_loop(c,thread)
{
* * *Message ("OK");
* * *// check1 =1;
* * *// check2 = 1;
* * *c_face_loop(c,thread,n)
* * *{
.......
}
}

May I know if the workflow for getting adjacent cell properties above is correct, and also what am I doing wrong in there? Thank you.
joshuawong2011 is offline   Reply With Quote

Old   July 14, 2022, 21:41
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
i think you don't need second loop (c_face_loop(c,thread,n))
use C_FACE and C_FACE_THREAD as a second step and continue with workflow
__________________
best regards


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

Old   July 14, 2022, 22:38
Default
  #3
New Member
 
Join Date: Jul 2022
Posts: 2
Rep Power: 0
joshuawong2011 is on a distinguished road
I've tried removing the c_face_loop, still does not work and gives me the "Received signal SIGSEGV" error when initializing.
joshuawong2011 is offline   Reply With Quote

Old   July 18, 2022, 00:50
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
show your code
__________________
best regards


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

Reply

Tags
adjacent cell, cell zone conditions, 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
[snappyHexMesh] SnappyHexMesh running killed! Mark JIN OpenFOAM Meshing & Mesh Conversion 7 June 14, 2022 01:37
how can use the cell temperature of each cell from zone 1 in zone 2 with UDF? bhwcs Fluent UDF and Scheme Programming 9 November 17, 2021 02:20
[snappyHexMesh] Error when setting locationsInMesh elonesampaio OpenFOAM Meshing & Mesh Conversion 1 April 3, 2021 17:44
Fluent UDF wrong number of cells in parallel - correct in serial dralexpe Fluent UDF and Scheme Programming 7 May 17, 2018 08:26
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28


All times are GMT -4. The time now is 19:39.