Skip to content
Snippets Groups Projects
Commit e1a91df0 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

tweaks CFL computation

parent efd77f3a
Branches
Tags
1 merge request!122fix CFL estimate for box length other than 2pi
Pipeline #221460 passed
...@@ -460,8 +460,14 @@ def plot_basic_stats( ...@@ -460,8 +460,14 @@ def plot_basic_stats(
with self.get_data_file() as data_file: with self.get_data_file() as data_file:
if 'CFL_velocity' in data_file['statistics'].keys(): if 'CFL_velocity' in data_file['statistics'].keys():
self.statistics['CFL_velocity(t)'] = data_file['statistics/CFL_velocity'][ii0:ii1+1] self.statistics['CFL_velocity(t)'] = data_file['statistics/CFL_velocity'][ii0:ii1+1]
dx = ((2*np.pi/self.parameters['dkx'])/self.parameters['nx']) # Lx / nx
dy = ((2*np.pi/self.parameters['dky'])/self.parameters['ny'])
dz = ((2*np.pi/self.parameters['dkz'])/self.parameters['nz'])
if ((np.round(dx, 5) != np.round(dy, 5))
or (np.round(dx, 5) != np.round(dz, 5))):
print('WARNING: CFL computation does not make sense for non-isotropic grids')
tresolution2 = (self.parameters['dt'] * self.statistics['CFL_velocity(t)'] tresolution2 = (self.parameters['dt'] * self.statistics['CFL_velocity(t)']
/ (2*np.pi/self.parameters['dkx']/self.parameters['nx'])) / dx)
a.plot(self.statistics['t'] / self.statistics['Tint'], a.plot(self.statistics['t'] / self.statistics['Tint'],
tresolution2, tresolution2,
label = '$\\frac{\\Delta t}{\\Delta x} \\| u \\|_{CFL}$') label = '$\\frac{\\Delta t}{\\Delta x} \\| u \\|_{CFL}$')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment