Esempio n. 1
0
def tpv(thermo):
    thermo['pActual'] = thermo['Pressure']
    T0 = ideal.tpv(thermo)
    thermtuple = 'LK tpv',thermo
    #print (thermtuple, type(thermtuple))
    T = scipy.optimize.newton(tfpv, T0, None, thermtuple)
    return T
Esempio n. 2
0
def vtp(thermo):
    thermo['pActual'] = thermo['Pressure']
    v0 = ideal.vtp(thermo)
    thermtuple = 'LK vtp',thermo
    #print (thermtuple, type(thermtuple))
    v = scipy.optimize.newton(vftp, v0, None, thermtuple)
    return v
@author: sthalabard
"""

#%% Startup File
startup_file='init_python.py'
exec(open(startup_file).read())
%matplotlib qt

import IdealGas as IG

FigFolder='PerfectGas'
if not os.path.exists(FigFolder): os.mkdir(FigFolder)
SAVEFIG=False

#Set initial distribution
g=IG.GP(N=800,L=1,beta=1)
g.t=-50

output=os.path.join(FigFolder,'Exp1_N%d' %(g.N,))
if SAVEFIG and not os.path.exists(output): 
    os.mkdir(output); os.mkdir(os.path.join(output,'FULL')); os.mkdir(os.path.join(output,'REVERSED'))

#%% Define Frame 
fig,axs=newfig(1,3,num='Paradoxical Mixing 1',clear=True,tight_layout=True)
bins_P=np.linspace(-4,4,25)
x=np.linspace(-6,6,1000)
dx=x[2]-x[1]

ax=axs[0] #Positions
ax.set_xlim(-3,3)
ax.set_ylim(-3,3)
@author: sthalabard
"""

#%% Startup File
startup_file='init_python.py'
exec(open(startup_file).read())
%matplotlib qt

import IdealGas as IG

FigFolder='PerfectGas'
if not os.path.exists(FigFolder): os.mkdir(FigFolder)
SAVEFIG=False

#Set initial distribution by patching gas together
ga1=IG.GP(N=800,L=1,beta=0.1); ga1.steps(M=1000,h=1e-2); ga1.q[:,0]+=-1; ga1.q[:,1]+=1
ga2=IG.GP(N=ga1.N,L=1,beta=0.1); ga2.steps(M=1000,h=1e-2);ga2.q[:,0]+=-1; ga2.q[:,1]+=-1

gb1=IG.GP(N=ga1.N,L=1,beta=4); gb1.steps(M=1000,h=1e-2);gb1.q[:,0]+=1; gb1.q[:,1]+=1
gb2=IG.GP(N=ga1.N,L=1,beta=4) ; gb2.steps(M=1000,h=1e-2);gb2.q[:,0]+=1; gb2.q[:,1]+=-1

#COLD GAS
gb=IG.GP(N=ga1.N*2,L=2,beta=gb1.beta)
gb.p[:ga1.N,:]=gb1.p
gb.p[ga1.N:2*ga1.N,:]=gb2.p
gb.q[:ga1.N,:]=gb1.q
gb.q[ga1.N:2*ga1.N,:]=gb2.q

#HOT GAS
ga=IG.GP(N=ga1.N*2,L=2,beta=ga1.beta)
ga.p[:ga1.N,:]=ga1.p