CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Siemens (https://www.cfd-online.com/Forums/siemens/)
-   -   common blocks (https://www.cfd-online.com/Forums/siemens/54152-common-blocks.html)

CMB November 9, 2004 09:51

common blocks
 
Hi, this is a question that has more to do with fortran than star itself. Some times I use variables that I calculate in POSDAT.f and then use in other subroutines such as SOR*.f. My question is that, when looping the mesh with DO ic=1,nctmax and then reducing the loop for ictid(ic).eq.#. Then calculate a variable(ip) for this cell region. Why is it that if I define the variable I have to give it the size of variable(nctmax) rather than variable(# of cells in ictid(ic).eq.#)? Kind regards CM

4xF November 12, 2004 09:41

Re: common blocks
 
Either you do not know which (STAR) cell numbers are belonging to the cell type # and in that case you have to dimension the array to have the size NCTMAX. All elements of the array (if initialised correctly) will be zero except for the cells with cell type #. If you need to have the array dimensioned to your needs (i.e. the same size as the number of cells with cell type #), you need to know the mapping between the cells with cell type #. Since all SOR* subroutines are called on a per cell basis, you will have to loop on the mapping to find out the desired cell to get the source term. Which is much slower than storing data and retrieving it from an array dimensioned to 1:NCTMAX.

Have fun...


All times are GMT -4. The time now is 13:33.