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

changing viscosity in main solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2015, 08:21
Default changing viscosity in main solver
  #1
New Member
 
Luuk Buijs
Join Date: Mar 2015
Posts: 19
Rep Power: 11
lcbuijs is on a distinguished road
Dear Foamers,

I would like to edit buoyantBoussinesqPimpleFoam to implement temperature-dependent viscosity. I've started to work on createFields.H, by trying to output the viscosity. So far I've added:
Code:
    volScalarField nu
    (
        IOobject
        (
            "nu",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        <function goes here>
    );
However, this works only for any random name other than "nu". Can anyone point me in the right direction or tell me what steps I should take to change the viscosity?

Many thanks!
Luuk
lcbuijs is offline   Reply With Quote

Old   March 28, 2015, 14:56
Default
  #2
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Hi,

I think you can't do this in this way, since in this solver, nu is a transportProperties variable, and this creates a conflict between the nu the solver has and the one you define.

I propose you two thinks:
  • Modify the solver and include your nuModified instead of nu
  • I think there are different options to express nu as a function inside the transportProperties file... take a look to this thread
agustinvo is offline   Reply With Quote

Old   March 30, 2015, 04:29
Default
  #3
New Member
 
Luuk Buijs
Join Date: Mar 2015
Posts: 19
Rep Power: 11
lcbuijs is on a distinguished road
Quote:
Originally Posted by agustinvo View Post
  • Modify the solver and include your nuModified instead of nu
  • I think there are different options to express nu as a function inside the transportProperties file... take a look to this thread
Heres my problem: buoyantPimpleFoam is the go-to solver for this kind of implementation. I can't get that solver to work for my geometry however, and am therefore stuck with buoyantBoussinesqPimpleFoam, which works fine so far. I haven't been able to find anything on how to modify viscosity in the main buoyantBoussinesqPimpleFoam solver.

Can anyone here show me an example on how this or something comparable is done?

Many thanks again!
Luuk
lcbuijs is offline   Reply With Quote

Old   March 30, 2015, 05:08
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

In general it is done through implementation of new viscosity model. You can find existing models in $FOAM_SRC/transportModels/incompressible/viscosityModels. So you take, for example, powerLaw model; copy it into myCoolNewViscosityModelWithTemperature; rename source files, correct Make/files and Make/options; add const volScalarField& T_ as a property of new class; use U.mesh().lookupObject("T") to initialize T_; and finally in calcNu method you utilize T_ to calculate new value of viscosity.
alexeym is offline   Reply With Quote

Old   March 30, 2015, 07:04
Default
  #5
New Member
 
Luuk Buijs
Join Date: Mar 2015
Posts: 19
Rep Power: 11
lcbuijs is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

In general it is done through implementation of new viscosity model. You can find existing models in $FOAM_SRC/transportModels/incompressible/viscosityModels. So you take, for example, powerLaw model; copy it into myCoolNewViscosityModelWithTemperature; rename source files, correct Make/files and Make/options; add const volScalarField& T_ as a property of new class; use U.mesh().lookupObject("T") to initialize T_; and finally in calcNu method you utilize T_ to calculate new value of viscosity.
Dear Alexey,

Thank you very much for your reply. I'll look into this!
lcbuijs is offline   Reply With Quote

Old   March 30, 2015, 07:52
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

It turns out there is an example of implementation - http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf [1]

There author decided to lookup temperature field each time calcNu is called instead of looking the field in constructor.

[1] - http://www.cfd-online.com/Forums/ope...tml#post538956
alexeym is offline   Reply With Quote

Old   March 24, 2019, 10:13
Default
  #7
New Member
 
ALOK KUMAR
Join Date: Apr 2016
Posts: 2
Rep Power: 0
alok1463 is on a distinguished road
Hi All,
I am simulating slurry flow. I am facing following problem during implementation of different functions of viscosity in different regions based on alpha. Expressions for the viscosity are given below.


volScalarField mueff
(
IOobject
(
"mueff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("mueff", dimViscosity, 0.0)
);

Definition of viscosity:
forAll(mesh.cells(), i)
{
mueff[i]= mu2.value()*(1.0 + 2.5*alpha1[i] + 10.05*Foam::sqr(alpha1[i]) + 0.00273*Foam::exp(16.6*alpha1[i]));

if ((alpha1[i] > 0.305))
{
mueff[i]=mu2.value();
}
}

Momentum equation:
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(phi, U)
+ MRF.DDt(rho, U)
- fvm::laplacian(rho*mu2/rho2, U)
- fvc::laplacian(rho*mueff*alpha1/rho2, US)
- fvc::laplacian(mu2*gs, US)
==
fvOptions(rho, U)
- gs*(rhos-rho2)*g
- fvm::Sp(Kdf, U)
);
UEqn.relax();
fvOptions.constrain(UEqn);


Solver is compiled successfully but it gives following error during running of test case:


DILUPBiCGStab: Solving for T, Initial residual = 1, Final residual = 7.09367e-09, No Iterations 5
DILUPBiCGStab: Solving for C, Initial residual = 0.000216836, Final residual = 6.22504e-13, No Iterations 1
THERMO: iteration 1 residual: 0
#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::sigFpe::sigHandler(int) at ??:?
#2 ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#4 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:perator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#5 ? at ??:?
#6 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#7 ? at ??:?
Floating point exception (core dumped)


Please provide me the suggestions to rectify the errors.


Thank you.

Last edited by alok1463; March 25, 2019 at 07:48.
alok1463 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 with divergence TDK FLUENT 13 December 14, 2018 06:00
different results between serial solver and parallel solver wlt_1985 FLUENT 11 October 12, 2018 08:23
Changing viscosity in interFoam ThomasV OpenFOAM Running, Solving & CFD 5 March 12, 2015 06:43
OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon qinmaple OpenFOAM Announcements from Other Sources 4 August 10, 2012 11:00
Too low temperature at combustor outlet romekr FLUENT 2 February 6, 2012 10:02


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