Fluent crashing with no error message when initialising simulation with new UDF's
I wrote some new UDF's to give Fluent more accurate dynamical viscosity and thermal conductivity values for Hydrogen. Previously I had a more basic UDF just giving data for 1atm, now I am providing data for a large range of pressures and temperatures. However, when attempting to initialize the simulation with the new UDF's compiled, Fluent crashes almost instantly and doesn't give any message.
If I do a hybrid initialization first with the old UDF, then another with the new UDF's, it manages 6-7 iterations during initialization before crashing. Seems likely it's the new UDF's causing the crash but I don't know why. Any ideas? The UDF reads in data taken from a NASA CEA simulation using a .csv file. All the conductivity data is merged into a single column. So for each pressure, there exist 43 conductivity values for the 43 temperature intervals tested. The UDF checks the pressure from fluent, then fills a temporary array of the corresponding 43 conductivity values. Then the UDF checks the temperature from fluent and linearly interpolates the conductivity from that temporary array. The code seems to work perfectly during testing, outputting the correct values and compiling in Fluent. Code:
/******* UDF that simulates the thermal conductivity**************** |
It crashes instantly because you use the temperature, which is not yet defined during initialization. If you initialize with another method, you avoid that problem.
And you open a file for every cell. That is very inefficient: the proper way is to read the file once (with a DEFINE_ON_DEMAND), store the info in a global array, and read from that global array. But what is causing the crash is that you never close files. Soon you have millions of open files, and the system is not designed for that. |
All times are GMT -4. The time now is 23:40. |