How to extract body load from Matlab PDE solver after using interpolateStress function?

4 次查看(过去 30 天)
assembleFEMatrices function in Matlab PDE solver eturns a structural array containing all finite element matrices such as body load. assembleFEMatrices can retuen body load based on the intial mesh size of the model which provided by genetereMesh function. For example if our model has 20 nodes it returnes 40 X 1 vector which the first 20 rows coresponds to horizental direction and the next 20 rows coresponds to certical direction. Now if I use interpolateStress to Interpolate stress at arbitrary spatial locations (interpolate over mesh grid of 100 X 100) I cannot extract body load at new arbitrary spatial locations.
Any Idea how to extract body force after I used interpolateStress?

回答(1 个)

Infinite_king
Infinite_king 2023-10-13
Hi Hamed,
I understand that you are trying to calculate the induced load in a specific area.
The method for calculating this load depends on the specific problem. If we have access to normal stress information, we can determine the load or force as follows,
% create mesh for the area of interest
% endpoints of the square
left_x = -1;
right_x = 1;
up_y = 1;
down_y = -1;
step_size = 100;
% calulating area of single square or grid in the mesh
single_grid_area = (right_x-left_x)/step_size * (up_y-down_y)/step_size;
% creating meshgrid
x = linspace(-1,1,step_size);
y = linspace(down_y,up_y,step_size);
[X,Y] = meshgrid(x,y);
% calculating the stress at each point given in the meshgrid
% results contains the solution of given PDE
intrpStress = interpolateStress(results,X,Y);
% reshape the stress array to the dimensions of the X,Y meshgrid
sxx = reshape(intrpStress.sxx,size(X));
% Calculating the load on the area of interest
% by summing the loads on each square (grid) in the mesh
load = 0;
for i = 1:step_size
for j = 1:step_size
load = load + single_grid_area * sxx(i,j);
end
end
The for loop can be optimized and written as follows,
% optimizing the load calculation
load = sum(sxx, "all") * single_grid_area;
For more information refer the following resources,
  1. https://www.mathworks.com/help/pde/ug/pde.staticstructuralresults.interpolatestress.html#d126e89319
  2. https://www.mathworks.com/help/pde/ug/assemblefematrices.html#:~:text=.-,assembleFEMatrices,-returns%20the%20following
  3. https://www.mathworks.com/help/pde/ug/pde.pdemodel.generatemesh.html
Hope this is helpful.

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by