|
[Sponsors] |
June 5, 2012, 08:13 |
User Fortran Problems
|
#1 |
New Member
Join Date: Oct 2010
Posts: 29
Rep Power: 16 |
I tried to use the function USER_GET_MESH_INFO inside a CEL routine.
When I try to compile the source, I get this error message on the command line: ----------------------------------------------------------------------------- ucf_prova_02.o : error LNK2019: unresolved external symbol _USER_GET_MESH_INFO@8 4 referenced in function _UCF_TEST_MMS .\winnt\\ucf_prova_02.dll : fatal error LNK1120: 1 unresolved externals An error has occurred in cfx5mkext: C:\Programmi\Intel\Composer XE 2011 SP1\bin\ia32\ifort exited with return code 96. -------------------------------------------------------------------------- I included: #include "cfx5ext.h" #include "MMS.h" #include "stack_point.h" When I try to compile without the CALL USER_GET_MESH_INFO function all goes smoothly (I also used external functions like LENACT, CFROMI, etc...) Where can be the problem? Thanks Silmaril |
|
June 5, 2012, 11:27 |
|
#2 |
New Member
Join Date: Oct 2010
Posts: 29
Rep Power: 16 |
Another doubt (I'm not very good with MMS....):
In the SOLVER MODELLING GUIDE, chapter 18:User Fortran: there are many examples where data are searched in DATA AREAS with names as: '/USER/WHICH_CALL' , '/USER/INPUT_FILE' , '/USER/FLOW/GEOMETRY' and so on..... These seems folder in UNIX environment..... 1) Do these DATA AREAS really are present (folders?) somewhere on my computer? 2) If yes, where can I find them in a windows environment? 3) If I run my simulation from a specified folder for example 'E:\Work\Work_CFX\Test1' how I have access to such DATA AREA? 4) DATA AREAS created with MAKDAT will be created like folders in the current working directory? |
|
June 6, 2012, 07:38 |
|
#3 |
New Member
Join Date: Oct 2010
Posts: 29
Rep Power: 16 |
Anyone having same problems or can help me on this please?
(If the question is not clear enough, please tell me what information u need) Thanks again Silmaril |
|
June 6, 2012, 08:09 |
|
#4 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144 |
The MMS is a big memory stack, which is addressed in a format similar to a directory structure. But it is stored in memory, not as files on a disk. So don't look for the files - you won't find them; and don't worry about UNIX/Windows file structure differences - that is not relevant as it is not a file structure.
And when you create a data area in the MMS you are just reserving a chunk of memory in the stack. Again, not files are generated. |
|
June 6, 2012, 10:23 |
|
#5 |
New Member
Join Date: Oct 2010
Posts: 29
Rep Power: 16 |
Thank you very much.
I keep trying some test programs in user FORTRAN hoping to solve all the issues. (otherwise I'll come back for some other advice ;p) |
|
June 26, 2012, 06:05 |
|
#6 |
New Member
Join Date: Oct 2010
Posts: 29
Rep Power: 16 |
I'm having problems writing to external text files during Junction Box Routine calls.
I started from a working junction box routine that stops the solver if a certain variable goes outside a pre-defined range. I added some lines ("Write Check") to test writing possibilities. This is the fortran code: __________________________________________________ _______________ __________________________________________________ _______________ #include "cfx5ext.h" dllexport(usr_stp_solver) SUBROUTINE USR_STP_SOLVER(CZ,DZ,IZ,LZ,RZ) IMPLICIT NONE CC CD Stops solver when the min, max, etc. of a variable falls in a range CC CC -------------------- CC Input CC -------------------- CC CC -------------------- CC Modified CC -------------------- CC CV Stacks CC CC -------------------- CC Output CC -------------------- CC CC -------------------- CC Details CC -------------------- CC CC Demonstrates use of user parameters and USER_GET_GVAR routine. CC Junction box routine, to be called at the end of each timestep. CC CC -------------------- CC Local variables & parameters CC -------------------- CC CC CC -------------------- CC Modification History CC -------------------- CC CC 3rd Sept 2004 CJS Created from previous example CC C================================================= ====================== C C --------------------------- C Preprocessor includes C --------------------------- C #include "cfd_constants.h" #include "MMS.h" C C ------------------------------ C Argument list C ------------------------------ C INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) C C ------------------------------ C External functions C ------------------------------ C INTEGER LENACT EXTERNAL LENACT C C ------------------------------ C Local Parameters C ------------------------------ C CHARACTER*(*) ROUTIN PARAMETER (ROUTIN = 'USR_STP_SOLVER') C C --------------------------- C Local Variables C --------------------------- C INTEGER OCHANNEL CHARACTER*4 CRESLT CHARACTER*80 CMESG, PATH, FILENAME, FILEPATH CHARACTER*(MXDNAM) USER_VAR, USER_LOC, USER_OPER C REAL USER_MIN, USER_MAX, VAR C C --------------------------- C Stack pointers C --------------------------- C C ------------------------------ C Directory on entry:- Any C ------------------------------ C C--------------------------- C Executable Statements C--------------------------- C C ---------------------------------------------------------------------- C Obtain names and values from /USER C ---------------------------------------------------------------------- C CALL USER_PEEKCS('UserVarName',USER_VAR,'STOP',CRESLT,C Z) CALL USER_PEEKCS('UserVarLoc',USER_LOC,'STOP',CRESLT,CZ ) CALL USER_PEEKCS('UserVarOper',USER_OPER,'STOP',CRESLT, CZ) CALL USER_PEEKR('UserVarMin',IONE,USER_MIN,'STOP',CRESL T,CZ) CALL USER_PEEKR('UserVarMax',IONE,USER_MAX,'STOP',CRESL T,CZ) C C ---------------------------------------------------------------------- C Obtain the integrated quantity value required C ---------------------------------------------------------------------- C CALL USER_GET_GVAR(USER_VAR,USER_LOC,USER_OPER, & CRESLT,VAR,CZ,DZ,IZ,LZ,RZ) C C ---------------------------------------------------------------------- C Modified Lines for Write Check C ---------------------------------------------------------------------- C----Define Path and File name PATH='E:\Work\Work_CFX\hk2b\' FILENAME='write_test.txt' FILEPATH=PATH(1:LENACT(PATH))//FILENAME(1:LENACT(FILENAME)) C C----Define unit channel and open the file (create if not present) OCHANNEL = 93 OPEN(UNIT=OCHANNEL,STATUS='UNKNOWN',ACCESS='APPEND ', & FILE=FILEPATH) C C----Write message on the file WRITE(UNIT=OCHANNEL,FMT=*) 'writing check' C CLOSE(UNIT=OCHANNEL) C ---------------------------------------------------------------------- C ---------------------------------------------------------------------- C If conditions are met, write a message and stop after this timestep C ---------------------------------------------------------------------- IF (VAR.GE.USER_MIN .AND. VAR.LE.USER_MAX) THEN C C---- Write a diagnostic message to the output file C CMESG = 'Stopping the solver in routine ' // ROUTIN CALL Out_Section_Header (CMESG, '-') C WRITE(CMESG,810) USER_VAR(1:LENACT(USER_VAR)), & USER_OPER(1:LENACT(USER_OPER)) 810 FORMAT ('Variable name:',1X,A20,4X,'Operation name:',1X,A10) CALL WRTTXT (CMESG, IONE) C WRITE(CMESG,820) VAR, USER_MIN, USER_MAX 820 FORMAT('Value:',1X,E13.6,1X,'in range',1X,E13.6,1X,'to',E13.6) CALL WRTTXT (CMESG, IONE) C C---- Stop achieved by setting /FLOW/ALGORITHM/CONTROL/NEXT_TSTEP=FALSE C CALL POKEL ('/FLOW/ALGORITHM/CONTROL/NEXT_TSTEP', & IONE, .FALSE., 'STOP', CRESLT, LZ) C ENDIF C END __________________________________________________ _______________ __________________________________________________ _______________ The same lines ("Write Check") works in a CEL routine, unfortunately in the junction box no write_test.txt is created within the FILEPATH folder defined in the added lines. On the other hand the solver run smoothly and reach the solution without any warning message and when the controlled variable goes outside the defined range the solver stops, as expected from the junction box routine. Hence the routine seems to work, except for the write check added... Anyone can help me on this? Thx in advance Lorenzo |
|
June 26, 2012, 10:35 |
|
#7 |
Senior Member
Join Date: Jul 2011
Location: Berlin, Germany
Posts: 173
Rep Power: 15 |
You sure that your Path defintion is correct and without typos?
I would just replace your C ---------------------------------------------------------------------- C Modified Lines for Write Check C ---------------------------------------------------------------------- C----Define Path and File name PATH='E:\Work\Work_CFX\hk2b\' FILENAME='write_test.txt' FILEPATH=PATH(1:LENACT(PATH))//FILENAME(1:LENACT(FILENAME)) With C ---------------------------------------------------------------------- C Modified Lines for Write Check C ---------------------------------------------------------------------- C----Define Path and File name PATH='E:\Work\Work_CFX\hk2b\' FILENAME='write_test.txt' FILEPATH='E:\Work\Work_CFX\hk2b\write_test.txt' Just to be sure...apart from that I don't see any (obvious) errors in your fortran code that would lead to the program not writing the file.... except for the line: OPEN(UNIT=OCHANNEL,STATUS='UNKNOWN',ACCESS='APPEND ', & FILE=FILEPATH) As far as I know the line continuation symbol in Fortran is an && separated by a Line break, so that the line to be continued ends with a & and the continuation line begins with a &...meaning shouldn't it be typed like this? OPEN(UNIT=OCHANNEL,STATUS='UNKNOWN',ACCESS='APPEND ',& & FILE=FILEPATH) |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
User fortran error when running CFX-10 in parallel | CFDworker | CFX | 3 | September 22, 2015 09:59 |
Importing external DLL to Ansys CFX using user Fortran | snpradeep | CFX | 2 | May 16, 2014 04:52 |
how to access each cell of a face? (user fortran) | Katariina | CFX | 3 | January 28, 2008 10:16 |
User fortran routines, DEBUG AND OUTPUT | Bloshchitsyn Vladimir | CFX | 5 | October 29, 2007 02:31 |
USER FORTRAN in CFX4.2 | Fabi | CFX | 1 | December 16, 1999 09:38 |