CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

natural logarithm function

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By isabel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 8, 2009, 10:38
Default natural logarithm function
  #1
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
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 is offline   Reply With Quote

Old   July 9, 2009, 03:20
Default solved
  #2
Senior Member
 
ZHOU Bin
Join Date: Mar 2009
Location: Nanjing/Torino, Nanjing/Piemente, China/Italy
Posts: 164
Rep Power: 17
zhoubinwx is on a distinguished road
Send a message via ICQ to zhoubinwx Send a message via MSN to zhoubinwx Send a message via Skype™ to zhoubinwx
This is solved.
Thank you for your attention.
Bin
zhoubinwx is offline   Reply With Quote

Old   October 21, 2009, 03:27
Default
  #3
Senior Member
 
J. Cai
Join Date: Apr 2009
Posts: 180
Rep Power: 17
chiven is on a distinguished road
Hi, dear Zhoubin, do you know how to convert dimentionedScalar into volScalarField? thanks. chiven
chiven is offline   Reply With Quote

Old   October 21, 2009, 06:51
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
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!
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   July 2, 2010, 06:20
Default
  #5
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17
isabel is on a distinguished road
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?
isabel is offline   Reply With Quote

Old   July 4, 2010, 07:30
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
'ln' is not what you think it is. 'ln' is defined in openfoam as:

Code:
bool ln                      (           const fileName &             src,                              
          
          const fileName &             dst                              
          )
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   July 5, 2010, 05:30
Default
  #7
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17
isabel is on a distinguished road
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?
soheil_r7 and Luttappy like this.
isabel is offline   Reply With Quote

Old   July 5, 2010, 05:42
Default
  #8
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
I can't see how that works. Use 'Foam::log' which returns a dimensionedScalar and computes the natural logarithm.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   July 5, 2010, 07:13
Default
  #9
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17
isabel is on a distinguished road
Thank you very much. I prefer your suggestion.
isabel is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 10:31
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 01:35
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


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