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

Finding moving equation of parcel in icoLagrangianFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By joshwilliams

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2022, 00:00
Default Finding moving equation of parcel in icoLagrangianFoam
  #1
New Member
 
Truong
Join Date: Mar 2022
Posts: 3
Rep Power: 4
DVTruong is on a distinguished road
Hi everyone,

I am a new foamer and I have a problem when adding electrical force in icoLagrangianFoam. It seems that there is no relation between void Foam::Cloud<ParticleType>::move(TrackingData& td) described in kinematicCloud.evolve() with moving equations of parcel.
Could anyone help me find the class that contains equations of parcel.

Thank you very much!
DVTruong is offline   Reply With Quote

Old   March 31, 2022, 03:29
Default
  #2
Senior Member
 
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 112
Rep Power: 5
joshwilliams is on a distinguished road
Hi Truong.



Particle equations of motion are found in $FOAM_SRC/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C (at least for OpenFOAM 6 anyway). Then in there, there is a function Foam::KinematicParcel<ParcelType>::calcVelocity. This function calculates the velocity increment based on the explicit and implicit forces acting on the particle:
Code:
    // Shortcut splitting assuming no implicit non-coupled force ...
    // Calculate the integration coefficients
    const vector acp = (Fcp.Sp()*td.Uc() + Fcp.Su())/massEff;
    const vector ancp = (Fncp.Su() + Su)/massEff;
    const scalar bcp = Fcp.Sp()/massEff;

Then the velocity increment is computed



Code:
    // Integrate to find the new parcel velocity
    const vector deltaU = cloud.UIntegrator().delta(U_, dt, acp + ancp, bcp);
    const vector deltaUncp = ancp*dt;
    const vector deltaUcp = deltaU - deltaUncp;

    // Calculate the new velocity and the momentum transfer terms
    vector Unew = U_ + deltaU;

There is a lot of templating, so it can take a while of following code to find where various properties are actually computed.
joshwilliams is offline   Reply With Quote

Old   March 31, 2022, 03:37
Default
  #3
Senior Member
 
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 112
Rep Power: 5
joshwilliams is on a distinguished road
Quote:
Originally Posted by joshwilliams View Post
Particle equations of motion are found in $FOAM_SRC/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C (at least for OpenFOAM 6 anyway).
I should add that this is of course based on whichever force submodels you apply to the particle. For example, drag, lift, gravity etc found in
Code:
$FOAM_SRC/lagrangian/intermediate/submodels/Kinematic/ParticleForces

So for your electrical force, you should probably begin by copying one of the classes in this directory that best matches what you want to, and modify it from there.
DVTruong likes this.
joshwilliams is offline   Reply With Quote

Old   March 31, 2022, 04:58
Default
  #4
New Member
 
Truong
Join Date: Mar 2022
Posts: 3
Rep Power: 4
DVTruong is on a distinguished road
Dear Josh Williams,

Thank you very much for your reply. You have provided me with valuable information.
I am a new foamer so it is helpful for me If you guide me how the function calcVelocity() in KinematicParcel.C related to function move(TrackingData& td) in CloudTemplate.C
Code:
void Foam::Cloud<ParticleType>::move(TrackingData& td)
{
    addProfile2(moveProfile,"Cloud<ParticleType>::move_"+this->name());

    const globalMeshData& pData = polyMesh_.globalData();
    const labelList& processorPatches = pData.processorPatches();
    const labelList& processorPatchIndices = pData.processorPatchIndices();
    const labelList& processorPatchNeighbours =
        pData.processorPatchNeighbours();

    // Initialise the setpFraction moved for the particles
    forAllIter(typename Cloud<ParticleType>, *this, pIter)
    {
        pIter().stepFraction() = 0;
    }

    // Assume there will be particles to transfer
    bool transfered = true;

    // While there are particles to transfer
    while (transfered)
    {
        // List of lists of particles to be transfered for all the processor
        // patches
        List<IDLList<ParticleType> > transferList(processorPatches.size());

        // Loop over all particles
        forAllIter(typename Cloud<ParticleType>, *this, pIter)
        {
            ParticleType& p = pIter();

            // Move the particle
            bool keepParticle = p.move(td);

            // If the particle is to be kept
            // (i.e. it hasn't passed through an inlet or outlet)
            if (keepParticle)
            {
                // If we are running in parallel and the particle is on a
                // boundary face
                if (Pstream::parRun() && p.facei_ >= pMesh().nInternalFaces())
                {
                    label patchi = pMesh().boundaryMesh().whichPatch(p.facei_);
                    label n = processorPatchIndices[patchi];

                    // ... and the face is on a processor patch
                    // prepare it for transfer
                    if (n != -1)
                    {
                        p.prepareForParallelTransfer(patchi, td);
                        transferList[n].append(this->remove(&p));
                    }
                }
            }
            else
            {
                deleteParticle(p);
            }
        }

        if (Pstream::parRun())
        {
            \\ something here
        }
        else
        {
            transfered = false;
        }
    }
}
This function is contained in function "kinematicCloud.evolve()" of icoLagrangianFoam.C
Code:
Info<< "Evolving kinematicCloud" << endl;
        kinematicCloud.evolve();
        kinematicCloud.info();

        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
            ==
            kinematicCloud.SU()/rho
        );

        solve(UEqn == -fvc::grad(p));
I think the move() function in "kinematicCloud.evolve()" is used to calculate the position of parcel, but I cannot find this relation between move() function and calcVelocity() function.

I hope that you could clarify this problem for me.
Thank you very much!
DVTruong is offline   Reply With Quote

Old   April 4, 2022, 07:19
Default
  #5
Senior Member
 
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 112
Rep Power: 5
joshwilliams is on a distinguished road
Hi Truong,


I remember trying to find this myself a year ago roughly. I think the relationship between kinematicCloud and kinematicParcel classes are very heavily templated and abstracted so it is a bit tricky to understand. But, I would say if you are simply adding an electrical force, you do not need to worry about this. You just simply copy a particle force template and modify it for your electrical force, no?


Best,
Josh
joshwilliams is offline   Reply With Quote

Old   April 4, 2022, 11:01
Default
  #6
New Member
 
Truong
Join Date: Mar 2022
Posts: 3
Rep Power: 4
DVTruong is on a distinguished road
Hi Josh,

Thank you very much for your reply.
I got the link between KinematicCloud and KinematicPacel as you instructed me.

I have another problem and it is very kind if you could help me solve it.
I want to modify the calcVelocity function in KinematicParcel.C because this function controls the particle motion in move() function of CloudTemplate.C.
If you could remember this problem, please give me details for solving it.

Thank you very much once more time!

Best,
Truong
DVTruong is offline   Reply With Quote

Reply

Tags
foamextend-4.0, icolagrangianfoam, lagrange


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Domain Reference Pressure and mass flow inlet boundary AdidaKK CFX 75 August 20, 2018 05:37
Moving mesh in Fluent fivos FLUENT 0 April 2, 2010 09:45
Derivation of Momentum Equation in Integral Form Demonwolf Main CFD Forum 2 October 29, 2009 19:53
moving grid_temperature equation George Main CFD Forum 2 October 6, 2005 19:39
moving cylinder blur boy Main CFD Forum 4 October 12, 2001 05:32


All times are GMT -4. The time now is 08:39.