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

Environment variable ($MPI_PROCS) in decomposeParDict

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By haakon

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 7, 2013, 23:30
Default Environment variable ($MPI_PROCS) in decomposeParDict
  #1
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 13
Pj. is on a distinguished road
Hi everyone,

this is my second post, so please excuse me if the question is pretty stupid.

I'm trying to run a OpenFOAM case on a super-computer with PBS queue manager. In the launch script I create the environment variable MPI_PROCS that contains the number of CPU that i'm using.

Is it possible to use this variable as number of subdomain in the decomposeParDict? (I'm using the scotch/ptscotch method, so I don't have to bother about the number of subdomain in other options)

I've tried to set just $MPI_PROCS in the place of the number of subdomain, but it gives me the error "Bad token in decomposeParDict ....etc etc".

PS: I'm not even very sure of what i'm saying, but could it be that i need to "export" the variable from the launch script to the variables of the run? (excuse me if my language is not technically correct, but I'm not a computer technician, I don't even now very well what environment variables are...)

thank you
Pj. is offline   Reply With Quote

Old   April 8, 2013, 03:34
Default
  #2
Senior Member
 
Join Date: Dec 2011
Posts: 111
Rep Power: 19
haakon will become famous soon enough
Ok; this might not be what you want, but this is my solution to this problem:

  1. In decomposeParDict, replace numberOfSubdomains 144; (or whatever number you want to use) with #include "numProcs"
  2. In the job script (the one you submit to PBS) you write the following line:
    Code:
    echo "numberOfSubdomains $MPI_PROCS;" > system/numProcs
    before you decompose the domain.
  3. When the job is started, the file system/numProcs will be written, and read together with decomposeParDict.
This trick also work brilliantly for other parts of OpenFOAM as well, for example mesh convergence studies, time step convergence or other, generic parameter studies.

However, if someone has a method of getting environment variables directly in a dictionary, that would be great, as this method is a bit "dirty".
sylvester likes this.
haakon is offline   Reply With Quote

Old   April 8, 2013, 03:38
Default
  #3
Pj.
Member
 
Luca
Join Date: Mar 2013
Posts: 68
Rep Power: 13
Pj. is on a distinguished road
Thank you very much haakon.

I see what you mean when you say that it's a bit "dirty", but it does exactly what I need.

It saves me from change that damn number every time i need to change number of CPU.

Thank you very much for the tip
Pj. is offline   Reply With Quote

Reply

Tags
decomposepar, environment variable, mpi, pbs


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
[swak4Foam] SWAK4FOAM_SRC environment variable fcuevas OpenFOAM Community Contributions 2 June 18, 2012 10:58
emag beta feature: charge density charlotte CFX 4 March 22, 2011 10:14
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas COMSOL 1 May 30, 2008 05:35
How to set environment variables kanishka OpenFOAM Installation 1 September 4, 2005 11:15
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


All times are GMT -4. The time now is 16:10.