# Transient Heat Transfer with Thermostat/ PID Controller

4 messages
Open this post in threaded view
|

## Transient Heat Transfer with Thermostat/ PID Controller

 I want to run a 3D transient heat transfer problem with a boundary condition q0 (inward heat flux, i.e. heating power) that depends on the dependet variable at a specific point (position of the temperature sensor). I know I can use the dependent variable in the boundary conditions but how can I access a value at a specific geometrical point? .. I tried the evalexpr function but couldn't make it work. A next step would be to also consider the transfer function of the temperature measurement as well as a PID controller. Are there ways to connect a transient HT problem with Simulink?
Open this post in threaded view
|

## Re: Transient Heat Transfer with Thermostat/ PID Controller

 Administrator Dan wrote I want to run a 3D transient heat transfer problem with a boundary condition q0 (inward heat flux, i.e. heating power) that depends on the dependet variable at a specific point (position of the temperature sensor). I know I can use the dependent variable in the boundary conditions but how can I access a value at a specific geometrical point? .. I tried the evalexpr function but couldn't make it work. I think the best way to do this is currently to add a "point geometry object, P1" in geometry mode to ensure that a mesh point will be generated there. Then write a custom/user-defined function that computes your heat flux for the boundary. In this function you can pass (x, y, z, T) and find T at the closest point to P1 to compute your heat flux. For example: https://www.featool.com/doc/physics.html#phys_coef_user Dan wrote A next step would be to also consider the transfer function of the temperature measurement as well as a PID controller. Are there ways to connect a transient HT problem with Simulink? There is no built-in connection with Simulink, but again you should be able to do this in your custom Matlab function.
 Administrator Dan wrote I did define a function for computing the heat flux and I am calling it from the boundary, where I want the heat flux to occur. I am passing it x,y and T. I all works well, however, how do I "find T at the closest point to P1"? I think when calling my custom function from a particular boundary, the values of the dependet variable T that are passed to that function are only the ones of the boundary that the function is called from? So how can I access the values of T at another point of the domain? Ah yes, quite right that the input to custom functions are local (per boundary/subdomain/assembly block). To access the global fea data you would need a workaround in your custom function after which you now can use evalexpr instead, something like:  function [out] = myfun(x,y,z) fea = evalin('caller', 'prob'); % Extract global fea data struct from calling function. T_p1 = evalexpr('T', [x1;y1;z1], fea); out = ones(size(x)) * T_p1; % Output array should have same size as input.