CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Power Law Viscosity Model (

cpplabs February 12, 2008 23:10

Hi, I tried to use Power La
I tried to use Power Law model by modifying Cross Power Law model. The following is the function I tried:

tmp<volscalarfield> PowerLaw::calcNu() const
return m_ * pow(0.01 + strainRate(), n_ - 1.0);

The function is ok to compile and link. But, when I tried to run the program, a fatal error happens in the following operator function:

dimensionSet operator+(const dimensionSet& ds1, const dimensionSet& ds2)
dimensionSet dimSum(ds1);

if (dimensionSet::debug && ds1 != ds2)
("operator+(const dimensionSet& ds1, const dimensionSet& ds2)")
<< "LHS and RHS of + have different dimensions" << endl
<< " dimensions : " << ds1 << " + " << ds2 << endl
<< abort(FatalError);

return dimSum;

It seems that the summation between the scalar value 0.01 and the strain rate scalar field is not allowed.

Can someone tell me the reason of the problem and how to fix the problem?
Thanks in advance.

cpplabs February 13, 2008 09:09

Hi Dragos, Thanks for the
Hi Dragos,
Thanks for the tip. It is dimension problem, the method can pass the dimension check but it causes problem in the returned volScalarField: the dimension of returned volScaleField changes with the parameter n.
The right way is to do the following:
return nu0_ * pow(0.01 + m_ * strainRate(), n_ - 1.0);
The m_ has reversed dimension with the return of strainRate() so that the product is dimentionless.

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