|
[Sponsors] |
May 25, 2018, 08:03 |
Variable Energy Source Terms using Scheme
|
#1 |
New Member
Mike
Join Date: May 2018
Posts: 10
Rep Power: 8 |
Hi,
I'm trying to model a solid cube as a variable heatsource. Therefore I have enabled the source-terms in the cell-condition-window where I can choose between 1 and 10 heatsources. Also you can choose the value of the heatsource by selecting none, constant or New Parameter. As I want the heatsource to be variable I chose New Parameter and I'm now trying to write a Scheme file that changes the value at a determined timestep (e.g. 1 s). The values are given in an excel-sheet. I found the following code in the Ansys help (Fluent User's Guide: 6.1.8.2.3. Using the Text User Interface to Define UDFs and Scheme Procedures With Input Parameters) but as I'm new to Scheme I have no idea how to write a function that gets the values from the excel-sheet (or txt-file, if it's easier). (define my-funct (lambda (value ) (ti-menu-load-string (format #f "/solve/set/under-relaxation/pressure ~g" value)))) Maybe it is easier to use a UDF or there is even another way to do this like using a profile for heatflux. I hope that someone could help me with that. Thanks a lot Greets Mike |
|
May 25, 2018, 12:12 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,762
Rep Power: 66 |
There is a much easier way. Indeed too many people jump straight to coding a UDF and fall into a rabbit hole.
Create what is called a PROFILE in Fluent. It is just a text file with two blocks, one for time and another block for your heat (it can also accept a two column format). In the GUI: go to cell zone conditions and click Profiles... Then read in the text file you created. Now when you go to source terms, in addition to none, constant, New Input Parameter, you will also find your named profile. You can find an example in the user's guide in User's Guide => Cell Zone and Boundary Conditions => Profiles => Defining Transient Cell Zone and Boundary Condition Profiles Code:
((sampleprofile transient 3 0) (time 1 2 3 ) (u 10 20 30 ) ) Code:
sampletabprofile 2 3 0 time u 1 10 2 20 3 30 |
|
May 28, 2018, 07:55 |
|
#3 |
New Member
Mike
Join Date: May 2018
Posts: 10
Rep Power: 8 |
Thank you very much LuckyTran
I used the profiles before for heatflux boundary conditions but I couldn't find anything in the Ansys Help thatit's possible to use this for Source Terms too. |
|
May 28, 2018, 15:55 |
|
#4 |
New Member
mohsen
Join Date: May 2018
Posts: 1
Rep Power: 0 |
Hi.
I am trying to model a transient heat source based on the equation (q)=(a)*(b). Both (a) and (b) are transient parameters and I have their values in two different excel files. I know that it is possible to calculate the (q) manually and then use a PROFILE in Fluent, but I am going to do it with a UDF. Can any one please tell me about how to write the UDF and the appropriate macros? |
|
Tags |
energy, scheme, source, terms, variable |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[foam-extend.org] problem when installing foam-extend-1.6 | Thomas pan | OpenFOAM Installation | 7 | September 9, 2015 22:53 |
Problem compiling a custom Lagrangian library | brbbhatti | OpenFOAM Programming & Development | 2 | July 7, 2014 12:32 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |
UDF Scalar Code: HT 1 | Greg Perkins | FLUENT | 8 | October 20, 2000 13:40 |
Why FVM for high-Re flows? | Zhong Lei | Main CFD Forum | 23 | May 14, 1999 14:22 |