
[Sponsors] 
November 22, 2013, 17:11 
Time and temperature dependent viscosity

#1 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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 asthough 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. 

November 24, 2013, 07:46 

#2 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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? 

November 24, 2013, 08:08 

#3  
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108 
Hi sur4j,
Quoting from your other thread: Quote:
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/standardsolvers.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
__________________


November 24, 2013, 08:45 

#4 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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? 

November 24, 2013, 09:10 

#5  
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108 
Hi sur4j,
Quote:
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:
Feel free to read more about it here:
Bruno
__________________


November 26, 2013, 15:17 

#6 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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. 

November 26, 2013, 17:54 

#7  
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108 
Hi sur4j,
Well, first of all, icoFoam is a transient solver: http://www.openfoam.com/features/standardsolvers.php Quote:
If you look at the page from the link above, you'll find this solver: Quote:
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
__________________


November 27, 2013, 06:55 

#8 
Senior Member
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 266
Rep Power: 11 
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 

December 8, 2013, 14:35 

#9 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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. 

December 8, 2013, 14:44 

#10 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108 
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
__________________


December 8, 2013, 17:06 

#11 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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 rerunning 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. 

December 9, 2013, 16:52 

#12 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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=1e05 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. 

December 10, 2013, 16:29 

#13 
Member
Join Date: Aug 2013
Posts: 60
Rep Power: 6 
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. 

December 28, 2013, 15:12 

#14 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108 
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
__________________


January 6, 2015, 02:53 
Error while building a new viscosity model..

#15 
Member
Himanshu Sharma
Join Date: Jul 2012
Posts: 98
Rep Power: 7 
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; } // ************************************************************************* / Code:
Making dependency list for source file alphaTLaw.C SOURCE=alphaTLaw.C ; g++ m64 Dlinux64 DWM_DP Wall Wextra Wnounusedparameter Woldstylecast Wnonvirtualdtor O3 DNoRepository ftemplatedepth100 I/home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/transportModels/incompressible/lnInclude/ I.. I../twoPhaseMixture/lnInclude I/home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/finiteVolume/lnInclude IlnInclude I. I/home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/OpenFOAM/lnInclude I/home/himanshu/OpenFOAM/OpenFOAM2.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/OpenFOAM2.3.0/src/OpenFOAM/lnInclude/regIOobject.H:43:0, from /home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/OpenFOAM/lnInclude/GeometricField.H:42, from /home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/OpenFOAM/lnInclude/GeometricScalarField.H:38, from /home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/OpenFOAM/lnInclude/GeometricFields.H:34, from /home/himanshu/OpenFOAM/OpenFOAM2.3.0/src/finiteVolume/lnInclude/volFields.H:37, from alphaTLaw.H:40, from alphaTLaw.C:26: /home/himanshu/OpenFOAM/OpenFOAM2.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 nonvoid function [Wreturntype] } ^ 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 

January 11, 2015, 16:42 

#16 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,978
Blog Entries: 39
Rep Power: 108 
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
__________________


January 12, 2015, 01:56 

#17 
Member
Himanshu Sharma
Join Date: Jul 2012
Posts: 98
Rep Power: 7 
Thank you Wyldckat for the help,I didn't notice such a silly thing. and now it build fine.


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Low Mixing time Problem  Mavier  CFX  5  April 29, 2013 00: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 