# Modal Transient

Standard Sierra/SD has a fine set of modal based solutions, including a
modal transient integrator. However, Sierra/SD is designed to focus on
massively parallel solutions. It is not uncommon for an analyst to
generate a small modal solution, and to use the modal solution as part
of a small transient run. Since in modal space, the solution is
diagonal, this completely uncouples the modes and allows for an
independent solution of each modal amplitude, $q_i$.

Sierra/SD uses these solutions, but it assumes that the full solution on
all output degrees of freedom is required. In other words, the quantity
$q_i(t)$ is easily computed, but to transform back to physical space, a
fair amount of calculation must be performed, and it is performed on the
full system model. For transient dynamics, Sierra/SD performs the
following operations.

1.  Compute $q_i(t)$ for all modes, $i$, at time $t$.

2.  Expand to physical space. $x(t)=\phi q(t)$.

    This requires participation of all processors that were involved in
    the calculation of the modes.

3.  Contract to a reduced physical space, if history output is
    requested.

    This requires communication between processors.

In cases where the analyst requires only a subset of the data, this
process can be streamlined by performing the integration outside of
Sierra/SD. The calculation is fast, and can be performed in serial.

## Process for serial integration
### Compute modes of the system model

Modes are extracted in the usual way, i.e. perform a standard eigen
extraction on the full system model. Output a reduced order model by
extracting a small portion of the eigenvectors to the history file.
Element variables of stress and strain may also be output.

:::{input}
HISTORY
  nodeset 1
  block 12
  displacement
  stress
END
:::
### Extract Modal force

The modal force, $\tilde{F}(t)$, can be written by specifying 'mfile' in
the OUTPUT section of the Sierra/SD input. The file is named
"ModalFv.m". The file contains a matrix of size $N_{vect}$ x
$N_{modes}$, where $N_{modes}$ is the number of normal modes computed,
and $N_{vect}$ is the number of spatial load vectors.

Recall that Sierra/SD defines time dependent loads as a sum of products
of spatial and temporal functions. For example, consider this example
loads section.

:::{input}
LOADS
  nodeset 111
    force 1 0 0
    function 111
  sideset 22
    pressure 1.0
    function 2
END
:::

This example time dependent force could be written as follows.

$$
F(x,t) = N_{111}(x)F_{111}(t) + N_{22}(x)F_2(t)
$$

where the $N(x)$ represents a function of space only, and $F(t)$ is a
function of time only. In this example, there are two spatially varying
functions, and $N_{vect}=2$.

We assume that the analyst has access to the time varying functions,
$F(t)$, since they are part of the input. Each of the spatial terms is
multiplied by the eigenvectors to arrive it the modal contribution.

$$
ModalFv=( \Phi^T N_j )^T
$$

The total generalized force is then,

$$
\tilde{f}_j(t) = \sum_i ModalFv_{ji} F_i(t)
$$

### Perform Time Integration of Modal Space

Time integration can be performed in MATLAB or other suitable
integrator. The file, "modal_int.m" provides an example time integrator
using the standard trapezoidal rule (the Newmark-Beta integrator with
$\beta=1/4$, and $\gamma=1/2$).

We can think of the integration as the solution of three equations in
three unknowns.

\begin{eqnarray*}
\tilde{k}q_{n+1} + \tilde{c}\dot{q}_{n+1} + \ddot{q}_{n+1} & = &
           \tilde{f}(t) \\
q_{n+1} &=& q_n + \frac{1}{2}(\dot{q}_n + \dot{q}_{n+1}) \\
\dot{q}_{n+1} &=& \dot{q}_n + \frac{1}{2}(\ddot{q}_n + \ddot{q}_{n+1}) \\
\end{eqnarray*}

The latter two equations are used to eliminate the $\dot{q}_{n+1}$ and
$\ddot{q}_{n+1}$ terms, resulting in the algebraic equation for
$q_{n+1}$.

$$
\left[ \tilde{k} + \frac{2}{\Delta t} \tilde{c} + \frac{4}{\Delta t^2}
        \right] q_{n+1} =
\tilde{f} + \tilde{c}(\dot{q}_n + \frac{2}{\Delta t} q_n) +
    \left( \ddot{q}_n + \frac{4}{\Delta t}\dot{q}_n +
    \frac{4}{\Delta t^2} q_n \right)
$$

The result is $q_j(t_i)$, for each mode $j$ in the system, and for each
time value $t_i$.

### Expand to Physical Space

The integrated time values can be represented as a matrix $Q$, where
each row of $Q$ corresponds to a normal mode coordinate, and each column
represents a time value. The physical space is represented by the
product, $\tilde{\phi} Q$, where $\tilde{\phi}$ is the eigenvector in
the reduced space.

Using `exo2mat` the eigenvectors are put into six variables. They can be
reshaped into $\phi$ as follows.

:::{matlab}
phi = [ nvar01 nvar02 nvar03 nvar04 nvar05 nvar06];
phi = reshape(something)
:::

The transformation to physical space is,

:::{matlab}
XXX = phi * Q;
XX  = reshape(XXX,n,6);
x = X(:,1);
y = X(:,2);
z = X(:,3);
:::

Determining the element variables is not much different. A set of
element results "eigenvectors" is obtained using evarXX in place of
nvarXX. The result is the product $\psi Q$.

## How to Use Results

The results from this calculation cannot be easily visualized as an
animated structure because there is typically insufficient data to
reconstruct the model. However, time histories of nodal and element data
can be examined and plotted.

### Related Calculations

Similar calculations are possible with other modal based solutions. For
example, a modal frequency response calculation is performed in the same
way except that the modal amplitude is given by the following.

$$
q_i(\omega) = \frac{\tilde{f}_i(\omega)}
                   {\omega^2 -\omega_i^2 + 2\gamma_i\omega\omega_i}
$$

where $\tilde{f}_i(\omega)=\phi F(\omega)$ is given by $Modalfv$ as
before. The modal amplitude in this problem is complex of course.

## Limitations

The entire modal must fit in memory. Since this is a linear
superposition model, only linear results can be used. Further, while
natural stresses can be computed, von Mises and other principal stresses
cannot be directly computed, as they are not linear functions of
displacement.

The modal superposition method has significant limitations, independent
of the particular solution methodology. In particular, the method may be
slow to converge spatially if the loading is not well represented by a
low frequency mode. Other methods such as the Craig-Bampton reduction
can be much better in these cases, though they suffer from having a
coupled system of equations.

## Verification

The simplest verification is to run a portion of the time history
through the standard Sierra/SD modal transient, and compare the results
with the results from the reduced order model.
