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 January 21, 2016 08:45

Quote:

Originally Posted by vonboett (Post 581909)
Hi Alex,
the attachment is empty I think...

Aye, my bad! I think it's ok now!

vonboett January 22, 2016 04:18

Thanks Alex!
What I can't understand is how you get two-way coupling when you include the particle momentum neighter in the UEqn nor in the pressure equation, only in the momentum predictor which is just a beginning guess for a desired divergence free velocity field. Any term in the momentum predictor that isn't somwhere in the pressure velocity coupling of the PISO should vanish in the iteration, right?
However, I am fighting with the p_rgh when trying to implement two-way coupling via a source term in the pressure equation...

alexlupo January 22, 2016 07:17

Quote:

Originally Posted by vonboett (Post 582057)
Thanks Alex!
What I can't understand is how you get two-way coupling when you include the particle momentum neighter in the UEqn nor in the pressure equation, only in the momentum predictor which is just a beginning guess for a desired divergence free velocity field. Any term in the momentum predictor that isn't somwhere in the pressure velocity coupling of the PISO should vanish in the iteration, right?
However, I am fighting with the p_rgh when trying to implement two-way coupling via a source term in the pressure equation...

Hi Albrecht,
You're probably right. I compiled this solver for OF22x two years ago just roughly following Aurelia Vallier's instructions and recompiled the same for 23x, since apparently, a common problem seems to be upgrading it to 23x. For two-way coupled simulations I'm currently using either a solver linked to the intermediate library in 22x or DPMFoam in 23x. In there, you implement two-way coupling via a source term in the momentum equation.
I did the course in Chalmers and went over the Lagrangian intermediate library of OF22x two years ago in this link: http://www.tfd.chalmers.se/~hani/kur...ing_report.pdf . It's not the best report but I tried to include as much as I could back then. Not sure if you'll find it useful though!

vonboett February 4, 2016 05:57

4-way coupling of interFOAM to Lagrangian Particle Cloud
 
Hi all,

OK I managed to do the 4way coupling for my version of interMixingFoam in agreement with DPMFoam, and the Goldschmidt test case looks fine. However, I get a shift in phase concentrations where the flow leaves a cell with parcels, and that causes negative concentrations within the phase derived by 1 -first solved phase fraction - second solved phase fraction.
Anyone has an idea about that? I solve the phase transport equations in the alphaEqns the usual way to get my phase-averaged viscosity and density field, but then I create a modified phase-averaged field to account for the particles as alphac = 1.0 - kinematicCloud.theta() and a modified density field rhoc = alphac * rho and the corresponding surfaceScalarFields and rhoPhic to feed into the momentum equation in UEqn.H. The flux phi is calculated in the PISO loop with:

HbyA = rAU*UEqn.H();
surfaceScalarField phiHbyA
(
"phiHbyA"
(fvc::interpolate(HbyA) & mesh.Sf())
+ alphacf*fvc::interpolate(rhoc*rAU)*fvc::ddtCorr(U, phi)
);
adjustPhi(phiHbyA, U, p_rgh);

phiHbyA += phig; //phig contains source terms gravity, drag...

while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_rghEqn
(
fvm::laplacian(alphacf*rAUf, p_rgh) == fvc::div(alphacf*phiHbyA)
);

p_rghEqn.setReference (...);
p_rghEqn.solve(...);
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA - p_rghEqn.flux()/alphacf;
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux()/alphacf)/rAUf);
...
}
}

hojjat.m March 18, 2016 10:04

Particles per cell
 
Hi foamers,

I am using solidParticle class and I am trying to calculate the number of particles in each cell at certain times. I want to combine all of the particles in a cell. Any suggestions?

Thanks,

Ebrahim April 28, 2016 04:34

Hi Everybody,

I'm trying to implement the Aurelia's code in OF 3, but facing some problems in post-processing. For code validation, I simulate the same flow field as Aurelia's (boxLPT), but when I open the results via paraview, I face this warning: " different time directories with the same time value X and Y found. Y will be ignored " (this warning is repeated for about 30 times). Also, I can see just 4 time step data with time intervals equal to 1, while I should have 60 time steps with time intervals of 2.5 e-5 .
If I load the results via parafoam command (instead of paraview), I don't see such a warning. However, only Eulerian data will be loaded!

Any suggestion is appreciated!

chpjz0391 May 12, 2016 02:50

Quote:

Originally Posted by luchen2408 (Post 548102)
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


Hey Luchen,
did you rewrite the solver? I mean did you add the particles track functions to the simpleFoam solver or you just used the given solver by OF?

totalBeginner February 7, 2017 03:59

Quote:

