CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   Using Curl in CFX11 (https://www.cfd-online.com/Forums/cfx/66667-using-curl-cfx11.html)

Cardero July 21, 2009 10:29

Using Curl in CFX11
 
Hi, I am willing to calculated the lift force on a Lagragian multiphasic simulation. However this force seems not available on the included ones on CFX11. Therefore I wrote a user fortran subroutine to calculate that force but to do so I need the Curl v. As a template I used an example included on the help of CFX to calculate the gradient of an additional variable however an error occurs averytime the subroutine CONVERT_NAME_S2U is called.
To see if the problem was related to the code I wrote I just try to run the provided example on the help but the same problem rised.
Has anyone faced such a problem?
#include "cfx5ext.h"dllexport(user_source2) SUBROUTINE USER_SOURCE2 ( & NLOC,NRET,NARG,RET,ARGS,CRESLT,CZ,DZ,IZ,LZ,RZ)C--------------------C DetailsC --------------------C ARGS(1:NLOC,1) holds parameter 'a' evaluated at all locationsC RET(1:NLOC,1) will hold return resultC ------------------------------C Preprocessor includesC ------------------------------#include "MMS.h"#include "stack_point.h"C ------------------------------C Argument listC ------------------------------ INTEGER NLOC,NARG,NRET CHARACTER CRESLT*(*) REAL ARGS(NLOC,NARG), RET(NLOC,NRET) INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*)C ------------------------------C External routinesC ------------------------------ INTEGER LENACT EXTERNAL LENACTC ------------------------------C Local VariablesC ------------------------------ CHARACTER*(MXDNAM) ACTION,CGROUP,CEQN,CTERM,CPVAR, & CLVAR,CPATCH,CRESLOC,CPHASE CHARACTER*120 User_Phase_Name, User_Variable_NameC ------------------------------C Stack pointersC ------------------------------ __stack_point__ pGRAD_PHIC ---------------------------C Executable StatementsC ---------------------------C Initialise success flag. CRESLT = 'GOOD'C Initialise RET to zero. CALL SET_A_0 ( RET, NLOC*NRET )CC---- Determine user's phase name for use in USER_GETVARCC Use USER_ASSEMBLE_INFO to determine solver equation and principalC variable names CEQN, CPVAR. ACTION = 'GET' CALL USER_ASSEMBLE_INFO (ACTION,CGROUP,CEQN,CTERM,CPVAR, & CLVAR,CPATCH,CRESLOC, & CZ,DZ,IZ,LZ,RZ) IF (CRESLOC.NE.'GOOD' .AND. CRESLOC.NE.'SOME') THEN CRESLT = 'FAIL' GO TO 999 ENDIFC Extract phase name from principal variable CALL GET_PHASE_FROM_VAR (CPVAR, CPHASE)C Convert solver phase name to user phase name. CALL CONVERT_NAME_S2U('Phase',CPHASE,' ',User_Phase_Name, & CRESLT, CZ,DZ,IZ,LZ,RZ) IF (CRESLT .NE. 'GOOD') GO TO 999CC---- Obtain grad(phi1)C in array shape GRAD_PHI(1:3,1:NLOC) located at RZ(pGRAD_PHI)C User_Variable_Name = User_Phase_Name(1:LENACT(User_Phase_Name)) & // '.phi1.Gradient' CALL USER_GETVAR (User_Variable_Name, CRESLT, pGRAD_PHI, & CZ,DZ,IZ,LZ,RZ) IF (CRESLT .NE. 'GOOD') GO TO 999CC---- Calculate source expression in RET(1:NLOC,1)C CALL USER_SOURCE_CAL( RET(1,1), ARGS(1,1), RZ(pGRAD_PHI), NLOC )C 999 CONTINUECC Send any diagnostics or stop requests via master processor IF (CRESLT .NE. 'GOOD') THEN CALL MESAGE( 'BUFF', 'USER_SOURCE2 returned error:' ) CALL MESAGE( 'BUFF', CRESLT ) CALL MESAGE( 'BUFF-OUT', ' ' ) END IFCC============================================== ========================= END SUBROUTINE USER_SOURCE_CAL (SOURCE, A, GRAD_PHI, NLOC)CC Purpose: Source = a * grad(phi).grad(phi)CC Inputs INTEGER NLOC REAL A(NLOC), GRAD_PHI(3,NLOC)C Outputs REAL SOURCE(NLOC)C Locals INTEGER ILOCC DO ILOC = 1, NLOC SOURCE(ILOC) = A(ILOC) * ( GRAD_PHI(1,ILOC)**2 & + GRAD_PHI(2,ILOC)**2 & + GRAD_PHI(3,ILOC)**2 ) END DOC END


All times are GMT -4. The time now is 04:10.