CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

0 Folder for a dsmcFoam simulation

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2012, 06:10
Default
  #21
New Member
 
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15
dpham is on a distinguished road
Hey anon_a,


Sorry for my late reply, I was on vacation last week.


I’m trying to simulate a closed box, where one of the walls is heated. After some time, the entire box should reach a constant temperature (the same as the heated wall) due to heat accumulation. The case I used so far was a box (all sides set to “wall”) of 0.5mm x 0.1mm x 1 mm with ambient conditions (300 K and 1 atm) inside while the bottom of the box was set to 700 K. Similar to the images previously posted, the temperature inside the box does not seem to change at all and I don’t know why.


By the way, thanks a lot for your suggestion with paraView. It works fine: set Mesh part to “dsmc” to visualize the dsmc particle and colored them by the Lagrangian Field “typeld” to see their type (e.g. N2 or O2).


I am still working on the partial pressures/number densities. Does anybody know what “iDof” is? In the readme it is mentioned that” iDof” is the number density of extensive quantities, this could be used to calculate the concentrations of a species, right? Unfortunately, “iDof” shows higher numbers than “rhoN”, which makes no sense to me.


Thanks a lot and cheers,
dpham is offline   Reply With Quote

Old   April 2, 2012, 03:12
Default
  #22
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
Hello again.

What I meant by "please post your case" is "could you please make a zip with your case directory and attach it here?". I will then take a look and let you know if I find something unusual.
anon_a is offline   Reply With Quote

Old   April 2, 2012, 06:06
Default
  #23
New Member
 
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15
dpham is on a distinguished road
Dear anon_a,


You can download the case I’m working on from the following link:


http://dl.dropbox.com/u/14930252/HeatKn0.1.zip



It is just a simple closed case (all sides are walls) in 2-D geometry with one heated side. As described earlier, the temperature does not increase over time. Hope you can find the problem.


Cheers
dpham is offline   Reply With Quote

Old   April 2, 2012, 12:27
Default
  #24
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
I would do the following:
(1) You need more particles per cell for a better accuracy, at least 10. Thus, I would increase the particles to 5000.
(2) Your Knudsen is definitely incorrect. The number of collisions is HUGE for this amount of particles (and that is the reason it is so sloooow). Therefore, I would go back to something simpler, i.e. single gas, before doing this. Which reference length do you use for your Knudsen? I would use the smallest dimension. If the collisions are not so many, you wouldn't even need to run it in parallel.
(3) Your geometry is not in the order of mm. Check the convertToMeters parameter
(4) Is your box really like that or are you trying to make something 2D? Just asking, because the long aspect ratio, checking if you know about "empty" boundary conditions.

You really need to check (2) and (3) with a single gas.
anon_a is offline   Reply With Quote

Old   April 9, 2012, 16:28
Default
  #25
New Member
 
Join Date: Sep 2011
Location: Bremen, Germany
Posts: 13
Rep Power: 15
dpham is on a distinguished road
Dear anon_a,


Thank you very much for your suggestions.


The number density I used in dsmcInitialiseDict is 1.836E+25, so the mean free path is 100nm. The smallest distance is 1000nm (thickness of the block), so the Knudsen number should be 0.1. Or is there an error in my reasoning?


I actually want to simulate a 3D case but used a 2D case to start with. Actually, I don’t know what an “empty” boundary condition is for or what it does?


Just started a new simulation with the same geometry but higher number of dsmc particles (45899 overall, thus in average 11.5 per cell) as you suggested, 3D (grading of 2 for the thickness), and only a single gas specimen but still, the temperature seems to stay constant.


Really no idea where the problem is…


Do you have a similar case where the heat transfer works?


Happy Easter
dpham is offline   Reply With Quote

Old   April 9, 2012, 18:41
Default
  #26
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
Quote:
Actually, I don’t know what an “empty” boundary condition is for or what it does?
I would recommend to read the manual and apply the tutorials, even if they do not seem directly related with DSMC. The empty BC makes your simulation 2D. You will find this in the early chapters.


Quote:
The number density I used in dsmcInitialiseDict is 1.836E+25, so the mean free path is 100nm. The smallest distance is 1000nm (thickness of the block), so the Knudsen number should be 0.1. Or is there an error in my reasoning?
Using the hard sphere mean free path definition
lambda = 1 / (sqrt(2) * n * (pi*d^2)) with n=1.836E+25
I get lambda = 7.051E-08 m = 70.5nm, which is close to what you say. Your geometry has indeed 10^(-6)m as the smallest dimension. I just got confused because in
http://www.cfd-online.com/Forums/ope...tml#post352121
you mention that it is in the millimeter (instead of micrometer) range. Furthermore, you have different numbers in that post than in the blockMesh
(0.5x0.1x1 vs. 5x0.1x1). Finally, since you are trying a 2D problem, it does not make sense to use the depth dimension as a reference length since you can adjust it to whatever you want. So, if you chose the 1 micrometer in this case, your Knudsen is around 0.007.


Quote:
Just started a new simulation with the same geometry but higher number of dsmc particles (45899 overall, thus in average 11.5 per cell)
I realized that this number is the one appearing in your dsmcProperties dictionary. You got it wrong: nEquivalentParticles is the number of real molecules that a dsmc particle represents. It is not the expected number of dsmc particles in the simulation. Please make sure you understand the difference and you include this change to your particle number calculations.



I ran a simulation taking into account these remarks for nitrogen at 293.15 and Kn around 0.7 by changing the number density. It was done rather fast, so I apologize if I made a mistake in the process. You can see the results in the attached zip file. I also removed some files to conform to the site attachment size rules but you will see that a temperature distribution is indeed developed near the hot wall. Let me know if there is something you don't understand.

Happy Easter! :-)
Attached Files
File Type: zip HeatKn0.7.zip (75.8 KB, 138 views)
anon_a is offline   Reply With Quote

Old   June 6, 2012, 02:52
Default moleculeProperties in dsmcFoam
  #27
j3r
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 14
j3r is on a distinguished road
Hello everybody,

My question regards the dsmc properties rather than the 0 folder. However, I hope somebody can help me.

In the file dsmcProperties located in the constant folder “moleculeProperties” are defined as:

N2
{
mass 46.5e-27;
diameter 4.17e-10;
internalDegreesOfFreedom 2;
omega 0.74;
}

O2
{
mass 53.12e-27;
diameter 4.07e-10;
internalDegreesOfFreedom 2;
omega 0.77;
}

How does one get to these values? E.g. in the case of N2 the covalent radius is 71 pm, which would lead to a max. diameter of 284 pm=2.84e-10
For a triple bond N atom, the covalent radius is 54 pm resulting in a max. diameter of 2.16e-10 m
As the molecule is not spherical, the other diameter would be even smaller (about half perpendicular to the max. diameter). In any case, I get diameters much smaller than defined in dsmcProperties (similar for O2).

And what is the unit of the mass? It seems like it is not the atomic mass, right (would be something with 28 and 32 for N2 and O2, respectively)?

Cheers and thank you very much,
j3r
j3r is offline   Reply With Quote

Old   June 6, 2012, 03:11
Default
  #28
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
Hi there

Check Bird's book, Appendix A, Tables A1 and A2.
Quoting Bird, they are "reference diameters for the VHS molecular model".

The units are simply kg.
anon_a is offline   Reply With Quote

Old   June 6, 2012, 05:37
Default
  #29
New Member
 
Jesús González Serrano
Join Date: Nov 2011
Posts: 8
Rep Power: 15
Jesgonse is on a distinguished road
Hi,

The reference diameter is calculated using the value of a reference viscosity at a reference temperature. For a variable soft sphere model see the equation 4.62 in Bird's book.
The mass represents the mass of a molecule in kg.
Jesgonse is offline   Reply With Quote

Old   June 6, 2012, 05:43
Default
  #30
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
Quote:
Originally Posted by Jesgonse View Post
Hi,

The reference diameter is calculated using the value of a reference viscosity at a reference temperature. For a variable soft sphere model see the equation 4.62 in Bird's book.
The mass represents the mass of a molecule in kg.
Exactly what I meant but more clearly stated :-)
anon_a is offline   Reply With Quote

Old   June 6, 2012, 05:56
Default
  #31
