Defining internalHeatSource based on changing temperature?
3 views (last 30 days)
Lisa Hildebrand on 16 Mar 2020
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:
R(p) = solve(thermalmodel,linspace(0,(p-1)*TimeStep,2))
T(p) = R.Temperature(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])
iu(p,u)=(T(u,p-1)); %%key here is that T is solved temperatures
(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.
Ravi Kumar on 17 Mar 2020
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.