TAGGED: stop-a-calculation, udf-fluent
-
-
January 6, 2021 at 8:08 pm
mardott
SubscriberI am running a steady state simulation and my aim is to send the journal file with a large number of iterations and no convergence criteria to the cluster. I would like the FLUENT solver to stop the calculation once a certain value inside my UDF is met. nHow can I achieve that? (Note that this value is a variable that exists only inside the UDF)nI saw online some methods that use scheme variables and/or creating a command inside Execute commands but they do not seem to work in my case.nMaybe I'm implementing them in the wrong way, also because I have no idea how the syntax for Execute commands work nor where to look for learning it.nCould you help me?. -
January 6, 2021 at 11:24 pm
YasserSelima
SubscriberHinDefine a global variable likenint my_convergence_variable=0;nThen write a function to report this variable nDEFINE_REPORT_DEFINITION_FN(my_convergence_function)n{n return my_convergence_variable;n}nThen when you need to stop inside any functionnif (condition){n my_convergence_variable=1;n}nThen. before you start simulations go to Residuals,>Convergence criteria ... Now you should find your variable in the list ... put the condition ... n -
January 6, 2021 at 11:25 pm
YasserSelima
SubscriberYou might need to add this variable in the report definition before you find it in the convergence criteria n -
January 7, 2021 at 7:15 am
Keyur Kanade
Ansys EmployeeThank you nYou have been very helpful on many posts. nAppreciate it. nRegards,nKeyurnHow to access Ansys Online Help DocumentnHow to show full resolution imagenGuidelines on the Student CommunitynHow to use Google to search within Ansys Student Communityn -
January 7, 2021 at 7:52 am
YasserSelima
SubscriberMy pleasuren -
January 7, 2021 at 1:01 pm
mardott
SubscriberArraythank you for you answer, but unfortunately when I tested your solution I see in the console Solution for report definition report-convergence has converged but the iterations go on. I would like them to stop when the report has converged.nDo you may know how I can do that?n -
January 7, 2021 at 1:34 pm
Rob
Forum ModeratorHave the rest of the equations converged? n -
January 7, 2021 at 2:08 pm
mardott
SubscriberArraydoes it matter? I would like the calculation to stop when I ask for it, as if I was pressing the stop button in FLUENT. nSo, in the test, the other equations did not converge but since I tried with none in the Convergence Criterion, I expected the calculation to stop only when the report definition converged.n*edit: setting absolute in the Convergence Criterion and unselecting all the check convergence ticks works.nThanks again for the help Arrayn
-
January 7, 2021 at 3:00 pm
YasserSelima
SubscriberYou must set the criteria as only one condition converges ... this is a check box in the residuals tabn -
January 7, 2021 at 4:18 pm
Rob
Forum Moderatoryes as the check in Fluent is on residuals and the report, thanks for the fix. n -
January 9, 2021 at 11:01 am
mardott
SubscriberActually I am still have issues. Maybe it depends on what I set in the Convergence Conditions box?n -
January 9, 2021 at 6:06 pm
YasserSelima
Subscriberyes, it depends. In the same panel of residuals, uncheck the boxes under check convergence.nThen in the convergence conditions panel when you selected your variable, make sure to check at the bottom only one condition is met.n -
January 13, 2021 at 8:31 am
mardott
SubscriberSo, I discovered what the problem was.nThe stop criterion stands for something different based on the FLUENT version one uses.nIn your version (and so the one in the file in knowledge resources:solutions of Ansys Portal) I put in stop criterion the value at which my variable has to stop. E.g. for the solution you suggested it should be 1nUnfortunately. in the version I am using (FLUENT 19 R2), the stop criterion stands for the residuals for the function, calculated as n
So, with your solution, if I put 1, my solution converges when the residuals of my function is <= 1, i.e. after 2 iterations.nI solved it by:n putting a very small number e.g. 1e-10 as stop criterionnusing the current iteration as variable in the UDF:nn
-
January 13, 2021 at 8:36 am
mardott
Subscriber(as global variable) int conv;nninside a function eg. DEFINE_EXECUTE_AT_END(...):n {conv = N_ITER;n if(convergence condition meet)n conv = N_ITER -1;}nnDEFINE_REPORT_DEFINITION_FN(...)n {return conv;}n -
January 13, 2021 at 11:09 am
YasserSelima
SubscriberGlad it works and nice idea .. I did not know that this is the residual value .. thanks for sharing the idean
-
Viewing 14 reply threads
- The topic ‘Stop steady state iteration process from UDF’ is closed to new replies.
Ansys Innovation Space
Trending discussions
Top Contributors
-
3064
-
971
-
905
-
858
-
792
Top Rated Tags
© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.