\subsection{The \texttt{GRAD:} module}

The {\tt GRAD:} module is designed to perform the following tasks:
\begin{itemize}
\item compute the gradients of the {\sl system characteristics} (i.e., objective function and constraints) using
solutions of direct or adjoint fixed source eigenvalue problems. Here, we assume an optimization problem with \dusa{nvar}
control variables and with \dusa{ncst} constraints. The total number of system characteristics is therefore equal to
\dusa{ncst}$+1$.

\item define options and parameters related to the optimization problem.
\end{itemize}

\vskip 0.08cm

The {\tt GRAD:} module can be used to perform a {\sl Newtonian} search of SPH factors, as depicted in Fig.~\ref{fig:fig_fnewton}.

\vskip 0.2cm

\begin{figure}[h!]
\begin{center}
\includegraphics[scale=0.85]{Figures/flow_newton.eps} 
\caption{Newton SPH iterations.}\label{fig:fig_fnewton}
\end{center}
\end{figure}

\vskip 0.08cm

The calling specifications are:

\begin{DataStructure}{Structure \moc{GRAD:}}
\dusa{OPTIM} \moc{:=} \moc{GRAD:} $[$ \dusa{OPTIM} $]$ \dusa{DFLUX} \dusa{GPT} \moc{::} \dstr{grad\_data}
\end{DataStructure}

\noindent where

\begin{ListeDeDescription}{mmmmmmmm}

\item[\dusa{OPTIM}] \texttt{character*12} name of the \dds{optimize} object ({\tt L\_OPTIMIZE} signature) containing the
optimization informations. Object \dusa{OPTIM} must appear on the RHS to be able to updated the previous values.

\item[\dusa{DFLUX}] \texttt{character*12} name of the \dds{flux} object ({\tt L\_FLUX} signature) containing a set of
solutions of fixed-source eigenvalue problems.

\item[\dusa{GPT}] \texttt{character*12} name of the \dds{source} object ({\tt L\_SOURCE} signature) containing a set of
direct or adjoint sources.

\item[\dstr{grad\_data}] structure containing the data to the module \texttt{GRAD:} (see Sect.~\ref{sect:grad_data}).

\end{ListeDeDescription}
\vskip 0.2cm

\subsubsection{Data input for module \texttt{GRAD:}}\label{sect:grad_data}

\begin{DataStructure}{Structure \moc{grad\_data}}
$[$ \moc{EDIT} \dusa{iprint} $]$ \\
$[~\{$ \moc{MAXIMIZE} $|$ \moc{MINIMIZE} $\}~]$ \\
$[$ \moc{OUT-STEP-LIM} \dusa{sr} $]$ \\
$[$ \moc{VAR-VALUE} ( \dusa{control}(i), i=1,\dusa{nvar} ) $]~[$ \moc{VAR-WEIGHT} ( \dusa{weight}(i), i=1,\dusa{nvar} ) $]$ \\
$[$ \moc{VAR-VAL-MIN} $\{$ ( \dusa{vecmin}(i), i=1,\dusa{nvar} ) $|$ \moc{ALL} \dusa{varmin} $]$ \\
$[$ \moc{VAR-VAL-MAX} $\{$ ( \dusa{vecmax}(i), i=1,\dusa{nvar} ) $|$ \moc{ALL} \dusa{varmax} $]$ \\
$[$ \moc{FOBJ-CST-VAL} ( \dusa{funct}(i), i=1,\dusa{ncst}$+1$ ) $]$ \\
$[$ \moc{CST-TYPE} ( \dusa{type}(i), i=1,\dusa{ncst} ) $]~[$ \moc{CST-OBJ} $\{$ ( \dusa{cstval}(i), i=1,\dusa{ncst} ) $|$ \moc{KEEP} $\}~]$ \\
$[$ \moc{CST-WEIGHT} ( \dusa{cstw}(i), i=1,\dusa{ncst} ) $]$ \\
;
\end{DataStructure}

\noindent where
\begin{ListeDeDescription}{mmmmmmmm}

\item[\moc{EDIT}] keyword used to set \dusa{iprint}.

\item[\dusa{iprint}] index used to control the printing in module.

\item[\moc{MAXIMIZE}] keyword used to specify that the optimization problem will be a maximization.

\item[\moc{MINIMIZE}] keyword used to specify that the optimization problem will be a minimization (default).

\item[\moc{OUT-STEP-LIM}] keyword used to set or reset the maximum steplength along the gradient (default value is \dusa{sr} $=1.0$ or the value
recovered from \dusa{OPTIM}).

\item[\dusa{sr}] maximum steplength value (real).

\item[\moc{VAR-VALUE}] keyword to specify the values of the control variables. These values can also be set in a previous call
to module {\tt GRAD:} or set in another module.

\item[\dusa{control}] array containing \dusa{nvar} real values.

\item[\moc{VAR-WEIGHT}] keyword to specify the values of the control variable weights in the quadratic constraint. All weights
are set to 1.0 by default.

\item[\dusa{weight}] array containing \dusa{nvar} real values.

\item[\moc{VAR-VAL-MIN}] keyword to specify the minimum values of the control variables. These values can also be set in a previous call
to module {\tt GRAD:}.

\item[\dusa{vecmin}] array containing \dusa{nvar} real values.

\item[\dusa{varmin}] single real value used for all control variables.

\item[\moc{VAR-VAL-MAX}] keyword to specify the maximum values of the control variables. These values can also be set in a previous call
to module {\tt GRAD:}.

\item[\dusa{vecmax}] array containing \dusa{nvar} real values.

\item[\dusa{varmax}] single real value used for all control variables.

\item[\moc{FOBJ-CST-VAL}] keyword to specify the value of the objective function followed by the actual values of the constraints. These values can also be set in a previous call
to module {\tt GRAD:} or set in another module.

\item[\dusa{funct}] array containing \dusa{ncst}$+1$ real values.

\item[\moc{CST-TYPE}] keyword to specify the relation types of the constraints. These values can also be set in a previous call
to module {\tt GRAD:}.

\item[\dusa{type}] array containing \dusa{ncst} integer values. These values are: $=-1$ for $\ge$, $=0$ for equalily and $=1$
for $\le$.

\item[\moc{CST-OBJ}] keyword to specify the RHS values of the constraints. These values can also be set in a previous call
to module {\tt GRAD:}.

\item[\dusa{cstval}] array containing \dusa{ncst} real values.

\item[\moc{KEEP}] keyword to specify that the RHS values of the constraints are identical to the values of the previous iteration.

\item[\moc{CST-WEIGHT}] keyword to specify the weights (or penalties) of the constraints. These weights are not used with
Lemke or MAP methods. These values can also be set in a previous call to module {\tt GRAD:}.

\item[\dusa{cstw}] array containing \dusa{ncst} real values.

\end{ListeDeDescription}
\clearpage
