.. _section-5.8:

Overall Solution and Time Step Control
--------------------------------------

.. _section-5.8.1:

Order of Calculation in PRIMAR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The computational sequence used in a time step in the primary and
intermediate loops is as follows:

1.  Adjust the inlet and outlet plenum pressures for any errors between
    the estimated and the calculated core flows in the last step.

2.  Calculate :math:`b_{\text{o}}`, :math:`b_{1}`, and :math:`b_{2}` for the
    compressible volumes in the primary loop.

3.  Calculate the contributions to :math:`a_{\text{o}}`, :math:`a_{1}`,
    :math:`a_{2}`, and :math:`a_{3}` for each element in a liquid
    segment and sum them for all of the liquid segments in the primary
    loop.

4.  Calculate contributions to :math:`c_{\text{ij}}` and :math:`d_{\text{j}}` from all
    of the segments in the primary loop.

5.  Add the contributions to :math:`c_{\text{ij}}` and :math:`d_{\text{j}}` from the
    estimated core flow.

6.  Solve for :math:`\Delta p`.

7.  Calculate :math:`\Delta w`.

8.  Repeat steps 2, 3, 4, 6 and 7 for the intermediate loops, if any are
    present.

9.  Repeat steps 2, 3, 4, 6 and 7 for the DRACS loops, if any are
    present.

10. Calculate the liquid temperatures.

11. Recalculate the compressible volume pressures with the new liquid
    temperatures.

12. Calculate the cover gas flows and the cover gas pressures.

In this sequence of events, the liquid flow hydraulics calculations are
done first, followed by the liquid temperature calculations and then by
the gas flow and temperature calculations. In order to reduce the sizes
of the matrix equations that must be solved, the hydraulics calculations
are done for the primary loop first, then for the intermediate loops,
and finally for the DRACS loops, if any are present. Adiabatic
compression of the cover gases is accounted for during the initial
hydraulics calculations, but heat transfer to the gas and gas flows
through connecting pipes are not accounted for until the gas
calculations at the end of the computational sequence for a time step.

.. _section-5.8.2:

PRIMAR Time Step Size
~~~~~~~~~~~~~~~~~~~~~

The initial PRIMAR time-step size is entered as an input quantity. Then
the time-step size is determined by the coupling with the coolant
dynamics calculations for the core subassemblies. PRIMAR is called to
calculate a new time step before the core coolant dynamics routines are
called and, as a result, part of the PRIMAR calculation consists in
estimating the new core flows based on information supplied by the
coolant dynamics routines. Before the start of voiding, the core flows
can be estimated accurately in PRIMAR because the single-phase
subassembly flow calculations are relatively simple. Consequently, the
time step can be fairly large before the start of voiding. After the
start of voiding, the core flows are strongly influenced by the rapidly
varying pressures in the voiding region, and the PRIMAR time-step size
must be cut back to 20 milliseconds or less.

If PRIMAR predicts a large change in the inlet plenum pressure during a
time step, the step size must be reduced and the quantities determined
in the time step recalculated. Alternatively, if the pressure,
temperature, or flow in the primary or intermediate loop change rapidly,
but do not have a large effect on the inlet or outlet plenum pressures
and temperatures, then the PRIMAR time step is subdivided into smaller
intervals for the PRIMAR calculations without requiring additional
coolant dynamics calculations in the core subassemblies.