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

Heat source term using named expression for feedback control

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 2, 2022, 11:13
Smile Heat source term using named expression for feedback control
  #1
New Member
 
sg.lee
Join Date: Aug 2022
Posts: 4
Rep Power: 4
sg.lee is on a distinguished road
hello.
I am wondering how to set up feedback control in terms of heat src as shown in figure and expression.
I'm not sure how to set "Src_old". I don't know how to set the volumetric heat source value used for the current iteration as a variable.


<figure>
|temp_sensor|<~~~heat~~~~|_heater_|
|_(T_current)|<~~~heat~~~~|_(Src)__|
|___[K]____ |<~~~heat~~~~|[W/m^3]|


<named expression>
T_target = 3000 [K]
T_current = AreaAve(T, ['temp_sensor'])
damp = 0.2
Src_new = Src_old*(1+damp*(T_target - T_current)/T_target))*1[W/m^3]
Src_old = ???????

regards
CFD user
sg.lee is offline   Reply With Quote

Old   August 3, 2022, 01:28
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
as you've used Src_old to calculate Src_new probably you don;t need it anymore so Src_old = Src_new

show the whole UDF to get meaningfull answer, people cant read your mind
if you are using DEFINE_SOURCE macro, then you probably need UDMs to store source values for the next timestep
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 8, 2022, 01:09
Default
  #3
New Member
 
sg.lee
Join Date: Aug 2022
Posts: 4
Rep Power: 4
sg.lee is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
as you've used Src_old to calculate Src_new probably you don;t need it anymore so Src_old = Src_new

show the whole UDF to get meaningfull answer, people cant read your mind
if you are using DEFINE_SOURCE macro, then you probably need UDMs to store source values for the next timestep
====================================

I do not mean 'UDF', but 'named expression'.
I need how to define src_old using 'named expression'.

There is a variable called 'User Volumetric Energy Source', so I tried to set Src_current = VolumeAve(User Volumetric Energy Source, ,['heater']), but a message saying 'User Volumetric Energy Source could not be defined' appeared.

I don't know how to define the heat source [W/m^3] used in the 'named expression', not 'UDF'.

Thank you for your answer.
sg.lee is offline   Reply With Quote

Old   August 10, 2022, 02:14
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
so you may try this approach
Code:
Src_new =  VolumeAve(User Volumetric Energy Source, ,['heater'])*(1+damp*(T_target - T_current)/T_target))*1[W/m^3]
 VolumeAve(User Volumetric Energy Source, ,['heater']) = Src_new
however, this is valid starting from the second timestep, as User Volumetric Energy Source is not difed to the initial timestep

so you should check if "IF" condition is avaliable in expression:
1. yes -> you should check the time , if time ==0 -> apply some value to user columetric source, else expression above
2. no -> probably you may try to change expression manually -> apply some value to user columetric source on initial timestep, then manually change expression
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 10, 2022, 03:11
Default
  #5
New Member
 
sg.lee
Join Date: Aug 2022
Posts: 4
Rep Power: 4
sg.lee is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
so you may try this approach
Code:
Src_new =  VolumeAve(User Volumetric Energy Source, ,['heater'])*(1+damp*(T_target - T_current)/T_target))*1[W/m^3]
 VolumeAve(User Volumetric Energy Source, ,['heater']) = Src_new
however, this is valid starting from the second timestep, as User Volumetric Energy Source is not difed to the initial timestep

so you should check if "IF" condition is avaliable in expression:
1. yes -> you should check the time , if time ==0 -> apply some value to user columetric source, else expression above
2. no -> probably you may try to change expression manually -> apply some value to user columetric source on initial timestep, then manually change expression

thank you
I've already used 'User Volumetric Energy Source', but a error message 'Cannot define User Volumetric Energy Source..?' appeared.
Initialization was necessary with 'IF'.
Thank you very much.
sg.lee is offline   Reply With Quote

Old   August 24, 2022, 08:47
Default
  #6
New Member
 
sg.lee
Join Date: Aug 2022
Posts: 4
Rep Power: 4
sg.lee is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
so you may try this approach
Code:
Src_new =  VolumeAve(User Volumetric Energy Source, ,['heater'])*(1+damp*(T_target - T_current)/T_target))*1[W/m^3]
 VolumeAve(User Volumetric Energy Source, ,['heater']) = Src_new
however, this is valid starting from the second timestep, as User Volumetric Energy Source is not difed to the initial timestep

so you should check if "IF" condition is avaliable in expression:
1. yes -> you should check the time , if time ==0 -> apply some value to user columetric source, else expression above
2. no -> probably you may try to change expression manually -> apply some value to user columetric source on initial timestep, then manually change expression

So what about cfx?
Do you know what variable corresponds to 'User Volumetric Energy Source' in CFX instead of fluent?? I would like to recalculate the same interpretation with CFX. If you know, please let me know.
sg.lee is offline   Reply With Quote

Reply

Tags
expression, fluent, heat source, iteration, target temperature


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
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44


All times are GMT -4. The time now is 14:57.