
[Sponsors] 
June 11, 2013, 04:36 
dscmFoam : nonuniform rhoN (number density) boundary condition

#1 
New Member
Join Date: Jun 2013
Posts: 12
Rep Power: 5 
Hi foamers !
I am new to openFoam, and I need to use dsmcFoam in order to simulate the expansion of a flow in a vacuum. In order to simulate my case, I need a nonuniform BC for RhoN. I have read this validation review : "An open source, parallel DSMC code for rarefied gas flows in arbitrary geometries. / Scanlon, T.J.; Roohi, E.; White, C.; Darbandi, M.; Reese, J.M." In which I have found the following statement : "dsmcFoam straightforwardly handles nonuniform distributions for the inlet conditions of velocity, temperature and number density" However, by studying the source code (freeStream.C), it seems to me that the freestream inflow condition only handles a constant value (per specie) for rhoN. But maybe I am wrong ? Ideally I would like to have a boundaryRhoN file that would act as an input for my case such as boundaryU and boundaryT. Can someone give me a hint on how to do that ? Thanks for your help ! 

June 11, 2013, 05:13 

#2 
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,211
Blog Entries: 1
Rep Power: 17 
for creating a nonuniform BC, you have two options:
1code stream 2groovyBC i recommend second, for ease of use
__________________
Telegram channel (https://telegram.me/openfoam4Iranian) My Weblog (http://openfoam.blogfa.com/) Training Course on OpenFOAM at (http://www.isme.ir/) 

June 12, 2013, 09:02 

#3 
New Member
Join Date: Jun 2013
Posts: 12
Rep Power: 5 
Thanks nimasam, but I don't think this will suit my needs. Perhaps I was not clear enough so I will try to be more specific about my issue.
I want to use the dsmcFoam solver. The principle of the dsmc method is to inject, move, and collide dsmc particles in the domain, where each dsmc particle represent a high number of real particles. Then the macroscopic properties are evaluated by averaging the properties of these particles over the cells of the domain. For this solver, the boundary conditions are not implemented in a classic way like in almost every other solver in OpenFoam. The boundary condition is "used" to inject particles in the domain by the freeStream inflow boundary model (src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream.C) However, this boundary model seems to consider that a FreeStream patch can have a nonuniform Temperature and Velocity (defined in the boundaryT and boundaryU dictionaries in the time directory of a dsmc case), BUT all the Freestream patches must have the same number density of real particles, defined as a constant (for each specie) in the constant/dsmcProperties dictionnary (if my understanding of the code is correct). Code:
src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream.C line 6494 const dictionary& numberDensitiesDict ( this>coeffDict().subDict("numberDensities") ); List<word> molecules(numberDensitiesDict.toc()); // Initialise the particleFluxAccumulators_ particleFluxAccumulators_.setSize(patches_.size()); forAll(patches_, p) { const polyPatch& patch = cloud.mesh().boundaryMesh()[patches_[p]]; particleFluxAccumulators_[p] = List<Field<scalar> > ( molecules.size(), Field<scalar>(patch.size(), 0.0) ); } moleculeTypeIds_.setSize(molecules.size()); numberDensities_.setSize(molecules.size()); forAll(molecules, i) { numberDensities_[i] = readScalar ( numberDensitiesDict.lookup(molecules[i]) ); [...] Code:
constant/dsmcProperties line 4655 InflowBoundaryModel FreeStream; FreeStreamCoeffs { numberDensities { N2 0.777e20; O2 0.223e20; }; } I would like to be able to enter a non uniform number density for one or several inflow patches, in the same way it is done with T and U. It should be possible to modify the source code but my understanding of C++ is fairly low, that is why I am looking for some help. Has anyone suceeded in implementing a non uniform BC for RhoN in a dsmc case ? Any help or advice would be welcome ! Thanks ! 

August 16, 2013, 04:51 

#4 
Member
hekseli
Join Date: Mar 2013
Posts: 47
Rep Power: 5 
Did you solve your problem? I have the same problem at the moment...


August 19, 2013, 04:51 

#5 
New Member
Join Date: Jun 2013
Posts: 12
Rep Power: 5 
I partially solved it. I had to modify the source code in order to define a nonuniform boundary condition for RhoN.
Unfortunately I am not allowed to share this work, but here are the key steps:  Modify DsmcCloud to read an Input file : boundaryRhoN  Create a new stream model, based on freeStream that will use this data  Add this model in the inflow model list in the file "makeInflowBoundaryModels" (in dsmcParcels folder) The best advice I can give you is to spend some time looking at the sources to understand how the solver works, and do this tutorial: openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam I hope it will help. Sylvain 

August 20, 2013, 02:57 

#6 
Member
hekseli
Join Date: Mar 2013
Posts: 47
Rep Power: 5 
Hey!
Thanks for the hints! This far I had not time to consentrate to this, but from now on I'll start. I quickly looked at the source code and started to think about that is it as complicated for U and T to give them as a nonuniform distribution? In Scanlon's article it "seems" to be so easy... My goal is to give a CFDbased result as an initial condition for the dsmcFoam so all the variables will be nonunifom. 

August 20, 2013, 03:41 

#7 
New Member
Join Date: Jun 2013
Posts: 12
Rep Power: 5 
The good news is that it is already implemented for U and T !
You just have to specify a nonuniform scalar list for your boundary in boundaryT and a nonuniform vector list for boundaryU (there are some examples in the tutorials for other solvers) That's why it seems simple in Scanlon's article (but they forgot to mention that it is not possible for RhoN) Sylvain 

August 20, 2013, 13:21 

#8 
Member
hekseli
Join Date: Mar 2013
Posts: 47
Rep Power: 5 
Good tips! Today I have been reading the source code through the whole day and starting to get some insight into it. Before going into number density itself I have a question about the "normal" fields.
I have a complex boundary shape and I have a list of (x,y,z,value) where the coordinates refer to the cell centers in a mesh, thus there is a problem while using the basic nonuniform boundary condition because I don't know the right order of the values in a list (it should be in a same order as blockmesh generates the cells?). According to my knowlegde normal nonuniform boundaries are generated by expressions with swak4foam etc. So basically I think I have to implement this spacediscretized boundary too? Cheers Heikki 

August 21, 2013, 07:41 

#9 
Member
hekseli
Join Date: Mar 2013
Posts: 47
Rep Power: 5 
Velocity and temperature worked out with timeVaryingMappedFixedValue  BC.
Still figuring out the number density. 

August 21, 2013, 12:51 

#10 
New Member
Join Date: Jun 2013
Posts: 12
Rep Power: 5 
I deal with the same boundary condition type. I developped an external "interfacing" routine that extract the faces of the boundary, interpolate the values of the flow on this face, and write theses values in a non uniform list in the boundary files.
It looks like timeVaryingMappedFixedValue  BC does pretty much the same, if it works for your case. 

August 22, 2013, 04:32 

#11 
Member
hekseli
Join Date: Mar 2013
Posts: 47
Rep Power: 5 
Hmm...
I think I still have a problem with the boundaries because now dsmcInitialiseDict still have scalar temperature and one velocity vector so basically simulation will be initialised with one value but on the boundary it has a distribution. There will be an error with determination of the molecules in cell level or something? 

August 22, 2013, 04:58 

#12 
New Member
Join Date: Jun 2013
Posts: 12
Rep Power: 5 
This is a different issue:
dsmcInitialize can only initialise the flow field with a uniform flow. However, you can launch a simulation without initialization. A 0time your domain will be entirely free of molecules but it will fill up as the molecules enter from your boundaries. The only thing to do is give an initial estimate of sigmaTcRMax in your domain, otherwise the collisions will not be computed. 

Tags 
boundary, boundary condition, dsmc, non uniform, openfoam 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
boundary conditions for simpleFoam calculation  foam_noob  OpenFOAM Running, Solving & CFD  8  July 1, 2015 08:07 
Need help with boundary conditions: open to atmosphere  Wolle  OpenFOAM  2  April 11, 2011 07:32 
turbulent jet simulation  antonio_ing  OpenFOAM Running, Solving & CFD  5  September 16, 2010 02:31 
RPM in Wind Turbine  Pankaj  CFX  9  November 23, 2009 05:05 
Convective Heat Transfer  Heat Exchanger  Mark  CFX  6  November 15, 2004 16:55 