CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   transportModels/viscosityModels (https://www.cfd-online.com/Forums/openfoam/90779-transportmodels-viscositymodels.html)

mugi July 20, 2011 10:07

transportModels/viscosityModels
 
Dear all,

I try to implement a new transport model 'myPowerLaw'. The viscosity should be dependent on the Temperature. I created a myPowerLaw.C and a myPowerLaw.H. I get the Temperaturefield via

const volScalarField& T; (in .H)

T
(
U_.mesh().lookupObject<volScalarField>("T")
), (in.C)

I initiated nu_ as
volScalarField nu_; (in .H)


and as IOobject

nu_
(
IOobject
(
name,
U_.time().timeName(),
U_.mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
// U.mesh(),
calcNu()
)
(in .C)


Furtheron I defined the function calc(Nu) as follows:

Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::myPowerLaw::calcNu() const
{
return nuZero_*exp(22-(1/80)*T/TZero_);
}

(just a simple function for testing...)

It is compiling and running fine, but the problem is that I get only one single value for nu at every position of the mesh!!! And it is also not changing with time... So I need to tell the code to recalculate the viscosity in every timestep and to calculate the viscosity for each cell dependent on the Temperature that is in the certain cell.

I'm still new in OpenFOAM and I have no Idea how to do that! I would be very thankfull for any help!!!

Cheers,
Maike.


All times are GMT -4. The time now is 12:20.