CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   dsmcInitialise - dsmcFoam (https://www.cfd-online.com/Forums/openfoam-pre-processing/74917-dsmcinitialise-dsmcfoam.html)

archymedes April 12, 2010 05:30

dsmcInitialise - dsmcFoam
 
Hi there,

I am new at openFoam, just installed 1.6 and try to run a dsmc simulation.
Tutorial examples are running fine.

Now I am attempting my first simulations.
I've set up my geometry in Ansys,
exported it in ascii ( .msh)
ran
Code:

$dos2unix
$fluentMeshToFoam

and took a look at the mesh in paraFoam, looks like everything worked ( is there a way to test if its fine ?)

PROBLEM:
after defining my input files:
in system/
controlDict
dsmcInitialiseDict
fvSchemes
fvSolution
in constant/
dsmcProperties
in 0/
boundaryT
boundaryU
dsmcRhoN
dsmcRhoM
fD
iDof
internalE
internalKE
momentum
q
rhoM
rhoN

I try to initialise the case
Code:

$ dsmcInitialise
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6                                  |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 1.6-53b7f692aa41
Exec  : dsmcInitialise
Date  : Apr 12 2010
Time  : 11:18:40
Host  : BE13661
PID    : 3846
Case  : /media/System/Claus/GasSimu/OpenFoam/valve_outlet_2D
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Initialising dsmc for Time = 0

--> FOAM Warning :
    From function Cloud<ParticleType>::initCloud(const bool checkClass)
    in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.6/src/lagrangian/basic/lnInclude/CloudIO.C at line 51
    Cannot read particle positions file
    "/media/System/Claus/GasSimu/OpenFoam/valve_outlet_2D/0/lagrangian/dsmc"
    assuming the initial cloud contains 0 particles.

Constructing constant properties for
    H2

Initialising particles

Total number of molecules added: 0


ClockTime = 0 s

End

but i get the error that the positions file is missing !!
I cannot define all particle positions manually. how to obtain this file, why is it needed anyway ? it's not in the tutorial cases!

I really appreciate any help!

cheers,
archy

Marta April 15, 2010 05:44

Hi Foamers! I would like to set a simulation with dsmcFoam, but i need to create sources of particles at some of the surfaces of my geometry. Is it possible to do this without modifying the existing code?

How can I do it?

Thank you!

Bye Marta

archymedes April 19, 2010 10:53

create the particles once at the beginning of the simulation ?
thats initialising the simulation done with the command dsmcInitialise which doesn't work for me ( dunno why ).

If you want to have a source that emits particles continously during the simu ( like aporous media ) I don't know how to do that or if it exits.

@Anyone: please help me understand dsmcInitialise and which definitions and files I need to make it work properly.

Thanks,
Archy

Marta April 19, 2010 16:16

Thank you for your answer Archy!
Yes, what i meant is that i need to create/define a source emitting particles continuously or at some specific times. I think there is something available because after writing here i've seen the file pointMassSourceProperties inside the porousExplicitSourceReactingParcelFoam tutorial.

I think i'll try using this kind of a solution.

Bye

Marta

cbarry May 3, 2010 08:48

point source in dsmcFoam
 
Hello Marta,

did you find a way to integrate point sources into dsmcFoam in the end?
I found the dictionary file you mentioned, but am nor sure how to combine it with dsmcFoam.

Best regards,

Chris

archymedes May 3, 2010 09:33

dsmcInitialise
 
Hey cbarry and Marta,

how do you initialise your simulation ? which files and input are needed for that ?

I still initialise Zero particles. I've noticed that the above error (positions file missing ) is also present at some of the tutorial examples but in the end there are some particles initialised in the tutorial.

thanks and good luck with your porous particle source,
Archy

cbarry May 4, 2010 05:38

particle positions file
 
Hi Archy,

I had that error message with every tutorial. On closer inspection, I noticed that the file called "positions" is actually created by dsmcInitialise in the 0/lagrangian/dsmc directory. In the tutorials, the directory itself does not actually exist before running dsmcInitialise.

I however do not think that this is a problem. If I have understood the DSMC method correctly, during initialisation particles are added to the volume until the desired macroscopic boundary conditions, such as temperature, density, etc, are reached in each cell. The number of particles per parcel is a constant, and defined in the dsmcProperties dictionary. Thus openFOAM starting initialisation with 0 parcels should be no problem, as it will just add the required amount of parcels to each cell, until the number of particles corresponds with the macroscopic boundary conditions. That is at least my understanding of the process. I am however no expert.

As to what the purpose of this error message is, I am not sure. Perhaps it is somehow possible to start with a certain amount of parcels in order to quicken the initialisation process.

I hope this helps.

Best regards,

Chris

archymedes May 4, 2010 05:48

Hi Chris and thanks for the response!

You are right, the error message appears with almost every tutorial but aren't there always some particles added ?

Total number of molecules added: 64218

In my case its always 0 Particles added.
I am running another simulation now on Windows, as soon as I can I will switch back to linux and try to run the simu even with 0 particles initialised but would be odd if it works wouldn't it ?

cheers,
Archy

Marta May 4, 2010 06:17

3 Attachment(s)
Hi Archy!
Here are the files i'm using, I don't know if they are useful, because my settings are at the moment very similar to the original test case in OpenFoam, since i'm not an expert user of particle solvers.

Hi Chris!
At the moment i'm running the simulation without sorces, just to learn how the solver works, so i still do not know if my idea about how to manage sources is feasible.

As soon as i understand something more i'll write it down in the forum!

Marta

cbarry May 4, 2010 06:47

Sorry Archy, I seem to have misunderstood your question. Yes it would be strange if it worked with 0 particles added. My guess would be that there's a problem with your macroscopic boundary conditions, but I am not sure. I am currently trying to set up a simple test case myself. I'll let you know if I come across the same problem.

Marta, thanks for your reply. I'll also keep you updated on this forum if I make any progress with adding point sources.

Best of luck to both of you,

Chris

cbarry May 18, 2010 05:02

Hi Archy,

sorry to take so long to reply. I've been having some computer problems. I set up my own test case, with pressure-based boundary conditions, and have not come across the problem of no particles being added. However, the number of particles added is very small (6), thus it may be a similar problem. I'll let you know if I find the reason for this.

archymedes June 9, 2010 08:49

dsmcInitialise Solution
 
So the problem was just the size of my geometry. ( e.g. a 10 um channel )

its extremely small and with the particle densities from the tutorial it had like 10e-7 particles per cell, so it didn't put a particle in the cell, which was the case for all cells.

increasing the densities to the actual values gave me some particles in the end !

The Warning message is "normal" and can be ignored if no file is defined ( i suppose this is to read in foregoing solutions ).

Nonetheless, thanks for the responses !!!

cbarry June 10, 2010 08:36

haha what a coincidence. I just realised this week that I had the same problem. I completely overlooked that blockMesh was multiplying all the dimensions I entered by 0.01.

Marta July 8, 2010 04:32

Hi all! I've been very busy with other stuff these days, only now i'm going back to dsmcFoam... Unfortunately I have another problem.
Do you know how to set different initial particle numbers in different zones of the domain?
Do i have to prepare the mesh on purpose to be able to do this?

Thank you very much in advance

Marta

m.maneshi July 9, 2010 06:05

hi all, haven't you come to problem when converting fluent .msh mesh to foam mesh with the zero cellzone and 0 point zones ???

archymedes July 9, 2010 07:20

I have to admit that I've never exported a .msh from fluent !

I do this from the Ansys mesher which is also capable of exporting a .msh file ( don't forget the named spaces later used for the boundary conditions )

Then dos2unix (in tofrodos package , in new ubuntu the command is fromdos i think )
then fluent3DMeshtoFoam command.

works with OF 1.6 and 1.7 (Ansys 12)

m.maneshi July 9, 2010 13:35

Dear Claus
what is the role of the dos2unix you mentioned here ?? is it needed in ubuntu 9.10 either ? how about fromdos ?

m.maneshi July 9, 2010 13:57

Quote:

Originally Posted by archymedes (Post 266569)
I have to admit that I've never exported a .msh from fluent !

I do this from the Ansys mesher which is also capable of exporting a .msh file ( don't forget the named spaces later used for the boundary conditions )

Then dos2unix (in tofrodos package , in new ubuntu the command is fromdos i think )
then fluent3DMeshtoFoam command.

works with OF 1.6 and 1.7 (Ansys 12)

i belive Ansys 12 msh mesh file is not in ASCI format , how did you manage to convert it into Foam mesh ?? this hapens when i do the FluentMeshToFoam by an ANSYS msh mesh
PHP Code:

Create time

Found unknown block
:(4
Embedded blocks in comment 
or unknown: (
Found end of section in unknown:)
Found end of section in unknown:)
Embedded blocks in comment or unknown:    (
Embedded blocks in comment or unknown:(
Found end of section in unknown:) 
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Found end of section in unknown:)
Embedded blocks in comment or unknown:    (
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Embedded blocks in comment or unknown:
        (
Found end of section in unknown:)
Found end of section in unknown:)
Embedded blocks in comment or unknown:    (
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Found end of section in unknown:)
Embedded blocks in comment or unknown:    (
Embedded blocks in comment or unknown:(
Found end of section in unknown:) 
Embedded blocks in comment or unknown:(
Found end of section in unknown:)
Found end of section in unknown:)
Dimension of grid3
Number of points
6840

number of faces
18117
Number of cells
5670
Found unknown block
:(3010
Embedded blocks in comment 
or unknown: (
Found end of section in unknown:)
(((((((((((((((
Found unknown block:(3010
Embedded blocks in comment 
or unknown: (
Found end of section in unknown:)
(((&
#65533;{��Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:?
&#2010;{��Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:?
&#65533;{��Embedded blocks in comment or unknown:
&#65533;Embedded blocks in comment or unknown:
&#65533;{�Found end of section in unknown:?
Found end of section in unknown:&#65533;
&#65533;Embedded blocks in comment or unknown:
&#65533;{�Found end of section in unknown:?
&#65533;Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:?
&#65533;{��Embedded blocks in comment or unknown:
&#65533;Embedded blocks in comment or unknown:
&#65533;[{�Found end of section in unknown:?
Found end of section in unknown:&#65533;
&#65533;Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:?
&#65533;{��Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:?
&#65533;{���
     
&#65533;
       
&#65533;
         
Embedded blocks in comment or unknown:
&
#65533;
 
    
&#65533;
      
Embedded blocks in comment or unknown:
&
#65533;[
  
&#65533;
    
&#65533;�Found end of section in unknown:��Mbp?
Found end of section in unknown:&#65533;
&#65533;�Embedded blocks in comment or unknown:
&#65533;����Embedded blocks in comment or unknown:
&#65533;[���Embedded blocks in comment or unknown:��
&#65533;��Embedded blocks in comment or unknown:
&#65533;�����Embedded blocks in comment or unknown:
&#65533;�������Embedded blocks in comment or unknown:
&#65533;[�����Embedded blocks in comment or unknown:��
&#65533;Embedded blocks in comment or unknown:
&#65533;�Embedded blocks in comment or unknown:
&#65533;�@Embedded blocks in comment or unknown:
&#65533;[��Found end of section in unknown:�
Found end of section in unknown:&#65533;
&#65533;Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:�
Found end of section in unknown:&#65533;
&#65533;Found end of section in unknown:�
Found end of section in unknown:&#65533;
&#65533;Embedded blocks in comment or unknown:
&#65533;Found end of section in unknown:�
Found end of section in unknown:&#65533;
&#65533;Found end of section in unknown:�
Found end of section in unknown:&#65533;
&#1818;Found end of section in unknown:�
Found end of section in unknown:&#65533;
Embedded blocks in comment or unknown:4
&#65533;@Embedded blocks in comment or unknown:
&#65533;[Found end of section in unknown:�
Found end of section in unknown:&#65533;
Embedded blocks in comment or unknown:4
&#1818;Found end of section in unknown:�
0Dimension of grid13
(Dimension of grid1
Dimension of grid
1
Dimension of grid
3
eDimension of grid
1
fDimension of grid
2
Dimension of grid



m.maneshi July 10, 2010 05:11

Finally got the mesh exported in ASCII format and converted it to Foam mesh , but there still remains the problem with 0 cellZones and 0 faceZones :(
any idea what to do ?

archymedes July 10, 2010 08:07

Hi maneshi,

the dos2unix ( fromdos should do it as well especially as the dos2unix command is in the tofrodos apt-get package ) is just for converting from dos to unix fileformats, I thinks its just replacing carrage return symbols and so on.

Try executing fromdos (with the correct options --help) before you convert the mesh to OG with fluent3dMeshtoFoam

m.maneshi July 10, 2010 11:23

yeah , and that solves the problem, thanks.

m.maneshi August 26, 2010 16:07

A LITTLE PROBLEM WHICH MIGHT BE LESS RELEVANT TO LATTER PROBLEMS IS fieldAverage FOR ME , HOW SHOULD I DICTATE THE SOLVER TO COMPUTE fieldAverage S ON EVERY TIME STEP ?

archymedes September 3, 2010 06:40

aren't the averages calculated everytime you write the data ?
I thought so.

Marta September 3, 2010 07:03

Hi All!
I believe Archy is wright, i saw the files in the folders created when running the simulation.

Marta

archymedes September 6, 2010 04:02

Outlet definition ?
 
1 Attachment(s)
Hi all,

I am having problems defining the outlet of my system. It should be a 0 Pascal vacuum outlet, but there is no "nice" pressure drop in front of the outlet ( outlet is on bottom of picture, wall is on left, center od axis-symmetry is the edge on the right ). I am not sure if i did everything right.

Here are the definitions of the 0/ folder concerning my outlet:

boundaryT
type fixedValue;
value uniform 300;

boundaryU
type calculated;

dsmcRhoN
type fixedValue;
value uniform 0;

dsmcSigmaTcRMax
type zeroGradient;

fD
type zeroGradient;

iDof
type zeroGradient;

internalE
type zeroGradient;

linearKE
type zeroGradient;

momentum
type zeroGradient;

q
type zeroGradient;

rhoM
type fixedValue;
value uniform 0;

rhoN
type fixedValue;
value uniform 0;

Did i make an obvious mistake there ?

thanks for your help,
Archy

Marta September 6, 2010 05:53

Dear Archy, I am experiencing the same difficulty with an outlet at a very low pressure.
Now i'm trying to verify the reason of this behaviour, which i have seen by looking at the densities.
I would also like to ask you how you managed to look into the pressure values, because this is not a physical parameter calculated by default in dsmcFoam.

Thank you in advance!

Marta

archymedes September 6, 2010 05:59

I've set up a filter to calculate the pressure

Go to
Filters > Data Analysis > Calculator

Here I've enterered
rhoNMean * 1.38065e-23 * 300 (sometimes paraview is bitchy and the Mean value is not accepted, take rhoN instead )

boltzmann constant, Temperature 300 K assumed.
Then I've plotted the resulting array.

It should be possible to calculate the local temperature from the internalE value, shouldn't it ?

Marta September 6, 2010 06:39

Thank you so much for you quick answer Archy!


Marta

archymedes September 6, 2010 07:02

can you post your outlet definitions , so we could take a look at it?

archymedes September 6, 2010 08:59

I've defined the boundary temperature of the outlet to be 300 Kelvin and I've run a simulation with 1e-12 K where I could see a "sucking" effect as expected from an vacuum outlet.

I think defining a temperature for an opening as an outlet cannot be right !
I would like to use:

boundaryT
type zeroGradient;

because I cannot know the temperature of the gas at the outlet.
But zeroGradient or calculated types are not accepted by dsmcFoam.

So how to define an unkown gas temperature ??

Marta September 6, 2010 09:47

At the outlet I have used a zeroGradient boundary type too, for temperature.

At the moment i'm trying to run a case where i have only the mass flow rate specified at the inlet (mass and number densities, velocity are the only parameters defined). The rest of the boundaries is 'zeroGradient' or 'calculated' type.

Marta

archymedes September 6, 2010 11:30

Strange... in the boundaryT file I cannot set a zeroGradient type for the outlet

--> FOAM FATAL ERROR:
Zero boundary temperature detected, check boundaryT condition.



From function Foam::FreeStream<CloudType>::inflow()
in file lnInclude/FreeStream.C at line 166.

FOAM aborting

#0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam170/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/opt/openfoam170/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Foam::FreeStream<Foam::DsmcCloud<Foam::dsmcParcel> >::inflow() in "/opt/openfoam170/lib/linuxGccDPOpt/libdsmc.so"
#3
in "/opt/openfoam170/applications/bin/linuxGccDPOpt/dsmcFoam"
#4
in "/opt/openfoam170/applications/bin/linuxGccDPOpt/dsmcFoam"
#5 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#6
in "/opt/openfoam170/applications/bin/linuxGccDPOpt/dsmcFoam"

[4]+ Aborted

how did you apply it ? did you define a rhoN / rhoM at the outlet ? ( I set it to zero for pure vacuum ).

Thanks,
Archy

Marta September 6, 2010 16:20

1 Attachment(s)
Hi Archy, here is the folder with the input parameters. Anyway i'm not sure about it, i'm just trying to find out the correct way to impose boundary conditions, at the moment.

What i would like to do is to verify and plot the pressure drop due to gas flow inside a tube with a specific geometry.
I have a 0 Pa pressure at the outlet and a fixed mass flow rate at the inlet. How can i specify these parameters without using too many constraints for the system in order to avoid over determining the problem?


Marta

archymedes September 7, 2010 03:37

Hi Marta,

not sure how to do this. I think density and velocity at the inlet is the only way to determine a certain massflow rate. As for the outlet you have set everything to zeroGradient, I don't understand how dsmcFoam can derive a 0 Pa outlet from that.

These are just guesses:

1) I think at least one of the particle file ( rhoN, rhoM, dsmcRhoN ) has to determine 0 particles at outlet, just to make sure it really is 0 Pa.

2) The walls absorb a particle and re-emit it with a cosine distribution right ? if this is really the case that boundaryU and momentum should be (0 0 0) at all walls. I don't understand how this conforms with slip on the walls, but zeroGradient there whould mean full speed along the walls, wouldn't it ?

what are the foro's ? freestream boundaries ? walls ?

the simulation runs with these definitions ? (I get errors when set boundaryT at outlet to zeroGradient, mavbe I am overconstrained.. )

cheers,
archy

Marta September 7, 2010 05:47

Hi Archy, thank you very much for your reply.
I will try to modify the input files as you recommend, and then i'll let you know how it works.

The 'foros' are the inlet sections for mass flow rate. Lateral is a part of the wall towards the discharge section of the vacuum chamber next to the outlet section.

Marta

archymedes September 7, 2010 09:17

dsmcFoam: there is no outlet
 
An outlet DOES NOT exist in dsmcFoam.

This is my conlusion after studying the examples and effects on changing the input files.

there are only two inflowBoundarModels

FreeStream and noFlow

with FreeStream you can define a particle density in the constant/dsmcProperties file
This will affect ALL OPENINGs of the system, as this model was made for the free stream around a wing or spacecraft.

To simulate a dsmc flow within a vacuum chamber with inlet/outlet, I think we can use the FreeStream for the opening ( boundaryT and boundaryU to define the flow and temperature ) but for the outlet I see no legal way to define it.
Only to set the boundaryT Temperature to almost zero Degree eg. 1e-10. In this way almost no particles are injected there ( almost no energy ) but they can still leave the system as it is an opening.
As soon as the chamber got filled with particles from the inlet side, the fact that they have some energy will make them overrule the "floating" particles from the outlet.

U think this could be true ? or am I complete lost here?

thanks for your comments,
archy

Marta September 20, 2010 06:59

Dear Archy, sorry for not having replied for so long, but i had to clarify some topics in my mind.

To run our simulations we probably need to modify the inflow method in dsmcCloud.C, in particular, we shall consider the possibility to modify:

this->inflowBoundary().inflow()

To be able to initialise a different number of particles in different areas of your domain, you'll need to modify:

void Foam::DsmcCloud<parcelType>::initialise()

here each single cell is filled with particles, so that it is possible (if you add some specifications) to apply different densities and so on to some specific cell regions.

If you need a different way to control the boundary conditions with respect to the freeStream model (which is actually the only implemented scheme in dsmcFoam), then it might be necessary to implement your own model.

To do this, have a look at : src/lagrangian/dsmc/submodels/InflowBoundaryModel

Hope this helps,

Marta

m.maneshi September 20, 2010 11:55

hi all.

there is one other thing i would wanna ask here, why doesnt my simulation reach a steady state independent of how many time steps is elapsed ?

Marta September 20, 2010 16:28

Hi Maneshi,
I think something is going wrong with your simulation, but i cannot answer more precisely, since i do not know what your test case is about, nor which boundary you have used.
If you have constant boundaries, then i think it's impossible not to reach a steady state condition, if everything is set up properly.

Marta

m.maneshi September 21, 2010 03:24

my simulations is a little diffrent with yours but with the same process. A molecular dynamic Mdfoam simulation of a nano channel with walls on 4 sides and a cyclic inlet to oulet in which the flow is pressure driven. is there any hints you can mention ?


All times are GMT -4. The time now is 16:17.