j3r
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 14
j3r is on a distinguished road
Thank you very much for your fast answers. That makes sense…In that case, there must be some other problem.

Actually, I’m trying to simulate diffusion on the nano-scale. I started with a very simple case (all at ambient conditions):
Cube with 200 nm side length; one face is defined as wall, the opposite side is the inlet and all other ones are cyclic (this condition is defined for dsmc, right?). Initially, there is 100% N2 in the cube and a 20% O2 80% N2 mixture at the inlet. nEquivalentParticles is set to 1 and I’m using the VHS right now.

After the simulation I compered the concentrations at different time steps with the analytical solution. No matter which parameters I chose (different cell size, other collision model, etc.) the analytical solution is always much faster than the dsmc simulation results. That’s why I thought that the molecule diameter might be too big and thus, too many collisions are calculated which seems to be not true.

Any idea what the problem could be?

Thank’s a lot,
j3r
j3r is offline   Reply With Quote

Old   June 6, 2012, 06:26
Default
  #32
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
Some comments and questions:
- If you set up your DSMC case with nEquivalentParticles = 1, then what about using molecular dynamics?
- Time dependent DSMC calculations are supposed to be performed taking a number of realizations with different random seeds and averaging. One realization is usually not accurate enough, unless you take a lot of particles into account. If you don't do that, then you may get the order of magnitude right but some noise will be present. But if your flow is not very violent (as far as I understand, the macroscopic velocity at the inlet is zero and the temperature is also the same as the wall's) then the noise becomes comparable to the solution.
- Have you checked your wall interaction model? Do you use diffuse or specular BCs? (Check WallInteractionModel in dsmcProperties file)
- Could you state your pressure and Knudsen number?
anon_a is offline   Reply With Quote

Old   June 6, 2012, 07:11
Default
  #33
New Member
 
Jesús González Serrano
Join Date: Nov 2011
Posts: 8
Rep Power: 15
Jesgonse is on a distinguished road
As well I wouldn't simulate diffusion of multispecies gases using the VHS model because several reviews of DSMC state that the model cannot represent properly the diffusion coefficient.

See:
Recent Advances and Current Challenges for DSMC. G.A.Bird
http://www.sciencedirect.com/science...9812219700254X

"The VHS model that reproduces the viscosity coefficient does not, however, lead to the correct
diffusion coefficient in a gas mixture"
Jesgonse is offline   Reply With Quote

Old   June 7, 2012, 00:35
Default
  #34
j3r
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 14
j3r is on a distinguished road
anon_a
-So far I only worked with dsmcFoam and never tried another solver. Which one would you suggest for my case, i.e. molecular dynamics?
-I’m using the MaxwellianThermal model right now. However, the wall interaction model should be no problem as the concentration profile looks different from the analytical solution before there are any O2 molecules close to the wall.
-The number density is 2.7e25, thus about 1 atm. The Knudsen number should be about 0.34 applying the distance between the wall and the inlet as representative length.
-Yes, pressure and temperature at the inlet are equal to the initial/internal values and the velocity is set to zero. Right now I simulate a case with bigger dimensions. This way the Knudsen number is decreased, number of molecules is increased and wall interaction model shouldn’t matter. Maybe the simulation results are only different from the analytical solution as they are in the transition regime (will see in a few hours).

Jesgonse:
Do you know if one of the other implemented dsmc collision models is better suited? Or would you also suggest a different OpenFOAM solver for my case?

Thank’s a lot for your help,
j3r
j3r is offline   Reply With Quote

Old   June 7, 2012, 01:50
Default
  #35
Disabled
 
Join Date: Mar 2011
Posts: 174
Rep Power: 15
anon_a is on a distinguished road
-I have not used molecular dynamics in the past (mdFoam is the name of the solver) but as far as I know, the main advantage of DSMC is to reduce the number of particles. If each particle represents a single molecule (and if MD is not much more computationally intensive for the same number of particles) then I see no point in using DSMC.

-I would try to switch to LarsenBorgnakkeVariableHardSphere to take into account other degrees of freedom. But I hardly believe that this will change your solution significantly, Jesgonse's answer about the VHS inaccuracy is probably much more relevant here than setup.

