CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

How to rewrite a standard OpenFOAM solver as a C++ class

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 17, 2016, 11:34
Default How to rewrite a standard OpenFOAM solver as a C++ class
  #1
New Member
 
Carlos Baptista
Join Date: Feb 2016
Location: Rotterdam, The Netherlands
Posts: 14
Rep Power: 10
cfbaptista is on a distinguished road
Standard OpenFOAM solvers are complete applications. This implies they do everything: read configuration files, initialize case and (for each time step) solve equations and write out data. This makes it difficult to embed an OpenFOAM solver into a 3rd party solver in a flexible manner.

I would like to know how to rewrite a standard OpenFOAM solver as a C++ class. By defining variables that need to remain in RAM as properties of the class and by defining actions (e.g. set boundary conditions, perform single time step, write out data) as methods of the class, I can instruct OpenFOAM to do what I want whenever I want.

My final objective is to rewrite pisoFoam as a C++ solver class for external flow cases (e.g. airfoil simulations). This class should contain methods to do at least the following:
  1. Set Dirichlet boundary conditions for the velocity field on the numerical boundary
  2. Perform a single time step

Can someone help me identify which variables I need to define as properties, or point me to documentation/tutorials dealing with similar things?

ps: Doing it the other way around (e.g. embedding the 3rd party solver inside OpenFOAM) is, unfortunately, not an option.
cfbaptista is offline   Reply With Quote

 

Tags
c++ solver class, embedding openfoam, interfacing openfoam


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which would be the most suitable standard solver in ejector problem? jexposito OpenFOAM Running, Solving & CFD 1 October 25, 2019 10:58
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
Can't get data from OpenFoam to external solver using externalCoupled perry OpenFOAM Running, Solving & CFD 4 May 26, 2014 08:09
Possible bug in OpenFoam Interpolation class MMC15 OpenFOAM Bugs 2 March 23, 2014 12:55
Building a custom solver on OpenFOAM 2.0 wschosta OpenFOAM Programming & Development 1 July 8, 2011 15:07


All times are GMT -4. The time now is 06:26.