CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   How to get the case nameroot outside main (

normunds May 16, 2007 08:41

Hello! I would like to apol

I would like to apologize for rather
simple question,also
my apologies if this is already
answered somewhere.

My problem is - I need to know the case
name and root directories outside the main()
function, in some of .C files where I
would like to define more complex boundary conditions.

I can use global variables in file with
main() function, something like



argList* global_args;


main(int argc, char **argv) {
global_args = &args;

and than in an other file

extern argList* global_args;

however it looks for me a bit ugly. Is here
an other way arround, something like functions


accessible from anywhere without
modification of main() body?

Is it possible to read transport
properties in a similar way, I must have mesh
for it's constructor, how to get it?

Thank you in advance!


eugene May 17, 2007 12:13


Check Time.H in src/OpenFOAM/lnInclude/

normunds May 18, 2007 04:31

Thank you Eugene for your answ
Thank you Eugene for your answer!

however, in my case it gives

error: 'runTime' was not declared in this scope

My file (globalTest.C)


#include"GlobalTest.H" // my code with class globalTest definition

globalTest::globalTest() {
Info << runTime.caseName() << endl;


may be I have to include some header
file with global runTime identifier declaration?

perhaps, I can ask my question in more exact
manner -

is inside OpenFoam source any
way how to access global case information
without remembering variables
(ones which holds case name, mesh, etc) on creation by myself?
Is here some globally accessible register
or whatever in which these unique things
(by meaning one per application)
are automatically remembered when I create



All times are GMT -4. The time now is 22:30.