|
[Sponsors] |
[swak4Foam] Writing a class to use in a groovyBC expression? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 22, 2014, 09:53 |
Writing a class to use in a groovyBC expression?
|
#1 |
Member
Olie
Join Date: Oct 2013
Posts: 51
Rep Power: 13 |
Hi,
I wish to write my own classwith functions that I can call from within an expression in a groovyBC boundary declaration in the 0/U file of a case. Can I write this class, compile it, then put it in a particular directory where OpenFOAM can access it when called from the 0/U file? And if so, what is the correct location? If not, what is the correct way of adding my own class/functions? Thanks, Olie |
|
July 22, 2014, 18:27 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
July 25, 2014, 11:02 |
|
#3 |
New Member
Join Date: Sep 2013
Location: Germany
Posts: 18
Rep Power: 13 |
Hi Bernhard,
great feature and a good presentation. I want to make use of this to call an external function from an older cpp file. How can I access the function? (to be correct it is a Fortran 77 based Database I managed it access it by a cpp wrapper. Now I want to implement it to a functionPlugin so that I m able to read out e.g.: Cv by giving the Temp .....I'm not really deep into c++ strukture classes. So it is quite difficult for me. Maybe some little advices would help me to find the right direction. Best regards, Alex ...I allready got your game of life sample through. And I try to understand the sample functions in the swak source..but still I don't know where to begin. |
|
July 26, 2014, 11:14 |
|
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Anyway: You say you've already got a C++ function that wraps the fortran stuff. So the hard part is already done and the rest can be tackled with a "Talent imitates, genius steals"-approach: Take the sources of the original "Game of life"-function and adapt them: 1. Rename the class to fit your application (also change the name of your function) 2. #Include the header to your wrapper Code:
#include "myCV.h" Code:
double myCV(double CV,int modelParameter1,double modelParameter2); Code:
forAll(field,cellI) { field[cellI]=myCV(old[cellI],42,666.6); } 5. Change the Contributor/Copyright appropriately if you want to pass the result around
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
July 28, 2014, 05:45 |
|
#5 |
New Member
Join Date: Sep 2013
Location: Germany
Posts: 18
Rep Power: 13 |
Thank you very much !! . I will try to implement it and will keep you updated.
Kind regards Alex |
|
July 28, 2014, 06:15 |
|
#6 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Of course that is if you're interested in the field (it just occurred to me that the title of the thread has "groovyBC". In that case you'd have to write a Plugin for the Patch-Driver. Which is slightly different)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
July 30, 2014, 12:03 |
|
#7 |
New Member
Join Date: Sep 2013
Location: Germany
Posts: 18
Rep Power: 13 |
...just figured out that I need to modify the thermophysicalModels to implement a new library. So unfortunatly I can't use swak. Sorry that I bothered you with my request. But your advice is still usefull in my currrent issues. Thanks anyway
|
|
Tags |
class, compile |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 06:38 |
Problem About Running Fluent In Linux | mitra | FLUENT | 18 | June 20, 2019 03:11 |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 19:44 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 07:25 |
Writing an expression for fully developed flow! | Usman | CFX | 12 | December 20, 2007 12:26 |