\begin{Verbatim}[commandchars=\\\{\}]
\PY{k}{class} \PY{n+nc}{Release}\PY{p}{(}\PY{n}{Hyperelasticity}\PY{p}{)}\PY{p}{:}

        \PY{o}{.}\PY{o}{.}\PY{o}{.}

    \PY{k}{def} \PY{n+nf}{end\PYZus{}time}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{k}{return} \PY{l+m+mf}{10.0}

    \PY{k}{def} \PY{n+nf}{time\PYZus{}step}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{k}{return} \PY{l+m+mf}{2.e-3}

    \PY{k}{def} \PY{n+nf}{reference\PYZus{}density}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{k}{return} \PY{l+m+mf}{1.0}

    \PY{k}{def} \PY{n+nf}{initial\PYZus{}conditions}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{l+s+sd}{"""Return initial conditions for displacement field, u0, and}
\PY{l+s+sd}{        velocity field, v0"""}
        \PY{n}{u0} \PY{o}{=} \PY{l+s}{"}\PY{l+s}{twisty.txt}\PY{l+s}{"}
        \PY{n}{v0} \PY{o}{=} \PY{n}{Expression}\PY{p}{(}\PY{p}{(}\PY{l+s}{"}\PY{l+s}{0.0}\PY{l+s}{"}\PY{p}{,} \PY{l+s}{"}\PY{l+s}{0.0}\PY{l+s}{"}\PY{p}{,} \PY{l+s}{"}\PY{l+s}{0.0}\PY{l+s}{"}\PY{p}{)}\PY{p}{)}
        \PY{k}{return} \PY{n}{u0}\PY{p}{,} \PY{n}{v0}

    \PY{k}{def} \PY{n+nf}{dirichlet\PYZus{}conditions}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{n}{clamp} \PY{o}{=} \PY{n}{Expression}\PY{p}{(}\PY{p}{(}\PY{l+s}{"}\PY{l+s}{0.0}\PY{l+s}{"}\PY{p}{,} \PY{l+s}{"}\PY{l+s}{0.0}\PY{l+s}{"}\PY{p}{,} \PY{l+s}{"}\PY{l+s}{0.0}\PY{l+s}{"}\PY{p}{)}\PY{p}{)}
        \PY{k}{return} \PY{p}{[}\PY{n}{clamp}\PY{p}{]}

    \PY{k}{def} \PY{n+nf}{dirichlet\PYZus{}boundaries}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{k}{return} \PY{p}{[}\PY{l+s}{"}\PY{l+s}{x[0] == 0.0}\PY{l+s}{"}\PY{p}{]}

    \PY{k}{def} \PY{n+nf}{material\PYZus{}model}\PY{p}{(}\PY{n+nb+bp}{self}\PY{p}{)}\PY{p}{:}
        \PY{n}{material} \PY{o}{=} \PY{n}{StVenantKirchhoff}\PY{p}{(}\PY{p}{[}\PY{l+m+mf}{3.8461}\PY{p}{,} \PY{l+m+mf}{5.76}\PY{p}{]}\PY{p}{)}
        \PY{k}{return} \PY{n}{material}

\PY{c}{# Setup and solve the problem}
\PY{n}{release} \PY{o}{=} \PY{n}{Release}\PY{p}{(}\PY{p}{)}
\PY{n}{u} \PY{o}{=} \PY{n}{release}\PY{o}{.}\PY{n}{solve}\PY{p}{(}\PY{p}{)}
\end{Verbatim}
