CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Wiki > Posdat.f

Posdat.f

From CFD-Wiki

(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by Xadmin (talk) to last revision by Murali)
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
This user subroutine is one of the most powerful subroutines in '''STAR CD'''. It allowes the user to access variables from the code and modify them.
+
--[[User:Murali|Murali]] 09:03, 21 May 2007 (MDT)This user subroutine is one of the most powerful subroutines in '''STAR CD'''. It allowes the user to access variables from the code and modify them.
 +
 
 +
 
 +
== Call posdat.f at the end of the run==
 +
 
 +
# POSDAT has the variable RESOR passed into it by default.
 +
# RESOR (IV,IMAT) is the residual of variable IV in material IMAT. IV is the variable number like U=1, V=2 etc. Refer to nom.inc for the details.
 +
# Write an IF stmt in POSDAT using LEVEL Eq 2. The STAR solver visits POSDAT once before and after iteration even after convergence. Else use level 1.
 +
# The IF stmt must have max(RESOR) to be verified with the set tolerance SETTOL. if max(RESOR).
 +
 
 +
 
 +
== Cell Face Directions==
 +
 
 +
POSDAT always receives a wealth of information about all the cells and these may be useful in creating large user-subroutines.  Normally programmers get confused when trying to access the information in the adjacent cells in STAR-CD 3.15.  Two arrayes LX and LQ contain the information about the faces.  There are times when one would think:
 +
 
 +
    LQ(1,IC): the -z direction neighbor cell;
 +
    LQ(2,IC): the z direction neighbor cell;
 +
    LQ(3,IC): the -y direction neighbor cell;
 +
    LQ(4,IC): the y direction neighbor cell;
 +
    LQ(5,IC): the -x direction neighbor cell;
 +
    LQ(6,IC): the x direction neighbor cell;
 +
 
 +
However, in some cases, one may find that,
 +
 
 +
    LQ(1,IC): the -x direction neighbor cell;
 +
    LQ(2,IC): the x direction neighbor cell;
 +
    LQ(3,IC): the -y direction neighbor cell;
 +
    LQ(4,IC): the y direction neighbor cell;
 +
    LQ(5,IC): the -z direction neighbor cell;
 +
    LQ(6,IC): the z direction neighbor cell;
 +
 
 +
The answer to this problem llies in the assumption that 1,2 and 3 correspond to x,y and z directions which is wrong. STAR-CD does NOT recognize x,y and z directions but only arbitrary directions.
 +
# Bottom
 +
# top
 +
# South
 +
# North
 +
# West
 +
# East
 +
 
 +
It is a li'l difficult to understand what these mean. See the following pic:
 +
 
 +
<pre>
 +
----|-----|-------
 +
    |  N  |
 +
----|-----|-------
 +
  W | Cell|  E
 +
----|-----|-------
 +
    |  S  |
 +
----|-----|-------
 +
 
 +
</pre>
 +
 
 +
The cell in the middle is flanked by 4 cells in 2-d and 6 cells in 3-d. In 2-d u see North, East, West and South neighbours only and in 3-D, u see a top and bottom neighbour also. These are NOT related to x,y,z directions. They just give you the various cells attached through the face indices running from 1 to 6.Then how can we determine a particular x, or y or z neighbour ?
 +
 
 +
# Checking the centroidal co-ordinates. Suppose it is a well-ordered grid. If LQ(k,IP) returns a cell, you can access the centroidal information of this cell using the commoned variable CX. If the z-coordinate is greater than the cell's coordinate, it is a "positive" z-beighbour else it could be negative. (ofcourse, this may not be true if the hexahedral cells are distorted).
 +
# Finding the normal of the faces using some other COMMONed variables e.g. NDIN. If the normal is same as z vector, your neighbouring cell is a z-neighbour. This way of accessing information is a little difficult when compared to the neatly structured way of accessing information of neighbouring cells in FLUENT 6. But you have no other choice in STAR-CD.

Latest revision as of 12:13, 3 September 2011

--Murali 09:03, 21 May 2007 (MDT)This user subroutine is one of the most powerful subroutines in STAR CD. It allowes the user to access variables from the code and modify them.


Call posdat.f at the end of the run

  1. POSDAT has the variable RESOR passed into it by default.
  2. RESOR (IV,IMAT) is the residual of variable IV in material IMAT. IV is the variable number like U=1, V=2 etc. Refer to nom.inc for the details.
  3. Write an IF stmt in POSDAT using LEVEL Eq 2. The STAR solver visits POSDAT once before and after iteration even after convergence. Else use level 1.
  4. The IF stmt must have max(RESOR) to be verified with the set tolerance SETTOL. if max(RESOR).


Cell Face Directions

POSDAT always receives a wealth of information about all the cells and these may be useful in creating large user-subroutines. Normally programmers get confused when trying to access the information in the adjacent cells in STAR-CD 3.15. Two arrayes LX and LQ contain the information about the faces. There are times when one would think:

   LQ(1,IC): the -z direction neighbor cell;
   LQ(2,IC): the z direction neighbor cell;
   LQ(3,IC): the -y direction neighbor cell;
   LQ(4,IC): the y direction neighbor cell;
   LQ(5,IC): the -x direction neighbor cell;
   LQ(6,IC): the x direction neighbor cell;

However, in some cases, one may find that,

   LQ(1,IC): the -x direction neighbor cell;
   LQ(2,IC): the x direction neighbor cell;
   LQ(3,IC): the -y direction neighbor cell;
   LQ(4,IC): the y direction neighbor cell;
   LQ(5,IC): the -z direction neighbor cell;
   LQ(6,IC): the z direction neighbor cell;

The answer to this problem llies in the assumption that 1,2 and 3 correspond to x,y and z directions which is wrong. STAR-CD does NOT recognize x,y and z directions but only arbitrary directions.

  1. Bottom
  2. top
  3. South
  4. North
  5. West
  6. East

It is a li'l difficult to understand what these mean. See the following pic:

----|-----|-------
    |  N  |
----|-----|-------
  W | Cell|  E
----|-----|-------
    |  S  |
----|-----|-------

The cell in the middle is flanked by 4 cells in 2-d and 6 cells in 3-d. In 2-d u see North, East, West and South neighbours only and in 3-D, u see a top and bottom neighbour also. These are NOT related to x,y,z directions. They just give you the various cells attached through the face indices running from 1 to 6.Then how can we determine a particular x, or y or z neighbour ?

  1. Checking the centroidal co-ordinates. Suppose it is a well-ordered grid. If LQ(k,IP) returns a cell, you can access the centroidal information of this cell using the commoned variable CX. If the z-coordinate is greater than the cell's coordinate, it is a "positive" z-beighbour else it could be negative. (ofcourse, this may not be true if the hexahedral cells are distorted).
  2. Finding the normal of the faces using some other COMMONed variables e.g. NDIN. If the normal is same as z vector, your neighbouring cell is a z-neighbour. This way of accessing information is a little difficult when compared to the neatly structured way of accessing information of neighbouring cells in FLUENT 6. But you have no other choice in STAR-CD.
My wiki