CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   dimensionedScalar + volScalarField is evaluated elementwisely ? (

tianyikillua March 29, 2012 13:53

dimensionedScalar + volScalarField is evaluated elementwisely ?
Hello everyone,

I'd like to know if a dimensionedScalar (ex. T1) + volScalarField (ex. T) is still a volScalarField and the result is obtained elementwisely, that is : result(i)=T1+T(i).

I need also to use a scalar function (ex. pos) determing the positivity of a scalar. If I apply this function to a volScalarField (ex. T), can I still obtain a volScalarField and result(i)=pos(T(i)) ?

I wrote this because I'm now implementing a non-constant diffusivity in the laplacianFoam solver.

In mylaplacianFoam.C, I have

before solving the laplacian equation.

In creatFields.H, I have

    volScalarField DT

where ai, bi, T1 and T2 are scalars and DT is piecewise affine in [0,T1], [T1,T2] and [T2,+Inf].

Thank you very much for your help !!

akidess March 30, 2012 03:12

Yes, pos(T - X), where T is a volScalarField and X is a dimensionedScalar will return a volScalarField.

All times are GMT -4. The time now is 22:01.