Global Reductions
I'm trying to use a global reduction, specifically PRF_GRSUM1, in my parallel interpreted UDF. Seems that it should be pretty straightforward, but I'm getting errors.
Code:
Error: ... line 30: MPT_gdsum1: no function prototype Code:
#define PRF_GRSUM1 MPT_GDSUM1 Code:
Error: C:\\PROGRA~1\\ANSYSI~1\\v145\\fluent\\fluent14.5.0/multiport/src/reductions.h: line 393: MPT_check has already been defined in the current frame |
Dear Andrew,
I am facing the same problem interpreting in Fluent's parallel mode. I have tried to avoid multiple definition by preprocessor statements in the usual pattern. But it didn't prevent reinterpreting of the files. Code:
#ifndef SOMETHING Best regards, Rudi |
In the end, I ended up compiling my UDF. Not sure if that's what fixed it, or if I did something else, but my final UDF #includes udf.h and nothing else.
|
Upon your hint, I have removed sg_ls.h from includes. Instead I 'exported', which is to say I copied, the definition I needed into my file.
Interpreting it went through without redefinition error :-) Thanks! Rudi |
I met the same problem
I have found the reductions.h,but,I can't find the define of the MPT_GDSUM1,could you tell me the define of the MPT_GDSUM1
|
use PRF_GRSUM1 for global redution
read ansys fluent customization manual for more details best regards |
Dear AlexanderZ:
Thank you so much for your answer. The advice you suggested I have tried, but it still goes wrong. It shows MPT_gdsum1: no function prototype. I have no idea how to adjust my UDF. My code as follow, could you tell me what is going wrong? #include "udf.h" #include "prf.h" DEFINE_EXECUTE_AT_END(centroid) { #if !RP_HOST real wcx = 0.0; real wcy = 0.0; real va_liq = 0.0; real cx, cy; real x, y; cell_t c; real z[ND_ND]; Domain *subdomain= Get_Domain(3); Thread *t; #endif #if !RP_NODE FILE *fout1; FILE *fout2; #endif #if !RP_HOST thread_loop_c(t,subdomain) { begin_c_loop(c, t) { if(0.5<=C_VOF(c,t)&&C_VOF(c,t)<=1.0) { va_liq = va_liq + C_VOLUME(c,t); C_CENTROID(z,c,t); wcx = wcx + z[0]*C_VOLUME(c,t); wcy = wcy + z[1]*C_VOLUME(c,t); } } end_c_loop(c, t) } va_liq = PRF_GDSUM1(va_liq); wcx = PRF_GDSUM1(wcx); wcy = PRF_GDSUM1(wcy); cx = wcx/va_liq; cy = wcy/va_liq; #endif #if !RP_NODE fout1 = fopen("X-centroid of liquid.txt","a"); fout2 = fopen("Y-centroid of liquid.txt","a"); #endif node_to_host_real_2(cx, cy); #if RP_HOST fprintf(fout1,"%g,%g\n",CURRENT_TIME,cx); fprintf(fout2,"%g,%g\n",CURRENT_TIME,cy); #endif #if !RP_NODE fclose(fout1); fclose(fout2); Message("\n X-centroid of liquid = %g\n", cx); Message("\n Y-centroid of liquid = %g\n", cy); #endif } Thanks a lot. Best regards. Wang Lu |
Code:
#include "udf.h" best regards |
Dear AlexanderZ:
Thank you for your answer. But when I interpret it, it gets wrong,I don't know what is up. Can you try to interpret my code in your fluent?I know it's rude to ask that. But I really want to know what is going up,my system or something else. Thank you a lot. Best regards. Wang Lu. |
As I've told, compile this code and try to run it
best regards |
Thanks a lot for your answer.
Best regards! Wang Lu |
Dear AlexanderZ:
Thank you for your answer. I still can not compile my code. When I compile my code ,it shows error like "The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform (win64)". Do you know what's wrong? Beat regards! Wang Lu |
this code, which I've attached, is compiled well
to compile code: run fluent from visual studio command prompt (or SDK command prompt) -> user defined -> functions -> compiled -> BUILD best regards |
Dear AlexanderZ:
Thank you for your answer.I just did what you have told,but it still shows wrong.I made a video which recorded what I did and upload on the website as follow,so that you can know what I have done. https://user.qzone.qq.com/651668162/main Best regards! Wang Lu |
Dear AlexanderZ
I need to change the website to https://user.qzone.qq.com/651668162 Best regards! Wang Lu |
Dear AlexanderZ
Today,I try to compile my UDF,and run my Fluent. The UDF can be compiled,but it can't output the file, and the case interrupt.I think my UDF still have the coding error. Could you help me correct my UDF. Blessing to you. WangLu |
Show what is written on your screen after you click "build". (not what happens after you click "load").
It might be in your video, but I am not going to watch a video. |
Dear pakk:
Thank you for your answer.It shows as follow: Copied F:\wldaoliuban\case\25_4/F:\wldaoliuban\case\25_4\centroid_parallel_wl.c to libudf\src Copied F:\wldaoliuban\case\25_4/F:\wldaoliuban\case\25_4\udf.h to libudf\src Creating user_nt.udf file for 3ddp_host ... (system "copy "D:\ANSYS\ANSYS Inc\v180\fluent"\fluent18.0.0\src\udf\makefile_nt. udf "libudf\win64\3ddp_host\makefile" ") 已复制 1 个文件。 (chdir "libudf")(chdir "win64\3ddp_host")# Generating ud_io1.h centroid_parallel_wl.c # Generating udf_names.c because of makefile centroid_parallel_wl.obj udf_names.c # Linking libudf.dll because of makefile user_nt.udf udf_names.obj centroid_parallel_wl.obj Microsoft (R) Incremental Linker Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. 正在创建库 libudf.lib 和对象 libudf.exp Creating user_nt.udf file for 3ddp_node ... (system "copy "D:\ANSYS\ANSYS Inc\v180\fluent"\fluent18.0.0\src\udf\makefile_nt. udf "libudf\win64\3ddp_node\makefile" ") 已复制 1 个文件。 (chdir "libudf")(chdir "win64\3ddp_node")# Generating ud_io1.h centroid_parallel_wl.c # Generating udf_names.c because of makefile centroid_parallel_wl.obj udf_names.c # Linking libudf.dll because of makefile user_nt.udf udf_names.obj centroid_parallel_wl.obj Microsoft (R) Incremental Linker Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved. 正在创建库 libudf.lib 和对象 libudf.exp Done. Best regards! WangLu |
try to run this code
Code:
#include "udf.h" best regards |
Dear AlexanderZ:
Thank you so much to help me correct my UDF. I am so happy to see my case run well with the UDF. But it still has a little error. The result in the text the case output is different with the result in the serial veision. It shows :"0.01,-1.#IND" In the serial version, it shows:"0.01,0.053456" Do you know what's wrong? Thank you again. Best Regards! Wanglu |
All times are GMT -4. The time now is 16:11. |