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)

alexlupo April 24, 2014 07:11

Quote:

Originally Posted by Mahdi2010 (Post 487847)
Please tell us more about your problem.

Hi houwy,
There are actually a few things in your code that dont look ok.
First of all, it looks like you have tetFac eI instead of tetFaceI.
The error shown by openFoam is letting you know that solidParticle needs a mesh, so instead of
Code:

solidParticle* pPtr2=new solidParticle(*this,td.cloud().posP2_,cellI,tetFaceI, tetPtI,td.cloud().dP2_,td.cloud().UP2_);
try
Code:

solidParticle* pPtr2=new solidParticle(mesh_,td.cloud().posP2_,cellI,tetFaceI,tetPtI,td.cloud().dP1_,td.cloud().UP2_);
Hope it helps.

Regards,
Alex

houwy April 24, 2014 07:25

Quote:

Originally Posted by alexlupo (Post 487939)
Hi houwy,
There are actually a few things in your code that dont look ok.
First of all, it looks like you have tetFac eI instead of tetFaceI.
The error shown by openFoam is letting you know that solidParticle needs a mesh, so instead of
Code:

solidParticle* pPtr2=new solidParticle(*this,td.cloud().posP2_,cellI,tetFaceI, tetPtI,td.cloud().dP2_,td.cloud().UP2_);
try
Code:

solidParticle* pPtr2=new solidParticle(mesh_,td.cloud().posP2_,cellI,tetFaceI,tetPtI,td.cloud().dP1_,td.cloud().UP2_);
Hope it helps.

Regards,
Alex

Hi! Alex.
Thank you very much! It works. :)

willzyba September 16, 2014 06:10

Seeding the Domain with Particles - Corrupt double-linked list error
 
Hi,

Can anyone help me to understand why this following does not work. We essentially followed the instructions in http://www.tfd.chalmers.se/~hani/kur...LPT_120911.pdf

except that we want to initiate the domain with a cloud of points evenly space throughout a chosen part. We've added to solidParticleCloud.C the following:

Code:

void Foam::solidParticleCloud::seed(const dimensionedVector& g)
{
    // http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2011/OF_kurs_LPT_120911.pdf

    const vector offset((endCorner_.x() - startCorner_.x())/(nPoints_.x() - 1),
                        (endCorner_.y() - startCorner_.y())/(nPoints_.y() - 1),
                        (endCorner_.z() - startCorner_.z())/(nPoints_.z() - 1) );
 
    int Nz= int(nPoints_.z());
    int Ny= int(nPoints_.y());
    int Nx= int(nPoints_.x());

    // Hope this produces a line of particle points.
    for(int k=0; k<Nz; k++)
    {
        for(int j=0; j<Ny; j++)
        {
            for(int i=0; i<Nx; i++)
            {
                vector pos(startCorner_.x() + offset.x()*i,
                          startCorner_.y() + offset.y()*j,
                          startCorner_.z() + offset.z()*k );

                label cellI =-1;
                label tetFaceI =-1;
                label tetPtI = -1;
                mesh_.findCellFacePt(pos, cellI, tetFaceI, tetPtI);
                if(cellI>0)
                {
                    solidParticle* pt= new solidParticle(mesh_, pos ,cellI, tetFaceI, tetPtI, 0.01, vector::zero );
                    Cloud<solidParticle>::addParticle(pt);
                }
            }
        }
    }
}

We then add to our main IcoFoam package the necessary headers and
Code:

solidParticleCloud particles(mesh);
particles.seed(g);

Ignoring the ugly vector maths, this works. I get a great cloud of point, the CFD runs through to the end. However on both a single thread and multi threaded environment I get the following on exit
Code:

*** glibc detected *** waveFoamLPT: corrupted double-linked list: 0x0000000000c02a50 ***
Google around this, it appear that the most likely offender is that our newly created particles are being deleted twice when the code cleans up at the end. I had though it might not be being cleaned at all, so we did add our own code to delete, but that didn't help.

Any thoughts greatly appreciated.

Will

vonboett November 4, 2014 08:17

interFoam: lagrangian particle tracking method by swak4Foam
 
Quote:

Originally Posted by nero235 (Post 452045)
Hello Alex,

thank you for your help! I will try this as soon I have some time for it :). However I found another way to couple interfoam with a lagrangian particle tracking method, which is by including swak4Foam libraries into your controlDict.

Thanks for the help!

Greetings, Sebastian


Hi Sebastian,

did that work well? Could you share some experience about coupling lagrangian particle tracking using swak4Foam? I used to run coupling via CFDEM to LIGGGHTS, but now I want to model a tracer injected to my turbulent interFoam simulation, and therefore I need only a one-way coupling and thaught, swak4Foam would be the solution. I tried aswell interMixingFoam but thats not a good solution for many reasons...

