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

Implemented generalized solution for ILD #26007

Closed

Conversation

Preypatel2413
Copy link
Contributor

References to other Issues or PRs

Fixes #25714
Fixes #24439

Brief description of what is fixed or changed

  • In solve_for_reaction_loads() : Rewriting shear_force and bending_moment in Heaviside function before taking limit.

    • This gives correct reaction forces when there is applied force at a varible distance (Independent from length of beam).
  • Changed _solve_for_ild_equations() : this helper function was changed to take care of common code in solve_for_ild_reactions(), solve_for_ild_shear() and solve_for_ild_moment().

    • The current implementation of solve_for_ild_shear() and solve_for_ild_moment() splits ILD curve in 2 segments from the specified section which does not give correct solution for multispan beam.
    • using generalized method to find ILD curves.
      • Applying load at variable distance y (which is removed in the end).
      • Solving reaction forces in terms of y which gives ILD_reactions.
      • Using these reaction forces in shear force and bending moment to find generalized ILD curve. These equations will involve two variables x (self.variable: the variable at which we want to find the value of reaction force, shear force, or bending moment) and y (the distance at which the influence line load (ILD_load) is applied).
      • In the individual functions substituting x = Distance (the input distance of the section at which the ILD curve is to be found) and y = x. This gives ILD equation for shear force or bending moment which represents the shear force or bending moment at chosen distance when ILD load is applied at distance x.

Other comments

  • Taking example from 24439 : reaction_loads was {M0 : F1*L , R0 : -F1}

    • After changes : reaction_loads are {M_0: F_1L + F_2dHeaviside(L - d, 1), R_0: -F_1 - F_2Heaviside(L - d, 1)}. Which are correctly generalized.
  • Taking example from 25714 :

    • After changes : ILD_moment is
      Piecewise((x*(x**2 - 100)/1000, x <= 10), (3*x**2/100 - 2*x/5 + 1, x <= 15), (3*x**2/100 - 7*x/5 + 16, x <= 20), (0, x > 30), (x/10 - (x - 30)**3/1000 - 3, True))
      and following graph (which is accurate result)

      ild_moment

First-time Contribution:

  • This is my first pull request to SymPy, and I'm excited to contribute to the project! I appreciate any feedback or guidance from the community and look forward to learning and contributing more in the future.

Release Notes

NO ENTRY

@sympy-bot
Copy link

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.

  • 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. -->
Fixes #25714
Fixes #24439

#### Brief description of what is fixed or changed
* In `solve_for_reaction_loads()` : Rewriting shear_force and bending_moment in Heaviside function before taking limit.
  * This gives correct reaction forces when there is applied force at a varible distance (Independent from length of beam).

* Changed `_solve_for_ild_equations()` : this helper function was changed to take care of common code in `solve_for_ild_reactions()`, `solve_for_ild_shear()` and `solve_for_ild_moment()`.
  * The current implementation of solve_for_ild_shear() and solve_for_ild_moment() splits ILD curve in 2 segments from the specified section which does not give correct solution for multispan beam.
  * using generalized method to find ILD curves.
    * Applying load at variable distance `y` (which is removed in the end).
    * Solving reaction forces in terms of `y` which gives ILD_reactions.
    * Using these reaction forces in shear force and bending moment to find generalized ILD curve. These equations will involve two variables `x` (`self.variable`: the variable at which we want to find the value of reaction force, shear force, or bending moment) and `y` (the distance at which the influence line load (ILD_load) is applied).
    * In the individual functions substituting `x` = `Distance` (the input distance of the section at which the ILD curve is to be found) and `y` = `x`. This gives ILD equation for shear force or bending moment which represents the shear force or bending moment at chosen distance when ILD load is applied at distance `x`.


