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

main()-execution and object creation within

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 16, 2020, 06:59
Default main()-execution and object creation within
  #1
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 369
Rep Power: 8
geth03 is on a distinguished road
Hi,

from my understanding if i want to create an object from a class i do the following:
classname objectname;
afterwards i can access the member functions of this class:
objectname.read();

when running a solver the main-function is executed.
however, within the main-function i don't see where the object of the pimple solver is created. i just see for example (reactingMultiphaseEulerFoam.C):

// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
fluid.solve();
fluid.correct();

#include "YEqns.H"

if (faceMomentum)
{
#include "pUf/UEqns.H"
#include "EEqns.H"
#include "pUf/pEqn.H"
}
else
{
#include "pU/UEqns.H"
#include "EEqns.H"
#include "pU/pEqn.H"
}

fluid.correctKinematics();

if (pimple.turbCorr())
{
fluid.correctTurbulence();
}
}

can anybody please explain how the object fluid or pimple is created? are those created in the header files and imported with #include? if yes, where is the code part that generates those objects automatically and gives these objects its names.
also,i don't understand how functions are executed only by including some header files.
do these header files contains certain code that are executed automatically?

thanks in advance.
geth03 is offline   Reply With Quote

Old   December 28, 2021, 08:17
Default
  #2
New Member
 
Peng Ningning
Join Date: May 2020
Posts: 5
Rep Power: 6
Linmunn is on a distinguished road
hi geth,

Have you figured out this problem? I have the same confusion.
Linmunn is offline   Reply With Quote

Old   December 28, 2021, 08:50
Default
  #3
Senior Member
 
Join Date: Dec 2019
Location: Cologne, Germany
Posts: 369
Rep Power: 8
geth03 is on a distinguished road
Hi,

There is nothing to be confused about. Back then i didn't know anything about code structure.

If you want to find how the code is written, you need to dig deeper and look how its done.

If you are new to openfoaming coding, i suggest you start with icofoam and look how it is coded.

Regards
geth03 is offline   Reply With Quote

Old   December 28, 2021, 09:25
Default
  #4
New Member
 
Peng Ningning
Join Date: May 2020
Posts: 5
Rep Power: 6
Linmunn is on a distinguished road
Quote:
Originally Posted by geth03 View Post
Hi,

There is nothing to be confused about. Back then i didn't know anything about code structure.

If you want to find how the code is written, you need to dig deeper and look how its done.

If you are new to openfoaming coding, i suggest you start with icofoam and look how it is coded.

Regards
Thanks for your suggestion.
Linmunn is offline   Reply With Quote

Reply

Tags
programming, solver


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
[snappyHexMesh] Placing an object on top of the NACA0012 airfoil shape najimaddin96 OpenFOAM Meshing & Mesh Conversion 0 March 21, 2020 23:53
Is the full text of an IOdictionary stored in RAM for the life of the object? knuckles OpenFOAM Programming & Development 0 November 3, 2015 12:46
Problem Execution Control ICEM-CFX cote2714 CFX 5 September 10, 2015 14:03
[waves2Foam] floating object inside the flume tutorial with interDyMFoam Rising Star OpenFOAM Community Contributions 2 April 21, 2015 00:42
Problems with the execution of the setFields utility. foamer OpenFOAM Pre-Processing 5 June 3, 2013 13:24


All times are GMT -4. The time now is 13:58.