CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   DSMC errors at inflow and outflow boundary (https://www.cfd-online.com/Forums/openfoam/112898-dsmc-errors-inflow-outflow-boundary.html)

 wenjie February 7, 2013 06:55

DSMC errors at inflow and outflow boundary

2 Attachment(s)
Hello,

I am a new user on dsmcFoam and trying to simulate a very basic case: a shpere in a confined microfluid in 3D in order to compute the drag coefficient.

case parameters:
0.1 atm, 293 K air with free stream velocity 20m/s. shpere diameter: 1e-6 m with an outer rectangular domain with width 6e-6 m, length 6e-6.

B.C.
0.1 atm, 293 K air for the free stream (corresponding molecular number density), Velocity: fixed value of 20m/s at inflow and outflow. symmetry plane for surrounding walls. fixed value of 0 on the surface of sphere.
Temperature:　293 K everywhere

control parameter:

meanfreepath based on VHR model is 2.2e-7 therefore the maximum grid size is chosen to be 2e-7, mean molecular thermal velocity is 450m/s, so the time step is set: 5e-11 = 0.1 (2.2e-7 / 450) which I think is small enough.

The simulation is run until T= 1.05e-6 which means the flow already passed more than 3 times of the domain length.

I attached the results.

Here are my quesitons:

1. why there is a thin layer of different velocity at the inflow and outflow? (lower at the inflow and higher at the outflow) It is physically not true, so I am wondering what set up of my case could cause this problem.

2. the velocity profile seems reasonable despite the strange phenomena mentioned above (about 20 at boundary to about 0 at the surface) but with significant fluctuation. So how longer time should I run it to get a smooth average value?

I would appreciate any relevant help!!

 wenjie February 12, 2013 04:58

Nobody is working on DSMC? Please help me with any possible guess...

 j3r February 13, 2013 22:38

hey wenjie,
in the two files you posted, where is the inlet and outlet? y=+-3e-6?

some thinks you should keep in mind:
- you are right, the max. grid size should be smaller than the mean free path. however, they should not get too small either as you must have at least 5-10 dsmc-particles in each cell. so i would check dsmcRohN
- the inlet and outlet conditions are not only defined by U and T but also the difference in number densities (i.e. in dsmcProperties and dsmcInitilizeDict).
- the fluctuations might also be caused by the number of dsmc particles per cell (i.e. if you have only 2 in one cell the statistic noise for the average U is quite high). otherwise, too large cells might be the reason but again, you should check dsmcRohN. if you have not enough dsmc particles just decrease nEquivalentParticles in dsmcProperties (however, this will increase the computation costs)
- even though your time steps are small enough i would try to further reduce them. this will increase computation costs but might avoid artifacts at the open boundary.

also, i would try to run the same case twice and compare the results. in my case i had some difficulties with the random number generator and the results were always exactly the same. if your results are slightly different, you can take averages to decrease the fluctuation.

cheers,
j3r

 wenjie February 17, 2013 15:01

1 Attachment(s)
Hi J3r,

Thanks for the comments. The inlet and outlet are x= -3e-6 and x=3e-6, which means the flow is coming from the left to the right in the first figure. There are strange thin layers of different velocity both at the inlet and outlet.

- you are right, the max. grid size should be smaller than the mean free path. however, they should not get too small either as you must have at least 5-10 dsmc-particles in each cell. so i would check dsmcRohN

I have checked the dsmcRohn, the minimum number is 9 and maximum is 247, because I have a refined mesh(smaller grid size) around the sphere, so there it appears the low values.

- the inlet and outlet conditions are not only defined by U and T but also the difference in number densities (i.e. in dsmcProperties and dsmcInitilizeDict).

Yes, that's true. But in dsmcfoam I can only define the number density through the "FreeStreamCoeffis" in the constant/dsmcProperties for the inlet and outlet, isn't it? As far as I know, the dsmcRhoN in the 0/ folder doesn't really work(the solver doesn't read in it when solving). Also, the main Idea of this simulation is to estimate the drag coefficient of the sphere in a confined microflow with a certain flow velocity. How do I know the pressure(number density) at the outlet in advance before the simulation and set it as the boundary condition? Or can I set zeroGradient like in the continuum CFD?

- even though your time steps are small enough i would try to further reduce them. this will increase computation costs but might avoid artifacts at the open boundary.

Could you please be more specific on this?　What is the criteria for the time setp and why a smaller one could avoid the artifacts at the open boundary?

Thanks again.

Wenjie

 wenjie February 20, 2013 15:48

injection of particles at the inflow boundary

1 Attachment(s)
I think I have figured out the inflow/olutflow thin layer problem. Thanks to the replys and messages, I have modified the tutorial case 'wedge...' using a 10 time smaller length scales(nequavalent as well).

Attached is what I found. It now makes it quite clear that the particles are injected into the domain in pulses and the velocity is averaged based on each cell.

 j3r February 21, 2013 00:27

Hi,

As far as I know (use a different case myself, so not an expert on this) the problem with dsmcFoam to simulate flow is that you can only set one number density (i.e. pressure) at all patches. Thus, in your case you have the same pressure at the inlet and outlet. But as you said, you will probably have a lower pressure and thus number density at the outlet than the inlet (i.e. pressure drop due to drag force between your gas an the walls/sphere). There are already a couple of thread that discuss this issue, i.e.:

http://www.cfd-online.com/Forums/ope...smcfoam-2.html

http://www.cfd-online.com/Forums/ope...am-vacuum.html

http://www.cfd-online.com/Forums/ope...-download.html

Regarding the time step dependance I'm not so confident but have the following theory:

Lets say you have 1000 molecules within the first cell. In one iteration step 100 move to the next cell or are deleted as they cross the open boundary. Now you initialize 100 new molecules right at the open boundary with a velocity determined by some Maxwell distribution. However, all of your molecules only move in one direction, i.e. into the first cell. This changes our average velocity within your first cell and in this direction (thus Ux in your case; similar for the outlet). If you decrease your time steps less dsmc particles are initialized in each step and this effect is less pronounced.

Regarding the pulses:
I have seen something similar before but still could not figure out where it is coming from or how to avoid it.

Cheers,
j3r

 All times are GMT -4. The time now is 17:03.