52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
|
#!/usr/bin/env python
|
||
|
|
||
|
import numpy as np
|
||
|
import matplotlib.pyplot as plt
|
||
|
import matplotlib.ticker as mtick
|
||
|
from tkinter import Tk
|
||
|
from tkinter.filedialog import askopenfilename, asksaveasfile, askdirectory
|
||
|
import pandas as pd
|
||
|
import tkinter as tk
|
||
|
import os.path
|
||
|
from scipy.signal import find_peaks_cwt
|
||
|
from scipy import signal
|
||
|
import statistics
|
||
|
|
||
|
|
||
|
from functions import error_plot, periodicity
|
||
|
|
||
|
# Selct dir
|
||
|
Tk().withdraw()
|
||
|
folder = askdirectory()
|
||
|
project_folder = os.path.dirname(folder)
|
||
|
project = os.path.basename(project_folder)
|
||
|
|
||
|
# Input parameters
|
||
|
T_cyc = 0.477
|
||
|
n_cyc = 5
|
||
|
|
||
|
|
||
|
# Read important parameters from - solver.inp file
|
||
|
mylines = [] # Declare an empty list named mylines.
|
||
|
with open (project_folder + '/solver.inp', 'rt') as myfile: # Open lorem.txt for reading text data.
|
||
|
for myline in myfile: # For each line, stored as myline,
|
||
|
mylines.append(myline) # add its contents to mylines.
|
||
|
# print(mylines)
|
||
|
|
||
|
|
||
|
# Number of Timesteps - idx 3
|
||
|
# Idea: remove the text to extract the number, the text part will be the same no matter the simulation
|
||
|
N_ts = int(mylines[3][20:-1])
|
||
|
|
||
|
# Time Step Size - idx 4
|
||
|
dt = float(mylines[4][16:-1])
|
||
|
|
||
|
# Residual criteria - idx 4
|
||
|
rc = float(mylines[26][18:-1])
|
||
|
|
||
|
# Cehcking convergency and periodicity
|
||
|
error_plot(folder,dt,rc,False)
|
||
|
periodicity(project,folder,dt,T_cyc,n_cyc)
|
||
|
|
||
|
|