.. _section-16.7:

Detailed Logic Flow Description
-------------------------------

This section describes in detail the logical sequence of the solution
method used in LEVITATE. The structure of the LEVITATE driver as well as
initiation and interfacing considerations have been presented in :numref:`section-16.1.3`. Some information about the interaction between LEVITATE models
was presented in :numref:`section-16.1.2.4` and the method of solution for the
coolant channel model was described in :numref:`section-16.4.2`. This section will
use, and occasionally repeat some of this information in order to
present a comprehensive picture of the general solution method. Some
considerations about the data management and time-step selection are
also presented.

.. _section-16.7.1:

Data Management Considerations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Every time LEVITATE begins calculations in a channel, the permanently
stored information is retrieved from the data container and loaded in
the common blocks. This operation is performed in the TSTHRM module. A
number of arrays and other data, however, which can be calculated from
the permanently stored variables, are not stored in the permanent
storage. These data are recalculated in the routine LESET2 every time
LEVITATE receives control in a certain channel, i.e., at the beginning
of a primary time step. These variables are stored in temporary common
blocks, and kept only as long as LEVITATE retains control in the
channel. At the end of the primary time step, when LEVITATE returns
control to TSTHRM, these variables are lost. Only the permanent common
blocks are saved in the data container. This procedure is used in order
to reduce the amount of storage required for SAS4A.

.. _section-16.7.2:

Logic Flow for Solution Advancement
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As explained in :numref:`section-16.1.2`, the LEVITATE model can be viewed as
being made up of three large models, i.e, the coolant channel
hydrodynamic model, the in-pin fuel motion model and the
freezing/melting model describing the fuel pins and the hexcan wall.
During each time step, LEVITATE advances the solution for these models
by calculating the value of all variables at the end of the time step.
The time-step selection is described in :numref:`section-16.7.3`. The simplified
modular chart of the LEVITATE model is shown again in :numref:`figure-16.7-1`.

The LEVITATE calculation begins by advancing the solution for the
channel hydrodynamic model. The changes in the position of material
boundaries are calculated first. The new interface positions, at the end
of the time step, are calculated for all components, except sodium in
the LEIF (LEVITATE INTERFACE) routine. The position of the sodium slugs,
which determine the boundaries of the sodium region, is calculated in
the LEREZO **LE**\ VITATE **REZON**\ ING) routine. This routine can add (or
remove) nodes to the LEVITATE compressible region as the sodium slugs
move out of (or remove) nodes to the LEVITATE compressible region as the
sodium slugs move out of (or into) the channel.

The mass conservation equation is solved next for all components and all
axial locations. Each equation is solved explicitly, i.e., the
convective fluxes are based on the generalized densities present in each
cell at the beginning of the time step. These calculations are performed
in the LEMACO (**LE**\ VITATE **MA**\ SS **CO**\ NSERVATION) routine.

The LEVOFR (**LE**\ VITATE **VO**\ LUME **FR**\ ACTION) routine uses the new
densities to determine the volume fraction of each component at each
axial location. Using these volume fractions, the LEVOFR routine also
determines the flow regime in each axial cell. This flow regime will be
assumed to exist in the cell of the duration of the time step. It is
worth noting that this is an "implicit type" assumption as the flow
regimes are based on the densities calculated at the end of the time
step.

The next routine called is LEGEOM (**LE**\ VITATE **GEOM**\ ETRY) which
determines the geometrical characteristics defining each local
configuration. This routine will change the thickness of the fuel crust
as necessary or determine

the fraction of the cladding circumference covered by the liquid fuel in
the partial annular flow regime. In general, LEGEOM calculates the area
of contact between various components in various flow regimes. These
areas will be used later in calculating the energy and momentum transfer
between various components.

