Skip to content

Commit

Permalink
Merge pull request #601 from adtzlr/change-linear-elastic-largestrain
Browse files Browse the repository at this point in the history
Change implementation of `LinearElasticLargeStrain` from `NeoHooke` to `NeoHookeCompressible`
  • Loading branch information
adtzlr authored Jan 25, 2024
2 parents f99b8f9 + 79d78b7 commit 6f6ec5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
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

0 comments on commit 6f6ec5d

Please sign in to comment.