USER1 arguments and common blocks

Calling convention

 subroutine user1(gg,t,c,q,qd,r,time,dt,it,
        + kode,nocon,maxno,iconv,dum1,dum2,dtp,tf)
C
C   Arguments
C
        real gg(*), t(*), c(*), q(*), qd(*), r(*)
        real time, dt, dum1, dum2, dtp, tf
        integer it, kode, nocon, maxno, iconv(*)
        character*7 name
C
C   Common block variables
C
        real tdmax, prtflg, params(80000), grav, gv(3), tabs, rgas
        real pstd, tstd, sigma
        integer irun, ir(1), maxn1, maxn2
C
C   Common block definitions
C
        common/tdmax/tdmax
        common/prtflg/prtflg
        common/irun/irun,ir
        common/maxnoq/maxn1,maxn2
        common/params/params
        common/grav/grav,gv(3),tabs,rgas,pstd,tstd,sigma
    double precision t,time,dt
    save
    ..
        return
        end

Argument definitions

Arguments Definition
c c(i) is the capacitance of internal element i. Temperatures of elements with c(i) < 0 are not computed with the normal heat balance equations. MCV elements and sink elements are assigned c(i) < 0.
dt The current integration time step for transient runs.
dtp The printout time increment for transient runs.
gg gg(j) is the current value of the resistance j, that is, the inverse of the conductance J. If J is a radiative conductance, then gg(j) is the inverse of its current linearized value, that is, the temperature difference between its elements divided by the heat flow through it.
grav The magnitude of the gravity acceleration.
gv gv(i) is the component of the unit gravity vector in direction i, expressed in global coordinates.
iconv iconv(j) is the real element number of internal element k. Thermal solver assigns an internal number for each element. The real element numbers are stored in array iconv. The function k = kconv(j) retrieves the internal element number k of real element j.
irun The current run number.
ir The parameter to execute the run number (irun) when irun> 1. ir(irun)is set to the Card 2b - Analyzer Control Card – Optional GRADNT parameter value: 0 for steady state runs and –2, –3, –4, or –5 for transient runs. For more information, see the Thermal Solver Reference Manual PDF.
it The current iteration counter value.
kode = 1 if the subroutine USER1 is entered before calculating the temperatures.

= 2 if the subroutine USER1 is entered after calculating the temperatures.

= 3 when the run is completed.

= 4 when the subroutine USER1 is entered before calculating total pressures for hydraulic elements.

= 5 If PARAM USRCNDADD is present, USER1 is entered once initially with KODE=5. If CALL ADDCOND is present, new conductances are added to the matrix.

maxn1 The number of non–hydraulic elements (cannot be changed).
maxn2 The number of hydraulic elements (cannot be changed).
maxn0

The number of elements (maxn0 = maxn1 + maxn2). Recommended array size for the models with hydraulic elements is maxn0 + maxn2, not maxn0. Thermal solver partitions element numbers as follows:

  • 1 to maxn1: Thermal properties of non-hydraulic elements.
  • maxn1+1 to maxn1+maxn2: Thermal properties of hydraulic elements.
  • maxn1+maxn2+1 to maxn1+2*maxn2: Thermal properties of hydraulic elements.
  • maxn1+maxn2+1 to maxn1+2*maxn2: Pressure/flow properties of hydraulic elements.
nocon The number of conductances (cannot be changed).
params

General-purpose common block for analyzer parameters.

  • PARAMS (249) is the largest Card 9 DESCRIP Card ID number. For more information, see the Thermal Solver Reference Manual PDF.
  • PARAMS (291) is the maximum element number in the model.
  • PARAMS (292) is the maximum node number in the model.
prtflg The print flag.
  • = 0,then it isOFF.
  • = 1,then it is ON.
  • = 1 when KODE = 2, thermal solver prints the parameters specified on the PRINT Cards for the current iteration or time step.
pstd The standard pressure from Card 9 - HYDENV Hydraulic Element Environment Definition Card - Optional. For more information, see the Thermal Solver Reference Manual PDF.
q The heat load to internal element k. q(j) is re-initialized at each iteration or time step. To change its value permanently, you have to change it every time USER1 is entered with KODE = 1.
qd(k) The fraction of phase–change element k in its higher temperature phase. k is an internal element number.
r(j) The conductance parameter of conductance J. r(j) is not altered during the run, except for temperature-dependent radiative conductances. The value of r(j) for a linear conductance is the inverse of its initial conductance, that is, R(J) is a resistance. r(j) is the value for a radiative conductance (area * emissivity * gray body view factor * Stefan–Boltzmann constant) . For Oppenheim's Method (Card 9 - PARAM Parameter Card - Optional OPPENHEIM) the gray body view factor between an element and its surface element is 1/(1–emissivity). For more information, see the Thermal Solver Reference Manual PDF.

For example, to change the value of a radiative coupling in a user-written subroutine, modify the value of both r(j) and gg(j) by multiplying them by the same value.

For a convective conductance, r(j) is the inverse of the Card 6e - Thermal Coupling Request Card – Optional A(N1)*HN1, that is, projected area multiply by multiplier value.

rgas The universal gas constant.
sigma The Stefan–Boltzmann's Constant.
t

t(j) is the temperature of the internal element j, for internal element numbers ≤maxn1+maxn2.

t(j+maxn2) is the total pressure value of internal element j for internal element numbers >maxn1+maxn2.

The contents of the T array are as follows:

From To Description
t(1) t(maxn1) Temperatures of non-hydraulic elements.
t(maxn1+1) t(maxn1+maxn2) Temperatures of hydraulic elements.
t(maxn1+maxn2+1) t(maxn1+2maxn2) Total pressure values of the hydraulic elements.

Both iconv(j) and iconv(j + maxn2) represent the element's real element number.

Analyzer calculates temperatures in double precision. t(K) is in single precision by default. To specify the t array in double precision, include the following line: double precision t, time, dt.

tabs The absolute value of the absolute zero temperature (273). Thermal solver assumes that the model zero is never below absolute zero.
tdmax The current value of the maximum temperature difference of any element between the current iteration and the previous one for steady-state run. If tdmax is set to 0 with KODE = 2 for steady state runs, the run is forced to terminate.
time The current time value for transient runs. time is in single precision by default. To specify dt, t and time in double precision variables to USER1,include the following line: double precision t, time, dt
tf The maximum number of iterations for a steady state run. If tf is set to 0, the run is forced to terminate.
tstd The standard temperature for fluid properties.