Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85152288
test_hertz_kato.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
Fri, Sep 27, 03:29
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Sep 29, 03:29 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21020924
Attached To
rTAMAAS tamaas
test_hertz_kato.py
View Options
# -*- coding: utf-8 -*-
# @file
# @section LICENSE
#
# Copyright (©) 2016-2020 EPFL (École Polytechnique Fédérale de Lausanne),
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from
__future__
import
division
,
print_function
import
numpy
as
np
import
tamaas
as
tm
import
pytest
from
numpy.linalg
import
norm
@pytest.fixture
(
scope
=
"module"
)
def
kato
(
hertz_coarse
):
hertz
=
hertz_coarse
model
=
tm
.
ModelFactory
.
createModel
(
tm
.
model_type
.
basic_2d
,
[
hertz
.
domain_size
,
hertz
.
domain_size
],
[
hertz
.
n
,
hertz
.
n
])
model
.
setElasticity
(
hertz
.
e_star
,
0
)
solver
=
tm
.
KatoSaturated
(
model
,
hertz
.
surface
,
1e-12
,
1e30
)
solver
.
setMaxIterations
(
10000
)
solver
.
solve
(
hertz
.
load
)
return
model
,
hertz
def
test_contact_area
(
kato
):
# Testing contact area against Hertz solution for solids of revolution
model
,
hertz
=
kato
contact_area
=
np
.
sum
(
model
.
getTraction
()
>
0
)
/
float
(
hertz
.
n
**
2
)
hertz_area
=
np
.
sum
(
hertz
.
pressure
>
0
)
/
float
(
hertz
.
n
**
2
)
area_error
=
np
.
abs
(
hertz_area
-
contact_area
)
/
hertz_area
assert
area_error
<
1e-2
def
test_pressure
(
kato
):
model
,
hertz
=
kato
error
=
norm
(
model
.
getTraction
()
-
hertz
.
pressure
)
/
norm
(
hertz
.
pressure
)
assert
error
<
5e-3
def
test_displacement
(
kato
):
model
,
hertz
=
kato
error
=
norm
(
model
.
getDisplacement
()
-
hertz
.
displacement
)
\
/
norm
(
hertz
.
displacement
)
assert
error
<
2e-2
Event Timeline
Log In to Comment