|
[Sponsors] |
January 23, 2016, 08:43 |
Read in Formula via Dictionary
|
#1 |
Senior Member
Join Date: Jan 2014
Posts: 179
Rep Power: 12 |
Hi guys,
quick question, I created an own Dict and reading in a formular via Code:
word cd(word(sensorDict.subDict("solving").lookup("cd"))); Code:
cd "1+10*Foam::exp(Re,0.66666667)"; Thanks for help |
|
January 25, 2016, 04:28 |
|
#2 |
Senior Member
Join Date: Jan 2014
Posts: 179
Rep Power: 12 |
Hi, I tried with
Code:
#include <cstdlib> scalar cd_form=atof(cd.c_str()); Any ideas? |
|
January 25, 2016, 04:29 |
|
#3 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
This means you will need to have a parser/interpreter. I'm not sure if there is one in OpenFOAM, yiou might have some luck with swak4Foam though.
|
|
January 27, 2016, 12:47 |
|
#4 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
I think you might want equationReader.
swak4Foam could be suitable, but if you want to parse a user-entered equation and use it at your discretion within your application, then that is exactly what equationReader was intended for. Be careful, though... any interpreted equations will take longer to evaluate than hard-coded equations.
__________________
~~~ Follow me on twitter @DavidGaden |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Read properties per component from an input file dictionary | Cyp | OpenFOAM Programming & Development | 29 | November 1, 2015 22:41 |
Including lists in a dictionary. | Divyaprakash | OpenFOAM Programming & Development | 0 | June 18, 2015 07:14 |
writing subDict in a dictionary | ubaid | OpenFOAM Programming & Development | 3 | October 25, 2014 18:17 |
Reading a field(?) within a dictionary | ecbmxer | OpenFOAM Programming & Development | 0 | July 14, 2014 17:21 |
Overwriting dictionary from BC | Phicau | OpenFOAM Programming & Development | 1 | January 25, 2013 05:24 |