|
[Sponsors] |
September 16, 2015, 05:37 |
Call udf some Iterations
|
#1 |
Member
Eduardo Tola
Join Date: Aug 2015
Location: Madrid/Haifa
Posts: 50
Rep Power: 11 |
Hello to everyone!!
I would love to know if there is someone who knows how to call a udf every some iterations (compiled udf), for example 5, instead of every iteration. In order to not waste computer power, I want to call the function every 'X' iterations and no call every iteration and if a condition is reached then run the function. Thank you very much
__________________
Having fun with CFD =) |
|
September 16, 2015, 06:43 |
|
#2 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
what do you want to do? What you can do is add a counter base on the iteration and put it in an if statement.
|
|
September 16, 2015, 08:05 |
|
#3 | |
Member
Eduardo Tola
Join Date: Aug 2015
Location: Madrid/Haifa
Posts: 50
Rep Power: 11 |
Quote:
Thank you =)
__________________
Having fun with CFD =) |
||
September 16, 2015, 08:13 |
|
#4 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
so in that case you can add one counter
static int counter = 0.0; if (counter <5) { do nothing for example counter += 1.0; } else if (counter = 5) { do whatever you want; counter = 0.0; } You can do something like this in your execute at the end or adjust macro. |
|
September 16, 2015, 08:50 |
|
#5 | |
Member
Eduardo Tola
Join Date: Aug 2015
Location: Madrid/Haifa
Posts: 50
Rep Power: 11 |
Quote:
__________________
Having fun with CFD =) |
||
September 16, 2015, 08:56 |
|
#6 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
when the variable reaches 5 (for example), it will execute something and the variable returns to 0. from iterations 1 to 4 it wont do anything. I do not know how to code to do this only every X iterations, but you can say to do nothing in intervals. Not sure if I made myself clear.
|
|
September 16, 2015, 09:09 |
|
#7 | |
Member
Eduardo Tola
Join Date: Aug 2015
Location: Madrid/Haifa
Posts: 50
Rep Power: 11 |
Quote:
__________________
Having fun with CFD =) |
||
September 16, 2015, 12:18 |
|
#8 |
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14 |
Bruno's answer is probably easier to implement, but I'll put out an alternative option, just in case.
Under Calculation Activities, you can run some scheme code every X iterations or timesteps. If you have an on-demand UDF, you can call it with Code:
(%udf-on-demand "udfname::libudf") |
|
September 14, 2017, 13:48 |
|
#9 | |
Senior Member
Astio Lamar
Join Date: May 2012
Location: Pipe
Posts: 186
Rep Power: 14 |
Quote:
I have the same issue and want to use this method to call the UDF every certain iteration. If I understand correctly, this code needs to be compiled rather than interpret. However, when I interpret, I got "Parse error" In another try, I have successfully compiled the UDF, but cannot load it due to the following error: Code:
Error: The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64). \n\nThe system cannot find the file specified. \n\nC:\...\libudf\win64\3ddp_host\libudf.dll Error Object: #f Thanks. |
||
Tags |
compiled, dpm, fluent, iteration, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with chtMultiregionFoam radiation boundary condition | baran_foam | OpenFOAM Running, Solving & CFD | 10 | December 17, 2019 18:36 |
High Courant Number @ icoFoam | Artex85 | OpenFOAM Running, Solving & CFD | 11 | February 16, 2017 14:40 |
Wrong fluctuation of pressure in transient simulation | caitao | OpenFOAM Running, Solving & CFD | 2 | March 5, 2015 22:33 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
pisoFoam with k-epsilon turb blows up - Some questions | Heroic | OpenFOAM Running, Solving & CFD | 26 | December 17, 2012 04:34 |