Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
Example 2: Use ModelEvaluator

This example moves the van der Pol model into a Thyra::ModelEvaluator. The time integration loop still performs a hand-written Forward Euler update, but the right-hand side evaluation and nominal initial conditions are now obtained through the model interface.

The main purpose of this step is to separate the problem physics from the time integration algorithm.

Relative to Example 1: Utilize Thyra:

  • the problem physics are encapsulated in a Thyra::ModelEvaluator, VanDerPol_ModelEvaluator_02
  • initial conditions are obtained from getNominalValues()
  • right-hand-side evaluation is performed through evalModel()
  • the application begins to separate the model definition from the time integration logic

Thyra::ModelEvaluator provides a common Trilinos interface between application models and abstract numerical algorithms. For Tempus, this interface is the standard mechanism for exposing governing equations to steppers and integrators.

This example focuses only on the subset of Thyra::ModelEvaluator behavior needed for explicit first-order ODEs.


Transition notes
See Transition from Example 1 to Example 2 for a detailed explanation of what changed from Example 1: Utilize Thyra.

← Previous Example | Tutorial Overview | Next Example →