CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Solar calculator daily cycle update (https://www.cfd-online.com/Forums/fluent-udf/234935-solar-calculator-daily-cycle-update.html)

Plak March 24, 2021 10:43

Solar calculator daily cycle update
 
Hello everyone,

I am trying to do a long time simulation, after doing some serious approximations, using the Solar Load Model. I am doing thermal research for the SWGO (Southern Wide-field Gamma-ray Observatory) and I want to simulate a water tank for about a month (or more) in 15 minute time steps using the solar load and see if the water freezes.

I already have some UDF for real data I have, but once I pass midnight Fluent starts asking me to fix the hour. Doing this with journal files is not a great solution for me as I already have user-defined values for the sun intensity, ambient temperature, heat coefficients, etc.

Is there any way for fluent to do that on its own or even using some UDF?
I found a TUI command that adjusts the solar calculator position:
/define/models/radiation/solar-calculator 40.7 -74.1 1 0 0 -1 1 0 0 19 7 0 0 y 1 ;set your correct location, date, time and mesh orientation etc.

Is there a way that I can call this TUI command from a UDF? I will call it near midnight passing the hour and date to the next day.

Using ANSYS 19.2

Thank you in advance

Best Regards

Plamen

AlexanderZ March 28, 2021 22:46

you may try to use:
Code:

CX_Interpret_String(ti-menu-load-string (format #f "/define/models/radiation/solar-calculator 40.7 -74.1 1 0 0 -1 1 0 0 19 7 0 0 y 1" ));
other way is to have scheme script, which will monitor some criteria calculated in your UDF
under some condition scheme scrip will execute whatever you want

Plak March 29, 2021 05:52

Thank you a lot for your answer.

I managed to go around this by using a journal file with multiple commands (approx 1440 lines for a year to be precise).

I used the define solar calculator and then set up the time step, number of time steps and iterations, after doing them, the journal file keeps reading the next lines without stopping and so on for every day of the year.

NOTE: In order to be able to reset the time flow and back to 0 hours, the command (rpsetvar 'flow-time 0); is needed from the second day onwards.

I hope this is useful for someone in the future, there is small amount of information about it.
;
/define/models/radiation/solar-calculator -23.017 -67.753 -4 1 0 0 0 0 1 1 1 0 10 y 1 ;
/solve/set/time-step 900 ;
/solve dt 96 30 ;
;
/define/models/radiation/solar-calculator -23.017 -67.753 -4 1 0 0 0 0 1 2 1 0 10 y 1 ;
(rpsetvar 'flow-time 0);
/solve dt 96 30 ;
;
/define/models/radiation/solar-calculator -23.017 -67.753 -4 1 0 0 0 0 1 3 1 0 10 y 1 ;
(rpsetvar 'flow-time 0);
/solve dt 96 30 ;
;

Best Regards

Plamen

HelloThere June 24, 2021 06:55

Quote:

Originally Posted by Plak (Post 800102)
Thank you a lot for your answer.

I managed to go around this by using a journal file with multiple commands (approx 1440 lines for a year to be precise).

I used the define solar calculator and then set up the time step, number of time steps and iterations, after doing them, the journal file keeps reading the next lines without stopping and so on for every day of the year.

NOTE: In order to be able to reset the time flow and back to 0 hours, the command (rpsetvar 'flow-time 0); is needed from the second day onwards.

I hope this is useful for someone in the future, there is small amount of information about it.
;
/define/models/radiation/solar-calculator -23.017 -67.753 -4 1 0 0 0 0 1 1 1 0 10 y 1 ;
/solve/set/time-step 900 ;
/solve dt 96 30 ;
;
/define/models/radiation/solar-calculator -23.017 -67.753 -4 1 0 0 0 0 1 2 1 0 10 y 1 ;
(rpsetvar 'flow-time 0);
/solve dt 96 30 ;
;
/define/models/radiation/solar-calculator -23.017 -67.753 -4 1 0 0 0 0 1 3 1 0 10 y 1 ;
(rpsetvar 'flow-time 0);
/solve dt 96 30 ;
;

Best Regards

Plamen

Hello,

I'm running into a similar issue and I was wondering if you could give a little more detail on how you solved this as I'm fairly new to Fluent so don't fully understand everything you are talking about. Do I need to set up a file with these commands? and how is that read into Fluent?

Sorry to be a bother.

Cheers

AlexanderZ June 25, 2021 00:52

usually you will run code above using journal file.
journal file is any text file with list of directives for fluent
to run it use fluent interface:
file-> read-> journal


All times are GMT -4. The time now is 10:32.