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

continuum_mechanics : slope and deflection method now returns complete answer #14446

Merged
merged 4 commits into from
Aug 7, 2018

Conversation

jashan498
Copy link
Member

@jashan498 jashan498 commented Mar 9, 2018

Brief description of what is fixed or changed

>>> L = symbols('L', positive=True)
>>> b = Beam(L, E, I)
>>> b.apply_load(R2, L, -1)
>>> b.apply_load(R1, 0, -1)
>>> P=symbols('P')
>>> b.apply_load(-P, L/2, -1)

Now for the above beam this integrates the bending_moment twice ignoring that for every integral a constant has to be added (which is solved with help of boundary conditions provided). 0n current master:

>>> b.slope()
(-P*SingularityFunction(x, L/2, 2)/2 + R1*SingularityFunction(x, 0, 2)/2 + R2*SingularityFunction(x, L, 2)/2)/(E*I)
>>> b.deflection()
(-P*SingularityFunction(x, L/2, 3)/6 + R1*SingularityFunction(x, 0, 3)/6 + R2*SingularityFunction(x, L, 3)/6)/(E*I)

In case of deflection coefficient of x vanishes due to this.

This sometimes is misleading, hence constants are required to mark the incomplete solution.

>>> b.slope()
C3 + (-P*SingularityFunction(x, L/2, 2)/2 + R1*SingularityFunction(x, 0, 2)/2 + R2*SingularityFunction(x, L, 2)/2)/(E*I)
>>> b.deflection()
C3*x + C4 + (-P*SingularityFunction(x, L/2, 3)/6 + R1*SingularityFunction(x, 0, 3)/6 + R2*SingularityFunction(x, L, 3)/6)/(E*I)

Release Notes

  • physics.continuum_mechanics
    • slope and deflection methods now return integral constants along with expression if insufficient boundary conditions to solve those constants are passed.

@jashan498
Copy link
Member Author

@moorepants please review

@Abdullahjavednesar
Copy link
Member

@moorepants can you please have a look, thanks!

@moorepants
Copy link
Member

@jashan498 Please update wrt to master and add a release note.

@moorepants
Copy link
Member

@jashan498 Can you explain why this doesn't affect all beams (the ones that already work)?

@moorepants moorepants added PR: author's turn The PR has been reviewed and the author needs to submit more changes. GSoC labels Jul 28, 2018
@sympy-bot
Copy link

sympy-bot commented Aug 1, 2018

Hi, I am the SymPy bot (v124). I'm here to make sure this pull request has a release notes entry. Please read the guide on how to write release notes.

Click here to see the pull request description that was parsed.

#### Brief description of what is fixed or changed
```
>>> L = symbols('L', positive=True)
>>> b = Beam(L, E, I)
>>> b.apply_load(R2, L, -1)
>>> b.apply_load(R1, 0, -1)
>>> P=symbols('P')
>>> b.apply_load(-P, L/2, -1)
```
Now for the above beam [this](https://github.com/sympy/sympy/blob/3a5515d19bfd48ed680da2c4a23289f2500065b3/sympy/physics/continuum_mechanics/beam.py#L494) integrates the bending_moment twice ignoring that for every integral a constant has to be added (which is solved with help of boundary conditions provided). 0n current master:
```
>>> b.slope()
(-P*SingularityFunction(x, L/2, 2)/2 + R1*SingularityFunction(x, 0, 2)/2 + R2*SingularityFunction(x, L, 2)/2)/(E*I)
>>> b.deflection()
(-P*SingularityFunction(x, L/2, 3)/6 + R1*SingularityFunction(x, 0, 3)/6 + R2*SingularityFunction(x, L, 3)/6)/(E*I)
```
In case of `deflection` coefficient of `x` vanishes due to this.

This sometimes is misleading, hence constants are required to mark the incomplete solution. 
```
>>> b.slope()
C3 + (-P*SingularityFunction(x, L/2, 2)/2 + R1*SingularityFunction(x, 0, 2)/2 + R2*SingularityFunction(x, L, 2)/2)/(E*I)
>>> b.deflection()
C3*x + C4 + (-P*SingularityFunction(x, L/2, 3)/6 + R1*SingularityFunction(x, 0, 3)/6 + R2*SingularityFunction(x, L, 3)/6)/(E*I)

```

#### 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. If there is no release notes entry for this PR,
write "NO ENTRY". The bot will check your release notes automatically to see
if they are formatted correctly. -->
<!-- BEGIN RELEASE NOTES -->
* physics.continuum_mechanics
  * slope and deflection methods now return integral constants along with expression if insufficient boundary conditions to solve those constants are passed.
<!-- END RELEASE NOTES -->

Your release notes are in good order.

Here is what the release notes will look like:

  • physics.continuum_mechanics
    • slope and deflection methods now return integral constants along with expression if insufficient boundary conditions to solve those constants are passed. (#14446 by @jashan498)

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

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Update

The release notes on the wiki have been updated.

@jashan498
Copy link
Member Author

jashan498 commented Aug 1, 2018

@moorepants actually it's due to the reason in most of our test cases we have provided all boundary_conditions applied on our Beam, so most of the time constants originated were solved.

@@ -1040,9 +1040,12 @@ def deflection(self):
conditions.append(((prev_def + deflection_value), args[i][1]))
prev_def = deflection_value.subs(x, args[i][1].args[1])
return Piecewise(*conditions)
return S(1)/(E*I)*integrate(integrate(self.bending_moment(), x), x)
C3 = Symbol('C3')
C4 = Symbol('C4')
Copy link
Member

Choose a reason for hiding this comment

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

We need a way for the user to set this symbol or access it. So either an optional argurment or an attribute, or both. They should be able to set the base character(s) or symbol or pass in a generator. SymPy has a generator for creating sequential symbols. cse uses it.

@jashan498
Copy link
Member Author

@moorepants I missed b.bc_deflection in this example of .rst file (due to which it was returning constants in this PR). I corrected that example.

@jashan498
Copy link
Member Author

This job failed due to some CondaHTTPError.

@jksuom
Copy link
Member

jksuom commented Aug 3, 2018

Restarted.

@jashan498
Copy link
Member Author

Thanks @jksuom !

@jashan498 jashan498 changed the title continuum_mechanics : slope and deflection functions returns complete answer now continuum_mechanics : slope and deflection method now returns complete answer Aug 7, 2018
@moorepants moorepants merged commit 0e75388 into sympy:master Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSoC physics.continuum_mechanics PR: author's turn The PR has been reviewed and the author needs to submit more changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants