Sunteți pe pagina 1din 10

CHBE 344 - HW1 Q2

September 21, 2018

In [3]: import pandas as pd


import numpy as np
import matplotlib.pyplot as plt

# Get data from .csv


data = pd.read_csv('HW1-2 Data.txt')

# Make arrays for Volume, Mass, and Feret Diameters


Volume = data['Volume [mm^3]]'].values
Mass = data['Mass [mg]'].values
FD1 = data['Feret Diameter 1 [mm]'].values
FD2 = data['Feret Diameter 2 [mm]'].values
w = np.ones_like(Volume)

# PART A

# Create a function for the moment calculations


def moments(y,w,y0=0,m=1):
num = 0
den = 0
N = len(y)
for i in range (N):
num += w[i]*(y[i]-y0)**m
den += w[i]

moment = num/den
return moment

# Calculate Particle Density


Density = Mass/Volume

# Calc Mean, Standard Deviation, Skewness, and Kurtosis for


# Particle Density
Mean_pd = moments(Density,w)
Variance_pd = moments(Density,w,y0=Mean_pd,m=2)
Std_pd = np.sqrt(Variance_pd)
Skewness_pd = moments(Density,w,y0=Mean_pd,m=3)/Std_pd**3
Kurtosis_pd = moments(Density,w,y0=Mean_pd,m=4)/Std_pd**4

1
# Print Mean, Standard Deviation, Skewness, and Kurtosis for
# Particle Density
print('Question 2:')
print()
print('PART A:')
print()
print('i) Particle Density:')
print(' The Mean is: %.15f mg/mm^3 ' %Mean_pd)
print(' The Standard Deviation is: %.14f mg/mm^3 ' %Std_pd)
print(' The Skewness is: %.15f ' %Skewness_pd)
print(' The Kurtosis is: %.14f ' %Kurtosis_pd)
print()

# Print Distribution of Particle Density


bins = 100;

plt.figure(1)
plt.hist(np.log(Density),bins);
plt.title('Particle Density Distribution');
plt.ylabel('Frequency');
plt.xlabel('log(Particle Density)');
plt.show();

# Calculate Equivalent Volume Diameter


Dv = (6*Volume/np.pi)**(1/3)

# Calc Mean, Standard Deviation, Skewness, and Kurtosis for


# Equivalent Volume Diameter
Mean_dv = moments(Dv,w)
Variance_dv = moments(Dv,w,y0=Mean_dv,m=2)
Std_dv = np.sqrt(Variance_dv)
Skewness_dv = moments(Dv,w,y0=Mean_dv,m=3)/Std_dv**3
Kurtosis_dv = moments(Dv,w,y0=Mean_dv,m=4)/Std_dv**4

# Print Mean, Standard Deviation, Skewness, and Kurtosis for


# Equivalent Volume Diameter
print('ii) Equivalent Volume Diameter:')
print(' The Mean is: %.17f mm ' %Mean_dv)
print(' The Standard Deviation is: %.17f mm ' %Std_dv)
print(' The Skewness is: %.16f ' %Skewness_dv)
print(' The Kurtosis is: %.16f ' %Kurtosis_dv)
print()

# Print Distribution of Equivalent Volume Diameter


bins = 100;

plt.figure(2)

2
plt.hist(Dv,bins);
plt.title('Equivalent Volume Diameter Distribution');
plt.ylabel('Frequency');
plt.xlabel('Equivalent Volume Diameter');
plt.show();

# Calculate largest feret diameter


FD_max = np.linspace(0,0,len(FD1))
FD_min = np.linspace(0,0,len(FD1))

for i in range(len(FD1)):
FD_max[i] = max(FD1[i],FD2[i])
FD_min[i] = min(FD1[i],FD2[i])

FD_L = FD_max

# Calc Mean, Standard Deviation, Skewness, and Kurtosis for


# largest feret diameter
Mean_fd = moments(FD_L,w)
Variance_fd = moments(FD_L,w,y0=Mean_fd,m=2)
Std_fd = np.sqrt(Variance_fd)
Skewness_fd = moments(FD_L,w,y0=Mean_fd,m=3)/Std_fd**3
Kurtosis_fd = moments(FD_L,w,y0=Mean_fd,m=4)/Std_fd**4

# Print Mean, Standard Deviation, Skewness, and Kurtosis for


# largest feret diameter
print('iii) Large Feret Diameter:')
print(' The Mean is: %.17f mm' %Mean_fd)
print(' The Standard Deviation is: %.17f mm' %Std_fd)
print(' The Skewness is: %.16f ' %Skewness_fd)
print(' The Kurtosis is: %.15f ' %Kurtosis_fd)
print()

# Print Distribution of largest feret diameter


bins = 100;

plt.figure(3)
plt.hist(FD_L,bins);
plt.title('Large Feret Diameter Distribution');
plt.ylabel('Frequency');
plt.xlabel('Large Feret Diameter');
plt.show();

# Calculate Particle Aspect Ratio


AR = FD_min/FD_max

# Calc Mean, Standard Deviation, Skewness, and Kurtosis for


# Particle Aspect Ratio

3
Mean_ar = moments(AR,w)
Variance_ar = moments(AR,w,y0=Mean_ar,m=2)
Std_ar = np.sqrt(Variance_ar)
Skewness_ar = moments(AR,w,y0=Mean_ar,m=3)/Std_ar**3
Kurtosis_ar = moments(AR,w,y0=Mean_ar,m=4)/Std_ar**4

# Print Mean, Standard Deviation, Skewness, and Kurtosis for


