Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Fluiddynamicsproject4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Hilsky
Fluiddynamicsproject4
Commits
7ed80d28
Commit
7ed80d28
authored
4 years ago
by
Felix
Browse files
Options
Downloads
Patches
Plain Diff
much code for bad diagrams
parent
12231072
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
zeichnungen/code/.maindir
+1
-0
1 addition, 0 deletions
zeichnungen/code/.maindir
zeichnungen/code/diagrams.py
+74
-0
74 additions, 0 deletions
zeichnungen/code/diagrams.py
zeichnungen/code/environment.yml
+9
-0
9 additions, 0 deletions
zeichnungen/code/environment.yml
with
84 additions
and
0 deletions
zeichnungen/code/.maindir
0 → 120000
+
1
−
0
View file @
7ed80d28
../..
\ No newline at end of file
This diff is collapsed.
Click to expand it.
zeichnungen/code/diagrams.py
0 → 100755
+
74
−
0
View file @
7ed80d28
#! /usr/bin/env python3
import
sys
import
os.path
import
numpy
import
matplotlib.pyplot
as
pyplot
import
tikzplotlib
from
fluidfoam.readpostpro
import
readforce
CASE_PATH
=
"
.maindir/openfoam2012/freeCylinderFlow-N{N}-u{u}
"
SUBPATH_FORCE_COEFFS
=
"
forceCoeffsIncompressible/0/coefficiant.dat
"
SUBPATH_GRADT
=
"
patchAverage(name=cylinder,mag(grad(T)))
"
PATH_DIAGRAMS
=
"
.maindir/zeichnungen/generated
"
DIAGRAM_WIDTH
=
r
'
\diagramwidth
'
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
==
3
:
N
=
sys
.
argv
[
1
]
u
=
sys
.
argv
[
2
]
cases
=
[(
N
,
u
)]
else
:
cases
=
[(
N
,
u
)
for
N
in
range
(
1
,
3
)
for
u
in
range
(
-
2
,
2
)
if
os
.
path
.
isdir
(
CASE_PATH
.
format
(
N
=
N
,
u
=
u
))]
print
(
"
cases:
"
,
cases
)
for
N
,
u
in
cases
:
filenumber
=
"
{nr}-u-{u}-N{N}
"
.
format
(
nr
=
(
u
+
3
)
*
10
+
N
,
u
=
u
,
N
=
N
)
try
:
force
=
numpy
.
array
(
readforce
(
CASE_PATH
.
format
(
N
=
N
,
u
=
u
),
namepatch
=
'
forceCoeffsIncompressible
'
,
name
=
'
coefficient
'
))
except
FileNotFoundError
as
error
:
print
(
error
)
print
(
"
abort this case
"
)
continue
times
=
force
[
len
(
force
)
//
3
:,
0
]
drag_coeffs
=
force
[
len
(
force
)
//
3
:,
1
]
if
len
(
cases
)
==
1
:
print
(
"
times:
"
,
times
)
print
(
"
D:
"
,
drag_coeffs
)
fig
=
pyplot
.
figure
()
axis
=
pyplot
.
axes
()
axis
.
set_xlabel
(
'
time
'
)
axis
.
set_ylabel
(
'
Drag coefficiant
'
)
print
(
"
plot D_c for N={N}, u={u}
"
)
axis
.
plot
(
times
,
drag_coeffs
)
tikzplotlib
.
save
(
figure
=
fig
,
filepath
=
(
PATH_DIAGRAMS
+
'
{nr}-D.tex
'
.
format
(
nr
=
filenumber
)),
axis_width
=
DIAGRAM_WIDTH
)
fig
.
savefig
(
PATH_DIAGRAMS
+
'
{nr}-D
'
.
format
(
nr
=
filenumber
))
# grad(T)
try
:
gradT
=
numpy
.
array
(
readforce
(
CASE_PATH
.
format
(
N
=
N
,
u
=
u
),
time_name
=
'
latestTime
'
,
namepatch
=
'
patchAverage(name=cylinder,mag(grad(T)))
'
,
name
=
'
surfaceFieldValue
'
))
except
FileNotFoundError
as
error
:
print
(
error
)
print
(
"
abort this case
"
)
continue
times
=
gradT
[
len
(
gradT
)
//
3
:,
0
]
dT
=
gradT
[
len
(
gradT
)
//
3
:,
1
]
if
len
(
cases
)
==
1
:
print
(
"
times:
"
,
times
)
print
(
"
dT:
"
,
dT
)
fig
=
pyplot
.
figure
()
axis
=
pyplot
.
axes
()
axis
.
set_xlabel
(
'
time
'
)
axis
.
set_ylabel
(
'
avg(|n·∇T|)
'
)
axis
.
plot
(
times
,
dT
)
print
(
"
plot dt for N={N}, u = {u}
"
.
format
(
N
=
N
,
u
=
u
))
tikzplotlib
.
save
(
figure
=
fig
,
filepath
=
(
PATH_DIAGRAMS
+
'
{nr}-gT.tex
'
.
format
(
nr
=
filenumber
)),
axis_width
=
DIAGRAM_WIDTH
)
fig
.
savefig
(
PATH_DIAGRAMS
+
'
{nr}-gT
'
.
format
(
N
=
N
,
u
=
u
))
This diff is collapsed.
Click to expand it.
zeichnungen/code/environment.yml
0 → 100644
+
9
−
0
View file @
7ed80d28
name
:
diagrams
channels
:
-
conda-forge
-
defaults
dependencies
:
-
matplotlib
-
tikzplotlib
-
pylint
-
fluidfoam
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment