Skip to content
Snippets Groups Projects
Commit 6a379133 authored by Franck Pérignon's avatar Franck Pérignon
Browse files

Update NSDebug + postProcess file

parent e5cd9674
No related branches found
No related tags found
No related merge requests found
...@@ -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['Str2diff'] = Redistribute([vorti], op['stretching'], op['diffusion']) distr['str2diff'] = Redistribute([vorti], op['stretching'], op['diffusion'])
distr['Curl2Advec'] = Redistribute([vorti], op['curl'], op['advection']) distr['curl2adv'] = 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()
......
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')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment