
[Sponsors] 
July 26, 2015, 21:44 
heat source vary with time

#1 
New Member
Join Date: Jun 2011
Posts: 28
Rep Power: 6 
HI there!
I have a problem with which I would like to do in cfx. I have 2 chips having high power (10W) at a certain time say for 2 sec and then after that it will shut off (0W) for 20 sec. How can I input this as an expression in my Heat source using transient simulation? I also wanted my time to be short like say .... for 1.5 sec i will divide it by 0.1s (15 timestep) and then 10sec by 1s (10 timesteps) and lastly 10sec by 2s (5 timesteps). All have 5 coefficient loops. Thanks guys! =) 

July 27, 2015, 06:29 

#2 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 11,267
Rep Power: 88 
You can do this easily, by at least 2 methods:
1) Use a 1D interpolation function 2) Use a CEL expression. Something like timestep = if(t<1.5[s],0.1[s],if(t<11.5[s],1[s],2[s])) will do your time step function. 

July 27, 2015, 21:30 

#3  
New Member
Join Date: Jun 2011
Posts: 28
Rep Power: 6 
Quote:
anyway, if i do 5 cycles (total time is 125s) how can i do this? My statement is something like this: Q=0 Q1=10W So if at 1.5sec my power is Q1 then run it until 25 sec for Q. My formulated heat source expression should be something like this? heat source = if (t<1.5, Q1, Q, if (t<26.5, Q1, Q)) and soon... can you teach me on how to properly write my code? Thanks a lot! =) btw, my timestep on 1 cycle is something like this: Timesteps = 10*0.1, 4*0.25, 6*0.5, 10*1, 5*2 [s] 

July 27, 2015, 21:56 

#4 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 11,267
Rep Power: 88 
Doing it using if statements gets pretty horrible pretty quickly. Two options come to mind:
1) Do it using a 1D interpolation function and generate the function you wish. 2) Use the mod function to work out where in the cycle you are. I think mod(t,25[s]) will give you the time into the current 25 second cycle. Then you only need to define the function for one cycle. 

July 28, 2015, 02:21 

#5  
New Member
Join Date: Jun 2011
Posts: 28
Rep Power: 6 
Quote:
But can you help me creating the function? Sorry coz Im new to this CEL thing... User Function: For #1) Argument Units = [s]; Result Units = [kg m^2 s^3] < watts Since this have 5 cycles, I will just input conditions on 1 cycle where: Coordinate = 1.5 ; Value = 16 Coordinate = 25 ; Value = 0 Is this correct? As for the mod function on my transient timestep... sorry I have no idea how to formulate. Hope you can help me out. Will try to read and study more so that I can understand deeply on what you are trying to teach. I apologize for the time and thanks for being patient. 

July 28, 2015, 05:50 

#6 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 11,267
Rep Power: 88 
Here's some CEL which will turn the power on for 1s and off for 10s forever:
Cycletime = mod(t,11[s]) HeaterPower = if(Cycletime<1[s],100[W],0[W]) If you use a CEL function to control time step size then you have to validate that every bit of your time step function is OK  a nightmare. A much better approach is just to use adaptive time stepping, homing in on 35 coeff loops per iteration and with a min and max time step size wide enough that you never hit them. 

July 29, 2015, 02:03 

#7  
New Member
Join Date: Jun 2011
Posts: 28
Rep Power: 6 
Quote:
my conditions are these: Heat ON > 2s, 27s Heat OFF > 2s to 25s and 27s to 50s These are already 2 cycles. How can I simply this using adaptive time stepping? For the heat source my CEL should be: heaterPower = if(Cycletime<1[s],100[W],0[W]) For the transient adaptive panel: Total time = 50sec Option: Adaptive First Update Time = ? Timestep Update Freq = ? Initial timestep = ? Num of Coeff Loops; Max Time Step =? ; Min Time Step =? Target max Loops = 5 (default) Target min Loops = 2 (default) Timestep Dec Fac = 0.8 (default) Timestep Inc Fac = 1.06 (default) Thanks again @ghorrocks! I found little success on these adaptive transient examples on the web and so Im here. =) 

July 29, 2015, 06:13 

#8 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 11,267
Rep Power: 88 
I will let you sort out the details of the CEL expression. I think you get the idea.
For adaptive time stepping: Total time = 50sec (Whatever you want the total time to be) Option: Adaptive First Update Time = ? (a small number so it starts updating on the first time step). Timestep Update Freq = ? (Use 1 so it updates every time step) Initial timestep = ? (Your best guess for the initial time step. If you run it and it quickly makes the time step bigger or smaller then stop the run, change the initial time step to the value it wants to use and restart) Num of Coeff Loops; Max Time Step =? ; (use 1e10 so it never hits it) Min Time Step =? (use 1e10 so it never hits it) Target max Loops = 5 (default) Target min Loops = 2 (default) Timestep Dec Fac = 0.8 (default) Timestep Inc Fac = 1.06 (default) 

July 31, 2015, 04:33 

#9 
New Member
Join Date: Jun 2011
Posts: 28
Rep Power: 6 
thanks @ghorrocks! will try my best and hopefully I could get this done.


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
swak4foam building problem  GGerber  OpenFOAM Installation  54  April 24, 2015 16:02 
Compressor Simulation using rhoPimpleDyMFoam  Jetfire  OpenFOAM Running, Solving & CFD  107  December 9, 2014 14:38 
friction forces icoFoam  ofslcm  OpenFOAM  3  April 7, 2012 10:57 
time dependent source using DEFINE_SOURCE  T81  Fluent UDF and Scheme Programming  5  February 28, 2011 18:23 
DecomposePar links against liblamso0 with OpenMPI  jens_klostermann  OpenFOAM Bugs  11  June 28, 2007 17:51 