|
[Sponsors] |
August 27, 2013, 17:02 |
Global Reductions
|
#1 |
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 13 |
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 |
|
November 27, 2014, 09:16 |
|
#2 |
New Member
Rudi
Join Date: Jun 2014
Posts: 14
Rep Power: 11 |
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 #include <udf.h> #include <sg_ls.h> #define SOMETHING #endif Best regards, Rudi |
|
December 1, 2014, 10:17 |
|
#3 |
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 13 |
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.
|
|
December 2, 2014, 08:34 |
|
#4 |
New Member
Rudi
Join Date: Jun 2014
Posts: 14
Rep Power: 11 |
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 |
|
September 16, 2019, 04:43 |
I met the same problem
|
#5 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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
|
|
September 23, 2019, 05:23 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use PRF_GRSUM1 for global redution
read ansys fluent customization manual for more details best regards |
|
September 25, 2019, 03:55 |
|
#7 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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 |
|
September 25, 2019, 05:09 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
#include "udf.h" #include "prf.h" DEFINE_EXECUTE_AT_END(centroid) { 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; #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 } best regards |
|
September 25, 2019, 07:23 |
|
#9 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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. |
|
September 25, 2019, 21:35 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
As I've told, compile this code and try to run it
best regards |
|
September 25, 2019, 22:42 |
|
#11 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
Thanks a lot for your answer.
Best regards! Wang Lu |
|
September 26, 2019, 03:54 |
|
#12 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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 |
|
September 26, 2019, 20:11 |
|
#13 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
September 27, 2019, 08:48 |
|
#14 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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 |
|
September 27, 2019, 09:17 |
|
#15 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
Dear AlexanderZ
I need to change the website to https://user.qzone.qq.com/651668162 Best regards! Wang Lu |
|
September 28, 2019, 09:04 |
|
#16 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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 |
|
September 28, 2019, 09:32 |
|
#17 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26 |
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. |
|
September 28, 2019, 21:00 |
|
#18 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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 |
|
September 29, 2019, 21:44 |
|
#19 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
try to run this code
Code:
#include "udf.h" #include "prf.h" DEFINE_EXECUTE_AT_END(centroid) { 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; #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_GISUM1(va_liq); wcx = PRF_GISUM1(wcx); wcy = PRF_GISUM1(wcy); cx = wcx/va_liq; cy = wcy/va_liq; Message0("cx cy where calculated successfully\n"); #endif #if !RP_NODE fout1 = fopen("X-centroid of liquid.txt","a"); fout2 = fopen("Y-centroid of liquid.txt","a"); Message0("store files where opened \n"); #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); Message0("data stored successfully \n\n"); #endif #if !RP_NODE fclose(fout1); fclose(fout2); Message0("\n X-centroid of liquid = %g\n", cx); Message0("\n Y-centroid of liquid = %g\n", cy); #endif } best regards |
|
October 2, 2019, 23:43 |
|
#20 |
New Member
WANG LU
Join Date: Sep 2019
Posts: 22
Rep Power: 6 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AMI interDyMFoam for mixer nu problem | danny123 | OpenFOAM Programming & Development | 8 | September 6, 2013 02:34 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 15:33 |
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 | bookie56 | OpenFOAM Installation | 8 | August 13, 2011 04:03 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 02:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 18:07 |