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

dscmFoam : non-uniform rhoN (number density) boundary condition

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   June 11, 2013, 04:36
Default dscmFoam : non-uniform rhoN (number density) boundary condition
  #1
New Member
 
Join Date: Jun 2013
Posts: 12
Rep Power: 4
elfuertes is on a distinguished road
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 non-uniform 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 non-uniform 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 !
elfuertes is offline   Reply With Quote

Old   June 11, 2013, 05:13
Default
  #2
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
for creating a non-uniform BC, you have two options:
1-code stream
2-groovyBC

i recommend second, for ease of use
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   June 12, 2013, 09:02
Default
  #3
New Member
 
Join Date: Jun 2013
Posts: 12
Rep Power: 4
elfuertes is on a distinguished road
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 non-uniform 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 64-94
 
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 46-55
 
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 !
elfuertes is offline   Reply With Quote

Old   August 16, 2013, 04:51
Default
  #4
Member
 
hekseli
Join Date: Mar 2013
Posts: 38
Rep Power: 4
heksel8i is on a distinguished road
Did you solve your problem? I have the same problem at the moment...
heksel8i is offline   Reply With Quote

Old   August 19, 2013, 04:51
Default
  #5
New Member
 
Join Date: Jun 2013
Posts: 12
Rep Power: 4
elfuertes is on a distinguished road
I partially solved it. I had to modify the source code in order to define a non-uniform 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
elfuertes is offline   Reply With Quote

Old   August 20, 2013, 02:57
Default
  #6
Member
 
hekseli
Join Date: Mar 2013
Posts: 38
Rep Power: 4
heksel8i is on a distinguished road
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 non-uniform distribution? In Scanlon's article it "seems" to be so easy...

My goal is to give a CFD-based result as an initial condition for the dsmcFoam so all the variables will be non-unifom.
heksel8i is offline   Reply With Quote

Old   August 20, 2013, 03:41
Default
  #7
New Member
 
Join Date: Jun 2013
Posts: 12
Rep Power: 4
elfuertes is on a distinguished road
The good news is that it is already implemented for U and T !
You just have to specify a non-uniform scalar list for your boundary in boundaryT and a non-uniform 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
elfuertes is offline   Reply With Quote

Old   August 20, 2013, 13:21
Default
  #8
Member
 
hekseli
Join Date: Mar 2013
Posts: 38
Rep Power: 4
heksel8i is on a distinguished road
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 space-discretized boundary too?





Cheers Heikki
heksel8i is offline   Reply With Quote

Old   August 21, 2013, 07:41
Default
  #9
Member
 
hekseli
Join Date: Mar 2013
Posts: 38
Rep Power: 4
heksel8i is on a distinguished road
Velocity and temperature worked out with timeVaryingMappedFixedValue - BC.

Still figuring out the number density.
heksel8i is offline   Reply With Quote

Old   August 21, 2013, 12:51
Default
  #10
New Member
 
Join Date: Jun 2013
Posts: 12
Rep Power: 4
elfuertes is on a distinguished road
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.
elfuertes is offline   Reply With Quote

Old   August 22, 2013, 04:32
Default
  #11
Member
 
hekseli
Join Date: Mar 2013
Posts: 38
Rep Power: 4
heksel8i is on a distinguished road
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?
heksel8i is offline   Reply With Quote

Old   August 22, 2013, 04:58
Default
  #12
New Member
 
Join Date: Jun 2013
Posts: 12
Rep Power: 4
elfuertes is on a distinguished road
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 0-time 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.
elfuertes is offline   Reply With Quote

Reply

Tags
boundary, boundary condition, dsmc, non uniform, openfoam

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 23:21.