Skip to content

Conversation

Davide-sd
Copy link
Contributor

References to other Issues or PRs

Fixes #24043

Brief description of what is fixed or changed

This PR is fixing the inconsistencies mentioned on Issue #24043 , thus providing a schematic view which is consistent with the sign convention used by the Beam class. Not only this improves the visualization. It also allows the users to better make sense of the symbolic results. In particular:

  • the draw method is no longer looking at the assumptions on symbolic loads and moments, which are not used by the Beam class either in its computations.
  • positive loads (numeric or symbolic) are pointing downward.
  • negative loads (numeric or symbolic) are pointing upward.
  • positive moments (numeric or symbolic) are directed counterclockwise.
  • negative moments (numeric or symbolic) are directed clockwise.
  • the draw method is now able to visualize symbolic distributed loads without raising errors.
  • the beam won't be hidden by the distributed loads.

Other comments

Release Notes

  • physics.continuum_mechanics
    • Improved the schematic view produced by the Beam.draw method.

@sympy-bot
Copy link

sympy-bot commented Sep 20, 2022

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

Your release notes are in good order.

Here is what the release notes will look like:

  • physics.continuum_mechanics

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.13.

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. -->

Fixes #24043 


#### Brief description of what is fixed or changed

This PR is fixing the inconsistencies mentioned on Issue #24043 , thus providing a schematic view which is consistent with the sign convention used by the `Beam` class. Not only this improves the visualization. It also allows the users to better make sense of the symbolic results. In particular:

* the `draw` method is no longer looking at the assumptions on symbolic loads and moments, which are not used by the `Beam` class either in its computations.
* positive loads (numeric or symbolic) are pointing downward.
* negative loads (numeric or symbolic) are pointing upward.
* positive moments (numeric or symbolic) are directed counterclockwise.
* negative moments (numeric or symbolic) are directed clockwise.
* the `draw` method is now able to visualize symbolic distributed loads without raising errors.
* the beam won't be hidden by the distributed loads.


#### Other comments


#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers.

or if no release note(s) should be included use:

NO ENTRY

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 -->

* physics.continuum_mechanics
  * Improved the schematic view produced by the `Beam.draw` method.

<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@moorepants
Copy link
Member

@AdvaitPote, given that you are also working on draw methods for the trusses, it would be in your best interest to review this PR and discuss.

@AdvaitPote
Copy link
Member

Very Good work @Davide-sd on this PR. The points that you raised in the corresponding issue are valid and the draw method could definitely use these improvements. I just have one issue with this which shouldn't take much time to resolve.

from sympy import *
from sympy.plotting import PlotGrid
from sympy.physics.continuum_mechanics import Beam
init_printing()

E, I, P = symbols('E, I, P')
R1, R2 = symbols('R1, R2')
M1, M2 = symbols('M1, M2')
L = symbols("L", positive=True)

b1 = Beam(L, E, I)
b1.apply_load(-R1, 0, -1)
b1.apply_load(R2, L, -1)
b1.apply_load(M1, L/4, -2)
b1.apply_load(-M2, 3*L/4, -2)
p1 = b1.draw()

b2 = Beam(L, E, I)
b2.apply_load(-2*R1, 0, -1)
b2.apply_load(R2, L, -1)
b2.apply_load(M1, L/4, -2)
b2.apply_load(-2*M2, 3*L/4, -2)
p2 = b2.draw()

PlotGrid(1, 2, p1, p2)

In the first case, what you have suggested having symbols with a negative sign to have directions the same as negative loads works. The Force R1 is in the upward direction and the Moment M2 is in the clockwise direction.
However, just adding a constant just reverts the method back to its original and now both forces and both moments are in the same direction despite there being a negative sign attached to the loads.

Screenshot 2022-10-03 at 4 54 23 PM

@oscarbenjamin
Copy link
Collaborator

This has merge conflicts now. I'll mark this as draft. Feel free to mark it as ready for review later.

@oscarbenjamin oscarbenjamin marked this pull request as draft November 24, 2022 20:05
I wish that were not flagged: it is  convenient way to avoid having to type string quotation marks.
@github-actions
Copy link

github-actions bot commented Sep 12, 2023

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

Significantly changed benchmark results (PR vs master)

Significantly changed benchmark results (master vs previous release)

| Change   | Before [8059df73] <sympy-1.12^0>   | After [cd89bf0b]    |   Ratio | Benchmark (Parameter)                                                |
|----------|------------------------------------|---------------------|---------|----------------------------------------------------------------------|
| -        | 87.3±2ms                           | 57.1±0.1ms          |    0.65 | integrate.TimeIntegrationRisch02.time_doit(10)                       |
| -        | 85.3±1ms                           | 56.7±0.9ms          |    0.67 | integrate.TimeIntegrationRisch02.time_doit_risch(10)                 |
| +        | 22.2±0.07μs                        | 38.9±0.2μs          |    1.76 | integrate.TimeIntegrationRisch03.time_doit(1)                        |
| -        | 6.98±0.02ms                        | 3.77±0.02ms         |    0.54 | logic.LogicSuite.time_load_file                                      |
| -        | 2.11±0ms                           | 654±1μs             |    0.31 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse')          |
| -        | 10.4±0.04ms                        | 1.96±0ms            |    0.19 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse')          |
| -        | 369±1μs                            | 82.0±0.2μs          |    0.22 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse')             |
| -        | 4.85±0.02ms                        | 363±1μs             |    0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse')             |
| -        | 10.7±0.04ms                        | 1.09±0ms            |    0.1  | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse')             |
| -        | 6.26±0.01ms                        | 3.95±0ms            |    0.63 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| -        | 27.3±0.07ms                        | 12.0±0.03ms         |    0.44 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| -        | 6.91±0.01ms                        | 1.18±0ms            |    0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse')    |
| -        | 16.3±0.06ms                        | 9.23±0.02ms         |    0.57 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse')    |
| -        | 212±0.4ms                          | 71.0±0.2ms          |    0.34 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse')    |
| -        | 6.37±0.01ms                        | 539±0.6μs           |    0.08 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse')     |
| -        | 27.8±0.05ms                        | 857±2μs             |    0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse')     |
| -        | 611±1μs                            | 201±0.9μs           |    0.33 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| -        | 6.49±0.02ms                        | 203±1μs             |    0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| -        | 17.0±0.04ms                        | 205±0.4μs           |    0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| -        | 164±0.2μs                          | 89.6±0.5μs          |    0.55 | solve.TimeMatrixOperations.time_rref(3, 0)                           |
| -        | 315±0.4μs                          | 108±0.8μs           |    0.34 | solve.TimeMatrixOperations.time_rref(4, 0)                           |
| -        | 31.7±0.07ms                        | 13.5±0.01ms         |    0.43 | solve.TimeSolveLinSys189x49.time_solve_lin_sys                       |

Full benchmark results can be found as artifacts in GitHub Actions
(click on checks at the top of the PR).

@smichr smichr marked this pull request as ready for review September 12, 2023 21:52
@smichr
Copy link
Member

smichr commented Sep 12, 2023

@AdvaitPote @moorepants , please give this another look.

@smichr
Copy link
Member

smichr commented Sep 15, 2023

Further modifications can be made in a new PR.

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.

Beam - inconsistent convention used on draw()
7 participants