CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   CFX5.5 User Subroutine defining velocity B.C. (https://www.cfd-online.com/Forums/cfx/19497-cfx5-5-user-subroutine-defining-velocity-b-c.html)

David February 28, 2003 09:33

CFX5.5 User Subroutine defining velocity B.C.
 
Hi all,

I am using CFX5.5 User Subroutine to define the unsteady velocity inlet boundary condition. It is the function of the location of the cells and diverged time serial. Could the system variables ¡°u,v,w¡± be defined as the 2-D arrays? Where I can find some examples of this application. Thanks.

Robin February 28, 2003 12:57

Re: CFX5.5 User Subroutine defining velocity B.C.
 
Hi David,

First of all, what is the function? Does it require complicated logic?

Regards, Robin

David February 28, 2003 20:38

Re: CFX5.5 User Subroutine defining velocity B.C.
 
Hi Robin,

It is somewhat complicated. The Fortran source code is about 500 lines.Now I am facing the difficulty of translate my code into CFX User Subroutine. Regards, David.

Robin March 2, 2003 19:06

Re: CFX5.5 User Subroutine defining velocity B.C.
 
HI David,

What are you simulating at your inlet that requires 500 lines of Fortran?

Regards, Robin

David March 2, 2003 21:21

Re: CFX5.5 User Subroutine defining velocity B.C.
 
Hi Robin,

It simulates the stochastic velocity history of the inlet from the frequency domain to time domain, so the arithmetic is complicated. Now I have two questions: 1,How the system time is visited by external subroutine. There are no examples of this aspects in CFX helpfile. 2,It needs to define a kind of arrays in the subroutine.Their dimensions are the funtion of the number of the cell,such as "REAL UU(1:2*1024*NLOC,1:NLOC)".But the Fortan does not permit to do so. How to sovle it? Regards, David.


Robin March 3, 2003 15:28

Re: CFX5.5 User Subroutine defining velocity B.C.
 
Hi David,

By stochastic velocity history, I assume then that your functions are more complicated than a combination of trig functions then ( V = A*sin(wt) for instance)?

Solution time may be passed as a variable to your subroutine ( for example: U = myFunction(x,y,z,t) ) or accessed through the MMS(I assume this is what you mean by system time and not your system clock?) . Note that time is only available if you have a transient run.

I am not sure what you mean by your second statement. The arrays you appear to be referring to are available through the User Function Fortran interface. Have you reviewed the Fortran examples in the documentation?

Regards, Robin

David March 4, 2003 03:25

Re: CFX5.5 User Subroutine defining velocity B.C.
 
Hi,Robin

The array could be defined such way.I examined it and found that I made a little mistake.

About the first question, I want to get the physical "flow time" of the simulation to control the result obtained by the solver.But I am not sure how to access this system variable in CFX. Just access it as "t"? I post the main part (also I think this part may be something wrong) below:

#include "cfx5ext.h" dllexport(inlet_velocity)

SUBROUTINE INLET_VELOCITY ( NLOC, NRET, NARG, RET, ARGS, CRESLT, CZ,DZ,IZ,LZ,RZ )

....................... !------------------------------------------------------ ! U = RET(1:NLOC,1) ! Y = ARG(1:NLOC,1) ! Z = ARG(1:NLOC,2) !------------------------------------------------------ ........................

CALL USER_INLETV_SUB (NLOC,RET(1,1),ARG(1,1),ARG(1,2)) ........................ END

SUBROUTINE USER_INLETV_SUB (NLOC,U,Y,Z) ........................

CALL SPEEDSIMUIFFT(UU,NF,DF,DELTA,UN,Z, US,FS,OPT,NLOC) !subroutine return the velocity history stored in UU ........................ DO J=0,2*NF*NLOC-1

IF(T.GE.J*DT.AND.T.LT.(J+1)*DT) THEN

DO ILOC=1,NLOC

U(ILOC)=UU(J,ILOC) !J denotes the time serial

ENDDO

ENDIF ENDDO ........................

In the subroutine SPEEDSIMUIFFT() calculating velocity history,I avoid accessing flow time and store the velocity history in 2-D array UU(J,ILOC).J is the integer serial denoting the time sequence.Then I wish to evaluate it to 1-D array U(ILOC) using system varial "t" control(to do so because I don't know whether U could be defined as a 2D array). This is the first time I using CFX user subroutine. Many thanks for your kindly help.

Regards, David.


Robin March 4, 2003 19:02

Re: CFX5.5 User Subroutine defining velocity B.C.
 
Hi David,

To store the history, you will need to create a junction box routine and create the necessary user data in the CFX-5 MMS.

This is really too detailed to get into on a forum and I highly recommend getting in touch with your local support representative for help.

Best regards, Robin


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