nero235 November 4, 2014 09:52

Quote:

Originally Posted by vonboett (Post 517316)
Hi Sebastian,

did that work well? Could you share some experience about coupling lagrangian particle tracking using swak4Foam? I used to run coupling via CFDEM to LIGGGHTS, but now I want to model a tracer injected to my turbulent interFoam simulation, and therefore I need only a one-way coupling and thaught, swak4Foam would be the solution. I tried aswell interMixingFoam but thats not a good solution for many reasons...

Hello Albrecht,

yes the solid particle tracking worked really good with interFoam. At first I encountered a problem however: the particle wasn't affected by gravity in swak4Foam 0.2.4 but there's a fix for that (see the other threats about LPT on my page).

What you need is a swak4Foam installation and a modified controlDict where you add these following lines:

Code:

libs
(
    "libsimpleFunctionObjects.so"
    "libsimpleLagrangianFunctionObjects.so"
    "libswakLagrangianCloudSourcesFunctionPlugin.so"
    "libswakFunctionObjects.so"
);

functions
{
    rho
    {
        type expressionField;
        expression "1000";
        fieldName rho;
        autowrite true;
    }
    mu
    {
        type expressionField;
        expression "(1e-6)*rho";
        fieldName mu;
        autowrite true;
    }
    Particle
    {
        type evolveKinematicCloud;
        cloudName ParticleCloud;
        //only necessary if solver doesn't consider gravity
        //g "down" [0 1 -2 0 0 0 0] (0 0 -9.81);
        rhoName rho;
        muName mu;
        UName U;
    }
}

And you need the file
Code:

./constant/ParticleCloudProperties
with the following contents:

Code:

solution
{
    active        on;
    coupled        false;
    transient    true;
    cellValueSourceCorrection    on;

    interpolationSchemes
    {
        rho    cell;
        mu    cell;
        U    cellPoint;
    }

    sourceTerms
    {
        schemes
        {
            rho    explicit 1;
            U    explicit 1;
        }
    }

    integrationSchemes
    {
        U    Euler;
    }
}

constantProperties
{
    parcelTypeId    1;
    rhoMin          1e-15;
    minParticleMass  1e-15;
    rho0            750;
    epsilon0        10;
    Pr              0.7;
    pMin            0;
    constantVolume  1;
    youngsModulus    1e9;
    poissonsRatio    0.35;
}

subModels
{
    particleForces
    {
        gravity;
        sphereDrag;
    }

    injectionModels
    {
        model1
        {
            type            manualInjection;
            massTotal      0.3927e-3;
            parcelBasisType mass;
            nParticle      1;
            SOI            0;
            positionsFile  "tracerParticlePositions";
            U0              (0 0 0);
            sizeDistribution
            {
                type        fixedValue;
                fixedValueDistribution
                {
                    //diameter
                    value  1e-2;
                }
            }
        }
    }

    dispersionModel none;
    patchInteractionModel standardWallInteraction;
    heatTransferModel none;
    radiation off;
    surfaceFilmModel none;

    standardWallInteractionCoeffs
    {
        type    stick;
    }
}

cloudFunctions
{
    particleTracks
    {
        trackInterval  1;
        maxSamples      1000000;
        resetOnWrite    yes;
    }
}

Depending on your injection model (here it was manual injection) you may need a file where the initial positions of you particles are listed. Hope this helps!

Regards, Sebastian

vonboett November 4, 2014 14:51

That is really quick and precise help, thank you!
It really helps because I can get things started so fast I can present them on the startup-meeting this week!

sophie_l January 11, 2015 06:20

Hello,

I'm working on the coupling of interFoam and solidParticle as well. The solver works well in serial. It runs in parallel as well, and the fluid phase behaves, however, the results of the solid phase are not reasonable, let alone resemble those produced in serial run. So there must be something wrong with the parallelisation of solidParticle, it runs without error message though. I checked the output, origId of the particles are all -1 at every time step. I suspect this might be the reason, however I didn't manage to get origId right, let alone to know whether this is the reason to the problem. Could you shed some light on this please? Any thoughts would be much appreciated!

Thanks in advance.
Sophie

luchen2408 February 5, 2015 20:33

hello, sebastian,
what is the sequence of running command? is it that first run the simulation with interFoam then modify the file and go on performing the simulation after some time to add the particles
or just perform the simulation with the new controldict file to add the particles at the start? Thanks

nero235 February 6, 2015 03:29

Quote:

Originally Posted by luchen2408 (Post 530637)
hello, sebastian,
what is the sequence of running command? is it that first run the simulation with interFoam then modify the file and go on performing the simulation after some time to add the particles
or just perform the simulation with the new controldict file to add the particles at the start? Thanks

