Esempio n. 1
0
            print iterable

            for direction, pKey, pKey_test1, pKey_test2, pKey_test3, pKey_test4 in iterable:
                # ptermfig = hfig.Homfig(title="pterm ", ylabel="$(V-U)_j*du/dx_j$",xlim=[-1,1])
                # plotFileNamePterm = pict_path + "test_pterm_nosymm_"+stattype +coordinates[direction]+"_"+StNo+".eps"

                #ptermfig.add_plot(pstat_test1["yplus"],pstat_test1[pKey_test1],linestyle='dotted',label='$(V-Uf)_j*du/dx_j$')
                #ptermfig.add_plot(pstat_test2["yplus"],pstat_test2[pKey_test2],linestyle='dashed',label='$(V-Uf)_j*dUf/dx_j$')

                #ptermfig.hdraw()
                #ptermfig.save(plotFileNamePterm)
                #print "plot created: " + plotFileNamePterm
                #plt.close(ptermfig.fig)

                ptermfullvel = hfig.Homfig(title="pterm ",
                                           ylabel="$((V-U)_j*dU/dx_j)^{2}$")
                #plotFileNamePterm = pict_path + "VUdUdx_"+stattype +coordinates[direction]+"_"+StNo+".eps"
                plotFileNamePterm = pict_path + "dUdx_" + stattype + coordinates[
                    direction] + "_" + StNo + ".eps"

                #ptermfullvel.add_plot(pstat["yplus"],pstat[pKey]/termplus,linestyle='solid',label='excact term, $(V-U)_j*du/dx_j$')
                #ptermfullvel.add_plot(pstat_test1["yplus"],pstat_test1[pKey_test1]/termplus,linestyle='dashed',label='$(V-Uf)_j*du/dx_j$')
                #ptermfullvel.add_plot(pstat_test2["yplus"],pstat_test2[pKey_test2]/termplus,linestyle='dotted',label='$(V-Uf)_j*dUf/dx_j$')
                ptermfullvel.add_plot(pstat_test3["yplus"],
                                      pstat_test3[pKey_test3] / termplus,
                                      linestyle='dotted',
                                      label='$(V-U)_j*dU/dx_j$')
                ptermfullvel.add_plot(pstat_test4["yplus"],
                                      pstat_test4[pKey_test4] / termplus,
                                      linestyle='dashed',
                                      label='$(V-U)_j*dUf/dx_j$')
Esempio n. 2
0
#--------------------------------------------------------------------#
# PLOT DRAW
#
# we use symmetrised data
#--------------------------------------------------------------------#


