Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F66708224
patch_test_linear_solid_mechanics_fixture.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jun 12, 13:02
Size
2 KB
Mime Type
text/x-python
Expires
Fri, Jun 14, 13:02 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18264536
Attached To
rAKA akantu
patch_test_linear_solid_mechanics_fixture.py
View Options
#!/usr/bin/env python3
import
patch_test_linear_fixture
import
numpy
as
np
import
akantu
class
TestPatchTestSMMLinear
(
patch_test_linear_fixture
.
TestPatchTestLinear
):
plane_strain
=
True
model_type
=
akantu
.
SolidMechanicsModel
def
applyBC
(
self
):
patch_test_linear_fixture
.
TestPatchTestLinear
.
applyBC
(
self
)
displacement
=
self
.
model
.
getDisplacement
()
self
.
applyBConDOFs
(
displacement
)
def
checkAll
(
self
):
displacement
=
self
.
model
.
getDisplacement
()
mat
=
self
.
model
.
getMaterial
(
0
)
self
.
checkDOFs
(
displacement
)
self
.
checkGradient
(
mat
.
getGradU
(
self
.
elem_type
),
displacement
)
def
foo
(
pstrain
):
nu
=
self
.
model
.
getMaterial
(
0
)
.
getParamReal
(
"nu"
)
E
=
self
.
model
.
getMaterial
(
0
)
.
getParamReal
(
"E"
)
strain
=
(
pstrain
+
pstrain
.
transpose
())
/
2.
trace
=
strain
.
trace
()
_lambda
=
nu
*
E
/
((
1
+
nu
)
*
(
1
-
2
*
nu
))
mu
=
E
/
(
2
*
(
1
+
nu
))
if
(
not
self
.
plane_strain
):
_lambda
=
nu
*
E
/
(
1
-
nu
*
nu
)
stress
=
np
.
zeros
((
self
.
dim
,
self
.
dim
))
if
self
.
dim
==
1
:
stress
[
0
,
0
]
=
E
*
strain
[
0
,
0
]
else
:
stress
[:,
:]
=
(
_lambda
*
trace
*
np
.
eye
(
self
.
dim
)
+
2
*
mu
*
strain
)
return
stress
self
.
checkResults
(
foo
,
mat
.
getStress
(
self
.
elem_type
),
displacement
)
# template <typename T> struct invalid_plan_stress : std::true_type {}
# template <typename type, typename bool_c>
# struct invalid_plan_stress<std::tuple<type, bool_c>>
# : aka::bool_constant<ElementClass<type::value>::getSpatialDimension() !=
# 2 and
# not bool_c::value> {}
#
# using true_false =
# std::tuple<aka::bool_constant<true>, aka::bool_constant<false>>
#
# template <typename T> using valid_types = aka::negation<invalid_plan_stress<T>>
#
# using types = gtest_list_t<
# tuple_filter_t<valid_types, cross_product_t<TestElementTypes, true_false>>>
#
# TYPED_TEST_CASE(TestPatchTestSMMLinear, types)
#endif /* __AKANTU_PATCH_TEST_LINEAR_SOLID_MECHANICS_FIXTURE_HH__ */
Event Timeline
Log In to Comment