Hello luchen2408,

you just run interFoam like always, just make sure you have a working swak4Foam installation. The coupled lagrangian particle libraries will do the rest. Depending on your injection model, the particles will be injected through the inlet or will be inserted into the field manually (automatic injection by the libraries) after some time. You will see that in the solver log, which will differ from a normal interFoam run.

Depending on the coupling (1-way, 2-way) the velocity field will be calculated by interFoam and then the particle path will be estimated through the libraries. After this step the new velocity field will be calculated (1-way) or the last fluid velocity field will be recalculated (2-way).

Regards, Sebastian

luchen2408 May 28, 2015 03:48

hello, sebastian,
I have successfully performed the simulation with particles, but the result looks unreasonable, I set the wall as "stick" boundary, but the from the result, the particle will not stick to the wall and it will flow in the domain. Do you have the problem? Besides, I found the gravity seems didn't act on the particles. what about your result?

nero235 May 28, 2015 04:01

Quote:

Originally Posted by luchen2408 (Post 547970)
hello, sebastian,
I have successfully performed the simulation with particles, but the result looks unreasonable, I set the wall as "stick" boundary, but the from the result, the particle will not stick to the wall and it will flow in the domain. Do you have the problem?

Hi,

maybe your particle is not really at the wall for the boundary condition to apply. Since the LPT model treats every particle as "mass point", forces only act on the center of the particle. If the particle center is away from the wall, and only the virtual particle surface touches the wall, the stick boundary condition won't apply. So, you really have to be at the wall with the center point of your particle.

Hope this helps. Regards, Sebastian

luchen2408 May 28, 2015 21:47

hi,sebastian,
Thanks for your reply. Then what can I do to solve the problem?
Besides, I think the gravity seems doesn't act on the particles.
For understanding the problem better, I will introduce the problem and post my initial file.
For the test simulation, I took state solver simpleFoam and introduce the liquid particles after 50 iterations.
The particlecloudpropeties as follows:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object ParticleCloudProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solution
{
active yes;
transient no; // yes;
calcFrequency 50;
maxTrackTime 3600;
// maxCo 0.3;

coupled false;
cellValueSourceCorrection off;

sourceTerms
{

schemes
{
rho semiImplicit 1;
U semiImplicit 1;
}
}

interpolationSchemes
{
rho cell;
U cellPoint;
mu cell;

}

integrationSchemes
{
U Euler;
}
}


constantProperties
{
rho0 735;
mu0 0.000774;

constantVolume true;
}


subModels
{
particleForces
{
sphereDrag;
gravity;
}

injectionModels
{
model1
{
type patchInjection;
massFlowRate 0.8e-03;
parcelBasisType mass;
patchName InletN1B;
parcelsPerSecond 100;
duration 1; // NOTE: set to 1 for steady state
U0 (0 0 -22.99);
flowRateProfile constant 1;
sizeDistribution
{
type fixedValue;
fixedValueDistribution
{
value 0.0001;
}
}
}

}

dispersionModel none;

// patchInteractionModel standardWallInteraction;
patchInteractionModel localInteraction;

heatTransferModel RanzMarshall;

compositionModel none;

phaseChangeModel none;

devolatilisationModel none;

surfaceReactionModel none;

stochasticCollisionModel none;

surfaceFilmModel none;

radiation off;

// standardWallInteractionCoeffs
// {
// type rebound;
// }

localInteractionCoeffs
{
patches
(
InletN1B
{
type rebound;
// e 0.97;
// mu 0.09;
}
InletN1Bwall
{
type rebound;
// e 0.97;
// mu 0.09;
}
Walls
{
type stick;
}
Outlet
{
type escape;
}
);
}

RanzMarshallCoeffs
{
BirdCorrection off;
}

}


cloudFunctions
{
patchPostProcessing1
{
type patchPostProcessing;
maxStoredParcels 100;
patches ( Outlet );
}

particleTracks1
{
type particleTracks;
trackInterval 5;
maxSamples 1000000;
resetOnWrite yes;
}
}


// ************************************************** *********************** //

The controlDict as follows:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application simpleFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1000;

deltaT 1;

writeControl timeStep;

writeInterval 500;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{
InletN1B
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl timeStep;
outputInterval 1;
log true;
valueOutput false;
source patch;
sourceName InletN1B;
operation sum;
// weightField alpha.air;
fields
(
phi
);
}
Outletair
{
type faceSource;
functionObjectLibs ("libfieldFunctionObjects.so");
enabled true;
outputControl timeStep;
outputInterval 1;
log true;
valueOutput false;
source patch;
sourceName Outlet;
operation sum;
// weightField alpha.air;
fields
(
phi
);
}

}

