CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

defining particle positions by manualInjection in icoLagrangianFoam

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

Like Tree1Likes
  • 1 Post By ali_atrian

Reply
 
LinkBack Thread Tools Display Modes
Old   October 19, 2014, 07:16
Default defining particle positions by manualInjection in icoLagrangianFoam
  #1
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
Hello
I am a new begginer to openFoam and working on particle tracking in order to simulate sediment transport. i have choosen icoLagrangianFoam solver in openFOAM-ext 3.0.
This solver includes a case (channelParticles) which by default injects the particles at SOI but I want to settle the particles on bed randomely in order to simulate bedload transport.
I guess I can get it done using src\lagrangian\intermediate\submodels\Kinematic\In jectionModel\ManualInjection and making "positionFile" dictionary.
but unfortunately i don't know how it is exactly possible. which files I have to change and what files I have to add?!
The other question of mine is that is it possible to define friction for all the particles (to simulate sediment)
I will be very thankful if someone shows me the way.
ali_atrian is offline   Reply With Quote

Old   October 20, 2014, 05:18
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 245
Rep Power: 13
floquation will become famous soon enough
Hi,

I'm not an expert either, but I can tell you the following, which might help:

ManualInjection can solely be used for instant injections; Have a look at the "timeEnd()" method of:
Code:
vi $FOAM_SRC/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C
Although, comparing it with CellZoneInjection, I wonder if it is implemented correctly. (Tho I did not dive into the InjectionModels code yet.) It seems that it becomes time-dependent if you set SOI to a negative value, but this has other nasty consequences (you get a time-step dependency of the number of particles injected), so don't do that.


A question which might help you:
Is your bed on a patch? Because if so, you might want to have a look at PatchInjection, which does allow for time-dependent injection (and there are tutorial cases which use it).


Otherwisely, maybe KinematicLookupTableInjection might have something useful. (I never used it, but given its name and given that it does have a time-dependency, it might have what you want.)


The only alternative I see to the above (someone else might know more than me), is to write your own InjectionModel based of ManualInjection.
floquation is offline   Reply With Quote

Old   October 20, 2014, 08:44
Default
  #3
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
Hi Kevin
thanks for your kind guidance
I should say that in file "manualInjection.H" , in Description part, its mentioned that parcel positions can be specified through the file named "positionFile". so i made a "dictionary" class type file in 0/lagrangian directoy (i dont know whether it should be in this location or not) and specified the particle positions in this format:
Code:
90
(
(0.803837 0.0226777 0.005) 
(0.763517 0.0123323 0.005) 
(0.792514 0.0204512 0.005) 
(0.940018 0.0663434 0.005) 
(0.788872 0.0131514 0.005) 
)
and add the following code to the kinematicCloudProperties:
Code:
injectionModel
{  
        type            manualInjection; 
        massTotal       0.0001; 
        parcelBasisType mass; 
        SOI             0; 
        positionsFile   "PositionsFile"; 
        U0              ( 0 0 0 ); 
	parcelPDF
	    {
	        pdfType                          RosinRammler;
	        RosinRammlerPDF
        	{
        	    minValue                     50.0e-06;
        	    maxValue                     100.0e-06;
        	    d                            (75.0e-06);
        	    n                            (0.5);
        	}
    	    }
}
but i received the following error:

Code:
Reading g
Constructing kinematicCloud
--> FOAM Warning : 
    From function Cloud<ParticleType>::initCloud(const bool checkClass)
    in file /home/alireza/foam/foam-extend-3.0/src/lagrangian/basic/lnInclude/CloudIO.C at line 124
    Cannot read particle positions file 
    "/home/alireza/Desktop/icoLagrangianFoam/channelParticles/0/lagrangian/kinematicCloud"
    assuming the initial cloud contains 0 particles.

mybe i can inject the paticles in a very short period of time (e.g 0.001 sec.) so the particles wont move but the simulation run is going on (water movement on particles)
is there any idea?
thax a lottt
ali_atrian is offline   Reply With Quote

Old   October 20, 2014, 09:45
Default
  #4
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 245
Rep Power: 13
floquation will become famous soon enough
Position file:
Your position file needs to be in the constant directory, right next to your properties file.

For example, if you have:
"particleProperties" and "particlePositions" for your filenames, you'd have (copied from a case of mine (OF v2.3.x), adapt it to your case):

Code:
in constant/particleProperties file

    injectionModels
    {
        model1
        {
            type            manualInjection;
            massTotal       1; //unused when parcelBasisType=fixed.
            parcelBasisType fixed;
            nParticle       1; //number of particles per parcel
            SOI             0; //start-time of the injection
            positionsFile   "particlePositions";
            U0              (0 0 0);
            sizeDistribution
            {
                type uniform;
                uniformDistribution
                {
                    minValue        20e-06;
                    maxValue        20e-06;
                }
            }
        }
    }
Code:
in constant/particlePositions file

(...Header...)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
(0.004463 0.028349 0.000000)
(-0.002976 0.020872 0.000000)
(-0.007233 0.029628 0.000000)
(-0.001094 0.020986 0.000000)
(-0.004087 0.023335 0.000000)
(-0.004742 0.023012 0.000000)
)
Static particles
It is certainly possible to enforce particles to be static for some amount of time. It is even possible to randomize it such that particles "come loose" over time, independently.
However, I'm not aware of any OF feature that can do so, meaning you'd need a custom CloudFunctionObject (CCFO) for that task. It is, however, easier to write a custom ManualInjection model by simply copying it, and including a time-dependency than to write such a CCFO.


Though, if it is possible for you to use it, PatchInjection would be your best call, since it already allows you do inject particles at a random position as a function of time (provided your bed is on a patch). So if possible, I'd highly recommend taking a look at this first.
floquation is offline   Reply With Quote

Old   October 21, 2014, 05:46
Default
  #5
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
Hi kevin
from the errors, I found that the particle positin file should be in “positions” file name and should be placed in 0/lagrangian/kinematicCloud/ directory and also should be in the following format:

Code:
1000
(
(0.195632 0.0414094 0.005) 419
(0.189153 0.0619011 0.005) 618
(0.194084 0.039347 0.005) 319
.
.
.
)
besides, I found that, the “kinematicCloudProperties” file which is located at constant folder should be edited as:

Code:
InjectionModel                           ManualInjection;
ManualInjectionCoeffs
{
	massTotal  massTotal [ 1  0  0  0  0]    2.0e-4;
        parcelBasisType mass; 
        SOI             0; 
        positionsFile   "positionsFile"; 
        U0              ( 0 0 0 ); 
        sizeDistribution 
        { 
            type        fixedValue; 
            fixedValueDistribution 
            { 
                value           5e-06; 
            } 
        } 
}
so I resolved the prior errors
but now I recieve the following errors:

Code:
file: /home/alireza/Desktop/icoLagrangianFoam/channelParticles/constant/positionsFile at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 61.

FOAM exiting

