Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F78839735
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, Aug 23, 06:44
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Aug 25, 06:44 (2 d)
Engine
blob
Format
Raw Data
Handle
20073913
Attached To
rTAMAAS tamaas
test_hertz_kato.py
View Options
# -*- coding: utf-8 -*-
#
# Copyright (©) 2016-2021 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
.
E
,
model
.
nu
=
hertz
.
e_star
,
0
solver
=
tm
.
KatoSaturated
(
model
,
hertz
.
surface
,
1e-12
,
1e30
)
solver
.
max_iter
=
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
[
'traction'
]
>
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
[
'traction'
]
-
hertz
.
pressure
)
/
norm
(
hertz
.
pressure
)
assert
error
<
5e-3
def
test_displacement
(
kato
):
model
,
hertz
=
kato
error
=
norm
(
model
[
'displacement'
]
-
hertz
.
displacement
)
\
/
norm
(
hertz
.
displacement
)
assert
error
<
2e-2
Event Timeline
Log In to Comment