The next routine called is LETRAN (**LE**\ VITATE **TRAN**\ SFER) which
calculates the heat-transfer and friction coefficients for all axial
locations and among all components that are in direct contact. Thus, the
code will use the flow regimes present at a certain location to
determine which heat-transfer and friction coefficients have to be
calculated. The allowable exchanges for each flow regime and each
component have already been presented in :numref:`figure-16.4-3` through :numref:`figure-16.4-10`.
Once contact areas and the corresponding heat-transfer coefficients have
been calculated, the energy conservation equation can be solved for all
components.

.. _figure-16.7-1:

..  figure:: media/image29.png
	:align: center
	:figclass: align-center

	Simplified Modular Chart of the LEVITATE Module

The LESOEN (**LE**\ VITATE **SO**\ LID, LIQUID AND STATIONARY **EN**\ ERGY
EQUATION) routine is called to solve the energy conservation equations
for the fuel and steel channels, liquid fuel, liquid steel, stationary
cladding, hexcan wall, frozen fuel on the cladding and frozen fuel on
the hexcan wall. All equations are solved explicitly, i.e., the
convective fluxes are based on beginning of time-step densities, thus
allowing the axial decoupling of the equations. The energy equation for
sodium (two-phase or single-phase vapor) and fission gas is solved in
LENAEN (**LE**\ VITATE SODIUM-\ **NA** **EN**\ ERGY). The energy equations for
fuel and steel vapor are solved LEFUVA (**LE**\ VITATE **FU**\ EL **VA**\ POR
ENERGY) and LESEVA (**LE**\ VITATE **FU**\ EL **VA**\ POR ENERGY) and LESEVA
(**LE**\ VITATE **S**\ TEEL **VA**\ POR ENERGY), respectively. The new
temperatures calculated in LENAEN, LEFUVA and LESEVA are used to
determine the new pressure of each of the compressible components and
thus the total new pressure.

At this point, the only variables that remain to be calculated in order
to complete the solution for the coolant channel hydrodynamic model are
the velocities of various components. However, before calculating the
new velocities, the hydrodynamic in-pin model is used to advance the
in-pin solution in the LE1PIN and LE2PIN routines. Due to the strategy,
the changes n the channel hydrodynamics due to the interaction with the
in-pin motion will be taken into account in the velocity calculation.
The routine LE1PIN solves the mass and energy conservation equations for
the in-pin hydrodynamic model. It also calculates the enlargement of the
pin cavity and the amount of molten fuel added to the cavity, as well as
the amount of fuel ejected from the cavity via the cladding rip and/or
the ends of the fuel-pin stubs. The LE2PIN routine completes the
solution of the in-pin hydrodynamic model by solving the momentum
conservation equations for all the cells in the cavity and determining
the new in-pin velocities at the end of the time step. This routine
determines the next maximum time step acceptable for the in-pin
hydrodynamic model, DTPIN which will then be used in the LEVIATE driver
as explained in :numref:`section-16.7.3`. The in-pin model interacts directly with
the channel model via the fuel injection process, which, as mentioned
above, is described in the LE1PIN routine. Molten fuel and fission gas
are ejected from cavity into the channel, leading to changes in the
local pressure.

The solution of the channel hydrodynamic model is then completed by
solving the momentum equation for each of the three velocity fields
(fuel/steel, gas mixture and solid chunks) in the routine LEMOCO
(**LE**\ VITATE **MO**\ MENTUM **CO**\ NSERVATION). The method of solution is
still explicit and the equations are uncoupled axially, but the
equations for all three fields are solved simultaneously rather than
independently, as was done in the mass and energy equations. Also it is
important to note that the pressures used in the momentum equation are
the pressures at then end of the time step. The LEMOCO routine also
calculates the new velocities of the lower and upper liquid sodium
slugs, which will be used in the next time step in the LEREZO routine.
It also calculates the quantities which are fed back to the primary loop
model as explained in :numref:`section-16.1.3.3.1` and :numref:`section-16.6.2`. The sodium slugs
provide the axial boundaries for the interactive region modeled by
LEVITATE and their molten can affect significantly the fuel motion in
the coolant channel.

