Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F82471798
contact
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 11, 15:07
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Sep 13, 15:07 (2 d)
Engine
blob
Format
Raw Data
Handle
20631934
Attached To
rTAMAAS tamaas
contact
View Options
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
# vim: set ft=python:
"""
Read from stdin a surface profile and solve an elastic contact problem with
load given as an argument.
"""
import
argparse
import
sys
import
tamaas
as
tm
import
numpy
as
np
from
tamaas.dumpers
import
NumpyDumper
__author__
=
"Lucas Frérot"
__copyright__
=
"""Copyright (©) 2019-2020, EPFL (École Polytechnique Fédérale de Lausanne),
Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)"""
__license__
=
"AGPL"
__email__
=
"lucas.frerot@epfl.ch"
tm
.
initialize
()
tm
.
set_log_level
(
tm
.
LogLevel
.
error
)
parser
=
argparse
.
ArgumentParser
(
description
=
"Compute the elastic contact solution with a given surface"
)
parser
.
add_argument
(
"--input"
,
"-i"
,
help
=
"Rough surface file (default read from stdin)"
)
parser
.
add_argument
(
"--tol"
,
type
=
float
,
default
=
1
e
-
12
,
help
=
"Solver tolerance"
)
parser
.
add_argument
(
"load"
,
type
=
float
,
help
=
"Applied average pressure"
)
args
=
parser
.
parse_args
()
if
not
args
.
input
:
input
=
sys
.
stdin
else
:
input
=
args
.
input
surface
=
np
.
loadtxt
(
input
)
discretization
=
surface
.
shape
system_size
=
[
1.
,
1.
]
model
=
tm
.
ModelFactory
.
createModel
(
tm
.
model_type
.
basic_2d
,
system_size
,
discretization
)
solver
=
tm
.
PolonskyKeerRey
(
model
,
surface
,
args
.
tol
,
tm
.
PolonskyKeerRey
.
pressure
,
tm
.
PolonskyKeerRey
.
pressure
)
solver
.
solve
(
args
.
load
)
dumper
=
NumpyDumper
(
'numpy'
,
'traction'
,
'displacement'
)
dumper
.
dump_to_file
(
sys
.
stdout
.
buffer
,
model
)
tm
.
finalize
()
Event Timeline
Log In to Comment