0 Folder for a dsmcFoam simulation
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:
dsmcRhoM (mass density??)
rhoM (Why these rhoM and rhoN when you have already defined dsmcRhoN and RhonM?)
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.
You find a description of the fields in the documentation of the DsmcCloud class:
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.
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).
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
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
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
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:
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.
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.
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
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.
Also, the fields may be lost in noise if you have very slow flows and very low Kn.
I hope these help.
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.
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.
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
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:
and change it to
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.
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?
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
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:
value uniform 300;
(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
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.
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):
value uniform 300;
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
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.
|All times are GMT -4. The time now is 11:43.|