AEATECHNOLoGY ENGINEERING SOFTWAR Lecture 9 User FOrtran CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -1 CFX-4.3 V4.3.1H Lecture 9 User FORTRAN
AEATECHNOLoGY ENGINEERING SOFTWAR User FOrtran The user fortran routines are used for Complex features not available through the command language Non-uniform velocity profiles, variable material properties, moving grid, etc Convenience Flexibility User ForTRan greatly enhances CFX-4 capabilities CFX-4 comes with 32 FORTRAN templates CFX-Environment provides access to user FORTRAN routines CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -2 CFX-4.3 V4.3.1H User FORTRAN The user FORTRAN routines are used for - Complex features not available through the command language > Non-uniform velocity profiles, variable material properties, moving grid, etc… - Convenience - Flexibility. User FORTRAN greatly enhances CFX-4 capabilities. CFX-4 comes with 32 FORTRAN templates. CFX-Environment provides access to user FORTRAN routines
AEATECHNOLoGY ENGINEERING SOFTWAR Commonly Used Routines USRBCS To allow users to specify real information at walls, inlets mass flow boundaries and other 2D patches, called at the start of a run and on each iteration or time step USRBF To allow users to specify body forces, resistances USRCND To allow users to specify conductivity USRCVG To allow users to monitor the solution at every non-linear iteration and test for convergence CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -3 CFX-4.3 V4.3.1H Commonly Used Routines USRBCS > To allow users to specify real information at walls, inlets, mass flow boundaries and other 2D patches, called at the start of a run and on each iteration or time step. USRBF > To allow users to specify body forces, resistances. USRCND > To allow users to specify conductivity. USRCVG > To allow users to monitor the solution at every non-linear iteration, and test for convergence
AEATECHNOLoGY ENGINEERING SOFTWAR Commonly Used Routines USRDEN To allow users to specify density and the partial derivatives of density with respect to pressure USRGRD > To allow users to generate a user grid or update grid as a function of time USRINT To allow users to specify an initial guess USRPBC To allow users to specify particle boundary conditions CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -4 CFX-4.3 V4.3.1H Commonly Used Routines USRDEN > To allow users to specify density and the partial derivatives of density with respect to pressure. USRGRD > To allow users to generate a user grid or update grid as a function of time. USRINT > To allow users to specify an initial guess. USRPBC > To allow users to specify particle boundary conditions
AEATECHNOLoGY ENGINEERING SOFTWAR Commonly Used Routines USRSRC To allow users to add source or modify source terms USRTRN To allow users to monitor the solution as a function of time and to specify next time step USRVIS To allow users to specify viscosity CFX-4 CFX4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -5 CFX-4.3 V4.3.1H Commonly Used Routines USRSRC > To allow users to add source or modify source terms. USRTRN > To allow users to monitor the solution as a function of time and to specify next time step. USRVIS > To allow users to specify viscosity
AEATECHNOLoGY ENGINEERING SOFTWAR Commonly Used Routines There are also 22 utility routines which can be called directly GETVAR To allow users to find equation number for a variable PALL To allow users to obtain the addresses for all the centers vertices of selected blocks/patches IPREC To allow users to obtain the addresses for all the centers vertices on a single block /patch (covering a single face SETWRK. DELWRK To allow users to allocate and delete work space for a temporary array CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -6 CFX-4.3 V4.3.1H Commonly Used Routines There are also 22 utility routines which can be called directly: - GETVAR > To allow users to find equation number for a variable. - IPALL > To allow users to obtain the addresses for all the centers / vertices of selected blocks / patches. - IPREC > To allow users to obtain the addresses for all the centers / vertices on a single block / patch (covering a single face). - SETWRK, DELWRK > To allow users to allocate and delete work space for a temporary array
AEATECHNOLoGY ENGINEERING SOFTWAR How to Use fOrtran o use a user FORTRAN routine Obtain the template by clicking on User Fortran torn within the environment and get Fort Edit the fOrtran ne f Strout routine and ensure the IUSED flag is set to 1 Include the routine in the command file 》 OPTIONS 》 USER FORTRAN USRSRC Specify the user FORTRAN file when running the solver CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -7 CFX-4.3 V4.3.1H How to Use FORTRAN To use a user FORTRAN routine - Obtain the template by clicking on User Fortran within the Environment, and Get Fortran. - Edit the FORTRAN routine and ensure the IUSED flag is set to 1. - Include the routine in the command file » OPTIONS ... ... » USER FORTRAN USRSRC - Specify the user FORTRAN file when running the solver
AEATECHNOLoGY ENGINEERING SOFTWAR How to Use fortran The solver stops if any of the last three steps are mIssing The fortran routine is compiled and linked at the beginning of a CFX run Facility to save executable in local directory (under Advanced Options of the solve menu) CFX-4 CFX4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -8 CFX-4.3 V4.3.1H The solver stops if any of the last three steps are missing. The FORTRAN routine is compiled and linked at the beginning of a CFX run. Facility to save executable in local directory (under Advanced Options of the solve menu). How to Use FORTRAN
AEATECHNOLoGY ENGINEERING SOFTWAR Structure of a Template Variables, constants are passed through the argument list and common blocks SUBROUTINE USRSRC (IEQN, I CALL, CNAME, CALIAs, AM, SP, SU, CONV XP, YP, ZP, VOL, AREA, VPOR, ARPOR, WFACT, IPT 工BLK, IPVERT,工 PNODN,工 PFACN, I PNO DE, IPNODE, IPFACE ,WoRK,工WORK, CWORK) UVWP VERAC DEN.TH are dimensioned (NNODE, NPHASE) SCAL is dimensioned(NNODE, NPHASE, NSCAL) XP, YP, ZP are dimensioned(NNODE) CFX-4 CFX-4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -9 CFX-4.3 V4.3.1H Structure of a Template Variables, constants are passed through the argument list and common blocks SUBROUTINE USRSRC(IEQN,ICALL,CNAME,CALIAS,AM,SP,SU,CONV + ,U,V,W,P,VFRAC,DEN,VIS,TE,ED,RS,T,H,RF,SCAL + ,XP,YP,ZP,VOL,AREA,VPOR,ARPOR,WFACT,IPT + ,IBLK,IPVERT,IPNODN,IPFACN,IPNODF,IPNODB,IPFACB + ,WORK,IWORK,CWORK) - U, V, W, P, VFRAC, DEN, …, T, H are dimensioned (NNODE, NPHASE) - SCAL is dimensioned (NNODE, NPHASE, NSCAL) - XP, YP, ZP are dimensioned (NNODE)
AEATECHNOLoGY ENGINEERING SOFTWAR Structure of a Template Variables not in the subroutine argument list can be accessed through work space stacks WORK WORK. CWORK User areas are available for defining user variables, common blocks. etc Each template contains several examples which can be uncommented and modified by the user CFX-4 CFX4.3V4.3.1H Introductory Training(Dec 1999)
CFX-4 Introductory Training (Dec 1999) 9 -10 CFX-4.3 V4.3.1H Structure of a Template Variables not in the subroutine argument list can be accessed through work space stacks. - WORK, IWORK, CWORK. User areas are available for defining user variables, common blocks, etc. Each template contains several examples which can be uncommented and modified by the user