The error arises from the following lines (in file regIOobjectRead.C):

 // Construct object stream and read header if not already constructed
    if (!isPtr_)
    {
        if (!(isPtr_ = objectStream()))
        {
            FatalIOError
            (
                "regIOobject::readStream()",
                __FILE__,
                __LINE__,
                objectPath(),
                0
            )   << "cannot open file"
                << exit(FatalIOError);
        }
now what is the problem from??
I guess, maybe, it is because of the class name of position file wich I have inserted all of these 3 type:
ManualInjection<CloudType>
dictionary
and
Cloud<basicKinematicParcel>

but no progress.

The other question of mine is that what are the numbers (419 ,618, 319) after paranthesis (the position coordination) in “positions” file stand for and means?
when I delete one of them I will receive the following error:
Code:
wrong token type - expected int found on line 25 the punctuation token '('

file: /home/alireza/Desktop/icoLagrangianFoam/channelParticles/0/lagrangian/kinematicCloud/positions at line 25.

    From function operator>>(Istream&, int&)
    in file primitives/ints/int/intIO.C at line 68.
I would appreciate any help
thanks alot
ali_atrian is offline   Reply With Quote

Old   October 21, 2014, 06:13
Default
  #6
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 245
Rep Power: 13
floquation will become famous soon enough
I know little about OF 3.0-ext (I'm solely using OF 2.3.x), hence we may have had some differences in the posts above.

However, I did find the following for you (which is for "foam-extend-3.0", which is what you're using, right?):

Tutorial case (coalChemistryFoam) which uses ManualInjection:
http://sourceforge.net/p/openfoam-ex...mplifiedSiwek/
Position file in constant/ directory:
http://sourceforge.net/p/openfoam-ex...loud1Positions
Properties file in constant/ directory:
http://sourceforge.net/p/openfoam-ex...oud1Properties

From this I learn that:
  1. Your position file should not be in the 0/lagrangian/kinematicCloud/ directory. That is a generated file, not an input file.
    • This is as well an indication for what the numbers mean:
      • "1000" is the number of parcels
      • The integers behind the positions are the indices of the cell the particle is in (this is a hypothesis of mine, I have no proof, but it seems to make a lot of sense to me). Storing these integers saves OF a lot of computational time, since it is expensive to locate a particle, while it is cheap to store a single number. (And when the particle travels to a neighbouring cell, that number is known - it needs not be found.)
---

I'd say, move your position file to the appropriate directory (following the tutorial case I linked), and see if the error disappears.
floquation is offline   Reply With Quote

Old   October 21, 2014, 14:18
Default
  #7
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
thanxxx alot for your kindly guidance kevin, you made my solver Starting time loop (but no conclusion!)
I made these changes:
1. I put the "positions" file in constant directory
2. (from the tutorial case you showd me) I changed the positions file in this format:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       vectorField;
    location    "constant";
    object      positions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

(
(0.005 0.05 0.005)
(0.010 0.05 0.005)
(0.015 0.05 0.005)
)
3. (because of the errors I got) I added "parcelPDF" in the following format to file kinematicCloudProperties:
Code:
ManualInjectionCoeffs
{
	massTotal  massTotal [ 1  0  0  0  0]    2.0e-4;
        parcelBasisType mass; 
        SOI             0; 
        positionsFile   "positions"; 
        U0              ( 0 0 0 ); 
        sizeDistribution 
        { 
            type        fixedValue; 
            fixedValueDistribution 
            { 
                value           5e-06; 
            } 
        } 
  	
	parcelPDF
    	{
       	 pdfType                          RosinRammler;
       	 RosinRammlerPDF
       	    {
       	     minValue                     50.0e-06;
             maxValue                     100.0e-06;
            d                             (75.0e-06);
            n                             (0.5);
            }
        }
}
althogh the solver gets along more than ever, I still get the following error:

Code:
Reading g
Constructing kinematicCloud
--> FOAM Warning : 
    From function Cloud<ParticleType>::initCloud(const bool checkClass)
    in file /home/alireza/foam/foam-extend-3.0/src/lagrangian/basic/lnInclude/CloudIO.C at line 124
    Cannot read particle positions file 
    "/home/alireza/Desktop/icoLagrangianFoam/ManualInjection/channelParticles/0/lagrangian/kinematicCloud"
    assuming the initial cloud contains 0 particles.
Selecting DispersionModel none
Selecting DragModel SphereDrag
Selecting InjectionModel ManualInjection
    Constructing 2-D injection
Selecting pdfType RosinRammler
Selecting PatchInteractionModel StandardWallInteraction
Selecting PostProcessingModel PatchPostProcessing
Selecting U IntegrationScheme Euler

Starting time loop

Time = 0.001

Courant Number mean: 0 max: 0.2 velocity magnitude: 1
Evolving kinematicCloud

--> Cloud: kinematicCloud
    Added 27 new parcels

Cloud: kinematicCloud
    Total number of parcels added   = 27
    Total mass introduced           = 0.0002
    Current number of parcels       = 27
    Current mass in system          = 0.0002
and then suddenly the solvers stops with the sentence:
Code:
Evolving kinematicCloud
If you see the log there is a warning which I already recieved too and that was why I used to put the position file in the mentioned directory!

now my questions are:
- is it clear for you what is problem
- are the 'class' and 'location' values in the header of positions file correct? and is it necessary to specify the 'location' option in the header?

I add that the file "CloudIO.C" (mentioned in the log) contains:
Code:
void Foam::Cloud<ParticleType>::initCloud(const bool checkClass)
{
    readCloudUniformProperties();

    IOPosition<ParticleType> ioP(*this);

    if (ioP.headerOk())
    {
        ioP.readData(*this, checkClass);
        ioP.close();

        if (this->size())
        {
            readFields();
        }
    }
    else
    {
        WarningIn("Cloud<ParticleType>::initCloud(const bool checkClass)")
            << "Cannot read particle positions file " << nl
            << "    " << ioP.path() << nl
            << "    assuming the initial cloud contains 0 particles." << endl;
    }

I'm really thankful
ali_atrian is offline   Reply With Quote

Old   October 21, 2014, 15:13
Default
  #8
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
Hi Kevin
I think I found why run stops suddenly
I think the particle numbers which should be added finishes before the endTime of run because I introduced only 27 particles totally. ofcourse this is my hypothesis!
I mentioned this matter not to waste your time absurdly
but i still have the other questions i mentioned
ali_atrian is offline   Reply With Quote

Old   October 22, 2014, 03:40
Default
  #9
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 245
Rep Power: 13
floquation will become famous soon enough
I don't know, but a few things I can suggest are:

  • "sizeDistribution" is probably the OF2.3.x equivalent of parcelPDF. I'd remove it.
  • I do not know how OF behaves with "parcelBasisType mass;" (I have had some problems with it when I fooled around with ManualInjection). The problem I have with it is the fact that you specify both a totalMass and a density in your properties file and a number of parcels in your position file. Problem is: knowing 2 (and given the diameter) is knowing the third.
    That's why I tend to use:
    Code:
    massTotal       1; //unused when parcelBasisType=fixed.
    parcelBasisType fixed;
    nParticle       1; //number of particles per parcel
    That way, I know (by source code inspection) that the density is used to determine the mass of each parcel.
  • I do not understand the warning you receive, since it should be reading the constant file at t=0 --> Does your simulation begin at t=0?
  • A difference I note between the tutorial and your position header is that the tutorial specifies a different location. While I think your location makes more sense than the tutorial's, it is worth a try to use the same as the tutorial uses. I.e.: "".
Otherwisely, what exactly is your final error? Or does the simulation just hang, without any error whatsoever?
floquation is offline   Reply With Quote

Old   October 23, 2014, 16:49
Default
  #10
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
Hi kevin
My hypothesis was completely right and simulation running stoped only because of very low number of particles. I generated 6000 random positions by Excel and inserted them in position file so everything resolved and I run the solver without annnyyy error and this was ofcourse for the sake of your guidelines. Thnx 

1. Yes, sizeDistribution works exactly the same as parcelPDF (in of-exd 3.0). so I deleted the sizeDistribution in my kinematicCloudProperties file.

2. About the “parcelBasisType” function: we have three parameters “totalMass”, “density” and “number of parcels”. My guess is that openfoam changes the particle diameters to keep totalMass constant (as value you specified). Because, according to No. of Par. and particle distribution method, openFoam determines each particle diameter. So diameters changes in relevant to No. of Pars. My evidence to claim this is that: whether when I put “Total number of parcels added = 20” or 2000 or 6000 I will always have the constant “Total mass introduced = 0.0002” for all three cases.

3. About the warning I get I have to say that occurs even in the default tutorial case. So I ignored it!
About simulation beginning time
In controlDict:
startFrom firstTime;
startTime 0;
and in kinematicCloudPros:
SOI (start of injection) 0

4. ‘location’ in the header of position file has noooo effect on the result. I can even disable it!

- At last, my last finding was that when injection is Manual, duration option has noooooooo influence of the result, so injection is at a moment and "parcelPerSecond" and "volumeFlowRate" does not make any sense too.

I hope I have you in contact in case of problems
thnx
vonboett likes this.
ali_atrian is offline   Reply With Quote

Old   October 24, 2014, 03:27
Default
  #11
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 245
Rep Power: 13
floquation will become famous soon enough
I'm glad that you have your simulation running.

Concerning ManualInjection: it does not support a time-dependency, as can be seen in the source-code:
Quote:
Originally Posted by floquation View Post
ManualInjection can solely be used for instant injections; Have a look at the "timeEnd()" method of:
Code:
vi $FOAM_SRC/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C
If you need a time-dependency, have a look at PatchInjection. Otherwisely, you need to do some coding yourself (afaik).

Quote:
Originally Posted by ali_atrian View Post
2. About the “parcelBasisType” function: we have three parameters “totalMass”, “density” and “number of parcels”. My guess is that openfoam changes the particle diameters to keep totalMass constant (as value you specified). Because, according to No. of Par. and particle distribution method, openFoam determines each particle diameter. So diameters changes in relevant to No. of Pars. My evidence to claim this is that: whether when I put “Total number of parcels added = 20” or 2000 or 6000 I will always have the constant “Total mass introduced = 0.0002” for all three cases.
Have you checked in e.g. ParaView to see that the parcel diameters are indeed variable, and not e.g. the density changed?
floquation is offline   Reply With Quote

Old   November 4, 2014, 16:28
Default virtualMass
  #12
Member
 
Alireza Atrian
Join Date: May 2014
Posts: 39
Rep Power: 5
ali_atrian is on a distinguished road
Hi kevin again
I intend to implement virtual mass force in icolagrangianFoam solver (foam-exd 3.0) as explained in:
HTML Code:
http://www.cfd-online.com/Forums/openfoam-programming-development/143543-virtual-mass-force-implementation-icolagrangianfoam-foam_exd-3-0-a.html
Its around 2 weeks i have mentioned my problem on the thread but no answer yet
would you please guide me and mention even small hints if you know anything about the problem?!
ali_atrian is offline   Reply With Quote

Old   November 5, 2014, 04:03
Default
  #13
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 245
Rep Power: 13
floquation will become famous soon enough
No, I don't. It is significantly different than OF2.3.x's implementation.

However, by the looks of it, the answer is very simple: "not implemented". What you are trying to do is not available in the OF version you are using.

While I have never used the virtual mass force before, by a quick look into the source code, it does seem to be implemented in OF2.3.x.
floquation is offline   Reply With Quote

Old   July 12, 2016, 07:16
Default kinematic cloud properties-Regd
  #14
Member
 
thegauravonline's Avatar
 
Gaurav Singh
Join Date: Mar 2016
Posts: 69
Rep Power: 3
thegauravonline is on a distinguished road
Hi,

I would like to understand what is the meaning of "rhoMin" & "rho0" in the kinematic Cloud properties file in Lagrangian solver of foam-extend3.2

I want to specify and vary the density of the particles that I inject. For this, where should I make changes.

Please let me know if you are aware of this...

Also, please let me know these: "minParticleMass" & "RosinRammlerPDF"

Thank you.
thegauravonline is offline   Reply With Quote

Old   July 14, 2016, 04:21
Default
  #15
Member
 
Ping Chang
Join Date: Feb 2016
Location: Perth
Posts: 92
Rep Power: 3
chpjz0391 is on a distinguished road
Quote:
Originally Posted by thegauravonline View Post
Hi,

I would like to understand what is the meaning of "rhoMin" & "rho0" in the kinematic Cloud properties file in Lagrangian solver of foam-extend3.2

I want to specify and vary the density of the particles that I inject. For this, where should I make changes.

Please let me know if you are aware of this...

Also, please let me know these: "minParticleMass" & "RosinRammlerPDF"

Thank you.
Hi,

rho0 is the particle density, and RosinRammlerPDF is a kind of distribution for the particles.
chpjz0391 is offline   Reply With Quote

Old   July 14, 2016, 07:35
Default
  #16
Member
 
thegauravonline's Avatar
 
Gaurav Singh
Join Date: Mar 2016
Posts: 69
Rep Power: 3
thegauravonline is on a distinguished road
Quote:
Originally Posted by chpjz0391 View Post
Hi,

rho0 is the particle density, and RosinRammlerPDF is a kind of distribution for the particles.
Dear Ping,

Thanks for the information.

Could you please tell the difference between 'rho' & 'rho0' given in the kinematicCloudProperties file.

Is there a limit on the value of rho0. Because, if i am changing the default values, foam is giving errors(FLOATING POINT EXCEPTION). Also, for moderate values of rho0, the solution is running only upto a limited number of time steps than mentioned in the controlDict file.

Thanks
thegauravonline is offline   Reply With Quote

Old   April 13, 2017, 03:54
Post How to inject solid particles in mesh in openFOam2.4.0 for particle tracking
  #17
Member
 
AJAY BHANDARI
Join Date: Jul 2015
Location: INDIA
Posts: 48
Rep Power: 4
AJAY BHANDARI is on a distinguished road
Hi all,

I think my post best fits here.

I want to do particle tracking of a solid particle injected from a specified position in mesh.
Then after adding the injector i want to couple the lagrangian solution with the eulerian one just like icolagrangian foam. In my case it is not icoFoam but it is poroussimpleFoam as i am simulated flow through porous media.

I am working in openFoam2.4.0

Any suggestions how should i start with the lagrangian part and how i inject the particles.

Right now i am following this link to inject particles in my computational domain and then coupling with the eulerian solution to do particle tracking

http://www.tfd.chalmers.se/~hani/kur...tonPersson.pdf
(Please see Page no 19 of this)

But its not working due to openFoam version problem. Can anybody tell how to inject particles in openFoam2.4.0 version. or what should i change in the above mentioned link to make it work for openFoam 2.4.0

Best
Ajay
AJAY BHANDARI is offline   Reply With Quote

Reply

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
Error during reconstructing lagarangian fields ybapat OpenFOAM 9 November 17, 2014 08:52
decomposePar field transfer of particle positions failed sophie_l OpenFOAM Running, Solving & CFD 2 October 28, 2014 21:46
injection problem Mark New FLUENT 0 August 4, 2013 01:30
Check particle impaction with User Fortran Julian K. CFX 3 January 12, 2012 10:46
DPM UDF particle position using the macro P_POS(p)[i] dm2747 FLUENT 0 April 17, 2009 01:29


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