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.