Coder Social home page Coder Social logo

nicoguaro / continuum_mechanics Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 9.0 3.05 MB

Utilities for doing calculations in continuum mechanics.

License: MIT License

Makefile 4.28% Python 87.76% TeX 7.96%
continuum-mechanics vector-calculus physics mathematics sympy solid-mechanics elasticity visualization tensor-analysis finite-elements

continuum_mechanics's Issues

Rotation matrices don't match reference solution?

  • Continuum Mechanics version: 0.3.0

Description

The rotation matrix given in http://solidmechanics.org/Text/Chapter3_2/Chapter3_2.php under section 3.2.11 is not the same as what I get from the package. It might be an issue with clockwise and counterclockwise rotation, as the numbers are the same, the signs are not always.

As far as I understand it, a counterclockwise rotation should be positive about the rotation axis according to the right-hand rule. This is also what's shown in his book and the figure under 3.2.11 on the webpage.

I know this is a version under development, but I checked your code and did not find any error.

What I Did

Computed the two rotation matrices as below. They don't match.

theta = sym.pi/6
c = sym.cos(theta)
s = sym.sin(theta)

# counterclockwise, z-axis, 30°
# Taken from https://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
Q = sym.Matrix([[c, -s, 0], [s, c, 0], [0, 0, 1]])     

M = sym.zeros(6)
for i in range(3):
    for j in range(3):
        M[i, j] = Q[i, j]**2
        M[i, j + 3] = 2 * Q[i, (j + 1) % 3] * Q[i, (j + 2) % 3]
        M[i + 3, j] = Q[(i + 1) % 3, j] * Q[(i + 2) % 3, j]
        M[i + 3, j + 3] = Q[(i + 1) % 3, (j + 1) % 3] * \
            Q[(i + 2) % 3, (j + 2) % 3] + \
            Q[(i + 1) % 3, (j + 2) % 3] * \
            Q[(i + 2) % 3, (j + 1) % 3]

# Counterclockwise, z-axis
M_ref = np.array([[c**2, s**2, 0, 0, 0, 2*c*s],
                  [s**2, c**2, 0, 0, 0, -2*c*s],
                  [0, 0, 1, 0, 0, 0],
                  [0, 0, 0, c, s, 0],
                  [0, 0, 0, -s, c, 0],
                  [-c*s, c*s, 0, 0, 0, c**2-s**2]])

print(M_ref == np.array(M))

Output:

[[ True  True  True  True  True False]
 [ True  True  True  True  True False]
 [ True  True  True  True  True  True]
 [ True  True  True  True  True  True]
 [ True  True  True  True  True  True]
 [False False  True  True  True  True]]

Add optional parameters to ``mohr2d``

Regarding Mohr circles in 2D it would be useful to have optional parameters to turn off some of the details in the graphics, such as the center or the line connecting the current state.

Tensor divergence seems to be wrong

  • Continuum Mechanics version: 0.2.2
  • Python version: 3.7.10

Description

The divergence of the stress tensor is not 0 while the Navier-Cauchy operator is zero for the displacement vector.

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

from sympy import *
from continuum_mechanics.vector import div_tensor
from continuum_mechanics.solids import navier_cauchy

r, theta, phi = symbols("r theta phi")
T, mu = symbols("T mu")

h = (1, r, r*sin(theta))
coords = (r, theta, phi)
disp = Matrix([[0], [0], [T*sin(theta)/(8*pi*mu*r**2)]])
stress = Matrix([[0, 0, -3*T*sin(theta)/(8*pi*r**3)], [0, 0, 0], [-3*T*sin(theta)/(8*pi*r**3), 0, 0]])

And

navier_cauchy(disp, [1, mu], coords, h)

gives Matrix([[0], [0], [0]]), while

div_tensor(stress, coords, h)

gives Matrix([[0], [0], [3*T*sin(theta)/(8*pi*r**4)]]).

Add Airy stress functions

We can add Airy stress functions to the package since the vector operators are implemented. A good starting point is given in the following notebook:

https://github.com/nicoguaro/notebooks_examples/blob/master/Airy%20stress%20functions.ipynb

It could be possible to add Michelle general solution for 2D elasticity in polar coordinates.

  • J. H. Michell, 1899, On the direct determination of stress in an elastic solid,
    with application to the theory of plates, Proceedings of the London Mathematical
    Society, vol. 31, pages 100-124.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.