TAGGED: udf
-
-
April 15, 2023 at 11:32 am
K
SubscriberI have a UDF define_on_demand macro that takes a while to run (over a minute). Throughout the code, I have placed Message() commands that provide updates on where the calculation is up to. However, it seems that the messages are not printed as they come, but rather all at once after the calculation has finished.
Is there a way to print the messages as they come? Not sure if it's relevant, but the code is run in serial so there is no need for message passing between compute nodes.
-
April 17, 2023 at 12:42 pm
SRP
SubscriberHi,
Can you try DEFINE_EXECUTE_AT_END macro to print message?
If possible can you share your UDF code, it will aid in an improved understanding of the problem?
Thank you.
-
April 18, 2023 at 10:24 am
K
SubscriberThere are no iterations being performed. The UDF is just executed to solve for something based on the mesh (e.g. suppose it is calculating the average x-component of all the cell centroids or something). I’m unable to share it, but I’ve provided an example code below:
DEFINE_ON_DEMAND(compute_variable) {
#if !RP_HOST
Domain *domain;
Thread *t;
cell_t c;
domain = Get_Domain(ROOT_DOMAIN_ID);
thread_loop_c(t,domain) {
begin_c_loop(c,t) {
/* Do something that might take 10s. */
Message("Analyzed cell %d\n",c);
}
end_c_loop(c,tc)
}
#endif
}The code takes a few minutes to run, so the messages are there to provide an update for the user. However, it does not spit out the messages as it is running, but rather just dumps all the messages in one go at the end.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- Difference between K-epsilon and K-omega Turbulence Model
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5290
-
3309
-
2469
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.