CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   user fortran (https://www.cfd-online.com/Forums/cfx/87835-user-fortran.html)

omidiut April 30, 2011 02:51

user fortran
 
Hi all,
I'm solving a moving grid simulation that i need a pressure on each node of a boundary condition (Wall) in each time step
i have to put this pressure as a mesh displacement on each node.
i use the utility routine USER_GETVAR & USER_GET_GVAR but i have some problem for syntax of this routine
my routie is:


#include "cfx5ext.h"
dllexport(user_pressure)
SUBROUTINE USER_PRESSURE (
& NLOC,NRET,NARG,RET,ARGS,CRESLT,CZ,DZ,IZ,LZ,RZ)
C ------------------------------
C ------------------------------
#include "MMS.h"
#include "cfd_constants.h"
C ------------------------------
C Argument list
C ------------------------------
C
INTEGER NLOC,NARG,NRET
C
CHARACTER CRESLT*(*)
C
REAL ARGS(NLOC,NARG), RET(NLOC,NRET)
C
INTEGER IZ(*)
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
LOGICAL LZ(*)
REAL RZ(*)
CC --------------------
CC
CC NLOC - size of current locale
CC NRET - number of components in result
CC NARG - number of arguments in call
CC ARGS() - (NLOC,NARG) argument values
CC
C ------------------------------
C ------------------------------
C External routines
C ------------------------------
INTEGER LENACT
EXTERNAL LENACT
C ------------------------------
C Local Variables
C ------------------------------
C ------------------------------
C Initialise RET to zero.
C ------------------------------
c
CALL SET_A_0 ( RET, NLOC*NRET )
c
c
c
CALL USER_GET_GVAR ('wall.press','MovingWall',
& CRESLT, p, CZ,DZ,IZ,LZ,RZ)
IF (CRESLT .NE. 'GOOD') GOTO 999
c
999 CONTINUE
IF (CRESLT .NE. 'GOOD') THEN
CALL MESAGE( 'WRITE', 'User abort, CRESLT = '//CRESLT)
CALL CFXSTP (ROUTIN)
ENDIF
c
End
--------------------------------------------------------------


But
when i compile it i see some errors like this:
---------------------------------------------------------------
wallpress.F:
58: End
^
** warning on line 58 in wallpress.F: file does not end in unescaped
newline.
wallpress.i
df -threads -dll:.\winnt\\wallpress.dll winnt\\wallpress.o C:\Program Files\ANSY
S Inc\v120\CFX\lib\winnt\solver-hpmpi.lib
Compaq Visual Fortran Optimizing Compiler Version 6.6
Copyright 2001 Compaq Computer Corp. All rights reserved.
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/entry:_DllMainCRTStartup@12
/ignore:505
/debugtype:cv
/debug:minimal
/pdb:none
winnt\\wallpress.o
"C:\Program Files\ANSYS Inc\v120\CFX\lib\winnt\solver-hpmpi.lib"
dformd.lib
msvcrt.lib
dfconsol.lib
dfport.lib
kernel32.lib
/out:.\winnt\\wallpress.dll
/dll
Creating library .\winnt\\wallpress.lib and object .\winnt\\wallpress.exp
wallpress.o : error LNK2001: unresolved external symbol _USER_GET_GVAR@52
wallpress.o : error LNK2001: unresolved external symbol _CFXSTP@4
.\winnt\\wallpress.dll : fatal error LNK1120: 2 unresolved externals
An error has occurred in cfx5mkext:
df exited with return code 96.


Thanks

stumpy May 2, 2011 09:06

Does "End" need to be in uppercase? Do you need an empty line at the end of the file as the error suggests?
Looking at the big picture, you have a mesh displacements as a function of pressure. Where does the need to User FORTRAN come in? A lot of cases that "need" Fortran can be done in CEL.

omidiut May 3, 2011 05:36

Quote:

Originally Posted by stumpy (Post 305931)
Does "End" need to be in uppercase? Do you need an empty line at the end of the file as the error suggests?
Looking at the big picture, you have a mesh displacements as a function of pressure. Where does the need to User FORTRAN come in? A lot of cases that "need" Fortran can be done in CEL.

Thanks a lot for your attention stumpy.
Would you mind explain more about your answer?
I really confused because I can't understand your reason. Can you tell me about difference between "END" and "end"? And also can you explain about influence of empty line at the end of program?
I want to find displacement as a function of pressure on each node! This means every node has pressure that influence on displacement. Do you have any idea for this problem?
If I have your email I sent my problem for you. Would you mind send your Email for me?

stumpy May 3, 2011 09:30

The last line of the Fortran you posted says "End". Usually Fortran code should finish with "END", but I really don't know if it makes a difference.
The error message from the compiler says "file does not end in unescaped newline". So make sure the last line in your file is an empty line (i.e. hit the Enter key after the last "END" statement).
What's the equation that relates displacement to pressure? If that equation can be written in CEL then you don't need Fortran.
Sorry, I don't have time to look through individual cases via e-mail :-)

omidiut May 4, 2011 14:45

1 Attachment(s)
Thank you stumpy
my problem is a diffuser like image attached. the pressure exist on each node of slant wall define the Y-displacement of each node as this relation:(its my CEL):
dy=-0.5*(((Pressure-Pprobe )*0.00714285[m^2])/(5[kg]))*dt ^2

Pprobe is the pressure at inlet and 0.007 is the Area of each cell

i import this displacement (dy) in the mesh motion option of slant wall. but i'm not ensure this pressure is exactly the pressure on the slant wall, what can i do?

stumpy May 4, 2011 15:52

So why is Fortran needed? You have a CEL expression for the incremental displacement as a function of the local pressure, the inlet pressure and the timestep. I assume you are setting Total Mesh Displacement Y on the boundary as:
Total Mesh Displacement Y = Total Mesh Displacement Y + dy
One the right-hand side of the above expression "Total Mesh Displacement Y" gives the displacement at the previous timestep, then you are adding on an incremental displacement. Normally variables in CFX get updated every inner loop in a transient run, but Total Mesh Displacement doesn't, which is quite useful and allows you to write this simple expression.

omidiut May 6, 2011 01:44

Thanks for your attention stumpy

first i use CEL but always have error in solution, I cant use CEL like that you says because there is error like this:

Parameter 'Displacement Y Component' in object '/FLOW:Flow Analysis 2/DOMAINDefault Domain/BOUNDARY:MovingWall/BOUNDARY CONDITIONS/MESH MOTION
/DISPLACEMENT' has been assigned an expression that references the following unavailable variables: Total Mesh Displacement Y


because i cant obtain result with CEL, i want to use User fortran.
i have an important question: is this pressure in this CEL exactly the pressure exist on that wall?

stumpy May 6, 2011 08:55

Total Mesh Displacement Y certainly should be available, it's even used in the ball valve tutorial. I think that's a bug. Try installing the latest version/service pack, or just ignore the error if it's coming from CFX-Pre.

omidiut May 6, 2011 15:31

Thank you stumpy
is this pressure in this CEL exactly the pressure exist on that wall?

omidiut May 7, 2011 13:53

if i use that CEL this error exist:


Feature CFX_SOLVER_BASIC_MP_LIMIT does not exist in the ANSYSLI pool.

Feature CFX_SOLVER_FULL_UNIVERSITY_LIMIT does not exist in the ANSYSLI pool


An error has occurred in cfx5solve:

The ANSYS CFX solver has terminated without writing a results file.
Command on host omidpc (OMID-PC) exited with return code 0.

omidiut May 8, 2011 02:29

the interesting point is that solution complete, but at the end of run this error occurred:

Feature CFX_SOLVER_FULL_UNIVERSITY_LIMIT does not exist in the ANSYSLI pool.


An error has occurred in cfx5solve:

The ANSYS CFX solver has terminated without writing a results file.
Command on host tahpc (TAH-PC) exited with return code 0
.
what can i do?


All times are GMT -4. The time now is 11:56.