-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from adtzlr/add-planestrain-planestress
Add plane-strain plane-stress-incompressible
- Loading branch information
Showing
8 changed files
with
103 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.0.21" | ||
__version__ = "0.0.22" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,6 @@ | |
logic_not, | ||
floor, | ||
ceil, | ||
|
||
SX, | ||
DM, | ||
MX, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[metadata] | ||
name = matadi | ||
version = 0.0.21 | ||
version = 0.0.22 | ||
author = Andreas Dutzler | ||
author_email = [email protected] | ||
description = Material Definition with Automatic Differentiation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import numpy as np | ||
|
||
from matadi import ( | ||
MaterialHyperelasticPlaneStrain, | ||
MaterialHyperelasticPlaneStressIncompressible, | ||
) | ||
from matadi.models import neo_hooke | ||
|
||
|
||
def pre(): | ||
|
||
FF = np.random.rand(2, 2, 8, 1000) | ||
for a in range(2): | ||
FF[a, a] += 1 | ||
|
||
return FF | ||
|
||
|
||
def test_plane_strain(): | ||
|
||
# data | ||
FF = pre() | ||
|
||
# init Material | ||
W = MaterialHyperelasticPlaneStrain( | ||
fun=neo_hooke, | ||
C10=0.5, | ||
) | ||
|
||
W0 = W.function([FF]) | ||
dW = W.gradient([FF]) | ||
DW = W.hessian([FF]) | ||
|
||
assert W0[0].shape == (8, 1000) | ||
assert dW[0].shape == (2, 2, 8, 1000) | ||
assert DW[0].shape == (2, 2, 2, 2, 8, 1000) | ||
|
||
assert W0[0].shape == (8, 1000) | ||
assert dW[0].shape == (2, 2, 8, 1000) | ||
assert DW[0].shape == (2, 2, 2, 2, 8, 1000) | ||
|
||
|
||
def test_plane_stress(): | ||
|
||
# data | ||
FF = pre() | ||
|
||
# init Material | ||
W = MaterialHyperelasticPlaneStressIncompressible( | ||
fun=neo_hooke, | ||
C10=0.5, | ||
) | ||
|
||
W0 = W.function([FF]) | ||
dW = W.gradient([FF]) | ||
DW = W.hessian([FF]) | ||
|
||
assert W0[0].shape == (8, 1000) | ||
assert dW[0].shape == (2, 2, 8, 1000) | ||
assert DW[0].shape == (2, 2, 2, 2, 8, 1000) | ||
|
||
assert W0[0].shape == (8, 1000) | ||
assert dW[0].shape == (2, 2, 8, 1000) | ||
assert DW[0].shape == (2, 2, 2, 2, 8, 1000) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_plane_strain() | ||
test_plane_stress() |