JWock82 / Pynite

A 3D structural engineering finite element library for Python.
MIT License
454 stars 93 forks source link

Quad results in global coordinate system #192

Open bjhowie opened 5 months ago

bjhowie commented 5 months ago

As I understand it, at the moment you can only extract results from quads (and presumably plates) in the quad's local coordinate system.

I assume it's a trivial process to convert results into the global coordinate system using the quad's transformation matrix, but I'm a little unfamiliar with the mathematics.

If it's something that's straightforward to implement, it'd be great to see it in a future release.

bjhowie commented 5 months ago

Or as another thought, each quad could have a local axis vector defined (or use an auxiliary node) that gets projected onto the plane of the quad to form the quad's local X axis instead of just using the node3->node4 vector as is currently done. I assume the 3-4 vector is just an arbitrary selection anyway?

I'm happy to have a go at implementing if you think it could work...

JWock82 commented 5 months ago

I think it’s pretty simple. I believe you just take the quad results in each direction and multiply them by the appropriate direction cosines for the quad. The direction cosines are the first 3 rows (dircosX, dircosY, dircosZ) and first 3 columns of the transformation matrix, T, which PyNite already can calculate for you. I’d be happy to have your help.

JWock82 commented 4 months ago

I've decided to take a stab at this. It's a feature I've been meaning to get to. I'll let you know what I come up with.

bjhowie commented 4 months ago

Thanks, it looks like my attempt failed. It seems to work OK for rectangular elements which I had originally tested it with, but results diverge pretty quickly with skewed quads.

Below are two deflection plots, both using the custom local axes method from my pull request. The rectangular(ish) quad plot looks quite good, the other with skewed quads is incorrect. Both deflection plots look OK with the previous local axis system, but obviously the quad moment and shear plots are not correct for the skewed quad example.

Screenshot 2024-05-08 204510-rect

Screenshot 2024-05-08 205637-skewed

JWock82 commented 4 months ago

I've created a new branch global_plate_stress for development of this feature. Feel free to check out and test out that branch and see if it's behaving as you expect. It seems to be working, but I'd like to double check my "theory" behind the stress transformation before publishing it to the main branch. I have only done it for shears (QX and QY) and moments (MX and MY), not displacements yet.

bjhowie commented 4 months ago

OK I've tested it a bit and am getting some odd results. Below is the same example as above, but with MX moments:

mx_unskewed mx_skewed

This is another test I was using to test my implementation. It's a slab supported only at its corners with a uniform area load applied to all quads. The two copies to the right are rotated 45 and 90 degrees with respect to the slab on the far left. It looks better than the above example, but the sign of the moment seems to be inverted. I also saw this issue when i tried to implement this method last week.

local_comp1

More to the point, I dont really understand your implementation. What would it mean to get the global Mx moment from a quad whos normal vector is parallel to the global X axis? You're trying to return plate bending moments about an axis that may not lie within the plane of the quad. I'm sure it's mathematically possible, but feels weird.

Most commercial applications seem to allow you to define custom local axis orientations for each quad, then all results are reported about those local axes. This is the reason I tried to take a similar approach with my implementation.

bjhowie commented 4 months ago

Just having a look at my implementation again. It looks like the only issue was that i didnt adjust the T matrix calculation to use the new local axis vectors. Seems to be working well now.

I'll update the pull request. Have a look and see what you think.

JWock82 commented 4 months ago

I often use global MX, MY, and MZ. If you have plates in the mesh with non-aligned local axes, it will resolve the forces to be rendered to the same axis for all plates. As long as your mesh is parallel to one of the 3 primary planes (XY, XZ, and YZ) the moments about 2 of the axes will be the primary moments you're interested in. If you choose to see results for an axis that is normal to the surface, you will will get zeros as your moment values.