|
[Sponsors] |
[swak4Foam] Writing a class to use in a groovyBC expression? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#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 |
|
![]() |
![]() |
![]() |
![]() |
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
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 |
||
![]() |
![]() |
![]() |
![]() |
#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. |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
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 |
||
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
Join Date: Sep 2013
Location: Germany
Posts: 18
Rep Power: 13 ![]() |
Thank you very much !!
![]() Kind regards Alex |
|
![]() |
![]() |
![]() |
![]() |
#6 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 52 ![]() ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#7 | |
New Member
Join Date: Sep 2013
Location: Germany
Posts: 18
Rep Power: 13 ![]() |
Quote:
![]() |
||
![]() |
![]() |
![]() |
Tags |
class, compile |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
decomposePar problem: Cell 0contains face labels out of range | vaina74 | OpenFOAM Pre-Processing | 37 | July 20, 2020 05:38 |
Problem About Running Fluent In Linux | mitra | FLUENT | 18 | June 20, 2019 02:11 |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 18:44 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 06:25 |
Writing an expression for fully developed flow! | Usman | CFX | 12 | December 20, 2007 11:26 |