Calculating the average the number of molecules in each bin

Assignment Help MATLAB Programming
Reference no: EM131906474

Microscale Heat Transfer Project Assignment

The analytical approach to determining bulk properties of an ideal gas based on molecular data. One key aspect of the analytical models is the assumption of an infinite number of molecules. Therefore, the analytical approach breaks down at the nanoscale, so computational approaches are used instead. In this project you will get a brief glimpse of some of the computational approaches used to modeling ideal gases computationally using the Direct Simulation Monte Carlo (DSMC) method.

1. One of the important aspects of kinetic theory is sampling from a probability distribution function f(x), where x is the property that is distributed among the molecules. In order to accurately model a system of molecules, random positions, velocities, and energies must be assigned such that the resultant distribution of properties follows that prescribed by the theory.

a. The easiest way to do this is to integrate the probability distribution function -∞f(x)dx = 1 since 100% of all sampled values of x lie between -∞ and ∞. This allows you to develop a relation for f(x). Then, the cumulative distribution function is defined as F(x) = -∞xf(x) dx. Setting F(x) equal to a random number R in the range 0 ≤ R ≤ 1 allows for accurate sampling using a random number generator.

i. Show that using this technique, a randomly assigned value of x for a uniform distribution of x between a and b (no values of x outside of the range a ≤ x ≤ b) is: x = a + R(b - a) [hint: f(x) is constant in the range a ≤ x ≤ b].

ii. How would you randomly assign a value of x for the distribution f(x) = cx, where all values of x lie between a and b?

iii. Use MATLAB to show plots of the distributions for 10,000 samples of x for both (i) and (ii) for a = 3, b = 12. Create a normalized histogram with 30 bins and compare the results to the theoretical curves of f(x)dx, where dx is the width of the bins.

b. There are situations where the method in part (a) doesn't work mathematically. Therefore, the acceptance-rejection method is used.

i. Show that the method in part (a) for the x-velocity component in an equilibrium gas f(vx) = (β/π½)exp(-β2vx2) yields F(vx) = ½(1 + erf(βvx)), where erf is the Gaussian error function. This shows that you cannot solve directly for vx by setting F(vx) = R.

ii. The acceptance-rejection method is written as f^(x) = f(x)/fmax, where fmax is the maximum value of the distribution function. Determine f^(vx) for the distribution in (i).

iii. In this technique, a value of v^x is sampled using a uniform distribution between a = -3/β and b = 3/β. Write out the expression for sampling of v^x using the result from Part (a, i).

iv. The expression for v^x developed in (iii) replaces vx in the expression for f^(vx) in (ii)-write out the final expression for f^(vx) in terms of R.

v. For a given randomly determined value of f^(vx) using (iv), the value is accepted if f^(vx) > R2, where R2 is a second randomly generated number. Run MATLAB for 10,000 points with this technique to show that it obtains the appropriate distribution by comparing to the Maxwell x-velocity distribution. Use β = 1 and 30 bins for collection in your histogram.

2. In this project we are only focusing on a 1-d velocity distribution.

a. Starting with Eq. 2.36, show that (vx2)- = kBT/m.

b. If we assume that Eq. 2.62 is still valid for a 1-d distribution, then show that vrms,x = 1/2β.

c. Combine parts (a) and (b) to show that β = √(m/4kBT).

3. Our simplified 1-d DSMC simulation will test conduction between two plates at different temperatures. Consider a channel between two infinite parallel plates. The plate at x = 0 contains a temperature of Tc = 290 K, and the plate at x = L = 2 μm is at Th = 310 K. The spherical monatomic molecules have a diameter of d = 0.2 nm and a molar mass of M = 30 kg/kmol.

a. Initialize a set of 10,000 molecules with randomly-assigned positions in 0 ≤ x ≤ L.

b. Apply the acceptance-rejection method to randomly assign x-velocity vectors for each molecule using a temperature of Ti = 300 K.

