Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces
HarmonicOscillatorModel_decl.hpp File Reference
#include "Thyra_ModelEvaluator.hpp"
#include "Thyra_StateFuncModelEvaluatorBase.hpp"
#include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
#include "Teuchos_ParameterList.hpp"

Go to the source code of this file.


class  Tempus_Test::HarmonicOscillatorModel< Scalar >
 Consider the ODE:

\[ m\ddot{x} + c\dot{x} + kx=f \]

where $k \geq 0$ is a constant, $c$ is a constant damping parameter, $f$ is a constant forcing parameter, and $m>0$ is a constant mass parameter, with initial conditions are:

\begin{eqnarray*} x(0) & = & 0\\ \dot{x}(0) & = & 1 \end{eqnarray*}

It is straight-forward to show that the exact solution to this ODE is:

\begin{eqnarray*} x(t) & = & t(1+0.5\tilde{f}t), \hspace{3.6cm} if \hspace{0.2cm} k = c = 0 \\ & = & \frac{(\tilde{c}-\tilde{f})}{\tilde{c}^2}(1-e^{-\tilde{c}t}) + \frac{f}{c}t, \hspace{1.9cm} if \hspace{0.2cm} k = 0, c\neq 0 \\ & = & \frac{1}{\sqrt{\tilde{k}}}\sin(\sqrt{\tilde{k}}t) + \frac{f}{k}\left(1-\cos(\sqrt{\tilde{k}}t) \right), \hspace{0.2cm} if \hspace{0.2cm} k > 0, c = 0 \end{eqnarray*}

where $\tilde{c}\equiv c/m$, $\tilde{k}\equiv k/m$ and $\tilde{f}\equiv f/m$. While it is possible to derive the solution to this ODE for the case when $k > 0$ and $c \neq 0$, we do not consider that case here. When $c = k = 0$, $m=1$, and $f=-1$, our ODE simplies to a canonical differential equation model of a ball thrown up in the air, with a parabolic trajectory solution, namely

\[ x(t) = t(1-0.5t) \]

where $t\in [0,2]$. An EpetraExt version of this simplified version of the test is implemented in Piro::MockModelEval_B (see Trilinos/packages/piro/test), where it is used to test the Piro (EpetraExt) Newmark-Beta scheme (see input_Solver_NB.xml input file). When $c = f = 0$ and $m=k = 1$, this test is equivalent to the SinCos model.. More...