|
[Sponsors] |
Finding moving equation of parcel in icoLagrangianFoam |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 30, 2022, 01:00 |
Finding moving equation of parcel in icoLagrangianFoam
|
#1 |
New Member
Truong
Join Date: Mar 2022
Posts: 3
Rep Power: 4 |
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! |
|
March 31, 2022, 04:29 |
|
#2 |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 |
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. |
|
March 31, 2022, 04:37 |
|
#3 | |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 |
Quote:
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. |
||
March 31, 2022, 05:58 |
|
#4 |
New Member
Truong
Join Date: Mar 2022
Posts: 3
Rep Power: 4 |
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; } } } 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 hope that you could clarify this problem for me. Thank you very much! |
|
April 4, 2022, 08:19 |
|
#5 |
Senior Member
Josh Williams
Join Date: Feb 2021
Location: Scotland
Posts: 113
Rep Power: 5 |
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 |
|
April 4, 2022, 12:01 |
|
#6 |
New Member
Truong
Join Date: Mar 2022
Posts: 3
Rep Power: 4 |
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 |
|
Tags |
foamextend-4.0, icolagrangianfoam, lagrange |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Domain Reference Pressure and mass flow inlet boundary | AdidaKK | CFX | 75 | August 20, 2018 06:37 |
Moving mesh in Fluent | fivos | FLUENT | 0 | April 2, 2010 10:45 |
Derivation of Momentum Equation in Integral Form | Demonwolf | Main CFD Forum | 2 | October 29, 2009 20:53 |
moving grid_temperature equation | George | Main CFD Forum | 2 | October 6, 2005 20:39 |
moving cylinder | blur boy | Main CFD Forum | 4 | October 12, 2001 06:32 |