Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
particle_methods
hysop
Commits
6a379133
Commit
6a379133
authored
11 years ago
by
Franck Pérignon
Browse files
Options
Downloads
Patches
Plain Diff
Update NSDebug + postProcess file
parent
e5cd9674
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/NSDebug.py
+35
-13
35 additions, 13 deletions
Examples/NSDebug.py
Examples/postNSBluff.py
+67
-0
67 additions, 0 deletions
Examples/postNSBluff.py
with
102 additions
and
13 deletions
Examples/NSDebug.py
+
35
−
13
View file @
6a379133
...
@@ -134,14 +134,19 @@ distr = {}
...
@@ -134,14 +134,19 @@ distr = {}
distr
[
'
fft2curl
'
]
=
Redistribute
([
velo
],
op
[
'
penalization
'
],
op
[
'
curl
'
])
distr
[
'
fft2curl
'
]
=
Redistribute
([
velo
],
op
[
'
penalization
'
],
op
[
'
curl
'
])
distr
[
'
curl2fft
'
]
=
Redistribute
([
vorti
],
op
[
'
curl
'
],
op
[
'
poisson
'
])
distr
[
'
curl2fft
'
]
=
Redistribute
([
vorti
],
op
[
'
curl
'
],
op
[
'
poisson
'
])
# 1 - Curl_fft to stretching (velocity only)
# 1 - Curl to stretching (velocity only)
distr
[
'
Curl2Str
'
]
=
Redistribute
([
velo
],
op
[
'
curl
'
],
op
[
'
stretching
'
])
#distr['curl2str'] = Redistribute([velo], op['curl'], op['stretching'])
# 2 - Advection to stretching (vorticity only)
# 2 - Advection to stretching
distr
[
'
Advec2Str_v
'
]
=
Redistribute
([
velo
],
op
[
'
advection
'
],
op
[
'
stretching
'
])
# velocity only
distr
[
'
Advec2Str_w
'
]
=
Redistribute
([
vorti
],
op
[
'
advection
'
],
op
[
'
stretching
'
])
#distr['adv2str_v'] = Redistribute([velo], op['advection'], op['stretching'])
# vorticity only
#distr['adv2str_w'] = Redistribute([vorti], op['advection'], op['stretching'])
# Both
distr
[
'
adv2str
'
]
=
Redistribute
([
velo
,
vorti
],
op
[
'
advection
'
],
op
[
'
stretching
'
])
# 3 - Stretching to Diffusion
# 3 - Stretching to Diffusion
distr
[
'
S
tr2diff
'
]
=
Redistribute
([
vorti
],
op
[
'
stretching
'
],
op
[
'
diffusion
'
])
distr
[
'
s
tr2diff
'
]
=
Redistribute
([
vorti
],
op
[
'
stretching
'
],
op
[
'
diffusion
'
])
distr
[
'
C
url2
A
dv
ec
'
]
=
Redistribute
([
vorti
],
op
[
'
curl
'
],
op
[
'
advection
'
])
distr
[
'
c
url2
a
dv
'
]
=
Redistribute
([
velo
,
vorti
],
op
[
'
curl
'
],
op
[
'
advection
'
])
for
ope
in
distr
.
values
():
for
ope
in
distr
.
values
():
ope
.
discretize
()
ope
.
discretize
()
...
@@ -215,6 +220,8 @@ def initFields_mode1():
...
@@ -215,6 +220,8 @@ def initFields_mode1():
distr
[
'
curl2fft
'
].
apply
(
simu
)
distr
[
'
curl2fft
'
].
apply
(
simu
)
# From this point both velocity and vorticity are initialized
# From this point both velocity and vorticity are initialized
# on topofft and on topocurl
# on topofft and on topocurl
# Remark : we only need to initialize v on topocurl
# w computation and distribution is there just on test purpose.
## Call initialization
## Call initialization
initFields_mode1
()
initFields_mode1
()
...
@@ -236,7 +243,10 @@ for mon in monitors.values():
...
@@ -236,7 +243,10 @@ for mon in monitors.values():
## Note Franck : tests init ok, same values on both topologies, for v and w.
## Note Franck : tests init ok, same values on both topologies, for v and w.
# === After init ===
#
# v init on topocurl (which may be equal to topofft)
#
# === Definition of the 'one-step' sequence of operators ===
# === Definition of the 'one-step' sequence of operators ===
#
#
# 1 - w = curl(v), topocurl
# 1 - w = curl(v), topocurl
...
@@ -247,21 +257,33 @@ for mon in monitors.values():
...
@@ -247,21 +257,33 @@ for mon in monitors.values():
# 6 - v = correction(v, w), topofft
# 6 - v = correction(v, w), topofft
# 7 - v = penalization(v), topofft
# 7 - v = penalization(v), topofft
#
#
fullseq
=
[
'
curl
'
,
'
printerCurl
'
,
'
advection
'
,
'
stretching
'
,
'
diffusion
'
,
# Required bridges :
'
reprojection
'
,
'
poisson
'
,
'
correction
'
,
'
energy
'
,
'
forces
'
,
# 1 --> 2 : (v,w) on topo-advec
'
printerFFT
'
]
# 2 --> 3 : (v,w) on topostr
# 3 --> 4 : w on topofft
# 7 --> 1 : v on topocurl
fullseq
=
[
'
curl
'
,
'
printerCurl
'
,
# in: v, out : w both on topocurl
'
curl2adv
'
,
'
advection
'
,
# in: v,w out: w, on topoadvec
'
adv2str
'
,
'
stretching
'
,
# in: v,w out: w on topostr
# in: w, out: v, w on topofft
'
str2diff
'
,
'
diffusion
'
,
'
reprojection
'
,
'
poisson
'
,
'
correction
'
,
'
penalization
'
,
'
energy
'
,
'
forces
'
,
'
printerFFT
'
,
'
fft2curl
'
# Back to topocurl for v
]
def
run
(
sequence
):
def
run
(
sequence
):
for
name
in
sequence
:
for
name
in
sequence
:
assert
allops
.
keys
().
count
(
name
)
>
0
or
distr
.
keys
().
count
(
name
)
>
0
\
assert
allops
.
keys
().
count
(
name
)
>
0
or
distr
.
keys
().
count
(
name
)
>
0
\
or
monitors
.
keys
().
count
(
name
)
>
0
or
monitors
.
keys
().
count
(
name
)
>
0
,
'
unknow key:
'
+
name
allops
[
name
].
apply
(
simu
)
allops
[
name
].
apply
(
simu
)
seq
=
fullseq
seq
=
fullseq
simu
.
initialize
()
simu
.
initialize
()
while
not
simu
.
isOver
:
while
not
simu
.
isOver
:
simu
.
printState
()
if
topocurl
.
rank
==
0
:
simu
.
printState
()
run
(
seq
)
run
(
seq
)
simu
.
advance
()
simu
.
advance
()
...
...
This diff is collapsed.
Click to expand it.
Examples/postNSBluff.py
0 → 100644
+
67
−
0
View file @
6a379133
import
scitools.filetable
as
ft
import
matplotlib.pyplot
as
plt
def
plotEnergyEnstrophy
(
filename
):
ff
=
open
(
filename
)
data
=
ft
.
read
(
ff
)
time
=
data
[:,
0
]
energy
=
data
[:,
1
]
enstrophy
=
data
[:,
2
]
plt
.
subplot
(
211
)
plt
.
plot
(
time
,
energy
,
'
+-
'
,
label
=
'
energy
'
)
plt
.
xlabel
(
'
time
'
)
plt
.
subplot
(
212
)
plt
.
plot
(
time
,
enstrophy
,
'
+-
'
,
label
=
'
enstrophy
'
)
plt
.
xlabel
(
'
time
'
)
plt
.
legend
()
plt
.
suptitle
(
'
Results from simu in:
'
+
filename
)
plt
.
show
()
def
plotDragAndLift
(
filename
):
ff
=
open
(
filename
)
data
=
ft
.
read
(
ff
)
time
=
data
[:,
0
]
drag
=
data
[:,
1
]
lift
=
data
[:,
2
:]
plt
.
subplot
(
211
)
plt
.
plot
(
time
,
drag
,
'
+-
'
,
label
=
'
drag
'
)
plt
.
xlabel
(
'
time
'
)
plt
.
subplot
(
212
)
for
i
in
xrange
(
lift
.
shape
[
1
]):
plt
.
plot
(
time
,
lift
[:,
i
],
'
+-
'
,
label
=
'
lift
'
+
str
(
i
))
plt
.
xlabel
(
'
time
'
)
plt
.
legend
()
plt
.
suptitle
(
'
Results from simu in:
'
+
filename
)
plt
.
show
()
def
plotReprojection
(
filename
):
ff
=
open
(
filename
)
data
=
ft
.
read
(
ff
)
time
=
data
[:,
0
]
crit
=
data
[:,
1
]
counter
=
data
[:,
2
]
d1
=
data
[:,
3
]
d2
=
data
[:,
4
]
plt
.
subplot
(
221
)
plt
.
plot
(
time
,
crit
,
'
+-
'
,
label
=
'
criterion
'
)
plt
.
xlabel
(
'
time
'
)
plt
.
subplot
(
222
)
plt
.
plot
(
time
,
d1
,
'
+-
'
,
label
=
'
d1
'
)
plt
.
xlabel
(
'
time
'
)
plt
.
subplot
(
223
)
plt
.
plot
(
time
,
d2
,
'
+-
'
,
label
=
'
d2
'
)
plt
.
xlabel
(
'
time
'
)
plt
.
legend
()
plt
.
suptitle
(
'
Results from simu in:
'
+
filename
)
plt
.
show
()
plt
.
ioff
()
direc
=
'
NSDebug
'
nprocs
=
1
fileroot
=
direc
+
'
/p
'
+
str
(
nprocs
)
+
'
/
'
plotEnergyEnstrophy
(
fileroot
+
'
energy_enstrophy
'
)
plotDragAndLift
(
fileroot
+
'
drag_and_lift
'
)
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