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

Change implementation of LinearElasticLargeStrain from NeoHooke to NeoHookeCompressible #601

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. The format
- Use fixed output locations for the extracted field-gradients and the integrated stiffness matrices in `SolidBody` and `SolidBodyNearlyIncompressible`. This enhances the performance.
- Change default filename in `Mesh.screenshot()` from `filename="field.png"` to `filename="mesh.png"`.
- Change the return value on job-evaluation from `None = Job.evaluate()` to `job = Job.evaluate()`.
- Change implementation of `LinearElasticLargeStrain` from `NeoHooke` to `NeoHookeCompressible`.

### Removed
- Do not invoke `pyvista.start_xvfb()` on a posix-os. If required, run it manually.
Expand Down
6 changes: 3 additions & 3 deletions docs/howto/solid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The mechanics submodule contains classes for the generation of solid bodies. Sol
Solid Body
----------

The generation of internal force vectors and stiffness matrices of solid bodies are provided as assembly-methods of a :class:`fem.SolidBody` or a :class:`fem.SolidBodyNearlyIncompressible`.
The generation of internal force vectors and stiffness matrices of solid bodies are provided as assembly-methods of a :class:`SolidBody` or a :class:`SolidBodyNearlyIncompressible`.

.. code-block:: python

Expand Down Expand Up @@ -47,7 +47,7 @@ The Cauchy stress tensor, as well as the gradient and the hessian of the strain
Body Force (Gravity) on a Solid Body
------------------------------------

The generation of internal force vectors or stiffness matrices of body forces acting on solid bodies are provided as assembly-methods of a :class:`fem.SolidBodyGravity`.
The generation of internal force vectors or stiffness matrices of body forces acting on solid bodies are provided as assembly-methods of a :class:`SolidBodyGravity`.


.. code-block:: python
Expand All @@ -60,7 +60,7 @@ The generation of internal force vectors or stiffness matrices of body forces ac
Pressure Boundary on a Solid Body
---------------------------------

The generation of force vectors or stiffness matrices of pressure boundaries on solid bodies are provided as assembly-methods of a :class:`fem.SolidBodyPressure`.
The generation of force vectors or stiffness matrices of pressure boundaries on solid bodies are provided as assembly-methods of a :class:`SolidBodyPressure`.

.. code-block:: python

Expand Down
24 changes: 10 additions & 14 deletions src/felupe/constitution/_models_linear_elasticity_large_strain.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import numpy as np

from ._models_hyperelasticity import NeoHooke
from ._models_hyperelasticity import NeoHookeCompressible
from ._models_linear_elasticity import lame_converter


Expand Down Expand Up @@ -54,13 +54,12 @@ def __init__(self, E=None, nu=None, parallel=False):
self.x = [np.eye(3), np.zeros(0)]

mu = None
bulk = None
lmbda = None

if self.E is not None and self.nu is not None:
gamma, mu = lame_converter(E, nu)
bulk = gamma + 2 * mu / 3
lmbda, mu = lame_converter(E, nu)

self.material = NeoHooke(mu=mu, bulk=bulk, parallel=parallel)
self.material = NeoHookeCompressible(mu=mu, lmbda=lmbda, parallel=parallel)

def function(self, x, E=None, nu=None):
"""Evaluate the strain energy (as a function of the deformation gradient).
Expand All @@ -87,10 +86,9 @@ def function(self, x, E=None, nu=None):
if nu is None:
nu = self.nu

gamma, mu = lame_converter(E, nu)
bulk = gamma + 2 * mu / 3
lmbda, mu = lame_converter(E, nu)

return self.material.function(x, mu=mu, bulk=bulk)
return self.material.function(x, mu=mu, lmbda=lmbda)

def gradient(self, x, E=None, nu=None):
"""Evaluate the stress tensor (as a function of the deformation gradient).
Expand All @@ -117,10 +115,9 @@ def gradient(self, x, E=None, nu=None):
if nu is None:
nu = self.nu

gamma, mu = lame_converter(E, nu)
bulk = gamma + 2 * mu / 3
lmbda, mu = lame_converter(E, nu)

return self.material.gradient(x, mu=mu, bulk=bulk)
return self.material.gradient(x, mu=mu, lmbda=lmbda)

def hessian(self, x, E=None, nu=None):
"""Evaluate the elasticity tensor (as a function of the deformation gradient).
Expand All @@ -147,7 +144,6 @@ def hessian(self, x, E=None, nu=None):
if nu is None:
nu = self.nu

gamma, mu = lame_converter(E, nu)
bulk = gamma + 2 * mu / 3
lmbda, mu = lame_converter(E, nu)

return self.material.hessian(x, mu=mu, bulk=bulk)
return self.material.hessian(x, mu=mu, lmbda=lmbda)
5 changes: 4 additions & 1 deletion src/felupe/mesh/_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def view(self, point_data=None, cell_data=None, cell_type=None):
"""

return ViewMesh(
self, point_data=point_data, cell_data=cell_data, cell_type=cell_type
self,
point_data=point_data,
cell_data=cell_data,
cell_type=cell_type,
)

def plot(self, *args, **kwargs):
Expand Down