|
[Sponsors] |
Using trig/hyperbolic functions with dimensioned scalars |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 20, 2013, 23:16 |
Using trig/hyperbolic functions with dimensioned scalars
|
#1 |
New Member
Chris Prohoda
Join Date: Mar 2013
Posts: 6
Rep Power: 13 |
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)); } 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, 04:37 |
|
#2 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
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) For your case, you could use Code:
cosh(Argument.value())/sinh(Argument.value()) Cheers, L |
|
April 21, 2013, 15:35 |
|
#3 | |
New Member
Chris Prohoda
Join Date: Mar 2013
Posts: 6
Rep Power: 13 |
Quote:
What does the "double&" mean, and does anyone have any suggestions for how to solve this? |
||
April 21, 2013, 17:55 |
|
#4 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 22 |
Ok, try adding 'Foam::' :
Code:
Foam::cosh(Argument.value())/Foam::sinh(Argument.value()) L |
|
April 21, 2013, 19:27 |
|
#5 |
New Member
Chris Prohoda
Join Date: Mar 2013
Posts: 6
Rep Power: 13 |
That worked! Thank you, Lieven
|
|
Tags |
hyperbolic functions, scalar types, trig functions |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
field functions - table | crevoise | STAR-CCM+ | 3 | March 26, 2013 10:37 |
Field functions and table | crevoise | Siemens | 0 | March 20, 2013 11:51 |
Flux functions for User-Defined Scalars | Zhengcai Ye | FLUENT | 0 | October 8, 2004 11:34 |
The Field Scalars in Tascflow | Darcy | CFX | 0 | November 19, 2003 23:14 |
N-S equations:divergence free functions? | D. Puigjaner | Main CFD Forum | 1 | July 27, 2000 13:43 |