Body

Hi again,

I'm comparing MolFlow's results to a montecarlo code I built in MATLAB. I'm curious what type of distribution type MolFlow uses. I'm using a cosine distributionin MATLAB. Is that what MolFlow uses (I looked at the PDF, and it said to see the Theory section for more details on this but there's nothing in that chapter currently)?

My code is more basic than MolFlow, but I feel that my results should be similar to what MolFlow is giving, and that's not the case. I'm hoping it's just a difference in the distribution that accounts for the discrepancies. Thank you. 

Submitted by 439b41427f9df836a500 7 years ago

Also with this, what's the difference between the diffuse and uniform? Maybe that's all part of the same question, but I just want to make sure I'm using the correct distribution when comparing. (also I'm assuming "mirror" means specular,right?).

Submitted by Marton Ady 7 years ago

Hello Stephen,

A bit hidden in the old user guide, the desorption distributions are explained on page 25. The reflection types (p27) are the same - diffuse corresponds to cosine and uniform means all angles have equal probability.

Your MATLAB code and Molflow should get exactly the same results, my guess would be that you're comparing the Molflow pressure to your MATLAB code's number of hits. As pressure depends on the incident angle, for such comparisons you most likely need the impingement rate (you can choose it in the texture plotter's dropdown menu) or the raw number of Monte Carlo hits.

If that's not the case, send me your MATLAB results with a brief explanation of how they are generated, and I'll have a look!

One last thing: the old user guide, written in 2013 isn't updated anymore, so if you're interested what Molflow is doing under the hood, you can have a look at section 1.2 of my thesis.

Submitted by 439b41427f9df836a500 7 years ago

Thank you, Marton.

I'm actually not looking at pressure in MolFlow (to my knowledge). What I've done is constructed, per our previous conversation, a surface in front of the inlet to my system that absorbs particles reflected back to the inlet. I'm testing how many particles reach the outlet on a simple parabolic shape. I've attached the .geo file so you can see what I did. As for the results, MolFlow is reporting an 8% capture on that model I've attached 3U_L10_para.geo

My MATLAB code is very very basic , but using the same equation for the parabolic shape of the model, I'm getting a 29% capture. A brief overview of how it works is: I generate a random matrix of "x" values. I then see if those "x" values intersect with the parabolic wall. If they do, I pick a random angle from a cosine distribution. If the angle, puts the particle on a trajectory through the outlet, I mark it as captured. If the angle puts the particle on a trajectory above or below the outlet, it's not counted. Likewise, negative angles are not counted since those would go back out of the inlet, unless they hit another wall. Like I said very very basic, but apart from not counting subsequent hits, the numbers should be close to MolFlow.

Submitted by Marton Ady 7 years ago

An important question: is your MATLAB simulation 2D or 3D?

If it is 2D, could you verify that you're not generating the cosine distribution incorrectly, as described in section 5 of this paper?

Edit: I had a look at your file. I don't know if setting the walls as "Mirror" was deliberate (specular reflection), anyway setting them to Diffuse returns the 8% capture at the outlet you talked about.

You have created an extra facet next to the inlet to count returning particles, which is correct, but you can use the same facet (large inlet) for desorbing and sticking for simplicity.

Other than that the simulation is correct, so to discuss the results I would also say an 8% transmission rate from inlet to outlet. In fact, if you set sticking everywhere (on the walls as well), you get 4% transmission, which is exactly the area ratio of the outlet to the inlet (as expected, as particles fly straight). Setting diffuse reflection on the walls help some particles make it to the outlet, a small increase from 4% to 8%.

Submitted by 439b41427f9df836a500 7 years ago

Thank you again. It is a 2D simluation, but I believe I am calculating the distribution incorrectly per the paper you shared. However when I changed from cos(theta) to sind(2*theta), my results don't change. Here is how I'm building the distribution.

If you don't mind taking a look, here is how I'm building the distribution.

thmax = 90; %maximum angle
cospower = 0.1; 
N = 10000; % number of data points in distribution
th = linspace(-thmax,thmax,N); %theta matrix
dth = th(2) - th(1); %step size
f = sind(2*th).^cospower; %distribution (changed from cosd(th) )
fcum = cumsum(f.*dth)/sum(f.*dth); %normalized distribution
thrand = myinterp1(fcum,th,rand(N,1)); %personalized interp function to pick values from fcum