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

Time and temperature dependent viscosity

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By olivierG

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2013, 17:11
Default Time and temperature dependent viscosity
  #1
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
Hi,

I am trying to simulate a time and temperature dependent viscosity. In the simulation some heat is applied to the material, when the material at some point reaches a given temperature its viscosity starts increasing at a set rate. When reaching its final viscosity it stays at this viscosity.

The fluid will be stationary and just the pressure, time, temperature and viscosity of the material will be analysed.

It has been suggested to me that for this simulation I should make the viscosity (Mu) a function of time and temperature, however it seems as-though there are simpler methods for implementing this such as the sutherland transport solver explained in the OpenFOAM user guide.

Which would be the best method for creating this simulation and are there any other methods that may be more efficient?

If anyone has any information that may help me with this simulation please let me know. I will really appreciate any help that I get with this.

THANK YOU.
sur4j is offline   Reply With Quote

Old   November 24, 2013, 07:46
Default
  #2
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
I have been thinking about this and it occurred to me that this may not even be a CFD simulation, instead it may be a FEA simulation as I later planned on adding thermal expansion to it.
Is this the case or should I continue using the icoFoam solver with temperature added to it or would it be something totally different such as a reaction simulation?
sur4j is offline   Reply With Quote

Old   November 24, 2013, 08:08
Default
  #3
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi sur4j,

Quoting from your other thread:
Quote:
Originally Posted by sur4j View Post
My simulation is a static simulation in which the fluid is not moving, I am trying to have a variable viscosity in this and as far as I am aware the viscosity of a stationary fluid does not have any effect on the heat transfer, please correct me on this if I am wrong.

I would like this viscosity to be visible in para view and it is variable such that when it gets to a certain temperature it starts increasing at a set rate and then at some other higher temperature it stops increases and stays at the final value. How would you suggest I start this simulation, should I create some sort of dummy variable in the same sort of way temperature was added to the simulation?

Again, thank you so much for your help I really appreciated it.
This is a somewhat complex simulation you're trying to perform. And it also depends on whether your solid/fluid is Newtonian or not. But I suppose that you want to start things simple and to use a Newtonian fluid.

I'm not familiar with any solvers in OpenFOAM that have varying viscosity, but there are several with varying density, which usually start with the name "rho": http://www.openfoam.com/features/standard-solvers.php
The solver rhoSimpleFoam is possibly the simplest one you can use as a basis for ideas.

Beyond this, there is the solidMechanics solver+library kit: http://openfoamwiki.net/index.php/Co...solidMechanics

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 24, 2013, 08:45
Default
  #4
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
Hello Bruno,

Thank you for the suggestions, I will look into rhoSimpleFoam.

I have spent the past few months learning some of the theory behind CFD and it has really helped me understand what I am simulating but now this simulation requires me to move into solid mechanics which I have not worked with before.
I am planning on doing the same as what I had done for CFD and that is study the theory first but the majority of literature available is for FEA whereas OpenFOAM works on FVM, do you think that if I studied solid mechanics with the FEA approach I could translate much of what I learn to FVM so that it can be applied to OpenFOAM?

Also, how do the solidMechanics solvers available within OpenFOAM compare with that of something such as Nastran orother commercial FEA software?
sur4j is offline   Reply With Quote

Old   November 24, 2013, 09:10
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi sur4j,
Quote:
Originally Posted by sur4j View Post
do you think that if I studied solid mechanics with the FEA approach I could translate much of what I learn to FVM so that it can be applied to OpenFOAM?
Well, in theory, FEA and FVM share the same requirements:
  • both need boundary conditions;
  • both need physical definitions (density, viscosity and so on);
  • both have modelling limitations (mesh, algorithms, etc...).
But when it comes to meshing and simulating, things are considerably different.
Either way, FEA is known for its simulations in solid mechanics and solid thermodynamics; FVM is known for simulations with fluids + mass + heat transfer.


But as I wrote before - AFAIK and I am not an expert in this field - viscosity changes during simulation are less common in CFD simulations.


Quote:
Originally Posted by sur4j View Post
Also, how do the solidMechanics solvers available within OpenFOAM compare with that of something such as Nastran orother commercial FEA software?
I have no idea of how they compare. In addition, this is an independent tool-kit and it's not part of the official OpenFOAM distribution.
Feel free to read more about it here:
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 26, 2013, 15:17
Default
  #6
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
I am still going to be studying FEA but with this simulation I think I should start off simple as you suggested with a Newtonian fluid. I have a few questions about this and also the icoFoam solver that I added temperature to.

