CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   can't compile subroutine..... (https://www.cfd-online.com/Forums/cfx/104504-cant-compile-subroutine.html)

yuhai July 11, 2012 08:18

can't compile subroutine.....
 
Dear CFXer,

I can't compile my subroutine, I hope if you can give me some hints on it....


this is my code:
---------------------------
#include "cfx5ext.h"
#include "stack_point.h"
dllexport(USER_SOURCE2)
SUBROUTINE USER_SOURCE2 (NLOC,NRET,RET,CRESLT,CZ,DZ,IZ,LZ,RZ)
INTEGER NLOC,NRET
CHARACTER CRESLT*(*)
REAL RET(NLOC,NRET)
INTEGER IZ(*)
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
LOGICAL LZ(*)
REAL RZ(*),RZ2(*)

INTEGER LENACT
EXTERNAL LENACT

__stack_point__ pGRAD_V
__stack_point__ p_HL


CALL USER_GETVAR ('Water.Velocity.Gradient', CRESLT, pGRAD_V,
& CZ,DZ,IZ,LZ,RZ)
CALL USER_GETVAR ('Water.HL', CRESLT, p_HL,
& CZ,DZ,IZ,LZ,RZ)

CALL cH (RET(1,1), RZ(pGRAD_V), RZ2(p_HL), NLOC)

END




SUBROUTINE cH (SOURCE, GRAD_V, HL, NLOC)

INTEGER NLOC
REAL GRAD_V(3,NLOC,3)
REAL HL

REAL SOURCE(NLOC), tau(NLOC), tau11(NLOC), tau12(NLOC),
& tau13(NLOC), tau22(NLOC), tau23(NLOC), tau33(NLOC)
INTEGER ILOC

DO ILOC = 1, NLOC
tau11(ILOC) = 0.007 * GRAD_V(1,ILOC,1)
tau12(ILOC) = 0.0035 * (GRAD_V(1,ILOC,2) + GRAD_V(2,ILOC,1))
tau13(ILOC) = 0.0035 * (GRAD_V(3,ILOC,1) + GRAD_V(3,ILOC,1))
tau22(ILOC) = 0.007 * GRAD_V(2,ILOC,2)
tau23(ILOC) = 0.0035 * (GRAD_V(2,ILOC,3) + GRAD_V(3,ILOC,2))
tau33(ILOC) = 0.007 * GRAD_V(3,ILOC,3)
tau(ILOC) = (0.3333*(tau11(ILOC)**2 + tau22(ILOC)**2 +
& tau33(ILOC)**2) +
& 0.3333*(tau11(ILOC)*tau22(ILOC) + tau11(ILOC)*tau33(ILOC) +
& tau22(ILOC)*tau33(ILOC)) +
& (tau12(ILOC)**2 + tau23(ILOC)**2 + tau13(ILOC)**2))**0.5

IF ( tau(ILOC) /= 0 ) THEN
SOURCE(ILOC) = 3.62e-05 * (tau(ILOC)**3.07771)*(1-HL)
ELSE
SOURCE(ILOC) = 0
END IF

END DO

END
------------------------------------

and this is the error:
------------------------------------
D:\UF>cfx5mkext -fpp aa.f
E:\Program Files (x86)\Intel\Compiler\11.0\061\fortran\Bin\intel64\ ifort -Qvec-
-iface:cvf -MD -fpp -object:winnt-amd64\\aa.o -c aa.f
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.0 Build 20080930 Package ID: w_cprof_p_11.0.061

Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
aa.f(4): error #6218: This statement is positioned incorrectly and/or has syntax
errors.
SUBROUTINE USER_SOURCE2 (NLOC,NRET,RET,CRESLT,CZ,DZ,IZ,LZ,RZ)
------^
aa.f(6): error #6219: A specification expression object must be a dummy argument
, a COMMON block object, or an object accessible through host or use association
[NLOC]
INTEGER NLOC,NRET
--------------^
aa.f(6): error #6219: A specification expression object must be a dummy argument
, a COMMON block object, or an object accessible through host or use association
[NRET]
INTEGER NLOC,NRET
-------------------^
aa.f(8): error #6591: An automatic object is invalid in a main program. [RET]
REAL RET(NLOC,NRET)
-----------^
aa.f(7): error #6832: This passed length character name has been used in an inva
lid context. [CRESLT]
CHARACTER CRESLT*(*)
----------------^
aa.f(10): error #6221: The assumed-size array must be a dummy argument. [CZ]
CHARACTER CZ(*)*(1)
----------------^
aa.f(11): error #6221: The assumed-size array must be a dummy argument. [DZ]
DOUBLE PRECISION DZ(*)
-----------------------^
aa.f(9): error #6221: The assumed-size array must be a dummy argument. [IZ]
INTEGER IZ(*)
--------------^
aa.f(12): error #6221: The assumed-size array must be a dummy argument. [LZ]
LOGICAL LZ(*)
--------------^
aa.f(13): error #6221: The assumed-size array must be a dummy argument. [RZ]
REAL RZ(*),RZ2(*)
-----------^
aa.f(13): error #6221: The assumed-size array must be a dummy argument. [RZ2]
REAL RZ(*),RZ2(*)
-----------------^
compilation aborted for aa.f (code 1)
An error has occurred in cfx5mkext:

E:\Program Files (x86)\Intel\Compiler\11.0\061\fortran\Bin\intel64\ ifort
exited with return code 1.

-----------------






Thanks in advance.

H.Y.

yuhai July 12, 2012 17:39

now I have only one problem (the uppers are solved):

LINK: fatal error LNK1104: cannot open file 'ifconsol.lib'

yuhai July 18, 2012 11:43

nolange problem......

solved

jmaxime March 14, 2014 10:10

Hi yuhai,
I have also encountered this kind of problem, " error #6591: An automatic object is invalid in a main program. "
Can you tell me how you finally solve it?
Thanks in advance.

jmaxime


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