CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Variable Energy Source Terms using Scheme

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By LuckyTran

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2018, 08:03
Question Variable Energy Source Terms using Scheme
  #1
New Member
 
Mike
Join Date: May 2018
Posts: 10
Rep Power: 5
mir9283 is on a distinguished road
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
mir9283 is offline   Reply With Quote

Old   May 25, 2018, 12:12
Default
  #2
Senior Member
 
Lucky Tran
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 4,438
Rep Power: 53
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
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
) 
)
The tabular format looks like so:
Code:
sampletabprofile 2 3 0
time u
1 10
2 20
3 30
The 0 means this is not a periodic profile. The 3 means there are 3 data. Change this 3 for your setup to whatever number. In the last example with tabular format, the 2 means there is two fields (the time field and u field). If you have only time and heat then you will also use 2. Everything is in Fluent standard units.
mir9283 likes this.
LuckyTran is offline   Reply With Quote

Old   May 28, 2018, 07:55
Default
  #3
New Member
 
Mike
Join Date: May 2018
Posts: 10
Rep Power: 5
mir9283 is on a distinguished road
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.
mir9283 is offline   Reply With Quote

Old   May 28, 2018, 15:55
Default
  #4
New Member
 
mohsen
Join Date: May 2018
Posts: 1
Rep Power: 0
mohsen_a_s is on a distinguished road
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?
mohsen_a_s is offline   Reply With Quote

Reply

Tags
energy, scheme, source, terms, variable

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 02:38.