CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Verification & Validation (http://www.cfd-online.com/Forums/openfoam-verification-validation/)
-   -   Validation of swak4Foam for lagrangian particle tracking (http://www.cfd-online.com/Forums/openfoam-verification-validation/123764-validation-swak4foam-lagrangian-particle-tracking.html)

nero235 September 20, 2013 07:38

Validation of swak4Foam for lagrangian particle tracking
 
1 Attachment(s)
Hello,

I am simulating several different multiphase flow regimes, consisting of 3 phases with multiphaseInterFoam. Additionally I need to inject a particle (not massless) to the flow and track it as it moves. I found that this can be done using swak4Foam libraries to add LPT (lagrangian particle tracking) methods to any solver. I set up several test cases, combining interFoam and swak4Foam with success.

However I need to validate this method in order to know if the calculated particle trajectory is physically correct. For this I have set up a 3D test case of a rectangular domain filled with air. A particle will be injected at the bottom of the domain with an initial velocity (in x and z-direction). Gravity is acting in negative z-direction. I am using interFoam for the calculation of the continuous phase and swak4Foam for the uncoupled particle tracking.

The result of this simulation should be a parabolic particle trajectory. However it seems that there is no gravity acting on the particle. Therefor the particle trajectory is linear.

I have uploaded my validation case in the hope somebody can tell me why the gravity is not considered here.

Thanks in advance!

Sebastian

gschaider September 20, 2013 08:42

Quote:

Originally Posted by nero235 (Post 452720)
Hello,

I am simulating several different multiphase flow regimes, consisting of 3 phases with multiphaseInterFoam. Additionally I need to inject a particle (not massless) to the flow and track it as it moves. I found that this can be done using swak4Foam libraries to add LPT (lagrangian particle tracking) methods to any solver. I set up several test cases, combining interFoam and swak4Foam with success.

However I need to validate this method in order to know if the calculated particle trajectory is physically correct. For this I have set up a 3D test case of a rectangular domain filled with air. A particle will be injected at the bottom of the domain with an initial velocity (in x and z-direction). Gravity is acting in negative z-direction. I am using interFoam for the calculation of the continuous phase and swak4Foam for the uncoupled particle tracking.

The result of this simulation should be a parabolic particle trajectory. However it seems that there is no gravity acting on the particle. Therefor the particle trajectory is linear.

I have uploaded my validation case in the hope somebody can tell me why the gravity is not considered here.

Thanks in advance!

Sebastian

The lagrangian particles in swak add no submodels to the particles (basically swak only creates the cloud and at each timestep says "move the way you always move"). So in fact you're verifying the OF lagrangian particles. Haven't got the time to look at the case today. Have you switched on gravity (I think it is in the "forces"-subdict of the cloudDict)?
Anyway: when moving through the fluid the viscosity should also slow down the particle so it should at least come to a stand-still (especially with the high viscosities you usually have in interFoam)

nero235 September 20, 2013 08:57

Quote:

Originally Posted by gschaider (Post 452753)
The lagrangian particles in swak add no submodels to the particles (basically swak only creates the cloud and at each timestep says "move the way you always move"). So in fact you're verifying the OF lagrangian particles. Haven't got the time to look at the case today. Have you switched on gravity (I think it is in the "forces"-subdict of the cloudDict)?
Anyway: when moving through the fluid the viscosity should also slow down the particle so it should at least come to a stand-still (especially with the high viscosities you usually have in interFoam)

Yes, I am using gravity and sphereDrag as body forces. However it doesn't show an effect on the particle trajectory when I change the value of "g" in the controlDict under the particle function.

Here is my particleCloudProperties file:

Code:

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

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

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

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

    integrationSchemes
    {
        U              Euler;
    }
}


constantProperties
{
    parcelTypeId    1;
    rhoMin          1;
    minParticleMass  5.23e-10;
    rho0            2000;
    epsilon0        10;
    Pr              0.7;
    pMin              1;
    constantVolume  true;
    youngsModulus    1e9;
    poissonsRatio    0.35;
}

subModels
{
    particleForces
    {
        gravity;
        sphereDrag;
//        pressureGradient
//        {
//            U U;
//        }
        //virtualMass off;
    }

    injectionModels
    {
        model1
        {
            type            manualInjection;
            massTotal      1.05e-6;
            parcelBasisType mass;
            nParticle      1;
            SOI            0;                //Start Of Injection
            positionsFile  "tracerParticlePositions";
            U0              (0.1 0 0.1);    //the calculated 'linear momentum' is p=m*v
            sizeDistribution
            {
                type        fixedValue;
                fixedValueDistribution
                {
                    value  1e-3;
                }
            }
        }
    }


    dispersionModel none;

    patchInteractionModel standardWallInteraction;

    heatTransferModel none;

    radiation      off;


    standardWallInteractionCoeffs
    {
        type            rebound;
        mu                0;
    }

    surfaceFilmModel none;
}

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


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

and the controlDict

Code:

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

application    interFoam;

startFrom      startTime;

startTime      0;

stopAt          endTime;

endTime        20;

deltaT          0.005;

writeControl    adjustableRunTime;

writeInterval  20;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision  6;

runTimeModifiable yes;

adjustTimeStep  no;

maxCo            1;

maxAlphaCo        1;

maxDeltaT      0.005;


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

functions
{
    mu
    {
        type expressionField;
        expression "1.7894e-5";
        fieldName mu;
        autowrite true;
    }
    Particle
    {
        type evolveKinematicCloud;
        cloudName ParticleCloud;
        g "down" [0 1 -2 0 0 0 0] (0 0 -9.81 );
        rhoName rho;
        muName mu;
        UName U;
    }
}

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

Greetings, Sebastian.

gschaider September 23, 2013 18:59

Quote:

Originally Posted by nero235 (Post 452757)
Yes, I am using gravity and sphereDrag as body forces. However it doesn't show an effect on the particle trajectory when I change the value of "g" in the controlDict under the particle function.

OK. I think I found the problem. The clouds want a reference to the gravity vector. The swak-functionObjects were passing a value ... the cloud took a reference to the temporary value which turned into garbage .... it's painfully obvious once you found it.

Anyway. The fix is just one additional char (it will be in the next release):

Code:

diff --git a/Libraries/simpleLagrangianFunctionObjects/EvolveCloudFunctionObject.H b/Lib
--- a/Libraries/simpleLagrangianFunctionObjects/EvolveCloudFunctionObject.H
+++ b/Libraries/simpleLagrangianFunctionObjects/EvolveCloudFunctionObject.H
@@ -105,7 +105,7 @@
 
    autoPtr<CloudType> &cloud() { return cloud_; }
 
-    const dimensionedVector g() const { return g_; }
+    const dimensionedVector &g() const { return g_; }
 
    const objectRegistry &obr() const { return obr_; }


luchen2408 May 28, 2015 21:05

Dear gschaider,
I also have this problem in my simulation, but I don't konw how to solve it in the simulation. can you explain more about that or give a solution with more details?

nero235 May 29, 2015 03:09

Quote:

Originally Posted by luchen2408 (Post 548098)
Dear gschaider,
I also have this problem in my simulation, but I don't konw how to solve it in the simulation. can you explain more about that or give a solution with more details?

You have to modify the file:
Code:

/home/$USER/OpenFOAM/.../swak4Foam/Libraries/simpleLagrangianFunctionObjects/EvolveCloudFunctionObject.H
Change the line 109 to:
Code:

const dimensionedVector &g() const { return g_; }
Where the "&" is missing. Recompile swak4Foam and it then it should work.

gschaider May 31, 2015 16:21

Quote:

Originally Posted by nero235 (Post 548132)
You have to modify the file:
Code:

/home/$USER/OpenFOAM/.../swak4Foam/Libraries/simpleLagrangianFunctionObjects/EvolveCloudFunctionObject.H
Change the line 109 to:
Code:

const dimensionedVector &g() const { return g_; }
Where the "&" is missing. Recompile swak4Foam and it then it should work.

Which version of swak are you talking about? I just checked in the repository and this is fixed since September 2013 so it should be in the last 2 releases (at least)

luchen2408 May 31, 2015 21:36

Dear Sebastian and Bernhard,
Thanks for your reply, I took the swak version 0.3.1 in which the problem is solved in the code. The "&" is in the code. But the gravity seems doesn't on the particles.

luchen2408 June 2, 2015 01:59

Dear Sebastian and Bernhard,
I have cross checked my code in the ContolDict file.
I found I took the EvolveKinematicCloud, not EvolveCloud and I thinkd I need to modified the EvolveKinematicCloudFunctionObject.H, but there is not codes to adjust as you mentioned, how can I adjust code in the EvolveKinematicCloudFunctionObject.H? Thanks

luchen2408 June 2, 2015 02:12

Dear Sebastian and Bernhard,
You mean I have to remove the "&" and then recompile the swak4foam. Thanks your feedback.


All times are GMT -4. The time now is 04:00.