How can I define the temperature in 2D domain at location x,y [rather than nodal locations] for steady state or transient solution?
3 views (last 30 days)
Show older comments
John McGrath
on 21 Aug 2024
Commented: John McGrath
on 23 Aug 2024
I have been able to duplicate the results for the steady state and transient responses for the problem defined at
This example includes code to plot the temperature at a specific point in the block, in this case near the center of the right edge, as a function of time.
I would be interested to define the temperature and temperature history at any x,y location for the defined block with the slot in it- for example at the top right corner of the slot.
0 Comments
Accepted Answer
Shishir Reddy
on 23 Aug 2024
Hi John
Finding the temperature at an arbitrary point ((x, y)) within a finite element mesh can be challenging because directly calculating the temperature at a random (x, y) point would require identifying the element containing the point and using interpolation functions, which can be complex and computationally intensive.
Instead of calculating the temperature at the exact (x, y) point, it can be approximated to the temperature at the nearest node. This is an efficient approximation because it reduces the complexity and also gives closer estimate to the temperature if the mesh is sufficiently refined.
If observed closely, it can be understood that same method is followed in the documentation in finding the temperature at the centre of the right edge as well.
% Function to find the index of the nearest node
getClosestNode = @(p, x, y) find(min((p(1,:) - x).^2 + (p(2,:) - y).^2) == (p(1,:) - x).^2 + (p(2,:) - y).^2);
% Find the index of the nearest node
nid = getClosestNode(p, x_target, y_target);% (x_target, y_target) are the coordinates of the specific position we would like to calculate the temperature at.
To find the temperature at top right corner of the slot, substitute x_target = 0.5 and y_target = 0.8.
I hope this helps.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!