Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F84873298
stresses.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
Wed, Sep 25, 09:00
Size
3 KB
Mime Type
text/x-python
Expires
Fri, Sep 27, 09:00 (2 d)
Engine
blob
Format
Raw Data
Handle
21014328
Attached To
rTAMAAS tamaas
stresses.py
View Options
#!/usr/bin/env python3
# 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/>.
# -----------------------------------------------------------------------------
import
numpy
as
np
import
tamaas
as
tm
import
argparse
from
tamaas.dumpers
import
UVWDumper
parser
=
argparse
.
ArgumentParser
(
description
=
"Hertzian tractios applied on elastic half-space"
)
parser
.
add_argument
(
"radius"
,
type
=
float
,
help
=
"Radius of sphere"
)
parser
.
add_argument
(
"load"
,
type
=
float
,
help
=
"Applied normal force"
)
parser
.
add_argument
(
"name"
,
help
=
"Output file name"
)
args
=
parser
.
parse_args
()
tm
.
initialize
()
# Definition of modeled domain
model_type
=
tm
.
model_type
.
volume_2d
discretization
=
[
127
,
127
,
127
]
system_size
=
[
1.
,
1.
,
1.
]
# Material contants
E
=
1.
# Young's modulus
nu
=
0.3
# Poisson's ratio
E_star
=
E
/
(
1
-
nu
**
2
)
# Hertz modulus
# Creation of model
model
=
tm
.
ModelFactory
.
createModel
(
model_type
,
system_size
,
discretization
)
model
.
E
=
E
model
.
nu
=
nu
# Setup for integral operators
residual
=
tm
.
ModelFactory
.
createResidual
(
model
,
0
,
0
)
# Coordinates
x
=
np
.
linspace
(
0
,
system_size
[
1
],
discretization
[
1
],
endpoint
=
False
)
y
=
np
.
linspace
(
0
,
system_size
[
2
],
discretization
[
2
],
endpoint
=
False
)
x
,
y
=
np
.
meshgrid
(
x
,
y
,
indexing
=
'ij'
)
center
=
[
0.5
,
0.5
]
r
=
np
.
sqrt
((
x
-
center
[
0
])
**
2
+
(
y
-
center
[
1
])
**
2
)
# Sphere
R
=
args
.
radius
P
=
args
.
load
# Contact area
a
=
(
3
*
P
*
R
/
(
4
*
E_star
))
**
(
1
/
3
)
p_0
=
3
*
P
/
(
2
*
np
.
pi
*
a
**
2
)
# Pressure definition
traction
=
model
.
getTraction
()
traction
[
r
<
a
,
2
]
=
p_0
*
np
.
sqrt
(
1
-
(
r
[
r
<
a
]
/
a
)
**
2
)
# Array references
displacement
=
model
.
getDisplacement
()
stress
=
residual
.
getStress
()
gradient
=
residual
.
getVector
()
# Applying operator
boussinesq
=
model
.
getIntegralOperator
(
"boussinesq"
)
boussinesq_gradient
=
model
.
getIntegralOperator
(
"boussinesq_gradient"
)
boussinesq
.
apply
(
traction
,
displacement
)
boussinesq_gradient
.
apply
(
traction
,
gradient
)
model
.
applyElasticity
(
stress
,
gradient
)
# Dumper
dumper_helper
=
UVWDumper
(
args
.
name
)
model
.
addDumper
(
dumper_helper
)
model
.
dump
()
print
(
"Done"
)
tm
.
finalize
()
Event Timeline
Log In to Comment