|
[Sponsors] |
November 15, 2011, 04:38 |
0 Folder for a dsmcFoam simulation
|
#1 |
New Member
Jesús González Serrano
Join Date: Nov 2011
Posts: 8
Rep Power: 15 |
Hi, I'm new in using the dsmc solver and I#m having the problem with the definition of the 0 folder because I don't know the exact meaning of the properties that you are defininig:
boundaryT (temperature) boundaryU (velocity) dsmcRhoN (numberdensity??) dsmcRhoM (mass density??) fD (Pressure??) iDof (???) internalE internalKE momentum q rhoM (Why these rhoM and rhoN when you have already defined dsmcRhoN and RhonM?) rhoN Is it really necessary to define all of them? I would appreciate If someone could clarify my doubts and recommend me a tutorial, paper, link, book or whatever that could help me to understand this solver. |
|
November 21, 2011, 14:59 |
|
#2 | |
New Member
Thanasis
Join Date: Mar 2010
Location: Greece
Posts: 9
Rep Power: 16 |
Quote:
Last edited by thanz; November 22, 2011 at 13:32. Reason: mistyping |
||
November 22, 2011, 03:36 |
|
#3 |
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36 |
You find a description of the fields in the documentation of the DsmcCloud class:
http://foam.sourceforge.net/docs/cpp/a00438.html To clarify your confusion about rhoN and dsmcRhoN, notice that rhoN is the number density (the actual one), while dsmcRhoN is the number density of the DSMC particles. Best,
__________________
Alberto Passalacqua GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM - An open-source implementation of quadrature-based moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. |
|
December 1, 2011, 15:02 |
|
#4 |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
You have to define boundaryU and boundaryT according to the corresponding patch Maxwellian distribution properties.
The rest of them may be set to zeroGradient for all patches except symmetryPlanes and empty (it does not make a difference in the simulation). |
|
February 6, 2012, 04:30 |
|
#5 |
New Member
Jesús González Serrano
Join Date: Nov 2011
Posts: 8
Rep Power: 15 |
Thank you all for your answers, definitely it is totally recommendable and form my point of view necessary to read Bird's book and the whole C++ code to understand the operation of this solver
|
|
February 20, 2012, 12:22 |
|
#6 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Hi all,
I'm also starting to use the dsmcFoam solver for my OpenFOAM simulations and to get more familiar with the solver, I set up an easy case: 2-D rectangle (1x10 mm) with simple Grading 10x100 cells; inlet and outlet on the short sides and all other sides set as walls. The number density is set to 2.6867774x10^25 for ambient conditions. For an average of 6 dsmcParticles in each cell, the nEquivalentParticles in the dsmcProperties was set to 4.47796x10^12. deltat was set to 10^-7 s to ensure that the gas molecules stayed approximately 3 iteration steps in one cell (assuming a molecule velocity of the speed of sound). boundaryT was set to 300 K and the velocity at the inlet to 50 m/s. All other files in the 0-folder were set to the appropriate values (zeroGradient for patches and calculated with value of 0 for the walls). The calculated dsmcParticles and their movement as well as the pressure change with time look fine to me but I have had some difficulties understanding the other calculated values. 1. What is the difference between overallT, translationalT and internalT? Are they different temperature values or can they be used to calculate the temperature (units being kg*m^2/s^2 instead of K)? 2. I noticed that the boundary velocity at the inlet seems to be only 25 m/s even though it should be 50 m/s (same thing happens to boundaryT, e.g. when I set it to 700 K, paraView shows only 550 K). Additionally, the calculated velocity is unreasonable where it is 8 m/s within the first cell, then a step to 0 m/s which stays constant within the rectangle until the outlet where it goes back to 8 m/s. Does anybody see where the problem(s) may be? Thank you very much for the help |
|
February 20, 2012, 13:05 |
|
#7 |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
A few things to get you started.
The units you wrote (kg*m^2/s^2) correspond to energy. Maybe you mixed internalT with internalE? These temperatures are calculated in dsmcFields.C (http://foam.sourceforge.net/docs/cpp/a07456_source.html) in lines 168-208. With a little patience, you can see their definition and verify that their units are indeed Kelvin. Keep in mind that many quantities (such as iDofMean, linearKEMean, etc) are naturally defined per unit of volume. How did you define your inlet and outlet conditions? In the default version of dsmcFoam you can only give a number density for all open boundary surfaces (unless they worked on that in 2.1, I didn't check that but I doubt it). See the following: http://www.cfd-online.com/Forums/ope...am-solver.html http://www.cfd-online.com/Forums/ope...am-vacuum.html When you say that you have incorrect velocities and temperatures in ParaFoam, are you visualising boundaryT and boundaryU or overallT and overallU? Because the first ones are not very meaningful, they only serve as boundary conditions and their inner field is not calculated. |
|
February 21, 2012, 11:22 |
|
#8 |
New Member
Jesús González Serrano
Join Date: Nov 2011
Posts: 8
Rep Power: 15 |
The unit of overallT, translationalT and internalT is K, as anon_a said, you can check it in the C++ code.
You can see the definition of these temperatures, for example, in the first chapter (page 14) of Bird's book: Molecular Gas Dynamics and the Direct Simulation of Gas Flows (Oxford Engineering Science Series. The translationalT is calculated from the velocities of a set of molecules. The internalT is calculated taking in account the vibrational and rotational energy of the molecules (so its value is zero for a monoatomic gas). The overallT is defined as a weighted mean (taking in account the internal degrees of freedom) of the other two. |
|
February 22, 2012, 07:45 |
|
#9 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Thank you very much for your answers! I’m not so familiar with C++ so I only looked in the calculated files for a specific time step (e.g. internalT). Here, the dimension is [1 2 -2 0 0 0 0], which confused me a bit (expected [0 0 0 1 0 0 0]). Is that always the case with temperatures (dimensions and actually calculated units are not the same) or is there something wrong with my case? Due to your comment I checked the dimensions of internalE, which would be [1 -1 -2 0 0 0 0], thus energy per volume? Seems like I have to learn a bit more about C++…
Do you mean the inlet and outlet conditions in the 0-folder? They are defined as patches in the blockMesh-file with these parameters in the 0-folder: boundaryT=300 K and boundaryU=(0 0 50) m/s and boundaryU=(0 0 0) for the inlet and outlet, respectively. Everything else is set to zeroGradient. The overallU and overallT seem unreasonable. At the inlet, where there should be a velocity close to the boundary conditions (+50 m/s; shown boundaryU is +25 m/s) a value for UMean_z of -8 m/s is calculated (the opposite for the outlet: a velocity of +8). Within the geometry, the velocity is 0 after a while. The calculated parameters of the tutorial case “freeSpaceStream” look strange to me, too. boundaryT is set to 700 K but overallT does only reach about 500. And shouldn’t the whole cube reach a constant temperature around 700 K after a while (all other boundaryT conditions are set to walls with zeroGradient). Thanks a lot and regards |
|
February 22, 2012, 10:39 |
|
#10 | ||||
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
First off, sorry for not checking out the temperature files first but I was not in my PC. Second, to be honest, I am not exactly a C++ master myself too but it is worth investing time on the code.
Quote:
Quote:
Quote:
Even if you change the patch inflow properties, you will not get exactly what you prescribe at these boundaries. On a boundary patch for example, the macroscopic quantities are calculated using the molecular properties of particles crossing the patch both ways and you can not be sure (in fact it rarely happens) that molecules moving in opposite directions have the properties you want. Also, their distribution is probably not Maxwellian. It is very common to include a part of the upstream and downstream reservoirs in the computational domain (see e.g. http://www.sciencedirect.com/science...2037961000253X) to solve this problem (but be warned that the computational effort is increased). Also, the fields may be lost in noise if you have very slow flows and very low Kn. Quote:
I hope these help. |
|||||
February 27, 2012, 05:07 |
|
#11 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Hey everybody,
First of all, thanks a lot for the explanations, anon_a and Jesgonse. I’ve done some simulations over the weekend and the results look much better now (used a reservoir at the outlet). Sorry about the freeSpaceStream tutorial. I mixed something up there with the temperatures. Another case that I am running right now is about heat transfer. The geometry is a simple 2-D rectangle with walls on all sides. boundaryT is 700 K on one side, internalT is 300 K and all other sides have “zeroGradient” as boundaryT. All other parameters in the 0-folder are set to “zeroGradient” and InflowBoundaryModel is “none” due to the absence of patches. This way the whole rectangle should heat up to a constant temperature after some time, right? Unfortunately, the rectangle does not heat up. Only in a very small region close to the heated wall does the overallT reach an increased temperature (about 500 K) but stays at about 300 K everywhere else. For me, it seems like the heat transfer between the wall and the molecules or between the molecules themselves somehow do not work. BinaryCollisionModel is set to “LarsenBorgnakkeVariableHardSphere” and WallInteractionModel to “MaxwellianThermal”. Does anybody have an idea what’s wrong with my case? Thanks in advance. |
|
February 27, 2012, 10:06 |
|
#12 | |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
Quote:
internalField: This is an entry existing in all quantities. It is the non-boundary value of each quantity, the internal field as the name says. Normally, if you wanted to impose a temperature in the internal field you would change this value in the file T. But dsmcFoam is an exception. boundaryT: The temperature of the boundary, according to which the boundary Maxwellian is produced. The value given in the "internalField" of this file has no meaning, it is not used anywhere, only the boundary terms make sense. internalT: This is the part of the temperature associated with internal energy. It is not used for the initial generation of the field. initial conditions: These are imposed through the system/dsmcInitialiseDict. This is your initial distribution of particles. Also, there might be a problem in using zeroGradient for boundaryT in DSMC. Please check that everything is in order and we'll talk again. |
||
February 28, 2012, 12:09 |
|
#13 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Hey anon_a,
I just checked all of the temperature settings and they are as follows: In the 0-folder, for boundaryT: one wall is set at 700 K, all other wall are at 300 K. The internalField in this file is set to 300 K but as you said, it has no meaning/is not used. In the constant-folder, for dsmcProperties: Tref of the BinaryCollisionModel is 273 (although I don’t know the meaning of this value) In the system-folder, for dsmcInitialiseDict: temperature is set as 300K. Other than these, I didn't find anything else with regard to temperature settings. Did I perhaps miss any, for example where can I find internalT? internalField is also not present in the dsmc solver (except of course in the boundaryT file)? Is there a way to check if zeroGradient is working properly for boundaryT or can I simply use another condition for my case? Thank you very much |
|
February 28, 2012, 14:53 |
|
#14 |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
How small is this affected area? can you post some pictures?
If it is extremely small, I would bet money that you have used specular boundary conditions in constant/dsmcProperties, especially since you started with the freeSpacePeriodic tutorial. Check for this line: WallInteractionModel SpecularReflection; and change it to WallInteractionModel MaxwellianThermal; Also study a little on the literature for the kinetic boundary conditions. Regarding Tref, take a look at Appendix A in Bird's book. Just forget about setting InternalT, you don't need to do that. InternalT comes as a result, it is not a prerequisite. I have only tried to use zeroGradient as a BC for boundaryT a long time ago and I remember it gave me an error (didn't it give you an error?). But it also makes sense: when zeroGradient is used, the boundary value is obtained using values from the internal field (which is meaningless for this file). Therefore, it would produce erroneous results. |
|
March 2, 2012, 06:32 |
|
#15 |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
I just noticed that you had mentioned using Maxwellian BCs (yes, 3 days after my post).
Sorry about that! It's a good thing noone called my bet :-) Did you have any progress after all? |
|
March 2, 2012, 11:00 |
|
#16 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Hey anon_a,
I did some more simulations with your comments in mind. The cell size is 0.01 mm^2 (see picture) where the inlet, outlet, and sides are defined as walls and boundaryT at the inlet is set to 700 K and dsmcInitialiseT is 300 K. After applying “MaxwellianThermal”(see 1st picture), the temperature near the inlet gets close to the “boundaryT”, but the rest of the rectangle does not heat up. For me, it looks like the molecules at the inlet receive thermal energy from the boundary (as they were initialized at only 300 K) but somehow do not transfer the thermal energy to the rest of the geometry. This might make sense because as I understand, the molecules do not get reflected from the wall when “MaxwellianThermal” is used since this condition is usually for very small geometries/low pressures. Or the “boundaryU” condition (set to “zeroGradient”) could be wrong? Or even the particle-particle interaction (“LarsenBorgnakkeVariableHardSphere” with “Tref” set at 273 K and “relaxationCollisionNumber” at 5.0) could be wrong (see 2nd picture)? In these centerline “overallT” profiles along the length of the rectangle, one can see that initially there is quite a bit of variation in the temperature within the geometry but after some time it reaches equilibrium around 300 K. For comparison, I applied “SpecularReflection”, but there is no interaction with the heated wall at all (remains at 300 K near the inlet). It looks like the molecules are reflected without absorbing any thermal energy. I would also like to try the “MixedDiffuseSpecular” condition for my case but I don’t know the syntax. It requires a fraction of Maxwell and reflection, otherwise I get an error. Does anybody know how to use “MixedDiffuseSpecular”? Also trying to get a copy of Bird’s book, but have not been successful as of yet. Thank you and have a nice weekend |
|
March 2, 2012, 11:53 |
|
#17 |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
Hmmm... it seems that your field is almost not influenced at all by your wall (observe that only the first cell is practically warm). What is your Kn number? If it is too high, then a large temperature jump is justified on the wall. I would run the same simulation for Kn = 0.1, 1, 10 and observe the differences. You can control Kn by adjusting the number density, but make sure you also keep the same number of particles (by adjusting nEquivalentParticles).
Also, I would use fixedValue BCs in the boundaryT and boundaryU files and then, after being sure about my results, I would try zeroGradient (but, again, I seriously doubt that zeroGradient works the correct way). The "variations" (a.k.a. fluctuations) you observe are due to the statistical noise and are to be expected in DSMC. There is nothing wrong with the models. In order to correct this, you usually average over a lot of time steps in steady state problems (this is what you currently do in overallT, even without knowing it :-) that's why the field is smoother at step 125 than at step 1). The results regarding specular reflection are, off course, natural. MixedDiffuseSpecular is practically a combination of MaxwellianThermal and SpecularReflection and its syntax should be something like: type MixedDiffuseSpecular; value uniform 300; diffuseFraction 0.9; (I did not confirm this before writing). diffuseFraction represents the percentage of molecules interacting diffusely with the wall, while the rest behave specularly. By the way, what is the purpose of the study? Have a nice weekend |
|
March 6, 2012, 07:33 |
|
#18 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Hey anon_a,
Thank you very much for your help. I will run a few simulations with different Kn numbers and boundary conditions. As soon as I have any results, I will get back to you. The future goal will be to simulate gas flows thru nano-porous layers. I have not worked with the dsmc solver before, so I wanted to start with a quite easy case to get familiar with the parameters. Regards |
|
March 14, 2012, 07:58 |
|
#19 |
New Member
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15 |
Hey,
I have run one case with Kn 0.1 and one with Kn 1, where all other conditions were kept the same, such as wall interaction model (Maxwell), collision model (VariableHardSphere) and number of dsmcParticles per cell (4 in average). boundaryT was set to fixedValue as was suggested (or did you mean all boundary conditions should not be zeroGradient?) but there still seems to be no heat transfer from the wall to the rest of the geometry. Right now, I’m running two more simulations: one with Kn 10 and one with Kn 0.1 and the MixedDiffuseSpecular wall interaction model. Hopefully, the results will be better this time with the syntax (thanks for your help, anon_a): WallInteractionModel MixedDiffuseSpecular; MixedDiffuseSpecularCoeffs { value uniform 300; diffuseFraction 0.9; } In the meantime, a new question came up. Is there an easy way to calculate partial pressures, concentrations of a specific gas, or plot moving molecules? A similar question was already posted some time ago (http://www.cfd-online.com/Forums/ope...-dsmcfoam.html) and partial pressures have also been discussed for fluent (http://www.cfd-online.com/Forums/flu...re-oxygen.html). Does anybody know how this works with dsmcFoam? I would like to set a different gas composition at the boundary as compare to within the geometry in order to simulate the diffusion of different gas species within the structure. For me, it sounds like the positions of molecules are stored in each time step at lagrangian/dsmc/positions (fits to number of dsmcParticles) and their type in the same folder in typeld (e.g. 0 for N2 and 1 for O2). Thank you very much |
|
March 14, 2012, 08:41 |
|
#20 |
Disabled
Join Date: Mar 2011
Posts: 174
Rep Power: 15 |
Could you please post your case here? I am getting very curious about what's going on and can not help you any further otherwise. The mixed boundary condition will not provide anything different since you add specular interaction and this should make things worse.
I have not been really involved with mixtures, so I can not help you with the partial pressures. The particles are indeed stored where you mention. In order to visualize them in with the paraFoam script, activate dsmc in the Mesh parts and your quantity of interest in the Lagrangian fields. |
|
Tags |
boundary conditions, dsmcfoam, initial conditions, openfoam dsmcfoam dsmc |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Why my simulation not agree with the wind tunnel experiment | zhaowei | CFX | 4 | July 11, 2015 04:36 |
Solar Radiation in OpenFOAM | plainstyle | OpenFOAM Running, Solving & CFD | 15 | July 8, 2014 05:43 |
Simulation of a complex wing in solidworks flow simulation | niels1900 | FloEFD, FloWorks & FloTHERM | 6 | April 20, 2011 11:44 |
Continuous vs interrupted simulation | sega | OpenFOAM Running, Solving & CFD | 4 | November 3, 2008 15:29 |
strange simulation error | Ralf Schmidt | FLUENT | 2 | May 4, 2007 14:02 |