|
[Sponsors] |
Lagrangian data - particle velocity post processing |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 8, 2019, 11:14 |
Lagrangian data - particle velocity post processing
|
#1 |
New Member
Kevin
Join Date: May 2018
Posts: 6
Rep Power: 8 |
Hi everyone,
i am doing LES and i just added lagrangian particles to pimpleFoam (openfoam 7). But now i am struggeling with the post processing, which isn't as easy as I thought/expected. I am able to see the lagrangian data in paraView. But i have no idea how to sample the particle velocity to get (for example) an axial particle velocity profile. Additionally i need the average of the particle velocity, what could be done easily in the controlDict if i have a field. So what i need is a field of the particle velocity with that i am able to create the time average. In the Cloudfunction "VoidFraction" (VoidFraction.C) there is lagrangian data "written in a field" i guess. --> theta[p.cell()] += dt*p.nParticle()*p.volume(); So i have tried to do it the same way and edit the VoidFraction cloudfunction with this or something similar --> Uparticle[p.cell()] += dt*mag(p.U()); but this didnt work properly. The solver compiles but the magnitude of the velocity of the created field is much too high (about 10⁹). I think there is something wrong in the transfer of the "point" velocity to the "cell" velocity. Does anyone have any idea how this could work? I'm not sure this is the right way. Maybe someone has a better idea to sample the particle velocity at any position? Is there an existing CloudFunction which can be used for that? Thanks in advance |
|
November 11, 2019, 06:01 |
|
#2 |
Senior Member
Join Date: Aug 2014
Location: UK
Posts: 213
Rep Power: 13 |
Have you tried using 'calculate' to acquire p.U(component) and 'integrate variables' in ParaView?
|
|
November 13, 2019, 07:35 |
|
#3 | |
New Member
Kevin
Join Date: May 2018
Posts: 6
Rep Power: 8 |
Quote:
I created a new vector field 'UPar' in the file KinematicCloudI.H similar to the given scalar field 'theta'. Additionally i created a scalar field of the particles sum 'SumPar' (=parcels sum). I need this field because it is possible that one cell contains more than one particle and then the averaged velocity is calculated. Code:
template<class CloudType> inline const Foam::tmp<Foam::volVectorField> Foam::KinematicCloud<CloudType>::UPar() const { tmp<volVectorField> tUPar ( volVectorField::New ( this->name() + ":UPar", mesh_, dimensionedVector(dimVelocity, vector(0,0,0)), extrapolatedCalculatedFvPatchVectorField::typeName ) ); volVectorField& UPar = tUPar.ref(); forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) { const parcelType& p = iter(); const label celli = p.cell(); UPar[celli] += (p.U())/(p.nParticle()); } UPar.primitiveFieldRef() /= 1;//mesh_.V(); UPar.correctBoundaryConditions(); return tUPar; } template<class CloudType> inline const Foam::tmp<Foam::volScalarField> Foam::KinematicCloud<CloudType>::SumPar() const { tmp<volScalarField> tSumPar ( volScalarField::New ( this->name() + ":SumPar", mesh_, dimensionedScalar(dimless, 0), extrapolatedCalculatedFvPatchScalarField::typeName ) ); volScalarField& SumPar = tSumPar.ref(); forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) { const parcelType& p = iter(); const label celli = p.cell(); SumPar[celli] += p.nParticle(); } SumPar.primitiveFieldRef() /= 1;//mesh_.V(); SumPar.correctBoundaryConditions(); return tSumPar; } Code:
volScalarField SumParTemp=(kinematicCloud.SumPar())(); volVectorField UParTemp=(kinematicCloud.UPar())(); forAll(mesh.C(), i) { if(SumParTemp[i]>0) { UPar[i] = UParTemp[i]/SumParTemp[i]; } else { UPar[i] = UParTemp[i]; } } UPar.correctBoundaryConditions(); SumPar = kinematicCloud.SumPar(); SumPar.correctBoundaryConditions(); This solution seems to be very good for my investigations. Nevertheless, if you have suggestions for improvement, I would be happy if you share them. |
||
March 3, 2020, 03:55 |
|
#4 | |
New Member
CHEUNG WING KI
Join Date: May 2017
Posts: 16
Rep Power: 9 |
Quote:
This is very helpful, may I ask where did you put the second code in pimpleLPT.C? I added it below the "parcels.evolve" within the runTime.run loop and it didn't work. Thanks, RIck |
||
March 3, 2020, 04:17 |
|
#5 |
New Member
Kevin
Join Date: May 2018
Posts: 6
Rep Power: 8 |
Hi Rick,
I put it in the same place. Within the runtime loop and outside the pimple loop. Maybe you can try it without the temporary fields and the particle sum in a first step. Just add a velocity vectorfield "UPar2" in the createFieldsDict and then add this below the .evolve in your pimpleLPT.C file: Code:
UPar2 = kinematicCloud.UPar(); |
|
March 3, 2020, 09:41 |
|
#6 | |
New Member
CHEUNG WING KI
Join Date: May 2017
Posts: 16
Rep Power: 9 |
Quote:
Yes I think the code in .C file is fine but I still haven't figured out where the problems are, could you post your createFields.H? It would be very appreciated. Cheers, Rick |
||
March 3, 2020, 10:27 |
|
#7 |
New Member
CHEUNG WING KI
Join Date: May 2017
Posts: 16
Rep Power: 9 |
I think I should post my error message here:
|
|
March 3, 2020, 11:13 |
|
#8 |
New Member
Kevin
Join Date: May 2018
Posts: 6
Rep Power: 8 |
It could be the name of your Cloud (.evolve)
The name of my kinematicCloud is kinematicCloud. This is my evolve in the .C file: Code:
kinematicCloud.evolve(); Code:
const word kinematicCloudName ( args.optionLookupOrDefault<word>("cloudName", "kinematicCloud") ); Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; basicKinematicCollidingCloud kinematicCloud ( kinematicCloudName, rho, U, mu, g ); |
|
March 3, 2020, 12:19 |
|
#9 | |
New Member
CHEUNG WING KI
Join Date: May 2017
Posts: 16
Rep Power: 9 |
Quote:
Thank you it successfully compiled. However I tested it with some cases it ended up like another error, it's like there are problems in dimension:, and my createFields.H is of attachment. Cheers, Rick |
||
March 3, 2020, 12:20 |
|
#10 |
New Member
CHEUNG WING KI
Join Date: May 2017
Posts: 16
Rep Power: 9 |
Sorry, I forgot to attach the image, there is it.
|
|
March 4, 2020, 04:14 |
|
#11 |
New Member
CHEUNG WING KI
Join Date: May 2017
Posts: 16
Rep Power: 9 |
After I correct some minor syntax mistakes and make some declaration in source code files, now it works perfectly now.
Thank you Kevin |
|
August 16, 2020, 08:24 |
|
#12 |
New Member
Join Date: Nov 2019
Posts: 5
Rep Power: 7 |
Dear Cheung Wing Ki
I also tried to create a scalar field of the particles sum (particle number per unit volume) I followed Kevin's codes and tried to compile kinematicCloudI.H Code:
template<class CloudType> inline const Foam::tmp<Foam::volScalarField> Foam::KinematicCloud<CloudType>::SumPar() const { tmp<volScalarField> tSumPar ( volScalarField::New ( this->name() + ":SumPar", mesh_, dimensionedScalar(dimless, 0), extrapolatedCalculatedFvPatchScalarField::typeName ) ); volScalarField& SumPar = tSumPar.ref(); forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) { const parcelType& p = iter(); const label celli = p.cell(); SumPar[celli] += p.nParticle(); } SumPar.primitiveFieldRef() /= mesh_.V(); // 1; SumPar.correctBoundaryConditions(); return tSumPar; } KinematicCloud.H Code:
inline const tmp<volScalarField> rhoEff() const; inline const tmp<volScalarField> SumPar() const; intL4Foam.C: In function ‘int main(int, char**)’: intL4Foam.C:188:9: error: ‘SumPar’ was not declared in this scope SumPar = kinematicCloud.SumPar(); ^~~~~~ intL4Foam.C:188:33: error: ‘Foam::basicKinematicCollidingCloud {aka class Foam::CollidingCloud<Foam::KinematicCloud<Foam::Cl oud<Foam::CollidingParcel<Foam::KinematicParcel<Fo am:article> > > > >}’ has no member named ‘SumPar’ SumPar = kinematicCloud.SumPar(); ^~~~~~ Does anybody can help me? Thank you |
|
August 16, 2020, 08:54 |
|
#13 |
New Member
Join Date: Nov 2019
Posts: 5
Rep Power: 7 |
I tried to get particle density output per volume
Add code in kinematicCloud.H, kinematicCloudI.H, main.C file and createFields.H And got following error messages.. Anybody please can help me? Thank you |
|
October 16, 2024, 14:14 |
|
#14 |
New Member
Join Date: Nov 2019
Posts: 5
Rep Power: 7 |
reply to me
both kinematicCloud.H and KinematicCloudl.H are in two locations |
|
Tags |
lagrangian data, large eddy simulation, post processing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] Plotting velocity of Lagrangian particle over time/direction | thintn222 | ParaView | 0 | April 25, 2019 22:43 |
How to create velocity profile for falling ball in fluent CFD post processing | valr | FLUENT | 2 | June 13, 2018 07:18 |
Exporting Particle Data | prX411 | CFX | 4 | April 3, 2018 13:00 |
Post processing of Lagrangian particle field | marialhm | OpenFOAM Post-Processing | 0 | October 8, 2017 23:02 |
Post processing data | zz744 | FLUENT | 0 | February 19, 2014 07:35 |