Skip to content

Conversation

@Vybornak2
Copy link
Collaborator

Adding basic stress calculation functions based on #12 .

Currently did not implement generics as for the sake of simplicity.
Mypy precommit hook version has been upgraded to resolve np.linalg mypy errors.

Please check validity calculation functions @KarasTomas.

@Vybornak2
Copy link
Collaborator Author

Tests are missing and are yet to be implemented before merging of the PR.

@Vybornak2 Vybornak2 assigned justOleh and KarasTomas and unassigned justOleh Aug 16, 2025

This comment was marked as outdated.

@Vybornak2 Vybornak2 added the WIP Work In Progress label Aug 17, 2025
@codecov-commenter

This comment was marked as outdated.

@Vybornak2 Vybornak2 requested a review from Copilot August 18, 2025 07:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds basic stress calculation functions for structural mechanics, introducing a new struct_mech module with comprehensive stress analysis capabilities. The implementation includes principal stress calculations, equivalent stress measures (von Mises, Tresca), and utility functions for handling Voigt notation tensors.

  • Implements fundamental stress metrics including principal stresses, hydrostatic stress, von Mises stress, and Tresca stress
  • Adds utility functions for Voigt notation handling and tensor conversions
  • Updates pre-commit hook versions to resolve mypy compatibility issues with numpy.linalg

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/fatpy/utils/voigt.py New utility module for Voigt notation vector handling and tensor conversion
src/fatpy/struct_mech/stress.py Main stress calculation module with principal stresses, equivalent stresses, and invariants
src/fatpy/structural_mechanics/eq_stresses.py Removed placeholder content
.python-version Added Python 3.12 version specification
.pre-commit-config.yaml Updated pre-commit hook versions for compatibility
Comments suppressed due to low confidence (1)

src/fatpy/struct_mech/stress.py:1

  • The if __name__ == "__main__": block contains commented-out test code and should be removed from production code. This type of debugging/example code belongs in tests or documentation, not in the main module."
"""Calculate fundamental stress metrics and invariants.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@KarasTomas KarasTomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the main changes are for the Voigt vector and tensor handling in utils/voigt.py.
The option for adding time as another dimension for stress data as well as component ordering should be further discussed.

@Vybornak2
Copy link
Collaborator Author

Changes implemented:

functions now utilize vectors of shape (... , 6)
stress_voigt replaced with stress_vector_voigt
signing function now handle edge cases
tests implemented

@KarasTomas please look at implemented tests, review the changes

@Vybornak2 Vybornak2 requested a review from Copilot September 28, 2025 23:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 12 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/fatpy/struct_mech/stress.py:1

  • The eigenvalues from np.linalg.eigvalsh are returned in ascending order, but the function expects descending order. Using principals[0] and principals[2] assumes descending order (σ1, σ2, σ3), but eigvalsh returns ascending order. This should use principals[-1] and principals[0] or sort the eigenvalues first.
"""Calculate fundamental stress metrics and invariants.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@KarasTomas KarasTomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated version correctly implements the variable stress vector dimension as requested.
Tests were also implemented.
Function docstrings were upgraded as well.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 8 out of 12 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@KarasTomas KarasTomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stress functionality is ready for merge to main.

@Vybornak2 Vybornak2 merged commit 47c8495 into main Oct 6, 2025
2 checks passed
@Vybornak2 Vybornak2 deleted the struct-mech-stress branch October 6, 2025 11:51
@Vybornak2 Vybornak2 removed the WIP Work In Progress label Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants