CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Beginner needs some advice how to get into programming a solver

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   August 28, 2013, 10:43
Default Beginner needs some advice how to get into programming a solver
Thomas Vossel
Join Date: Aug 2013
Location: Germany
Posts: 45
Rep Power: 4
ThomasV is on a distinguished road

I'm new to OpenFOAM and really need some advice. My job is to write a solver which is going to be about melting/solidification and a simple laminar flow of the fluid phase (which actually has been done by some persons here in the forum so I have some code to look at which is close to what I want to accomplish)...

My problem now is to get into the programming side of OpenFoam. In order to introduce myself I worked through the usual tutorials and e.g. created some custom geometry with in-/outlets and gave interFoam some work to do with it. So the general way of how to set up a project is clear to me. When diving into the code behind I'm facing huge problems though and I hope that someone here can help me with that...

1) Lack of comments / descriptions
Do things like solvers really have no real description? It seems like the source files don't give any more information than the wiki / user guide does. Let's have a look at interFoam's description:
Solver for 2 incompressible, isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach.

The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved.

Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.

For a two-fluid approach see twoPhaseEulerFoam.
Is that really all information I can get (especially as this is one of the more "lengthy" descriptions) or is there more elsewhere? I mean I don't expect to find every step described in detail but are there no details like "model XYZ is used here with approach ABC". Does one really have to stumble upon topics like THIS where you get to know not just you wrote the solver but also which scheme was used?

2.) Understanding what the code does
Probably my worst problem right now. When e.g. looking at icoFoam there are things I'd like to know what exactly they do. There for example is:
00063         solve(UEqn == -fvc::grad(p));
I now would like to know what the solve method does. The C++ documentation unfortunately just leads me HERE. I just can't figure out how to get to the actual implementation of the solve method. It's the same for e.g. this:
00090                 pEqn.solve();
I can search for pEqn in the C++ documentation but I end up with a list of pEqn.h files but no implementation of what "solve()" actually does.

3.) IDE?
Is there some way to make use of some kind of IDE like Eclipse? I did use Qt for a while and enjoyed not only having things like proposals for what I want might to write right now in terms of e.g. class names or methods a class offers but one also can simply point at e.g. a function and jump to the position where it's defined...
ThomasV is offline   Reply With Quote


Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
smoothSolver diverges - solution in using PBiCG solver? makaveli_lcf OpenFOAM Running, Solving & CFD 3 September 11, 2013 12:44
Looking for a solver (Mach 0.4, Turbulent, Heat Transfer, Second Order) fredo490 OpenFOAM Running, Solving & CFD 3 March 27, 2013 05:07
Getting too many iterations by velocity solving (aborting). Changing U - Solver? suitup OpenFOAM Running, Solving & CFD 0 January 20, 2010 08:45
Advice needed in writing my own solver... E. Turner Main CFD Forum 1 September 2, 2006 06:25
Convergence with coupled implicit solver Henrik Ström FLUENT 1 October 29, 2005 03:57

All times are GMT -4. The time now is 03:47.