-Would you also mind posting your case here? Just to make sure that nothing else is wrong.
anon_a is offline   Reply With Quote

Old   June 7, 2012, 04:38
Default
  #36
New Member
 
Jesús González Serrano
Join Date: Nov 2011
Posts: 8
Rep Power: 15
Jesgonse is on a distinguished road
I agree with anon_a, as long as you are simulating diatomic gases, internal degrees of freedom must be taken into account, and right now only the LarsenBorgnakkeVariableHardSphere model is avaliable. I have never worked with internal degrees of freedom, so I don't really know that model very well

As an idea I would suggest you to try to program the variable soft sphere model and run the simulation with a mixture of monoatomic gases, the diffusion should be properly represented
Jesgonse is offline   Reply With Quote

Old   July 9, 2012, 07:21
Default
  #37
j3r
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 14
j3r is on a distinguished road
Hey everybody,

Sorry for my late reply. I tried to verify your suggestions and there were some quite time intensive simulations required.

In the attached file you can find an example case as well as an image with my latest results (unfortunately, the upload limit was too low for e.g. pdf).

Summarized, the diffusion simulated with dsmcFoam is always slower than the analytic solution. I tried varying the length and thus Kn-number as well as wall influence, simulated with VHS and LBVHS model, and increased the diameter to avoid difficulties with the cyclic boundary condition (LBVHS_big in the graphs). When I used Ar and He (applied values from Bird’s book for moleculeProperties as well as an article from Taylor and Cain; J. Chern. Phys. 78(10) 1983 for diffusion coefficient for analytic calculation) instead of O2 and N2 to decrease the degrees of freedom, the results looked similar.

Do you see any mistake in the example case or is there an error in reasoning? I could try to vary the relaxationCollisionNumber for the LBVHS model but that seems to be more like fitting until the results look good and I am not sure which numbers are physically reasonable for my case (not sure if it makes much difference either). Do you have any other suggestions? Do you think the earlier suggested soft sphere model will improve the results or is another solver necessary (e.g. the suggested molecular one)?

Thank you very much for your help,
j3r

Example.zip

Uploaded the file once again as some of you had difficulties to open the previous zip-file.

Cheers,
j3r
Attached Files
File Type: zip dsmcFoam_j3r.zip (95.4 KB, 60 views)

Last edited by j3r; July 31, 2012 at 01:46.
j3r is offline   Reply With Quote

Old   July 31, 2012, 01:45
Default Implementing the VSS model
  #38
j3r
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 14
j3r is on a distinguished road
Hello everybody,

I tried to implement the VSS model as you suggested but have same difficulties. Hopefully one of you can help me. First I changed everything at once, the compilation worked fine but the simulations looked strange (number of dsmcParticles changed and only one gas type was generated at the boundary). Thus, I started all over again and checked the simulation after each step:

1) Copy and paste the VHS folder in openfoam/src/lagrangian/dsmc/submodels and rename the copied folder and containing .H/.C files in VSS. Replace “Hard” in the .H/.C files by “Soft”
2) Add the VSS model in the makeDsmcParcelBinaryCollisionModels.C file in the openfoam/src/lagrangian/dsmc/parcels/derived/dsmcParcel/ folder
3) wmake libso in the openfoam/src/lagrangian/basic/ and openfoam/src/lagrangian/dsmc/ folder as well as wmake all in the openfoam/ folder


So far everything works fine and I get no error messages during compilation or running the simulations. Now I tried to implement alpha, which is required for the VSS model (see e.g. Eq. 2.36 in Bird’s book). This has to be defined for each gas type in dsmcProperties in moleculeProperties (see A3 in Bird’s book).

4) Add alpha in DsmcParcel.H and DsmcParcell.H in the openfoam/src/lagrangian/dsmc/parcels/Templates/DsmcParcel folder (just copy/paste all sections with e.g. omega and rename to alpha).
5) wmake libso in the openfoam/src/lagrangian/basic/ and openfoam/src/lagrangian/dsmc/ folder as well as wmake all openfoam/

Again, I don’t see any error messages during compilation. dsmcInitilizes gives an error massage if alpha is not defined under moleculeProperties, which makes sense. However, the simulation doesn’t work correctly any more even though I still apply the VHS model and alpha is not used anywhere. This is what happens:

