CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   subroutine FORTRAN // CFX in Spain (http://www.cfd-online.com/Forums/cfx/22594-subroutine-fortran-cfx-spain.html)

spain May 23, 2006 06:12

subroutine FORTRAN // CFX in Spain
 
Hi! I've modified the subroutine used in the tutorial 17 (air conditioning) for my own sensor. If there is: H2 Ideal Gas.Mass Fraction > CLIM1 = 0.003 then I want my input of H2 to be closed.

The velocity Y of the input will be: H2_ON*10 [m s^-1]

CSENSOR = probe(Mixture.H2 Ideal Gas.Mass Fraction)@Detector,

where Detector is a Monitor Point.

Could somebody check if my routine is right?

#include "cfx5ext.h" dllexport(h2_on)

SUBROUTINE H2_ON (

& NLOC, NRET, NARG, RET, ARGS, CRESLT, CZ,DZ,IZ,LZ,RZ )

CD Control an input H2 by a sensor

#include "parallel_partitioning.h"

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(*)

CHARACTER*20 ROUTIN

PARAMETER(ROUTIN='HEAT_SOURCE')

INTEGER ILOC, NCLOOP

REAL CSENSOR, CLIM1, VALUE

C initialize H2 input to be on

DATA VALUE/1.0/

C initialize the variable that keeps track of the last time step

DATA NCLOOPLAST/-1/

SAVE VALUE

C Initialise RET() to zero.

CALL SET_A_0( RET, NLOC*NRET )

CSENSOR = ARGS(1,1)

CLIM1 = ARGS(1,2)

NCLOOP = INT(ARGS(1,3)+0.1)

IF (NCLOOP .EQ. 1) THEN

C At the start of a new timestep. It is time to re-assess whether to turn on or off the H2 input.

IF (CSENSOR .GT. CLIM1) THEN

C Turn off H2 input

VALUE = 0.0

ELSE

VALUE = 1.0

ENDIF

ENDIF

DO ILOC = 1, NLOC

RET(ILOC,1) = VALUE

ENDDO

C Set success flag.

CRESLT = 'GOOD'

END

Does anybody know where I can find someone who knows how to use Ansys-CFX in Spain?? Thank you very much!!!


All times are GMT -4. The time now is 06:19.