CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

parallel fluent on pc with udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 10, 2014, 15:59
Default parallel fluent on pc with udf
  #1
New Member
 
Mike
Join Date: Dec 2013
Posts: 7
Rep Power: 12
mabbo009 is on a distinguished road
Hello all,

I have a simulation that requires a sin wave pressure pulse at the inlet. In order to do this I have written the udf shown below and added the two extra lines for parallel operation. Even with these I am still getting errors when trying to load all the nodes for parallel implementation. I have found bits and pieces about running this through visual studio but the implementation there is beyond me provided the lack of structure to the instructions and my personal ignorance. I am sure there is something simple or obvious I am missing but sadly I am an undergraduate mechanical student and my adviser is of little help. If anyone can assist me here it would be greatly appreciated.

I am working and limited to working on a pc running windows 7 with 4 cores. I understand this is a much simpler job on linux but, as is life I must work with what I am given (and please avoid responses about running dual boot. this is an academic machine and they will not let me load such things onto the computer).

Thanks all in advance for any help provided.


//************************************************** *********************
//stepfunction.c
//UDF for specifying step pressure rise boundary condition
//************************************************** **********************//
#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{
#if !RP_HOST

face_t f;
real g;
real x1 = CURRENT_TIME*12.566;
g = sin(x1);

begin_f_loop(f,thread);
{
F_PROFILE(f, thread, position) = (55+10*g)*6894.757;
}
end_f_loop(f, thread)
#endif
}
mabbo009 is offline   Reply With Quote

Old   March 13, 2014, 09:36
Default
  #2
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23
vasava will become famous soon enough
What is the error message?
vasava is offline   Reply With Quote

Old   March 13, 2014, 12:57
Default Error Message
  #3
New Member
 
Mike
Join Date: Dec 2013
Posts: 7
Rep Power: 12
mabbo009 is on a distinguished road
So I went through all the other stuff with adding system variables and finally got it to compile a non-parallel code.

Copied C:\Users\Michael\Desktop\APU
ew 3.c to libudf\src
Copied C:\Users\Michael\Desktop\APU\udf.h to libudf\src
user_nt.udf file is outdated. So, recreating the file for 3ddp_host ...
udf_names.c file is outdated. So, recreating the file for 3ddp_host ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")user_nt.udf file is outdated. So, recreating the file for 3ddp_node ...
udf_names.c file is outdated. So, recreating the file for 3ddp_node ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")
Done.

However, when I attempted the parallel code i got this:

