Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79489157
apply_strain.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
Mon, Aug 26, 16:15
Size
973 B
Mime Type
text/x-python
Expires
Wed, Aug 28, 16:15 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20186040
Attached To
rLIBMULTISCALE LibMultiScale
apply_strain.py
View Options
#!/usr/bin/env python
import
numpy
as
np
name
=
"bound_pos"
shift
=
(
0.
,
.
1
,
0.
)
length
=
1.
def
compute
(
**
kwargs
):
keys
=
kwargs
.
keys
()
if
name
in
keys
:
key
=
name
try
:
pos0
=
kwargs
[
key
]
except
UnboundLocalError
as
err
:
raise
UnboundLocalError
(
"{0}
\n
The only available keys are {1}. The key '{2}' wasn't found!"
.
format
(
err
,
keys
,
name
))
#disp = np.array(np.matrix(pos0) * grad_u) + solid_body_disp
disp
=
np
.
zeros
(
pos0
.
shape
)
if
pos0
.
shape
[
0
]
==
0
:
return
disp
for
i
in
range
(
3
):
disp
[:,
i
]
=
shift
[
i
]
*
pos0
[:,
i
]
print
(
"When dealing with {0}, computed displacement within the ranges:"
.
format
(
key
))
print
(
" u_x_min = {0},
\t
u_x_max = {1}"
.
format
(
disp
.
min
(
0
)[
0
],
disp
.
max
(
0
)[
0
]))
print
(
" u_y_min = {0},
\t
u_y_max = {1}"
.
format
(
disp
.
min
(
0
)[
1
],
disp
.
max
(
0
)[
1
]))
print
(
" u_z_min = {0},
\t
u_z_max = {1}"
.
format
(
disp
.
min
(
0
)[
2
],
disp
.
max
(
0
)[
2
]))
return
disp
Event Timeline
Log In to Comment