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

Don't import LinearElasticPlaneStrain in top-level package namespace #844

Merged
merged 5 commits into from
Aug 31, 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 @@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file. The format
- Enforce contiguous arrays for the region shape-function and -gradient arrays `h` and `dhdX`. This recovers the integral-form assembly performance from v8.6.0.
- Make the private basis classes public (`assembly.expression.Basis`, `assembly.expression.BasisField` and `assembly.expression.BasisArray`) as especially their docstrings are useful to understand how a *Basis* is created on a field.
- Remove material parameter keyword-arguments in the `function()`-, `gradient()`- and `hessian()`-methods of the core constitutive material formulations. This removes the ability for temporary material parameters in `LinearElastic(E=None, nu=0.3).gradient(x, E=1.0)`, use `LinearElastic(E=1.0, nu=0.3).gradient(x)` instead. This affects the material formulations `LinearElastic`, `LinearElasticPlaneStrain`, `LinearElasticPlaneStress`, `LinearElasticLargeStrain`, `NeoHooke` and `NeoHookeCompressible`. `None` is still supported for the material parameters of `NeoHooke` and `NeoHookeCompressible`.
- Remove `LinearElasticPlaneStrain` from the top-level package namespace because this should only be used with `Field(region, dim=2)`. The preferred method is to use `FieldPlaneStrain(region, dim=2)` and the default `LinearElastic`. `LinearElasticPlaneStrain` remains available in `constitution.LinearElasticPlaneStrain`.

### Deprecated
- Deprecate `SolidBodyGravity`, `SolidBodyForce` should be used instead.
Expand Down
2 changes: 0 additions & 2 deletions src/felupe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
LinearElastic,
LinearElasticLargeStrain,
LinearElasticOrthotropic,
LinearElasticPlaneStrain,
LinearElasticPlaneStress,
LinearElasticPlasticIsotropicHardening,
LineChange,
Expand Down Expand Up @@ -174,7 +173,6 @@
"LinearElastic",
"LinearElasticLargeStrain",
"LinearElasticOrthotropic",
"LinearElasticPlaneStrain",
"LinearElasticPlaneStress",
"LinearElasticPlasticIsotropicHardening",
"LineChange",
Expand Down
7 changes: 7 additions & 0 deletions src/felupe/constitution/linear_elasticity/_linear_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ class LinearElasticPlaneStrain:
nu : float
Poisson ratio.

Notes
-----
.. warning::

This class must not be used with :class:`~felupe.FieldPlaneStrain` but with
:class:`~felupe.Field` instead!

"""

def __init__(self, E, nu):
Expand Down
2 changes: 2 additions & 0 deletions src/felupe/mechanics/_solidbody_cauchy_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class SolidBodyCauchyStress:
Examples
--------
.. pyvista-plot::
:force_static:

>>> import numpy as np
>>> import felupe as fem
>>>
>>> mesh = fem.Rectangle(n=6)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_planestrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_planestrain():
g = fem.FieldsMixed(r, n=1, planestrain=False)

u = fem.LinearElastic(E=1, nu=0.3)
v = fem.LinearElasticPlaneStrain(E=1, nu=0.3)
v = fem.constitution.LinearElasticPlaneStrain(E=1, nu=0.3)

b = fem.SolidBody(u, f)
c = fem.SolidBody(v, g)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_newton_plane():
)

# define the constitutive material behavior
umat = fem.LinearElasticPlaneStrain(E=1.0, nu=0.3)
umat = fem.constitution.LinearElasticPlaneStrain(E=1.0, nu=0.3)

# newton-rhapson procedure
res = fem.newtonrhapson(
Expand Down
Loading