Multiple runs for a user written subroutine

You can perform a maximum of 9999 Analyzer runs within a single thermal solver run by setting the run type in the IR array. The IR array is initialized to –10000, except for IR(1), which is initialized to the Card 2b Analyzer Control GRADNT parameter.

IR(1) defines whether the initial run is steady state or transient.

IRUN is the current run number. To perform subsequent runs, simply set the values in the IR array to the desired Card 2b GRADNT values. The temperatures, heat loads, and total pressures of run n are written on files TEMPFn, QNODEFn, and PRESSFn.

For example, suppose you want to perform three runs in a row: a steady state run to define initial temperatures with the boundary conditions defined at Card 2b TST = 0, then a transient run with Card 2b GRADNT = –3 until TF = 2, then another steady state run with the heat loads and sink element temperatures defined at TIME = 10. This can be achieved with the following example:

      subroutine user1
     +(gg,t,c,q,qd,r,time,dt,it,kode,nocon,maxno,
     +iconv,dum1,dum2,dtp,tf)
      dimension gg(*),qd(*),t(*),c(*),q(*),r(*),iconv(*)
      character*7 name
      common/tdmax/tdmax
      common/prtflg/prtflg
      common/irun/irun,ir(1)
      common/maxnoq/maxn1,maxn2
      common/params/params(80000)
      common/grav/grav,gv(3),tabs,rgas,pstd,tstd,sigma
      save
C
C   Define that we wish to run multiple runs
C
      if (kode.eq.3) then
C
C   Set second run to transient, forward
C   differencing
C
         ir(2)=-3
C
C   Set third run to steady state
C
         ir(3)=0
      end if
C
C   Set final time of transient run for run 2 to 2. 
C   Set the printout interval to 0.5
C
      if (irun.eq.2) then
         tf=2
         dtp=0.5
      end if
C
C   Set steady state iteration parameters for run 3. 
C   The heat loads and sink element temperatures 
C   are defined at time = 10. The maximum number of
C   iterations is set to 100, and only final 
C   printout is requested.
C
      if (irun.eq.3) then
         time=10
         tf=100
         dtp=0
      end if
      return
      end

Another multiple run example

–1 $ ninth –1 delimiter card
      subroutine user1
     +(gg,t,c,q,qd,r,time,dt,it,kode,nocon,maxno,
     +iconv,dum1,dum2,dtp,tf)
      dimension gg(*),qd(*),t(*),c(*),q(*),r(*),iconv(*)
      character*7 name
      common/tdmax/tdmax
      common/prtflg/prtflg
      common/irun/irun,ir(1)
      common/maxnoq/maxn1,maxn2
      common/params/params(80000)
      common/grav/grav,gv(3),tabs,rgas,pstd,tstd,sigma
      save
C
C   Set heat load to element 10 to 20 units 
C   for time > 100 if temperature of
C   element 30 < 15 degrees.
C
      if(kode.eq.1)then
         if(time.gt.100.0.and.t(kconv(30)).lt.15)
     +     q(kconv(10))=20.0
      else
C
C   Postprocessing – temperature of element 20 
C   is 5 degrees above that of 30
C
         t(kconv(20))=t(kconv(30))+5
      end if
      return
      end
–1 $ tenth delimiter card