All the routine called after LEMOCO describe melting or freezing
processes related to the solid chunks, cladding or the hexcan wall. The
routine LELUME (**LE**\ VITATE CHUNK-\ **LU** **MEL**\ TING) calculates the
melting and the size changes of the solid fuel/steel chunks at all axial
locations. The routine LEFREZ (**LE**\ VITATE **FRE**\ E\ **Z**\ ING AND
MELTING) then models a series of important processes, such as fuel/steel
freezing and crust formation, fuel/steel chunk formation, fuel crust
remelting and breakup. Next called is the routine LEABLA (**LE**\ VITATE
**ABLA**\ TION) which calculates the gradual melting and ablation of the
cladding and hexcan wall. The routine LEDISR (**LE**\ VITATE
**DISTR**\ UPTION) performs the disruption of the fuel pin, whenever a
node disruption is predicted. The disruption, which can occur in one or
more nodes in any time step, leads to changes in geometry, mass, energy
and pressure various components present in the respective cell. Finally,
the routine LESRME (**LE**\ VITATE **S**\ T\ **R**\ UCTURE **ME**\ LTING)
calculates the rupture of the hexcan wall, due to melting and/or
pressure burst effects.

Using the material distributions at the end of the time step, LEVITATE
then calculates the fuel, steel and sodium mass distributions, which, at
the end of the primary time step, are fed back to the point kinetics
module, as explained in :numref:`section-16.1.3.3.3` and :numref:`section-16.6.1`. Finally, if the
end of a heat-transfer time step is reached, LEVITATE class the routine
PLHTR, which calculates the new temperatures in the solid fuel pin at
all axial locations. These temperatures will be used in the next time
step in the LE1PIN routine to calculate the new cavity diameter and the
heat flux between the outer fuel pin surface and the cladding.

.. _section-16.7.3:

Time-step Considerations
~~~~~~~~~~~~~~~~~~~~~~~~

The LEVITATE driver routine, LEVDRV can be called by the SAS4A transient
driver TSTHRM at any time during a primary loop time step. The primary
time step is common for all SAS4A calculational channels and is always
smaller than or equal to the main time step used in the point kinetics
calculation.

When the fuel-pin failure is detected in a given channel, the LEVITTE
and PLUTO2 time, TIMEPL, is set to zero in the FAILUR routine. Then
LEVITATE is entered directly after pin failure, TIMEPL is initially
advanced by adding the LEVITATE minimum time step DTPLIN to the time
TIMEPL. However, if LEVITATE is entered after PLUTO2 has been active in
a given channel, the TIMEPL will be incremented by the last time step
calculated by PLUTO2, as explained in :numref:`section-14.7.2`. Subsequently, the
time TIMEPL will be advanced by the time step calculated by LEVITATE< as
described below.

A maximum time step DTPIN, is calculated first for the in-pin
hydrodynamic model, as outlined in :numref:`section-14.2.8`. Then, once all
LEVITATE calculations for the current time step are completed, a new
time step for the channel hydrodynamic model is calculated in the LEVDRV
routine. The details of this calculation are presented in :numref:`section-16.4.3.11`. This time step is then compared with the in-pin time step and
with the present maximum value :math:`2 \cdot 10^{-4}` s. The smallest value
is retained as the LEVITATE time step. This value is further compared
with the input minimum time step, DTPLIN and the larger value is
retained. Finally, the LEVITATE time step can be cut back if the newly
determined time:

(16.7-1)

.. _eq-16.7-1:

.. math::

	t_{\text{LE}}^{n + 1} = t_{\text{LE}}^{n} + \Delta t

extends beyond the end of a heat-transfer time step. In this case, the
new LEVITATE time step will be reduced so that the new LEVITATE time
:math:`t_{\text{LE}}^{n + 1}` will coincide with the end of the
heat-transfer time step.

