Data initialization

The initialization step is required when the thermal solver calls USER1 during a solution for a first time. This step includes the gathering model data such as contents of groups, element properties, and needs to be performed only once.

        logical firsttime, active
        data firsttime/.true./
C
C
C
        if ( firsttime ) then
C
C   Initialization code goes here
C
                firstime = .false.
        end if
C
C   Implementation code goes here
C

The if loop terminates in an end if rather than an else statement in case it is still needed to run the actual code that modifies the thermal model. The first call to USER1 is no different from any other, it is not specifically for initialization.

The USER1 argument KODE indicates where thermal solver is in the temperature solution process. The possible values are:

Value of KODE Solution state
1 Thermal solver is about to calculate temperatures. This is the appropriate time to modify conductance values as temperatures are calculated from conductances.
2

Temperatures have just been calculated. If thermal solver is going to recalculate conductances it will do it after returning from this call to USER1.

This is the time to modify temperatures in the model so that conductances will be calculated from the modified values.

3 The run is completed. Use this call to write out any final results that USER1 is calculating.
4 Thermal solver is about to calculate total pressures for any fluid network element. Adjust any fluid network parameters at this point.
5 If USER1 is adding conductances to the model, it must be done during this call to USER1. There is only one opportunity during a solution.

In practice, most USER1 activity occurs with KODE = 1 or KODE = 2. A possible implementation of this logic is shown in the following example:

       if (kode .eq. 1) then
C
C   Modify conductance values here
C
        else if (kode .eq. 2) then
C
C   Modify temperatures
C
        else if (kode .eq. 3) then
C
C   Tidy up and print final results
C
        else if (kode .eq. 4) then
C
C   Adjust fluid network parameters
C
        else if (kode .eq. 5) then
C
C   Generate and add conductances
C
        end if