CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   USER SCALAR (http://www.cfd-online.com/Forums/cfx/21248-user-scalar.html)

Robin K May 13, 2005 07:03

USER SCALAR
 
Hi,

To use the IVAR for IEQN in USRSRC for the first scalar it would be defined as this:

CALL GETVAR('USRSRC','SCAL ',ISCAL)

CALL GETSCA('USER SCALAR1',ISC1,CWORK)

ISC=ISCAL+ISC1-1

Then the above would be used as follows:

IF (ISC.EQ.IEQN) THEN

BLAH…

NOW if there are many scalars (say 2 more)…then would it be simply: for scalar two

CALL GETVAR('USRSRC','SCAL ',ISCAL)

CALL GETSCA('USER SCALAR2',ISC2,CWORK)

ISCA=ISCAL+ISC2-1

IF (ISCA.EQ.IEQN) THEN

BLAH…

CALL GETVAR('USRSRC','SCAL ',ISCAL)

CALL GETSCA('USER SCALAR3',ISC3,CWORK)

ISCB=ISCAL+ISC3-1

IF (ISCB.EQ.IEQN) THEN

BLAH…

ETC…

Thanks,

RK

Jeff May 15, 2005 04:51

Re: USER SCALAR
 
That's the idea. I'd get all three indices (ISC,ISCA, and ISCB) first and then set up the if then else as:

IF (ISC.EQ.IEQN) THEN

....Blah1

ELSE IF(ISCA.EQ.IEQN) THEN

....Blah2

ELSE IF(ISCB.EQ.IEQN) THEN

....Blah3

ENDIF

Just for programming efficiency.

Jeff


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