# Particle Aspect Ratio
print('iv) Particle Aspect Ratio:')
print(' The Mean is: %.17f ' %Mean_ar)
print(' The Standard Deviation is: %.17f ' %Std_ar)
print(' The Skewness is: %.16f ' %Skewness_ar)
print(' The Kurtosis is: %.16f ' %Kurtosis_ar)
print()

# Print Distribution of Particle Aspect Ratio


bins = 100;

plt.figure(4)
plt.hist(AR,bins);
plt.title('Particle Aspect Ratio Distribution');
plt.ylabel('Frequency');
plt.xlabel('Particle Aspect Ratio');
plt.show();

# PART B

# Calculate Sauter Mean Diameter


D = FD_min
L = FD_max
SA = (2*np.pi*L*(D/2)) + (2*np.pi*(D/2)**2)
w_S = SA
Mean_Sauter = moments(D,w_S)
print('PART B:')
print()
print('i) Sauter Mean Diameter:')
print(' The Sauter Mean Diameter is: %.17f mm ' %Mean_Sauter)
print()
print(' The Sauter Mean Diameter is useful when characterizing sprays')
print(' The volume to surface area ratio for the Sauter Mean Diameter')
print(' is the same for the entire volume, therefore it is very useful')
print(' for these types of processes. When the surface area is critical')
print(' for spray performance, such as in gas scrubbing, then the Sauter')
print(' Mean Diameter is used to determine which spray is the mose effective')
print()

# Calculate D[4,3]
w_v = Volume

4
D_43 = moments(Dv,w_v)
print('ii) D[4,3]:')
print(' The D[4,3] is: %.17f mm' %D_43)
print()
print(' The Debrouker Mean Diameter, D[4,3] is used in particle distributions')
print(' because it reflects the size of the particles that form the bulk of')
print(' the sample volume. The D[4,3] is useful when the goal of the project')
print(' is to monitor the size of the coarse particles that make up the bulk')
print(' of the sample')
print()

# Calculate Median
D_50 = np.percentile(FD_min,50)
print('iii) 50th Percentile - Median:')
print(' The Median is: %.18f mm ' %D_50)
print()
print(' The Median is used when wanting to separate out the smaller or larger')
print(' half of a distribution of particles. Since the Median is directly in')
print(' the middle of the sample size the correct screen size can be selected')
print(' based on its value. This would allow for the sample to be screened')
print(' correctly')
print()

# Calculate the 10th Percentile


print('iv) 10th and 90th Percentile:')
D_10 = np.percentile(Dv,10)
print(' The 10th Percentile is: %.17f mm ' %D_10)

# Calculate the 90th Percentile


D_90 = np.percentile(Dv,90)
print(' The 90th Percentile is: %.17f mm ' %D_90)
print()
print(' The 10th and 90th percentile is used to determine if there are any')
print(' major changes in the main particle size due to disturbances. The')
print(' 10th and 90th percentile creates a range for acceptable particle')
print(' sizes. When there are changes in the extremes of the distribution')
print(' the change could be due to fines or agglomerates being present in')
print(' the system')

Question 2:

PART A:

i) Particle Density:
The Mean is: 58.906775310830561 mg/mmˆ3
The Standard Deviation is: 472.80851289028720 mg/mmˆ3
The Skewness is: 20.766836073542905
The Kurtosis is: 510.80982540947474

5
ii) Equivalent Volume Diameter:
The Mean is: 0.30559675699354327 mm
The Standard Deviation is: 0.15667567141572547 mm
The Skewness is: 1.3710714999368980
The Kurtosis is: 5.8219838388329608

6
iii) Large Feret Diameter:
The Mean is: 0.57105432094587605 mm
The Standard Deviation is: 0.31207533565872692 mm
The Skewness is: 2.2133938299183855
The Kurtosis is: 13.559023806204134

7
iv) Particle Aspect Ratio:
The Mean is: 0.26498199022201135
The Standard Deviation is: 0.22111885607863277
The Skewness is: 1.1776314019540022
The Kurtosis is: 3.7668709878765205

8
PART B:

i) Sauter Mean Diameter:


The Sauter Mean Diameter is: 0.28084097023276627 mm

The Sauter Mean Diameter is useful when characterizing sprays


The volume to surface area ratio for the Sauter Mean Diameter
is the same for the entire volume, therefore it is very useful
for these types of processes. When the surface area is critical
for spray performance, such as in gas scrubbing, then the Sauter
Mean Diameter is used to determine which spray is the mose effective

ii) D[4,3]:
The D[4,3] is: 0.57584809312927210 mm

The Debrouker Mean Diameter, D[4,3] is used in particle distributions


because it reflects the size of the particles that form the bulk of
the sample volume. The D[4,3] is useful when the goal of the project
is to monitor the size of the coarse particles that make up the bulk
of the sample

iii) 50th Percentile - Median:


The Median is: 0.094951663173421283 mm

9
The Median is used when wanting to separate out the smaller or larger
half of a distribution of particles. Since the Median is directly in
the middle of the sample size the correct screen size can be selected
based on its value. This would allow for the sample to be screened
correctly

iv) 10th and 90th Percentile:


The 10th Percentile is: 0.14084833060192750 mm
The 90th Percentile is: 0.50613741428598569 mm

The 10th and 90th percentile is used to determine if there are any
major changes in the main particle size due to disturbances. The
10th and 90th percentile creates a range for acceptable particle
sizes. When there are changes in the extremes of the distribution
the change could be due to fines or agglomerates being present in
the system

In [ ]:

10

S-ar putea să vă placă și