Originally Posted by alexlupo (Post 582080)
Hi Albrecht,
You're probably right. I compiled this solver for OF22x two years ago just roughly following Aurelia Vallier's instructions and recompiled the same for 23x, since apparently, a common problem seems to be upgrading it to 23x. For two-way coupled simulations I'm currently using either a solver linked to the intermediate library in 22x or DPMFoam in 23x. In there, you implement two-way coupling via a source term in the momentum equation.
I did the course in Chalmers and went over the Lagrangian intermediate library of OF22x two years ago in this link: http://www.tfd.chalmers.se/~hani/kur...ing_report.pdf . It's not the best report but I tried to include as much as I could back then. Not sure if you'll find it useful though!

Hey Alex,
I`ve downloaded your files and tried to make them work, but I`m confused. On which case do I use it on? Am I supposed to create my own case using your additionalFiles? I need to use particletracking for the olaFOAM (wave generating) solver, using a given geometry. And I`m desperate for help!
Cheers, Kryss

alexlupo February 7, 2017 09:17

Quote:

Originally Posted by totalBeginner (Post 636206)
Hey Alex,
I`ve downloaded your files and tried to make them work, but I`m confused. On which case do I use it on? Am I supposed to create my own case using your additionalFiles? I need to use particletracking for the olaFOAM (wave generating) solver, using a given geometry. And I`m desperate for help!
Cheers, Kryss

Hi Kryss,

If you need lagrangian particles I would recommend using the tutorial in the Chalmers website. At the end of the report, there is a blockMeshDict for generating a square section elbow on which to run a simple case. You can read through the tutorial and try doing the same in olaFoam. The coupling is fairly easy to achieve. I would recommend that you use the intermediate library because of it's enhanced functionality if compared to solidParticle. There are also other options such as swak4FOAM for adding lagrangian particles. The tutorial on the Chalmers webpage is for OpenFOAM 2.2.x. If you want coupling in, lets say, OF3.0.x, you could have a look at DPMFoam and compare it with pimpleFoam to see what the differences are and how to add the lagrangian library. It's very similar to the tutorial files although with some small changes because of the version.
There is also training about the Lagrangian Intermediate Library here from the last OpenFOAM workshop. There should be a case on which to run the tutorial too. If you still have trouble you can send me a private and I'll try to help you.

tom_flint2012 March 8, 2017 08:06

adding lagrangian particle tracking to multiphaseEulerFoam
 
Hi,

I know this thread has not been touched in a while but I thought someone may be able to help me.

I am trying to implement the lagrangian solid particle tracking described in this thread into the multiphaseeulerfoam solver. I have followed the steps provided and the solver compiles ok.
However, when I attempt to run a case I get an error from the "inject" function through the "move" function.
My inject function is:
Code:


void Foam::solidParticleCloud::inject(solidParticle::trackingData &td)
{

label celli=1;
label tetFacei=1;
label tetPtI=1;
mesh_.findCellFacePt(td.cloud().posP1_, celli, tetFacei, tetPtI);
solidParticle* pPtr1=new solidParticle(mesh_,td.cloud().posP1_,celli,tetFacei,tetPtI,td.cloud().dP1_,td.cloud().UP1_);
Foam::Cloud<solidParticle>::addParticle(pPtr1);

//mesh_.findCellFacePt(td.cloud().posP1_, cellI, tetFaceI, tetPtI);
//solidParticle* pPtr2=new solidParticle(mesh_,td.cloud().posP2_,cellI,tetFaceI,tetPtI,td.cloud().dP2_,td.cloud().UP2_);
//Foam::Cloud<solidParticle>::addParticle(pPtr2);

}

and my move function is:

Code:

void Foam::solidParticleCloud::move(const dimensionedVector& g)
{
    const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho");
    const volVectorField& U = mesh_.lookupObject<const volVectorField>("U");
    const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu");

    interpolationCellPoint<scalar> rhoInterp(rho);
    interpolationCellPoint<vector> UInterp(U);
    interpolationCellPoint<scalar> nuInterp(nu);

    solidParticle::trackingData
        td(*this, rhoInterp, UInterp, nuInterp, g.value());

    Cloud<solidParticle>::move(td, mesh_.time().deltaTValue());

//if(mesh.time().value()>td.spc().tInjStart&&mesh.time().value()<td.spc().tInjEnd)//ORIGINAL
//{
//this->inject(td);
//}

if(mesh_.time().value()>td.cloud().tInjStart_&&mesh_.time().value()<td.cloud().tInjEnd_)
{
this->inject(td);
}

}

I believe the problem is the problem is the line:
Code:

Foam::Cloud<solidParticle>::addParticle(pPtr1);
in the injection function, because if I comment this out the solver runs, although I obviously dont get any particle injected.

