CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   XYZ Coordinate (http://www.cfd-online.com/Forums/cfx/20595-xyz-coordinate.html)

 RK August 25, 2004 13:56

XYZ Coordinate

Hello:

I am using USTRN to write out Temperature values at all nodes in particular a block. With these temperature values, I would also like to write the X, Y, & Z values (which are distances and therefore it should be in units of meters) at the corresponding temperature value. Thus the output file created would look like as shown below; four column with particular values.

X/ Y/ Z/ T/

0.0/ 0.0/ 0.0/ 2.0E-03

I hope this makes some sense. Does any one know how to do the above?

RK

 Jeff August 25, 2004 23:33

Re: XYZ Coordinate

Assuming that your are speaking of using USRTRN in CFX-4.....

Loop over the nodes in the block, or 3D Patch (this is the recommended method then you can re-block if you want to). Then access the arrays XP,YP,ZP to get the three coordinates of the cell center. Temperature is in the T array......

CALL IPALL('PATCH NAME','USER3D','PATCH','CENTERS',IPT,NPT,CWORK,IWO RK)

IPHASE = 1

DO I = 1,NPT ! Loop over all cells INODE = IPT(I) ! Get node index X = XP(INODE) ! Get X coordinate Y = YP(INODE) ! Get Y coordinate Z = ZP(INODE) ! Get Z coordinate TEMP = T(INODE,IPHASE) ! Get Temperature value WRITE(*,*) X,Y,Z,TEMP ! Write values out ENDDO

If you must loop over the block (instead of a USER3D patch) then use IPREC instead of IPALL (different parameter list), but you can only do one block at a time. I suggest you get in the habit of defining USER3D patches for your regions of interest as they can cover multiple blocks.

Jeff

 RK August 26, 2004 03:27

Re: XYZ Coordinate

Jeff: