コード例 #1
0
def readMetrics(redvol, maxrad, capnum):
    import matplotlib.pyplot as plt
    from matplotlib.pyplot import cm
    import numpy as np
    from scipy import interpolate, interpolate
    from math import log10, floor, pi, sqrt
    import os.path

    homedir = os.path.abspath(os.path.join("../../", os.pardir))

    load_src("readLT", homedir + "/tools/readLT.py")
    from readLT import *

    ###################################################
    #                     SETUP                       #
    ###################################################

    # read parameters
    ifile = open("./params.in", "r")
    print ifile
    for line in ifile:
        params = line.split()  # space delimited text
        if params[0] == "METRIC":
            STR = params[2]
    # 		if params[0] == 'REDVOL' :
    # 			redvol = params[2]
    # 		if params[0] == 'MAXRAD' :
    # 			maxrad = params[2]
    # 		if params[0] == 'BENMOD' :
    # 			benmod = params[2]
    # 		if params[0] == 'CAPNUM' :
    # 			capnum = params[2]
    ifile.close()

    ###################################################
    #               LUBRICATION THEORY                #
    ###################################################

    # load data file
    # 	(CA, EPS, LENGTH, AREA, VLME, FX, FR, DP, GAMMAX, TAUMAX, ETA) = readLT2(homedir, redvol, maxrad)
    (Ca, eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLT(homedir, redvol, maxrad, capnum)

    Dp = p[0] - p[-1]
    length = max(x) - min(x)
    eta = (pi * length / vlme) * (Dp / (8.0 * (1.0 - eps) * length) - 1.0)
    maxgam = max(gam)

    return (STR, Ca, eps, area, vlme, Dp, eta, length, maxgam)
コード例 #2
0
def readMetrics(redvol,capnum) :
	import matplotlib.pyplot as plt
	from matplotlib.pyplot import cm
	import numpy as np
	from scipy import interpolate, integrate
	from math import log10, floor, pi, sqrt
	import os.path
	
	homedir = os.path.abspath(os.path.join("../", os.pardir))

	load_src("readLT", homedir + "/tools/readLT.py")
	from readLT import *
	
	###################################################
	#                     SETUP                       #
	###################################################
	
	# read parameters
	ifile = open('./params.in', 'r')
	print ifile
	for line in ifile :
		params = line.split()		# space delimited text
		if params[0] == 'METRIC' :
			STR = params[2]
#		if params[0] == 'REDVOL' :
#			redvol = params[2]
#		if params[0] == 'CONFIN' :
#			confin = params[2]
#		if params[0] == 'BENMOD' :
#			benmod = params[2]
#		if params[0] == 'CAPNUM' :
#			capnum = params[2]
	ifile.close()
	
	REDVOL = ['90','91','92','93','94','95','96','97','98','99','100']
	REDVOL = ['80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100']
	REDVOL = ['70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100']
	REDVOL = ['65','66','67','68','69','70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99','100']

	CONFIN = ['80','85','90','95']
	CONFIN = ['95','96','97','98','99']
	CONFIN = ['80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99']
	#CONFIN = ['70','71','72','73','74','75','76','77','78','79','80','81','82','83','84','85','86','87','88','89','90','91','92','93','94','95','96','97','98','99',]
#	CONFIN = ['80','82','84','86','88','90','92','94','96','98']
#	CONFIN = ['80','85','90','95','98']
#	CONFIN = ['90','91','92','93','94','95','96','97','98','99']
	#CONFIN = ['99']
	#CONFIN = ['99']

	DP = []
	EPS = []
	AREA = []
	VLME = []
	LAMBDA = []
	VOLRAT = []
	for confin in CONFIN :
		
		###################################################
		#               LUBRICATION THEORY                #
		###################################################
		
		# load data file
		#(CA, EPS, LENGTH, AREA, VLME, FX, FR, DP, GAMMAX, TAUMAX, ETA) = readLT2(homedir, redvol, confin)
		(Ca, eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLT(homedir, redvol, confin, capnum)

		# alternative way of calculating the pressure drop
		# - integrate the shear stress on the wall
		shear = []
		for i in range(len(s)) :
			rr = r[i]
			r2 = rr*rr
			if (rr > 0.0001) :
				from math import log
				logr = log(rr)
			
				g =   (8.0/(1.0 - r2))
				g = g*(eps - 1.0 - (1.0 - r2)/(2.0*logr))
				g = g/(1.0 + r2 + (1.0 - r2)/logr)

				e = 0.25*g*(2.0 + (1.0 - r2)/logr) + 1.0/logr
			else : 
				g  = 8.0*(eps - 1.0) # limiting value as r --> 0
				e = 0.5*g
			shear.append(-e*tx[i])
		shear = np.column_stack(shear)
		shear = shear[0]
		
		dp = 2.0*integrate.trapz(shear, s) 

		# reduced volume
		a = sqrt(area/(4.0*pi))
		a3 = a*a*a
		lam = a
		v = vlme/((4.0/3.0)*pi*a3)

		DP .append(dp)
		EPS.append(eps)
		AREA.append(area)
		VLME.append(vlme)
		LAMBDA.append(a)
		VOLRAT.append(v)
	
	DP     = np.column_stack(DP)
	EPS    = np.column_stack(EPS)
	AREA   = np.column_stack(AREA)
	VLME   = np.column_stack(VLME)
	LAMBDA = np.column_stack(LAMBDA)
	VOLRAT = np.column_stack(VOLRAT)

	DP     = DP[0]
	EPS    = EPS[0]
	AREA   = AREA[0]
	VLME   = VLME[0]
	LAMBDA = LAMBDA[0]
	VOLRAT = VOLRAT[0]
	
	return (STR, EPS, VOLRAT, LAMBDA, AREA, VLME, DP)
コード例 #3
0
ファイル: readProfiles.py プロジェクト: jbarakat/ves_tapered
def readProfiles() :
	import numpy as np
	from scipy import interpolate, integrate
	from math import log10, floor, pi, sqrt
	import os.path
	
	altdir = os.path.abspath("../")
	
	load_src("readLT", altdir + "/tools/readLT.py")
	from readLT import *
	
	###################################################
	#                     SETUP                       #
	###################################################
	
	# read parameters
	ifile = open('./params.in', 'r')
	print ifile
	for line in ifile :
		params = line.split()		# space delimited text
		if params[0] == 'PROFILE' :
			STR = params[2]
		if params[0] == 'REDVOL' :
			redvol = params[2]
		if params[0] == 'CONFIN' :
			confin = params[2]
		if params[0] == 'CAPNUM' :
			capnum = params[2]
	ifile.close()
		
	###################################################
	#               LUBRICATION THEORY                #
	###################################################
		
	xL = []
	yL = []

	vL   = 0
	epsL = 0
	CaL  = 0
	
	# load data file
	(Ca, eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLT(altdir, redvol, confin, capnum)

	lengthx = len(x)
#	print lengthx
		
	# alternative way of calculating the pressure drop
	# - integrate the shear stress on the wall
	shear = []
	dgamds= []
	for i in range(len(s)) :
		rr = r[i]
		r2 = rr*rr
		if (rr > 0.0001) :
			from math import log
			logr = log(rr)
		
			g =   (8.0/(1.0 - r2))
			g = g*(eps - 1.0 - (1.0 - r2)/(2.0*logr))
			g = g/(1.0 + r2 + (1.0 - r2)/logr)

			e = 0.25*g*(2.0 + (1.0 - r2)/logr) + 1.0/logr
			e2 = 0.25*g*(2.0*rr + (1.0 - r2)/(rr*logr)) + 1.0/(rr*logr)
		else : 
			g  = 8.0*(eps - 1.0) # limiting value as r --> 0
			e = 0.5*g
			e2 = 0.5*g
		#shear.append(-e*tx[i])
		shear.append(-e)
		dgamds.append(-e2)
	shear = np.column_stack(shear)
	shear = shear[0]
	dgamds = np.column_stack(dgamds)
	dgamds = dgamds[0]
	
	dp = 2.0*integrate.trapz(shear, x) 
	dgam = integrate.trapz(dgamds, s) 

	# reflect shape across symmetry axis
	xx  = np.concatenate((x, np.flipud( x)))
	rr  = np.concatenate((r, np.flipud(-r)))
		

	if   (STR == 'SHAPE') :
		xL = xx
		yL = rr
	elif (STR == 'PRESS') :
		xL = x
		yL = p
	elif (STR == 'SHEAR') :
		xL = x
		yL = tau
	#	for i in range(len(tau)) :
	#		yL[i] = tau[i]*Ca
	elif (STR == 'TENS' ) :
		xL = x
		yL = gam
	elif (STR == 'TRANS' ) :
		xL = x
		yL = qs
	
	# add a decimal point to the Ca string if need be
	if (capnum[0] == '0') :
		capnum = capnum[0] + '.' + capnum[1:]
	
	a  = sqrt(area/(4.0*pi))
	a3 = a*a*a
	v  = vlme/((4.0/3.0)*pi*a3)
	v  = round(v, 2)

	vL   = v
	epsL = eps
	CaL  = Ca

	return (STR, vL, epsL, CaL, xL, yL)
コード例 #4
0
def readProfiles():
    import numpy as np

    # from scipy import interpolate, interpolate
    from math import log10, floor, pi, sqrt
    import os.path

    altdir = os.path.abspath("../")

    load_src("readLT", altdir + "/tools/readLT.py")
    from readLT import *

    ###################################################
    #                     SETUP                       #
    ###################################################

    # read parameters
    ifile = open("./params.in", "r")
    print ifile
    for line in ifile:
        params = line.split()  # space delimited text
        if params[0] == "PROFILE":
            STR = params[2]
        if params[0] == "REDVOL":
            redvol = params[2]
        if params[0] == "CONFIN":
            confin = params[2]
        if params[0] == "CAPNUM":
            capnum = params[2]
    ifile.close()

    ###################################################
    #               LUBRICATION THEORY                #
    ###################################################

    xL = []
    yL = []

    vL = 0
    epsL = 0
    CaL = 0

    # load data file
    (Ca, eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLT(altdir, redvol, confin, capnum)

    # 	lengthx = len(x)
    # 	mid = lengthx/2
    # 	print mid
    # 	print (1.0 - r[mid])/eps
    # 	print 1.0 - ((1.0 - r[mid])/eps - 1.0)*6.0/eps

    # reflect shape across symmetry axis
    xx = np.concatenate((x, np.flipud(x)))
    rr = np.concatenate((r, np.flipud(-r)))

    ## interpolate to xi using splines
    # tck = interpolate.splrep(x, y, s=0)
    # yi = interpolate.splev(xi, tck, der=0)

    if STR == "SHAPE":
        xL = xx
        yL = rr
    elif STR == "PRESS":
        xL = x
        yL = p
    elif STR == "SHEAR":
        xL = x
        yL = tau
        # 	for i in range(len(tau)) :
        # 		yL[i] = tau[i]*Ca
    elif STR == "TENS":
        xL = x
        yL = gam
    elif STR == "TRANS":
        xL = x
        yL = qs

        # add a decimal point to the Ca string if need be
    if capnum[0] == "0":
        capnum = capnum[0] + "." + capnum[1:]

    a = sqrt(area / (4.0 * pi))
    a3 = a * a * a
    v = vlme / ((4.0 / 3.0) * pi * a3)
    v = round(v, 2)

    vL = v
    epsL = eps
    CaL = Ca

    return (STR, vL, epsL, CaL, xL, yL)
コード例 #5
0
def readProfiles() :
	import numpy as np
	#from scipy import interpolate, interpolate
	from math import log10, floor, pi, sqrt
	import os.path
	
	altdir  = os.path.abspath("../../../allCa/postproc/")
	altdir2 = os.path.abspath("../")
	
	load_src("readLT", altdir + "/tools/readLT.py")
	load_src("readLTHighCa", altdir2 + "/tools/readLT.py")
	from readLT import *
	from readLTHighCa import *
	
	###################################################
	#                     SETUP                       #
	###################################################
	
	# read parameters
	ifile = open('./params.in', 'r')
	print ifile
	for line in ifile :
		params = line.split()		# space delimited text
		if params[0] == 'PROFILE' :
			STR = params[2]
		if params[0] == 'REDVOL' :
			redvol = params[2]
		if params[0] == 'MAXRAD' :
			maxrad = params[2]
		if params[0] == 'CAPNUM' :
			capnum = params[2]
	ifile.close()
		
	###################################################
	#               LUBRICATION THEORY                #
	###################################################
		
	xL = []
	yL = []

	vL   = 0
	epsL = 0
	CaL  = 0
	
	# load data file
	(Ca, eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLT(altdir, redvol, maxrad, capnum)

	# reflect shape across symmetry axis
	xx  = np.concatenate((x, np.flipud( x)))
	rr  = np.concatenate((r, np.flipud(-r)))
	
	## interpolate to xi using splines
	#tck = interpolate.splrep(x, y, s=0)
	#yi = interpolate.splev(xi, tck, der=0)

	if   (STR == 'SHAPE') :
		xL = xx
		yL = rr
	elif (STR == 'PRESS') :
		xL = x
		yL = p
	elif (STR == 'SHEAR') :
		xL = x
		yL = tau
	elif (STR == 'TENS' ) :
		xL = x
		yL = gam
	elif (STR == 'TRANS' ) :
		xL = x
		yL = qs
	
	# add a decimal point to the Ca string if need be
	if (capnum[0] == '0') :
		capnum = capnum[0] + '.' + capnum[1:]
	
	a  = sqrt(area/(4.0*pi))
	a3 = a*a*a
	v  = vlme/((4.0/3.0)*pi*a3)
	v  = round(v, 2)

	vL   = v
	epsL = eps
	CaL  = Ca

	###################################################
	#    HIGH CAPILLARY NUMBER LUBRICATION THEORY     #
	###################################################
		
	xH = []
	yH = []

	vH   = 0
	epsH = 0
	
	# load data file
	(eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLTHighCa(altdir2, redvol, maxrad)

	# reflect shape across symmetry axis
	xx  = np.concatenate((x, np.flipud( x)))
	rr  = np.concatenate((r, np.flipud(-r)))
	
	## interpolate to xi using splines
	#tck = interpolate.splrep(x, y, s=0)
	#yi = interpolate.splev(xi, tck, der=0)

	if   (STR == 'SHAPE') :
		xH = xx
		yH = rr
	elif (STR == 'PRESS') :
		xH = x
		yH = p
	elif (STR == 'SHEAR') :
		xH = x
		yH = tau
	elif (STR == 'TENS' ) :
		xH = x
		yH = gam
	elif (STR == 'TRANS' ) :
		xH = x
		yH = qs
	
	a  = sqrt(area/(4.0*pi))
	a3 = a*a*a
	v  = vlme/((4.0/3.0)*pi*a3)
	v  = round(v, 2)

	vH   = v
	epsH = eps

	return (STR, vL, epsL, CaL, xL, yL, vH, epsH, xH, yH)
コード例 #6
0
ファイル: readProfiles.py プロジェクト: jbarakat/ves_tapered
def readProfiles() :
	import numpy as np
	#from scipy import interpolate, interpolate
	from math import log10, floor, pi, sqrt, log
	import os.path
	
	altdir = os.path.abspath("../")
	
	load_src("readLT", altdir + "/tools/readLT.py")
	from readLT import *
	
	###################################################
	#                     SETUP                       #
	###################################################
	
	# read parameters
	ifile = open('./params.in', 'r')
	print ifile
	for line in ifile :
		params = line.split()		# space delimited text
		if params[0] == 'PROFILE' :
			STR = params[2]
		if params[0] == 'REDVOL' :
			redvol = params[2]
		if params[0] == 'CONFIN' :
			confin = params[2]
		if params[0] == 'CAPNUM' :
			capnum = params[2]
	ifile.close()
		
	###################################################
	#               LUBRICATION THEORY                #
	###################################################
		
	xL = []
	yL = []

	vL   = 0
	epsL = 0
	CaL  = 0
	
	# load data file
	(Ca, eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLT(altdir, redvol, confin, capnum)

	tauw = []
	for i in range(len(s)) :
		rr = r[i]
		r2 = rr*rr
		if (rr > 0.0001) :
			from math import log
			logr = log(rr)
		
			g =   (8.0/(1.0 - r2))
			g = g*(eps - 1.0 - (1.0 - r2)/(2.0*logr))
			g = g/(1.0 + r2 + (1.0 - r2)/logr)

			e = 0.25*g*(2.0 + (1.0 - r2)/logr) + 1.0/logr
		else : 
			g  = 8.0*(eps - 1.0) # limiting value as r --> 0
			e = 0.5*g
		#tauw.append(-e*tx[i])
		tauw.append(e)
	tauw = np.column_stack(tauw)
	tauw = tauw[0]

	lengthx = len(x)
	mid = lengthx/2
#	print mid
#	print (1.0 - r[mid])/eps
#	print 1.0 - ((1.0 - r[mid])/eps - 1.0)*6.0/eps

	rmid = r[mid]
	Q2 = eps
#	print eps - (1.0 - rmid)
	rmid = 0.990147
	Q2 = 1.0 - rmid - (1.0/3.0)*pow((1.0 - rmid),2.0) + (1.0/4.0)*pow((1.0 - rmid),3.0)
#	Q2 = 0.00983
#	print 0.009821 - (1.0 - rmid + (1.0/4.0)*pow((1.0 - rmid),3.0))
	print Q2
	r2 = rmid*rmid
	g = (8.0/(1.0 - r2))
	g = g*(Q2 - 1.0 - (1.0 - r2)/(2.0*log(rmid)))
	g = g/(1.0 + r2 + (1.0 - r2)/log(rmid))

	print rmid
	print g

	# reflect shape across symmetry axis
	xx  = np.concatenate((x, np.flipud( x)))
	rr  = np.concatenate((r, np.flipud(-r)))
	
	## interpolate to xi using splines
	#tck = interpolate.splrep(x, y, s=0)
	#yi = interpolate.splev(xi, tck, der=0)

	if   (STR == 'SHAPE') :
		xL = xx
		yL = rr
	elif (STR == 'PRESS') :
		xL = x
		yL = p
	elif (STR == 'SHEAR') :
		xL = x
		yL = tau
	elif (STR == 'WALLSHEAR') :
		xL = x
		yL = tauw
	elif (STR == 'TENS' ) :
		xL = x
		yL = gam
	#	for i in range(len(yL)):
	#		yL[i] = -p[i]*r[i]/gam[i]
	elif (STR == 'CURV' ) :
		xL = x
		yL = cs
	elif (STR == 'TRANS' ) :
		xL = x
		yL = qs
	
	# add a decimal point to the Ca string if need be
	if (capnum[0] == '0') :
		capnum = capnum[0] + '.' + capnum[1:]
	
	a  = sqrt(area/(4.0*pi))
	a3 = a*a*a
	v  = vlme/((4.0/3.0)*pi*a3)
	v  = round(v, 2)

	vL   = v
	epsL = eps
	CaL  = Ca
	
	###################################################
	#    HIGH CAPILLARY NUMBER LUBRICATION THEORY     #
	###################################################
		
	xH = []
	yH = []

	# load data file
	(eps, area, vlme, s, x, r, nx, nr, tx, tr, cs, cphi, qs, p, tau, gam) = readLTHighCa(altdir, redvol, confin)

	tauw = []
	for i in range(len(s)) :
		rr = r[i]
		r2 = rr*rr
		if (rr > 0.0001) :
			from math import log
			logr = log(rr)
		
			g =   (8.0/(1.0 - r2))
			g = g*(eps - 1.0 - (1.0 - r2)/(2.0*logr))
			g = g/(1.0 + r2 + (1.0 - r2)/logr)

			e = 0.25*g*(2.0 + (1.0 - r2)/logr) + 1.0/logr
		else : 
			g  = 8.0*(eps - 1.0) # limiting value as r --> 0
			e = 0.5*g
		#tauw.append(-e*tx[i])
		tauw.append(e)
	tauw = np.column_stack(tauw)
	tauw = tauw[0]

	# reflect shape across symmetry axis
	xx  = np.concatenate((x, np.flipud( x)))
	rr  = np.concatenate((r, np.flipud(-r)))
	
	## interpolate to xi using splines
	#tck = interpolate.splrep(x, y, s=0)
	#yi = interpolate.splev(xi, tck, der=0)

	if   (STR == 'SHAPE') :
		xH = xx
		yH = rr
	elif (STR == 'PRESS') :
		xH = x
		yH = p
	elif (STR == 'SHEAR') :
		xH = x
		yH = tau
	#	for i in range(len(tau)) :
	#		yH[i] = -tau[i]#/(Ca)
	elif (STR == 'WALLSHEAR') :
		xH = x
		yH = tauw
	elif (STR == 'TENS' ) :
		xH = x
		yH = gam
	#	for i in range(len(yH)):
	#		yH[i] = -p[i]*r[i]/gam[i]
	elif (STR == 'CURV' ) :
		xH = x
		yH = cs
	elif (STR == 'TRANS' ) :
		xH = x
		yH = qs
	
	return (STR, vL, epsL, CaL, xL, yL, xH, yH)