Пример #1
0
    def save_means(self):
        res_path = self.param.res_path
        file_prefix = self.param.case_name + '_' + self.param.plane_name

        filename = os.path.join(res_path, file_prefix + '_means.plt')
        print(self.stats.mean)
        tecreader.save_plt(self.stats.mean,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)
Пример #2
0
    def save_rstresses(self, rstress, res_path=None, file_prefix=None):
        if res_path is None:
            res_path = self.param.res_path
        if file_prefix is None:
            file_prefix = self.param.case_name + '_' + self.param.plane_name
        # Save the results

        try:
            os.makedirs(res_path, mode=0o777, exist_ok=True)
            print("Directory '%s' created successfully" % res_path)
        except:
            print("Directory '%s' can not be created" % res_path)

        save_var= {'uu': rstress['uu'], 'vv': rstress['vv'], 'ww': rstress['ww'], \
                'uv': rstress['uv'], 'uw': rstress['uw'], 'vw': rstress['vw'], 'kt': rstress['kt']}

        filename = os.path.join(res_path, file_prefix + '_rstresses.plt')
        tecreader.save_plt(save_var,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)
Пример #3
0
    def compute_skew_kurt(self, do_save=False):

        from scipy.stats import kurtosis, skew

        self.skew = {}
        self.kurt = {}
        for var, name in zip([self.vel.u, self.vel.v, self.vel.w],
                             ['u', 'v', 'w']):
            self.skew[name] = skew(var, axis=-1)
            self.kurt[name] = kurtosis(var, axis=-1)

        res_path = self.param.res_path
        file_prefix = self.param.case_name + '_' + self.param.plane_name

        save_var = {
            'skew_u': self.skew['u'],
            'skew_v': self.skew['v'],
            'skew_w': self.skew['w']
        }

        filename = os.path.join(res_path, file_prefix + '_skewness.plt')
        tecreader.save_plt(save_var,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)

        save_var = {
            'kurt_u': self.kurt['u'],
            'kurt_v': self.kurt['v'],
            'kurt_w': self.kurt['w']
        }

        filename = os.path.join(res_path, file_prefix + '_kurtosis.plt')
        tecreader.save_plt(save_var,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)
Пример #4
0
    def compute_independent_samples(self, acf_maxlag=10, do_save=False):
        # Compute the autocorrelation function at each point
        uprime, _, wprime = ws.compute_fluctuations(self.vel.u, self.vel.v,
                                                    self.vel.w)
        self.acf_u = ws.compute_field_acf(uprime, acf_maxlag)
        self.acf_w = ws.compute_field_acf(wprime, acf_maxlag)

        # Obtain the number of independent samples based on the ACF
        ind_u = ws.compute_field_acf_index(self.acf_u)
        ind_w = ws.compute_field_acf_index(self.acf_w)
        self.n_eff_u = self.vel.n_samples / (2 * ind_u)
        self.n_eff_w = self.vel.n_samples / (2 * ind_w)

        if do_save:
            res_path = self.param.res_path
            file_prefix = self.param.case_name + '_' + self.param.plane_name
            save_var = {'n_eff_u': self.n_eff_u, 'n_eff_w': self.n_eff_w}

            filename = os.path.join(res_path, file_prefix + '_ind_samples.plt')
            tecreader.save_plt(save_var,
                               self.dataset,
                               filename,
                               addvars=True,
                               removevars=True)
Пример #5
0
    def save_anisotropy(self, atensor, ev, C, res_path=None, file_prefix=None):
        if res_path is None:
            res_path = self.param.res_path
        if file_prefix is None:
            file_prefix = self.param.case_name + '_' + self.param.plane_name
        # Save the results

        try:
            os.makedirs(res_path, mode=0o777, exist_ok=True)
            print("Directory '%s' created successfully" % res_path)
        except:
            print("Directory '%s' can not be created" % res_path)

        save_var= {'a_uu': atensor['uu'], 'a_vv': atensor['vv'], 'a_ww': atensor['ww'], \
                'a_uv': atensor['uv'], 'a_uw': atensor['uw'], 'a_vw': atensor['vw']}

        filename = os.path.join(res_path,
                                file_prefix + '_anisotropy_tensor.plt')
        print(filename)
        tecreader.save_plt(save_var,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)

        save_var = {'ev1': ev[0, :], 'ev2': ev[1, :], 'ev3': ev[2, :]}

        filename = os.path.join(res_path,
                                file_prefix + '_anisotropy_eigenvalues.plt')
        tecreader.save_plt(save_var,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)

        save_var = {'C1': C[0, :], 'C2': C[1, :], 'C3': C[2, :]}

        filename = os.path.join(res_path,
                                file_prefix + '_anisotropy_components.plt')
        tecreader.save_plt(save_var,
                           self.dataset,
                           filename,
                           addvars=True,
                           removevars=True)