When I only initialize one gas type and have two different ones at the boundary, only the one that was initialized is generated at the boundary. The number of molecules decreases during the simulation.

When I initialize two different gas types dsmcFoam gives the following floating point exception error message:

Create mesh for time = 0


Constructing dsmcCloud
Selecting BinaryCollisionModel VariableHardSphere
Selecting WallInteractionModel MaxwellianThermal
Selecting InflowBoundaryModel FreeStream

Constructing constant properties for
N2
O2

Starting time loop

Reading/calculating field rhoNMean

Reading/calculating field rhoMMean

Reading/calculating field dsmcRhoNMean

Reading/calculating field momentumMean

Reading/calculating field linearKEMean

Reading/calculating field internalEMean

Reading/calculating field iDofMean

Reading/calculating field qMean

Reading/calculating field fDMean

fieldAverage: starting averaging at time 0

--> FOAM Warning :
From function polyBoundaryMesh:atchSet(const wordReList&, const bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 572
Cannot find any patch names matching obstacle
Time = 1e-12

Particles inserted = 27
#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigFpe::sigHandler(int) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2 in "/lib/libc.so.6"
#3 in "/lib/libm.so.6"
#4 Foam:smcCloud<Foam:smcParcel<Foam:article> >::equipartitionInternalEnergy(double, double) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libdsmc.so"
#5 Foam::MaxwellianThermal<Foam:smcCloud<Foam:smc Parcel<Foam:article> > >::correct(Foam:smcParcel<Foam:article>&, Foam::wallPolyPatch const&) in "/opt/openfoam201/platforms/linux64GccDPOpt/lib/libdsmc.so"
#6
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
#7
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
#8
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
#9
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
#10
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
#11
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
#12 __libc_start_main in "/lib/libc.so.6"
#13
in "/home/dreyer/OpenFOAM/dreyer-2.0.1/platforms/linux64GccDPOpt/bin/dsmcFoam"
Floating point exception

Does anybody have an idea where the problem is? For me it looks like something is wrong with gas type 1 (whichever one is defined as second type) while type 0 works fine. Maybe I overlooked a file in which adjustments are required when the number of moleculeProperties is increased?

Thank you very much for your help,
j3r
j3r is offline   Reply With Quote

Old   September 3, 2012, 06:14
Default
  #39
j3r
New Member
 
Join Date: Jun 2012
Posts: 11
Rep Power: 14
j3r is on a distinguished road
Hello everybody,

I’m still trying to implement the variable soft sphere (VSS) model in dsmcFoam but am stuck with the same problem as described before. Just can’t figure out where the problem is. For me it seems like only changes in DsmcParcel.H and DsmcParcell.H are required or is there any other file I have to modify when I want to add a parameter to molculeProperties? I could imagine that DsmcCloud.C also needs adjustments but my C++ knowledge is too limited.

Any hint would be highly appreciated, I’m really lost here. If you need additional information please let me know.

Thank you so much,
j3r
j3r is offline   Reply With Quote

Old   August 14, 2014, 09:56
Default
  #40
New Member
 
wenjie
Join Date: Dec 2012
Posts: 12
Rep Power: 14
wenjie is on a distinguished road
Quote:
Originally Posted by j3r View Post
Hello everybody,

I’m still trying to implement the variable soft sphere (VSS) model in dsmcFoam but am stuck with the same problem as described before. Just can’t figure out where the problem is. For me it seems like only changes in DsmcParcel.H and DsmcParcell.H are required or is there any other file I have to modify when I want to add a parameter to molculeProperties? I could imagine that DsmcCloud.C also needs adjustments but my C++ knowledge is too limited.

Any hint would be highly appreciated, I’m really lost here. If you need additional information please let me know.

Thank you so much,
j3r
Hi J3r,

I am right now also thinking of implementing VSS in dsmcFoam. Did you finally managed to get it work?

Cheers,
Wenjie
wenjie is offline   Reply With Quote

Reply

Tags
boundary conditions, dsmcfoam, initial conditions, openfoam dsmcfoam dsmc


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 14:55.