CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CD-adapco (
-   -   HPC and subroutines (

Steve February 21, 2003 10:10

HPC and subroutines

I have a user subroutine, the body of which is only executed by node 0 for an HPC job. That subroutine may want (need) to shut down the whole job. Is there an undocumented subroutine/function call in StarCD that I can call to effect this? Currently it calls the FORTRAN STOP statement, which stops node 0, leaving the other nodes hanging. I cannot find anything in the HPC manual that seems to apply. Any advise greatfully accepted.

- Steve

jimbo February 21, 2003 11:38

Re: HPC and subroutines
Yes there is. The "nice" way to exit your user subroutine is to call stquit().

cjtune February 21, 2003 12:25

Re: HPC and subroutines
But does it nicely shut down STAR as well? Maybe a 'call system' statement that does a 'touch ABORT' (may need to use with ssh or rsh command) on all working directories?

jimbo February 24, 2003 12:48

Re: HPC and subroutines
sounds complicated!

In your subroutine include; if(everything goes wrong) call stquit(1) and your STAR run will die, all of it.

CJ Tune February 24, 2003 20:46

Re: HPC and subroutines
Is stquit() a STAR function or standard Fortran function? Will it properly save the last iteration's data in the post file?

jimbo February 25, 2003 09:43

Re: HPC and subroutines
If you want the process to stop and write out a .pst file then stquit is not for you. stquit, is a replacement for the FORTRAN 'STOP' (FYI it is a STAR routine).

If you want to exit and write out a pst file, then you can do this by creating an ABORT file on the master node (only, you don't really need to have one in each subdirectory). You could probably do something clever with a gsum of a variable and a test on the master node, which would then create your ABORT file. I think that would be easier than going into system commands etc....

cjtune February 25, 2003 10:36

Re: HPC and subroutines
Thanks jimbo. I toyed with HPC for awhile (demo license) and was thinking along the lines of something like the C3 ( suite of command-line programs where you can execute commands on all nodes simultaneously. But since you only need to create an ABORT file on the master node, I guess it's really much easier then.

BTW, how can I find out more about 'undocumented' STAR routines? I only knew of two before (gloloc and locglo) and today, stquit.

jimbo February 25, 2003 11:47

Re: HPC and subroutines
As you may have guessed, I work for CD adapco, hence my knowledge of things like stquit. You should be able to get some info from your support engineer although, understandably, not every support engineer has an in-depth knowledge of advanced user coding techniques.

The other way is to go on the User Subroutines course which, in my opinion, is very good and is used a lot internally for top user coding tips.

If anyone (who doesn't work for CD adapco) who has been on the User Coding course, perhaps they could give their comments ...

CJ Tune February 25, 2003 21:23

Re: HPC and subroutines
Well, I haven't gone to the course yet but I do have the course notes (.pdf format) left over from my predecessors. I running solely on elbow grease...

It's quite comprehensive but a bit dated. Windows users will be puzzled at first when their usubs don't work because now the COMMON blocks are referenced by pointers (have to specify the COMMON pointers too in the usub). Found this out when comparing between starin.f from the Windows v3.15 and UNIX v3.15 but not after some angst in trying to root out a bug that wasn't there in the first place.

I'm still stuck on a couple of issues (last checked: yet unanswered on this forum), and the support engineer was quick in supplying me some sample user coding -but unfortunately gave only very scant explanation as to how anything works.

Although STAR-CD usub coding is not yet 'general knowledge' amongst users, I appreciate the fact that CD-Adapco has made a solid product with a very 'open' architecture. Of course I also understand that CD-A cannot document or make public everything that is in the code to avoid giving away the tricks-of-the-trade to competitors.

Steve February 26, 2003 08:05

Re: HPC and subroutines
Thanks for the comments guys.

I think I'll try how stquit()performs. Sounds like yet another undocumented facet of user subroutine use. Are there any platform dependencies or is it a wrapper around them?

- Steve

jimbo February 28, 2003 12:39

Re: HPC and subroutines

CJ, if you look at either the release or sup notes for the Windows port you will find the documentation of pointers for common blocks on windows.

Steve, there are no system specific issues relating to stquit.


cjtune March 1, 2003 01:01

Re: HPC and subroutines
Thanks jimbo. I found it eventually on pg 4 of the FAQ.

Does CD-A plan/has any documentation on internal STAR routines like stquit()? I found it appears only exactly once in the User Subroutine training notes... Others like GLOLOC and LOCGLO (which are useful if you have multiple axes of rotation in a model to manipulate) I had to find out from support and was never public, as far I could remember.

Steve March 3, 2003 06:02

Re: HPC and subroutines
Given that StarCD is simply a monolithic hunk of FORTRAN code shipped as a set of objects and libraries, you could, in theory, call any proprietary function or subroutine if you knew it's argument list. And I bet there are many user routines out there based on hints/tips/insider knowledge given out by current or former Star personnel.

The fun starts when one Star office recommends using an undocumented routine or common block, whilst another Star office is in the process of removing it from the code for ever.

cjtune March 3, 2003 11:19

Re: HPC and subroutines
Dang, I'm being drawn into 'underground' STAR-CD... the 'back-alleys' of coding.

Er, are you in any position to give tips? I would particularly like to know what flip32 does... or is there any routine for you to 'point' to a particular event arbitrarily and have it executed regardless of event time?

Steve March 3, 2003 12:49

Re: HPC and subroutines
Er, sorry no. I'm not that same "Steve" that hangs around here occasionally and seems to maybe work for either CD or Adapco.

Given its name, I reckon flip32 could be a byte swapping routine. Just a guess though.

cjtune March 4, 2003 00:53

Re: HPC and subroutines
Dang, I was hoping you were. Well, that'll be an open question to all the Steves in this forum. Thanks.

Steve March 4, 2003 04:36

Re: HPC and subroutines
Nope. He spells his name with a lower case "s". My interest in user routines is using them to couple 1D and 3D codes, StarCD being one such 3D code.

cjtune March 4, 2003 06:35

Re: HPC and subroutines
GTPower? Wave? I take it you need to subroutines to help map the results at some node of your 1D code as transient boundary conditions for a STAR-CD model -ICE, perhaps?

steve March 5, 2003 15:19

Re: HPC and subroutines
Could you not set up a conditional event? If you look at the EICOND, you can force an event to happen in the user subroutine UBINIT. It appears that you can make events happen anytime you want that way.

If I capitalize the first letter of my name nobody would ever know who was talking to who.


cjtune March 5, 2003 21:08

Re: HPC and subroutines
Why don't you guys postfix something to your nicks, like Steve3:69 or steve_wonder?

Tried that at first when I couldn't figure out the sample usub supplied by support (that uses some obscure method of reading from I/O 32, using flip32(,,), and the variable ETIMEJ). By golly I was really hoping it would work but somehow ProSTAR hangs when I try to declare:

(previous two events 1 and 2 are partial sliding events)

*SET EVTN 2 1 *SET CTYS 49 1 *SET CLAM 150


...specifically when executing EDCE or EACE.

All times are GMT -4. The time now is 01:29.