Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85290359
test_westergaard.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
Sat, Sep 28, 01:33
Size
2 KB
Mime Type
text/x-python
Expires
Mon, Sep 30, 01:33 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20885221
Attached To
rTAMAAS tamaas
test_westergaard.py
View Options
#!/usr/bin/env python
# coding: utf-8
# -----------------------------------------------------------------------------
# @author Lucas Frérot <lucas.frerot@epfl.ch>
#
# @section LICENSE
#
# Copyright (©) 2016 EPFL (Ecole Polytechnique Fédérale de
# Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
# Solides)
#
# Tamaas is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Tamaas 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 Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
from
__future__
import
division
,
print_function
import
sys
import
numpy
as
np
from
numpy.linalg
import
norm
import
tamaas
as
tm
import
pytest
@pytest.fixture
(
scope
=
"module"
,
params
=
[
tm
.
PolonskyKeerRey
.
pressure
,
tm
.
PolonskyKeerRey
.
gap
])
def
pkr
(
westergaard
,
request
):
loads
=
{
tm
.
PolonskyKeerRey
.
pressure
:
westergaard
.
load
,
tm
.
PolonskyKeerRey
.
gap
:
0.06697415181446396
}
model
=
tm
.
ModelFactory
.
createModel
(
tm
.
model_type
.
basic_1d
,
[
1.
],
[
westergaard
.
n
])
model
.
setElasticity
(
westergaard
.
e_star
,
0
)
solver
=
tm
.
PolonskyKeerRey
(
model
,
westergaard
.
surface
,
1e-12
,
request
.
param
,
request
.
param
)
solver
.
solve
(
loads
[
request
.
param
])
return
model
,
westergaard
def
test_energy
(
pkr
):
model
,
sol
=
pkr
traction
,
displacement
=
model
.
getTraction
(),
model
.
getDisplacement
()
error
=
norm
((
traction
-
sol
.
pressure
)
*
(
displacement
-
sol
.
displacement
))
error
/=
norm
(
sol
.
pressure
*
sol
.
displacement
)
assert
error
<
4e-6
if
__name__
==
"__main__"
:
print
(
"Test is meant to run with pytest"
)
Event Timeline
Log In to Comment