CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

user fortran

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2011, 03:51
Default user fortran
  #1
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
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

Last edited by omidiut; May 1, 2011 at 07:28.
omidiut is offline   Reply With Quote

Old   May 2, 2011, 10:06
Default
  #2
Senior Member
 
Join Date: Apr 2009
Posts: 531
Rep Power: 21
stumpy is on a distinguished road
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.
stumpy is offline   Reply With Quote

Old   May 3, 2011, 06:36
Default
  #3
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
Quote:
Originally Posted by stumpy View Post
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?
omidiut is offline   Reply With Quote

Old   May 3, 2011, 10:30
Default
  #4
Senior Member
 
Join Date: Apr 2009
Posts: 531
Rep Power: 21
stumpy is on a distinguished road
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 :-)
stumpy is offline   Reply With Quote

Old   May 4, 2011, 15:45
Default
  #5
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
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 relationits 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?
Attached Images
File Type: jpg CFX9.jpg (59.1 KB, 27 views)
omidiut is offline   Reply With Quote

Old   May 4, 2011, 16:52
Default
  #6
Senior Member
 
Join Date: Apr 2009
Posts: 531
Rep Power: 21
stumpy is on a distinguished road
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.
stumpy is offline   Reply With Quote

Old   May 6, 2011, 02:44
Default
  #7
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
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?
omidiut is offline   Reply With Quote

Old   May 6, 2011, 09:55
Default
  #8
Senior Member
 
Join Date: Apr 2009
Posts: 531
Rep Power: 21
stumpy is on a distinguished road
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.
stumpy is offline   Reply With Quote

Old   May 6, 2011, 16:31
Default
  #9
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
Thank you stumpy
is this pressure in this CEL exactly the pressure exist on that wall?
omidiut is offline   Reply With Quote

Old   May 7, 2011, 14:53
Default
  #10
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
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.

Last edited by omidiut; May 8, 2011 at 03:23.
omidiut is offline   Reply With Quote

Old   May 8, 2011, 03:29
Default
  #11
Senior Member
 
omid
Join Date: Apr 2011
Posts: 105
Rep Power: 15
omidiut is on a distinguished road
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?
omidiut is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
user routine, user funcion, or fortran compile effect on the memroy? princeps11 CFX 1 May 13, 2009 19:37
Can use PVM in User Fortran LIU Yu CFX 0 November 29, 2008 23:10
User fortran routines, DEBUG AND OUTPUT Bloshchitsyn Vladimir CFX 5 October 29, 2007 02:31
CFX 10 User Routine NOT in Fortran Andre CFX 14 August 9, 2006 00:03
CFX5 and user FORTRAN Worth CFX 9 December 25, 2003 02:43


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