CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   heat source vary with time (https://www.cfd-online.com/Forums/cfx/157324-heat-source-vary-time.html)

mariconeagles96 July 26, 2015 21:44

heat source vary with time
 
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! =)

ghorrocks July 27, 2015 06:29

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.

mariconeagles96 July 27, 2015 21:30

Quote:

Originally Posted by ghorrocks (Post 557132)
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.

Thanks as usual for your support @ghorrocks! =)

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]

ghorrocks July 27, 2015 21:56

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.

mariconeagles96 July 28, 2015 02:21

Quote:

Originally Posted by ghorrocks (Post 557260)
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.

I totally agree with this! =)

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.

ghorrocks July 28, 2015 05:50

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 3-5 coeff loops per iteration and with a min and max time step size wide enough that you never hit them.

mariconeagles96 July 29, 2015 02:03

Quote:

Originally Posted by ghorrocks (Post 557300)
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 3-5 coeff loops per iteration and with a min and max time step size wide enough that you never hit them.

i see...so to make it simple if i only make 2 cycles what wil be my cycletime?

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. =)

ghorrocks July 29, 2015 06:13

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 1e-10 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)

mariconeagles96 July 31, 2015 04:33

thanks @ghorrocks! will try my best and hopefully I could get this done. :(


All times are GMT -4. The time now is 15:00.