~andy-terrel/junk/dolfwave

« back to all changes in this revision

Viewing changes to demo/Stab1HD1S/plot_modes.py

  • Committer: Nuno Lopes
  • Date: 2013-01-04 20:33:34 UTC
  • Revision ID: ndlopes@gmail.com-20130104203334-fi37ndqxbhrn8jib
Snapshot. Updated Changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Nuno David Lopes.-----------------------------------
2
 
# Licensed under the GNU LGPL Version 3.0 or later.
3
 
# Eigenvalue solver for stability of BBM equation
4
 
# First added:  2011-06-21
5
 
# Last changed: 2011-06-24
6
 
 
7
 
 
8
 
import matplotlib as mpl
9
 
from matplotlib.font_manager import FontProperties
10
 
 
11
 
params = {'axes.labelsize': 24,
12
 
          'text.fontsize': 18,
13
 
          'legend.fontsize': 18,
14
 
          'xtick.labelsize': 18,
15
 
          'ytick.labelsize': 18,
16
 
          'text.usetex': True}
17
 
mpl.rcParams.update(params)
18
 
 
19
 
from pylab import *
20
 
from numpy import fromfile
21
 
 
22
 
H=[0.05,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
23
 
 
24
 
def plotfig():
25
 
    ax=subplot(231)
26
 
 
27
 
    step=2
28
 
    for h in H[:]:
29
 
        filename='BBM/outputP2/H_'+str(h)+'_stability.dxhm'
30
 
 
31
 
        u1 = fromfile(filename,sep=" ")
32
 
        u1.shape=len(u1)//2,2
33
 
        us=ones((len(u1)//(step),2))
34
 
        for i in range(0,len(u1)//(step)):
35
 
            us[i,0]=u1[i*step,0]
36
 
            us[i,1]=u1[i*step,1]
37
 
        ax.plot(us[:,0], us[:,1],"bo",ms=7)
38
 
 
39
 
 
40
 
 
41
 
        ax.legend(loc=(0.6,0.5))
42
 
 
43
 
    ax=subplot(232)
44
 
 
45
 
    step=2
46
 
    for h in H[:]:
47
 
        filename='KdV/output/tau_0_H_'+str(h)+'_stability.dxhm'
48
 
 
49
 
        u1 = fromfile(filename,sep=" ")
50
 
        u1.shape=len(u1)//2,2
51
 
        us=ones((len(u1)//(step),2))
52
 
        for i in range(0,len(u1)//(step)):
53
 
            us[i,0]=u1[i*step,0]
54
 
            us[i,1]=u1[i*step,1]
55
 
        ax.plot(us[:,0], us[:,1],"bo",ms=7)
56
 
 
57
 
 
58
 
 
59
 
        ax.legend(loc=(0.6,0.5))
60
 
 
61
 
        ax=subplot(233)
62
 
 
63
 
    step=2
64
 
    for h in H[:]:
65
 
        filename='KdV-BBM/output/tau_0_H_'+str(h)+'_stability.dxhm'
66
 
 
67
 
        u1 = fromfile(filename,sep=" ")
68
 
        u1.shape=len(u1)//2,2
69
 
        us=ones((len(u1)//(step),2))
70
 
        for i in range(0,len(u1)//(step)):
71
 
            us[i,0]=u1[i*step,0]
72
 
            us[i,1]=u1[i*step,1]
73
 
            ax.plot(us[:,0], us[:,1],"bo",ms=7)
74
 
 
75
 
 
76
 
 
77
 
    ax.legend(loc=(0.6,0.5))
78
 
 
79
 
    #(xname, yname) = ('$H$', '$\\triangle x$ ({\\tt m})')
80
 
    title('BBM, KdV model over constant depth H (with $P_2$ Lagrange)',fontsize=18)
81
 
    #ax.set_aspect(.5)
82
 
    #ax.set_xlim(0.,1.1)
83
 
    #ax.set_ylim(0.,1.0)
84
 
    #xlabel(xname,fontsize=24)
85
 
    #ylabel(yname,fontsize=24)
86
 
    grid()
87
 
    #outputfile='modes.png'
88
 
    #savefig(outputfile)
89
 
    #clf()
90
 
    show()
91
 
 
92
 
plotfig()
93
 
 
94
 
 
95
 
 
96
 
 
97
 
 
98
 
 
99
 
 
100
 
 
101
 
 
102
 
 
103
 
 
104
 
 
105