#### Other comments
* Taking example from [24439](https://github.com/sympy/sympy/issues/24439#issue-1514409011) : reaction_loads was {M0 : F1*L , R0 : -F1}
  * After changes : reaction_loads are {M_0: F_1*L + F_2*d*Heaviside(L - d, 1), R_0: -F_1 - F_2*Heaviside(L - d, 1)}. Which are correctly generalized.

* Taking example from [25714](https://github.com/sympy/sympy/issues/25714#issue-1907206104) :
  * After changes : ILD_moment is
    `Piecewise((x*(x**2 - 100)/1000, x <= 10), (3*x**2/100 - 2*x/5 + 1, x <= 15), (3*x**2/100 - 7*x/5 + 16, x <= 20), (0, x > 30), (x/10 - (x - 30)**3/1000 - 3, True))` 
and following graph (which is accurate result)

    ![ild_moment](https://github.com/Preypatel2413/ML_Assignment1/assets/76490445/01073f96-6050-43f7-b36d-a4cffc72860b)

**First-time Contribution:** 
* This is my first pull request to SymPy, and I'm excited to contribute to the project! I appreciate any feedback or guidance from the community and look forward to learning and contributing more in the future.


#### 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. Formerly, `log(-x)` incorrectly gave `-log(x)`.

* physics.units
  * Corrected a semantical error in the conversion between volt and statvolt which
    reported the volt as being larger than the statvolt.

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 -->
NO ENTRY
<!-- END RELEASE NOTES -->

Copy link

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 [a00718ba]    | After [c81c8169]    |   Ratio | Benchmark (Parameter)                                                |
|----------|----------------------|---------------------|---------|----------------------------------------------------------------------|
| -        | 68.6±0.7ms           | 44.0±0.2ms          |    0.64 | integrate.TimeIntegrationRisch02.time_doit(10)                       |
| -        | 67.7±1ms             | 43.7±0.3ms          |    0.65 | integrate.TimeIntegrationRisch02.time_doit_risch(10)                 |
| +        | 18.7±0.2μs           | 30.4±0.07μs         |    1.63 | integrate.TimeIntegrationRisch03.time_doit(1)                        |
| -        | 5.28±0.02ms          | 2.92±0.03ms         |    0.55 | logic.LogicSuite.time_load_file                                      |
| -        | 73.1±1ms             | 29.0±0.2ms          |    0.4  | polys.TimeGCD_GaussInt.time_op(1, 'dense')                           |
| -        | 25.7±0.1ms           | 17.1±0.03ms         |    0.67 | polys.TimeGCD_GaussInt.time_op(1, 'expr')                            |
| -        | 74.5±0.7ms           | 28.9±0.2ms          |    0.39 | polys.TimeGCD_GaussInt.time_op(1, 'sparse')                          |
| -        | 258±1ms              | 125±0.7ms           |    0.49 | polys.TimeGCD_GaussInt.time_op(2, 'dense')                           |
| -        | 258±2ms              | 126±0.8ms           |    0.49 | polys.TimeGCD_GaussInt.time_op(2, 'sparse')                          |
| -        | 650±4ms              | 373±2ms             |    0.57 | polys.TimeGCD_GaussInt.time_op(3, 'dense')                           |
| -        | 659±0.6ms            | 375±1ms             |    0.57 | polys.TimeGCD_GaussInt.time_op(3, 'sparse')                          |
| -        | 497±1μs              | 288±1μs             |    0.58 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(1, 'dense')            |
| -        | 1.78±0.01ms          | 1.05±0ms            |    0.59 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(2, 'dense')            |
| -        | 5.87±0.03ms          | 3.11±0.01ms         |    0.53 | polys.TimeGCD_LinearDenseQuadraticGCD.time_op(3, 'dense')            |
| -        | 446±1μs              | 229±2μs             |    0.51 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(1, 'dense')               |
| -        | 1.49±0.01ms          | 688±5μs             |    0.46 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(2, 'dense')               |
| -        | 4.88±0.03ms          | 1.68±0.01ms         |    0.34 | polys.TimeGCD_QuadraticNonMonicGCD.time_op(3, 'dense')               |
| -        | 376±2μs              | 206±0.7μs           |    0.55 | polys.TimeGCD_SparseGCDHighDegree.time_op(1, 'dense')                |
| -        | 2.46±0.02ms          | 1.25±0.01ms         |    0.51 | polys.TimeGCD_SparseGCDHighDegree.time_op(3, 'dense')                |
| -        | 10.1±0.06ms          | 4.37±0.04ms         |    0.43 | polys.TimeGCD_SparseGCDHighDegree.time_op(5, 'dense')                |
| -        | 352±2μs              | 168±0.8μs           |    0.48 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(1, 'dense')            |
| -        | 2.48±0.03ms          | 911±3μs             |    0.37 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(3, 'dense')            |
| -        | 9.56±0.03ms          | 2.68±0.01ms         |    0.28 | polys.TimeGCD_SparseNonMonicQuadratic.time_op(5, 'dense')            |
| -        | 1.03±0.01ms          | 426±5μs             |    0.41 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'dense')           |
| -        | 1.73±0.01ms          | 497±3μs             |    0.29 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(3, 'sparse')          |
| -        | 5.97±0.05ms          | 1.82±0.02ms         |    0.3  | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'dense')           |
| -        | 8.38±0.06ms          | 1.49±0.01ms         |    0.18 | polys.TimePREM_LinearDenseQuadraticGCD.time_op(5, 'sparse')          |
| -        | 286±2μs              | 64.0±0.7μs          |    0.22 | polys.TimePREM_QuadraticNonMonicGCD.time_op(1, 'sparse')             |
| -        | 3.42±0.03ms          | 401±3μs             |    0.12 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'dense')              |
| -        | 3.99±0.04ms          | 278±1μs             |    0.07 | polys.TimePREM_QuadraticNonMonicGCD.time_op(3, 'sparse')             |
| -        | 7.14±0.1ms           | 1.27±0.01ms         |    0.18 | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'dense')              |
| -        | 8.73±0.09ms          | 837±2μs             |    0.1  | polys.TimePREM_QuadraticNonMonicGCD.time_op(5, 'sparse')             |
| -        | 5.04±0.02ms          | 2.96±0.01ms         |    0.59 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(2, 'sparse') |
| -        | 12.2±0.1ms           | 6.64±0.05ms         |    0.54 | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'dense')  |
| -        | 22.6±0.09ms          | 9.09±0.04ms         |    0.4  | polys.TimeSUBRESULTANTS_LinearDenseQuadraticGCD.time_op(3, 'sparse') |
| -        | 5.21±0.02ms          | 867±3μs             |    0.17 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(1, 'sparse')    |
| -        | 12.6±0.1ms           | 7.04±0.04ms         |    0.56 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(2, 'sparse')    |
| -        | 104±0.4ms            | 26.2±0.06ms         |    0.25 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'dense')     |
| -        | 169±2ms              | 54.2±0.4ms          |    0.32 | polys.TimeSUBRESULTANTS_QuadraticNonMonicGCD.time_op(3, 'sparse')    |
| -        | 173±0.6μs            | 112±0.6μs           |    0.65 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'dense')      |
| -        | 357±5μs              | 216±1μs             |    0.61 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(1, 'sparse')     |
| -        | 4.30±0.06ms          | 843±4μs             |    0.2  | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'dense')      |
| -        | 5.35±0.03ms          | 384±0.8μs           |    0.07 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(3, 'sparse')     |
| -        | 20.4±0.1ms           | 2.81±0.01ms         |    0.14 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'dense')      |
| -        | 22.8±0.2ms           | 626±2μs             |    0.03 | polys.TimeSUBRESULTANTS_SparseGCDHighDegree.time_op(5, 'sparse')     |
| -        | 476±2μs              | 134±0.7μs           |    0.28 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(1, 'sparse') |
| -        | 4.63±0.06ms          | 634±4μs             |    0.14 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'dense')  |
| -        | 5.39±0.09ms          | 139±2μs             |    0.03 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(3, 'sparse') |
| -        | 13.2±0.06ms          | 1.29±0ms            |    0.1  | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'dense')  |
| -        | 13.8±0.06ms          | 140±0.3μs           |    0.01 | polys.TimeSUBRESULTANTS_SparseNonMonicQuadratic.time_op(5, 'sparse') |
| -        | 133±0.5μs            | 72.8±0.5μs          |    0.55 | solve.TimeMatrixOperations.time_rref(3, 0)                           |
| -        | 248±0.4μs            | 88.3±0.5μs          |    0.36 | solve.TimeMatrixOperations.time_rref(4, 0)                           |
| -        | 24.0±0.04ms          | 10.2±0.04ms         |    0.42 | 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).

