Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85150267
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
Fri, Sep 27, 03:09
Size
2 KB
Mime Type
text/x-python
Expires
Sun, Sep 29, 03:09 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21015703
Attached To
rTAMAAS tamaas
stresses.py
View Options
#!/usr/bin/env python3
# @file
# @section LICENSE
#
# Copyright (©) 2016-19 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/>.
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
,
'stress'
)
model
.
addDumper
(
dumper_helper
)
model
.
dump
()
print
(
"Done"
)
tm
.
finalize
()
Event Timeline
Log In to Comment