if __name__ == '__main__':


    #--------------------------------------------------------------------#
    #  time scales 
    #--------------------------------------------------------------------#

    SGStime = hfig.Homfig(title= " SGS relaxation time for fluid particles" ,
                               ylabel="$\\tau$", xlabel="$y^{+}$")

    plotFileName = tc.pict_path + "SGS_aprioriVSmodel.eps"

    SGStime.add_plot(relaxation_time['y'],relaxation_time['fluid_SGSles'],label='a priori')
    SGStime.add_plot(dissipation_symm['y'],dissipation_symm['tau_modell2'],label='tau_modell2')
    SGStime.add_plot(ksgsYoshizawa_symm['y'],ksgsYoshizawa_symm['tau_Yoshizawa'],label='LES,Yoshizawa est.')

    SGStime.hdraw()
    SGStime.save(plotFileName)
    plt.close(SGStime.fig)

    #--------------------------------------------------------------------#
    #  kinetic energy 
    #--------------------------------------------------------------------#
    ksgs = hfig.Homfig(title= " SGS kinetic energy for fluid particles" ,
Esempio n. 3
0
            #return ifilterfalse(lambda x: x=="yplus", set(arg))
            arg_sorted = sorted(arg)
            return ifilter(lambda x: x <> "yplus", arg_sorted)

        # STATISTICS
#        pstat = pfields.equationP(StNo,pterm,stattype,"none",*ptermArglist)
#        pstat_test1 = pfields.equationP(StNo,pterm,stattype,"none",*ptermArglist_test1)
#        pstat_test2 = pfields.equationP(StNo,pterm_test2,stattype,"none",*ptermArglist_test2)
#        pstat_test3 = pfields.equationP(StNo,pterm_test2,stattype,"none",*ptermArglist_test3)
#        pstat_test4 = pfields.equationP(StNo,pterm_test2,stattype,"none",*ptermArglist_test4)

# FIGURES

        pstat_gradient = {}
        gradfig = hfig.Homfig(title="gradients  of $\overline{U}$",
                              ylabel="$(d\overline{U}/dx_j)^{+}$",
                              xscale='log',
                              xlim=[1, 160])
        plotFileNamePterm = pict_path + "gradients_" + stattype + "_" + StNo + ".eps"

        for component in ['dx', 'dz']:
            pstat_gradient[component] = pfields.equationP(
                StNo, lambda x: x, stattype, 'symm', *gradients[component])

            iterable1 = keys_no_yplus(pstat_gradient[component].keys())
            for pKey in iterable1:
                gradfig.add_plot(pstat_gradient[component]["yplus"],
                                 pstat_gradient[component][pKey] / termplus,
                                 linestyle='dotted',
                                 label=labels[pKey[1:]])

        pstat_gradient['dy'] = pfields.equationP(StNo, lambda x: x, stattype,
Esempio n. 4
0
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# File name: homfigs_tests.py
# Created by: gemusia
# Creation date: 02-07-2017
# Last modified: 02-07-2017 16:08:37
# Purpose:
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

import numpy as np
import matplotlib.pyplot as plt
import homfigs as hf
import unittest

ff = hf.Homfig(title='very important title', xlabel="xxx", ylabel="yyy")
ff.hdraw()


class HomfigTest(unittest.TestCase):
    def test_input0(self):
        with self.assertRaises(ValueError):
            hs.Channel([], [], [], 0, 0, 0)
Esempio n. 5
0
        5:("hek_symm",)}
ylabels = {1:"$<U>_{x}$",2:"$<U>_{y}$",
        3:"$<U>_{z}$",4:"$<U_{x},U_{y}>$",
        5:"$<U_{y},U_z>$",6:"$<U_{x}U_{z}$",
        7:"$e_{k}$"}
ptitles = {"hmean_symm":"mean of U","hstd_symm":"Standard deviation of U","hcor_symm":"Correlation of ","hek_symm":"Kinetic energy"}


#data loading
file_path    = expanduser("~") + "/wyniki/apriori/fluid/"
fig_path     = file_path

# U streamwise, for channel flow description in PhD

DNS_5200 = np.transpose(np.loadtxt('/home/gemusia/REFERENCE_DATA/DNS_5200_Uplus_LeeMoser15.txt.csv',skiprows=6))
statfig = hfig.Homfig(title="Streamwise velocity", ylabel='$U_{x}^{+}$',xscale='log',xlim=[1,6000])

print DNS_5200

statfig.add_plot(DNS_5200[0],DNS_5200[1],linestyle=LineStyle['DNS'],label='DNS')
statfig.add_plot(DNS_5200[0][:7],DNS_5200[0][:7],linestyle='dashed',label='$y=x$')
statfig.add_plot(DNS_5200[0][6:],2.49*np.log(DNS_5200[0][6:])+5,linestyle='dashdot',label='$y=a\ln(x) + b$')
plt.axvline(x=5,ymin=0,ymax=0.6,linestyle = 'dashed',color='black',linewidth=0.2)
plt.axvline(x=30,ymin=0,ymax=0.6,linestyle = 'dashed',color='black',linewidth=0.2)
plt.axvline(x=700,ymin=0,ymax=0.8,linestyle = 'dashed',color='black',linewidth=0.2)
plt.text(2,10,"I")
plt.text(10,15,"II")
plt.text(80,10,"III")
plt.text(1100,10,"IV")

statfig.hdraw()
Esempio n. 6
0
                                fPath=file_path,
                                fPrefix=["uppf_Ux", "uppf_Uy", "uppf_Uz"])