opied C:\Users\Michael\Desktop\APU/C:\Users\Michael\Desktop\APU\SIN_Par.c to libudf\src
Copied C:\Users\Michael\Desktop\APU/C:\Users\Michael\Desktop\APU\udf.h to libudf\src
udf_names.c and user_nt.udf files in 3ddp_host are upto date.
(system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp_host\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_host")user_nt.udf file is outdated. So, recreating the file for 3ddp_node ...
udf_names.c file is outdated. So, recreating the file for 3ddp_node ...
(system "copy "C:\PROGRA~1\ANSYSI~1\v150\fluent"\fluent15.0.0\sr c\makefile_nt.udf "libudf\win64\3ddp_node\makefile" ")
1 file(s) copied.
(chdir "libudf")(chdir "win64\3ddp_node")# Generating udf_names.c because of makefile SIN_Par.obj
udf_names.c
udf_names.c(9) : warning C4113: 'void (*)()' differs in parameter lists from 'void (*)(void)'
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj SIN_Par.obj
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.

Creating library libudf.lib and object libudf.exp
SIN_Par.obj : error LNK2019: unresolved external symbol __imp__RP_Get_Float referenced in function _unsteady_pressure
libudf.dll : fatal error LNK1120: 1 unresolved externals


Done.
mabbo009 is offline   Reply With Quote

Old   March 17, 2014, 03:39
Default
  #4
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23
vasava will become famous soon enough
Have you installed visual studio and SDK properly? If not then you must do it first.
vasava is offline   Reply With Quote

Old   March 17, 2014, 09:13
Default
  #5
New Member
 
Mike
Join Date: Dec 2013
Posts: 7
Rep Power: 12
mabbo009 is on a distinguished road
If it was not installed correctly, would it have compiled the non parallel udf?
mabbo009 is offline   Reply With Quote

Old   March 17, 2014, 17:57
Default
  #6
Senior Member
 
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14
Kokemoor is on a distinguished road
If it successfully compiled your serial code, the compiler is probably fine. Could you post your new code that works in serial?
Kokemoor is offline   Reply With Quote

Old   March 17, 2014, 17:59
Default
  #7
New Member
 
Mike
Join Date: Dec 2013
Posts: 7
Rep Power: 12
mabbo009 is on a distinguished road
same code, it just gets rid of the parallel stuff.


//************************************************** *********************
//stepfunction.c
//UDF for specifying step pressure rise boundary condition
//************************************************** **********************//
include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{


face_t f;
real g;
real x1 = CURRENT_TIME*12.566;
g = sin(x1);

begin_f_loop(f,thread);
{
F_PROFILE(f, thread, position) = (55+10*g)*6894.757;
}
end_f_loop(f, thread)

}
mabbo009 is offline   Reply With Quote

Old   March 17, 2014, 18:04
Default
  #8
Senior Member
 
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14
Kokemoor is on a distinguished road
Ah, I misunderstood; thought you had made some changes. Looking more closely, it looks like it might be related to your sin(x1) call. Try replacing that with 'g=2*x1' or something similarly basic, and see if it will compile.
Kokemoor is offline   Reply With Quote

Old   March 18, 2014, 09:01
Default
  #9
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
Hi Mike,

May I ask why you absolutely want to compile the udf? It can be interpreted. Just curious.

As Andrew pointed out, the sin call is inside the f_loop in the example of section 8.2.1.2 of the UDF Manual 15.0, maybe it's for a reason?
macfly is offline   Reply With Quote

Old   March 18, 2014, 10:05
Default
  #10
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23
vasava will become famous soon enough
Your UDF may not not need #if !RP_HOST if you ensure that the face to which you are applying the condition is intact (not shared by multiple parts) after dividing your mesh in to multiple parts for parallel processing.

I have used a UDF with DEFINE_PROFILE macro on a cluster with 4-8 processors without changing the UDF and it worked fine. I can say this ONLY for UDF with DEFINE_PROFILE and DEFINE_PROPERTY macros.
vasava is offline   Reply With Quote

Old   March 18, 2014, 10:51
Default
  #11
Senior Member
 
Alex
Join Date: Jan 2014
Posts: 126
Rep Power: 12
Kina is on a distinguished road
Well, if you just need it once, you can open fluent serial, import udf, close fluent, save, open fluent in parallel. Or doesn't that work for you?
Kina is offline   Reply With Quote

Old   April 14, 2014, 14:35
Default Sorry for the delay in response
  #12
New Member
 
Mike
Join Date: Dec 2013
Posts: 7
Rep Power: 12
mabbo009 is on a distinguished road
Its the end of the semester and im getting hammered. So in response to your comments and suggestions:

So I tried replacing the sin call and it gave me the same error.

When I attempt to interpret I get an error for each core I had requested to run on.

And when I attempt to interpret or compile without the RP_HOST I get errors about the .c not being parallel

Further, I have attempted to run this on a unix cluster and am getting the same errors. What am I missing?

(sorry I am not providing you with these errors...the licenses are being used and I cannot get into the system to run and screen shot the output)
mabbo009 is offline   Reply With Quote

Old   April 25, 2014, 06:30
Default
  #13
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 13
upeksa is on a distinguished road
#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position)
{
#if !RP_HOST

face_t f;
real g;
real x1 = CURRENT_TIME*12.566;
g = sin(x1);

begin_f_loop(f,thread);
{
F_PROFILE(f, thread, position) = (55+10*g)*6894.757;
}
end_f_loop(f, thread)
#endif
}

You must delete the semi colon after begin_f_loop.
If I were you, I would include "math.h" since you are using a "sin" function.

Cheers
upeksa is offline   Reply With Quote

Old   April 28, 2015, 04:14
Default Clarification
  #14
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Quote:
Originally Posted by vasava View Post
Your UDF may not not need #if !RP_HOST if you ensure that the face to which you are applying the condition is intact (not shared by multiple parts) after dividing your mesh in to multiple parts for parallel processing.

I have used a UDF with DEFINE_PROFILE macro on a cluster with 4-8 processors without changing the UDF and it worked fine. I can say this ONLY for UDF with DEFINE_PROFILE and DEFINE_PROPERTY macros.
Hi Paritosh,

I just wanted to ask you if there were any changes to the results by using same serial code in parallel? And is this applicable to only DEFINE_PROFILE and DEFINE_PROPERTY or any other macros also?

Thanks in advance,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Old   April 29, 2015, 04:05
Default
  #15
Senior Member
 
Paritosh Vasava
Join Date: Oct 2012
Location: Lappeenranta, Finland
Posts: 732
Rep Power: 23
vasava will become famous soon enough
Quote:
Originally Posted by Bharadwaj B S View Post
I just wanted to ask you if there were any changes to the results by using same serial code in parallel? And is this applicable to only DEFINE_PROFILE and DEFINE_PROPERTY or any other macros also?

Thanks in advance,
Bharadwaj B S
I have used a UDF with macros DEFINE_PROFILE and DEFINE_PROPERTY in serial and parallel without any changes. I did not see any difference.

My claim is limited to the two macros that I mentions. I can not comment on the other macros.
vasava is offline   Reply With Quote

Old   April 29, 2015, 05:47
Default Working
  #16
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Dear Paritosh,

Thanks for your reply. It is working fine in parallel.

Thanks again,
Bharadwaj B S
Bharadwaj B S is offline   Reply With Quote

Reply

Tags
fluent, parallel, udf, windows 7


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluent UDF on parallel computing Andrea Fluent UDF and Scheme Programming 22 August 12, 2015 08:44
Differences of parallel UDF for Fluent 6.3 and 13 didiean Fluent UDF and Scheme Programming 9 March 25, 2013 22:37
Problem with Parallel Fluent mohamed_ FLUENT 1 December 28, 2012 12:23
PROBLEM in UDF on parallel fluent mode rakadit Fluent UDF and Scheme Programming 0 July 13, 2012 07:51
UDF in parallel version. yobee FLUENT 0 August 17, 2004 05:12


All times are GMT -4. The time now is 00:19.