libs
(
"libsimpleFunctionObjects.so"
"libsimpleLagrangianFunctionObjects.so"
"libswakLagrangianCloudSourcesFunctionPlugin.s o"
"libswakFunctionObjects.so"
);

functions
{
rho
{
type expressionField;
dimension [1 -3 0 0 0 0 0];
expression "735";
fieldName rho;
autowrite true;
}
mu
{
type expressionField;
dimension [1 -3 0 0 0 0 0];
expression "0.000774";
fieldName mu;
autowrite true;
}
Particle
{
type evolveKinematicCloud;
cloudName ParticleCloud;
//only necessary if solver doesn't consider gravity
g "down" [0 1 -2 0 0 0 0] (0 0 -9.81);
rhoName rho;
muName mu;
UName U;
}
}


// ************************************************** *********************** //

so, I found all the particles will be introduced into the domain, and they seems don't have gravity and they will not stick to the wall. Do you konw the reason? and how can I solve the problem. Thanks


luchen2408 June 4, 2015 21:04

hello, sebasetian,
do you know the different of the evolvesolidparticleCloud and evolveKinematicCloud in swak4foam? I think they have differet constantproperties in the partilesproperties file.

nero235 June 5, 2015 03:34

Quote:

Originally Posted by luchen2408 (Post 548954)
hello, sebasetian,
do you know the different of the evolvesolidparticleCloud and evolveKinematicCloud in swak4foam? I think they have differet constantproperties in the partilesproperties file.

Hello,

I suggest you compare the appropriate files in
Code:

./swak4Foam/Libraries/simpleLagrangianFunctionObjects/
to find out the differences between the different could types.

Regards, Sebastian

vonboett August 10, 2015 06:46

OK, to have more possibilities to control the IO of the particles (write out particle positions in higher frequency than the fluid Fields) I implemented kinematicCloud and particleCloud in pimpleFoam based on icoUncoupledKinematicParcelFoam and checked with swack4foam that it gives the same results in parallel.
However, now trying the two-way coupling with interFoam according to http://www.tfd.chalmers.se/~hani/kur...LPT_120911.pdf I run into the same troubles. Is there someone still working with interFoam & solidParticles willing to help?

Mahdi2010 August 10, 2015 07:13

What exactly is your problem while coupling interFoam and solidParticles?

vonboett August 11, 2015 05:20

Dear Mahdi,

when I include the line
+particles.momentumSource()
in the UEqn.H, for example in the momentum predictor, it causes either overflow
in solidParticleCloudI.H in solidParticleCloud::momentumSource()
at: tsource().internalField() = -smom_/(mesh_.time().deltaT().value()*mesh_.V());
or if I limit that with min() and max() functions, I still get an Foam::sigSegv::sigHandler(int) error in UEqn.H
Whithout two-way coupling it looks OK but that I can do better with particleCloud or kinematicCloud anyway.

I am happy for any hint...

Mahdi2010 August 11, 2015 05:26

Quote:

Originally Posted by vonboett (Post 559061)
Dear Mahdi,

when I include the line
+particles.momentumSource()
in the UEqn.H, for example in the momentum predictor, it causes either overflow
in solidParticleCloudI.H in solidParticleCloud::momentumSource()
at: tsource().internalField() = -smom_/(mesh_.time().deltaT().value()*mesh_.V());
or if I limit that with min() and max() functions, I still get an Foam::sigSegv::sigHandler(int) error in UEqn.H
Whithout two-way coupling it looks OK but that I can do better with particleCloud or kinematicCloud anyway.

I am happy for any hint...

What is your dt and minimum grid spacing (dx)?
I guess it might be due to very small dt times dx in the denominator of momentum source resulting very large values.

vonboett August 11, 2015 05:46

OK I am one step further:

The overflow was caused by competing names for rhoInf and rho, changing
volScalarField rhoInf
(
IOobject
(
"rho",
to
IOobject
(
"rhoInf",
solved that. But now I have a temporary deallocation error solving UEqn.H, which seems to raise from a difference in treating boundary conditions in OF2.3

pnovo September 28, 2015 11:50

I hope this thread is still under active visiting and guess many of you have successfully coupled particle flow in interFoam. However, I am interested in coupling of the solidParticle, as described by the tutorial by Ms. Vallier (here and here), using icoFoam for cases of incompressible laminar flow. When I try to compile I get :

Code:

icoFoam.C: In function ‘int main(int, char**)’:
icoFoam.C:112:18: error: ‘g’ was not declared in this scope
  particles.move(g);

Could you tell me why is g not defined (or maybe included?) ? Not sure if and which additional information is required...

Thank you


All times are GMT -4. The time now is 02:10.