####################################
G. User-Defined Model Initialization
####################################

Multiple methods exist to define the initial state of an analysis model. When initializing the state of a new Sierra/SManalysis from a previous analysis, restart is the recommended method (see :numref:`output-restart`). However, in some cases a restart initialization is not possible; for instance, if the initial stress/strain state of the model is coming from an external source such as another code, experimental data, or an analytic solution. Another example is when new blocks are added to an existing analysis and need initial stress/strain/material state that is defined in a secondary analysis.

The methodology of manually initializing a model is sometimes called "poor man's restart."  Generally many node and element fields need to be set to give a fully consistent initial state. The required field set is different for different element types as shown in :numref:`poorMansRestartVars`.

.. _poorMansRestartVars:

.. csv-table:: Required Variables For Consistent Model Initialization
   :align: center
   :delim: &
   :header: Element, Nodes, Formulation, Element Variables, Nodal Variables
   :widths: auto

   Beam & 2 & Rod & beam_tshear_rs, beam_tshear_rt, beam_t_axis, cross_sectional_area, left_stretch, unrotated_stress & acceleration, displacement, velocity, rotational_acceleration, rotational_displacement, rotational_velocity
   & & Cylindrical Joint & cylj_rst_theta1, cylj_rst_theta2, hg_resistance, left_stretch, unrotated_stress & displacement, velocity
   Shell & 3 & Orig_Tri_Shell, C0_Tri_Shell & element_thickness, unrotated_stress & acceleration, displacement, velocity, rotational_acceleration, rotational_displacement, rotational_velocity
   & 4 & BL_Shell (Integration rule = Trapezoid) & membranehourglass, shearhourglass, unrotated_stress & acceleration, displacement, velocity, rotational_acceleration, rotational_displacement, rotational_velocity
   & & BT_Shell (Integration rule = Trapezoid) & hg_resistance_q4, unrotated_stress & acceleration, displacement, velocity, rotational_acceleration, rotational_displacement, rotational_velocity
   Hex & 8 & Uniform Gradient & rotation, left_stretch, hg_resistance, unrotated_stress & displacement, acceleration, velocity
   & & Fully Integrated & unrotated_stress & displacement, velocity
   Tet & 4 & Uniform Gradient & left_stretch, unrotated_stress & displacement, acceleration, velocity
   & & Fully Integrated & left_stretch, unrotated_stress & displacement, acceleration, velocity
   & 10 & Composite_Tet & left_stretch, rotation, unrotated_stress & displacement, velocity
   Particle & 1 & SPH & calc_dens, element_density, element_mass, left_stretch, rotation, total_stress, unrotated_stress & coordinates, acceleration, displacement, velocity, rotational_acceleration, rotational_displacement, rotational_velocity, force_internal

Material state needs to be initialized in a manner that is consistent with other element kinematic quantities, as well. Several elastic materials have no state data, but most materials have a state data array at each element. The name of the material state data field is usually defined by ``lame_state_[model_name]``, where ``model_name`` is the name of the material model. For example the name of the state field for the viscoplastic material is ``lame_state_viscoplastic`` and the name of the state field for the soil foam model is ``lame_state_soil_foam``.

Material state variables also often have aliases, which causes some confusion when using them for restart and initialization purposes. When writing out material state in a preload analysis for initialization in a later analysis output, the following syntax is strongly recommended:

.. code-block:: sierrainput

   BEGIN RESULTS OUTPUT
     ...
     ELEMENT VARIABLES = lame_state_viscoplastic(:) as \#
       state_viscoplastic
     ...
   END

The "(:)" operator will prevent the use of material state alias names; the material state will be output as a single contiguous field which can then be read back in a single operation. An initialization block like the following should then be used to read back in the material state:

.. code-block:: sierrainput

   BEGIN INITIAL CONDITION
     INITIALIZE VARIABLE NAME = lame_state_viscoplastic(:)
     VARIABLE TYPE = ELEMENT
     READ VARIABLE = state_viscoplastic
   END

In addition to element- and material-specific field data, some boundary-specific conditions may have additional initialization requirements.