Is implementing a dummy variable which is a function of temperature and time into OpenFOAM and Para View a difficult task? If not I could do this instead of altering the viscosity as it would give the same results.

On a case such as this one where the fluid is stationary and only heat transfer is analysed how would I set the time step? This is because when fluid is moving I can use the courant number to determine the time step but in this case U=0.

I had previously added temperature to the icoFoam solver. When viewing the results on para view I noticed that increasing the temperature value at the wall by modifying the BC in the 0 folder had no effect on the results, I mean that when running the my_icoFoam solver, para view showed the same rate at which heat travelled through the cavity when the temperature was set to for example 10 or 200, the only time the results changed was when the temperature diffusivity value was changed.
However, when I done the same thing with the standard icoFoam solver on the case I got results that changed but they still did not seem right because when temperature was decreased the rate of heat transfer was faster.
sur4j is offline   Reply With Quote

Old   November 26, 2013, 17:54
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi sur4j,

Well, first of all, icoFoam is a transient solver: http://www.openfoam.com/features/standard-solvers.php
Quote:
Transient solver for incompressible, laminar flow of Newtonian fluids
What you're looking for is a steady-state solver.

If you look at the page from the link above, you'll find this solver:
Quote:
solidEquilibriumDisplacementFoam - Steady-state segregated finite-volume solver of linear-elastic, small-strain deformation of a solid body, with optional thermal diffusion and thermal stresses
I would say, from the description, that this solver is closer to what you need. Problem is that this particular solver is probably very complex... I haven't looked at the source code, so I'm only guessing here.


Either way, the simplest solution seems to be that you should use the solver laplacianFoam as a basis for what you want to achieve. A short description is given here: http://openfoamwiki.net/index.php/LaplacianFoam

You can find similar descriptions to the other two basic solvers here: http://openfoamwiki.net/index.php/Ma...asic_CFD_codes

In theory, what you want to do is to use the laplacianFoam solver as a basis for the temperature (heat) transfer over the solid and use the scalar transportation for the viscosity changes. The basis for this scalar/viscosity transport will likely be the temperature and/or time of residence of said temperature.
Therefore, if study the 3 basic solvers, you should be able to figure out how to implement the simulation you want to perform.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 27, 2013, 06:55
Default
  #8
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 18
olivierG is on a distinguished road
hello,

Standard foam solver can already do almost what you need. Hoever the increasing viscosity rate is not here.
Take a look at buoyantSimpleFoam. You can choose a polynomial thermo type for viscosity, then you get your temperature dependant viscosity.

If you need to take into account the increase rate in time, you need to create your own viscosity model, which is not so difficult.
Take a look at:
http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

regards,
olivier
wyldckat and fumiya like this.
olivierG is offline   Reply With Quote

Old   December 8, 2013, 14:35
Default
  #9
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
Hello,

Thank you for all your help, I did not want to bump this thread until I had a new question but I am really stuck now.

I have been doing as you had suggested by looking at the basic solvers and gaining a better understanding how they work I also finished reading the user guide and the finally simulated the simulation shown in the PDF Oliver had posted.

I modified the simulation to work on a simpler case, this was done by making the geometry a simple block with no velocity or pressure just a temperature set at each wall, the results I obtained were very strange. The temperature was low at the wall and high at the centre which is opposite to what was set. Exactly what happened was at time step 0 the results looked correct, the wall temp was high and centre was low temperature however at time step 1 this becomes opposite, the centre becomes the high temp and the wall becomes low and then the slowly cools everything in the centre down.

This has confused me a lot, I would appreciate if you could tell me if this is the wrong results or am I just reading them wrong.

Also, you suggested the buoyantSimpleFoam solver for the required simulation so I ran a simulation with the cavity using this solver and noticed that it uses species, since I am working with a single material would it be better suited to use the modified SimpleFoam solver shown in the PDF or would you still suggest the buoyantSimpleFoam solver with the polynomial thermo type viscosity? Also, please note that the material I am working with is incompressible.

Thank you.
sur4j is offline   Reply With Quote

Old   December 8, 2013, 14:44
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi sur4j,

Without more specific and concrete information, I can only guess that you didn't notice the specific units for the values in question.

For example, in "polyMesh/constant/blockMeshDict", where it's possible to define a transformation factor right at the beginning of the file and not notice the 1.0 or 0.001 factor There is nothing as wonderfully crazy as trying to simulate a room that is 3x5... km^2

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   December 8, 2013, 17:06
Default
  #11
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
You were correct, I changed the dimensions of the geometry to 0.5m and it worked much better. Also, I did not delete the time files when re-running the simulation and for some reason this also caused problems with the results in para view, deleting these and modifying the geometry seemed to have solved that problem.

Thank you.

Last edited by sur4j; December 9, 2013 at 16:35.
sur4j is offline   Reply With Quote

Old   December 9, 2013, 16:52
Default
  #12
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
Hello again

I now have another problem My new problem is that when I change the thermal diffusivity in the transport properties file I get no change in heat flow, this is shown in the attached images, both at the same time step, one at DT=1 and the other DT=1e-05 and both look exactly the same.

https://imageshack.com/i/5n33t4p
https://imageshack.com/i/mhf3atp

Whilst doing this I have also been playing around with solidDisplacementFoam, I should have followed your initial suggestion and went with this solver because it can already do much of what I need and making the stiffness the variable would be better suited than making viscosity vary.

Thank you.

Last edited by sur4j; December 10, 2013 at 14:51.
sur4j is offline   Reply With Quote

Old   December 10, 2013, 16:29
Default
  #13
Member
 
Join Date: Aug 2013
Posts: 60
Rep Power: 13
sur4j is on a distinguished road
Is there many similarities between the CFD theory that I have learnt previously and the thermal analysis in solidDisplacementFoam? I mean from my understanding there is a energy equation also used in solidDisplacementFoam to calculate the heat transfer, is this similar to the energy equation used in CFD which is derived from the mass conservation equation?

Also, could anyone please provide me with any literature or related documents for studying the solidDisplacementFoam thermal solver, such as information behind the theory of the solvers used for heat transfer and how these are discretised using the FVM.

Thank you.
sur4j is offline   Reply With Quote

Old   December 28, 2013, 15:12
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi sur4j,

I've finally managed to answer to your post. From what I can see in the source code, this solver is considerably simple and the basis for it is possibly already documented in some CFD book.
The thermal part that it has got integrated into the source code, comes from laplacianFoam: http://openfoamwiki.net/index.php/LaplacianFoam

If you have a look into the section "Basic CFD codes" here: http://openfoamwiki.net/index.php/Ma...asic_CFD_codes - you'll see that this solver is one of 3 basic solvers, for which descriptions are given in the links given there.

And have a look into the source code of solidDisplacementFoam, located at "$FOAM_SOLVERS/stressAnalysis/solidDisplacementFoam", or online here: https://github.com/OpenFOAM/OpenFOAM...splacementFoam

Beyond this, I would say that the User Guide gives a good tutorial: http://www.openfoam.org/docs/user/plateHole.php

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 6, 2015, 02:53
Exclamation Error while building a new viscosity model..
  #15
Senior Member
 
Himanshu Sharma
Join Date: Jul 2012
Posts: 101
Rep Power: 14
himanshu28 is on a distinguished road
Hi wyldckat,

I am trying to built a new viscosity model based on some scalar like alpha(concentration),T (Temperature)
I have tried the following approach given below
Code:
#include "alphaTLaw.H"
#include "addToRunTimeSelectionTable.H"
#include "surfaceFields.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace viscosityModels
{
    defineTypeNameAndDebug(alphaTLaw, 0);

    addToRunTimeSelectionTable
    (
        viscosityModel,
        alphaTLaw,
        dictionary
    );
}
}


// * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //

Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::alphaTLaw::calcNu() const
{
const volScalarField& T = U_.mesh().lookupObject<volScalarField>("T");
const volScalarField& alpha = U_.mesh().lookupObject<volScalarField>("alpha");


        return ((1/Re_)*exp(alpha*ln(m_)-T));


}
// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::viscosityModels::alphaTLaw::alphaTLaw
(
    const word& name,
    const dictionary& viscosityProperties,
    const volVectorField& U,
    const surfaceScalarField& phi
)
:
    viscosityModel(name, viscosityProperties, U, phi),
    //alphaTLawCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
    Re_(alphaTLawCoeffs_.lookup("Re")),
    m_(alphaTLawCoeffs_.lookup("m")),
    //nuMin_(alphaTLawCoeffs_.lookup("nuMin")),
    //nuMax_(alphaTLawCoeffs_.lookup("nuMax")),

    nu_
    (
        IOobject
        (
            name,
            U_.time().timeName(),
            U_.db(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        calcNu()
    )
{}

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::viscosityModels::alphaTLaw::alphaTLaw
(
    const word& name,
    const dictionary& viscosityProperties,
    const volVectorField& U,
    const surfaceScalarField& phi
)
:
    viscosityModel(name, viscosityProperties, U, phi),
    //alphaTLawCoeffs_(viscosityProperties.subDict(typeName + "Coeffs")),
    Re_(alphaTLawCoeffs_.lookup("Re")),
    m_(alphaTLawCoeffs_.lookup("m")),
    //nuMin_(alphaTLawCoeffs_.lookup("nuMin")),
    //nuMax_(alphaTLawCoeffs_.lookup("nuMax")),

    nu_
    (
        IOobject
        (
            name,
            U_.time().timeName(),
            U_.db(),
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        calcNu()
    )
{}

// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //

bool Foam::viscosityModels::alphaTLaw::read
(
    const dictionary& viscosityProperties
)
{
    viscosityModel::read(viscosityProperties);

    alphaTLawCoeffs_ = viscosityProperties.subDict(typeName + "Coeffs");

    alphaTLawCoeffs_.lookup("Re") >> Re_;
    alphaTLawCoeffs_.lookup("m") >> m_;
    //alphaTLawCoeffs_.lookup("nuMin") >> nuMin_;
    //alphaTLawCoeffs_.lookup("nuMax") >> nuMax_;

    return true;
}


// ************************************************************************* /
But I am getting following error on wmake libso

Code:
Making dependency list for source file alphaTLaw.C
SOURCE=alphaTLaw.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/transportModels/incompressible/lnInclude/ -I.. -I../twoPhaseMixture/lnInclude -I/home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude -I/home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/alphaTLaw.o
alphaTLaw.C: In member function ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::viscosityModels::alphaTLaw::calcNu() const’:
alphaTLaw.C:57:33: error: invalid initialization of reference of type ‘const Foam::fileName&’ from expression of type ‘const dimensionedScalar {aka const Foam::dimensioned<double>}’
  return ((1/Re_)*exp(alpha*ln(m_)-T));
                                 ^
In file included from /home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/regIOobject.H:43:0,
                 from /home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricField.H:42,
                 from /home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                 from /home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                 from /home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/finiteVolume/lnInclude/volFields.H:37,
                 from alphaTLaw.H:40,
                 from alphaTLaw.C:26:
/home/himanshu/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/OSspecific.H:170:6: error: in passing argument 1 of ‘bool Foam::ln(const Foam::fileName&, const Foam::fileName&)’
 bool ln(const fileName& src, const fileName& dst);
      ^
alphaTLaw.C:60:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
I am not getting any clue why the error in bold is occurring I have followed this approach based on
http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

I would be thankful to you if you can provide any insight on the error....

Thank you
himanshu28 is offline   Reply With Quote

Old   January 11, 2015, 16:42
Default
  #16
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings himanshu28,

"ln" in OpenFOAM stands for "symbolic link", not "natural logarithm".
In C++, the natural logarithm function is named "log" and the base 10 one is "log10".

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 12, 2015, 01:56
Default
  #17
Senior Member
 
Himanshu Sharma
Join Date: Jul 2012
Posts: 101
Rep Power: 14
himanshu28 is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings himanshu28,

"ln" in OpenFOAM stands for "symbolic link", not "natural logarithm".
In C++, the natural logarithm function is named "log" and the base 10 one is "log10".

Best regards,
Bruno
Thank you Wyldckat for the help,I didn't notice such a silly thing. and now it build fine.
himanshu28 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
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Time Dependent Sinusoid Temperature cstack13 FLUENT 0 March 25, 2013 10:58
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Too low temperature at combustor outlet romekr FLUENT 2 February 6, 2012 11:02
Time Dependent Temperature Dependent BC Analysis RP Main CFD Forum 1 March 28, 2008 02:22


All times are GMT -4. The time now is 18:52.