-
-
November 2, 2023 at 5:47 amRamesh Chandra MishraSubscriber
Hi
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 amRamesh Chandra MishraSubscriber
Also, 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 pmRobForum Moderator
If 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 pmRamesh Chandra MishraSubscriber
"ach_udf::libudf"
-
November 2, 2023 at 1:45 pmRamesh Chandra MishraSubscriber
Rob
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 pmRobForum Moderator
If 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 pmRamesh Chandra MishraSubscriber
I 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 pmRobForum Moderator
No, 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 pmRamesh Chandra MishraSubscriber
yes, 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 pmRamesh Chandra MishraSubscriber
I 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 pmRobForum Moderator
That 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 amRamesh Chandra MishraSubscriber
I 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 pmRobForum Moderator
So you'll need to get the UDF and command working.Â
-
November 3, 2023 at 12:57 pmRamesh Chandra MishraSubscriber
So 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 pmRobForum Moderator
Have 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 pmRamesh Chandra MishraSubscriber
UDF 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 pmRobForum Moderator
Which 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 pmmishranamrata1196Bbp_participant
That 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 pmRobForum Moderator
Take 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 ammishranamrata1196Bbp_participant
Hi 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 pmRobForum Moderator
Try 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 pmmishranamrata1196Bbp_participant
Yes, that's why I didn't put it into loop.Â
-
November 7, 2023 at 3:57 pmRobForum Moderator
You just want a single value?Â
-
November 8, 2023 at 5:36 ammishranamrata1196Bbp_participant
Hi 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 amRobForum Moderator
UDFs 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 ammishranamrata1196Bbp_participant
I can't use F_UDMI because the surface is an interior surface not a boundary face.
-
November 8, 2023 at 12:21 pmRobForum Moderator
An 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).Â
-
- The topic ‘Hooking DEFINE_ON_DEMAND for HPC simulations’ is closed to new replies.
-
416
-
187
-
167
-
156
-
140
© 2024 Copyright ANSYS, Inc. All rights reserved.