Is it possible to calculate stress in matlab using M,K matrix from ANSYS?

13 Ansichten (letzte 30 Tage)
daeho
daeho am 13 Mai 2024
Kommentiert: daeho am 29 Mai 2024
Hello,
Is it possible to calculate stress similar to ANSYS using stiffness, mass matrix, and mesh data exported from ANSYS in MATLAB? I have successfully obtained the final deformation using the HHT-alpha method, which is ANSYS's transient analysis algorithm with M and K matrix. Although there is a slight difference in values, I believe it's due to the error in calculating the inverse matrix. Now, I want to calculate the stress using the deformation but I'm having difficulty grasping which method to apply. Is it possible to write code entirely on my own without using the PDE toolbox to achieve stress values similar to ANSYS?
I would greatly appreciate it if you could provide me with any related code, materials, or detail methods.

Antworten (1)

Himanshu
Himanshu am 28 Mai 2024
Hey Daeho,
It is possible to calculate stress from deformation data in MATLAB without the PDE toolbox. The calculation of stress from deformation depends on stress, strain, and deformation in the material.
Since you mentioned that you have calculated the deformatoin, the next step would be to calculate the stress and strain.
  • From the deformation data, you can calculate the strain. For small deformations, strain can often be approximated as the gradient of the displacement field.
  • With the strain, you can then use the material's constitutive model to calculate stress. For a linear elastic material, this is generally done using Hooke's law.
This following example code snippet assumes you have a simple model and you're working with linear elasticity. Please adjust the parameters according to your requirements:
% Calculate D, the elasticity matrix for plane stress
E = 210e9; % Example for steel, in Pascals
nu = 0.3; % Typical for steel
D = E / (1 - nu^2) * [1, nu, 0; nu, 1, 0; 0, 0, (1 - nu) / 2];
% For each element, calculate strain and then stress
for elem = 1:size(elementNodes, 1)
% Extract nodal coordinates and displacements for the current element
nodes = elementNodes(elem, :);
elemCoords = nodeCoordinates(nodes, :);
elemD = deformation(nodes, :);
% Calculate strain for the element - simplified, depends on element type
% This step is highly dependent on your element type and mesh
% For example, for a 2D triangular element:
% B = ... % Calculate the strain-displacement matrix B
% strain = B * elemD(:);
% Calculate stress
stress = D * strain;
% Store or process the stress as needed
% ...
end
Here, E is the Young's modulus, nu is the Poisson's ratio, deformation is a matrix of nodal displacements obtained from your analysis, elementNodes is a matrix defining nodes for each element, nodeCoordinates is a matrix defining the x, y coordinates of each node.
  1 Kommentar
daeho
daeho am 29 Mai 2024
Hi himanshu,
Thank you for you response.
I understand that in FEA software like ANSYS or ABAQUS, the strain within an element is calculated at integration points (Gauss points) using the element's shape function. This strain is then extrapolated to the nodes to compute nodal strains and stresses. Recently, I wrote a code to perform these calculations on a very simple model (a cube made up of a few tetrahedral elements), and everything worked fine. However, when dealing with more complex geometries like a wheel or a lower control arm, I've noticed significant discrepancies overall. Particularly, when comparing the Gauss point coordinates to those in ANSYS, there seems to be a significant error specifically in the x-axis coordinates, despite using the same shape functions for x, y, and z coordinates. Could there be a reason why errors are only occurring in the x values?

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by