|
[Sponsors] |
December 14, 2017, 17:36 |
UDF to define Direct Solar Irradiation
|
#1 |
New Member
Augustin R
Join Date: Nov 2017
Posts: 2
Rep Power: 0 |
Hello everyone,
I'm kinda new to the usage of UDFs in ANSYS Fluent, but I've got the following problem: I want to simulate the radiation and fluid flow in a closed room with two windows. I got the simulation running using the S2S Model. Now I want to add the solar ray tracing to my model. I was also able to manage that and in Fluent Post I can see the sun beam moving within the room. But now I would like to define the Direct Solar Irradiation and the Diffuse Solar Irradiation with own values. I thought, I could do that by using a UDF with "DEFINE_SOLAR_INTENSITY" and doing something like this: Code:
DEFINE_SOLAR_INTENSITY(sol_direct_int, sun_x, sun_y, sun_z, S_hour, S_minute) { real intensity; if(S_hour = 11 && S_minute <= 15){intensity=120;} printf("solar-time=%f intensity=%e\n", minute, intensity); return intensity; } Code:
Error: received a fatal signal (Segmentation fault). Error Object: #f The UDF works totally fine with changing for example the wall temperature with every 5 timesteps. I hope I could describe my problem well. Thanks for your time and your answers |
|
December 19, 2017, 05:29 |
|
#2 |
New Member
Augustin R
Join Date: Nov 2017
Posts: 2
Rep Power: 0 |
Does nobody have an answer? Does anyone at least have an idea for a way to avoid this problem?
|
|
December 20, 2017, 00:46 |
|
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
try this code
Code:
DEFINE_SOLAR_INTENSITY(sol_direct_int, sun_x, sun_y, sun_z, S_hour, S_minute) { real intensity; if(S_hour == 11 && S_minute <= 15){intensity=120;} Message("solar-time=%f intensity=%e\n", minute, intensity); return intensity; } |
|
May 6, 2020, 03:22 |
|
#4 | |
Member
Join Date: Oct 2019
Posts: 35
Rep Power: 7 |
Quote:
Was this UDF able to work for anyone who tried to implement it this way? I keep getting an error message, the screenshot is attached. My UDF simply defines the intensity values. #include "udf.h" DEFINE_SOLAR_INTENSITY(sol_direct_intensity,sun_x, sun_y,sun_z,hour,minute) { real intensity; intensity = 35; Message("solar-time=%f intensity=%e\n", minute, intensity); return intensity; } DEFINE_SOLAR_INTENSITY(sol_diffuse_intensity,sun_x ,sun_y,sun_z,hour,minute) { real intensity; intensity = 77; Message("solar-time=%f intensity-diff=%e\n", minute, intensity); return intensity; } |
||
May 6, 2020, 05:00 |
Compilation
|
#5 |
Senior Member
|
You appear to be interpreting the library while you need to compile it. If you do not have a compiler then remove Message command. Rest of the code will work.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
May 6, 2020, 07:50 |
Compilation
|
#6 | |
Member
Join Date: Oct 2019
Posts: 35
Rep Power: 7 |
Quote:
Even with the VS installed, the error still persists but I found I workaround on youtube of using the x86_x64 Cross Tools command prompt in VS. Thanks for the response |
||
May 6, 2020, 08:10 |
Compilation
|
#7 |
Senior Member
|
Just the installation of VS or Build Tools is not sufficient. Either you need to ensure that udf.bat file installed with Fluent has correct path or use any of the VS command prompts to start Fluent. Once compiled, it will work with normally started Fluent as long as you use the library for same OS, same precision, and same mode (serial or parallel).
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
May 6, 2020, 19:32 |
Successful compilation
|
#8 |
Member
Join Date: Oct 2019
Posts: 35
Rep Power: 7 |
Morning Vinerm,
Thanks for the response. Yes you are right. I used the VS x86_x64 Command Prompt in VS to start FlUENT and the UDFs compiled successful. I was able to run the simulation as well. Thank you for your assistance. much appreciated |
|
Tags |
define_solar_intensity, direct, solar, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Please help UDF error!!!! | dinhanh | Fluent UDF and Scheme Programming | 3 | September 26, 2014 05:10 |
use of pointers in specific heat udf | mdakbari | Fluent UDF and Scheme Programming | 0 | April 18, 2014 12:37 |
Solar Calculator | Dorasemon | FLUENT | 1 | July 25, 2013 10:20 |
UDF: exporting a variable between two DEFINE function | Carlo | FLUENT | 3 | August 19, 2009 13:21 |
Free surface boudary conditions with SOLA-VOF | Fan | Main CFD Forum | 10 | September 9, 2006 13:24 |