CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   INTFLG (https://www.cfd-online.com/Forums/siemens/53566-intflg.html)

Juliet November 26, 2003 19:29

INTFLG
 
Hi,experts can you give me detailed information about INTFLG, how to use it, what is it mean?

thanks a lot Juliet


Richard November 27, 2003 04:49

Re: INTFLG
 
INTFLG is an array of 100 integers which is available to all user subroutines. The initial values are 0, but STAR "remembers" any changes you make to these values. Hence you can use INTFLG to pass a message from one subroutine to another, or from one call of a subroutine to the next call of the same subroutine. So, for example, if you wanted a subroutine to do something once only:

if (intflg(1).eq.0) then &nbsp&nbsp do_this_once &nbsp&nbsp intflg(1)=1 end if

Juliet November 27, 2003 19:06

Re: INTFLG
 
thank you Richard!

I understand some from you. but it is not very clear now, for example, if i want first call sorsca.f then sorent.f, therefore i should make (if intflg(1) .eq. 0 then(),intflg(1)=1,endif )in sorsca.f, then i make (if intflg(1).eq.1 then (),intflg(1)=2,endif) in sorent.f. is it right? but how to pass some message from one subroutine to another, would you give me some example for intflg? thank you again for your help and your time!

Juliet

Richard November 28, 2003 04:12

Re: INTFLG
 
The INTFLG array doesn't "mean" anything by default; it doesn't control which subroutines are called or what order they are called in. You can think of it as scratch space which STAR maintains for you. STAR "promises" to initialise the array to 100*0, to pass it to all user subroutines and to "remember" the changes you make to it. Hence these are flags for you to use as you wish.

Here's a simple example. Suppose you wanted your user subroutine to print a message the first time it is called - useful if you want to be sure it is being used. Here's how you could do it (in BCDEFI, for example):

if (intflg(1).eq.0) then write(*,*) 'In BCDEFI!' write(60,*) 'In BCDEFI!' intflg(1)=1 end if

The choice of which intlfg you use (in the range 1-100) is up to you, but make sure there's no conflict with other intflgs you use elsewhere. Now, other subroutines will see intflg(1)=1 as well, so you could have some code in another subroutine, like this

if (intflg(1).eq.1) then write(*,*) 'BCDEFI has already been called' write(60,*) 'BCDEFI has already been called' end if

Juliet November 29, 2003 00:31

Re: INTFLG
 
thank you so much Richard!

now i understand some about it, it looks useful sometimes, so i will try it.i wish i can get more help from you if i have advanced qustion about it after practice

thank you again

regards

Juliet


Steve December 1, 2003 04:20

Re: INTFLG
 
Alternatively, just define your own COMMON blocks to share data between routines.


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