CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   how to develope a solver (

AmirBaqa1987 May 5, 2013 04:01

how to develope a solver
Hi everyone,
i want to develop a solver by adding energy equation
to momentum equation(like adding temperature to icoFoam solver) but the difference is that the variables are coupled in these two equations for instance, viscosity in momentum equation varies with temperature in energy equation.
what should i do?

any help is appreciated.


fabian_roesler May 5, 2013 05:13

new volScalarField nu

stick to this howTo:
HTML Code:
1. You can add a new scalarField nu for the kinematic viscosity to the createFields.H like this:


volScalarField nu (    IOobject    (          "nu",          runTime.timeName(),          mesh,          IOobject::NO_READ,          IOobject::AUTO_WRITE      ),      nu0*(scalar(1)-nuk*(T-T0) );

2. Read the constants of your viscosity function. For example nu0, nuk and T0 for a linear function


nu = nu0*(scalar(1)-nuk*(T-T0));


dimensionedScalar nu0 (      transportProperties.lookup("nu0") );
dimensionedScalar nuk (      transportProperties.lookup("nuk") );

3. Update your viscosity function after you solved for temperature in the TEqn.H


nu = nu0*(scalar(1)-nuk*(T-T0));

This should be all.



AmirBaqa1987 May 6, 2013 02:57

Hallo Fabian

Vielen Dank.

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