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

Function for plotting shear force added #19237

Merged
merged 4 commits into from Jan 7, 2021

Conversation

Psycho-Pirate
Copy link
Member

@Psycho-Pirate Psycho-Pirate commented May 1, 2020

References to other Issues or PRs

See #19202

Brief description of what is fixed or changed

A function for plotting shear force in 3D Beam is added.

Other comments

Release Notes

NO ENTRY

@Psycho-Pirate
Copy link
Member Author

Here is an example:

>>> from sympy.physics.continuum_mechanics.beam import Beam3D
>>> from sympy import symbols
>>> l, E, G, I, A, x = symbols('l, E, G, I, A, x')
>>> b = Beam3D(30, E, G, I, A, x)
>>> b.apply_load(8, start=0, order=0, dir="y")
>>> b.apply_load(9*x, start=0, order=0, dir="z")
>>> b.bc_deflection = [(0, [0, 0, 0]), (30, [0, 0, 0])]
>>> R1, R2, R3, R4 = symbols('R1, R2, R3, R4')
>>> b.apply_load(R1, start=0, order=-1, dir="y")
>>> b.apply_load(R2, start=30, order=-1, dir="y")
>>> b.apply_load(R3, start=0, order=-1, dir="z")
>>> b.apply_load(R4, start=30, order=-1, dir="z")
>>> b.solve_for_reaction_loads(R1, R2, R3, R4)
>>> print(b.plot_shear_force())

image
image
image

@Psycho-Pirate
Copy link
Member Author

Ping @moorepants @ishanaj @Sc0rpi0n101

@codecov
Copy link

codecov bot commented May 1, 2020

Codecov Report

Merging #19237 (1543fcd) into master (226b942) will increase coverage by 0.124%.
The diff coverage is 9.677%.

@@              Coverage Diff              @@
##            master    #19237       +/-   ##
=============================================
+ Coverage   75.650%   75.774%   +0.124%     
=============================================
  Files          651       674       +23     
  Lines       169488    174249     +4761     
  Branches     40021     41128     +1107     
=============================================
+ Hits        128219    132037     +3818     
- Misses       35652     36498      +846     
- Partials      5617      5714       +97     

@sympy-bot
Copy link

sympy-bot commented May 1, 2020

Hi, I am the SymPy bot (v161). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

  • No release notes entry will be added for this pull request.
Click here to see the pull request description that was parsed.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->
See #19202

#### Brief description of what is fixed or changed
A function for plotting shear force in 3D Beam is added.

#### Other comments


#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
NO ENTRY
<!-- END RELEASE NOTES -->

@Psycho-Pirate
Copy link
Member Author

Please add the physics.continuum.mechanics and plotting labels

@Psycho-Pirate
Copy link
Member Author

I have added a function for plotting shear force.
If this approach is approved, I will add other functions as well.
@moorepants @ishanaj @jashan498

@czgdp1807
Copy link
Member

@moorepants Is this good to go? Any thoughts on the changes by @Psycho-Pirate ?

return Pz.show()
# For shear force along all direction
else:

Copy link
Contributor

Choose a reason for hiding this comment

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

This case should plot all the graphs as subplots in a single plot.

Copy link
Member Author

Choose a reason for hiding this comment

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

The values of shear force can vary greatly along different directions. See the example i mentioned above, shear force along y has smaller values in hundreds, while shear force along z has values in thousands. Having them on a same plot may not convey the information clearly. What do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

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

The values of shear force can vary greatly along different directions

I don't think that would be an issue. Just give it a try and share the plot results here. You can see how plot_loading_results() functions.

@ishanaj
Copy link
Contributor

ishanaj commented Sep 5, 2020

I think for all the different cases the same code is being repeated. It would be better if the code is separated and put inside a helper function which would return the plot whenever required

@Psycho-Pirate
Copy link
Member Author

I think for all the different cases the same code is being repeated. It would be better if the code is separated and put inside a helper function which would return the plot whenever required

I agree! I will start working on this.

@Psycho-Pirate
Copy link
Member Author

Please have a look @ishanaj

@czgdp1807
Copy link
Member

@ishanaj Please review this PR.

@ishanaj
Copy link
Contributor

ishanaj commented Dec 25, 2020

It would be great if you could share some screenshots for the fourth case (dir='all' ) too.
The rest looks good.

@Psycho-Pirate
Copy link
Member Author

It would be great if you could share some screenshots for the fourth case (dir='all' ) too.
The rest looks good.

I have made the suggested changes and added an example in the docs as well.

>>> from sympy.physics.continuum_mechanics.beam import Beam3D
>>> from sympy import symbols
>>> l, E, G, I, A, x = symbols('l, E, G, I, A, x')
>>> b = Beam3D(20, E, G, I, A, x)
>>> b.apply_load(15, start=0, order=0, dir="z")
>>> b.apply_load(12*x, start=0, order=0, dir="y")
>>> b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])]
>>> R1, R2, R3, R4 = symbols('R1, R2, R3, R4')
>>> b.apply_load(R1, start=0, order=-1, dir="z")
>>> b.apply_load(R2, start=20, order=-1, dir="z")
>>> b.apply_load(R3, start=0, order=-1, dir="y")
>>> b.apply_load(R4, start=20, order=-1, dir="y")
>>> b.solve_for_reaction_loads(R1, R2, R3, R4)
>>> b.plot_shear_force('y')

Figure_1

>>> b.plot_shear_force()  #for all directions

xyz_1

@Psycho-Pirate
Copy link
Member Author

Here's a screenshot of the docs with the example added.
Screenshot from 2020-12-26 16-30-50

@ishanaj
Copy link
Contributor

ishanaj commented Dec 26, 2020

Great work! Looks good to me.
@Psycho-Pirate are you intending to add other plotting functions too in this PR?

@Psycho-Pirate
Copy link
Member Author

Great work! Looks good to me.
@Psycho-Pirate are you intending to add other plotting functions too in this PR?

Thanks!
I'm not planning about adding more plotting functions as of now because i have other issues pending and this pr has been open for months. But I'm open to suggestions about new plotting functions if you have any.

@ishanaj
Copy link
Contributor

ishanaj commented Dec 26, 2020

A plot function for bending moment, deflection, slope, should also be built in a similar manner. Maybe they can be added in a separate PR. Otherwise, I think this is good to go! @moorepants @czgdp1807

@Psycho-Pirate
Copy link
Member Author

A plot function for bending moment, deflection, slope, should also be built in a similar manner.

I'll start working on them. Thanks for reviewing!

@Psycho-Pirate
Copy link
Member Author

Please get this merged @czgdp1807 @moorepants

@czgdp1807
Copy link
Member

@asmeurer Could you please give merge access to @ishanaj ?
Many days have passed since merge approval was given and therefore I will wait till tomorrow to merge this. Thanks for the contributions.

@czgdp1807 czgdp1807 closed this Jan 7, 2021
@czgdp1807 czgdp1807 reopened this Jan 7, 2021
@oscarbenjamin
Copy link
Contributor

I have sent a request to add @ishanaj as a member. @ishanaj if you accept the request then you will be able to merge this.

@ishanaj
Copy link
Contributor

ishanaj commented Jan 7, 2021

Thanks @oscarbenjamin! I will be merging this now.

@ishanaj ishanaj merged commit eb9543a into sympy:master Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants