CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to add the species mass fraction equation to compressibleInterFoam?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 25, 2023, 06:13
Default How to add the species mass fraction equation to compressibleInterFoam?
  #1
New Member
 
Qian Meng
Join Date: Nov 2022
Posts: 4
Rep Power: 4
Rachel0096 is on a distinguished road
Hello,everyone!
I am now trying to add the species mass fraction equation to compressibleInterFoam, but since I have less programming experience, I am not sure if this is correct?
Code:
tmp<fv::convectionScheme<scalar>> mvConvection
(
    fv::convectionScheme<scalar>::New
    (
        mesh,
        fields,
        alpha2rho2phi,
        mesh.divScheme("div(alpha2rho2phi,Yi)")
    )
);
{
    combustion->correct();
    Qdot = combustion->Qdot();
    volScalarField Yt(0.0*Y[0]);
    volScalarField alpha2muEff("alpha2muEff" , alpha2*turbulence.muEff());

    forAll(Y, i)
    {
        if (i != inertIndex && composition.active(i))
        {
            volScalarField& Yi = Y[i];
            fvScalarMatrix YEqn
            (
                fvm::ddt(alpha2rho2, Yi)
              + mvConvection->fvmDiv(alpha2rho2phi, Yi)
              - fvm::laplacian(alpha2muEff, Yi)
             ==
                parcels.SYi(i, Yi)
              + combustion->R(Yi)
              + fvOptions(rho, Yi)
            );

            YEqn.relax();

            fvOptions.constrain(YEqn);

            YEqn.solve(mesh.solver("Yi"));

            fvOptions.correct(Yi);

            Yi.max(0.0);
            Yt += Yi;
        }
    }

    Y[inertIndex] = scalar(1) - Yt;
    Y[inertIndex].max(0.0);
Variables,such as alpha2rho2phi and alpha2rho2 are defined in createField.H.
Code:
volScalarField alpha2rho2
(
   IOobject
   (
       "alpha2rho2",
       runTime.timeName(),
       mesh,
       IOobject::READ_IF_PRESENT,
       IOobject::AUTO_WRITE
   ),
   alpha2*rho2
);

 surfaceScalarField alpha2rho2phi
 (
     IOobject
     (
         "alpha2phi",
         runTime.timeName(),
         mesh,
         IOobject::READ_IF_PRESENT,
         IOobject::AUTO_WRITE
     ),
     linearInterpolate(alpha2*rho2*U) & mesh.Sf()
 );
Is this correct?Besides,What does mvconvection stand for?
Rachel0096 is offline   Reply With Quote

Reply

Tags
compressibleinterfoam


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass fraction of species Lilly FLUENT 5 March 13, 2022 18:52
What is the equation or formula to calculate Mass Flux[kg/m²s] of species in Fluent? THA SEANGHAI FLUENT 0 September 11, 2020 02:10
Order of species in the array of mass fraction Vidushi FLUENT 5 May 20, 2020 06:44
Define mass flow profile with regards to species mass fraction danS Fluent UDF and Scheme Programming 0 June 20, 2017 07:21
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32


All times are GMT -4. The time now is 13:16.