The fault I am getting when I run the case is:

Code:

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigSegv::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  double Foam::particle::trackToFace<Foam::solidParticle::trackingData>(Foam::Vector<double> const&, Foam::solidParticle::trackingData&) at ??:?
#4  Foam::solidParticle::move(Foam::solidParticle::trackingData&, double) at ??:?
#5  void Foam::Cloud<Foam::solidParticle>::move<Foam::solidParticle::trackingData>(Foam::solidParticle::trackingData&, double) at ??:?
#6  Foam::solidParticleCloud::move(Foam::dimensioned<Foam::Vector<double> > const&) at ??:?
#7  ? at ??:?
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9  ? at ??:?
Segmentation fault (core dumped)

Any help would be greatly appreciated.

Thanks in advance.

Mahdi2010 March 8, 2017 09:32

If the solver compiles without error, one possible reason for this problem might be the initial values you provide in the //constant/particleProperties. If I'm not mistaken, this error seems to happen in cases with problem in numerical singularities (e.g. when a number is divided by zero somewhere in the code)

tom_flint2012 March 8, 2017 10:00

thankyou
 
Thankyou so much Mahdi,

You are absolutely correct, I was injecting particles outside my domain. Many thanks.

Have a nice day,

Tom

tom_flint2012 March 9, 2017 06:25

another problem; implementing two-way coupling in openfoam4
 
Hello again everyone,

I'm afraid I have run into another obstacle. I believe this is because I am using openfoam version 4 and some of the syntax has changed.

This line of code is giving me problems in the momentumsource in solidParticleCloudI.H:

Code:

tsource().internalField() = - smom_/(mesh_.time().deltaT().value()*mesh_.V());
I think it has to be something like tsource.ref() =........

however the RHS of the equation is giving me real problems. Has something changed between the versions of openfoam to cause this, or am I being silly.

The error I get is:

Code:

In file included from solidParticleCloud.H:144:0,
                from ParticlemultiphaseEulerFoam.C:47:
solidParticleCloudI.H: In member function ‘Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> > Foam::solidParticleCloud::momentumSource() const’:
solidParticleCloudI.H:122:16: error: no match for ‘operator=’ (operand types are ‘Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>’ and ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’)
  tsource.ref() =(- smom_/(mesh_.time().deltaT().value()*mesh_.V()));// - smom_/(mesh_.time().deltaT().value()*mesh_.V());


I'd really appreciate any help.

Thankyou,

Tom

khulekuka April 3, 2017 02:45

Quote:

Originally Posted by alexlupo (Post 450277)
Hi there!
I havent been able to validate because I am working now on the same kind of solver but with pimpleFoam.
Anyway, as a starting point, there is a very good tutorial on how to couple both interFoam and the solidParticle class:
http://www.tfd.chalmers.se/~hani/kur...LPT_120911.pdf
The tutorial is for a previous version of OpenFoam so you will have to upgrade it in case you are using 2.2.x.
Take a look and just let me know if you need some help. I will be glad to help you.
Cheers,

Working on simpleFoam and solidParticle when compiling i keep getting error from solidParticle move(g) saying g is not declared in SRFSimple.C.

Sent from my LG-H955 using CFD Online Forum mobile app

khulekuka April 3, 2017 12:54

Quote:

Originally Posted by khulekuka (Post 643427)
Working on simpleFoam and solidParticle when compiling i keep getting error from solidParticle move(g) saying g is not declared in SRFSimple.C.

Sent from my LG-H955 using CFD Online Forum mobile app

Ok figured it out.

Sent from my LG-H955 using CFD Online Forum mobile app

AJAY BHANDARI April 14, 2017 02:30

Hi houvy,

Exactly similar problem i am facing. DId you find solution of that.

or somebody please tell me that by following the chalmers tutorial mentioned in above links how it can be upgraded to openFoam version 2.4.0 regarding particle injection.

Or how to use swak4Foam to couple lagrangian with an eulerian solver.

Any help will be appreciated.

Best
Ajay

LauraSumner April 24, 2017 13:10

cloud size=0??
 
Hi All
I have followed the Chalmers tutorial to merge pimpleDyMFoam and solidParticle. I updated it to run on OF3.0.1 and it compiles fine. However when I run the simulation the Cloud Size=0.
I havent looked into particle coupling yet, and have literally copied the tutorial, the only changes i made were syntax based due to running a different version. I also made sure that:

label cellI=1;
label tetFaceI=1;
label tetPtI=1;

in solidParticleCloud.C as this was advised on here somewhere.

