Author |
Message |
Kevin Ellwood (ikevin)
Member Username: ikevin
Post Number: 32 Registered: 06-2003
| Posted on Thursday, February 17, 2005 - 07:43 am: | |
Hi All I am having a bit of trouble with calculating some values derived from a variable that I transfer from a previous simulation. Below is a bit of code from the flexpde input file and everything seems to be working except for the calculation of "T_inside" and "tmean". "T0" is interpolated between the constant "trest" and the temperature field "temp_init". Contours of "T0" and plotting the variable "tttemp" show that this part is working. However, "T_inside" and "tmean" have values that never change and the value is "trest". Is there some special property for "transfer" variable that prevent their use in sintegral() and area_integral().? Thanks Kevin Code snipet: transfer('tire_temp_trans.dat',temp_init) temp1 = SAVE(temp_init) trest = 273.15+20.0 T0 = if (tc<t1) then trest else if (tc<t2) then swage(tc-ts1,trest,temp1,tint) else if (tc<t3) then swage(tc-ts2,temp1,trest,tint) else if (tc<t4) then swage(tc-ts3,trest,temp1,tint) else if (tc<t5) then swage(tc-ts4,temp1,trest,tint) else trest T_inside = sintegral(T0,"liner_surf")/sintegral(1,"liner_surf") tmean = area_integral(T0)/area_integral(1) tttemp = EVAL(T0,34.04, 8.348)
|
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 326 Registered: 06-2003
| Posted on Thursday, February 17, 2005 - 05:36 pm: | |
I don't see any reason why this should not succeed. But then you have not specified how tc is defined, and this would seem to be the core of the problem. Tc always appearing to be less than t1 or greater than t5 would result in what you see. Why don't you send me the file, and I'll try to see what's happening.
|
Kevin Ellwood (ikevin)
Member Username: ikevin
Post Number: 33 Registered: 06-2003
| Posted on Friday, February 18, 2005 - 10:22 am: | |
Hi Robert "Tc" is defined as tc= mod(t,86400) ts1 = 25100.0 ts2 = ts1 + 3700.0 ts3 = ts2 + 28800.0 ts4 = ts3 + 3700.0 t1 = (0.0+ts1)/2.0 t2 = (ts1+ts2)/2.0 t3 = (ts2+ts3)/2.0 t4 = (ts3+ts4)/2.0 t5 = (ts4+86400.0)/2.0 and plotting of "TO" shows that it cycles correctly. On more interesting point that may help with what I am doing wrong is this: If I use VAL() instead of EVAL() in the definition of "tttemp", its value is constant at "trest". Thanks Kev
|
Kevin Ellwood (ikevin)
Member Username: ikevin
Post Number: 34 Registered: 06-2003
| Posted on Monday, February 21, 2005 - 01:43 pm: | |
One more interesting tidbit. I can calculate the quantities that I need, when I create a new "variable" called "T_calc" and define its equation to be: T_calc: T_calc = T0 The calculations: T_inside = integral(T_calc,"liner_surf")/sintegral(1,"liner_surf") and tmean = area_integral(T_calc)/area_integral(1) are correct. Thanks Kevin
|
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 328 Registered: 06-2003
| Posted on Monday, February 21, 2005 - 04:23 pm: | |
Send me the offending script so I can analyze it. |
Robert G. Nelson (rgnelson)
Moderator Username: rgnelson
Post Number: 329 Registered: 06-2003
| Posted on Tuesday, February 22, 2005 - 07:00 pm: | |
FlexPDE tries to avoid recomputing expensive things like integrals and fits any more than necessary. To accomplish this, it keeps a scoreboard for each item, along with a dependency list to show what it depends on. Whenever one if its dependencies changes, it is recomputed and marked valid. Interestingly, this dependency list does not include time itself. In your case, all the components of T0 are constant items, and it is only the time coordinate that causes the value of T0 to switch. This effect is not detected, and FlexPDE thinks the integral of T0 is constant in time. (Of course, T0 used in other places is still dynamically computed, because those other places are not under the control of the validation scoreboard). I will correct this in the next release, but in the meantime you can work around it by providing a branch of the T0 definition that contains an explicit reference to a time-varying quantity. For example, T0 = if(tc<0) then t_calc else if (tc<t1) then trest else .... This makes it look like it depends on t_calc, although tc will never be less than 0.
|
Kevin Ellwood (ikevin)
Member Username: ikevin
Post Number: 35 Registered: 06-2003
| Posted on Thursday, February 24, 2005 - 08:26 am: | |
Thanks a bunch. It is nice that my strange example might help improve flexpde. Kevin |
|