|
[Sponsors] |
Opening a file and if statement before a DPM UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 11, 2014, 23:16 |
Opening a file and if statement before a DPM UDF
|
#1 |
New Member
Anthony
Join Date: Jul 2013
Posts: 15
Rep Power: 12 |
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 |
|
Tags |
dpm, fluent, udf |
|
|