-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspanwise_convergence.py
More file actions
64 lines (57 loc) · 1.69 KB
/
spanwise_convergence.py
File metadata and controls
64 lines (57 loc) · 1.69 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
#!/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 = []
Z_conv = []
Z_diff = []
err_EZ0 = []
# read t, Z-conv, Z-diff and EX0
f = open('./fort.3119.sym')
flines = f.readlines()
f.close()
for l in flines:
d = l.split()
t.append(dt * float(d[0]))
Z_diff.append(float(d[1]))
Z_conv.append(float(d[2]))
err_EZ0.append(float(d[3]))
# Plot
plot(t,err_EZ0,'-.',color='g',label=r"${\parallel E_0^Z \parallel}^2$")
plot(t,Z_conv,'--',color='r',label=r"$Z-Conv$")
plot(t,Z_diff,'--',color='b',label=r"$Z-Diff$")
plot([1000,20000],[0.0002,0.0002/20],'-',color='k',label=r"$\frac{1}{T}$ and $\frac{1}{T^2}$")
plot([1000,20000],[0.00002,0.00002/20/20],'-',color='k')
text(4500,0.00007,r"$T^{-1}$")
text(4000,0.0000002,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.43,0.45),numpoints=1)
# Save to file
savefig("spanwise_convergence.png",bbox_inches='tight')
savefig("spanwise_convergence.pdf",bbox_inches='tight')