CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Adding a new parameter to the injected particles (https://www.cfd-online.com/Forums/openfoam-programming-development/235042-adding-new-parameter-injected-particles.html)

farzadmech March 29, 2021 16:24

Adding a new parameter to the injected particles
 
Dear friend
I want to add a property(exactly like "rho" for particles) to my particle properties. Actually I want to add "Mass Fraction" at the injection to my particles. I know that I should change KinematicParcel.C and KinematicCloud.C (constructor part), but it is a little ambiguous to me which one is an Eulerian parameter and which one is a Lagrangian parameter(I make them RED). Lets I copy the code here;

Code:

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

template<class CloudType>
Foam::KinematicCloud<CloudType>::KinematicCloud
(
    const word& cloudName,
    const volScalarField& rho,
    const volVectorField& U,
    const volScalarField& mu,
    const dimensionedVector& g,
    bool readFields
)
:
    CloudType(rho.mesh(), cloudName, false),
    kinematicCloud(),
    cloudCopyPtr_(nullptr),
    mesh_(rho.mesh()),
    particleProperties_
    (
        IOobject
        (
            cloudName + "Properties",
            rho.mesh().time().constant(),
            rho.mesh(),
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE

        )
    ),
    outputProperties_
    (
        IOobject
        (
            cloudName + "OutputProperties",
            mesh_.time().timeName(),
            "uniform"/cloud::prefix/cloudName,
            mesh_,
            IOobject::READ_IF_PRESENT,
            IOobject::NO_WRITE
        )
    ),



Thanks,
Farzad

farzadmech March 30, 2021 10:24

Extra explanation
 
Dear friends
After reviewing the code for few times, I remembered that I remember that the green lines are for Eulerian rho(density of Fluid) and red lines are for Lagrangian(density of particle) as below;


[CODE]

Code:

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

template<class CloudType>
Foam::KinematicCloud<CloudType>::KinematicCloud
(
    const word& cloudName,
    const volScalarField& rho,
    const volVectorField& U,
    const volScalarField& mu,
    const dimensionedVector& g,
    bool readFields
)
:
    CloudType(rho.mesh(), cloudName, false),
    kinematicCloud(),
    cloudCopyPtr_(nullptr),
    mesh_(rho.mesh()),
    particleProperties_
    (
        IOobject
        (
            cloudName + "Properties",
            rho.mesh().time().constant(),
            rho.mesh(),
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )[/COLOR]
    ),
    outputProperties_
    (
        IOobject
        (
            cloudName + "OutputProperties",
            mesh_.time().timeName(),
            "uniform"/cloud::prefix/cloudName,
            mesh_,
            IOobject::READ_IF_PRESENT,
            IOobject::NO_WRITE
        )
    ),

Now the main question is that how can I add another parameter like a mass fraction(Y) to the Lagrangian parameters?


Thanks,
Farzad


All times are GMT -4. The time now is 17:04.