CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   natural logarithm function (http://www.cfd-online.com/Forums/openfoam-programming-development/66183-natural-logarithm-function.html)

zhoubinwx July 8, 2009 09:38

natural logarithm function
 
Dear all,

We know that for log function:
dimentionedScalar log (const dimentionedScalar & ds)

I try to get the log value of (r/R), where r is the distance between the point and cylinder center, R is the cylinder radius.

When I take a look at "analyticalCylinder" in programmers' guide, we see that
r = volScalarField magCentres;
R = dimensionedScalar radius

However, magCentres/radius (or magCentres/radius.value()) is not dimentionedScalar, so my question is:
do we have log function for this case? Or how could I convert volScalarField into dimentionedScalar, which is required by log function?

Thank you for your attention.

Bin

zhoubinwx July 9, 2009 02:20

solved
 
This is solved.
Thank you for your attention.
Bin

chiven October 21, 2009 02:27

Hi, dear Zhoubin, do you know how to convert dimentionedScalar into volScalarField? thanks. chiven

l_r_mcglashan October 21, 2009 05:51

If you solve something, then state how you have solved it. There is NOTHING worse (in my opinion) on message boards than searching through threads such as this!

isabel July 2, 2010 05:20

Hello friends,

I need to define the following variable; it is the natural logarithm of the time and a constant value:

volScalarField miso = ln(runTime+0.001);

But when I try to compile my solver I have the following error:

pdEqn.H:83: error: invalid initialization of reference of type ‘const Foam::fileName&’ from expression of type ‘Foam::dimensionedScalar’


Does anybody know what I have to do?

l_r_mcglashan July 4, 2010 06:30

'ln' is not what you think it is. 'ln' is defined in openfoam as:

Code:

bool ln                      (          const fileName &            src,                             
         
          const fileName &            dst                             
          )


isabel July 5, 2010 04:30

ln is the natural logarithm. I have successfully compiled my solver by introducing a surfaceScalarField unit variable:

miso = ln(unit*(runTime + 0.001*scalar(1))));

I am not sure if this is the best option.Does anyone have any better solution, or any comment?

l_r_mcglashan July 5, 2010 04:42

I can't see how that works. Use 'Foam::log' which returns a dimensionedScalar and computes the natural logarithm.

isabel July 5, 2010 06:13

Thank you very much. I prefer your suggestion.


All times are GMT -4. The time now is 07:11.