c. Divide the domain into Ncell = 25 cells in the x-direction. The cells are of equal thickness Δx. So, the minimum x-value for cell i is (i - 1)Δx, and the maximum x-value is iΔx.

d. Use a "for" loop to do the following:

i. Advance the positions of the molecules using xnew = xold + vxΔt, where Δt = 0.2 ns.

ii. Check to see if the molecules hit a wall by seeing if xnew < 0 or xnew > L. If this happens, then scale the x-velocity of the particle using vnew = -vold√(Twall/Ti), where Twall equals either Tc(x = 0) or Th(x = L). Determine the new position of the molecules at the end of the time step by examining the pre- and post-collision portions of the timestep.

iii. Randomly determine if collisions occur in the channel. For Na molecules in the cell, then randomly select ∼Na/2 collision pairs using the FindPairs function provided. The probability that a collision occurs in a given pair is calculated using

P~ = (Na/Nr)(gΔt/√2Λr)

where Na is the number of molecules in the cell, Nr = ρrΔx, ρr = N/L, g = |vx,1 = vx,2|, and Λr = [√2πρr3d2]-1. A collision occurs if a random number R < P~. As a hint, use the floor command in MATLAB to help quickly identify which cell a molecule is in.

iv. If a collision occurs, then re-sample an x-velocity using the acceptance-rejection method to get a parameter vcoll. Use the temperature Ti in doing the sampling. The new x-velocities for molecules 1 and 2 are calculated using v1,new = vcm + vcoll, v2,new = vcm - vcoll , where vcm = ½(v1,old + v2,old).

e. Run the simulation for 1000 steps, calculating the average the number of molecules ?Na? in each bin. Plot this parameter versus the x-position of the center of the bins. Also, determine the percentage of molecule pairs that collide throughout the duration of the simulation. Physically explain any trend seen in the plot.

f. Repeat steps a-e for 1,000 molecules run for 10,000 steps. Comment on and explain any differences you see in the two sets of plots or collision percentage for the two cases.

g. Repeat step f for a molecular diameter of 2 nm. Comment on and explain any differences you see in the two sets of plots or collision percentage for the two cases.

Attachment:- Assignment Files.rar

Reference no: EM131906474

Questions Cloud

Total number of electron valence shell : In each of these compounds, the Mo2 will have a charge of +4 and a total number of electron valence shell of 12 which equates to 8 electrons
What information can you get from looking at the map : First, glance at the map and offer your feedback. What information can you get from looking at the map?Then, please look at "emancipation event types".
Cash value-assume payments are paid ahead of coverage : A cash value life insurance policy with a face value of $100,000 was prepared for John. Assume payments are paid ahead of coverage.
Molybdenum compounds with quadruple bonds : In this experiment, molybdenum compounds with quadruple bonds are synthesized. Because of poor yields
Calculating the average the number of molecules in each bin : ME 8250-001/DL1: Microscale Heat Transfer Project Assignment. Run the simulation for 1000 steps, calculating average the number of molecules ?Na? in each bin
Capital structure weights on market value basis : What are the company’s capital structure weights on a market value basis?
Hydrochloric acid with nickel : Write balanced molecular and net ionic equations for the following reactions :hydrochloric acid with nickel.
Determining the equilibrium concentration : If the reaction began with 0.150 M of N2 and 0.150 M of O2, the equilibrium concentration of NO would be?
What observations can you make about these results : What would be the value of these bonds if the market discount rate were. What observations can you make about these results?

Reviews

len1906474

3/19/2018 4:45:54 AM

A hint regarding the coding to work with the FindPairs function: The function takes as its input a 1-d array of molecule identification numbers. It then randomly determines pairs from them. This means that you need to create two arrays: cellid and cellct. cellid is an N x Ncell array, where N is the number of molecules and Ncell is the number of cells. cellct is an Ncell x 1 array. So, when the time comes to find your input to FindPairs you will need to update the cellid and cellct arrays using the molecular position informatoin, and then feed the arrays into Findpairs for a given cell.

Write a Review

MATLAB Programming Questions & Answers

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd