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

Changing viscosity in interFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By olivierG

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2015, 04:14
Default Changing viscosity in interFoam
  #1
Member
 
Thomas Vossel
Join Date: Aug 2013
Location: Germany
Posts: 45
Rep Power: 12
ThomasV is on a distinguished road
Hi!

I want to use interFoam and change the viscosity depending on the temperature. I already included the temperature transport and a method for interpolating the respective viscosity values based on some actually measured data. I'm now struggling to get access to the viscosity field / understanding how all of this works...

1.)
The viscosity is calculated via the incompressibleTwoPhaseMixture model. There a volScalarField "nu_" is created but it's protected so I cannot change it via my solver's code...

2.)
I had a look at the velocity / pressure solver itself to see where the viscosity is passed on to the solver so I could like clone the internally calculated viscosity field in order to pass on an altered version to the actual velocity equations. I would have expected to see it in the momentum equation but for U there's just this:

Code:
    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)
                  - fvc::snGrad(p_rgh)
                ) * mesh.magSf()
            )
        );
    }
So at which point in the solver's code does the viscosity play a role and how can I get access to the viscosity field in order to change it?
ThomasV is offline   Reply With Quote

Old   March 11, 2015, 09:55
Default
  #2
Member
 
ali alkebsi
Join Date: Jan 2012
Location: Strasbourg, France
Posts: 82
Rep Power: 14
kebsiali is on a distinguished road
hello

I'm also interested in doing this ( I have to. )
I think, if you are not going to use any turbulence model (laminar case)
then you could just exchange the line
+ turbulence->divDevRhoReff(rho, U)
with one like in icoFoam
where you will have to go to createFields.H and create you nu1 nu2 and nu
and make it calculated like rho (averaging).
However it might prove not effective (its just an idea i came up with to try)
in case you find another solution i'm very interested in knowing how

and i think that the slover uses the nu as calculated in
incompressibleTwoPhaseMixture.C
by calling
twoPhaseProperties.correct();
kebsiali is offline   Reply With Quote

Old   March 11, 2015, 23:45
Default
  #3
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 15
ybapat is on a distinguished road
Hello Thomas,

You can write your own viscosity model as in src/transportModels/viscosityModel. Here you can find different viscosity models are implemented.

Regards,
-Yogesh
ybapat is offline   Reply With Quote

Old   March 12, 2015, 02:47
Default
  #4
Member
 
Thomas Vossel
Join Date: Aug 2013
Location: Germany
Posts: 45
Rep Power: 12
ThomasV is on a distinguished road
Hi!

Thanks for your suggestions. Writing a viscosity model of my own might be a solution but after quite a struggle to get a boundary condition of mine to work I want to avoid writing more template code plus it usually costs quite some time to understand how those models are supposed to work. But maybe I should have a look at this again - perhaps OpenFOAM surprises me for once by giving a straightforward process for integrating something new...

Right now I'm trying to implement a "dirty trick". I just copied the entire transport model sources to my solver in order to compile all of this as a custom library. I then added a function which passes on a pointer to the nu_ volScalarField. In my solver I know use the pointer to simply overwrite nu_ with a field of my own. This seems to work so far but recently I just did some tests without the U and p calculations so I still have to check that it won't become overwritten by something. There also seems to be a bug in my interpolation code I have to fix first...

If none of all this will work I guess I'll try kebsiali's approach. So the viscosity is implemented via the turbulence model?
ThomasV is offline   Reply With Quote

Old   March 12, 2015, 04:45
Default
  #5
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
hello,

This has already been done ...
check http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

Regards,
olivier
ThomasV and purnp2 like this.
olivierG is offline   Reply With Quote

Old   March 12, 2015, 06:43
Default
  #6
Member
 
Thomas Vossel
Join Date: Aug 2013
Location: Germany
Posts: 45
Rep Power: 12
ThomasV is on a distinguished road
Thanks - that's a nice source. Way more easy than my approach...
ThomasV 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
InterFoam viscosity problem / possible bug pbryant OpenFOAM Running, Solving & CFD 24 March 30, 2020 04:25
Problem with divergence TDK FLUENT 13 December 14, 2018 06:00
[PyFoam] Problems with the new PyFoam release zfaraday OpenFOAM Community Contributions 13 December 9, 2014 18:58
[PyFoam] having problems with pyfoam Installation vitorspadetoventurin OpenFOAM Community Contributions 3 December 2, 2014 07:18
Viscosity interpolation in interFoam Jun Kwon Park OpenFOAM Running, Solving & CFD 0 October 9, 2009 08:29


All times are GMT -4. The time now is 08:32.