Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100564825
surface
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, Jan 31, 19:07
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Feb 2, 19:07 (2 d)
Engine
blob
Format
Raw Data
Handle
23991897
Attached To
rTAMAAS tamaas
surface
View Options
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
# vim: set ft=python:
"""
Create a random self-affine rough surface from command line parameters.
"""
import
argparse
import
sys
import
time
import
tamaas
as
tm
import
numpy
as
np
__author__
=
"Lucas Frérot"
__copyright__
=
"""Copyright (©) 2019, 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
()
parser
=
argparse
.
ArgumentParser
(
description
=
"Generate a self-affine rough surface"
)
parser
.
add_argument
(
"--cutoffs"
,
"-Q"
,
nargs
=
3
,
type
=
int
,
help
=
"Long, rolloff and short wavelength cutoffs"
,
required
=
True
)
parser
.
add_argument
(
"--sizes"
,
nargs
=
2
,
type
=
int
,
help
=
"Number of points"
,
required
=
True
)
parser
.
add_argument
(
"--hurst"
,
"-H"
,
type
=
float
,
help
=
"Hurst exponent"
,
required
=
True
)
parser
.
add_argument
(
"--rms"
,
type
=
float
,
help
=
"Root-mean-square of heights"
,
default
=
1.
)
parser
.
add_argument
(
"--seed"
,
type
=
int
,
help
=
"Random seed"
,
default
=
int
(
time
.
time
()))
parser
.
add_argument
(
"--output"
,
"-o"
,
help
=
"Output file name (compressed if .gz)"
)
args
=
parser
.
parse_args
()
spectrum
=
tm
.
Isopowerlaw2D
()
spectrum
.
q0
=
args
.
cutoffs
[
0
]
spectrum
.
q1
=
args
.
cutoffs
[
1
]
spectrum
.
q2
=
args
.
cutoffs
[
2
]
spectrum
.
hurst
=
args
.
hurst
generator
=
tm
.
SurfaceGeneratorRandomPhase2D
()
generator
.
setSizes
(
args
.
sizes
)
generator
.
random_seed
=
args
.
seed
generator
.
setSpectrum
(
spectrum
)
surface
=
generator
.
buildSurface
()
if
not
args
.
output
:
output
=
sys
.
stdout
else
:
output
=
args
.
output
np
.
savetxt
(
output
.
buffer
,
surface
)
tm
.
finalize
()
Event Timeline
Log In to Comment