-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamwise_convergence.py
More file actions
68 lines (60 loc) · 1.71 KB
/
streamwise_convergence.py
File metadata and controls
68 lines (60 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env/python
# -*- coding: utf-8 -*-
##################################################################
# Flageul and Tiselj
# https://doi.org/
##################################################################
# import modules
import os, sys
from numpy import *
from pylab import *
# define time step and empty arrays
dt = 0.027*10
t = []
err_EX0 = []
err_ER = []
# read t and EX0
f = open('./fort.3115.sym')
flines = f.readlines()
f.close()
for l in flines:
d = l.split()
t.append(dt * float(d[0]))
err_EX0.append(float(d[3]))
# read ER
f = open('./fort.3117.sym')
flines = f.readlines()
f.close()
for l in flines:
d = l.split()
err_ER.append(float(d[3]))
# Plot
plot(t,err_EX0,'-.',color='g',label=r"${\parallel E_0^X \parallel}^2$")
plot(t,err_ER,'--',color='r',label=r"${\parallel E_R^X \parallel}^2$")
plot([400,20000],[0.01,0.01*4/200],'-',color='k',label=r"$\frac{1}{T}$ and $\frac{1}{T^2}$")
plot([400,20000],[0.01,0.01*4*4/200/200],'-',color='k')
text(5000,0.001,r"$T^{-1}$")
text(5000,0.0001,r"$T^{-2}$")
# Graph settings
matplotlib.rc('figure', figsize=(5.,4.13))
matplotlib.rc('text', usetex = True)
size=16
size_legend=14
size_label=20
linewidth=1.5
markersize=10
framealpha=1.
matplotlib.rc('lines', linewidth=linewidth,markersize=markersize)
matplotlib.rc('font', size=size)
matplotlib.rc('axes', labelsize=size_label, titlesize=size)
matplotlib.rc('legend', fontsize=size_legend, framealpha=framealpha)
#
axis([100.,dt*410000,0.0000000001,0.02])
xscale('log')
yscale('log')
xlabel(r"$T^+$")
ylabel(r"Squared residuals")
legend(bbox_to_anchor=(0.38,0.4),numpoints=1)
# Save to file
savefig("streamwise_convergence.png",bbox_inches='tight')
savefig("streamwise_convergence.pdf",bbox_inches='tight')