CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Global variables storage in CFX. (

Fabio Kasper October 5, 2000 14:04

Global variables storage in CFX.
Hi everyone.

I'm a chemical engineering student and I have a simple question, but I don't know how to proceed with it. Is there a way to store global variables in the User Fortran supplied with CFX? When an user variable is stored, this one is only stored when the subroutine is called. In the next call, this variable is stored again, and looses its previous information. So, if I want to do a summation of a variable along the time, I won't be able to do it, because my variable is a local variable kind. Hence this happens because the variable is not specified at the main program code. Whenever I need something like this, I use to work with files, so I store the variable into a file and in the next iteration I read it for calculations. I keep storing it until simulations ends, but sometimes this strategy gives me several problems.

So, anyone could give some more alternatives to proceed with this fact ?

Thanks in advance. Fabio Kasper.

Fabian October 6, 2000 08:21

Re: Global variables storage in CFX.
Hi Fabio,

yes, there is a way how you can retain all values of every single variable from any subroutine. First, you have to understand that all values are stored in three huge arrays, WORK, IWORK, CWORK, (Real, Integer and Character, respectively). Only thing you have to do to get the value of a specific variable is to obtain the pointer of that variable in the field. This is achieved by the routine "CALL GETADD". To get the pointer to the variable stack, you use this funcion as follows: ('Calling routine','VAR ','VAR ',ILEVEL,JVAR). The pointer to the variables in the WORK stack then is JVAR. To obtain the value of say the V-velocity, you have to add NNODE, because V veocity has the variable number 2. So the v-velocity of the first node is stored in WORK(JVAR-1+NNODE). This is all explained in the solver manual in Chapter 11.5 Hope this helps Fabian

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