|
[Sponsors] |
how to use UDF& USER_GETVAR // what is the problem in my code |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 7, 2013, 09:06 |
how to use UDF& USER_GETVAR // what is the problem in my code
|
#1 |
New Member
DongGunKo
Join Date: Apr 2013
Posts: 13
Rep Power: 13 |
I coded like below
i don't know why it does not work help me #include "cfx5ext.h" dllexport(nucl) SUBROUTINE NUCL (NLOC, NRET, NARG, RET, ARGS, CRESLT, & CZ,DZ,IZ,LZ,RZ) c implicit none C C User CEL routine to calculate velocity boundary C Creates a parabolic inlet profile as function of the y coordinate C #include "MMS.h" #include "cfd_constants.h" #include "stack_point.h" C ================================================== ==================== C Arguments C ================================================== ==================== C C Result flag CHARACTER CRESLT*(*) C Number of locations in space over which calculations will be performed INTEGER NLOC C Number of CEL arguments INTEGER NARG C Number of return variables INTEGER NRET C C Argument array REAL ARGS(NLOC,NARG) C Return variable array REAL RET(NLOC,NRET) C C Stacks INTEGER IZ(*) CHARACTER CZ(*)*(1) DOUBLE PRECISION DZ(*) LOGICAL LZ(*) REAL RZ(*) C ================================================== ==================== C Local parameters C ================================================== ==================== C REAL pi, sigma, R, qc, M, k PARAMETER (pi = 3.14, sigma = 1, R = 1, qc=1, M=1, k=1) C C ================================================== ==================== C Local variables C ================================================== ==================== C INTEGER ILOC REAL dden, cden, rcri, Tc, Pc, PSAT, mcri, fraction, nucl, n, & Sheat, Lheat , a, b CHARACTER*(MXDNAM) ACTION,CGROUP,CEQN,CTERM,CPVAR, & CLVAR,CPATCH,CRESLOC,CPHASE CHARACTER*120 h2ol, h2og C------------------------------ C Stack pointers C ------------------------------ __stack_point__ Tc __stack_point__ Pc __stack_point__ PSAT __stack_point__ dden __stack_point__ cden __stack_point__ Lheat __stack_point__ a __stack_point__ b C C ================================================== ==================== C Executable statements C ================================================== ==================== C Initialise success flag. CRESLT = 'GOOD' C Initialise RET to zero. CALL SET_A_0 ( RET, NLOC*NRET ) C C---- Determine user’s phase name for use in USER_GETVAR C C Use USER_ASSEMBLE_INFO to determine solver equation and principal C 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 ENDIF C C C C C C C C C DO ILOC = 1,NLOC fraction = ARGS(ILOC,1) c C 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,' ',h2og, & CRESLT, CZ,DZ,IZ,LZ,RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2og.Saturation Pressure', CRESLT, & PSAT, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2og.Pressure', CRESLT, & Pc, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2og.Temperature', CRESLT, & Tc, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2og.Density', CRESLT, & cden, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c c c CALL CONVERT_NAME_S2U('Phase',CPHASE,' ',h2ol, & CRESLT, CZ,DZ,IZ,LZ,RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2ol.Density', CRESLT, & dden, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c c call USER_GETVAR ('h2ol.Latent Heat', CRESLT, & Lheat, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2ol.Specific Heat Capacity at Constant & Volume', CRESLT, a, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c call USER_GETVAR ('h2ol.Specific Heat Capacity at Constant & Pressure', CRESLT, b, CZ, DZ, IZ, LZ, RZ) IF (CRESLT .NE. 'GOOD') GO TO 999 c Sheat=a/b C C c c c c c rcri = (2*sigma)/(R*Tc*dden*CLOG(Pc/PSAT)) mcri=(4/3)*pi*dden*(rcri**3) n=((sheat-1)/(sheat+1))*(Lheat/(R*Tc))*((Lheat/(R*Tc))-(1/2)) c nucl= (qc/(1+n))*SQRT((2*sigma)/(pi*M))* & ((cden**2)/dden)*EXP((-4*pi*sigma*(rcri**2))/(3*k*Tc)) RET(ILOC,1) = mcri*fraction*nucl END DO C C Set success flag. CRESLT = 'GOOD' C 999 CONTINUE END |
|
April 7, 2013, 19:00 |
|
#2 |
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,852
Rep Power: 144 |
Nobody on this forum has time to debug your code from scratch.
Post the error message you are getting, or something to suggest why it is not working. "i don't know why it does not work" is not a very useful description of the failure. |
|
April 8, 2013, 01:16 |
sorry
|
#3 |
New Member
DongGunKo
Join Date: Apr 2013
Posts: 13
Rep Power: 13 |
i don' know how to use this page.
i will change question |
|
Tags |
udf, udf and programming, user_getvar |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
COBRAS code | novan tofany | Main CFD Forum | 0 | October 8, 2012 05:40 |
Problem in k-eps turbulence code in complex geometry | sontukaku | Main CFD Forum | 2 | December 28, 2010 01:44 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |
What is the Better Way to Do CFD? | John C. Chien | Main CFD Forum | 54 | April 23, 2001 09:10 |
own Code vs. commercial code | Bernhard Mueck | Main CFD Forum | 10 | February 16, 2000 11:07 |