|
NEML2 2.0.0
|
Recall that the complete model for simulating the projectile trajectory is
\begin{align} \dot{\boldsymbol{x}} & = \boldsymbol{v}, \label{1} \\ \dot{\boldsymbol{v}} & = \boldsymbol{a} = \boldsymbol{g} - \mu \boldsymbol{v}, \label{2} \\ \mathbf{r} = & = \begin{Bmatrix} \tilde{\boldsymbol{x}} - \boldsymbol{x}_n - \left(t - t_n\right) \dot{\boldsymbol{x}} \\ \tilde{\boldsymbol{v}} - \boldsymbol{v}_n - \left(t - t_n\right) \dot{\boldsymbol{v}} \\ \end{Bmatrix}, \label{3} \\ \begin{Bmatrix} \boldsymbol{x} \\ \boldsymbol{v} \end{Bmatrix} & = \mathop{\mathrm{root}}\limits_{\tilde{\boldsymbol{x}}, \tilde{\boldsymbol{v}}} \left( \mathbf{r} \right), \label{4} \end{align}
subject to appropriate initial conditions \(\boldsymbol{x}_0\) and \(\boldsymbol{v}_0\)
Among these equations:
ProjectileAcceleration which we have implemented in previous tutorials.This tutorial demonstrates that our custom model ProjectileAcceleration can be composed with other existing, predefined NEML2 models.
The following input file composes the constitutive model for a single-step update for 5 projectiles each with a different dynamic viscosity, i.e., the shape of "mu" is \((5;)\).
To obtain the entire trajectory, the constitutive model need to be recursively integrated. As discussed in a previous tutorial, a transient driver should be used to perform the recursive constitutive update. Conveniently, in this example, since we are dealing with an autonomous system (i.e., no external "forces" are needed to drive the constitutive update), the vanilla TransientDriver can be used:
The five projectiles are launched from the same position (the origin) but with two different lauching velocities. Note how broadcasting is used to simultaneously simulate the trajectories of all 10 combinations.
Output @list-output:ex1
The following Python script plots the trajectories loaded from "result.pt" written by the driver.