# Defining internalHeatSource based on changing temperature?

조회 수: 5(최근 30일)
Lisa Hildebrand 2020년 3월 16일
댓글: Lisa Hildebrand 2020년 3월 19일
Hello,
I'm trying to apply an internalHeatSource to a 2D thermal model. My intent is to use it to simulate conduction to a flat plate from another body sitting on the flat plate. In order to do this, I need the internal heat source's value to vary depending on both the other component's temperature (which varies based on its current draw) and the plate's temperature nearby the body sitting on it. The only way I can think to do this is to find the temperatures at the nodes surrounding it and take their average, then feed this into calculations that go into a fuction for internalHeatSource. However, this requires me to collect temperature values as the solver solves. I tried putting the solver in the same for-loop as the rest of my calculations as follows:
for p=2:Sz2
R(p) = solve(thermalmodel,linspace(0,(p-1)*TimeStep,2))
toc
T(p) = R.Temperature(p);
Ti(p)=R.SolutionTimes(p);
qFuncHYD = @(region,state) HeatPWR_HYD(1,size(region.x,1)).*region.x; %creates an anonymous function with inputs region and state
qFuncLM = @(region,state) QCondLM(1,size(region.x,1)).*region.x
internalHeatSource(thermalmodel,qFuncHYD,'Face',2) %creates internal heat source on Face 2 using watts generated by qFunc
internalHeatSource(thermalmodel,qFuncLM,'Face',[3 4 5 6])
for u=Nr(1,:)
iu(p,u)=(T(u,p-1)); %%key here is that T is solved temperatures
end
AverageTempFoot1(p)=mean(iu(p,Nr));
QConvLM(p)=15*.2*(TLM(p-1)-20)/.00064;
QCondLM(p)=50*.0254^2/.05*(TLM(p-1)-AverageTempFoot1(p)')/.00064;
TLM(p)=TLM(p-1)+(HeatPWR_LM(p)-QConvLM(p)-QCondLM(p))*TimeStep*1/500/64*.00064;
end
(thermalmodel is the PDE; TimeStep is the desired time step between iterations; HeatPWR_HYD is a column matrix; Nr is a matrix defining the IDs of nodes I'm interested in; iu is a matrix to extract just the values of those nodes from the temperature solution; the constants are physical properties and surface areas. If anything is unclear, I can clarify more)
But this obviously limits the solver to only solve for two steps at a time, starting at 0, which is definitely wrong. I'm not really sure what to do from here. Any suggestions or explanations of things I'm missing about Matlab's thermal models would be appreciated.
Thanks!

댓글을 달려면 로그인하십시오.

### 채택된 답변

Ravi Kumar 2020년 3월 17일
Solver passes the value of solution and its derivatives in state struct array (state.u, state.ux, etc.) You can use this data in your function definition to write the expression of the heat source.
##### 댓글 수: 1표시숨기기 없음
Lisa Hildebrand 2020년 3월 19일
Thanks! That worked!

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by