CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   solidParticle class. Wrong code (https://www.cfd-online.com/Forums/openfoam/67596-solidparticle-class-wrong-code.html)

shchepan August 20, 2009 02:53

solidParticle class. Wrong code
 
Hello!
In file src/lagrangian/solidParticle/solidParticle.C is described function

bool Foam::solidParticle::move(solidParticle::trackData & td)
{
td.switchProcessor = false;
td.keepParticle = true;

const polyMesh& mesh = cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();

scalar deltaT = mesh.time().deltaT().value();
scalar tEnd = (1.0 - stepFraction())*deltaT;
scalar dtMax = tEnd;

while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
{
if (debug)
{
Info<< "Time = " << mesh.time().timeName()
<< " deltaT = " << deltaT
<< " tEnd = " << tEnd
<< " steptFraction() = " << stepFraction() << endl;
}

// set the lagrangian time-step
scalar dt = min(dtMax, tEnd);

// remember which cell the parcel is in
// since this will change if a face is hit
label celli = cell();

dt *= trackToFace(position() + dt*U_, td);

tEnd -= dt;
stepFraction() = 1.0 - tEnd/deltaT;

cellPointWeight cpw(mesh, position(), celli, face());
scalar rhoc = td.rhoInterp().interpolate(cpw);
vector Uc = td.UInterp().interpolate(cpw);
scalar nuc = td.nuInterp().interpolate(cpw);

scalar rhop = td.spc().rhop();
scalar magUr = mag(Uc - U_);

scalar ReFunc = 1.0;
scalar Re = magUr*d_/nuc;

if (Re > 0.01)
{
ReFunc += 0.15*pow(Re, 0.687);
}

scalar Dc = (24.0*nuc/d_)*ReFunc*(3.0/4.0)*(rhoc/(d_*rhop));

U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);

if (onBoundary() && td.keepParticle)
{
if (face() > -1)
{
if (isType<processorPolyPatch>(pbMesh[patch(face())]))
{
td.switchProcessor = true;
}
}
}
}

return td.keepParticle;
}

This function move solid particles that are influenced by drag and Archmed's forces.
I think that formula
U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
is wrong. This formula is equal equation
(U_-Uc)*Dc+(1.0-rhoc/rhop)*td.g()=0
Last equation means that (drag force)+(Archimed's force)=0, so particle do not move.

I think, we should replace this code to

//U_ = (U_ + dt*(Dc*Uc + (1.0 - rhoc/rhop)*td.g()))/(1.0 + dt*Dc);
//Drag force
vector Fdrag = Dc*(U_-Uc);
//Archimed's frce
vector FArch = td.g()*(1.0-rhoc/rhop);
vector F = Fdrag + FArch;
U_ += dt*F;


I need your criticism. Am I right or not?

shchepan September 29, 2009 08:06

It was my mistake. solidParticle.C code is correct!

gooya_mehdy May 27, 2011 02:23

solidparticle compiling
 
hello shchepan
sorry I'm trying to use solidParticle solver for my project but I can't.
i use OF 1.6 and can't compile it.
I've got This massage:

.
.
.
injectorSolidParticleFoam.C:(.text._ZN4Foam26surfa ceInterpolationSchemeINS_6VectorIdEEE11interpolate ERKNS_14GeometricFieldIS2_NS_12fvPatchFieldENS_7vo lMeshEEERKNS_3tmpINS4_IdNS_13fvsPatchFieldENS_11su rfaceMeshEEEEE[Foam::surfaceInterpolationScheme<Foam::Vector<doub le> >::interpolate(Foam::GeometricField<Foam::Vector<d ouble>, Foam::fvPatchField, Foam::volMesh> const&, Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> > const&)]+0x1b4): undefined reference to `Foam::calculatedFvsPatchField<Foam::Vector<double > >::typeName'
collect2: ld returned 1 exit status
make: *** [OpenFOAM.out] Error 1

The sentence "undefined reference to `Foam:...." is the same in all errors.
could anybody help me?:(
Thank you so much


All times are GMT -4. The time now is 01:14.