Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92297910
small_case.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
Tue, Nov 19, 04:51
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Nov 21, 04:51 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22415517
Attached To
rMUSPECTRE µSpectre
small_case.py
View Options
#!/usr/bin/env python3
"""
file small_case.py
@author Till Junge <till.junge@epfl.ch>
@date 12 Jan 2018
@brief small case for debugging
@section LICENCE
Copyright © 2018 Till Junge
µSpectre is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3, or (at
your option) any later version.
µSpectre is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
"""
import
sys
import
os
import
numpy
as
np
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
getcwd
(),
"language_bindings/python"
))
import
pyMuSpectre
as
µ
resolution
=
[
5
,
5
]
lengths
=
[
7.
,
5.
]
formulation
=
µ
.
Formulation
.
finite_strain
rve
=
µ
.
SystemFactory
(
resolution
,
lengths
,
formulation
)
hard
=
µ
.
material
.
MaterialHooke2d
.
make
(
rve
,
"hard"
,
210e9
,
.
33
)
soft
=
µ
.
material
.
MaterialHooke2d
.
make
(
rve
,
"soft"
,
70e9
,
.
33
)
for
i
,
pixel
in
enumerate
(
rve
):
if
i
<
3
:
hard
.
add_pixel
(
pixel
)
else
:
soft
.
add_pixel
(
pixel
)
tol
=
1e-6
Del0
=
np
.
array
([[
0
,
.
001
],
[
0
,
0
]])
if
formulation
==
µ
.
Formulation
.
small_strain
:
Del0
=
.
5
*
(
Del0
+
Del0
.
T
)
maxiter
=
301
verbose
=
3
r
=
µ
.
solvers
.
de_geus
(
rve
,
Del0
,
tol
,
tol
,
maxiter
,
verbose
)
print
(
r
.
grad
.
T
[:
3
])
print
(
r
.
stress
.
T
[:
3
])
print
(
r
.
nb_fev
)
Event Timeline
Log In to Comment