The primary goal of Example 2: Use ModelEvaluator is to move the van der Pol problem definition into a Thyra::ModelEvaluator while preserving the same Thyra vector-based state representation, the same hand-written Forward Euler stepping logic, the same simple tabular output, and the same regression workflow used in Example 1: Utilize Thyra.
provides a standard Trilinos interface for evaluating the application model
getNominalValues()
provides nominal initial conditions from the model
Thyra::ModelEvaluatorBase::InArgs
supplies model inputs such as time and state
Thyra::ModelEvaluatorBase::OutArgs
receives model outputs such as the right-hand side
evalModel()
evaluates the model using the supplied input and output arguments
This is the first step in separating the problem physics from the time integration algorithm. Rather than evaluating the right-hand side directly in the application, the code now requests that evaluation through a common model interface. This is a key part of how Tempus steppers and integrators interact with application models.
The application still controls the time loop directly.
The output table still reports the step index, time, , and .
The regression check follows the same pattern.
Selected code excerpts
The code excerpts below highlight the main changes needed to move from direct application-level right-hand-side evaluation to the use of a Thyra::ModelEvaluator.
Construct the model
Construct a ModelEvaluator. The application now creates an object that represents the problem model.
From the packages/tempus directory, a focused comparison of the main time-integration logic between these two examples can be generated locally in bash or zsh with: