|
[Sponsors] |
July 21, 2009, 11:29 |
Using Curl in CFX11
|
#1 |
New Member
|
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
own grid to CFX11 | subba | CFX | 5 | June 27, 2007 05:49 |
Importing CFX10 data into CFX 11 | Stephen | CFX | 1 | May 11, 2007 00:42 |
Importing CFX10 data into CFX 11 | Stephen | CFX | 0 | May 9, 2007 07:55 |
Pb:with the curl of the velocity urgent | student | Siemens | 2 | July 21, 2006 05:19 |
About curl | evgenii | OpenFOAM Running, Solving & CFD | 2 | December 14, 2005 09:15 |