-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
36 lines (22 loc) · 912 Bytes
/
Main.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
import numpy as np
import json
import FiniteVolume as fv
import PlotUtil as pu
# Extracting configuration properties
with open('config.json', 'r') as f:
config = json.load(f)
test_inputs = config['MAIN']
domain_length = test_inputs['DOMAIN_LENGTH']
cell_count = test_inputs['CELL_COUNT']
bc = (config['MAIN']['BC']['LEFT'], config['MAIN']['BC']['RIGHT'])
ic = np.zeros([np.size(config['MAIN']['IC']), 5])
for i in range(0, np.size(config['MAIN']['IC'])):
ic[i][0] = config['MAIN']['IC'][i]['START']
ic[i][1] = config['MAIN']['IC'][i]['END']
ic[i][2] = config['MAIN']['IC'][i]['DENS']
ic[i][3] = config['MAIN']['IC'][i]['VELO']
ic[i][4] = config['MAIN']['IC'][i]['PRES']
time_eval = config['MAIN']['TIME_EVAL']
plot_factor = config['CONSTANTS']['PLOT_FACTOR']
cells = fv.run(domain_length, cell_count, ic, bc, time_eval)
pu.plot(cells, domain_length/cell_count, plot_factor)