Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
m_huelsberg
analyzebd
Commits
ace2bea1
Commit
ace2bea1
authored
Sep 14, 2020
by
mhuels
Browse files
Merge branch 'master' of gitlab.tubit.tu-berlin.de:m_huelsberg/analyzebd
Conflicts: analyzebd/stress.py
parents
6a8089a0
cac6bb3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
.idea/analyzebd.iml
View file @
ace2bea1
...
...
@@ -4,7 +4,7 @@
<content
url=
"file://$MODULE_DIR$"
>
<excludeFolder
url=
"file://$MODULE_DIR$/.venv"
/>
</content>
<orderEntry
type=
"
jdk"
jdkName=
"Python 3.7 (analyzebd)"
jdkType=
"Python SDK
"
/>
<orderEntry
type=
"
inheritedJdk
"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
<component
name=
"TestRunnerService"
>
...
...
analyzebd/strain.py
View file @
ace2bea1
...
...
@@ -13,10 +13,10 @@ class Strain:
if
(
filename
is
None
):
self
.
generate
()
else
:
self
.
read
_f
rom
_f
ile
(
filename
)
self
.
read
F
rom
F
ile
(
filename
)
def
reset
(
self
,
filename
):
self
.
read
_f
rom
_f
ile
(
filename
)
self
.
read
F
rom
F
ile
(
filename
)
def
generate
(
self
):
self
.
T
=
1
...
...
@@ -28,7 +28,7 @@ class Strain:
self
.
strainUnit
=
"y0"
self
.
strainConversion
=
self
.
A
def
read
_f
rom
_f
ile
(
self
,
filename
):
def
read
F
rom
F
ile
(
self
,
filename
):
self
.
dt
=
float
(
find_setting_in_file
(
filename
.
parent
/
"shearedSlitporeBD.out"
,
"dt"
))
self
.
T
=
float
(
find_setting_in_file
(
filename
.
parent
/
"shearedSlitporeBD.out"
,
"oscillationPeriod"
))
self
.
A
=
float
(
find_setting_in_file
(
filename
.
parent
/
"shearedSlitporeBD.out"
,
"amplitude"
))
*
self
.
T
/
(
2
*
math
.
pi
)
...
...
analyzebd/stress.py
View file @
ace2bea1
import
math
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
matplotlib
import
cm
...
...
@@ -43,7 +44,8 @@ class Stress:
i0
=
int
(
tStart
*
self
.
timeConversion
/
self
.
dt_stress
)
iEnd
=
None
if
(
tEnd
is
not
None
):
iEnd
=
int
(
tEnd
*
self
.
timeConversion
/
self
.
dt_stress
)
# not optimal
iEnd
=
round
(
tEnd
*
self
.
timeConversion
/
self
.
dt_stress
)
self
.
time
=
np
.
loadtxt
(
filename
,
skiprows
=
i0
,
max_rows
=
iEnd
,
usecols
=
0
)
*
self
.
dt
/
self
.
timeConversion
self
.
shearRate
=
np
.
loadtxt
(
filename
,
skiprows
=
i0
,
max_rows
=
iEnd
,
usecols
=
1
)
self
.
stress
=
np
.
loadtxt
(
filename
,
skiprows
=
i0
,
max_rows
=
iEnd
,
usecols
=
6
)
...
...
@@ -83,9 +85,9 @@ class Stress:
if
(
tStart
is
not
None
):
self
.
time
-=
tStart
# translated starting index due to shift
i0
=
int
(
tStart
*
self
.
timeConversion
/
self
.
dt_stress
)
i0
=
round
(
tStart
*
self
.
timeConversion
/
self
.
dt_stress
)
if
(
tEnd
is
not
None
):
iEnd
=
int
(
tEnd
*
self
.
timeConversion
/
self
.
dt_stress
)
iEnd
=
round
(
tEnd
*
self
.
timeConversion
/
self
.
dt_stress
)
self
.
time
=
self
.
time
[
i0
:
iEnd
]
self
.
shearRate
=
self
.
shearRate
[
i0
:
iEnd
]
self
.
stress
=
self
.
stress
[
i0
:
iEnd
]
...
...
@@ -111,6 +113,9 @@ class Stress:
self
.
stress
=
newStress
return
self
def
getTotalAverage
(
self
):
return
self
.
stress
.
mean
()
def
plotOverTime
(
self
,
ax
=
None
,
**
kwargs
):
if
(
ax
is
None
):
ax
=
plt
.
subplot
()
...
...
@@ -125,13 +130,28 @@ class Stress:
ax
.
set_title
(
"$T=$"
f
"
{
self
.
T
}
"
"$
\\
tau_B,
\\
dot{
\\
gamma}_0=$"
f
"
{
self
.
A
}
"
"$
\\
tau_B^{-1}$"
)
return
ax
def
plot
V
LB
(
self
,
ax
=
None
,
normalize
=
False
,
withColor
=
True
,
withColorBar
=
False
,
colormap
=
"viridis"
,
**
kwargs
):
def
plotLB
(
self
,
ax
=
None
,
kind
=
"viscous"
,
normalize
=
False
,
withColor
=
True
,
withColorBar
=
False
,
colormap
=
"viridis"
,
**
kwargs
):
if
(
ax
is
None
):
ax
=
plt
.
subplot
()
if
(
kind
==
"viscous"
):
x
=
self
.
shearRate
ax
.
set_xlabel
(
"$
\\
dot{
\\
gamma}(t)/
\\
tau_B^{-1}$"
)
ax
.
set_title
(
"Viscous Lissajou-Bowditch figure"
)
elif
(
kind
==
"elastic"
):
x
=
np
.
array
([
self
.
A
*
self
.
T
/
self
.
timeConversion
/
(
2
*
math
.
pi
)
*
math
.
sin
(
2
*
math
.
pi
*
t
/
self
.
T
*
self
.
timeConversion
)
for
t
in
self
.
time
])
ax
.
set_xlabel
(
"$
\\
gamma(t)$"
)
ax
.
set_title
(
"Elastic Lissajou-Bowditch figure"
)
else
:
raise
AttributeError
(
f
"kind='
{
kind
}
' not supported. Choose either 'viscous' or 'elastic'."
)
y
=
self
.
stress
ax
.
set_ylabel
(
"$
\\
sigma_{xz}(t)/
\\
tilde{
\\
epsilon}d^{-3}$"
)
if
(
normalize
):
x
=
self
.
shearRate
/
np
.
absolute
(
self
.
shearRate
).
max
()
y
=
self
.
stress
/
np
.
absolute
(
self
.
stress
).
max
()
ax
.
set_xlabel
(
"$
\\
dot{
\\
gamma}(t)/
\\
dot{
\\
gamma}_0$"
)
x
/=
np
.
absolute
(
x
).
max
()
y
/=
np
.
absolute
(
y
).
max
()
if
(
kind
==
"viscous"
):
ax
.
set_xlabel
(
"$
\\
dot{
\\
gamma}(t)/
\\
dot{
\\
gamma}_0$"
)
else
:
ax
.
set_xlabel
(
"$
\\
gamma(t)/
\\
gamma_0$"
)
ax
.
set_ylabel
(
"$
\\
sigma_{xz}(t)/
\\
sigma_{xz}^{max}$"
)
else
:
x
=
self
.
shearRate
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment