CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Multiphase Solid Particle Tracking (https://www.cfd-online.com/Forums/openfoam-solving/117375-multiphase-solid-particle-tracking.html)

vonboett September 29, 2015 03:07

Hi pnovo, thanks for posting the nice tutorial. However as you maybe saw the comment in the code:
/*this solver is not to be used for simulations that resemble the real world.It’s just a demo.*/


you may want to use icoUncoupledKinematicParcelFoam as a starting point together with basicKinematicCollidingCloud.H in the header of the solver.
Anyway, what you need for your error is
#include "readGravitationalAcceleration.H" in your solver header before starting the time loop. Or take a look at the createFields.H of interFOAM etc. how it is done there.

The problematic part is more adding the particle force to the momentum equation, I am stuck there...

pnovo September 29, 2015 05:05

Thank you for your tips. Now I ran into some other errors upon compilation, but I'll have a careful look at it later. For now I will also give a try using the solver you pointed out and look into the files used for compilation. 'Would be nice if you post any (also towards) successful developments.

pnovo October 1, 2015 05:27

Hi again,
So I have looked a bit into the icoUncoupledKinematicParcelFoam tutorials, ran them and looked into some of the header files included. Now I was trying to make a simulation in which I do not have manually defined positions for the particles, but rather an injection via an inlet, 'say using elbow example located in the icoFoam tutorial folder and by using the last time point from the icoFoam run as the "0" folder for the run with icoUncoupledKinematicParcelFoam.

So I changed the injectionModels type to patchInjection:

Code:

type pathInjection;
nParticle 1000;
massTotal 1;
parcelBasisType fixed;
patchName velocity-inlet-5;
parcelsPerSecond 100000;
duration 1;
U0 (0 0.1 0); // just forced the particle to move on the y direction - doubts here
flowRateProfile constant 1;
SOI 0;

Could you give me help on how to define the U0 to read the "U" file in the 0/ directory? Also, do you know what does the flowRateProfile defines? Although I got some info from here, I could not really understand it (not due to the fact of been written in German ;) ).

Thanks

hojjat.m January 13, 2016 19:29

Particle tracking
 
Hello everyone,
I have been stuck to a problem with particle tracking. In openfoam, all the solvers are designed to inject particles from a certain location for all time steps. But I want to inject particles form different cells, at each time step.
Lets say we have a temperature field calculated at each time step. I want to inject particles at each time step from cells with certain temperature (e.g. T=200K). Can anyone help me with this.

Thanks in advance.

Mahdi2010 January 14, 2016 01:55

Quote:

Originally Posted by hojjat.m (Post 580858)
Hello everyone,
I have been stuck to a problem with particle tracking. In openfoam, all the solvers are designed to inject particles from a certain location for all time steps. But I want to inject particles form different cells, at each time step.
Lets say we have a temperature field calculated at each time step. I want to inject particles at each time step from cells with certain temperature (e.g. T=200K). Can anyone help me with this.

Thanks in advance.

If you wanna inject particles per cell (not for instance bubbles or drops which would undergo coalescence/breakup), this can be simply done. You only need to define an injection function in the particle cloud class. Then following this (rough) algorithm:

forAll cells

{ if T[cell] == 200

{
add a particle to the cloud
}

}


So, this needs a bit hard coding because you should be able to build a connection between Eulerian fields (i.e. T) and Lagrangian data (i.e. d, U, ...). The best material to read is the tutorial below:

http://www.tfd.chalmers.se/~hani/kur...LPT_120911.pdf

hojjat.m January 14, 2016 11:14

Thanks for the reply Mahdi,

I've gone through this tutorial, and as you mentioned my main problem is how to call for Eulerian parameters in the solidParticleCloud.C file.

Mahdi2010 January 14, 2016 11:21

Quote:

Originally Posted by hojjat.m (Post 580948)
Thanks for the reply Mahdi,