@Preypatel2413
Copy link
Contributor Author

@AdvaitPote ,
Dear Sir,
I created this PR a while ago for solving issues related influence line diagram and calculating reaction loads for the Beam object when using undefined variables. I made changes in solve_for_reaction_loads() to obtain correct reaction forces even for variable distances, and generalized algorithm to solve for ILD equations. It would be very helpful if you could review this PR. Your suggestions will be very helpful for me.

@AdvaitPote
Copy link
Member

Sure will do. I have my midsems going on right now so I might take some days to get back to you.

@Preypatel2413
Copy link
Contributor Author

@AdvaitPote a gentle reminder.

@@ -1691,19 +1692,53 @@ def plot_loading_results(self, subs=None):

return PlotGrid(4, 1, ax1, ax2, ax3, ax4)

def _solve_for_ild_equations(self):
def _solve_for_ild_equations(self, ild_load_value, *reactions):
Copy link
Member

Choose a reason for hiding this comment

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

Add something in the docs below for these parameters. Maybe a small definition for each.

@AdvaitPote
Copy link
Member

Try not to leave your Release Notes Empty while making a major change like this

@AdvaitPote
Copy link
Member

AdvaitPote commented Mar 12, 2024

However, since I haven't worked extensively on the beam module, I'd suggest waiting for additional inputs from other members as well

@Preypatel2413 Preypatel2413 deleted the generalized_ild_solutions branch March 16, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants