|
[Sponsors] |
March 27, 2015, 08:21 |
changing viscosity in main solver
|
#1 |
New Member
Luuk Buijs
Join Date: Mar 2015
Posts: 19
Rep Power: 11 |
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> ); Many thanks! Luuk |
|
March 28, 2015, 14:56 |
|
#2 |
Senior Member
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15 |
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:
|
|
March 30, 2015, 04:29 |
|
#3 | |
New Member
Luuk Buijs
Join Date: Mar 2015
Posts: 19
Rep Power: 11 |
Quote:
Can anyone here show me an example on how this or something comparable is done? Many thanks again! Luuk |
||
March 30, 2015, 05:08 |
|
#4 |
Senior Member
|
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. |
|
March 30, 2015, 07:04 |
|
#5 | |
New Member
Luuk Buijs
Join Date: Mar 2015
Posts: 19
Rep Power: 11 |
Quote:
Thank you very much for your reply. I'll look into this! |
||
March 30, 2015, 07:52 |
|
#6 |
Senior Member
|
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 |
|
March 24, 2019, 10:13 |
|
#7 |
New Member
ALOK KUMAR
Join Date: Apr 2016
Posts: 2
Rep Power: 0 |
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. |
|
|
|
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 |