hystrath / hyStrath

Hypersonic / Rarefied gas dynamics code developments (GPL-3.0)
https://hystrath.github.io/
GNU General Public License v3.0
219 stars 109 forks source link

How to impose vacuum BCs in dsmcFoam+ #107

Open hamidmoezzi1988 opened 1 year ago

hamidmoezzi1988 commented 1 year ago

Hello all,

I was wondering how I can impose vacuum boundary condition. I tried to use 0 for the outlet pressure in dsmcLiouFangPressureOutletSpecifiedMolarFraction BC, but it results in FPE error. I read a thesis that they had imposed a very low temperature at the boundary to simulate vacuum condition. My second question is that the pressure we specify as the outlet pressure is the absolute pressure? I mean, if I want my outlet pressure to be atmospheric, should I enter 101325 Pa as the outlet pressure in outlet BCs considered in dsmcFoam+?

Any clarification and help would be highly appreciated.

Thank you for your time. Best regards. Hamid

timteichmann commented 1 year ago

Short answer to the first question: boundaryModel dsmcDeletionPatch; (see e.g. hypersonicCorner flow)

I suggest you take a deeper dive into the DSMC method, your understanding of the boundary conditions is very "continuum"-like. The above will delete all impinging particles, which is equivalent to a perfect vacuum pump. It will however not lead to the pressure being zero at the specified interface. It is more comparable to the zeroGradient boundary condition in continuum simulations. Basically the flow passes it unhindered.

To the second question: In DSMC you cannot specify a pressure directly; it will establish based on the boundary conditions and your system (particle in- and outflow). What you specify is usually a flow rate through a surface (the inflow part). Because you usually have no direct control over the outflow part (which is highly dependent on the geometry and temperatures) it is hard to specify a certain pressure - this is more pronounced in subsonic flows than in supersonic ones. Advanced boundary conditions like the Liou Fang model (see their paper for more info) aim to remedy this be by adapting the inflow iteratively during the simulation to match a user-defined pressure at the interface.

I hope this pointed you in the right direction.

hamidmoezzi1988 commented 1 year ago

Short answer to the first question: boundaryModel dsmcDeletionPatch; (see e.g. hypersonicCorner flow)

I suggest you take a deeper dive into the DSMC method, your understanding of the boundary conditions is very "continuum"-like. The above will delete all impinging particles, which is equivalent to a perfect vacuum pump. It will however not lead to the pressure being zero at the specified interface. It is more comparable to the zeroGradient boundary condition in continuum simulations. Basically the flow passes it unhindered.

To the second question: In DSMC you cannot specify a pressure directly; it will establish based on the boundary conditions and your system (particle in- and outflow). What you specify is usually a flow rate through a surface (the inflow part). Because you usually have no direct control over the outflow part (which is highly dependent on the geometry and temperatures) it is hard to specify a certain pressure - this is more pronounced in subsonic flows than in supersonic ones. Advanced boundary conditions like the Liou Fang model (see their paper for more info) aim to remedy this be by adapting the inflow iteratively during the simulation to match a user-defined pressure at the interface.

I hope this pointed you in the right direction.

Hi Tim, Thank you very much for your clarification. I'm new to DSMC, so as you mentioned my view to DSMC BCs is like as CFD! About the dsmcDeletionPatch, I saw in tutorials of dsmcFoam+ that it is also used for the inlet when we use for example inflow velocity patch. So, if dsmcDeletionPatch provides a vacuum condition, then why we use it also for the velocity inlet BCs? What comes into my mind is that, in this way, if there is a back flow then the particles are deleted!

Once again, thank you for your time and support. Kind regards, Hamid

timteichmann commented 1 year ago

In DSMC the concept of open boundaries (both inlet and outlet) is a bit different. You always have to specify two things:

Again you have to think in terms of kinetic theory, not continuum. On the particle level particles fly all over the place, this means they will enter at the inlet - but also leave there. This is why you always have to specify both models for open boundaries.

hamidmoezzi1988 commented 1 year ago

In DSMC the concept of open boundaries (both inlet and outlet) is a bit different. You always have to specify two things:

  • Do particles come in? If yes with what distribution function? Often we assume a Maxwellian at given temperature and number density here, sometimes shifted by a macroscopic bulk velocity.
  • How do particles interact with the boundary when they hit it (from the inside of your flow volume). For the inlet boundary they are typically deleted.

Again you have to think in terms of kinetic theory, not continuum. On the particle level particles fly all over the place, this means they will enter at the inlet - but also leave there. This is why you always have to specify both models for open boundaries.

Hi Tim,

Thank you so much for your explanation. Now, I understand better how these BCs work in DSMC.

I didn't want to open a new issue, so if you don't mind, I ask my another question regarding the BCs here. I have a simulation in which argon with atmospheric pressure and around 4000-5000 K temp. enters a cylinders and then passes through a nozzle toward the outlet. My simulation is axisymmetric and I simulated it successfully with velocityInflowPatch for the inlet and dsmcDeletionPatch for the outlet. The walls are diffuseWallPatch with 1500K. Since in my ongoing simulations the velocity of the incoming gas is unknown, but the pressure is not, I want to consider dsmcWangPressureInlet instead of velocity inlet. However, when I run the simulation with pressure inlet BC, after some timesteps, suddenly in one time step, the number of dsmc particles and average linear kinetic energy increase drastically up to ~15 times and then drop down to ~10 times their initial values. I tried both dsmcDeletionPatch and LiouFangOutletPressure for the outlet along with the dsmcWangPresureInlet, but nothing changed. I also changed the mesh and initial number of particles, but again the same problem happens.

I would really appreciate any advice in this regard. Thank you for your time and continued support. Best regards, Hamid

vincentcasseau commented 1 year ago

Hi Hamid, You said that the outlet pressure you want to prescribe is the sea-level atmospheric pressure. Why would you want to use the DSMC method in these conditions? What is your mean free path? Thanks, Vincent

hamidmoezzi1988 commented 1 year ago

Hi Vincent, Actually the inlet pressure is atmospheric. In my current simulation which is a starting point, the mean free path is 2 micro meters, and the Kn number varies between 0.005 to 0.02 for which CFD is also applicable, however, further downstream the pressure would be something like 6 Pa and the Kn > 0.1, so CFD is not valid anymore and that is why I intend to use DSMC.

Thank you for your attention. Kind regards, Hamid

vincentcasseau commented 1 year ago

Hi Hamid,

I see, thank you. I can't comment on the pressure inlet/outlet BCs you are using, I never used them. It's either a set-up issue or a bug. If you want to investigate this problem, I encourage you to check the original journal articles for these BCs and re-verify the implementation using simple test cases.

Thanks