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

Opening a file and if statement before a DPM UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By pakk

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   August 11, 2014, 23:16
Question Opening a file and if statement before a DPM UDF
  #1
New Member
 
Anthony
Join Date: Jul 2013
Posts: 15
Rep Power: 12
anthony05 is on a distinguished road
I am currently using a UDF for DEFINE_DPM_PROPERTY and it involves an If statement, reading a file, and then modifying a particle property.

So the very simplified file looks like,

DEFINE_DPM_PROPERTY
>if 1 condition
>open file A
else
>open file B

>modify particle property

This works but is extremely slow due to the way the file opens. Is there anyway I can open the file before the UDF loops over every particle?

This was not a problem when I was using DEFINE_PROPERTY since the loop over every cell was contained within a for loop and the file could be opened before this. However if I put the file opening part before DEFINE_DPM_PROPERTY line I get 2 compiler errors since 'If' statements cannot be used outside of a function and my file opening needs an address operator (&) which also seems to not work outside of a function.

The compiler errors I receive are:
error C2143: syntax error : missing ')' before '&'
error C2143: syntax error : missing '{' before '&'
error C2059: syntax error : '&'
error C2059: syntax error : ')'
error C2059: syntax error : 'if'

Thanks in advance to anyone that can help
anthony05 is offline   Reply With Quote

 

Tags
dpm, fluent, 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



All times are GMT -4. The time now is 03:53.