for skey, sval in statistics.iteritems():

    print skey, sval, type(sval[0])
    #computation of statistics
    stat_DNS = test_set_DNS.statsT(*sval)
    stat_LES = test_set_LES.statsT(*sval)

    #figures
    for a in range(1, len(stat_DNS)):  #len(stat_DNS) = len(stat_LES)
        #handle for different plot title
        if skey in range(2, 5):
            statfig = hfig.Homfig(title=ptitles[sval[0]] + sval[1] + " " +
                                  sval[2],
                                  ylabel=ylabels[skey + 1])  #correlations
        elif skey == 5:
            statfig = hfig.Homfig(title=ptitles[sval[0]],
                                  ylabel=ylabels[6])  #kinetic energy
        else:
            statfig = hfig.Homfig(title=ptitles[sval[0]] + coordinates[a],
                                  ylabel=ylabels[a])

        statfig.add_plot(stat_DNS[0],
                         stat_DNS[a],
                         linestyle=LineStyle['DNS'],
                         label='DNS')
        statfig.add_plot(stat_LES[0],
                         stat_LES[a],
                         linestyle=LineStyle['LES'],
    for stattype in ("pmean", "pstd"):
        for key, val2 in terms.iteritems():
            statArgList.append([stattype, "symm", ["f" + val2]])
            statArgList.append([stattype, "symm", ["p" + val2]])

    pstat = pfields.statsP(
        StNo, *statArgList)  #computation of all required statistic
    #to improve efficiency and not opening
    #big data files too many times

    #figures
    for arg in ifilterfalse(lambda x: x == "plus",
                            set(map(lambda y: y[1:],
                                    pstat.keys()))):  #custom , for this case

        statfig = hfig.Homfig(ylabel='$(u\\frac{\partial U}{\partial x})^{+}$')

        statfig.add_plot(pstat["yplus"],
                         pstat["f" + arg] / termplus,
                         linestyle=LineStyle['fterm'],
                         label=labels['f' + arg[:5]])
        statfig.add_plot(pstat["yplus"],
                         pstat["p" + arg] / termplus,
                         linestyle=LineStyle['pterm'],
                         label=labels['p' + arg[:5]])

        statfig.hdraw()
        plotFileName = pict_path + arg + "_" + StNo + ".eps"
        statfig.save(plotFileName)
        print "plot created: " + plotFileName
Esempio n. 8
0
    w.writerow(tau.keys())
    w.writerows(zip(*tau.values()))

    print f_name_tau, " created"

#--------------------------------------------------------------------#
# PLOT DRAW
#
# we use symmetrised data
#--------------------------------------------------------------------#

for simulation, St in product(ptype, Stlist):

    corrfig = hfig.Homfig(title=St + ": Correlation coefficient for " +
                          simulation + " simulation",
                          ylabel="$rho (t)$",
                          xlabel="t",
                          xlim=[0, 800])

    plotFileName = pict_path + "rho_" + St + "_" + simulation + ".eps"

    for key, arg in zip(datalines.keys(), datalines.values()):
        corrfig.add_plot(rho[St + "_" + simulation][int(key)],
                         linestyle=arg["ls"],
                         color=arg["c"],
                         label=arg["lbl"])

    corrfig.hdraw()
    corrfig.save(plotFileName)
    print "plot created: " + plotFileName
    plt.close(corrfig.fig)
Esempio n. 9
0
def h(x):
    return np.sin(np.pi / (2 * n)) * np.cos(x / float(n) * np.pi) / (
        np.cos(np.pi / (2 * n)) * np.sin(x / float(n) * np.pi))


y = np.arange(2, 31, 1)
z = np.arange(0, 1, 0.1)

print z
print g(z)

file_path = expanduser("~") + "/Documents/Doktorat_current/picts/"
pict_path = file_path

asymmetry_coeff = hfig.Homfig(
    title="Difference of right and left side wall-normal filter",
    ylabel="$c$",
    xlabel="y",
    xlim=[1, 31])
#  ylabel="$c$", xlabel="y", xlim=[0,1])

plotFileName = pict_path + "filter_skewness.eps"

asymmetry_coeff.add_plot(h(y))

asymmetry_coeff.hdraw()
asymmetry_coeff.save(plotFileName)
print "plot created: " + plotFileName
plt.close(asymmetry_coeff.fig)
Esempio n. 10
0
                        tf[1],
                        ftermx=tf[5],
                        ftermy=tf[3],
                        ftermz=tf[4],
                        ptermx=tf[8],
                        ptermy=tf[6],
                        ptermz=tf[7])

    for stattype in ("pmean", "pstd"):
        for key, val2 in terms.iteritems():
            stat_fterm = part.stat_symm(stattype, "symm", "f" + val2)
            stat_pterm = part.stat_symm(stattype, "symm", "p" + val2)

            #figures

            statfig = hfig.Homfig(title=key, ylabel=key)

            statfig.add_plot(*stat_fterm,
                             linestyle=LineStyle['fterm'],
                             label='fterm')
            statfig.add_plot(*stat_pterm,
                             linestyle=LineStyle['pterm'],
                             label='pterm')

            statfig.hdraw()
            statfig.save(fig_path + val2 + "_" + stattype + "_" + val + ".eps")

            plt.close(statfig.fig)
'''
tf=np.transpose(np.loadtxt("200_particles"))
Esempio n. 11
0

# separate plots for each stokes number
for StNo in ptype:

    for stattype in ("pmean","pstd"):
      
        # STATISTICS
        pstat = pfields.equationP(StNo,(lambda x:x),stattype,"symm",["Ux"],["Ufx"],["Vx"])  
        sgsStat = pfields.equationP(StNo,(lambda x,y: x-y),stattype,"symm",["Ux","Ufx"],["Uy","Ufy"],["Uz","Ufz"])  


        # FIGURES

        # velocity statistics
        statfig = hfig.Homfig(title="Velocities streamwise", ylabel="U")
        plotFileName = pict_path +stattype +"_"+StNo+".eps"

        for arg in ifilterfalse(lambda x: x=="yplus", set(pstat.keys())): #custom , for this case
            statfig.add_plot(pstat["yplus"],pstat[arg],linestyle=LineStyle[arg],label=arg)
            
        statfig.hdraw()
        statfig.save(plotFileName)
        print "plot created: " + plotFileName
        plt.close(statfig.fig)


        # SGS statistics
        sgsfig = hfig.Homfig(title="SGS velocity", ylabel="$u^*$")
        plotFileNameSGS = pict_path + "Usgs_"+stattype +"_"+StNo+".eps"