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

How to get the case nameroot outside main

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 16, 2007, 08:41
Default Hello! I would like to apol
  #1
New Member
 
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17
normunds is on a distinguished road
Hello!

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

#include"fvCFD.H"

...

argList* global_args;

...

main(int argc, char **argv) {
#include"setRootCase.H"
...
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

global.getCaseName()
global.getRoot()

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!

/Normunds
normunds is offline   Reply With Quote

Old   May 17, 2007, 12:13
Default runTime.caseName() runTime.ro
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
runTime.caseName()
runTime.rootPath()

Check Time.H in src/OpenFOAM/lnInclude/
eugene is offline   Reply With Quote

Old   May 18, 2007, 04:31
Default Thank you Eugene for your answ
  #3
New Member
 
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17
normunds is on a distinguished road
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"fvCFD.H"
#include"Time.H"
#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
them?


sincerely

/normunds
normunds is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Influece of wall velocity in the main flow marvin CFX 0 March 22, 2008 02:05
Main Diffenrences between commercian packages ?? Abou Main CFD Forum 8 October 16, 2006 08:36
axisymmetric main flow + injection Stephan FLUENT 1 January 19, 2006 11:43
Re: Heat transfer coefficient (from Main Forum) Eugene Phoenics 0 January 15, 2002 05:30
Main Star-CD Commands Maxime Perelli Siemens 1 April 17, 2001 08:35


All times are GMT -4. The time now is 11:19.