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/)
-   -   Adding an acceleration source term to interFoam (https://www.cfd-online.com/Forums/openfoam-solving/156664-adding-acceleration-source-term-interfoam.html)

arsalan.dryi July 10, 2015 07:19

Adding an acceleration source term to interFoam
 
1 Attachment(s)
Dear Foamers,
I want to study the shape oscillation an translation motion of a single bubble in a liquid container under vibration while the imposed displacement of the container is y=Acos(wt).
for this purpose,i should add an acceleration source term to momentum equation.
I'm trying to modify the interFoam equations by adding a source term to the momentum equation,
UEqn.H :
Code:

dimensionedVector accY
        (
          "accY",dimensionSet(0, 1, -2, 0, 0),vector(0, 1, 0)
        );

        scalar Pi = 3.14;
       

      dimensionedVector acc = (-396270.25*0.0002*Foam::cos(629.5*runTime.value())*accY);   




    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U)
      + fvm::div(rhoPhi, U)
      + turbulence->divDevRhoReff(rho, U)
      ==
        (acc*rho)
     
     
    );

    UEqn.relax();

    if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
        ==
            fvc::reconstruct
            (
                (
                    fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
                  - ghf*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
                ) * mesh.magSf()
            )
        );
    }

but this method get wrong results,What's wrong with it??

I would appreciate your comments!

Thanks a lot,
Arsalan.

olivierG July 10, 2015 09:32

hello,

Take a look at how gravity source term is take into account.
And do the same.

regards,
olivier

arsalan.dryi July 10, 2015 12:16

Well, with the extra help of Olivier I got the following to compile:
UEeqn.H :
Code:

    dimensionedVector accY
        (
          "accY",dimensionSet(0, 1, -2, 0, 0),vector(0, 1, 0)
        );

        scalar Pi = 3.14;
       

      dimensionedVector acc = (-396270.25*0.0001*Foam::cos(629.5*runTime.value())*accY);   




    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U)
      + fvm::div(rhoPhi, U)
      + turbulence->divDevRhoReff(rho, U)
 
    );

    UEqn.relax();

    if (pimple.momentumPredictor())
    {
        solve
        (
            UEqn
        ==
            fvc::reconstruct
            (
                (
                    fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
                  - ghf*fvc::snGrad(rho)
                  + acc*fvc::snGrad(rho)
                  - fvc::snGrad(p_rgh)
                ) * mesh.magSf()
            )
        );
    }

but i got this error when i want to compile the code :
Code:

UEqn.H:35:40:  instantiated from here
/opt/openfoam221/src/OpenFOAM/lnInclude/FieldFunctions.C:700:1: error: no match for ‘operator+’ in ‘*(f2P ++) + *(f3P ++)

i just add the
Code:

+ acc*fvc::snGrad(rho)
to momentum equation!

Every help, idea, hint... will be greatly apprecitated!
Thanks a lot,
Arsalan.

olivierG July 10, 2015 12:56

hello,

Try to follow more closely what's done with g:
acc = ...; //ok
gh = (acc+g) &mesh.C();
ghf = (acc+g) & mesh.Cf();
.. then you don't have to add acc in momentum predictor.

regards,
Olivier

arsalan.dryi July 10, 2015 17:00

Dear Olivier,
thank u for your reply,but how do i modify the gh and ghf(and at which file)?


Best regards,
Arsalan


All times are GMT -4. The time now is 12:31.