I've gone through this tutorial, and as you mentioned my main problem is how to call for Eulerian parameters in the solidParticleCloud.C file.


Yes you need to implement it within the function "inject" inside the function "move".
As I said this is not difficult at all, but needs some efforts. Just follow the instruction in the report, If you have problem share it here.

hojjat.m January 14, 2016 13:46

Mahdi,

I followed the instructions, and I have added the following to solidParticleCloud.C file (I have added the T interpolations to all files required):

void Foam::solidParticleCloud::inject(solidParticle::tr ackingData &td)
{
forAll (T, celli)
{
if (T[celli]==200)
{
scalar posx=mesh.C().component(0);
scalar posy=mesh.C().component(1);
scalar posz=mesh.C().component(2);
vector pos=vector(posx,posy,posz);
vector vel=vel_;

label cellI=1;
label tetFaceI=1;
label tetPtI=1;
mesh_.findCellFacePt(td.cloud().pos,cellI,tetFaceI ,tetPtI);
solidParticle* ptr= new solidParticle(mesh_,td.cloud().pos,cellI,tetFaceI, tetPtI,td.cloud().d(),td.cloud().vel);
Cloud<solidParticle>::addParticle(ptr);

}

}
}

What I am trying to do, is to read the cell centers of cells with T=200, and assign them as the position for injecting particles.
After getting rid of some of the errors, I finally get the following errors, which are due to the link between Eulerian and Lagrangian fields:

solidParticleCloud.C: In member function ‘void Foam::solidParticleCloud::inject(Foam::solidPartic le::trackingData&)’:
solidParticleCloud.C:102:3: error: ‘T’ was not declared in this scope
solidParticleCloud.C:107:23: error: ‘((Foam::solidParticleCloud*)this)->Foam::solidParticleCloud::mesh’ does not have class type
solidParticleCloud.C:108:23: error: ‘((Foam::solidParticleCloud*)this)->Foam::solidParticleCloud::mesh’ does not have class type
solidParticleCloud.C:109:23: error: ‘((Foam::solidParticleCloud*)this)->Foam::solidParticleCloud::mesh’ does not have class type
solidParticleCloud.C:116:38: error: ‘class Foam::solidParticleCloud’ has no member named ‘pos’
solidParticleCloud.C:117:61: error: ‘class Foam::solidParticleCloud’ has no member named ‘pos’
make: *** [Make/linux64GccDPOpt/solidParticleCloud.o] Error 1

I really appreciate your help.
Thanks

Mahdi2010 January 15, 2016 04:05

Quote:

Originally Posted by hojjat.m (Post 580967)
Mahdi,

I followed the instructions, and I have added the following to solidParticleCloud.C file (I have added the T interpolations to all files required):

void Foam::solidParticleCloud::inject(solidParticle::tr ackingData &td)
{
forAll (T, celli)
{
if (T[celli]==200)
{
scalar posx=mesh.C().component(0);
scalar posy=mesh.C().component(1);
scalar posz=mesh.C().component(2);
vector pos=vector(posx,posy,posz);
vector vel=vel_;

label cellI=1;
label tetFaceI=1;
label tetPtI=1;
mesh_.findCellFacePt(td.cloud().pos,cellI,tetFaceI ,tetPtI);
solidParticle* ptr= new solidParticle(mesh_,td.cloud().pos,cellI,tetFaceI, tetPtI,td.cloud().d(),td.cloud().vel);
Cloud<solidParticle>::addParticle(ptr);

}

}
}

What I am trying to do, is to read the cell centers of cells with T=200, and assign them as the position for injecting particles.
After getting rid of some of the errors, I finally get the following errors, which are due to the link between Eulerian and Lagrangian fields:

