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

Adding an acceleration source term to interFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By olivierG
  • 1 Post By olivierG

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2015, 07:19
Default Adding an acceleration source term to interFoam
  #1
Member
 
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 11
arsalan.dryi is on a distinguished road
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.
Attached Files
File Type: h UEqn.H (816 Bytes, 15 views)
arsalan.dryi is offline   Reply With Quote

Old   July 10, 2015, 09:32
Default
  #2
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
hello,

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

regards,
olivier
arsalan.dryi likes this.
olivierG is offline   Reply With Quote

Old   July 10, 2015, 12:16
Default
  #3
Member
 
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 11
arsalan.dryi is on a distinguished road
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.
arsalan.dryi is offline   Reply With Quote

Old   July 10, 2015, 12:56
Default
  #4
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
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 likes this.
olivierG is offline   Reply With Quote

Old   July 10, 2015, 17:00
Default
  #5
Member
 
Arsalan
Join Date: Jul 2014
Posts: 74
Rep Power: 11
arsalan.dryi is on a distinguished road
Dear Olivier,
thank u for your reply,but how do i modify the gh and ghf(and at which file)?


Best regards,
Arsalan
arsalan.dryi 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
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 09:17
Adding volumetric Source Term mohanamuraly OpenFOAM 0 May 17, 2009 22:00
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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