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

Adding a mass source term to compressibleInterFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2021, 08:16
Default Adding a mass source term to compressibleInterFoam
  #1
Member
 
Join Date: Mar 2021
Posts: 39
Rep Power: 5
trailer is on a distinguished road
Hello to all,

I would like to know how to add a mass source term to compressibleInterFoam and a clarification on fvOptions code syntax.

In my simulation phase1 is water and phase2 is air.

Since we are using the mass conservation equation to write the pressure correction equation, the mass source should be placed there (is this correct?).

In pEqn.H file we have from line 26 to 95

Code:
   tmp<fvScalarMatrix> p_rghEqnComp1;
    tmp<fvScalarMatrix> p_rghEqnComp2;

    if (pimple.transonic())
    {
        #include "rhofs.H"

        surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
        surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);

        p_rghEqnComp1 =
            pos(alpha1)
           *(
                (
                    fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
                  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
                )/rho1
              - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
              + (alpha1/rho1)
               *correction
                (
                    psi1*fvm::ddt(p_rgh)
                  + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
                )
            );
        p_rghEqnComp1.ref().relax();

        p_rghEqnComp2 =
            pos(alpha2)
           *(
               (
                   fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
                 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
               )/rho2
             - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
             + (alpha2/rho2)
              *correction
               (
                   psi2*fvm::ddt(p_rgh)
                 + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
               )
           );
        p_rghEqnComp2.ref().relax();
    }
    else
    {
        #include "rhofs.H"

        p_rghEqnComp1 =
            pos(alpha1)
           *(
                (
                    fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
                  - (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
                )/rho1
              - fvc::ddt(alpha1) - fvc::div(alphaPhi1)
              + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh))
            );

        p_rghEqnComp2 =
            pos(alpha2)
           *(
               (
                   fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
                 - (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
               )/rho2
             - fvc::ddt(alpha2) - fvc::div(alphaPhi2)
             + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh))
            );
    }
Where the fvOptions is available on line 41 and 58 for transonic flow and in line 79 and 90 for the remainder.

I would like to know the following:
How can I put a source term there?

In my fvOptions dictionary I have:
Code:
massSource
{
    type            scalarCodedSource;
    selectionMode   all;
    fields          (?thermo:rho.water?);

    // Name of the coded source
    name            sourceTime;
But this does not change my simulation results... ( I am using an equation of state with constant density)


Additionally, can anyone clarify the entries on the fvOptions code syntax, e.g.,

Code:
fvOptions(alpha1, mixture.thermo1().rho())&rho1)
Or in the UEqn.H
Code:
fvOptions(rho, U)
what does (rho,U) mean? U is the field where the source is being implemented, but why is rho being passes as an argument?

Last edited by trailer; May 6, 2021 at 04:24.
trailer is offline   Reply With Quote

Old   January 7, 2023, 22:26
Default
  #2
New Member
 
Corbin G
Join Date: Oct 2022
Location: Midwest, USA
Posts: 11
Rep Power: 3
CorbinMG is on a distinguished road
Hi trailer,

Did you ever figure out how to add the mass source term to the compressibleInterFoam solver? I am trying to do a similar thing but I am struggling to figure out the formulation of the p_rghEqnComp1 and p_rghEqnComp2 in pEqn.H.

Best regards,
Corbin
CorbinMG is offline   Reply With Quote

Reply


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
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 03:50
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 01:22
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
friction forces icoFoam ofslcm OpenFOAM 3 April 7, 2012 10:57
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


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