|
|
|
@ -132,7 +132,6 @@ def Plot_Histogram(meshnames,paths,colors,outpath):
|
|
|
|
|
ind = 0
|
|
|
|
|
|
|
|
|
|
for nm in range(len(meshnames)):
|
|
|
|
|
|
|
|
|
|
if 'box' in meshnames[nm]:
|
|
|
|
|
# VOXEL SEQUENCE SIZE
|
|
|
|
|
Lx = 64
|
|
|
|
@ -167,13 +166,11 @@ def Plot_Histogram(meshnames,paths,colors,outpath):
|
|
|
|
|
heights_method = False
|
|
|
|
|
|
|
|
|
|
for k in range(mesh.num_cells()):
|
|
|
|
|
|
|
|
|
|
# Coordinates of each cell (A,B,C,D)
|
|
|
|
|
A = Points[Cells[k]][0]
|
|
|
|
|
B = Points[Cells[k]][1]
|
|
|
|
|
C = Points[Cells[k]][2]
|
|
|
|
|
D = Points[Cells[k]][3]
|
|
|
|
|
|
|
|
|
|
if heights_method:
|
|
|
|
|
hs = np.zeros([4])
|
|
|
|
|
for l in range(4):
|
|
|
|
@ -1412,127 +1409,79 @@ def ROUTINE(options):
|
|
|
|
|
|
|
|
|
|
if 'Error-curves' in options:
|
|
|
|
|
if options['Error-curves']['apply']:
|
|
|
|
|
print('--- Error curves ---')
|
|
|
|
|
|
|
|
|
|
meas = {}
|
|
|
|
|
corrs = {}
|
|
|
|
|
times = {}
|
|
|
|
|
norm = options['Error-curves']['norm']
|
|
|
|
|
colorset = options['Error-curves']['colors']
|
|
|
|
|
|
|
|
|
|
for resol in options['Error-curves']['resol']:
|
|
|
|
|
meas[resol] = {}
|
|
|
|
|
corrs[resol] = {}
|
|
|
|
|
times[resol] = {}
|
|
|
|
|
for dts in options['Error-curves']['times']:
|
|
|
|
|
path = options['Error-curves']['folder'] + \
|
|
|
|
|
resol + '/dt' + dts
|
|
|
|
|
try:
|
|
|
|
|
corrs[resol][dts] = np.loadtxt(
|
|
|
|
|
path + '/w_' + str(norm) + 'norm.txt')
|
|
|
|
|
except IOError:
|
|
|
|
|
print('no curve for ' + resol + '/' + dts)
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
meas[resol][dts] = np.loadtxt(
|
|
|
|
|
path + '/u_' + str(norm) + 'norm.txt')
|
|
|
|
|
times[resol][dts] = np.loadtxt(
|
|
|
|
|
path + '/times_' + str(norm) + 'norm.txt')
|
|
|
|
|
except IOError:
|
|
|
|
|
print('no meas for ' + resol + '/' + dts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if 'meas' in options['Error-curves']['mode']:
|
|
|
|
|
for resol in options['Error-curves']['resol']:
|
|
|
|
|
for dts in meas[resol].keys():
|
|
|
|
|
if resol == 'H1':
|
|
|
|
|
nc = 0
|
|
|
|
|
elif resol == 'H2':
|
|
|
|
|
nc = 1
|
|
|
|
|
elif resol == 'H3':
|
|
|
|
|
nc = 2
|
|
|
|
|
plt.plot(times[resol][dts], meas[resol]
|
|
|
|
|
[dts], color=colorset[nc], label='$' + resol + '/' + dts + '$')
|
|
|
|
|
|
|
|
|
|
#plt.ylim([0, 1.1])
|
|
|
|
|
plt.ylabel('$||u||_2$', fontsize=18)
|
|
|
|
|
plt.xlabel('$time \ \ (s)$', fontsize=18)
|
|
|
|
|
plt.legend(fontsize=16)
|
|
|
|
|
plt.savefig(options['Error-curves']['outpath'] + 'meas_' +dts + '.png',
|
|
|
|
|
dpi=500, bbox_inches='tight')
|
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
if 'corrs' in options['Error-curves']['mode']:
|
|
|
|
|
for resol in options['Error-curves']['resol']:
|
|
|
|
|
for dts in corrs[resol].keys():
|
|
|
|
|
if resol == 'H1':
|
|
|
|
|
nc = 0
|
|
|
|
|
elif resol == 'H2':
|
|
|
|
|
nc = 1
|
|
|
|
|
elif resol == 'H3':
|
|
|
|
|
nc = 2
|
|
|
|
|
plt.plot(times[resol][dts], corrs[resol]
|
|
|
|
|
[dts], color = colorset[nc],label='$' + resol + '/' + dts + '$')
|
|
|
|
|
|
|
|
|
|
plt.ylim([0, 16.2])
|
|
|
|
|
plt.ylabel('$||w||_2$', fontsize=18)
|
|
|
|
|
plt.xlabel('$time \ \ (s)$', fontsize=18)
|
|
|
|
|
plt.legend(fontsize=16)
|
|
|
|
|
plt.savefig(options['Error-curves']['outpath'] + 'corrs_' +dts + '.png',
|
|
|
|
|
dpi=500, bbox_inches='tight')
|
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
if 'fracs' in options['Error-curves']['mode']:
|
|
|
|
|
for resol in options['Error-curves']['resol']:
|
|
|
|
|
for dts in corrs[resol].keys():
|
|
|
|
|
if resol == 'H1':
|
|
|
|
|
nc = 0
|
|
|
|
|
elif resol == 'H2':
|
|
|
|
|
nc = 1
|
|
|
|
|
elif resol == 'H3':
|
|
|
|
|
nc = 2
|
|
|
|
|
plt.plot(times[resol][dts], corrs[resol][dts]/meas[resol][dts],
|
|
|
|
|
color=colorset[nc], label='$' + resol + '/' + dts + '$')
|
|
|
|
|
|
|
|
|
|
plt.ylim([0, 1])
|
|
|
|
|
plt.ylabel('$||w||_2/||u||_2$', fontsize=18)
|
|
|
|
|
plt.xlabel('$time \ \ (s)$', fontsize=18)
|
|
|
|
|
plt.legend(fontsize=16)
|
|
|
|
|
plt.savefig(options['Error-curves']['outpath'] + 'fracs_' +dts + '.png',
|
|
|
|
|
dpi=500, bbox_inches='tight')
|
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
if 'Components' in options:
|
|
|
|
|
if options['Components']['apply']:
|
|
|
|
|
print('--- Components analysis ---')
|
|
|
|
|
|
|
|
|
|
for types in options['Components']['type']:
|
|
|
|
|
print('--- Error-curves analysis ---')
|
|
|
|
|
ratio = False
|
|
|
|
|
for types in options['Error-curves']['type']:
|
|
|
|
|
if types=='mean_ratio':
|
|
|
|
|
types = 'mean'
|
|
|
|
|
ratio = True
|
|
|
|
|
if types=='max_ratio':
|
|
|
|
|
types = 'max'
|
|
|
|
|
ratio = True
|
|
|
|
|
nc = 0
|
|
|
|
|
for subf in options['Components']['subfolders']:
|
|
|
|
|
if len(options['Error-curves']['subfolders'])==0:
|
|
|
|
|
ucomp = []
|
|
|
|
|
wcomp = []
|
|
|
|
|
colorset = options['Components']['colors']
|
|
|
|
|
path = options['Components']['folder'] + subf + '/'
|
|
|
|
|
colorset = options['Error-curves']['colors']
|
|
|
|
|
path = options['Error-curves']['folder']
|
|
|
|
|
try:
|
|
|
|
|
ucomp = np.loadtxt(path + '/u'+types+'.txt')
|
|
|
|
|
wcomp = np.loadtxt(path + '/w'+types+'.txt')
|
|
|
|
|
times = np.loadtxt(path + '/times.txt')
|
|
|
|
|
except IOError:
|
|
|
|
|
print('no components for ' + subf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, ucomp, color=colorset[nc], linestyle='-', label= '$u'+ subf +'$' )
|
|
|
|
|
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, wcomp, color=colorset[nc], linestyle='--', label='$w'+subf+'$')
|
|
|
|
|
print('no Error-curves for ' + subf)
|
|
|
|
|
if not ratio:
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, ucomp, color=colorset[nc], linestyle='-', label= '$u$' )
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, wcomp, color=colorset[nc], linestyle='--', label='$w$')
|
|
|
|
|
else:
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, ucomp, color=colorset[nc], linestyle='-', label= '$u$' )
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, wcomp, color=colorset[nc], linestyle='--', label='$w$')
|
|
|
|
|
nc +=1
|
|
|
|
|
else:
|
|
|
|
|
for subf in options['Error-curves']['subfolders']:
|
|
|
|
|
ucomp = []
|
|
|
|
|
wcomp = []
|
|
|
|
|
colorset = options['Error-curves']['colors']
|
|
|
|
|
labelset = options['Error-curves']['labels']
|
|
|
|
|
path = options['Error-curves']['folder'] + subf + '/'
|
|
|
|
|
try:
|
|
|
|
|
ucomp = np.loadtxt(path + '/u'+types+'.txt')
|
|
|
|
|
wcomp = np.loadtxt(path + '/w'+types+'.txt')
|
|
|
|
|
times = np.loadtxt(path + '/times.txt')
|
|
|
|
|
except IOError:
|
|
|
|
|
print('no cError-curves for ' + subf)
|
|
|
|
|
|
|
|
|
|
if not ratio:
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, ucomp, color=colorset[nc], linestyle='-', label= '$u'+ subf +'$' )
|
|
|
|
|
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, wcomp, color=colorset[nc], linestyle='--', label='$w'+subf+'$')
|
|
|
|
|
else:
|
|
|
|
|
wu = wcomp/ucomp
|
|
|
|
|
plt.plot(
|
|
|
|
|
times, wu, color=colorset[nc], linestyle='-', label= '$'+ labelset[nc] +'$' )
|
|
|
|
|
nc +=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#plt.ylim([0, 170])
|
|
|
|
|
plt.ylabel('$velocity \ \ (cm/s)$', fontsize=18)
|
|
|
|
|
plt.xlabel('$time \ \ (s)$', fontsize=18)
|
|
|
|
|
plt.legend(fontsize=16)
|
|
|
|
|
plt.savefig(options['Components']['outpath'] + types + '.png', dpi=500, bbox_inches='tight')
|
|
|
|
|
if options['Error-curves']['title']:
|
|
|
|
|
plt.title(options['Error-curves']['title'], fontsize=18)
|
|
|
|
|
|
|
|
|
|
if not ratio:
|
|
|
|
|
plt.ylabel('$velocity \ \ (cm/s)$', fontsize=18)
|
|
|
|
|
plt.savefig(options['Error-curves']['outpath'] + types + '.png', dpi=500, bbox_inches='tight')
|
|
|
|
|
else:
|
|
|
|
|
plt.ylabel('$w/u$', fontsize=18)
|
|
|
|
|
if 'max' in types:
|
|
|
|
|
plt.ylim([0, 1.8])
|
|
|
|
|
plt.savefig(options['Error-curves']['outpath'] + types + '_ratio.png', dpi=500, bbox_inches='tight')
|
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|