dscmFoam : nonuniform rhoN (number density) boundary condition
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. :confused: 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 ! 
for creating a nonuniform BC, you have two options:
1code stream 2groovyBC i recommend second, for ease of use 
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 Code:
constant/dsmcProperties line 4655 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 ! 
Did you solve your problem? I have the same problem at the moment...

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 
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. 
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 
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 
Velocity and temperature worked out with timeVaryingMappedFixedValue  BC.
Still figuring out the number density. 
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. 
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? 
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. 
All times are GMT 4. The time now is 19:50. 