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

First Iteration UDF Problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 16, 2016, 18:00
Default First Iteration UDF Problem
  #1
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 11
Student_GF is on a distinguished road
Hi All,

I have a question regarding UDF's, mainly using "first iteration".

I currently creating a UDF code to execute in the first iteration of a timestep using "first Iteration". The problem I am having is that when simulation is executed, the code that I intended to be executed at at the first iteration executes 5 times rather than the intended one in the first iteration of a time step. Does anyone know why this occurs?

Thank you.
Student_GF is offline   Reply With Quote

Old   May 20, 2016, 02:21
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
What is your UDF and are you running in parallel or serial mode?
`e` is offline   Reply With Quote

Old   May 20, 2016, 11:40
Default
  #3
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 11
Student_GF is on a distinguished road
Hello!

My simulation is running in parallel woth 4 processes.
Student_GF is offline   Reply With Quote

Old   May 20, 2016, 13:01
Default
  #4
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 11
Student_GF is on a distinguished road
Opps currently I am not on my work computer but the code is something like the following
define Profile
{
Begin cell loop
{
if (first_iteration)
{
(does operation)
}
else
{
(default to constant value)
}
printf(Display Values <- This was done so I can determine how many time it is running at what time)
}
end Cell loop
}

If you need the real code, I can get it to you later tonight.
Student_GF is offline   Reply With Quote

Old   May 20, 2016, 18:50
Default
  #5
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The DEFINE_PROFILE macro is called by all compute nodes and the host (in parallel mode). For your case where parallel is used with four processes, four compute nodes exist as well as the host causing the macro to be called a total of five times. Depending on what you're trying to achieve, this duplication is fine.

The cell loop (with begin_c_loop) only contains the cells on the respective compute node. If the boundary value only depends on local values on its compute node (e.g. position) then you'll be fine as is. However, if you're defining a boundary value based on global values (e.g. total volume of the computation domain) then you'll need to be careful of counting overlapping cells. Have a read of the parallel considerations chapter in the UDF manual for details (the section on looping over interior and exterior cells).
`e` is offline   Reply With Quote

Reply

Tags
first iteration, question, udf


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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
UDF Compilation Error - Loading Library - COMMON Problem! Help! robtheslob Fluent UDF and Scheme Programming 8 July 24, 2015 01:53
UDF compiling problem in Flient 6.3 jeevan kumar FLUENT 2 February 25, 2009 01:43
UDF using problem, error happens-heip!! Michael FLUENT 1 December 9, 2008 08:51
UDF variables F1, y / problem with UDF Fabian FLUENT 6 June 2, 2003 11:22


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