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

Update Viscosity in every time step

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By mAlletto

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   August 22, 2021, 16:48
Default Update Viscosity in every time step
  #1
New Member
 
HH
Join Date: Apr 2019
Posts: 17
Rep Power: 7
user_HH is on a distinguished road
Hi Foamers,

For an incompressible flow case using a solver based on pimpleFoam, i am trying to update kinematic viscosity (nu()) as a function of temperature. (OpenFOAM version v1806)

I created a solver called ExpLaw using powerLaw as a reference.

# Code:

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

return k_*exp(-n_*(T - Talpha_));
}

#

The model compiles and works in the first time step, where viscosity is being calculated using this new model. However, the model then doesn't update and shows the same values.

Now, when i stop the simulation and restart it from the last recorded time step, the expLaw is accessed and it calculates the new viscosity values at the first time step. After that, in the consecutive time steps, it again does not update the viscosity.

I have looked at a lot of different threads on this forum and spent days to solve this problem but cannot find a way to update the viscosity at each time step based on changes in the temperature field.

Please help me solve this issue.
i will really appreciate the help.

Thanks in advance.

Best,
HH
user_HH is offline   Reply With Quote

 


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
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
Setting up Lid driven Cavity Benchmark with 1M cells for multiple cores puneet336 OpenFOAM Running, Solving & CFD 11 April 7, 2019 00:58
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 13:40
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 00:01
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 10:37.