|
[Sponsors] |
Cell loop contains 0 cells for only first iteration of timestep? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 16, 2020, 16:10 |
Cell loop contains 0 cells for only first iteration of timestep?
|
#1 |
New Member
Join Date: Dec 2020
Posts: 19
Rep Power: 6 |
Hello,
I am using a DEFINE_ADJUST macro in a transient flow simulation. I am also using the documented thread/cell loops to access all cells, but I've found that for the first iteration of a timestep ONLY, there appear to be no cells inside the loop at all. I've included a very general, application-independent code snippet that can reproduce this phenomenon below. When I print to console the counter number after the loop has ended, for the first iteration of the timestep it will always be 0. For every subsequent iteration in that same timestep until the solver converges, it will be a non-zero value appropriate to how many cells are actually inside the domain. I am wondering whether there is an explanation for why this happens (possibly inherent to the way Fluent does its calculations)? If this is well-known, can someone point me to a specific part of the manual explaining this? Alternatively, if this is something that "just happens" then is there any way to circumvent this in implementing code that would calculate values in DEFINE_ADJUST which are passed to DEFINE_SOURCE? If for some reason I cannot loop over cells for the first iteration then that makes it seemingly impossible to calculate cell-dependent source terms. Any help is appreciated, thanks! Code:
#include "udf.h" DEFINE_ADJUST(test_adjust,d) { Thread *t; cell_t c; int counter = 0; thread_loop_c(t,d) { begin_c_loop(c,t) counter = counter + 1; end_c_loop(c,t) } Message("---------------------------------\n"); Message("counter ended at %i\n", counter); } |
|
December 18, 2020, 03:44 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
DEFINE_ADJUST is executed before each iteration
and your code is not an exception
__________________
best regards ****************************** press LIKE if this message was helpful |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] snappyHexMesh sticking point | natty_king | OpenFOAM Meshing & Mesh Conversion | 11 | February 20, 2024 10:12 |
[blockMesh] Create internal faces as patch in blockMesh | m.delta68 | OpenFOAM Meshing & Mesh Conversion | 14 | July 12, 2018 15:43 |
How to loop the outer cells of the volume cell zone? | gzsakuraz | Fluent UDF and Scheme Programming | 1 | April 12, 2017 14:46 |
[snappyHexMesh] No layers in a small gap | bobburnquist | OpenFOAM Meshing & Mesh Conversion | 6 | August 26, 2015 10:38 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 22:11 |