Skip to content
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

Dev poisson ratio warning #26

Merged
merged 8 commits into from Nov 29, 2021
Merged

Conversation

armantekinalp
Copy link
Contributor

  • Soft changes are done for rod initialization. If user does not provides shear modulus then warning messages will be raised and shear modulus will be computed based on Poisson Ratio.
  • We changed the test scripts to test new warning messages.
  • Old test scripts are updated such that warning messages won't be raised.
  • Examples are updated such that warning messages won't be raised.

We changed the np.float in the code to np.float64 since numpy will stop using np.float in future relases.
This commit fixes some of the  Elastica test function warnings. Previously we named a dummy rod as a TestRod, which was assumed by pytests as a test function and a warninig is raised. We rename the class as DummyTestRod.
…ear modulus

This commit changes the elastica rod initialization such that if user does not pass shear modulus as an argument during the initialization of rod then a warning message raised. We also changed the necessary test functions according to new warning and add more test functions.
With this commit during the initialization step of cosserat rods, we remove the poisson ratio and use shear modulus.
…ved to other function.

This commit adds a new function which contains the warning functions of the shear modulus and poisson ratio, since allocate function was very complex previously.
@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2021

Codecov Report

Merging #26 (0e25e24) into master (fed4502) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #26      +/-   ##
==========================================
+ Coverage   90.57%   90.63%   +0.05%     
==========================================
  Files          58       58              
  Lines        3131     3150      +19     
  Branches      227      337     +110     
==========================================
+ Hits         2836     2855      +19     
  Misses        272      272              
  Partials       23       23              
Impacted Files Coverage Δ
elastica/_elastica_numba/_rod/_cosserat_rod.py 100.00% <ø> (ø)
elastica/_elastica_numpy/_rod/_cosserat_rod.py 100.00% <ø> (ø)
elastica/_elastica_numba/_external_forces.py 95.60% <100.00%> (ø)
elastica/_elastica_numpy/_external_forces.py 94.02% <100.00%> (ø)
elastica/rod/factory_function.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fed4502...0e25e24. Read the comment docs.


message = (
"Shear modulus cannot be found in kwargs. \n"
"Poisson ratio "
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest the warning being:
"The given Poisson ratio of "+ str(poisson_ratio) + " is used only to compute a shear modulus of " + str(shear_modulus) + ", " "using the equation: shear_modulus = youngs_modulus / (poisson_ratio + 1.0). Use of a Poisson ratio will be depreciated in a future release. It is encouraged that you discontinue using a Poisson ratio and instead directly provide the shear_modulus"

if kwargs.__contains__("poisson_ratio"):
poisson_ratio = kwargs.get("poisson_ratio")
message = (
" Poisson ratio ( "
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest:
"Both a Poisson ratio and a shear modulus are provided. The Poisson ratio is only used to compute a shear modulus so the provided Poisson ratio of ( "+ str(poisson_ratio)+ " ) is being ignored in favor of the provided shear modulus ( "+ str(shear_modulus)+ " ) \n"

@nmnaughton
Copy link
Collaborator

@armantekinalp I made two suggestions to changing the warnings to hopefully make them a bit more clear. Let me know what you think.

This commit updates the warning messages for `get_shear_modulus` function.
@armantekinalp
Copy link
Contributor Author

I made the changes and merging to the master.

@armantekinalp armantekinalp merged commit 19ecc37 into master Nov 29, 2021
@armantekinalp armantekinalp deleted the dev_poisson_ratio_warning branch November 29, 2021 02:44
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.

None yet

3 participants