• No results found

The Implementation of User Defined Subroutines: the Ground File

Chapter 3 Modelling of Turbulent SF 6 Switching Arcs

3.7 Implementation of the Arc Model in PHOENICS

3.7.3 The Implementation of User Defined Subroutines: the Ground File

The Ground file provides interfaces for users to insert their own subroutines necessary for their computer simulations using PHOENICS. EARTH will make calls to specific sections in Ground file when corresponding instructions are given in Q1 file. For implementation of the arc model used in the present investigation, a brief description of the subroutines required is given in this section. The description is based on the main structure of the Ground file given below:

Group 1:

(a) Declaration of user defined variables or arrays to be used in Ground file.

(b) Subroutines used to read user data files (described in Section 3.7.4) immediately after the start of the execution of the EARTH programme “earexe.exe”. The data

files include that for basic radiation data (NEC) and those providing initial conditions of the solved for variables for both the cold flow simulation and simulation with and arc.

Group 9:

(a) A subroutine used to calculate the gas temperature based on tabulated data of enthalpy-temperature relation given in [3.16]. This subroutine must be inserted in Section 10 of Group 9. It is used when the equation of enthalpy is solved for energy conservation and the PIL command, TMP1=GRND [3.35], is given in Q1 file to instruct the EARTH to look for user defined code for temperature calculation.

(b) When the Prandtl mixing length model is used in the computer simulation, the model is implemented by user defined subroutines which calculate the turbulence length scale and the eddy viscosity. Therefore, two subroutines are required which are given below

 A subroutine used to calculate turbulence length scale, which must be inserted in Section 12 of Group 9. The PIL command, EL1=GRND, is given in Q1 file to instruct Earth to look for this subroutine.

 A subroutine used to calculate eddy viscosity, which must be inserted in Section 12 of Group 9. The PIL command, ENUT=GRND, is given in Q1 file to instruct Earth to look for this subroutine.

(c) A subroutine which gives the equation of state based on the tabulated data in [3.16], which calculates the gas density from gas temperature and pressure. For SF6, the equation of state for ideal gas is valid for temperature below 1000 K.

Therefore, ideal gas law is used to calculate gas density when T <1000 K. The subroutine must be inserted in Section 10 of Group 9. In Q1 file, the PIL command, RHO1=GRND [3.35], is inserted to instruct the EARTH to look for user defined code for density calculation.

(d) Calculation of laminar Prandtl number, PRNDTL [3.35], for equations other than velocity (W1, V1) and mass conservation equation, i.e. Prandtl number for equation of enthalpy (H1). The code must be inserted in Section 7 of Group 9. In

Q1 file, the PIL command, PRNDTL (H1)=GRND [3.35], is inserted to instruct the EARTH to look for user defined code.

(e) A subroutine calculating the molecular kinematic viscosity based in the tabulated data given in [3.16]. The subroutine must be inserted in Section 12 of Group 9.The PIL command, ENUL=GRND [3.35], is given in Q1 file to instruct Earth to look for this subroutine.

Group 11:

This part is for initialization of the field values of PHOENICS solved-for variables. This provides a user interface to set initial values grid by grid which otherwise cannot be done in Q1 file. A subroutine is inserted here which uses data read in Group 1 of Ground file to do grid by grid initialization of solve-for variables. Relevant PIL commands are required in Q1 file to instruct the EARTH to find this subroutine, as previously in Point E of Section 3.7.2.

Group 13:

Subroutines used for implementation of the boundary conditions and special source terms (i.e. Ohmic heating and radiation). The subroutines here will be used when relevant COVAL [3.35] commands are given in the Q1 file to instruct the EARTH to access them for user defined boundary conditions and source terms [3.35].

Group 19:

(a) SECTION 1 ---- Start of time step. This is a user interface to make specific settings before the solution of the next time step is started. For the present investigation, a subroutine, which is used to calculate instantaneous current, is inserted in this section. A user data file is required by this subroutine which gives the current waveform, i.e. the instantaneous current as a function of time (Point c of Section 3.7.4).

(b) SECTION 2 ---- Start of sweep. Iteration of the solution consists of sweeps in the z-direction which is normally the axial direction of gas flow. Users can update certain settings before starting the next sweep. For example,

 The width and corner coordinates of all cells are needed in the simulation and these parameters can only be obtained in this section after the simulation

starts. They cannot be calculated in Section 1 of this group.

 There are other quantities that need to be updated on a sweep basis. For example, the electric conductivity of the arcing gas (ζ) needs to be updated based on the temperature and pressure results from the sweep that is just finished, in preparation for the next sweep. The same applies to the value of the molecular diffusion coefficient of enthalpy equation (kl cp) which is

used in the enthalpy equation. The reason that both ζ and kl cp need to be updated in this section is that the statements in Group 9 only pass the existing values of these two variables to the solver without performing any updating. (c) SECTION 3 ---- Start of IZ slab. Sometimes a user may wish to update the values

of a variable in a single slab before solution on that slab is performed. For example the velocity in a slab may have experienced substantial change during a sweep when iteration is performed from Slab 1 to this slab. To improve the convergence of the iteration, the Mach number of the flow may need to be updated. This can be done here.

(d) SECTION 7 ---- Finish of sweep. This section provides a user with an access point to check or record the results from a sweep by writing to relevant data files. Subroutines for calculation of the energy balance, which are always assessed in Chapters 4 to 7, are also inserted in this section. The energy balance calculations are performed using equations given in Table 4.1 of Chapter 4, Table 5.1 of Chapter 5 and the caption of Figure 7.9 of Chapter 7.

(e) SECTION 8 ---- Finish of time step. In a transient case some parameters, such as the arc voltage, need to be written into a data file at the end of each time step or every N steps. This is normally done in this section.