# Using trig/hyperbolic functions with dimensioned scalars

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 20, 2013, 22:16 Using trig/hyperbolic functions with dimensioned scalars #1 New Member   Chris Prohoda Join Date: Mar 2013 Posts: 6 Rep Power: 5 I'm trying to compute the cosh and sinh of a dimensionedScalar, and it won't accept the arguments. Here is my code: Code: ```forAll(M,celli){ Argument = fitParameter*H[celli].x()/T[celli]; M[celli].x()=Msat*(cosh(Argument)/sinh(Argument)); }``` "Argument" is a dimensioned scalar, and "M" is a volVectorField. I get the error "cannot convert 'Foam::dimensioned' to 'double' in assignment" on the second line of code. Two questions: (1) Is there a way to perform cosh et al on a vector or field? From the documentation, it looks like it only accepts scalars, but I'm not sure. (2) How can I solve the issue? Argument.value() doesn't seem to work, and using a const dimensionedScalar doesn't make sense with my problem. I really appreciate your help. Thanks!

 April 21, 2013, 03:37 #2 Senior Member   Lieven Join Date: Dec 2011 Location: Leuven, Belgium Posts: 297 Rep Power: 14 It is not allowed to compute the cosh or sinh of a dimensioned numer. Just this about it, what would be the meaning of Code: `scalar cosFive = cos(5 m/s)` cosh or sinh are no exception for this. For your case, you could use Code: ` cosh(Argument.value())/sinh(Argument.value())` to solve this. Cheers, L

April 21, 2013, 14:35
#3
New Member

Chris Prohoda
Join Date: Mar 2013
Posts: 6
Rep Power: 5
Quote:
 Originally Posted by Lieven It is not allowed to compute the cosh or sinh of a dimensioned numer. Just this about it, what would be the meaning of Code: `scalar cosFive = cos(5 m/s)` cosh or sinh are no exception for this. For your case, you could use Code: ` cosh(Argument.value())/sinh(Argument.value())` to solve this. Cheers, L
Thank you for your suggestion. However, when I try using Argument.value(), I get this error: "overloaded function cosh(double&) is ambiguous. Candidates are double cosh(double)."

What does the "double&" mean, and does anyone have any suggestions for how to solve this?

 April 21, 2013, 16:55 #4 Senior Member   Lieven Join Date: Dec 2011 Location: Leuven, Belgium Posts: 297 Rep Power: 14 Ok, try adding 'Foam::' : Code: `Foam::cosh(Argument.value())/Foam::sinh(Argument.value())` Cheers, L

 April 21, 2013, 18:27 #5 New Member   Chris Prohoda Join Date: Mar 2013 Posts: 6 Rep Power: 5 That worked! Thank you, Lieven

 Tags hyperbolic functions, scalar types, trig functions

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post crevoise STAR-CCM+ 3 March 26, 2013 10:37 crevoise CD-adapco 0 March 20, 2013 11:51 Zhengcai Ye FLUENT 0 October 8, 2004 10:34 Darcy CFX 0 November 19, 2003 23:14 D. Puigjaner Main CFD Forum 1 July 27, 2000 12:43

All times are GMT -4. The time now is 16:24.

 Contact Us - CFD Online - Top