-
-
November 2, 2023 at 5:47 am
Ramesh Chandra Mishra
SubscriberHi
I have to run simulations on HPC involving a UDF.
Now, a part of my code uses DEFINE_ON_DEMAND macro. Since I am compiling my UDF on HPC, I have to use TUI commands to hook the UDF. I am tried the following commands but it givs error even though UDF is compiled successfully.
/define/user-defined/execute-on-demand "ach_udf::libudf"
or
/define/user-defined/execute-on-demand " udf" "ach_udf::libudf"
Am I missing something?
-
November 2, 2023 at 6:49 am
Ramesh Chandra Mishra
SubscriberAlso, Please note that I haven't compiled the UDF in my case file because I am directly compiling it on the cluster and using tui commands in journal file to hook UDF.
-
November 2, 2023 at 12:50 pm
Rob
Forum ModeratorIf you run through the TUI command in stages the first return from Fluent is asking for the function name - what did you call the DEFINE_ON_DEMAND macro?
-
November 2, 2023 at 1:09 pm
Ramesh Chandra Mishra
Subscriber"ach_udf::libudf"
-
November 2, 2023 at 1:45 pm
Ramesh Chandra Mishra
SubscriberRob
I really need help on this because I am stuck here since 2 days.
I am writing all the steps I am following just to give you clarity so that you can point out if I am doing something wrong.
a) I prepare my case file and do not touch anything regarding execute on demand in my case file.
b) I prepare journal file, script file and libudf folder for compilation on HPC. In journal file I add /define/user-defined/execute-on-demand "ach_udf::libudf" for hooking this part of udf apart from other commands.
c) I compile UDF on HPC which is done successfully.
d) I submit the job and when it runs it stops at the execute-on-command and gives error:
/define/user-defined/execute-on-demand "ach_udf::libudf"
===============Message from the Cortex Process================================Fatal error in one of the compute processes.
==============================================================================
-
November 2, 2023 at 2:10 pm
Rob
Forum ModeratorIf you unhook the UDF and then use the /define... command locally what happens? You can test this on a dummy case, it just need enough mesh to load.
-
November 2, 2023 at 2:15 pm
Ramesh Chandra Mishra
SubscriberI am not sure I follow.
Are you saying that after running the simulations, I should use this command and see what happens?
-
November 2, 2023 at 2:45 pm
Rob
Forum ModeratorNo, you have the UDF, and can load it into any Fluent model. Do this on your local machine - does the command work?
-
November 2, 2023 at 2:53 pm
Ramesh Chandra Mishra
Subscriberyes, I have tried that .
As soon as I execute the execute on demand after compiling udf on my local machine, it gives error:
BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES.
I have tried this with other udf too. The issue remains the same.
I don't know if I am missing out on something.
-
November 2, 2023 at 3:15 pm
Ramesh Chandra Mishra
SubscriberI came to know that F_UDMI works only for boundary faces but I am using it for surfaces which I created using isoclip which are a part of the domain or you can say interior. can that be a reason? Because I am printing the value of F_UDMI for different locations under DEFINE_ON_DEMAND macro.
-
November 2, 2023 at 3:59 pm
Rob
Forum ModeratorThat would cause a failure after compilation, when you attach the UDF or trigger the Face loop. Isosurfaces aren't technically faces (facets) in the mesh sense.
Have a look at Expressions; depending on version and who told you to do what at Uni you may find the UDF is not needed.
-
November 3, 2023 at 3:31 am
Ramesh Chandra Mishra
SubscriberI have tried the expressions and custom field functions but concentration gradient is not available in the fluent GUI and it is one of the terms in my equation which I am trying to solve through UDF. So basically it is not possible without a UDF.
-
November 3, 2023 at 12:11 pm
Rob
Forum ModeratorSo you'll need to get the UDF and command working.
-
November 3, 2023 at 12:57 pm
Ramesh Chandra Mishra
SubscriberSo we are back to square one. I am unable to execute the define_on_demand macro. can you suggest me any alternative macro for that. I will give it a shot.
-
November 3, 2023 at 2:46 pm
Rob
Forum ModeratorHave you got the UDF working manually, you mention an error when running so that needs fixing first. The concentration gradient is available in the cells, what do you need the surface for?
-
November 3, 2023 at 2:50 pm
Ramesh Chandra Mishra
SubscriberUDF is getting compiled without error. But as soon as my job starts running, it stops at the command
/define/user-defined/execute-on-demand "ach_udf::libudf" giving me the error:
===============Message from the Cortex Process================================Fatal error in one of the compute processes.
==============================================================================
I need value of an expression on a surface and that equation includes concentration gradient:
-
November 3, 2023 at 3:00 pm
Rob
Forum ModeratorWhich means the C coding grammar is good, but that the macro/data use from Fluent needs work.
So, you need concentration gradient, that's available in all cells via the macros. You want to use that value on a surface? What's wrong with calculating the value everywhere, storing the value in a UDM and then displaying that value on a surface?
-
November 3, 2023 at 4:01 pm
namrata mishra
SubscriberThat is exactly what I am doing using DEFINE_ON_DEMAND macro. Don't know where is it going wrong.
-
November 3, 2023 at 4:21 pm
Rob
Forum ModeratorTake out some/all of the equations, ie simply the code. If that works slowly add macros/equations back in until it fails. That'll identify the cause.
-
November 6, 2023 at 6:04 am
namrata mishra
SubscriberHi Rob
I tried what you said and also identified the cause but don't know how to fix it.
Following is my piece of code:
DEFINE_ON_DEMAND(ach_udf)
{
FILE* fp;
fp = fopen("INDICE.txt", "a");
Thread *t,*to;
face_t f;
cell_t co;
Domain *d;d = Get_Domain(1);
real A[ND_ND];t = Lookup_Thread(d,2);
real ACHt_mean_out=0;
real ACHt_mean_in=0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);co = F_C0(f, t);
to = THREAD_T0(t);real vel_roof= C_V(co,to);
if (vel_roof>0)
{
ACHt_mean_out += vel_roof*NV_MAG(A);
}
else
{
ACHt_mean_in +=vel_roof*NV_MAG(A);
}
}
end_f_loop(f,t)}
This is getting compiled and solved properly. But as soon as I use C_UDMI for storage, it gives error. Following is the code which gives error:
DEFINE_ON_DEMAND(ach_udf)
{
FILE* fp;
fp = fopen("INDICE.txt", "a");
Thread *t,*to;
face_t f;
cell_t co;
Domain *d;d = Get_Domain(1);
real A[ND_ND];t = Lookup_Thread(d,2);
real ACHt_mean_out=0;
real ACHt_mean_in=0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);co = F_C0(f, t);
to = THREAD_T0(t);real vel_roof= C_V(co,to);
if (vel_roof>0)
{
ACHt_mean_out += vel_roof*NV_MAG(A);
}
else
{
ACHt_mean_in +=vel_roof*NV_MAG(A);
}
}
end_f_loop(f,t)C_UDMI (co,to,0)=ACHt_mean_out ;
}
Can you please tell me what is wrong here.
-
November 7, 2023 at 3:51 pm
Rob
Forum ModeratorTry putting the C_UDMI call into the loop, but as it's a face loop check up on F_UDMI. The UDMs are cell/facet based, they're not a single domain level value.
-
November 7, 2023 at 3:54 pm
namrata mishra
SubscriberYes, that's why I didn't put it into loop.
-
November 7, 2023 at 3:57 pm
Rob
Forum ModeratorYou just want a single value?
-
November 8, 2023 at 5:36 am
namrata mishra
SubscriberHi Rob
I want two things:
a) A single value for ACHt_mean_out after all the summation.
b) The value of vel_roof*NV_MAG(A) on each face of the surface defined with zone id 2.
-
November 8, 2023 at 9:44 am
Rob
Forum ModeratorUDFs tend to do "stuff" in the code. In your case can you simply report (surface sum/integral/etc) the values of the UDMs, ie the F_UDM is the result of vel_roof*NV_MAG(A) for each facet? Or fprint (or whatever the correct command is now) the single value.
-
November 8, 2023 at 10:23 am
namrata mishra
SubscriberI can't use F_UDMI because the surface is an interior surface not a boundary face.
-
November 8, 2023 at 12:21 pm
Rob
Forum ModeratorAn interior surface is a boundary face as it exists as a mesh surface and so has an idenity. If you mean an iso-surface then you'll also be lacking NV_MAG(A).
-
- 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.
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Difference between K-epsilon and K-omega Turbulence Model
- Getting graph and tabular data from result in workbench mechanical
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- Suppress Fluent to open with GUI while performing in journal file
- error: Received signal SIGSEGV
-
8780
-
4658
-
3151
-
1678
-
1462
© 2023 Copyright ANSYS, Inc. All rights reserved.