I thought it could be a problem within the particleProperties file but I dont know what the problem could be.
Does the position of the particle need to be at a grid intersection? I made sure this was the case. Also I said my injection start time was 0 and end time was after one timestep. I have changed this a few times and it makes no difference. I really don't see why the particles aren't present, so if anyone has any tips that would be great!

Laura

tom_flint2012 April 24, 2017 14:04

Injection function
 
Hi Laura,

What does your injection function look like,
I don't have my laptop with me at the moment but that is where the particles are added if I remember correctly. I can send you all my solid particle files tomorrow when I get back into the fluids dungeon if you have t cracked it by then.

Also are you calling the move/inject functions properly? I had an issue where I was injecting particles outside of the domain but that gave a segmentation fault so I don't think that is your issue. I suspect it's your injection function or a lack of a call to that function.

All the best,

Tom

LauraSumner April 25, 2017 08:11

Hey Tom,

I think you are right in that the problem is the calling of the injection function. I have a line which says particles.move(g) in the main solver, but no corresponding particles.inject(??) i tried playing around with this but must admit i'm a newcomer to C++ and couldn't work out what the argument for the inject function should be, so decided to just ask on here! Something else: I had to use #include... for the C codes like solidParticle.C instead of adding to my options file, as this just did not work. Could this be an issue? I thought that if they are included in the main solver then they can be called without any problems. I have no compilation errors so figured this is fine.
Thanks!

Laura

edit: also my inject function is:

void Foam::solidParticleCloud::inject(solidParticle::tr ackingData &td)
{
label cellI=1;
label tetFaceI=1;
label tetPtI=1;
mesh_.findCellFacePt(td.cloud().posP1_, cellI, tetFaceI, tetPtI);

solidParticle* ptr1=new solidParticle(mesh_,td.cloud().posP1_,cellI,tetFac eI,tetPtI,td.cloud().dP1_,td.cloud().UP1_);
Cloud<solidParticle>::addParticle(ptr1);
mesh_.findCellFacePt(td.cloud().posP2_, cellI, tetFaceI, tetPtI);
solidParticle* ptr2=new solidParticle(mesh_,td.cloud().posP2_,cellI,tetFac eI,tetPtI,td.cloud().dP2_,td.cloud().UP2_);
Cloud<solidParticle>::addParticle(ptr2);
}

tom_flint2012 April 25, 2017 08:31

Yes I think you should have:
-I$(LIB_SRC)/lagrangian/basic/lnInclude
in your Make/options file under the EXE_INC=\ heading, its the last line in mine and then:
-llagrangian \
-lsolidParticle \
in EXE_LIBS=\

Then if you have added all the SolidParticle* files that should be fine.
Then the injection function is called from the move function. So in your SolidParticleCloud.H you should have:

void inject(solidParticle::trackingData &td); in the member functions. Then in SolidParticleCloud.C the functions should be something like:
Code:

void Foam::solidParticleCloud::move(const dimensionedVector& g)
{
    const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho");
    const volVectorField& U = mesh_.lookupObject<const volVectorField>("U");
    const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu");

    interpolationCellPoint<scalar> rhoInterp(rho);
    interpolationCellPoint<vector> UInterp(U);
    interpolationCellPoint<scalar> nuInterp(nu);

    smom_=vector::zero;
    solidParticle::trackingData
        td(*this, rhoInterp, UInterp, nuInterp, g.value());

    Cloud<solidParticle>::move(td, mesh_.time().deltaTValue());

//if(mesh.time().value()>td.spc().tInjStart&&mesh.time().value()<td.spc().tInjEnd)//ORIGINAL
//{
//this->inject(td);
//}

if(mesh_.time().value()>td.cloud().tInjStart_&&mesh_.time().value()<td.cloud().tInjEnd_)
{
this->inject(td);
}

}



void Foam::solidParticleCloud::inject(solidParticle::trackingData &td)//    THE PROBLEM WILL BE HERE
{

label celli=1;
label tetFacei=1;
label tetPtI=1;
mesh_.findCellFacePt(td.cloud().posP1_, celli, tetFacei, tetPtI);
solidParticle* pPtr1=new solidParticle(mesh_,td.cloud().posP1_,celli,tetFacei,tetPtI,td.cloud().dP1_,td.cloud().UP1_);
Foam::Cloud<solidParticle>::addParticle(pPtr1);

mesh_.findCellFacePt(td.cloud().posP2_, celli, tetFacei, tetPtI);
solidParticle* pPtr2=new solidParticle(mesh_,td.cloud().posP2_,celli,tetFacei,tetPtI,td.cloud().dP2_,td.cloud().UP2_);
Foam::Cloud<solidParticle>::addParticle(pPtr2);

}



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