-
Notifications
You must be signed in to change notification settings - Fork 2
Thermoelastic3d #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Thermoelastic3d #209
Conversation
g-braeunlich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs seem to be missing (see docs/README.md)
SoheylM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary:
- Fix the TODO comment or document the reason
- Correct the docstring in shape_fun_and_derivs
- Add error handling for solver failures
- Add shape validation for boundary condition arrays
- Consider extracting magic numbers to named constants
- Verify render() return type matches annotation
- Add unit tests for the elasticity matrix construction
| @@ -0,0 +1,269 @@ | |||
| """Module for the forward solver for the thermoelastic3d problem.""" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fem_setup does large matrix operations without explicit memory management. Could we use sparse matrix operations to optimize a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For assembling the global stiffness matrices I am using coo_matrix for speed (these are sparse). For solving the linear system, I am using an iterative solver to massively reduce the memory requirement. Is there an additional area in particular where I should be using sparse matrices?
Added README.md file with problem information. |
|
So I fixed all the mypy related errors for the thermoelastic3d problem, however mypy still fails because other problems are triggering mypy errors (specifically airfoil and thermoelastic2d). When I merged in thermoelastic2d last year, there were no issues with mypy. As such, I believe that the git action verifying mypy errors may have changed (specifically I think it is using a newer python version and thus a newer mypy version). Below is the mypy error message from the git action: engibench/problems/airfoil/utils.py:265: error: Argument 5 to "_order_segments" has incompatible type "ndarray[tuple[int], dtype[signedinteger[_32Bit | _64Bit]]]"; expected "ndarray[tuple[Any, ...], dtype[signedinteger[_32Bit]]]" [arg-type] One solution is to decide on a specific version of mypy to use, and use this for all future git actions. Curious to hear other opinions on this. |
|
The philosphy so far was to always use the lates mypy / ruff, so we gradually improve our codebase with every improvement in the tools. |
That sounds good to me. For the pull request then, I would need to make the fixes on the airfoil and thermoelastic2d problems as well. I authored the thermoelastic2d problem so this is no problem, but are you alright if I make the changes for the airfoil problem as well? Let me know and I will commit the new changes. |
… to not specify floating point values Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
…ror handling, and added some constants for readability.
…g issues that I cannot see locally
…ght be an issue with mypy type checking here
5e75abc to
7351d2a
Compare
|
I fixed the typing issue in a separate PR which @markfuge approved. This PR has been rebased now on the merged PR. Tests should pass now |
|
@gapaza I think we can merge this now that @g-braeunlich has merged in the mypy fixes for the unrelated problems. Is this correct? @g-braeunlich are there other changes you need or can we approve this? I'll note that the one check that didn't pass was the windows test due to a timeout. We can discuss in the next EngiBench meeting how to handle this, but I don't think this is a problem with this particular PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left a minor suggestion, which should be ready to accept by a click
Adding more detailed docstrings to help with documentation Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
|
Okay @g-braeunlich I accepted the suggestion. If you can go ahead and approve your review of the PR to unblock the merge, then @gapaza can merge it in when he is ready. |
Description
This is the second version of this pull request, as the first didn't pass the mypy or ruff checks. I think mypy still fails because of a line in heatcondiction3d, but I didn't want to be both adding this problem and fixing the heatconduction3d one.
This pull request contains the entire codebase for the thermoelastic3d problem. It is quite similar to the thermoelastic2d problem with some minor additions. Two new dependencies were added to the pyproject.toml file. One outstanding issue to be resolved is the render function. I am using napari to visualize the 3d designs, so I am returning the napari np.ndarray in this function as I couldn't find a figure class like matplotlib. Besides this, everything seems ok for the time being.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
Checklist:
pre-commitchecks withpre-commit run --all-filesruff check .andruff formatmypy .Reviewer Checklist: