|
[Sponsors] |
March 31, 2015, 18:40 |
|
#21 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
We're both trying to help you out here Ondrej, and have both read your problem, understood it and given guidance. I agree with pakk that these forums are for learning and troubleshooting Fluent issues, not simply doing the work for you. It appears you ignored my comment on the domain pointer solution back in this post, and I had to repeat myself before you fixed that issue. For every solution we provide in threads, I'm sure there's a number of others who stumble across the same issue and find these threads through search engines.
That being said, I think the key issue you face is that computers like to start from zero; for example, you access the fourth element of an array with x[3] and not with x[4]. Applying this logic to your C_UDMI macro: try accessing C_UDMI(c,t,0). |
|
March 31, 2015, 19:19 |
|
#22 | |
New Member
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11 |
Quote:
Updating solution at time level N... done. iter energy delta_time time time/iter Error: received a fatal signal (Segmentation fault). Error: received a fatal signal (Segmentation fault). Error Object: #f This is my updated code: #include "udf.h" DEFINE_ADJUST(teste, domain) { Thread *t; cell_t c; thread_loop_c(t, domain) { begin_c_loop_all(c, t) { C_UDMI(c,t,0) = NV_MAG(C_T_G(c,t)); } end_c_loop_all(c, t) } } Then I tried it from another side, but with same resault: #include "udf.h" DEFINE_ADJUST(max_C_T_G, domain) { cell_t c; Thread *ct; real maxT; maxT = 0.0; thread_loop_c(ct,domain) { begin_c_loop(c,ct) { if (C_T_G(c,ct)[0] > maxT) { maxT = C_T_G(c,ct)[0]; } } end_c_loop(c,ct) } printf("Maximum temperature = %f \n", maxT); } Sorry for it. |
||
March 31, 2015, 19:27 |
|
#23 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Try emptying your DEFINE_ADJUST UDF and only have a message, for example:
Code:
#include "udf.h" DEFINE_ADJUST(max_C_T_G, domain) { Message("Hello...\n"); } Lastly, use Message() instead of printf(). |
|
March 31, 2015, 19:45 |
|
#24 | |
New Member
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11 |
Quote:
|
||
March 31, 2015, 19:52 |
|
#25 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Work through your code line by line (adding one by one from the working simple message UDF) until you determine which line is causing your error and then fix it, good luck!
|
|
April 1, 2015, 04:21 |
|
#26 | |
New Member
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11 |
Quote:
#include "udf.h" DEFINE_ADJUST(max_C_T_G, domain) { cell_t c; Thread *ct; real maxT; maxT = 0.0; thread_loop_c(ct,domain) { begin_c_loop(c,ct) { if (C_T_G(c,ct)[0] > maxT) { maxT = C_T_G(c,ct)[0]; } } end_c_loop(c,ct) } printf("Maximum temperature = %f \n", maxT); } But problem is maybe with axisymetric definition. |
||
April 1, 2015, 04:59 |
|
#27 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
The problem could be that your temperature gradient is not yet defined. Is this on the first iteration? If so, let your simulation run for a few time steps before you use this UDF.
And a minor detail: replace Code:
printf("Maximum temperature = %f \n", maxT); Code:
Message("Maximum temperature gradient = %f K/m.\n", maxT); |
|
April 1, 2015, 16:57 |
|
#28 | |
New Member
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11 |
Quote:
I tried your opinions: -change the line for message in udf -run transient calculate >>calculation converget -compiled upgraded udf -Adjust hook -calculate -error: Updating solution at time level N... done. iter energy delta_time time time/iter ! 45 solution is converged 45 5.6044e-07 1.0000e+01 1.3000e+02 0:00:02 20 Error: received a fatal signal (Segmentation fault). Error: received a fatal signal (Segmentation fault). Error Object: #f |
||
April 2, 2015, 05:05 |
|
#29 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Hmm, then I don't know...
You could try to see if the gradient is the problem by replacing C_T_G(c,ct)[0] by C_T(c,ct). But if the gradient is really the problem, I would not know how to solve that. If C_T(c,ct) also does not work, the axisymmetry might be the problem. But then, I also would not know how to solve that. |
|
April 2, 2015, 05:32 |
|
#30 | |
New Member
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11 |
Quote:
|
||
April 12, 2015, 16:45 |
|
#31 | |
New Member
Andrej
Join Date: Mar 2015
Posts: 18
Rep Power: 11 |
Quote:
I try to compiled and adjusted udf (which have to work) from ansys forum. Here is code: #include "udf.h" DEFINE_ADJUST(total_dissipation, domain) { cell_t c; Thread *ct; real total_diss; total_diss = 0.0; /* Initialise total_diss before the loop */ thread_loop_c(ct,domain) { begin_c_loop(c,ct) { total_diss += C_D(c,ct) * C_VOLUME(c,ct); /* Use += to sum up values */ } end_c_loop(c,ct) } Message("Volume integral of turbulent dissipation = %f \n", total_diss); } And I have still same resault: fatal error (segmentation fault) I tried to compiled simple udf which contains only hello world and it works. Have you any idea where is problem? |
||
May 9, 2016, 11:36 |
|
#32 |
New Member
Join Date: Jul 2014
Posts: 10
Rep Power: 12 |
Hi!
I think that the solution to your problem is defining the thread value as equal to DT_THREAD(dt). The reason is in the fact that you are using the dynamic mesh. In that case normal thread definition does not work. Consequentially, your face looping macro aborts the simulation. Regards, Marko. |
|
July 9, 2021, 15:03 |
|
#33 |
New Member
wiki
Join Date: Jun 2021
Posts: 8
Rep Power: 5 |
@OP.
Actually what was being conveyed to you was that by default the first memory location is 0 in Ansys fluent. You defined one memory means you defined 0 serial number memory. It starts with 0. But you were storing the gradient in the user defined memory 1 which was not existing. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Temperature gradient using wall-functions | chantre | OpenFOAM | 2 | July 19, 2021 08:56 |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 08:15 |
UDF for time-mean temperature gradient | nenazarian | Fluent UDF and Scheme Programming | 1 | November 12, 2012 04:30 |
UDF slip and temperature jump from IFRT | abir | Fluent UDF and Scheme Programming | 1 | July 30, 2012 06:44 |
UDF velocity and temperature | Raj | FLUENT | 3 | February 1, 2009 19:29 |