|
[Sponsors] |
I have two single udf files(see attachments), how can I put them together in one .c f |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 8, 2020, 11:07 |
I have two single udf files(see attachments), how can I put them together in one .c f
|
#1 |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
I have two single udf files(see attachments), how can I put them together in one .c file, who can help me?
|
|
October 10, 2020, 09:30 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You can do it in notepad. Open one, select all, copy. Then open the other one, paste.
|
|
October 10, 2020, 13:38 |
Thank you for your reply,I tried it, but the heat.c does not work, could you tell me
|
#3 |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Thank you for your reply,I tried it, but the heat.c does not work, could you tell me the reason? Whether should revise it a little such as delete one head "#include "udf.h"". I have also tried this, it still does not work.
|
|
October 10, 2020, 13:49 |
|
#4 | |
Member
mohammadreza
Join Date: Feb 2020
Posts: 31
Rep Power: 6 |
Quote:
i hope that work. |
||
October 10, 2020, 14:10 |
Hi, thank you for your reply. I am using a transient model, and I just try the udf.c
|
#5 |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Hi, thank you for your reply. I am using a transient model, and I just try the udf.c solely, it can work, which shows the profile does not have any problem. But when I put two udfs together, the heat.c does not work. This shows that may be the problem locates at the putting together directed.
|
|
October 11, 2020, 08:27 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You really need to be more specific. What does "heat.c does not work" mean? Does it give warnings? Errors? Crash the program? Give wrong results? I can not see what you see on you screen, so please don't let me guess what happens.
|
|
October 11, 2020, 19:14 |
|
#7 |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Hi, it means the function in the heat.c does not work in the fluent, it cannot realize the function(by monitoring the heat flux in the wall, the wall heat flux is still 0 at time larger than 0.3s,which is not correct), and there is no error in fluent. Does that make sense?
|
|
October 12, 2020, 07:55 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
put your code into 1 file and compile
Code:
#include "udf.h" DEFINE_PROFILE(inlet_x_velocity, thread, index) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread)/* loops over all faces in the thread passed in the DEFINE macro argument*/ { F_CENTROID(x,f,thread); y = x[1]; F_PROFILE(f, thread, index) = 20. - y*y/(.0745*.0745)*20.; } end_f_loop(f, thread) } DEFINE_PROFILE(hf_change,thread,position) { face_t f; real time,heat_flux1,heat_flux2; heat_flux1 = 0; heat_flux2 = 47300; time= RP_Get_Real("flow-time"); begin_f_loop(f,thread) { if (time<0.3) { F_PROFILE(f,thread,position)=heat_flux1; } else if (time>=0.3) { F_PROFILE(f,thread,position)=heat_flux2; } } end_f_loop(f,thread) }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 12, 2020, 08:07 |
|
#9 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
By the way:if you compile, there is no need to put in on one file. That is only needed if you interpret, and you should not do that unless strictly necessary. |
||
October 12, 2020, 11:04 |
Hi,it works in separate file, why can not do that way?
|
#10 |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
||
October 12, 2020, 11:07 |
I do as you said,but it still does not work.
|
#11 | |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Quote:
I compiled as you said,but it still does not work. The below are the process notes: nformation: The surface name point-150 no longer exists for report definition tem-150. They must have been deactivated/deleted. Information: The surface name line-150 no longer exists for report definition phase-line-150. They must have been deactivated/deleted. Information: The surface name line-30 no longer exists for report definition phase-line-30. They must have been deactivated/deleted. ************************************************** ************************** ************************************************** ************************** ** WARNING: Automatically switched to run in parallel -t1 mode. ** ** Detected non-parallelized UDF usage, enabling parallel usage. ** ** If you encounter any issues, please re-run with -t0 flag. ** ************************************************** ************************** ************************************************** ************************** cpp -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/acoustics" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/multiport/src" -I. -DUSE_UDF_HOST_DUMMY -DUDFCONFIG_H="<udfconfig-host.h>" "C:/Users/zhwan/Desktop/compiled.c" cpp -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/main" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/addon-wrapper" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/io" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/species" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/pbns" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/numerics" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/sphysics" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/storage" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/mphase" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/bc" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/models" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/material" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/amg" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/util" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/mesh" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/udf" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/ht" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/dx" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/turbulence" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/acoustics" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/parallel" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/etc" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/ue" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/dpm" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/src/dbns" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/PRIME/tgrid/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v193\fluent\fluent19.3.0/multiport/src" -I. -DUDFCONFIG_H="<C:/Users/zhwan/AppData/Local/Temp/udfconfig-12632-node0.h>" "C:/Users/zhwan/AppData/Local/Temp/compiled.c.12632.0.c" |
||
October 13, 2020, 00:54 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you may try to change time= RP_Get_Real("flow-time");
to time= CURRENT_TIME;
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 13, 2020, 18:26 |
There is no difference for it.
|
#13 |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
||
October 14, 2020, 05:45 |
|
#14 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
You are very confusing in your communication. If it works in a separate file, you can do it that way. Why do you ask me why you can NOT do it in that way?
I should ask you that question! If it works in separate files, why do go through all these troubles to combine it into one file? |
|
October 14, 2020, 18:27 |
Yes, I have combined it into one file,but one of it (heat.c) does not work, I do not
|
#15 | |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Quote:
|
||
October 19, 2020, 11:56 |
|
#16 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
You still did not answer the question. Let me ask it again. I will make it big and bold so you can not miss it: WHY do you want to combine it into one file? If everything works with separate files, just use separate files. Don't torture yourself. |
||
October 19, 2020, 12:00 |
|
#17 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Oh wait, I know the reason.
You said before that you compiled, but in reality you are interpreting. You go in the menu to "Define -> user-defined -> functions -> Interpreted", right? Well... Try to compile for a change. Go to "Define -> user-defined -> functions -> Compiled". |
|
October 19, 2020, 14:51 |
But when I try to compiled them one by one , the heat.c does not work, could you help
|
#18 | |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Quote:
But when I try to compiled them one by one , the heat.c does not work, could you help me deal with it . |
||
October 19, 2020, 15:23 |
|
#19 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Let me get this straight, because the story keeps changing.
1. You were able to interpret both files separately. (I mean: no errors or crashes.) 2. When you interpreted heat.c, it gave the result you wanted: the wall heated up after t=0.3. 3. You were able to compile both files separately (I mean: no errors or crashes.) 4. When you used the compiled version for heat.c, you did suddenly NOT get the result you wanted: the wall did not heat up after t=0.3. Is this accurate? (I told you before: "does not work" is too vague. Be more specific: does it crash Fluent? does it give errors? Does it give warnings? Does it give unexpected results? Does it make your computer burn? Each of these events has a different solution.) |
|
October 20, 2020, 12:07 |
Yes, all your four points are accurate, there is no errors or crashes when I interpre
|
#20 | |
Senior Member
Join Date: Dec 2017
Posts: 388
Rep Power: 10 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF compiling error | Weiqiang Liu | FLUENT | 2 | November 21, 2018 10:36 |
Single v.s. double precision | Confused | CFX | 15 | November 10, 2016 05:42 |
using define mass transfer udf for cavitation | Komon | Fluent UDF and Scheme Programming | 14 | June 21, 2016 03:50 |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 05:03 |