solidParticleCloud.C: In member function ‘void Foam::solidParticleCloud::inject(Foam::solidPartic le::trackingData&)’:
solidParticleCloud.C:102:3: error: ‘T’ was not declared in this scope
solidParticleCloud.C:107:23: error: ‘((Foam::solidParticleCloud*)this)->Foam::solidParticleCloud::mesh’ does not have class type
solidParticleCloud.C:108:23: error: ‘((Foam::solidParticleCloud*)this)->Foam::solidParticleCloud::mesh’ does not have class type
solidParticleCloud.C:109:23: error: ‘((Foam::solidParticleCloud*)this)->Foam::solidParticleCloud::mesh’ does not have class type
solidParticleCloud.C:116:38: error: ‘class Foam::solidParticleCloud’ has no member named ‘pos’
solidParticleCloud.C:117:61: error: ‘class Foam::solidParticleCloud’ has no member named ‘pos’
make: *** [Make/linux64GccDPOpt/solidParticleCloud.o] Error 1

I really appreciate your help.
Thanks

How did you define the scalarField T in this class? The error says you have not defined T yet. Please put the .H and .C files here, then I can see what you have done.

vonboett January 15, 2016 05:05

Quote:

Originally Posted by hojjat.m (Post 580858)
Hello everyone,
I have been stuck to a problem with particle tracking. In openfoam, all the solvers are designed to inject particles from a certain location for all time steps. But I want to inject particles form different cells, at each time step.
Lets say we have a temperature field calculated at each time step. I want to inject particles at each time step from cells with certain temperature (e.g. T=200K). Can anyone help me with this.

Thanks in advance.

Hi, do the particles injected influence the temperature field?

Of course, implementing your custom injection is the best way! But maybe you want to compare results then by running your case without particle injections, see where and when you want particles injected due to temperature and then rerun the case with standard particle injectors pre-defining the SOI valuie to match the time particles should enter at that spot...

hojjat.m January 15, 2016 10:42

1 Attachment(s)
Quote:

Originally Posted by Mahdi2010 (Post 581024)
How did you define the scalarField T in this class? The error says you have not defined T yet. Please put the .H and .C files here, then I can see what you have done.

Mahdi,
I have just defined T at createFields.H, for the Eulerian field. I have attached the whole files of .C and .H for the solidParticle solver.

Thanks

hojjat.m January 15, 2016 10:46

Quote:

Originally Posted by vonboett (Post 581036)
Hi, do the particles injected influence the temperature field?

Of course, implementing your custom injection is the best way! But maybe you want to compare results then by running your case without particle injections, see where and when you want particles injected due to temperature and then rerun the case with standard particle injectors pre-defining the SOI valuie to match the time particles should enter at that spot...

Albrecht,
The particlesare injected at certain cells and at each time step, Unfortunately, all of the injectors are designed to inject particles from SOI to EOI, from same location.
For my case, particles are injected each time step from certain cells, so SOI is meaningless.

hojjat.m January 15, 2016 12:28

Quote:

Originally Posted by Mahdi2010 (Post 581024)
How did you define the scalarField T in this class? The error says you have not defined T yet. Please put the .H and .C files here, then I can see what you have done.

Mahdi,
I defined T field at solidParticleCloud.H, and after some modification at the solidParticleCloud.C :

