-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEx1_read_two_files.py
43 lines (31 loc) · 1.12 KB
/
Ex1_read_two_files.py
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
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 19 13:47:56 2015
@author: bbarahon
Example of loading two WAMIT *.out files with different number of modes saved
to output.
"""
import matplotlib.pyplot as plt
from readwamit_v02 import readWamit
# read file with one mode
rwd = readWamit() #create class instance and pass WAMIT file name
wT1, nms1, dAB1 = rwd.ReadOutFile('./files/opt_ALL.out') # read file
AdM1, Damp1 = rwd.ReadMode(['3','3'], wT1, nms1, dAB1)
# read file with many modes/nodies
rwd = readWamit() #create class instance and pass WAMIT file name
wT2, nms2, dAB2 = rwd.ReadOutFile('./files/opt_x.out') # read file
AdM2, Damp2 = rwd.ReadMode(['3','3'], wT2, nms2, dAB2)
# Plot stuff
plt.subplot(2, 1, 1)
plt.plot(wT1, AdM1, label='opt_x')
plt.plot(wT2, AdM2, label='opt_ALL')
plt.xlabel('wave period (s)')
plt.title('Non-dimensional added mass coefficients')
plt.legend(loc='lower right', frameon= False)
plt.show()
plt.subplot(2, 1, 2)
plt.plot(wT1, Damp1, label='opt_x')
plt.plot(wT1, Damp1, label='opt_ALL')
plt.xlabel('wave period (s)')
plt.title('Non-dimensional damping coefficients')
plt.show()