As shown in the flow diagram 16.7-1, LEVITATE retains control and
advances the solution a given channel until the end of a primary loop
time step is reached.

.. _section-16.7.4:

List of LEVITATE Subroutines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This section contains a list of all the subroutines that are part of the
LEVITATE model. These routines are listed in the order they are called:

.. list-table::
	:header-rows: 1
	:align: center
	:widths: auto

	* - Name
	  - Description
	* - LEVDRV
	  - LEVITATE driver routine.
	* - LEIF
	  - Calculates the new boundary region locations for all the material components, except sodium.
	* - LEREZO
	  - Calculates the new boundary locations for the sodium region, as determined by the dynamics of the liquid sodium slugs.
	* - LEMACO
	  - Solves the conservation equations for all the components present in the coolant channel.
	* - LEVOFR
	  - Calculates the volume fraction occupied by each channel component at all axial locations. It also determines the flow regime present in the channel at all axial locations.
	* - LEGEOM
	  - Determines the local geometry, taking into account the previous configuration and the current flow regime.
	* - LETRAN
	  - Calculates the heat and momentum transfer coefficients between various components.
	* - LESOEN
	  - Solves the coolant channel energy conservation equations for liquid fuel and steel, chunks, fuel crusts, cladding and hexcan wall.
	* - LENAEN
	  - Solves the coolant channel energy conservation equation for the sodium and fission-gas mixture in the coolant channel.
	* - LEFUVA
	  - Solves the energy conservation equation for the fuel vapor in the channel.
	* - LESEVA
	  - Solves the energy conservation equation for the steel vapor in the channel.
	* - LE1PIN
	  - Solves the mass and energy conservation equation for the in-pin hydrodynamic model. It also calculates the ejection of molten fuel from the cavity into the coolant channel.
	* - LE2PIN
	  - Solves the momentum conservation equations for the in-pin hydrodynamic model. Determines the next maximum time step for the in-pin model.
	* - LEMOCO
	  - Solves the momentum conservation equations for the channel hydrodynamic model. Also solves the momentum equations for the liquid sodium slugs.
	* - LELUME
	  - Examines the melting of the fuel and steel chunks. When melting occurs, performs al the required operations.
	* - LEFREZ
	  - Models the freezing of fuel and steel in the channel, crust formation, crust remelting, and heat-up. This routine is used when the chunk model is not active (ICHUCK=O).
	* - LEFRLU
	  - Models the freezing of fuel and steel in the channel, crust and chunk formation, crust remelting and breakup. This routine is used instead of LEFREZ when the chunk model is used (ICHUNK=1).
	* - LEABLA
	  - Models the ablation of cladding and/or hexcan wall, whenever necessary.
	* - LEDISR
	  - Models the disruption of the fuel pins at any axial location.

Other routines called in LEVITATE, which are shared with other modules,
are:

.. list-table::
	:header-rows: 1
	:align: center
	:widths: auto

	* - Name
	  - Description
	* - PLHTR
	  - Calculates the transient heat transfer in the solid fuel pin. It is called from the LEVITATE driver. This routine can also be called from eh PLUTO2 driver routine.
	* - HHGAP
	  - Determines the heat-transfer coefficient between the fuel pin and cladding. This routine is called from LESOEN. It can also be called from PLUTO2 or DEFORM.
	* - UTS
	  - Determines the ultimate tensile strength of the cladding. It is called from LEIF in order to determine the cladding rip propagation.
	* - EGFUTE
	  - Provides the fuel enthalpy as a function of temperature. It is used frequently in LEVITATE and PLUTO2.
	* - TEFUEG
	  - Provides the fuel temperature as a function of enthalpy.
	* - EGSETE
	  - Provides the steel enthalpy as a function of temperature.
	* - TESEEG
	  - Provides the steel temperature as a function of enthalpy.