void Foam::solidParticleCloud::inject(solidParticle::tr ackingData &td)
{
const volScalarField& dInc = mesh_.lookupObject<const volScalarField>("dInc");
forAll (T, celli)
{
if (T[celli==0)
{
label cellI=1;
label tetFaceI=1;
label tetPtI=1;
solidParticle* ptr= new solidParticle(mesh_,pos,cellI,tetFaceI,tetPtI,td.c loud().d,vel);
Cloud<solidParticle>::addParticle(ptr);
}
}
}

It seems that T field is read, however, I get thje following error, which is the particle injection part:

injectionsolidParticleCloud.C: In member function ‘void Foam::solidParticleCloud::inject(Foam::solidPartic le::trackingData&)’:
solidParticleCloud.C:112:92: error: no matching function for call to ‘Foam::solidParticle::solidParticle(const Foam::fvMesh&, <unresolved overloaded function type>, Foam::label&, Foam::label&, Foam::label&, <unresolved overloaded function type>, <unresolved overloaded function type>)’
solidParticleCloud.C:112:92: note: candidates are:
In file included from solidParticleCloud.H:41:0,
from solidParticleCloud.C:26:
solidParticle.H:136:9: note: Foam::solidParticle::solidParticle(const Foam::polyMesh&, Foam::Istream&, bool)
solidParticle.H:136:9: note: candidate expects 3 arguments, 7 provided
In file included from solidParticle.H:264:0,
from solidParticleCloud.H:41,
from solidParticleCloud.C:26:
solidParticleI.H:47:8: note: Foam::solidParticle::solidParticle(const Foam::polyMesh&, const vector&, Foam::label, Foam::label, Foam::label, Foam::scalar, const vector&)
solidParticleI.H:47:8: note: no known conversion for argument 2 from ‘<unresolved overloaded function type>’ to ‘const vector& {aka const Foam::Vector<double>&}’
In file included from solidParticleCloud.H:41:0,
from solidParticleCloud.C:26:
solidParticle.H:59:7: note: Foam::solidParticle::solidParticle(const Foam::solidParticle&)
solidParticle.H:59:7: note: candidate expects 1 argument, 7 provided
make: *** [Make/linux64GccDPOpt/solidParticleCloud.o] Error 1

Mahdi2010 January 17, 2016 04:40

Quote:

Originally Posted by hojjat.m (Post 581097)
Mahdi,
I defined T field at solidParticleCloud.H, and after some modification at the solidParticleCloud.C :

void Foam::solidParticleCloud::inject(solidParticle::tr ackingData &td)
{
const volScalarField& dInc = mesh_.lookupObject<const volScalarField>("dInc");
forAll (T, celli)
{
if (T[celli==0)
{
label cellI=1;
label tetFaceI=1;
label tetPtI=1;
solidParticle* ptr= new solidParticle(mesh_,pos,cellI,tetFaceI,tetPtI,td.c loud().d,vel);
Cloud<solidParticle>::addParticle(ptr);
}
}
}

It seems that T field is read, however, I get thje following error, which is the particle injection part:

injectionsolidParticleCloud.C: In member function ‘void Foam::solidParticleCloud::inject(Foam::solidPartic le::trackingData&)’:
solidParticleCloud.C:112:92: error: no matching function for call to ‘Foam::solidParticle::solidParticle(const Foam::fvMesh&, <unresolved overloaded function type>, Foam::label&, Foam::label&, Foam::label&, <unresolved overloaded function type>, <unresolved overloaded function type>)’
solidParticleCloud.C:112:92: note: candidates are:
In file included from solidParticleCloud.H:41:0,
from solidParticleCloud.C:26:
solidParticle.H:136:9: note: Foam::solidParticle::solidParticle(const Foam::polyMesh&, Foam::Istream&, bool)
solidParticle.H:136:9: note: candidate expects 3 arguments, 7 provided
In file included from solidParticle.H:264:0,
from solidParticleCloud.H:41,
from solidParticleCloud.C:26:
solidParticleI.H:47:8: note: Foam::solidParticle::solidParticle(const Foam::polyMesh&, const vector&, Foam::label, Foam::label, Foam::label, Foam::scalar, const vector&)
solidParticleI.H:47:8: note: no known conversion for argument 2 from ‘<unresolved overloaded function type>’ to ‘const vector& {aka const Foam::Vector<double>&}’
In file included from solidParticleCloud.H:41:0,
from solidParticleCloud.C:26:
solidParticle.H:59:7: note: Foam::solidParticle::solidParticle(const Foam::solidParticle&)
solidParticle.H:59:7: note: candidate expects 1 argument, 7 provided
make: *** [Make/linux64GccDPOpt/solidParticleCloud.o] Error 1

I went through your code and I finally got what's wrong with the impelementation.
In solidParticleCloud.C within the function inject you define the following:

td(*this, rhoInterp, UInterp, TInterp, nuInterp, g.value());

but the point is that td(= tracking data class) has a function which does not recognize any temperature field. I mean td function does not include any T (see line 76 of this).

It means that any particle that is going to be added to the solidParticleCloud should be defined within this function with the arguments rho, U, nu and g. But you did not modify this function. If you wanna use "T" as one of the arguments of this function, you should modify that as well.

hojjat.m January 17, 2016 18:19

1 Attachment(s)
Quote:

Originally Posted by Mahdi2010 (Post 581232)
I went through your code and I finally got what's wrong with the impelementation.
In solidParticleCloud.C within the function inject you define the following:

td(*this, rhoInterp, UInterp, TInterp, nuInterp, g.value());

but the point is that td(= tracking data class) has a function which does not recognize any temperature field. I mean td function does not include any T (see line 76 of this).

It means that any particle that is going to be added to the solidParticleCloud should be defined within this function with the arguments rho, U, nu and g. But you did not modify this function. If you wanna use "T" as one of the arguments of this function, you should modify that as well.

I have already added TInterp to solidParticle.H file, but I still get errors. I have problem in adding the particle, I don't know how to assign the cell center to inject particles.

Mahdi2010 January 18, 2016 02:09

Quote:

Originally Posted by hojjat.m (Post 581295)
I have already added TInterp to solidParticle.H file, but I still get errors. I have problem in adding the particle, I don't know how to assign the cell center to inject particles.


Did you modify solidParticleI.H as well?
If so, I would say put the error you get here.

In addition, for cell center I guess you may simply use: "findTetFacePt" function or other functions like that. This can give you some hints

hojjat.m January 19, 2016 16:09

Quote:

Originally Posted by Mahdi2010 (Post 581321)
Did you modify solidParticleI.H as well?
If so, I would say put the error you get here.

In addition, for cell center I guess you may simply use: "findTetFacePt" function or other functions like that. This can give you some hints

So basically I have been stuck here:
I have a volumeVectorField (mesh_.C() which is the cell center of each mesh. But in function findCellFacePt(pos, cellI, tetFaceI, tetPtI), the pos label is for vector not volumeVectorField, so I get the following error:

error: no matching function for call to ‘Foam::fvMesh::findCellFacePt(Foam::volVectorField &, Foam::label&, Foam::label&, Foam::label&) const’

Any hints on that?

Mahdi2010 January 20, 2016 01:35

Quote:

Originally Posted by hojjat.m (Post 581623)
So basically I have been stuck here:
I have a volumeVectorField (mesh_.C() which is the cell center of each mesh. But in function findCellFacePt(pos, cellI, tetFaceI, tetPtI), the pos label is for vector not volumeVectorField, so I get the following error:

error: no matching function for call to ‘Foam::fvMesh::findCellFacePt(Foam::volVectorField &, Foam::label&, Foam::label&, Foam::label&) const’

Any hints on that?

I see. The only thing that I can offer is to use this format:

findTetFacePt(cellI,pt,tetFaceI,tetPtI);

instead of function "findCellFacePt". In this way the cell centers can be represented by
"pt" which will not be a volume vector anymore. But besides the labels like tetFace and
tetPtI, you need to define "pt" as well.

alexlupo January 21, 2016 06:35

interFoam + LPT with solidParticleCloud
 
2 Attachment(s)
Hi all,

This is not really related to the discussion right now but I got a private message asking for the upgraded code of Aurelia Vallier's tutorial so I compiled and tested it for OF2.3.x and I thought someone could use it so I decided to post it here together with the particleProperties dictionary and some additional files.
Hope it helps.
Cheers!

vonboett January 21, 2016 07:45

Hi Alex,
the attachment is empty I think...


All times are GMT -4. The time now is 14:34.