CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   the use of WRTFIL (http://www.cfd-online.com/Forums/cfx/18495-use-wrtfil.html)

Darcy Jiang April 12, 2001 06:20

the use of WRTFIL
 
Hi, everybody

I used the USER-FORTRAN utility WRTFIL and encountered a strange error. It told that :

'CFX-4 | Solver | UNIT 17? File name missing or blank - please enter fil e name'.

This message repeated on my MS-DOS window. Then I stoped it and print the variable NWDISK on my screen at my next run. The value of the variale is 17.

I don't understand why this error occur. I think CFX-4 must have set the file name in advance when I use WRTFIL. However the system tells me that the file name is not given yet. Can somebody tell me why and how can I do to avoid the error? I will send my code to you if you are interested in my problem.

Darcy

Darcy Jiang April 13, 2001 02:12

Re: the use of WRTFIL
 
Hi, everybody

I'm glad because I got it! I used WRTFIL in user-routine USRDMP yesterday. However the computer did not know the file name of unit 17 in which datas were written. I woundered that the restart file slot on solver panal must be filled so that the system can get the file name for unit 17.

I did it this morning and my problem is now solved. It's really great!

Darcy

Darcy Jiang April 13, 2001 05:53

correction
 
In the computation in this morning, I forgot to activate the WRTFIL section. I activate it and tried again. I found that it doesn't work at all.

Darcy Jiang April 17, 2001 08:30

new problem!!
 
Hi, everybody

The old problem is solved. Now I encounter new problem.
I don't know how to dump valuess on specific boundary to the .dmp file.

I want to dump the three components(X,Y,Z) of pressure force on the wall boundary to the .dmp file. First I used user scalars 'USRDPX', 'USRDPY', and 'USRDPZ' as the three components of pressure force on each cell face on walls. In order to make these user scalars processed by frontrend-process, I set 3 user scalar equations in >>option. I think the transport equations for 'USRDPX', 'USRDPY', and 'USRDPZ' turned off because I used 'USRD' as the prefixes in the names. It's reasonable according to the statements in p.196 of CFX4-solver manual. Then I added 'USRPDX', 'USRPDY', and 'USRPDZ' in >>DUMP FILE OPTIONS.

After all the settings in command files. I started writing my USER-FORTRAN. Of course I used the routine 'USRDMP'. My code is the following:

ELSEIF (ICALL.EQ.2) THEN
C
C+++++++++++++++++ USER AREA 6 +++++++++++++++++++++++++++++++++++++++++
C
C

C GET THE IPT FOR BOUNDARY WALLWING
CALL
+IPREC('WALLWING','PATCH','CENTERS',IPT,ILEN,JLEN, KLEN,CWORK,IWORK)

C GET THE USER-SCALAR NUMBER
CALL GETSCA('USRDPX',ISCALPX,CWORK)
CALL GETSCA('USRDPY',ISCALPY,CWORK)
CALL GETSCA('USRDPZ',ISCALPZ,CWORK)

C OPEN AN EXTERNAL FILE FOR CHECKING THE COMPUTED VALUE.
OPEN
+(1,FILE = 'd:\users\darcy\cfx4\project\wintran\usrfordb\xyzp .dat')

C GET THE WORKSPACE FOR THE OUTPUT OF USER DATA
NPT = ILEN * JLEN * KLEN

CALL SETWRK('USRDMP','WORK ','PXCOMP',NPT,JPXCOMP)
CALL SETWRK('USRDMP','WORK ','PYCOMP',NPT,JPYCOMP)
CALL SETWRK('USRDMP','WORK ','PZCOMP',NPT,JPZCOMP)

C CALCULATE THE PRESSURE FORCE COMPONENTS ON EACH CELL FACE
IDWORK = 0

DO 10 J = 1,JLEN

DO 20 I = 1,ILEN

DO 30 K = 1,KLEN

C DETERMINE SURFACE NORMALS
INODE1 = IP(I,J,K)

IF (J .EQ. JLEN) THEN
INODE2 = IP(I,J - 1,K)
INODE3 = IP(I + 1,J,K)

IF (I .EQ. ILEN) THEN
INODE3 = IP(I - ILEN + 1,J,K)
ENDIF

ELSE
INODE2 = IP(I + 1,J,K)
INODE3 = IP(I,J + 1,K)

IF (I .EQ. ILEN) THEN
INODE2 = IP(I - ILEN + 1,J,K)
ENDIF

ENDIF

C CRSPDT IS A SUBROUTINE USED TO DETERMINE THE CROSS PRODUCT OF TWO
C VECTORS
CALL CRSPDT(XP(INODE1),YP(INODE1),ZP(INODE1),
+ XP(INODE2),YP(INODE2),ZP(INODE2),
+ XP(INODE3),YP(INODE3),ZP(INODE3),
+ XN,YN,ZN)

C END DETERMINE THE SURFACE NORMAL
C MAGNML = ( XN ** 2.0 + YN ** 2.0 + ZN ** 2.0) ** 0.5

SCAL(INODE1,1,ISCALPX) = -1.0 * P(INODE1,1) * XN
SCAL(INODE1,1,ISCALPY) = -1.0 * P(INODE1,1) * YN
SCAL(INODE1,1,ISCALPZ) = -1.0 * P(INODE1,1) * ZN

WRITE(1,*) 'COORDINATES:'
WRITE(1,*) 'POINT INODE1:',XP(INODE1),YP(INODE1),ZP(INODE1)
WRITE(1,*) 'POINT INODE2:',XP(INODE2),YP(INODE2),ZP(INODE2)
WRITE(1,*) 'POINT INODE3:',XP(INODE3),YP(INODE3),ZP(INODE3)
WRITE(1,*) 'NORMALS:',XN,YN,ZN
WRITE(1,*) 'MAGNML:',MAGNML
WRITE(1,*) 'PRESSURE:',P(INODE1,1)
WRITE(1,*) 'PRESSURE FORCE COMPONENTS',SCAL(INODE1,1,ISCALPX)
+ ,SCAL(INODE1,1,ISCALPY)
+ ,SCAL(INODE1,1,ISCALPZ)

WORK(JPXCOMP + IDWORK) = SCAL(INODE1,1,ISCALPX)
WORK(JPYCOMP + IDWORK) = SCAL(INODE1,1,ISCALPY)
WORK(JPZCOMP + IDWORK) = SCAL(INODE1,1,ISCALPZ)
IDWORK = IDWORK + 1

30 CONTINUE

20 CONTINUE

10 CONTINUE

CLOSE(1)

C PXCOMP

IST=JPXCOMP
IEN=JPXCOMP + NPT - 1
CALL WRTFIL('USRDPX','R',IWORK,WORK,CWORK,IST,IEN,
+ 1,'E12.5',NWDISK)

C PYCOMP

IST=JPYCOMP
IEN=JPYCOMP + NPT - 1
CALL WRTFIL('USRDPY','R',IWORK,WORK,CWORK,IST,IEN,
+ 1,'E12.5',NWDISK)

C PZCOMP

IST=JPZCOMP
IEN=JPZCOMP + NPT - 1
CALL WRTFIL('USRDPZ','R',IWORK,WORK,CWORK,IST,IEN,
+ 1,'E12.5',NWDISK)

CALL DELWRK('USRDMP','WORK ','PXCOMP')




I would like everyone look at these codes:

C GET THE USER-SCALAR NUMBER
CALL GETSCA('USRDPX',ISCALPX,CWORK)
CALL GETSCA('USRDPY',ISCALPY,CWORK)
CALL GETSCA('USRDPZ',ISCALPZ,CWORK)


and these


SCAL(INODE1,1,ISCALPX) = -1.0 * P(INODE1,1) * XN
SCAL(INODE1,1,ISCALPY) = -1.0 * P(INODE1,1) * YN
SCAL(INODE1,1,ISCALPZ) = -1.0 * P(INODE1,1) * ZN


I myself checked my own output file and found that the computation of pressure force components is ok. However the value of 'USRDPX', 'USRDPY',
and 'USRDPZ' is dumped as zero(0.00000e+1). I wounder that I didn't access correct IPT for these user scalar on wall boundary. These user scalars is not assigned on the specified wall boundary. I don't know how to check if I got correct IPT for my user scalars or not.
I hope somebody tell me how.

Darcy

joseph May 8, 2001 05:49

Re: the use of WRTFIL
 
contact the CFX support guys

Darcy Jiang May 8, 2001 21:35

Re: the use of WRTFIL
 
Joseph Thanks for your concern. My problem has been solved for many weeks. I was too busy to share my experience immidately. I want share it this time with you and all other members here.

What I wanted to do is determining the x,y, and z pressure force components on each cell of wall boundaries. Then dump them to the dump file. What's more I want my post-processor(Fieldview v.6) to read them and integrate them over the wall. I use CFX-4 to simulate the flow field around a helicopter rotor. I want to compute the thrust of the rotor. To do this I must know at least the axial component of pressure force.

I archive my goal in these steps: 1. In command file:

(1) Under the subcommand >>options of

>>CFX4, I add the keywork 'USER SCALAR

EQUATIONS 3'. Each of the three equations is

for one force component.

(2) then >> USER FORTRAN

USRDMP

(3) Under >>VARIABLE NAMES, type the keywords

USER SCALAR1 'USRDPX'

USER SCALAR2 'USRDPY'

USER SCALAR3 'USRDPZ'

Prefix 'USRD' turns off the advection-diffusion

equations for the three user scalars. Thus I did

not add any additional equatoins to computation.

(4) Finally just add USRDPX, USRDPY, and USRDPZ to

the ouput variables under >>DUMP FILE OPTIONS

,which is a subcommand of >>OUTPUT OPTIONS.

Doing this adds these user scalars to the

variable list in the dump file frontrend

prints. These user scalars can be printed in

dump file. My post-processor can read my user

scalars since they are in the variable list.

I don't have to use USRRD subroutine to read

them at each restart.

2. In USRDMP subroutine I compute the pressure force

components when ICALL = 1. If I did my computation

when ICALL = 2, my user scalars for pressure force

components would be all zero. It is because the

program only outputs the user informations instead

of changing the user scalars. You are not allowed

to use WRTFIL when ICALL = 1 for the output file

names of CFX-4 (.dmp or .fo) is not assigned yet.

I did nothing when ICALL = 2. I also didn't use

subroutine USRRD because the solver will read

my user scalars by itself at each time step.

That's all. If your are interested in my code or my research. e-mail to me and I will discuss with you in detail.

Best regard

Darcy

joseph May 9, 2001 02:16

Re: the use of WRTFIL
 
hi darcy

I am not all the good in user fortrans

joseph



All times are GMT -4. The time now is 02:29.